Changeset 11555 for trunk/Mars/mraw
- Timestamp:
- 07/24/11 11:04:43 (13 years ago)
- Location:
- trunk/Mars/mraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mraw/MRawEvtData.cc
r11489 r11555 50 50 // ------------------ 51 51 // + MArrayS *fStartCell 52 // + Bool_t fIsSigned 52 53 // 53 54 // Version 7 … … 113 114 // 114 115 MRawEvtData::MRawEvtData(const char *name, const char *title) 115 : fRunHeader(0), fNumBytesPerSample(1) 116 : fRunHeader(0), fNumBytesPerSample(1), fIsSigned(false) 116 117 { 117 118 fName = name ? name : "MRawEvtData"; … … 288 289 name += pix.GetPixelId(); 289 290 291 fIsSigned = kTRUE; 290 292 291 293 Bool_t same = str.Contains("same"); 294 295 cout << "MIN/MAX=" << fNumBytesPerSample << " " << GetMin() << " " << GetMax() << endl; 292 296 293 297 if (str.BeginsWith("graph")) … … 304 308 305 309 graphhi->SetMaximum(GetMax()+0.5); 306 graphhi->SetMinimum( 0);310 graphhi->SetMinimum(GetMin()); 307 311 308 312 graphhi->SetBit(kCanDelete); … … 310 314 311 315 TH1F *histhi = graphhi->GetHistogram(); 312 histhi->SetMinimum( 0);316 histhi->SetMinimum(GetMin()); 313 317 histhi->SetMaximum(GetMax()+0.5); 314 318 … … 325 329 326 330 TH1F *histh = new TH1F(name, "FADC Samples", nh+nl, -0.5, nh+nl-.5); 327 histh->SetMinimum( 0);331 histh->SetMinimum(GetMin()); 328 332 histh->SetMaximum(GetMax()+0.5); 329 333 histh->SetXTitle("Time [FADC Slices]"); -
trunk/Mars/mraw/MRawEvtData.h
r11489 r11555 40 40 UShort_t fNumBytesPerSample; 41 41 42 Bool_t fIsSigned; 43 42 44 Int_t fConnectedPixels; //! 43 45 … … 47 49 Int_t GetNumBytes() const; 48 50 49 UInt_t GetSample(const void *ptr, Int_t n) // Helper for Draw51 Long_t GetSample(const void *ptr, Int_t n) // Helper for Draw 50 52 { 53 fIsSigned = kTRUE; 51 54 switch (fNumBytesPerSample) 52 55 { 53 case 1: return reinterpret_cast<const Byte_t*>(ptr)[n];54 case 2: return reinterpret_cast<const UShort_t*>(ptr)[n];55 case 4: return reinterpret_cast<const UInt_t*>(ptr)[n];56 case 1: return fIsSigned ? (Long_t)reinterpret_cast<const Char_t*>(ptr)[n] : (Long_t)reinterpret_cast<const Byte_t*>(ptr)[n]; 57 case 2: return fIsSigned ? (Long_t)reinterpret_cast<const Short_t*>(ptr)[n] : (Long_t)reinterpret_cast<const UShort_t*>(ptr)[n]; 58 case 4: return fIsSigned ? (Long_t)reinterpret_cast<const Int_t*>(ptr)[n] : (Long_t)reinterpret_cast<const UInt_t*>(ptr)[n]; 56 59 } 57 60 return 0; … … 91 94 UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; } 92 95 UInt_t GetScale() const { return 1<<((fNumBytesPerSample-1)*8); } 93 UInt_t GetMax() const { return (UInt_t)(~1)>>((4-fNumBytesPerSample)*8); } 94 96 Long_t GetMin() const { return fIsSigned ? -GetMax()-1 : 0; } 97 Long_t GetMax() const { 98 switch (fNumBytesPerSample) 99 { 100 case 1: return fIsSigned ? 0x7f : 0xff; 101 case 2: return fIsSigned ? 0x7fff : 0xffff; 102 case 4: return fIsSigned ? 0x7fffffff : 0xffffffff; 103 } 104 return 0; 105 } 95 106 Byte_t *GetSamples() const; 96 107 UShort_t *GetStartCells() const;
Note:
See TracChangeset
for help on using the changeset viewer.