Changeset 8938 for trunk/MagicSoft/Mars/mraw
- Timestamp:
- 06/12/08 14:00:47 (17 years ago)
- Location:
- trunk/MagicSoft/Mars/mraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r8704 r8938 18 18 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 720 ! Copyright: MAGIC Software Development, 2000-2008 21 21 ! 22 22 ! … … 263 263 264 264 if (str.BeginsWith("graph")) 265 if (str.Length()>5) 266 sscanf(&str[5], "%d", &id); 265 sscanf(str.Data()+5, "%d", &id); 267 266 if (str.BeginsWith("hist")) 268 if (str.Length()>4) 269 sscanf(&str[4], "%d", &id); 267 sscanf(str.Data()+4, "%d", &id); 270 268 271 269 MRawEvtPixelIter pix(this); … … 299 297 graphhi->SetPoint(graphhi->GetN(), i+nh, GetSample(logains, i)); 300 298 301 graphhi->SetMaximum( 256);299 graphhi->SetMaximum(GetMax()+0.5); 302 300 graphhi->SetMinimum(0); 303 301 … … 307 305 TH1F *histhi = graphhi->GetHistogram(); 308 306 histhi->SetMinimum(0); 309 histhi->SetMaximum( 255);307 histhi->SetMaximum(GetMax()+0.5); 310 308 311 309 histhi->SetXTitle("Time/FADC Slices"); … … 320 318 *fLog << inf << "Drawing Histogram of Pixel with Idx #" << dec << pix.GetPixelId() << " to " << gPad << endl; 321 319 322 TH1F *histh = new TH1F(name, "FADC Samples", nh , -0.5, nh-.5);320 TH1F *histh = new TH1F(name, "FADC Samples", nh+nl, -0.5, nh+nl-.5); 323 321 histh->SetMinimum(0); 324 histh->SetMaximum( 255);322 histh->SetMaximum(GetMax()+0.5); 325 323 histh->SetXTitle("Time [FADC Slices]"); 326 324 histh->SetYTitle("Signal [FADC Units]"); … … 329 327 histh->Fill(i, GetSample(higains, i)); 330 328 for (int i=0; i<nl; i++) 331 histh->Fill(i , GetSample(logains, i));329 histh->Fill(i+nl, GetSample(logains, i)); 332 330 histh->SetBit(kCanDelete); 333 331 histh->Draw(same ? "same" : ""); … … 613 611 614 612 evt.fConnectedPixels = fConnectedPixels; 615 } 613 614 evt.fNumBytesPerSample = fNumBytesPerSample; 615 } -
trunk/MagicSoft/Mars/mraw/MRawEvtData.h
r8571 r8938 47 47 UInt_t GetSample(const void *ptr, Int_t n) // Helper for Draw 48 48 { 49 switch ( n)49 switch (fNumBytesPerSample) 50 50 { 51 case 1: return *(Byte_t*)ptr;52 case 2: return *(UShort_t*)ptr;53 case 3: return *(Int_t*)ptr;51 case 1: return reinterpret_cast<const Byte_t*>(ptr)[n]; 52 case 2: return reinterpret_cast<const UShort_t*>(ptr)[n]; 53 case 3: return reinterpret_cast<const UInt_t*>(ptr)[n]; 54 54 } 55 55 return 0; … … 83 83 UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; } 84 84 UInt_t GetScale() const { return 1<<((fNumBytesPerSample-1)*8); } 85 UInt_t GetMax() const { return (UInt_t)(~1)>>((4-fNumBytesPerSample)*8); } 85 86 86 87 void ReadPixel(istream &fin, Int_t npix);
Note:
See TracChangeset
for help on using the changeset viewer.