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