CMS 3D CMS Logo

HcalSourcePositionData.cc
Go to the documentation of this file.
2 #include <cstdio>
3 
4 using namespace std;
5 
7  messageCounter_ = 0;
8  indexCounter_ = 0;
9  reelCounter_ = 0;
10  timestamp1_sec_ = 0;
11  timestamp1_usec_ = 0;
12  timestamp2_sec_ = 0;
13  timestamp2_usec_ = 0;
14  status_ = 0;
15  motorCurrent_ = 0;
16  motorVoltage_ = 0;
17  tubeId_ = -1;
18  driverId_ = -1;
19  sourceId_ = -1;
20  tubeNameFromCoord_ = "";
21  tubeDescriptionFromSD_ = "";
22  lastCommand_ = "";
23  message_ = "";
24 }
25 
26 void HcalSourcePositionData::set(int message_counter,
27  int timestamp1_sec,
28  int timestamp1_usec,
29  int timestamp2_sec,
30  int timestamp2_usec,
31  int status,
32  int index_counter,
33  int reel_counter,
34  int motor_current,
35  int motor_voltage,
36  int driver_id,
37  int source_id,
38  std::string tubeNameFromCoord,
39  std::string tubeDescFromSD,
40  std::string lastCommand,
41  std::string message) {
42  messageCounter_ = message_counter;
43  indexCounter_ = index_counter;
44  reelCounter_ = reel_counter;
45  timestamp1_sec_ = timestamp1_sec;
46  timestamp1_usec_ = timestamp1_usec;
47  timestamp2_sec_ = timestamp2_sec;
48  timestamp2_usec_ = timestamp2_usec;
49  status_ = status;
50  motorCurrent_ = motor_current;
51  motorVoltage_ = motor_voltage;
52  driverId_ = driver_id;
53  sourceId_ = source_id;
54  tubeNameFromCoord_ = tubeNameFromCoord;
55  tubeDescriptionFromSD_ = tubeDescFromSD;
56  lastCommand_ = lastCommand;
57  message_ = message;
58 }
59 
60 void HcalSourcePositionData::getDriverTimestamp(int& seconds, int& useconds) const {
61  seconds = timestamp1_sec_;
62  useconds = timestamp1_usec_;
63 }
64 
65 void HcalSourcePositionData::getDAQTimestamp(int& seconds, int& useconds) const {
66  seconds = timestamp2_sec_;
67  useconds = timestamp2_usec_;
68 }
69 
70 ostream& operator<<(ostream& s, const HcalSourcePositionData& hspd) {
71  s << " Message Counter =" << hspd.messageCounter() << endl;
72  s << " Index Counter =" << hspd.indexCounter() << endl;
73  s << " Reel Counter =" << hspd.reelCounter() << endl;
74  s << " Status =" << hex << hspd.status() << dec << endl;
75  s << " Motor Current =" << hspd.motorCurrent() << endl;
76  s << " Motor Voltage =" << hspd.motorVoltage() << endl;
77  s << " Tube Id =" << hspd.tubeId() << endl;
78  s << " Driver Id =" << hspd.driverId() << endl;
79  s << " Source Id =" << hspd.sourceId() << endl;
80  s << " TubeNameFromCoord =" << hspd.tubeNameFromCoord() << endl;
81  s << " TubeDescriptionFromSD =" << hspd.tubeDescriptionFromSD() << endl;
82  s << " Last Command =" << hspd.lastCommand() << endl;
83  s << " Message =" << hspd.message() << endl;
84 
85  int timebase = 0;
86  int timeusec = 0;
87  hspd.getDriverTimestamp(timebase, timeusec);
88  // trim seconds off of usec and add to base
89  timeusec %= 1000000;
90  timebase += timeusec / 1000000;
91  char str[50];
92  sprintf(str, " Driver Timestamp : %s", ctime((time_t*)&timebase));
93  s << str;
94  timebase = 0;
95  timeusec = 0;
96  hspd.getDAQTimestamp(timebase, timeusec);
97  timeusec %= 1000000;
98  timebase += timeusec / 1000000;
99 
100  sprintf(str, " DAQ Timestamp : %s", ctime((time_t*)&timebase));
101  s << str;
102 
103  return s;
104 }
HcalSourcePositionData
Definition: HcalSourcePositionData.h:8
mps_update.status
status
Definition: mps_update.py:69
HcalSourcePositionData::sourceId
int sourceId() const
Definition: HcalSourcePositionData.h:22
HcalSourcePositionData::getDAQTimestamp
void getDAQTimestamp(int &seconds, int &useconds) const
Definition: HcalSourcePositionData.cc:65
HcalSourcePositionData::messageCounter
int messageCounter() const
Definition: HcalSourcePositionData.h:13
HcalSourcePositionData::indexCounter
int indexCounter() const
Definition: HcalSourcePositionData.h:15
HcalSourcePositionData::message
std::string message() const
Definition: HcalSourcePositionData.h:26
HcalSourcePositionData::tubeId
int tubeId() const
Definition: HcalSourcePositionData.h:20
std::operator<<
std::ostream & operator<<(std::ostream &out, const std::tuple< Types... > &value)
Definition: Utilities.h:32
alignCSCRings.s
s
Definition: alignCSCRings.py:92
seconds
double seconds()
str
#define str(s)
Definition: TestProcessor.cc:52
HcalSourcePositionData::lastCommand
std::string lastCommand() const
Definition: HcalSourcePositionData.h:25
HcalSourcePositionData::tubeDescriptionFromSD
std::string tubeDescriptionFromSD() const
Definition: HcalSourcePositionData.h:24
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalSourcePositionData::set
void set(int message_counter, int timestamp1_sec, int timestamp1_usec, int timestamp2_sec, int timestamp2_usec, int status, int index_counter, int reel_counter, int motor_current, int motor_voltage, int driver_id, int source_id, std::string tubeNameFromCoord, std::string tubeDescFromSD, std::string lastCommand, std::string message)
Definition: HcalSourcePositionData.cc:26
HcalSourcePositionData::reelCounter
int reelCounter() const
Definition: HcalSourcePositionData.h:16
HcalSourcePositionData::getDriverTimestamp
void getDriverTimestamp(int &seconds, int &useconds) const
Definition: HcalSourcePositionData.cc:60
HcalSourcePositionData::HcalSourcePositionData
HcalSourcePositionData()
Definition: HcalSourcePositionData.cc:6
std
Definition: JetResolutionObject.h:76
HcalSourcePositionData::motorVoltage
int motorVoltage() const
Definition: HcalSourcePositionData.h:19
HcalSourcePositionData.h
HcalSourcePositionData::motorCurrent
int motorCurrent() const
Definition: HcalSourcePositionData.h:17
HcalSourcePositionData::driverId
int driverId() const
Definition: HcalSourcePositionData.h:21
HcalSourcePositionData::status
int status() const
Definition: HcalSourcePositionData.h:14
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HcalSourcePositionData::tubeNameFromCoord
std::string tubeNameFromCoord() const
Definition: HcalSourcePositionData.h:23