Changeset 4752 for trunk/MagicSoft/Mars/mpedestal
- Timestamp:
- 08/27/04 11:36:24 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpedestal/MPedPhotCam.cc
r4609 r4752 39 39 #include "MPedPhotCam.h" 40 40 41 #include <TArrayI.h>42 #include <TArrayD.h>43 41 #include <TClonesArray.h> 42 43 #include "MArrayI.h" 44 #include "MArrayD.h" 44 45 45 46 #include "MLog.h" … … 233 234 const Int_t na = GetNumAreas(); 234 235 235 TArrayI acnt(na); 236 TArrayI scnt(ns); 237 TArrayD asumx(na); 238 TArrayD ssumx(ns); 239 TArrayD asumr(na); 240 TArrayD ssumr(ns); 236 // Using MArray instead of TArray because they don't do range checks 237 MArrayI acnt(na); 238 MArrayI scnt(ns); 239 MArrayD asumx(na); 240 MArrayD ssumx(ns); 241 MArrayD asumr(na); 242 MArrayD ssumr(ns); 241 243 242 244 for (int i=0; i<np; i++) … … 246 248 247 249 // Create sums for areas and sectors 250 const MPedPhotPix &pix = (*this)[i]; 251 252 const UInt_t ne = pix.GetNumEvents(); 253 const Float_t mean = ne*pix.GetMean(); 254 const Float_t rms = ne*pix.GetRms(); 255 248 256 const UInt_t aidx = geom[i].GetAidx(); 257 asumx[aidx] += mean; 258 asumr[aidx] += rms; 259 acnt[aidx] += ne; 260 249 261 const UInt_t sect = geom[i].GetSector(); 250 251 const MPedPhotPix &pix = (*this)[i]; 252 253 const UInt_t ne = pix.GetNumEvents(); 254 const Float_t mean = pix.GetMean(); 255 const Float_t rms = pix.GetRms(); 256 257 asumx[aidx] += ne*mean; 258 asumr[aidx] += ne*rms; 259 acnt[aidx] += ne; 260 261 ssumx[sect] += ne*mean; 262 ssumr[sect] += ne*rms; 262 ssumx[sect] += mean; 263 ssumr[sect] += rms; 263 264 scnt[sect] += ne; 264 265 } … … 306 307 Bool_t MPedPhotCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const 307 308 { 308 309 const Float_t ped = (*this)[idx].GetMean();310 const Float_t rms = (*this)[idx].GetRms();311 const UInt_t nevt = (*this)[idx].GetNumEvents();312 313 314 Float_t pederr;315 Float_t rmserr;316 317 if (nevt>0)318 {319 pederr = rms/TMath::Sqrt((Float_t)nevt);320 rmserr = rms/TMath::Sqrt((Float_t)nevt)/2.;321 }322 else323 {324 pederr = -1;325 rmserr = -1;326 }327 328 309 switch (type) 329 310 { 330 311 case 0: 331 val = ped;//(*this)[idx].GetMean();312 val = (*this)[idx].GetMean(); 332 313 break; 333 314 case 1: 334 val = rms; //(*this)[idx].GetRms();315 val = (*this)[idx].GetRms(); 335 316 break; 336 317 case 2: 337 val = pederr; // new318 val = (*this)[idx].GetNumEvents()>0 ? (*this)[idx].GetRms()/TMath::Sqrt((Float_t)(*this)[idx].GetNumEvents()) : -1; 338 319 break; 339 320 case 3: 340 val = rmserr; // new321 val = (*this)[idx].GetNumEvents()>0 ? (*this)[idx].GetRms()/TMath::Sqrt((Float_t)(*this)[idx].GetNumEvents())/2. : -1; 341 322 break; 342 323 default:
Note:
See TracChangeset
for help on using the changeset viewer.