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 
8 #include "boost/cstdint.hpp"
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 uint32_t GetEventNumberFromBuffer(const unsigned char *databuffer);
28  static uint32_t GetRunNumberFromBuffer(const unsigned char *databuffer);
29  static std::string utcTime(uint64_t t);
30  static std::string locTime(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_;};
39  uint32_t orbitNumber() const { return orbitNumber_;};
40 
41  int version() const { return versionNumber_; } ;
42  int sourceID() const { return sourceID_; };
43 
44  int daqPartition() const { return daqPartition_; };
45 
46  uint32_t triggerInputStatus() const { return trigInputStat_; };
47  uint32_t triggerInhibitNumber() const { return trigInhibitNumber_; };
48 
49  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
88  uint32_t orbitNumber_; // 32 bits
89 
90  int versionNumber_; // 8 bits - Slink data version number
91 
92  int daqPartition_; // 4 bits
93 
94  uint32_t eventNumber_; // 32 bits
95  // same as event number up to resets
96  uint32_t trigInputStat_; // 32 bits
97  uint32_t trigInhibitNumber_; // 32 bits
98  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
static std::string locTime(uint64_t t)
Definition: LTCDigi.cc:110
unsigned int eventID() const
Definition: LTCDigi.h:35
unsigned int ramTrigger() const
Definition: LTCDigi.h:56
static uint32_t GetRunNumberFromBuffer(const unsigned char *databuffer)
Definition: LTCDigi.cc:44
int sourceID() const
Definition: LTCDigi.h:42
unsigned int bunchNumber_
Definition: LTCDigi.h:87
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
uint32_t orbitNumber() const
Definition: LTCDigi.h:39
uint32_t eventNumber_
Definition: LTCDigi.h:94
unsigned int runNumber_
Definition: LTCDigi.h:83
unsigned int trigType_
Definition: LTCDigi.h:80
unsigned int vmeTrigger() const
Definition: LTCDigi.h:52
bool HasTriggered(int i) const
Definition: LTCDigi.h:71
unsigned int sourceID_
Definition: LTCDigi.h:85
unsigned int bunchNumber() const
Definition: LTCDigi.h:38
static std::string utcTime(uint64_t t)
Definition: LTCDigi.cc:99
uint64_t bstGpsTime_
Definition: LTCDigi.h:98
uint32_t orbitNumber_
Definition: LTCDigi.h:88
unsigned char cyclicTriggerMask() const
Definition: LTCDigi.h:64
int version() const
Definition: LTCDigi.h:41
uint32_t triggerInputStatus() const
Definition: LTCDigi.h:46
std::vector< LTCDigi > LTCDigiCollection
Definition: LTCDigi.h:107
uint32_t trigInhibitNumber_
Definition: LTCDigi.h:97
uint64_t bstGpsTime() const
Definition: LTCDigi.h:49
unsigned long long uint64_t
Definition: Time.h:15
uint32_t triggerInhibitNumber() const
Definition: LTCDigi.h:47
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
int versionNumber_
Definition: LTCDigi.h:90
uint32_t trigInputStat_
Definition: LTCDigi.h:96
static uint32_t GetEventNumberFromBuffer(const unsigned char *databuffer)
Definition: LTCDigi.cc:36
LTCDigi()
Definition: LTCDigi.h:21
unsigned int runNumber() const
Definition: LTCDigi.h:36
unsigned int eventNumber() const
Definition: LTCDigi.h:34
unsigned char externTriggerMask() const
Definition: LTCDigi.h:60