Go to the documentation of this file.00001 #include "DataFormats/HcalRecHit/interface/HcalSourcePositionData.h"
00002 #include <cstdio>
00003
00004 using namespace std;
00005
00006 HcalSourcePositionData::HcalSourcePositionData(){
00007 messageCounter_=0;
00008 indexCounter_=0;
00009 reelCounter_=0;
00010 timestamp1_sec_=0;
00011 timestamp1_usec_=0;
00012 timestamp2_sec_=0;
00013 timestamp2_usec_=0;
00014 status_=0;
00015 motorCurrent_=0;
00016 speed_=0;
00017 tubeId_=-1;
00018 driverId_=-1;
00019 sourceId_=-1;
00020 }
00021
00022 void HcalSourcePositionData::set(int message_counter,
00023 int timestamp1_sec,
00024 int timestamp1_usec,
00025 int timestamp2_sec,
00026 int timestamp2_usec,
00027 int status,
00028 int index_counter,
00029 int reel_counter,
00030 int motor_current,
00031 int speed,
00032 int tube_id,
00033 int driver_id,
00034 int source_id){
00035
00036 messageCounter_=message_counter;
00037 indexCounter_=index_counter;
00038 reelCounter_=reel_counter;
00039 timestamp1_sec_=timestamp1_sec;
00040 timestamp1_usec_=timestamp1_usec;
00041 timestamp2_sec_=timestamp2_sec;
00042 timestamp2_usec_=timestamp2_usec;
00043 status_=status;
00044 motorCurrent_=motor_current;
00045 speed_=speed;
00046 tubeId_=tube_id;
00047 driverId_=driver_id;
00048 sourceId_=source_id;
00049 }
00050
00051 void HcalSourcePositionData::getDriverTimestamp(int& seconds, int& useconds) const{
00052 seconds=timestamp1_sec_;
00053 useconds=timestamp1_usec_;
00054 }
00055
00056 void HcalSourcePositionData::getDAQTimestamp(int& seconds, int& useconds) const{
00057 seconds=timestamp2_sec_;
00058 useconds=timestamp2_usec_;
00059 }
00060
00061 ostream& operator<<(ostream& s, const HcalSourcePositionData& hspd) {
00062
00063 s << " Message Counter =" << hspd.messageCounter() << endl;
00064 s << " Index Counter =" << hspd.indexCounter() << endl;
00065 s << " Reel Counter =" << hspd.reelCounter() << endl;
00066 s << " Status =" << hex << hspd.status() << dec << endl;
00067 s << " Motor Current =" << hspd.motorCurrent() << endl;
00068 s << " Speed =" << hspd.speed() << endl;
00069 s << " Tube Id =" << hspd.tubeId() << endl;
00070 s << " Driver Id =" << hspd.driverId() << endl;
00071 s << " Source Id =" << hspd.sourceId() << endl;
00072
00073 int timebase =0; int timeusec=0;
00074 hspd.getDriverTimestamp(timebase,timeusec);
00075
00076 timeusec %= 1000000;
00077 timebase += timeusec/1000000;
00078 char str[50];
00079 sprintf(str, " Driver Timestamp : %s", ctime((time_t *)&timebase));
00080 s << str;
00081 timebase=0; timeusec=0;
00082 hspd.getDAQTimestamp(timebase,timeusec);
00083 timeusec %= 1000000;
00084 timebase += timeusec/1000000;
00085
00086 sprintf(str, " DAQ Timestamp : %s", ctime((time_t *)&timebase));
00087 s << str;
00088
00089 return s;
00090 }