CMS 3D CMS Logo

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