Changeset 3374 for trunk/MagicSoft/Mars/manalysis/MPedPhotCalc.cc
- Timestamp:
- 03/01/04 17:18:18 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MPedPhotCalc.cc
r2850 r3374 109 109 const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 110 110 if (!runheader) 111 111 { 112 112 *fLog << warn << dbginf; 113 113 *fLog << "Warning - cannot check file type, MRawRunHeader not found." << endl; 114 114 } 115 115 else 116 if (runheader->GetRunType() == kRTMonteCarlo)117 return kTRUE;116 if (runheader->IsMonteCarloRun()) 117 return kTRUE; 118 118 119 119 120 120 // Initialize arrays 121 121 if(fSumx.GetSize()==0) 122 123 122 { 123 const UShort_t num = fPedestals->GetSize(); 124 124 125 126 125 fSumx.Set(num); 126 fSumx2.Set(num); 127 127 128 129 130 128 memset(fSumx.GetArray(), 0, sizeof(Float_t)*num); 129 memset(fSumx2.GetArray(), 0, sizeof(Float_t)*num); 130 } 131 131 132 132 return kTRUE; 133 133 } 134 134 … … 140 140 Int_t MPedPhotCalc::Process() 141 141 { 142 for(UInt_t i=0;i<fCerPhot->GetNumPixels();i++)142 for(UInt_t i=0;i<fCerPhot->GetNumPixels();i++) 143 143 { 144 const MCerPhotPix &pix = (*fCerPhot)[i];144 const MCerPhotPix &pix = (*fCerPhot)[i]; 145 145 146 const Float_t nphot = pix.GetNumPhotons();147 const Int_t idx = pix.GetPixId();148 149 fSumx[idx] += nphot;150 fSumx2[idx] += nphot*nphot;146 const Float_t nphot = pix.GetNumPhotons(); 147 const Int_t idx = pix.GetPixId(); 148 149 fSumx[idx] += nphot; 150 fSumx2[idx] += nphot*nphot; 151 151 } 152 153 fPedestals->SetReadyToSave();154 155 return kTRUE;152 153 fPedestals->SetReadyToSave(); 154 155 return kTRUE; 156 156 } 157 157 … … 161 161 // 162 162 Int_t MPedPhotCalc::PostProcess() 163 163 { 164 164 // Compute pedestals and rms from fSumx and fSumx2 arrays 165 165 const Int_t n = GetNumExecutions(); … … 167 167 168 168 for(Int_t i=0; i<npix; i++) 169 169 { 170 170 const Float_t sum = fSumx[i]; 171 171 const Float_t sum2 = fSumx2[i]; 172 172 173 173 const Float_t photped = sum/n; 174 174 const Float_t photrms = TMath::Sqrt((sum2-sum*sum/n)/(n-1.)); 175 175 176 (*fPedestals)[i].Set(photped,photrms); 177 178 176 (*fPedestals)[i].Set(photped,photrms); 177 } 178 179 179 return kTRUE; 180 180 }
Note:
See TracChangeset
for help on using the changeset viewer.