Changeset 8944 for trunk/MagicSoft/Mars
- Timestamp:
- 06/12/08 17:18:28 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mraw
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawCrateData.cc
r8344 r8944 18 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 420 ! Copyright: MAGIC Software Development, 2000-2008 21 21 ! 22 22 ! … … 33 33 #include "MRawCrateData.h" 34 34 35 #include <iostream> 36 #include <iomanip> 35 #include <fstream> 37 36 38 #include < fstream>37 #include <TArrayC.h> 39 38 40 39 #include "MLog.h" … … 54 53 // like specified in a TDAS note 55 54 // 56 void MRawCrateData::ReadEvt(istream& fin, UShort_t ver)55 Bool_t MRawCrateData::ReadEvtOld(istream& fin, UShort_t ver) 57 56 { 58 57 if (ver<7) … … 97 96 fin.read((char*)&dummys, 2); // U16 TrigTimeInterpol; 98 97 } 98 99 return fin.eof() ? kFALSE : kTRUE; 100 } 101 102 Bool_t MRawCrateData::ReadEvt(istream& fin, UShort_t ver, UInt_t size) 103 { 104 if (ver<11) 105 return ReadEvtOld(fin, ver); 106 107 if (size==0) 108 { 109 *fLog << err << "ERROR - Event header size unknown." << endl; 110 return kFALSE; 111 } 112 113 if (size<28) 114 { 115 *fLog << err << "ERROR - Event header too small (<28b)." << endl; 116 return kFALSE; 117 } 118 119 TArrayC h(size); 120 fin.read(h.GetArray(), h.GetSize()); 121 if (!fin) 122 return kFALSE; 123 124 // ----- convert ----- 125 //const Byte_t *Char = reinterpret_cast<Byte_t* >(h.GetArray()); 126 const UInt_t *Int = reinterpret_cast<UInt_t* >(h.GetArray()); 127 //const Float_t *Float = reinterpret_cast<Float_t*>(h.GetArray()); 128 129 fDAQCrateNumber = Int[0]; 130 fFADCEvtNumber = Int[3]; 131 132 return kTRUE; 99 133 } 100 134 -
trunk/MagicSoft/Mars/mraw/MRawCrateData.h
r3800 r8944 18 18 Byte_t fABFlags; // flag describing in which two-slice block the trigger was raised 19 19 20 Bool_t ReadEvtOld(istream& fin, UShort_t ver); 21 20 22 public: 21 23 MRawCrateData(); … … 28 30 void Print(Option_t *t=NULL) const; 29 31 30 void ReadEvt(istream& fin, UShort_t ver);31 void SkipEvt(istream& fin, UShort_t ver);32 Bool_t ReadEvt(istream& fin, UShort_t ver, UInt_t size); 33 void SkipEvt(istream& fin, UShort_t ver); 32 34 33 35 ClassDef(MRawCrateData, 2) //Container to store the Raw CRATE DATA -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
r8344 r8944 18 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 420 ! Copyright: MAGIC Software Development, 2000-2008 21 21 ! 22 22 ! … … 109 109 #include "MRawEvtHeader.h" 110 110 111 #include <iomanip>112 111 #include <fstream> 112 113 #include <TArrayC.h> 113 114 114 115 #include "MLog.h" … … 268 269 // source code. 269 270 // 270 Bool_t MRawEvtHeader::DecodeTime( UInt_t abstime[2], UShort_t ver) const271 Bool_t MRawEvtHeader::DecodeTime(const UInt_t tm[2], UShort_t ver) const 271 272 { 272 273 // … … 277 278 // Swap bits: 23->16, 22->17, 21->16, 20->19 278 279 // 280 UInt_t abstime[2] = { tm[0], tm[1] }; 281 279 282 abstime[0] = 280 283 abstime[0]>>7 & 0x00010000 | … … 338 341 // Remark: This 'feature' disallows single runs of more than 11h! 339 342 // 340 Int_t MRawEvtHeader::ReadEvt (istream &fin, UShort_t ver)341 { 342 Bool_t rc = kTRUE;343 Int_t MRawEvtHeader::ReadEvtOld(istream &fin, UShort_t ver) 344 { 345 Int_t rc = kTRUE; 343 346 344 347 fin.read((char*)&fDAQEvtNumber, 4); // Total=4 … … 379 382 380 383 return fin.eof() ? kFALSE : rc; 384 } 385 386 // -------------------------------------------------------------------------- 387 // 388 Int_t MRawEvtHeader::ReadEvt(istream &fin, UShort_t ver, UInt_t size) 389 { 390 if (ver<11) 391 return ReadEvtOld(fin, ver); 392 393 if (size==0) 394 { 395 *fLog << err << "ERROR - Event header size unknown." << endl; 396 return kFALSE; 397 } 398 399 if (size<32) 400 { 401 *fLog << err << "ERROR - Event header too small (<32b)." << endl; 402 return kFALSE; 403 } 404 405 TArrayC h(size); 406 fin.read(h.GetArray(), h.GetSize()); 407 if (!fin) 408 return kFALSE; 409 410 // ----- convert ----- 411 //const Byte_t *Char = reinterpret_cast<Byte_t* >(h.GetArray()); 412 const UInt_t *Int = reinterpret_cast<UInt_t* >(h.GetArray()); 413 //const Float_t *Float = reinterpret_cast<Float_t*>(h.GetArray()); 414 415 fDAQEvtNumber = Int[0]; 416 // Decode Time 417 fNumTrigLvl1 = Int[3]; 418 fNumTrigLvl2 = Int[4]; 419 fTrigPattern[0] = Int[5]; 420 fTrigPattern[1] = Int[6]; 421 fTrigType = Int[7]; 422 423 // No LoGains for version 7 data 424 fPixLoGainOn->Reset(); 425 fNumLoGainOn = 0; 426 427 return DecodeTime(Int+1, ver) ? kTRUE : kCONTINUE; 381 428 } 382 429 -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h
r6306 r8944 69 69 MArrayB *fPixLoGainOn; //! Array which tell you which pixels have lo gain on 70 70 71 Bool_t DecodeTime( UInt_t abstime[2], UShort_t ver) const;71 Bool_t DecodeTime(const UInt_t abstime[2], UShort_t ver) const; 72 72 73 73 Int_t GetNumBytes() const; 74 75 Int_t ReadEvtOld(istream& fin, UShort_t ver); 74 76 75 77 public: … … 77 79 ~MRawEvtHeader(); 78 80 81 // MRawEvtHeader 79 82 void InitRead(MRawRunHeader *rh, MTime *t); 80 83 84 // Getter 85 UShort_t GetTrigType() const { return fTrigType; } 86 UInt_t GetNumTrigLvl1() const { return fNumTrigLvl1; } 87 UInt_t GetNumTrigLvl2() const { return fNumTrigLvl2; } 88 UInt_t GetDAQEvtNumber() const { return fDAQEvtNumber; } 89 90 UInt_t GetTriggerID() const; 91 UInt_t GetCalibrationPattern() const; 92 UInt_t GetPulserSlotPattern() const; 93 94 // Setter 95 void FillHeader(UInt_t, Float_t=0); 96 97 void SetTriggerPattern( const UInt_t pattern ) { fTrigPattern[0] = pattern; } // Only for MC! 98 void SetCalibrationPattern( const UInt_t pattern ) { fTrigPattern[1] = pattern; } // Only for MC! 99 100 // TObject 81 101 void Clear(Option_t * = NULL); 82 102 void Print(Option_t * = NULL) const; 83 103 84 void FillHeader(UInt_t, Float_t=0); 85 86 UShort_t GetTrigType() const { return fTrigType; } 87 UInt_t GetNumTrigLvl1() const { return fNumTrigLvl1; } 88 UInt_t GetNumTrigLvl2() const { return fNumTrigLvl2; } 89 UInt_t GetDAQEvtNumber() const { return fDAQEvtNumber; } 90 91 UInt_t GetTriggerID() const; 92 UInt_t GetCalibrationPattern() const; 93 UInt_t GetPulserSlotPattern() const; 94 95 void SetTriggerPattern( const UInt_t pattern ) { fTrigPattern[0] = pattern; } // Only for MC! 96 void SetCalibrationPattern( const UInt_t pattern ) { fTrigPattern[1] = pattern; } // Only for MC! 97 98 Int_t ReadEvt(istream& fin, UShort_t ver); 104 // I/O 105 Int_t ReadEvt(istream& fin, UShort_t ver, UInt_t size); 99 106 void SkipEvt(istream& fin, UShort_t ver); 100 107
Note:
See TracChangeset
for help on using the changeset viewer.