CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LTCDigi.h
Go to the documentation of this file.
1 #ifndef DataFormats_LTCDigi_h
2 #define DataFormats_LTCDigi_h
3 
4 #include <vector>
5 #include <ostream>
6 #include <string>
7 
9 
16 class LTCDigi
17 {
18  public:
19  // need a default constructor!
20  LTCDigi() {}
21  LTCDigi(const unsigned char* data);
22 
23  // STATIC functions
24  // These are to allow the event builder to grab the run number
25  // from a butter it knows points at LTC data.
26  static cms_uint32_t GetEventNumberFromBuffer(const unsigned char *databuffer);
27  static cms_uint32_t GetRunNumberFromBuffer(const unsigned char *databuffer);
30 
31  // right now these are just silly but maybe if we pack the internals
32  // then this won't seem as silly
33  unsigned int eventNumber() const { return eventNumber_; };
34  unsigned int eventID() const { return eventID_; };
35  unsigned int runNumber() const { return runNumber_; };
36 
37  unsigned int bunchNumber() const { return bunchNumber_;};
39 
40  int version() const { return versionNumber_; } ;
41  int sourceID() const { return sourceID_; };
42 
43  int daqPartition() const { return daqPartition_; };
44 
47 
48  cms_uint64_t bstGpsTime() const { return bstGpsTime_;};
49 
50  unsigned int bxMask() const { return ((triggerInputStatus()>>28)&0x1); } ;
51  unsigned int vmeTrigger() const
52  {
53  return ((triggerInputStatus()>>27)&0x1);
54  } ;
55  unsigned int ramTrigger() const
56  {
57  return ((triggerInputStatus()>>26)&0x1);
58  } ;
59  unsigned char externTriggerMask() const // six bits
60  {
61  return ((triggerInputStatus()>>20)&0x3FU);
62  } ;
63  unsigned char cyclicTriggerMask() const // six bits
64  {
65  return (triggerInputStatus()&0x3FU);
66  } ;
67 
68 
69 
70  bool HasTriggered( int i ) const {
71  if ( i > 5 ) return false; // throw exception?
72  return ((externTriggerMask()&(0x1U<<i))!=0);
73  }
74 
75 
76 
77  private:
78  // unpacked for now
79  unsigned int trigType_; // 4 bits
80 
81  unsigned int eventID_; // 24 bits
82  unsigned int runNumber_; // 32 bits
83 
84  unsigned int sourceID_; // 12 bits - 0xCBB constant for LTC
85 
86  unsigned int bunchNumber_; // 12 bits
88 
89  int versionNumber_; // 8 bits - Slink data version number
90 
91  int daqPartition_; // 4 bits
92 
94  // same as event number up to resets
97  cms_uint64_t bstGpsTime_; // 64 bits - is standard unix time in seconds
98 
99 
100 
101 };
102 
103 std::ostream & operator<<(std::ostream & stream,
104  const LTCDigi & myDigi);
105 
106 typedef std::vector<LTCDigi> LTCDigiCollection;
107 
108 
109 #endif // DataFormats_LTCDigi_h
int daqPartition_
Definition: LTCDigi.h:91
int i
Definition: DBlmapReader.cc:9
unsigned int eventID() const
Definition: LTCDigi.h:34
unsigned int ramTrigger() const
Definition: LTCDigi.h:55
cms_uint64_t bstGpsTime() const
Definition: LTCDigi.h:48
int sourceID() const
Definition: LTCDigi.h:41
unsigned int bunchNumber_
Definition: LTCDigi.h:86
cms_uint32_t eventNumber_
Definition: LTCDigi.h:93
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
unsigned int runNumber_
Definition: LTCDigi.h:82
unsigned int trigType_
Definition: LTCDigi.h:79
unsigned int vmeTrigger() const
Definition: LTCDigi.h:51
cms_uint64_t bstGpsTime_
Definition: LTCDigi.h:97
bool HasTriggered(int i) const
Definition: LTCDigi.h:70
unsigned int sourceID_
Definition: LTCDigi.h:84
unsigned int bunchNumber() const
Definition: LTCDigi.h:37
cms_uint32_t trigInputStat_
Definition: LTCDigi.h:95
cms_uint32_t triggerInputStatus() const
Definition: LTCDigi.h:45
unsigned char cyclicTriggerMask() const
Definition: LTCDigi.h:63
int version() const
Definition: LTCDigi.h:40
std::vector< LTCDigi > LTCDigiCollection
Definition: LTCDigi.h:106
unsigned int cms_uint32_t
Definition: typedefs.h:15
static cms_uint32_t GetRunNumberFromBuffer(const unsigned char *databuffer)
Definition: LTCDigi.cc:43
string const
Definition: compareJSON.py:14
int daqPartition() const
Definition: LTCDigi.h:43
unsigned int bxMask() const
Definition: LTCDigi.h:50
unsigned int eventID_
Definition: LTCDigi.h:81
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
cms_uint32_t trigInhibitNumber_
Definition: LTCDigi.h:96
cms_uint32_t orbitNumber() const
Definition: LTCDigi.h:38
int versionNumber_
Definition: LTCDigi.h:89
cms_uint32_t triggerInhibitNumber() const
Definition: LTCDigi.h:46
unsigned long long cms_uint64_t
Definition: typedefs.h:17
LTCDigi()
Definition: LTCDigi.h:20
unsigned int runNumber() const
Definition: LTCDigi.h:35
unsigned int eventNumber() const
Definition: LTCDigi.h:33
static cms_uint32_t GetEventNumberFromBuffer(const unsigned char *databuffer)
Definition: LTCDigi.cc:35
unsigned char externTriggerMask() const
Definition: LTCDigi.h:59
cms_uint32_t orbitNumber_
Definition: LTCDigi.h:87
static std::string locTime(cms_uint64_t t)
Definition: LTCDigi.cc:109
static std::string utcTime(cms_uint64_t t)
Definition: LTCDigi.cc:98