Changeset 8490 for trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc
- Timestamp:
- 05/11/07 11:25:46 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc
r8361 r8490 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.3 7 2007-03-04 12:00:30tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.38 2007-05-11 10:25:45 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 26 26 ! Author(s): Nepomuk Otte 10/2004 <mailto:otte@mppmu.mpg.de> 27 27 ! 28 ! Copyright: MAGIC Software Development, 2000-200 628 ! Copyright: MAGIC Software Development, 2000-2007 29 29 ! 30 30 ! … … 145 145 #include "MRawEvtPixelIter.h" 146 146 147 #include "MPedestalPix.h"148 147 #include "MPedestalCam.h" 149 150 #include "MGeomPix.h"151 #include "MGeomCam.h"152 153 #include "MExtractPedestal.h"154 #include "MPedestalSubtractedEvt.h"155 148 156 149 ClassImp(MPedCalcFromLoGain); … … 177 170 SetPedestalUpdate(kTRUE); 178 171 SetNumDump(); 179 }180 181 // --------------------------------------------------------------------------182 //183 // Call MExtractPedestl::ResetArrays aand reset fNumAventsUsed and184 // fTotalCounter185 //186 void MPedCalcFromLoGain::ResetArrays()187 {188 MExtractPedestal::ResetArrays();189 190 fNumEventsUsed.Reset();191 fTotalCounter.Reset();192 172 } 193 173 … … 203 183 Bool_t MPedCalcFromLoGain::ReInit(MParList *pList) 204 184 { 205 // If the size is not yet set, set the size206 if (fSumx.GetSize()==0)207 {208 const Int_t npixels = fPedestalsOut->GetSize();209 fNumEventsUsed.Set(npixels);210 fTotalCounter.Set(npixels);211 }212 213 185 if (!MExtractPedestal::ReInit(pList)) 214 186 return kFALSE; … … 232 204 const Int_t nlo = fRunHeader->GetNumSamplesLoGain(); 233 205 206 const Int_t offset = nlo>0?nhi:0; 207 234 208 // Real Process 235 209 MRawEvtPixelIter pixel(fRawEvt); 236 210 while (pixel.Next()) 237 211 { 212 if (!CalcPixel(pixel, offset)) 213 continue; 214 238 215 const UInt_t idx = pixel.GetPixelId(); 239 240 if (!CheckVariation(idx))241 continue;242 243 //extract pedestal244 UInt_t ab[2];245 const Float_t sum = fExtractor ?246 CalcExtractor(pixel, nlo>0?nhi:0) :247 CalcSums(pixel, nlo>0?nhi:0, ab[0], ab[1]);248 249 const UInt_t aidx = (*fGeom)[idx].GetAidx();250 const UInt_t sector = (*fGeom)[idx].GetSector();251 252 const Float_t sqrsum = sum*sum;253 254 fSumx[idx] += sum;255 fSumx2[idx] += sqrsum;256 fAreaSumx[aidx] += sum;257 fAreaSumx2[aidx] += sqrsum;258 fSectorSumx[sector] += sum;259 fSectorSumx2[sector] += sqrsum;260 261 if (fIntermediateStorage)262 (*fPedestalsInter)[idx].Set(sum, 0, 0, fNumEventsUsed[idx]);263 264 fNumEventsUsed[idx] ++;265 fAreaFilled [aidx] ++;266 fSectorFilled [sector]++;267 268 if (!fExtractor && pixel.IsABFlagValid())269 {270 fSumAB0[idx] += ab[0];271 fSumAB1[idx] += ab[1];272 fAreaSumAB0[aidx] += ab[0];273 fAreaSumAB1[aidx] += ab[1];274 fSectorSumAB0[aidx] += ab[0];275 fSectorSumAB1[aidx] += ab[1];276 }277 278 216 if (!fPedestalUpdate || (UInt_t)fNumEventsUsed[idx]<fNumEventsDump) 279 217 continue; 280 218 281 CalcPixResults(fNumEventsDump, idx); 282 fTotalCounter[idx]++; 219 CalcPixResults(idx); 283 220 284 221 fNumEventsUsed[idx]=0; … … 289 226 } 290 227 291 if (!(GetNumExecutions() % fNumAreasDump)) 228 if (fNumAreasDump>0 && !(GetNumExecutions() % fNumAreasDump)) 229 { 292 230 CalcAreaResult(); 293 294 if (!(GetNumExecutions() % fNumSectorsDump)) 231 fAreaFilled.Reset(); 232 } 233 234 if (fNumSectorsDump>0 && !(GetNumExecutions() % fNumSectorsDump)) 235 { 295 236 CalcSectorResult(); 237 fSectorFilled.Reset(); 238 } 296 239 297 240 if (fPedestalUpdate) … … 299 242 300 243 return kTRUE; 301 }302 303 // --------------------------------------------------------------------------304 //305 // Loop over the sector indices to get the averaged pedestal per sector306 //307 void MPedCalcFromLoGain::CalcSectorResult()308 {309 for (UInt_t sector=0; sector<fSectorFilled.GetSize(); sector++)310 if (fSectorValid[sector]>0)311 CalcSectorResults(fSectorFilled[sector], fSectorValid[sector], sector);312 }313 314 // --------------------------------------------------------------------------315 //316 // Loop over the (two) area indices to get the averaged pedestal per aidx317 //318 void MPedCalcFromLoGain::CalcAreaResult()319 {320 for (UInt_t aidx=0; aidx<fAreaFilled.GetSize(); aidx++)321 if (fAreaValid[aidx]>0)322 CalcAreaResults(fAreaFilled[aidx], fAreaValid[aidx], aidx);323 324 244 } 325 245 … … 336 256 *fLog << flush << inf << "Calculating Pedestals..." << flush; 337 257 338 const Int_t npix = fGeom->GetNumPixels(); 339 for (Int_t idx=0; idx<npix; idx++) 340 { 341 const ULong_t n = fNumEventsUsed[idx]; 342 if (n>1) 343 { 344 CalcPixResults(n, idx); 345 fTotalCounter[idx]++; 346 } 347 } 348 258 CalcPixResult(); 349 259 CalcAreaResult(); 350 260 CalcSectorResult();
Note:
See TracChangeset
for help on using the changeset viewer.