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,
42 {
43 
44  messageCounter_=message_counter;
45  indexCounter_=index_counter;
46  reelCounter_=reel_counter;
47  timestamp1_sec_=timestamp1_sec;
48  timestamp1_usec_=timestamp1_usec;
49  timestamp2_sec_=timestamp2_sec;
50  timestamp2_usec_=timestamp2_usec;
51  status_=status;
52  motorCurrent_=motor_current;
53  motorVoltage_=motor_voltage;
54  driverId_=driver_id;
55  sourceId_=source_id;
56  tubeNameFromCoord_=tubeNameFromCoord;
57  tubeDescriptionFromSD_=tubeDescFromSD;
58  lastCommand_=lastCommand;
59  message_=message;
60 }
61 
62 void HcalSourcePositionData::getDriverTimestamp(int& seconds, int& useconds) const{
63  seconds=timestamp1_sec_;
64  useconds=timestamp1_usec_;
65 }
66 
67 void HcalSourcePositionData::getDAQTimestamp(int& seconds, int& useconds) const{
68  seconds=timestamp2_sec_;
69  useconds=timestamp2_usec_;
70 }
71 
72 ostream& operator<<(ostream& s, const HcalSourcePositionData& hspd) {
73 
74  s << " Message Counter =" << hspd.messageCounter() << endl;
75  s << " Index Counter =" << hspd.indexCounter() << endl;
76  s << " Reel Counter =" << hspd.reelCounter() << endl;
77  s << " Status =" << hex << hspd.status() << dec << endl;
78  s << " Motor Current =" << hspd.motorCurrent() << endl;
79  s << " Motor Voltage =" << hspd.motorVoltage() << endl;
80  s << " Tube Id =" << hspd.tubeId() << endl;
81  s << " Driver Id =" << hspd.driverId() << endl;
82  s << " Source Id =" << hspd.sourceId() << endl;
83  s << " TubeNameFromCoord =" << hspd.tubeNameFromCoord() << endl;
84  s << " TubeDescriptionFromSD =" << hspd.tubeDescriptionFromSD() << endl;
85  s << " Last Command =" << hspd.lastCommand() << endl;
86  s << " Message =" << hspd.message() << endl;
87 
88  int timebase =0; int timeusec=0;
89  hspd.getDriverTimestamp(timebase,timeusec);
90  // trim seconds off of usec and add to base
91  timeusec %= 1000000;
92  timebase += timeusec/1000000;
93  char str[50];
94  sprintf(str, " Driver Timestamp : %s", ctime((time_t *)&timebase));
95  s << str;
96  timebase=0; timeusec=0;
97  hspd.getDAQTimestamp(timebase,timeusec);
98  timeusec %= 1000000;
99  timebase += timeusec/1000000;
100 
101  sprintf(str, " DAQ Timestamp : %s", ctime((time_t *)&timebase));
102  s << str;
103 
104  return s;
105 }
double seconds()
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)
ostream & operator<<(std::ostream &o, vector< std::string > const &iValue)
Definition: refresh.cc:45
std::string tubeNameFromCoord() const
std::string tubeDescriptionFromSD() const
std::string lastCommand() const
void getDriverTimestamp(int &seconds, int &useconds) const
void getDAQTimestamp(int &seconds, int &useconds) const
std::string message() const