CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 }
21 
22 void HcalSourcePositionData::set(int message_counter,
23  int timestamp1_sec,
24  int timestamp1_usec,
25  int timestamp2_sec,
26  int timestamp2_usec,
27  int status,
28  int index_counter,
29  int reel_counter,
30  int motor_current,
31  int motor_voltage,
32  int tube_id,
33  int driver_id,
34  int source_id,
35  std::string tubeNameFromCoord,
36  std::string tubeNameFromSD,
37  std::string lastCommand,
39 {
40 
41  messageCounter_=message_counter;
42  indexCounter_=index_counter;
43  reelCounter_=reel_counter;
44  timestamp1_sec_=timestamp1_sec;
45  timestamp1_usec_=timestamp1_usec;
46  timestamp2_sec_=timestamp2_sec;
47  timestamp2_usec_=timestamp2_usec;
48  status_=status;
49  motorCurrent_=motor_current;
50  motorVoltage_=motor_voltage;
51  tubeId_=tube_id;
52  driverId_=driver_id;
53  sourceId_=source_id;
54  tubeNameFromCoord_=tubeNameFromCoord;
55  tubeNameFromSD_=tubeNameFromSD;
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 
72  s << " Message Counter =" << hspd.messageCounter() << endl;
73  s << " Index Counter =" << hspd.indexCounter() << endl;
74  s << " Reel Counter =" << hspd.reelCounter() << endl;
75  s << " Status =" << hex << hspd.status() << dec << endl;
76  s << " Motor Current =" << hspd.motorCurrent() << endl;
77  s << " Motor Voltage =" << hspd.motorVoltage() << endl;
78  s << " Tube Id =" << hspd.tubeId() << endl;
79  s << " Driver Id =" << hspd.driverId() << endl;
80  s << " Source Id =" << hspd.sourceId() << endl;
81  s << " TubeNameFromCoord =" << hspd.tubeNameFromCoord() << endl;
82  s << " TubeNameFromSD =" << hspd.tubeNameFromSD() << endl;
83  s << " Last Command =" << hspd.lastCommand() << endl;
84  s << " Message =" << hspd.message() << endl;
85 
86  int timebase =0; 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; timeusec=0;
95  hspd.getDAQTimestamp(timebase,timeusec);
96  timeusec %= 1000000;
97  timebase += timeusec/1000000;
98 
99  sprintf(str, " DAQ Timestamp : %s", ctime((time_t *)&timebase));
100  s << str;
101 
102  return s;
103 }
double seconds()
ostream & operator<<(std::ostream &o, vector< std::string > const &iValue)
Definition: refresh.cc:46
std::string tubeNameFromCoord() const
std::string lastCommand() const
void getDriverTimestamp(int &seconds, int &useconds) const
void getDAQTimestamp(int &seconds, int &useconds) const
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 tube_id, int driver_id, int source_id, std::string tubeNameFromCoord, std::string tubeNameFromSD, std::string lastCommand, std::string message)
std::string message() const
tuple status
Definition: ntuplemaker.py:245
std::string tubeNameFromSD() const