CMS 3D CMS Logo

LTCDigi.cc
Go to the documentation of this file.
2 
3 
4 LTCDigi::LTCDigi(const unsigned char *data)
5 {
6  // six 64 bit words
7  cms_uint64_t const *ld = reinterpret_cast<cms_uint64_t const*>(data);
8 
9  trigType_ = (ld[0]>>56)& 0xFULL; // 4 bits
10 
11  eventID_ = (ld[0]>>32)&0x00FFFFFFULL; // 24 bits
12  runNumber_ = (ld[2]>>32)&0xFFFFFFFFULL; // 32 bits
13  eventNumber_ = (ld[2]) &0xFFFFFFFFULL; // 32 bits
14 
15  sourceID_ = (ld[0]>> 8)&0x00000FFFULL; // 12 bits
16  // this should always be 815?
17  //assert(sourceID_ == 815);
18 
19  bunchNumber_ = (ld[0]>>20)& 0xFFFULL; // 12 bits
20  orbitNumber_ = (ld[1]>>32)&0xFFFFFFFFULL; // 32 bits
21 
22  versionNumber_ = (ld[1]>>24)&0xFFULL; // 8 bits
23 
24  daqPartition_ = (ld[1] )&0xFULL; // 4 bits
25 
26 
27  trigInputStat_ = (ld[3] )&0xFFFFFFFFULL; // 32 bits
28 
29  trigInhibitNumber_ = (ld[3]>>32)&0xFFFFFFFFULL; // 32 bits
30 
31  bstGpsTime_ = ld[4]; // 64 bits
32 
33 }
34 //static
36 {
37  // six 64 bit words
38  cms_uint64_t const *ld = reinterpret_cast<cms_uint64_t const*>(data);
39  cms_uint32_t eventNumber = (ld[2]) &0xFFFFFFFFULL; // 32 bits
40  return eventNumber;
41 }
42 //static
44 {
45  // six 64 bit words
46  cms_uint64_t const *ld = reinterpret_cast<cms_uint64_t const*>(data);
47  cms_uint32_t runNumber = (ld[2]>>32)&0xFFFFFFFFULL; // 32 bits
48  return runNumber;
49 }
50 
51 
52 std::ostream &
53 operator<<(std::ostream & stream, const LTCDigi & myDigi)
54 {
55  stream << "----------------------------------------"<< std::endl;
56  stream << "Dumping LTC digi. " << std::endl;
57  stream << "Source ID: " << myDigi.sourceID() << std::endl;
58  stream << "Run, event: " << myDigi.runNumber()
59  << ", " << myDigi.eventNumber () << std::endl;
60  stream << "N_Inhibit:" << myDigi.triggerInhibitNumber() << std::endl;
61  stream << LTCDigi::utcTime(myDigi.bstGpsTime()) << std::endl;
62  stream << LTCDigi::locTime(myDigi.bstGpsTime()) << std::endl;
64  stream << "Partition: " << myDigi.daqPartition() << std::endl;
65  stream << "Bunch #: " << myDigi.bunchNumber() << std::endl;
66  stream << "Orbit #: " << myDigi.orbitNumber() << std::endl;
67 
68  // Trigger information
69  stream << "Trigger Bits(0-5):" ;
70  for (int i = 0; i < 6; ++i ) {
71  if ( myDigi.HasTriggered(i) )
72  stream << "1";
73  else
74  stream << "0";
75  stream << " ";
76  }
77  stream << std::endl;
78 
79  //
80  stream << "Ram trigger: " << myDigi.ramTrigger() << std::endl;
81  stream << "VME trigger: " << myDigi.vmeTrigger() << std::endl;
82 
83  stream << "++++++++++++++++++++++++++++++++++++++++"<< std::endl;
84 
85  stream << "Raw Data" << std::endl;
86  stream << "Trigger Input status: 0x"
87  << std::hex << myDigi.triggerInputStatus() << std::endl;
88  stream << "GPS time: 0x"
89  << std::hex << myDigi.bstGpsTime() << std::endl;
90 
91  stream << "----------------------------------------"<< std::endl;
92  stream << std::dec << std::endl;
93 
94  return stream;
95 }
96 
97 
99 {
100  // note that gmtime isn't reentrant and we don't own the data
101  time_t tsmall = t/1000000;
102  tm *utct = gmtime(&tsmall);
103  std::string tstr("UTC: ");
104  tstr += asctime(utct);
105  tstr.replace(tstr.find("\n"),tstr.size(), "");
106  return tstr;
107 }
108 
110 {
111  time_t tsmall = t/1000000;
112  std::string a("LOC: ");
113  a+= std::string(ctime(&tsmall));
114  a.replace(a.find("\n"),a.size(), "");
115  return a;
116 }
117 
118 
119 
120 
int daqPartition_
Definition: LTCDigi.h:91
int i
Definition: DBlmapReader.cc:9
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 &stream, const LTCDigi &myDigi)
Definition: LTCDigi.cc:53
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 int cms_uint32_t
Definition: typedefs.h:15
static cms_uint32_t GetRunNumberFromBuffer(const unsigned char *databuffer)
Definition: LTCDigi.cc:43
int daqPartition() const
Definition: LTCDigi.h:43
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
double a
Definition: hdecay.h:121
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
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