StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TCU_2009.hh
1 //
2 // Pibero Djawotho <pibero@comp.tamu.edu>
3 // Texas A&M University Cyclotron Institute
4 // 7 Jan 2009
5 //
6 
7 #ifndef TCU_2009_HH
8 #define TCU_2009_HH
9 
11 
12 #include <string>
13 #include <vector>
14 #include <map>
15 
16 using namespace std;
17 
18 #ifdef __ROOT__
19 #include "RTS/trg/include/trgDataDefs_46.h"
20 #include "RTS/trg/include/trgConfNum.h"
21 #else
22 #include "trgDataDefs_46.h"
23 #include "trgConfNum.h"
24 #endif
25 
26 class TCU_2009 {
27 public:
28  TCU_2009();
29 
30  unsigned short bits() const { return mDSMInput; }
31  void read(const TriggerDataBlk& event);
32  void read(const DSMLayer_LD301_2009& layer);
33  void update();
34  bool isTrigger(int triggerId) const;
35  int numberOfTriggers() const;
36  string triggerName(int triggerId) const;
37  void getTriggerMasks(int triggerId, vector<int>& masks) const;
38  int barrelJetPatchBits(int triggerId) const;
39  int endcapJetPatchBits(int triggerId) const;
40  int emcJetPatchBits(int triggerId) const;
41  void dump() const;
42 
43 private:
44  typedef map<int, pair<string, int> >::const_iterator MapIterator;
45 
46  void defineTrigger(const char* name, int id, int mask);
47  int triggerId(const MapIterator& i) const { return i->first; }
48  string triggerName(const MapIterator& i) const { return i->second.first; }
49  int triggerMask(const MapIterator& i) const { return i->second.second; }
50  bool isTrigger(const MapIterator& i) const;
51 
52  unsigned short mDSMInput; // from trigger data
53  unsigned short mTCUInput; // from simulation
54  multimap<int, pair<string, int> > mTriggers;
55 };
56 
57 inline bool TCU_2009::isTrigger(const MapIterator& i) const
58 {
59  int mask = triggerMask(i);
60  return (mTCUInput & mask) == mask;
61 }
62 
63 #endif // TCU_2009_HH