StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTriggerId.h
1 /***************************************************************************
2  *
3  * $Id: StTriggerId.h,v 2.8 2011/02/02 20:26:30 ullrich Exp $
4  *
5  * Author: Thomas Ullrich, January 2003
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StTriggerId.h,v $
13  * Revision 2.8 2011/02/02 20:26:30 ullrich
14  * Switched data member type of mask from uint64_t to ULong64_t
15  *
16  * Revision 2.7 2011/02/02 20:20:10 ullrich
17  * Extend to 64 bit (Jamie)
18  *
19  * Revision 2.6 2006/05/04 19:07:02 ullrich
20  * Extended mMaxTriggerIds to 42.
21  *
22  * Revision 2.5 2004/10/11 23:00:20 ullrich
23  * Add copy constructor and assign. op., implement ostream op., define to enum.
24  *
25  * Revision 2.4 2003/09/02 17:58:06 perev
26  * gcc 3.2 updates + WarnOff
27  *
28  * Revision 2.3 2003/02/18 22:19:58 jeromel
29  * Skip mIdx
30  *
31  * Revision 2.2 2003/02/18 21:34:46 jeromel
32  * Changed vector to arrays
33  *
34  * Revision 2.1 2003/01/30 18:14:15 ullrich
35  * Initial Revision.
36  *
37  **************************************************************************/
38 #ifndef StTriggerId_hh
39 #define StTriggerId_hh
40 #include "StObject.h"
41 #include <Stiostream.h>
42 #include <vector>
43 #include <stdint.h>
44 
45 class StTriggerId : public StObject {
46 public:
47  StTriggerId();
48  StTriggerId(const StTriggerId &id);
49  const StTriggerId &operator=(const StTriggerId &id);
50  ~StTriggerId();
51 
52  uint64_t mask() const;
53 
54  unsigned int maxTriggerIds() const;
55  bool isTrigger(unsigned int id) const;
56 
57  unsigned int version(unsigned int id) const;
58  unsigned int nameVersion(unsigned int id) const;
59  unsigned int thresholdVersion(unsigned int id) const;
60  unsigned int prescaleVersion(unsigned int id) const;
61 
62  unsigned int triggerId(const int idx) const;
63  vector<unsigned int> triggerIds() const;
64 
65 
66  void setMask(uint64_t);
67  void addTrigger(unsigned int, unsigned int,
68  unsigned int, unsigned int, unsigned int);
69 
70  friend ostream& operator<<(ostream&, const StTriggerId&);
71 
72 private:
73  unsigned int index(unsigned int) const;
74 
75 protected:
76  enum {mMaxTriggerIds = 64};
77 
78 private:
79  UInt_t mIdx;
80  ULong64_t mMask;
81  UInt_t mId[mMaxTriggerIds];
82  UInt_t mVersion[mMaxTriggerIds];
83  UInt_t mNameVersion[mMaxTriggerIds];
84  UInt_t mThresholdVersion[mMaxTriggerIds];
85  UInt_t mPrescaleVersion[mMaxTriggerIds];
86 
87  ClassDef(StTriggerId,5)
88 };
89 
90 inline unsigned int
91 StTriggerId::maxTriggerIds() const {return mMaxTriggerIds;}
92 
93 inline unsigned int
94 StTriggerId::triggerId(const int idx) const
95 {
96  if (idx>=0 && idx<mMaxTriggerIds)
97  return mId[idx];
98  else
99  return 0;
100 }
101 
102 #endif