CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DcsStatus.cc
Go to the documentation of this file.
1 /*
2  * File: DataFormats/Scalers/src/DcsStatus.cc (W.Badgett)
3  */
4 
7 #include <cstdio>
8 #include <ostream>
9 
11  EBp ,
12  EBm ,
13  EEp ,
14  EEm ,
15  HBHEa ,
16  HBHEb ,
17  HBHEc ,
18  HF ,
19  HO ,
20  RPC ,
21  DT0 ,
22  DTp ,
23  DTm ,
24  CSCp ,
25  CSCm ,
26  CASTOR ,
27  ZDC ,
28  TIBTID ,
29  TOB ,
30  TECp ,
31  TECm ,
32  BPIX ,
33  FPIX ,
34  ESp ,
35  ESm };
36 
38  "EBp" ,
39  "EBm" ,
40  "EEp" ,
41  "EEm" ,
42  "HBHEa" ,
43  "HBHEb" ,
44  "HBHEc" ,
45  "HF" ,
46  "HO" ,
47  "RPC" ,
48  "DT0" ,
49  "DTp" ,
50  "DTm" ,
51  "CSCp" ,
52  "CSCm" ,
53  "CASTOR" ,
54  "ZDC" ,
55  "TIBTID" ,
56  "TOB" ,
57  "TECp" ,
58  "TECm" ,
59  "BPIX" ,
60  "FPIX" ,
61  "ESp" ,
62  "ESm" };
63 
65  trigType_(0),
66  eventID_(0),
67  sourceID_(0),
68  bunchNumber_(0),
69  version_(0),
70  collectionTime_(0,0),
71  ready_(0),
72  magnetCurrent_((float)0.0),
73  magnetTemperature_((float)0.0)
74 {
75 }
76 
77 DcsStatus::DcsStatus(const unsigned char * rawData)
78 {
79  DcsStatus();
80 
82  = (struct ScalersEventRecordRaw_v4 *)rawData;
83  trigType_ = ( raw->header >> 56 ) & 0xFULL;
84  eventID_ = ( raw->header >> 32 ) & 0x00FFFFFFULL;
85  sourceID_ = ( raw->header >> 8 ) & 0x00000FFFULL;
86  bunchNumber_ = ( raw->header >> 20 ) & 0xFFFULL;
87 
88  version_ = raw->version;
89  if ( version_ >= 4 )
90  {
91  collectionTime_.set_tv_sec(static_cast<long>(raw->dcsStatus.collectionTime_sec));
93  ready_ = raw->dcsStatus.ready;
96  }
97 }
98 
100 
101 
103 std::ostream& operator<<(std::ostream& s, const DcsStatus& c)
104 {
105  char zeit[128];
106  char line[128];
107  struct tm * hora;
108 
109  s << "DcsStatus Version: " << c.version() <<
110  " SourceID: "<< c.sourceID() << std::endl;
111 
112  timespec ts = c.collectionTime();
113  hora = gmtime(&ts.tv_sec);
114  strftime(zeit, sizeof(zeit), "%Y.%m.%d %H:%M:%S", hora);
115  sprintf(line, " CollectionTime: %s.%9.9d", zeit,
116  (int)ts.tv_nsec);
117  s << line << std::endl;
118 
119  sprintf(line, " TrigType: %d EventID: %d BunchNumber: %d",
120  c.trigType(), c.eventID(), c.bunchNumber());
121  s << line << std::endl;
122 
123  sprintf(line," MagnetCurrent: %e MagnetTemperature: %e",
125  s << line << std::endl;
126 
127  sprintf(line," Ready: %d 0x%8.8X", c.ready(), c.ready());
128  s << line << std::endl;
129 
130  for ( int i=0; i<DcsStatus::nPartitions; i++)
131  {
133  {
134  sprintf(line," %2d %6s: READY", i, DcsStatus::partitionName[i]);
135  }
136  else
137  {
138  sprintf(line," %2d %6s: NOT READY", i, DcsStatus::partitionName[i]);
139  }
140  s << line << std::endl;
141  }
142  return s;
143 }
unsigned int trigType() const
Definition: DcsStatus.h:76
int i
Definition: DBlmapReader.cc:9
static const char * partitionName[]
Definition: DcsStatus.h:33
timespec collectionTime() const
Definition: DcsStatus.h:82
unsigned int bunchNumber_
Definition: DcsStatus.h:103
void set_tv_nsec(long value)
Definition: TimeSpec.h:27
virtual ~DcsStatus()
Definition: DcsStatus.cc:99
unsigned int bunchNumber() const
Definition: DcsStatus.h:79
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
float magnetTemperature() const
Definition: DcsStatus.h:90
unsigned int eventID_
Definition: DcsStatus.h:101
unsigned long long header
Definition: ScalersRaw.h:217
int version() const
Definition: DcsStatus.h:81
unsigned int ready() const
Definition: DcsStatus.h:84
int version_
Definition: DcsStatus.h:105
unsigned int sourceID() const
Definition: DcsStatus.h:78
unsigned int ready
Definition: ScalersRaw.h:178
unsigned int collectionTime_sec
Definition: ScalersRaw.h:176
#define BPIX
unsigned int trigType_
Definition: DcsStatus.h:100
unsigned int ready_
Definition: DcsStatus.h:108
TimeSpec collectionTime_
Definition: DcsStatus.h:107
unsigned int sourceID_
Definition: DcsStatus.h:102
float magnetCurrent
Definition: ScalersRaw.h:179
unsigned int collectionTime_nsec
Definition: ScalersRaw.h:177
string s
Definition: asciidump.py:422
void set_tv_sec(long value)
Definition: TimeSpec.h:26
float magnetTemperature_
Definition: DcsStatus.h:110
struct DcsStatusRaw_v4 dcsStatus
Definition: ScalersRaw.h:222
float magnetTemperature
Definition: ScalersRaw.h:180
float magnetCurrent() const
Definition: DcsStatus.h:89
unsigned int eventID() const
Definition: DcsStatus.h:77
float magnetCurrent_
Definition: DcsStatus.h:109
static const int partitionList[]
Definition: DcsStatus.h:32