Class Reference for E1039 Core & Analysis Software
TriggerRoad.h
Go to the documentation of this file.
1 #ifndef _TRIGGERROAD_H
2 #define _TRIGGERROAD_H
3 
4 #include <iostream>
5 #include <vector>
6 #include <list>
7 #include <cmath>
8 
9 #include <TObject.h>
10 #include <TROOT.h>
11 #include <TH1D.h>
12 
13 #include "FastTracklet.h"
14 #include "SRecEvent.h"
15 
16 class TriggerRoad : public TObject
17 {
18 public:
20  TriggerRoad(std::list<int> uniqueIDs);
21  TriggerRoad(Tracklet& track);
22  TriggerRoad(SRecTrack& track);
23 
24  //Flag
25  bool isValid();
26  bool isEnabled() { return enabled; }
27 
28  //Get reflection in T/B, LR
31 
32  //Insert a hodo paddle into the road
33  void addElement(int detectorID, int elementID);
34 
35  //Setters
36  void enable() { enabled = true; }
37  void disable() { enabled = false; }
38 
39  //Getters
40  int getNElements() { return detectorIDs.size(); }
41  int getDetectorID(int i) { return detectorIDs[i]; }
42  int getElementID(int i) { return elementIDs[i]; }
43  int getUniqueID(int i) { return detectorIDs[i]*100 + elementIDs[i]; }
44 
45  int getRoadID();
46 
47  //The total weight and ratio of target weight
48  double weight() const { return targetWeight + dumpWeight; }
49  double ratio() const { return targetWeight/(targetWeight + dumpWeight); }
50  double mratio() const { return highMWeight/(lowMWeight + highMWeight); }
51 
52  //Mean and sigma of pX distribution
53  int getNEntries() const { return pXs.size(); }
54  double getpXMean() const;
55  double getpXWidth() const;
56 
57  //T/B , L/R
58  int getTB();
59  int getLR();
60 
61  //counts of mu+, mu-
62  int nPlus;
63  int nMinus;
64 
65  //print
66  void print();
67 
68  //Clear the container
69  void clear();
70 
71  //Overriden operators for comparison and sort
72  bool operator==(const TriggerRoad& elem) const;
73 
74  static bool byTargetDump(const TriggerRoad& elem1, const TriggerRoad& elem2);
75  static bool byWeight(const TriggerRoad& elem1, const TriggerRoad& elem2);
76  static bool byMass(const TriggerRoad& elem1, const TriggerRoad& elem2);
77  static bool byPt(const TriggerRoad& elem1, const TriggerRoad& elem2);
78  static bool byRndFrequency(const TriggerRoad& elem1, const TriggerRoad& elem2);
79 
80  //overload operator +=
81  TriggerRoad& operator+=(const TriggerRoad& elem);
82 
83  //Road maker
84  static std::list<TriggerRoad> makeRoadList(int nHits, int dIDs[], int eIDs[], double z, double mass, double pX, double weight);
85 
86  //overload stream operator <<
87  friend std::ostream& operator << (std::ostream& os, const TriggerRoad& road);
88 
89 public:
90  //Unique road ID
91  int roadID;
92 
93  //Lv1 group ID
94  int groupID;
95 
96  //Weights
97  double targetWeight;
98  double dumpWeight;
99  double lowMWeight;
100  double highMWeight;
101 
102  //pX distributions
103  std::vector<double> pXs;
104  double px_min;
105  double px_max;
106  double px_mean;
107 
108  //Random frequency
109  double rndf;
110 
111  //Flag
112  bool enabled;
113 
114  //hodo paddles
115  std::vector<int> detectorIDs;
116  std::vector<int> elementIDs;
117 
118  ClassDef(TriggerRoad, 2)
119 };
120 
121 typedef std::pair<int, int> Trigger;
122 
123 #endif
std::pair< int, int > Trigger
Definition: TriggerRoad.h:121
static std::list< TriggerRoad > makeRoadList(int nHits, int dIDs[], int eIDs[], double z, double mass, double pX, double weight)
double px_min
Definition: TriggerRoad.h:104
int getNElements()
Definition: TriggerRoad.h:40
std::vector< double > pXs
Definition: TriggerRoad.h:103
double getpXMean() const
double weight() const
Definition: TriggerRoad.h:48
double getpXWidth() const
double highMWeight
Definition: TriggerRoad.h:100
void disable()
Definition: TriggerRoad.h:37
void enable()
Definition: TriggerRoad.h:36
int getElementID(int i)
Definition: TriggerRoad.h:42
double mratio() const
Definition: TriggerRoad.h:50
int getDetectorID(int i)
Definition: TriggerRoad.h:41
int getUniqueID(int i)
Definition: TriggerRoad.h:43
friend std::ostream & operator<<(std::ostream &os, const TriggerRoad &road)
static bool byRndFrequency(const TriggerRoad &elem1, const TriggerRoad &elem2)
TriggerRoad & operator+=(const TriggerRoad &elem)
double px_mean
Definition: TriggerRoad.h:106
double rndf
Definition: TriggerRoad.h:109
static bool byMass(const TriggerRoad &elem1, const TriggerRoad &elem2)
static bool byTargetDump(const TriggerRoad &elem1, const TriggerRoad &elem2)
TriggerRoad reflectLR()
bool isValid()
bool operator==(const TriggerRoad &elem) const
double ratio() const
Definition: TriggerRoad.h:49
int getNEntries() const
Definition: TriggerRoad.h:53
double lowMWeight
Definition: TriggerRoad.h:99
double dumpWeight
Definition: TriggerRoad.h:98
std::vector< int > elementIDs
Definition: TriggerRoad.h:116
TriggerRoad reflectTB()
std::vector< int > detectorIDs
Definition: TriggerRoad.h:115
double targetWeight
Definition: TriggerRoad.h:97
bool isEnabled()
Definition: TriggerRoad.h:26
double px_max
Definition: TriggerRoad.h:105
void addElement(int detectorID, int elementID)
static bool byWeight(const TriggerRoad &elem1, const TriggerRoad &elem2)
static bool byPt(const TriggerRoad &elem1, const TriggerRoad &elem2)