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  speed_=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 speed,
32  int tube_id,
33  int driver_id,
34  int source_id){
35 
36  messageCounter_=message_counter;
37  indexCounter_=index_counter;
38  reelCounter_=reel_counter;
39  timestamp1_sec_=timestamp1_sec;
40  timestamp1_usec_=timestamp1_usec;
41  timestamp2_sec_=timestamp2_sec;
42  timestamp2_usec_=timestamp2_usec;
43  status_=status;
44  motorCurrent_=motor_current;
45  speed_=speed;
46  tubeId_=tube_id;
47  driverId_=driver_id;
48  sourceId_=source_id;
49 }
50 
51 void HcalSourcePositionData::getDriverTimestamp(int& seconds, int& useconds) const{
52  seconds=timestamp1_sec_;
53  useconds=timestamp1_usec_;
54 }
55 
56 void HcalSourcePositionData::getDAQTimestamp(int& seconds, int& useconds) const{
57  seconds=timestamp2_sec_;
58  useconds=timestamp2_usec_;
59 }
60 
61 ostream& operator<<(ostream& s, const HcalSourcePositionData& hspd) {
62 
63  s << " Message Counter =" << hspd.messageCounter() << endl;
64  s << " Index Counter =" << hspd.indexCounter() << endl;
65  s << " Reel Counter =" << hspd.reelCounter() << endl;
66  s << " Status =" << hex << hspd.status() << dec << endl;
67  s << " Motor Current =" << hspd.motorCurrent() << endl;
68  s << " Speed =" << hspd.speed() << endl;
69  s << " Tube Id =" << hspd.tubeId() << endl;
70  s << " Driver Id =" << hspd.driverId() << endl;
71  s << " Source Id =" << hspd.sourceId() << endl;
72 
73  int timebase =0; int timeusec=0;
74  hspd.getDriverTimestamp(timebase,timeusec);
75  // trim seconds off of usec and add to base
76  timeusec %= 1000000;
77  timebase += timeusec/1000000;
78  char str[50];
79  sprintf(str, " Driver Timestamp : %s", ctime((time_t *)&timebase));
80  s << str;
81  timebase=0; timeusec=0;
82  hspd.getDAQTimestamp(timebase,timeusec);
83  timeusec %= 1000000;
84  timebase += timeusec/1000000;
85 
86  sprintf(str, " DAQ Timestamp : %s", ctime((time_t *)&timebase));
87  s << str;
88 
89  return s;
90 }
double seconds()
ostream & operator<<(std::ostream &o, const vector< std::string > &iValue)
Definition: refresh.cc:30
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 speed, int tube_id, int driver_id, int source_id)
void getDriverTimestamp(int &seconds, int &useconds) const
void getDAQTimestamp(int &seconds, int &useconds) const
string s
Definition: asciidump.py:422
tuple status
Definition: ntuplemaker.py:245