CMS 3D CMS Logo

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