Class Reference for E1039 Core & Analysis Software
TriggerAnalyzer.h
Go to the documentation of this file.
1 #ifndef _TRIGGERANALYZER_H
2 #define _TRIGGERANALYZER_H
3 
4 #include <iostream>
5 #include <vector>
6 #include <list>
7 #include <string>
8 #include <set>
9 #include <map>
10 
11 #include <TROOT.h>
12 #include <TFile.h>
13 #include <TTree.h>
14 
15 #include "TriggerRoad.h"
16 #include "SRawEvent.h"
17 
18 #include <geom_svc/GeomSvc.h>
19 
20 typedef std::vector<std::set<int> > DataMatrix;
21 
22 class SQTNode
23 {
24 public:
25  //constructor
26  SQTNode(int uID);
27 
28  //add child
29  void add(SQTNode* child);
30 
31 public:
32  int uniqueID;
33  std::list<SQTNode*> children;
34 };
35 
37 {
38 public:
41 
42  //initialization
43  bool init(std::string fileName, double cut_td = 0., double cut_gun = 1E8); //init by root files
44  bool init(); //init by ascii file in the same directory
45  //void filterRoads(double cut_td, double cut_gun);
46  void makeRoadPairs();
47 
48  //Accept a event
49  bool acceptEvent(TriggerRoad& p_road, TriggerRoad& m_road);
50  bool acceptEvent(int nHits, int detectorIDs[], int elementIDs[]);
51  bool acceptEvent(SRawEvent* rawEvent, bool USE_TRIGGER_HIT, bool USE_HIT);
52 
53  //Trim a event's hodoscope hits
54  void trimEvent(SRawEvent* rawEvent, std::list<Hit>& hitlist, bool USE_TRIGGER_HIT, bool USE_HIT);
55 
56  //Get the road list of +/-
57  std::map<int, TriggerRoad>& getRoadsAll(int charge) { return roads[(-charge+1)/2]; }
58  std::map<int, TriggerRoad>& getRoadsEnabled(int charge) { return roads_enabled[(-charge+1)/2]; }
59  std::map<int, TriggerRoad>& getRoadsDisabled(int charge) { return roads_disabled[(-charge+1)/2]; }
60  std::list<TriggerRoad>& getRoadsFound(int charge) { return roads_found[(-charge+1)/2]; }
61 
62 
63  int getNRoadsPosTop() { return nRoads[0][0]; }
64  int getNRoadsPosBot() { return nRoads[0][1]; }
65  int getNRoadsNegTop() { return nRoads[1][0]; }
66  int getNRoadsNegBot() { return nRoads[1][1]; }
67 
68  //Build prefix tree
69  void buildTriggerTree();
70 
71  //Build data
72  bool buildData(int nHits, int detectorIDs[], int elementIDs[]);
73 
74  //find all possible matched road in data
75  void search(SQTNode* root, DataMatrix& data, int level, int charge);
76 
77  //print/clear prefix tree
78  void print(int charge) { roads_temp.clear(); printTree(root[(-charge+1)/2]); }
79  void clear(int charge) { roads_temp.clear(); clearTree(root[(-charge+1)/2]); }
80 
81  void printTree(SQTNode* root);
82  void clearTree(SQTNode* root);
83 
84  void printRoadFound();
85  void printData(DataMatrix& data);
86 
87  //Output the road selected and road pair selection
88  void outputEnabled();
89 
90 private:
91  //Pointer to Geometry
92  GeomSvc* p_geomSvc;
93 
94  //Single muon roads
95  std::map<int, TriggerRoad> roads[2];
96  std::map<int, TriggerRoad> roads_enabled[2];
97  std::map<int, TriggerRoad> roads_disabled[2];
98 
99  //Counters of single roads
100  int nRoads[2][2]; //first index stands for +/-, second stands for top/bottom
101 
102  //Dimuon road pairs (accepted groupID pairs)
103  std::list<Trigger> triggers;
104 
105  //Internal hit pattern structure
106  DataMatrix data;
107 
108  //root node of the trigger tree for mu+/-
109  SQTNode* root[2];
110 
111  //container of roads found
112  std::list<TriggerRoad> roads_found[2];
113 
114  //temporary container of uniqueIDs found
115  std::list<int> roads_temp;
116 
117  //Trigger hodos --- hodo station that are used in trigger
118  std::vector<int> detectorIDs_trigger;
119 };
120 
121 #endif
std::vector< std::set< int > > DataMatrix
User interface class about the geometry of detector planes.
Definition: GeomSvc.h:164
std::list< SQTNode * > children
SQTNode(int uID)
void add(SQTNode *child)
void search(SQTNode *root, DataMatrix &data, int level, int charge)
bool buildData(int nHits, int detectorIDs[], int elementIDs[])
void printData(DataMatrix &data)
void print(int charge)
std::list< TriggerRoad > & getRoadsFound(int charge)
void printTree(SQTNode *root)
std::map< int, TriggerRoad > & getRoadsDisabled(int charge)
void clear(int charge)
void trimEvent(SRawEvent *rawEvent, std::list< Hit > &hitlist, bool USE_TRIGGER_HIT, bool USE_HIT)
void clearTree(SQTNode *root)
std::map< int, TriggerRoad > & getRoadsEnabled(int charge)
bool acceptEvent(TriggerRoad &p_road, TriggerRoad &m_road)
std::map< int, TriggerRoad > & getRoadsAll(int charge)