Changeset 2728 for trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
- Timestamp:
- 12/20/03 13:46:17 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
r2580 r2728 236 236 } 237 237 238 Bool_t MRawEvtHeader::DecodeTime(UInt_t abstime[2]) const 239 { 240 // BADC|1032 --> DCBA|3210 (Byte swap - exchange MSB and LSB) 241 abstime[0] = (abstime[0]<<16) | (abstime[0]>>16); 242 abstime[1] = (abstime[1]<<16) | (abstime[1]>>16); 243 244 const Byte_t h = (abstime[0]>>18 & 0x30)*10 + (abstime[0]>>14 & 0x0f); 245 const Byte_t m = (abstime[0]>>11 & 0x70)*10 + (abstime[0]>> 7 & 0x0f); 246 const Byte_t s = (abstime[0]>> 4 & 0x70)*10 + (abstime[0]>> 0 & 0x0f); 247 const Int_t ms = 248 ((abstime[1]>>16)&0xf)*1000 + 249 ((abstime[1]>> 8)&0xf)* 100 + 250 ((abstime[1]>> 4)&0xf)* 10 + 251 ((abstime[1]>> 0)&0xf)* 1; 252 253 // hms =3210 --> h=2:4 m=3:4 s=3:4 254 // subsec=DCBA --> subsec? 255 *fLog << dbg << dec; 256 *fLog << (int)(abstime[0]>>18 & 0x30); // h 257 *fLog << (int)(abstime[0]>>14 & 0x0f); // h 258 *fLog << ":"; 259 *fLog << (int)(abstime[0]>>11 & 0x70); // m 260 *fLog << (int)(abstime[0]>> 7 & 0x0f); // m 261 *fLog << ":"; 262 *fLog << (int)(abstime[0]>> 4 & 0x70); // s 263 *fLog << (int)(abstime[0]>> 0 & 0x0f); // s 264 *fLog << " "; 265 *fLog << (int)(abstime[1]>>16 & 0xf) << "."; 266 *fLog << (int)(abstime[1]>> 8 & 0xf) << "."; 267 *fLog << (int)(abstime[1]>> 4 & 0xf) << "."; 268 *fLog << (int)(abstime[1]>> 0 & 0xf); 269 *fLog << endl; 270 271 // Update the time stamp with the current event time. 272 // Make sure, that the time stamp was initialized correctly 273 // with the start-date/time of the run (after reading the run header) 274 // 275 // Here the nanosec precision is ignored... (FIXME!) 276 return fTime->UpdMagicTime(h, m, s, ms); 277 } 278 238 279 // -------------------------------------------------------------------------- 239 280 // … … 241 282 // return FALSE if there is now header anymore, else TRUE 242 283 // 284 // Updates the time stamp with the current event time. 285 // Make sure, that the time stamp was initialized correctly 286 // with the start-date/time of the run (after reading the run header) 287 // 288 // Remark: This 'feature' disallows single runs of more than 11h! 289 // 243 290 int MRawEvtHeader::ReadEvt(istream &fin) 244 291 { 245 292 fin.read((char*)&fDAQEvtNumber, 4); // Total=4 246 293 247 UInt_t abstime[2]; 294 UInt_t abstime[2]; // BADC|1032 248 295 fin.read((char*)abstime, 8); // Total=12 249 250 // 251 // store the time of the event in the corresponding container 252 // 253 /* 254 const Double_t mhz = 9.375; // [1e6 ticks/s] 255 const Double_t t = (Double_t)abstime[0]/mhz; // [ns] 256 const UShort_t ns = (UShort_t)fmod(t*1e-3, 1e9); 257 const Byte_t s = (Byte_t)fmod(t/1e12, 60); 258 const Byte_t m = (Byte_t)fmod(t/60e12, 60); 259 const Byte_t h = (Byte_t)(t/3600e12); 260 fTime->SetTime(h, m, s, ns); 261 */ 296 if (!DecodeTime(abstime)) 297 { 298 *fLog << err << "ERROR - Event time in event header invalid... abort." << endl; 299 return kFALSE; 300 } 262 301 263 302 Byte_t dummy[4];
Note:
See TracChangeset
for help on using the changeset viewer.