Changeset 7189 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 07/14/05 16:03:32 (19 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc
r7053 r7189 32 32 // MCalibrationIntensityChargeCam 33 33 // MCalibrationIntensityRelTimeCam 34 // MCalibrationIntensityConstCam 34 35 // MBadPixelsIntensityCam 35 36 // … … 37 38 // MCalibrationIntensityChargeCam 38 39 // MCalibrationIntensityRelTimeCam 39 // MBadPixelsIntensityCam 40 // MBadPixelsIntensityCam 41 // 42 // Class version 2: 43 // + UInt_t fNumPhesDump; // Number of cams after which the number of phes gets averaged 44 // + Float_t fMeanPhes; 45 // + Float_t fMeanPhesRelVar; 46 // + Bool_t fUpdateNumPhes; // Update the number of photo-electrons only after fNumPhesDump number of Cams 47 // + TArrayF fPhes; 48 // + TArrayF fPhesVar; 40 49 // 41 50 ////////////////////////////////////////////////////////////////////////////// … … 55 64 #include "MCalibrationIntensityQECam.h" 56 65 #include "MCalibrationIntensityRelTimeCam.h" 66 #include "MCalibrationIntensityConstCam.h" 57 67 58 68 #include "MBadPixelsIntensityCam.h" 59 69 70 #include "MCalibrationChargePix.h" 60 71 #include "MCalibrationChargeCalc.h" 61 72 #include "MCalibrationRelTimeCalc.h" … … 67 78 68 79 const UInt_t MCalibCalcFromPast::fgNumEventsDump = 500; 80 const UInt_t MCalibCalcFromPast::fgNumPhesDump = 10; 69 81 70 82 // -------------------------------------------------------------------------- … … 74 86 // Sets: 75 87 // - fNumEventsDump to fgNumEventsDump 88 // - fNumPhesDump to fgNumPhesDump 76 89 // 77 90 MCalibCalcFromPast::MCalibCalcFromPast(const char *name, const char *title) 78 91 : fGeom(NULL), fParList(NULL), fRunHeader(NULL), 79 fIntensCharge(NULL), fIntensBlind(NULL), fIntensQE(NULL),80 fIntensRelTime(NULL), fIntensBad(NULL), fChargeCalc(NULL),81 fRelTimeCalc(NULL), fCalibrate(NULL), fNumEvents(0), fNumCam(0),82 fUpdateWithFFactorMethod(kFALSE)92 fIntensCharge(NULL), fIntensBlind(NULL), fIntensRelTime(NULL), fIntensConst(NULL), 93 fIntensBad(NULL), 94 fChargeCalc(NULL), fRelTimeCalc(NULL), fCalibrate(NULL), 95 fNumCam(0), fNumEvents(0), fUpdateWithFFactorMethod(kTRUE), fUpdateNumPhes(kTRUE) 83 96 { 84 97 … … 87 100 88 101 SetNumEventsDump(); 102 SetNumPhesDump (); 89 103 } 90 104 … … 150 164 fIntensCharge = (MCalibrationIntensityChargeCam*)pList->FindCreateObj("MCalibrationIntensityChargeCam"); 151 165 fIntensQE = (MCalibrationIntensityQECam*) pList->FindCreateObj("MCalibrationIntensityQECam"); 166 fIntensConst = (MCalibrationIntensityConstCam*) pList->FindCreateObj("MCalibrationIntensityConstCam"); 167 168 MCalibrationChargeCam *chargeinit = (MCalibrationChargeCam*)pList->FindObject("MCalibrationChargeCam"); 169 MCalibrationQECam *qeinit = (MCalibrationQECam*) pList->FindObject("MCalibrationQECam"); 170 171 if (chargeinit) 172 fIntensCharge->SetCam(chargeinit,0); 173 else 174 *fLog << "Could not find initial MCalibrationChargeCam, cannot initialize intensity cam" << endl; 175 176 if (qeinit) 177 fIntensQE->SetCam(qeinit,0); 178 else 179 *fLog << "Could not find initial MCalibrationQECam, cannot initialize intensity cam" << endl; 180 181 fIntensConst->GetCam()->Init(*fGeom); 152 182 153 183 if (!fChargeCalc) … … 212 242 fNumCam = 0; 213 243 fNumEvents = 0; 244 fNumPhes = 0; 245 246 fChargeCalc->SetUseExternalNumPhes(kFALSE); 247 248 if (fUpdateNumPhes) 249 { 250 fPhes.Set(fNumPhesDump); 251 fPhesVar.Set(fNumPhesDump); 252 } 214 253 215 254 return kTRUE; … … 231 270 232 271 fNumEvents = 0; 272 ReInitialize(); 273 233 274 // 234 275 // Finalize Possible calibration histogram classes... … … 246 287 *fLog << inf << "Finalize calibration calculations..." << endl; 247 288 if (fChargeCalc) 248 fChargeCalc->Finalize(); 289 { 290 fChargeCalc->Finalize(); 291 if (fUpdateNumPhes) 292 { 293 MCalibrationChargePix &avpix =(MCalibrationChargePix&)fIntensCharge->GetCam()->GetAverageArea(0); 294 fPhes [fNumPhes] = avpix.GetPheFFactorMethod(); 295 fPhesVar[fNumPhes] = avpix.GetPheFFactorMethodVar(); 296 297 fNumPhes++; 298 299 if (fNumPhes == fNumPhesDump) 300 { 301 fNumPhes = 0; 302 if (!UpdateMeanPhes()) 303 { 304 *fLog << warn << "Could not update mean number of photo-electrons. " 305 << "Skip it until next update" << endl; 306 fChargeCalc->SetUseExternalNumPhes(kFALSE); 307 } 308 else 309 { 310 *fLog << inf << "New averaged number photo-electrons: " << fMeanPhes << endl; 311 fChargeCalc->SetExternalNumPhes ( fMeanPhes ); 312 fChargeCalc->SetExternalNumPhesRelVar( fMeanPhesRelVar ); 313 fChargeCalc->SetUseExternalNumPhes(); 314 } 315 } 316 } 317 } 318 249 319 if (fRelTimeCalc) 250 320 fRelTimeCalc->Finalize(); 321 251 322 if (fCalibrate) 252 fCalibrate->UpdateConversionFactors(fUpdateWithFFactorMethod ? NULL : 253 (MCalibrationChargeCam*)fIntensCharge->GetCam()); 254 255 ReInitialize(); 323 fCalibrate->UpdateConversionFactors(fUpdateWithFFactorMethod ? NULL 324 : (MCalibrationChargeCam*)fIntensCharge->GetCam() ); 325 256 326 return kTRUE; 257 327 } … … 289 359 fNumCam++; 290 360 291 *fLog << inf << "MCalibCalcFromPast::ReInitialize #" << fNumCam << " ";361 *fLog << inf << "MCalibCalcFromPast::ReInitialize #" << fNumCam << ": "; 292 362 293 363 const Int_t runnumber = fRunHeader->GetRunNumber(); … … 331 401 } 332 402 403 404 Bool_t MCalibCalcFromPast::UpdateMeanPhes() 405 { 406 Float_t sumw = 0.; 407 Float_t sum = 0.; 408 409 for (Int_t i=0; i<fPhes.GetSize(); i++) 410 { 411 const Float_t weight = 1./fPhesVar[i]; 412 sum += fPhes[i]*weight; 413 sumw += weight; 414 } 415 416 if (sumw < 0.000001) 417 return kFALSE; 418 419 if (sum < 0.000001) 420 return kFALSE; 421 422 fMeanPhes = sum/sumw; 423 fMeanPhesRelVar = sumw/sum/sum; 424 425 return kTRUE; 426 } 427 333 428 // -------------------------------------------------------------------------- 334 429 // … … 336 431 // MCalibCalcFromPast.UpdateWithFFactorMethod: Off, On 337 432 // MCalibCalcFromPast.NumEventsDump: 500 433 // MCalibCalcFromPast.UpdateNumPhes: yes/no 434 // MCalibCalcFromPast.NumPhesDump: 10 338 435 // 339 436 Int_t MCalibCalcFromPast::ReadEnv(const TEnv &env, TString prefix, Bool_t print) … … 352 449 } 353 450 451 if (IsEnvDefined(env, prefix, "UpdateNumPhes", print)) 452 { 453 TString s = GetEnvValue(env, prefix, "UpdateNumPhes", ""); 454 s.ToLower(); 455 if (s.BeginsWith("no")) 456 SetUpdateNumPhes(kFALSE); 457 if (s.BeginsWith("yes")) 458 SetUpdateNumPhes(kTRUE); 459 rc = kTRUE; 460 } 461 462 if (IsEnvDefined(env, prefix, "NumPhesDump", print)) 463 { 464 SetNumPhesDump(GetEnvValue(env, prefix, "NumPhesDump", (Int_t)fNumPhesDump)); 465 rc = kTRUE; 466 } 467 468 469 354 470 return rc; 355 471 } -
trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h
r7005 r7189 4 4 #ifndef MARS_MTask 5 5 #include "MTask.h" 6 #endif 7 8 #ifndef ROOT_TArrayF 9 #include <TArrayF.h> 6 10 #endif 7 11 … … 17 21 class MCalibrationIntensityQECam; 18 22 class MCalibrationIntensityRelTimeCam; 23 class MCalibrationIntensityConstCam; 19 24 class MBadPixelsIntensityCam; 20 25 … … 22 27 { 23 28 private: 24 25 29 static const UInt_t fgNumEventsDump; //! Default for fNumEventsDump 30 static const UInt_t fgNumPhesDump; //! Default for fNumPhesDump 26 31 27 32 MGeomCam *fGeom; //! Camera Geometry … … 32 37 MCalibrationIntensityQECam *fIntensQE; //! Intensity QE Cam (to be created) 33 38 MCalibrationIntensityRelTimeCam *fIntensRelTime; //! Intensity Rel. Time Cam (to be created) 39 MCalibrationIntensityConstCam *fIntensConst; //! Intensity Rel. Time Cam (to be created) 34 40 MBadPixelsIntensityCam *fIntensBad; //! Intensity Bad Pixels Cam (to be created) 35 41 … … 38 44 MCalibrateData *fCalibrate; //! Data Calibration Task 39 45 46 UInt_t fNumCam; //! Number of currently used Calibration Cam 40 47 UInt_t fNumEventsDump; // Number of event after which the MCalibrationCams gets updated 41 48 UInt_t fNumEvents; //! Event counter only for calibration events 42 UInt_t fNumCam; //! Number of currently used Calibration Cam 49 UInt_t fNumPhesDump; // Number of cams after which the number of phes gets averaged 50 UInt_t fNumPhes; //! Event counter for photo-electron updates 51 52 Float_t fMeanPhes; 53 Float_t fMeanPhesRelVar; 43 54 44 55 Bool_t fUpdateWithFFactorMethod; // Update the interlaced calib events with the full F-Factor method 56 Bool_t fUpdateNumPhes; // Update the number of photo-electrons only after fNumPhesDump number of Cams 45 57 58 TArrayF fPhes; 59 TArrayF fPhesVar; 60 61 // MTask 46 62 Int_t PreProcess(MParList *pList); 47 63 Int_t Process(); 48 64 Int_t PostProcess(); 49 65 66 // MCalibCalcFromPast 50 67 Bool_t ReInitialize(); 51 68 Bool_t Finalize(const char* name); 52 69 70 Bool_t UpdateMeanPhes(); 71 72 // MParContainer 53 73 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 54 74 55 75 public: 76 MCalibCalcFromPast(const char *name=NULL, const char *title=NULL); 56 77 57 MCalibCalcFromPast(const char *name=NULL, const char *title=NULL); 58 ~MCalibCalcFromPast() {} 59 78 // Getter 60 79 UInt_t GetNumEventsDump() const { return fNumEventsDump; } 61 80 81 // Setter 62 82 void SetNumEventsDump( const UInt_t i=fgNumEventsDump ) { fNumEventsDump = i; } 83 void SetNumPhesDump ( const UInt_t i=fgNumPhesDump ) { fNumPhesDump = i; } 63 84 64 85 void SetCalibrate ( MCalibrateData *c ) { fCalibrate = c; } 65 86 void SetChargeCalc ( MCalibrationChargeCalc *c ) { fChargeCalc = c; } 66 87 void SetRelTimeCalc ( MCalibrationRelTimeCalc *c ) { fRelTimeCalc = c; } 88 void SetUpdateNumPhes ( const Bool_t b=kTRUE ) { fUpdateNumPhes = b; } 67 89 68 90 void SetUpdateWithFFactorMethod(const Bool_t b=kTRUE){ fUpdateWithFFactorMethod = b; } 69 91 70 ClassDef(MCalibCalcFromPast, 1) // Task to steer the processing of interlace calibration events92 ClassDef(MCalibCalcFromPast, 2) // Task to steer the processing of interlace calibration events 71 93 }; 72 94 -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r7122 r7189 92 92 // 93 93 // See also: MJCalibration, MJPedestal, MJExtractSignal, MJExtractCalibTest 94 // 94 // 95 95 ////////////////////////////////////////////////////////////////////////////// 96 96 #include "MCalibrateData.h" … … 112 112 #include "MPedestalPix.h" 113 113 114 #include "MCalibrationIntensityChargeCam.h" 114 115 #include "MCalibrationChargeCam.h" 115 116 #include "MCalibrationChargePix.h" 116 117 118 #include "MCalibrationIntensityQECam.h" 117 119 #include "MCalibrationQECam.h" 118 120 #include "MCalibrationQEPix.h" 119 121 122 #include "MCalibrationIntensityConstCam.h" 120 123 #include "MCalibConstCam.h" 121 124 #include "MCalibConstPix.h" … … 152 155 // 153 156 MCalibrateData::MCalibrateData(CalibrationMode_t calmode,const char *name, const char *title) 154 : fGeomCam(NULL), fBadPixels(NULL), fCalibrations(NULL), 155 fQEs(NULL), fSignals(NULL), fCerPhotEvt(NULL), fCalibConstCam(NULL), 156 fPedestalFlag(kNo), fSignalType(kPhot), fRenormFactor(1.), fScaleFactor(1.) 157 : fGeomCam(NULL), fBadPixels(NULL), fCalibrations(NULL), fIntensCalib(NULL), 158 fQEs(NULL), fIntensQE(NULL), fSignals(NULL), fCerPhotEvt(NULL), fCalibConstCam(NULL), 159 fIntensConst(NULL), fPedestalFlag(kNo), fSignalType(kPhot), fRenormFactor(1.), 160 fScaleFactor(1.) 157 161 { 158 162 … … 226 230 return kFALSE; 227 231 228 fCalibConstCam = (MCalibConstCam*)pList->FindCreateObj(AddSerialNumber("MCalibConstCam")); 229 if (!fCalibConstCam) 230 return kFALSE; 232 fIntensConst = (MCalibrationIntensityConstCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityConstCam")); 233 if (fIntensConst) 234 *fLog << inf << "Found MCalibrationIntensityConstCam ... " << endl; 235 else 236 { 237 fCalibConstCam = (MCalibConstCam*)pList->FindCreateObj(AddSerialNumber("MCalibConstCam")); 238 if (!fCalibConstCam) 239 return kFALSE; 240 } 231 241 } 232 242 … … 235 245 if (fCalibrationMode>kNone) 236 246 { 247 fIntensCalib = (MCalibrationIntensityChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityChargeCam")); 248 if (fIntensCalib) 249 *fLog << inf << "Found MCalibrationIntensityChargeCam ... " << endl; 250 237 251 fCalibrations = (MCalibrationChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam")); 238 252 if (!fCalibrations) … … 241 255 return kFALSE; 242 256 } 257 258 fIntensQE = (MCalibrationIntensityQECam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityQECam")); 259 if (fIntensQE) 260 *fLog << inf << "Found MCalibrationIntensityQECam ... " << endl; 243 261 244 262 fQEs = (MCalibrationQECam*)pList->FindObject(AddSerialNumber("MCalibrationQECam")); … … 290 308 { 291 309 case kPhe: 292 fRenormFactor = MCalibrationQEPix::gkDefaultAverageQE; 293 break; 310 // 311 // Average QE for C-photons, for pixels in the inner pixel region ("area 0"), 312 // used later to convert from C-photons into "equivalent phes": 313 // 314 if (fQEs->GetAverageAreas() > 0) 315 { 316 MCalibrationQEPix& avqepix = (MCalibrationQEPix&)(fQEs->GetAverageArea(0)); 317 fRenormFactor = avqepix.GetAverageQE(); 318 } 319 else // Average areas not yet initialized, use default value 320 fRenormFactor = MCalibrationQEPix::gkDefaultAverageQE; 321 322 fRenormFactor = MCalibrationQEPix::gkDefaultAverageQE; 323 break; 294 324 case kPhot: 295 fRenormFactor = 1.;296 break;325 fRenormFactor = 1.; 326 break; 297 327 } 298 328 … … 346 376 } 347 377 348 if(fCalibrationMode == kBlindPixel && !fQEs->IsBlindPixelMethodValid()) 378 const MCalibrationQECam *qecam = fIntensQE ? (MCalibrationQECam*)fIntensQE->GetCam() : fQEs; 379 if(fCalibrationMode == kBlindPixel && !qecam->IsBlindPixelMethodValid()) 349 380 { 350 381 *fLog << warn << "Blind pixel calibration method not valid, switching to F-factor method" << endl; … … 352 383 } 353 384 354 if(fCalibrationMode == kPinDiode && ! fQEs->IsPINDiodeMethodValid())385 if(fCalibrationMode == kPinDiode && !qecam->IsPINDiodeMethodValid()) 355 386 { 356 387 *fLog << warn << "PIN diode calibration method not valid, switching to F-factor method" << endl; … … 358 389 } 359 390 360 if(fCalibrationMode == kCombined && ! fQEs->IsCombinedMethodValid())391 if(fCalibrationMode == kCombined && !qecam->IsCombinedMethodValid()) 361 392 { 362 393 *fLog << warn << "Combined calibration method not valid, switching to F-factor method" << endl; … … 419 450 420 451 if (fCalibrationMode > kNone) 421 { 422 423 if (fCalibrations->GetSize() != npixels) 424 { 452 { 453 454 const MCalibrationCam *chargecam = fIntensCalib ? fIntensCalib->GetCam() : fCalibrations; 455 if (chargecam->GetSize() != npixels) 456 { 425 457 *fLog << "Size mismatch between MGeomCam and MCalibrationChargeCam... abort!" << endl; 426 458 return kFALSE; 427 428 459 } 460 429 461 if (fBadPixels->GetSize() != npixels) 430 462 { 431 463 *fLog << "Size mismatch between MGeomCam and MBadPixelsCam... abort!" << endl; 432 464 return kFALSE; 433 465 } 434 466 } 435 467 … … 466 498 fHiLoConv.Reset(); 467 499 fHiLoConvErr.Reset(); 468 500 501 MCalibConstCam *constcam = fIntensConst ? fIntensConst->GetCam() : fCalibConstCam; 502 503 MCalibrationChargeCam *chargecam = NULL; 504 MCalibrationQECam *qecam = NULL; 505 if (updatecam) 506 { 507 chargecam = fCalibrations; 508 qecam = fQEs; 509 } 510 else 511 { 512 chargecam = fIntensCalib ? (MCalibrationChargeCam*)fIntensCalib->GetCam() : fCalibrations; 513 qecam = fIntensQE ? (MCalibrationQECam*) fIntensQE->GetCam() : fQEs; 514 } 515 469 516 // 470 517 // For the moment, we use only a dummy zenith for the calibration: … … 488 535 Float_t calibUpdate = 1.; 489 536 490 MCalibConstPix &cpix = (* fCalibConstCam)[pixidx];537 MCalibConstPix &cpix = (*constcam)[pixidx]; 491 538 492 539 if(fCalibrationMode!=kNone) … … 499 546 } 500 547 501 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx];502 MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCalibrations->GetAverageArea(0);503 504 hiloconv = pix.GetConversionHiLo ();505 hiloconverr= pix.GetConversionHiLo Err();548 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[pixidx]; 549 const MCalibrationChargePix &avpix = (MCalibrationChargePix&)chargecam->GetAverageArea(0); 550 551 hiloconv = pix.GetConversionHiLo (); 552 hiloconverr= pix.GetConversionHiLoSigma(); 506 553 507 554 calibConv = pix.GetMeanConvFADC2Phe(); … … 509 556 calibFFactor = pix.GetMeanFFactorFADC2Phot(); 510 557 511 MCalibrationQEPix &qe = (MCalibrationQEPix&) (*fQEs)[pixidx];558 const MCalibrationQEPix &qe = (MCalibrationQEPix&)(*qecam)[pixidx]; 512 559 513 560 if (updatecam) … … 613 660 calibConv /= calibQE; 614 661 615 if (calibConv != 0. && calibQE != 0.)662 if (calibConv > 0.00001 && calibQE > 0.00001) 616 663 { 617 664 calibConvVar = calibConvVar/(calibConv*calibConv) + calibQEVar/(calibQE*calibQE); … … 632 679 calibConv = -1.; 633 680 calibFFactor = -1.; 681 *fLog << warn << "Conversion factor of Pixel " << pixidx << " out of range " << endl; 634 682 } 635 683 cpix.SetCalibConst(calibConv); -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
r7122 r7189 13 13 class MBadPixelsCam; 14 14 class MPedestalCam; 15 class MCalibrationChargeCam;16 class MCalibrationQECam;17 class MExtractedSignalCam;18 19 15 class MPedPhotCam; 20 16 class MSignalCam; 21 17 class MCalibConstCam; 18 class MExtractedSignalCam; 19 20 class MCalibrationChargeCam; 21 class MCalibrationQECam; 22 23 class MCalibrationIntensityChargeCam; 24 class MCalibrationIntensityQECam; 25 class MCalibrationIntensityConstCam; 22 26 23 27 class MCalibrateData : public MTask … … 58 62 Float_t fCalibConvMaxLimit; // Maximum limit for conv. factor 59 63 60 MGeomCam *fGeomCam; //! Camera geometry container 61 MBadPixelsCam *fBadPixels; //! Bad Pixels information 62 MCalibrationChargeCam *fCalibrations; //! Calibration constants 63 MCalibrationQECam *fQEs; //! Quantum efficiencies 64 MExtractedSignalCam *fSignals; //! Integrated charge in FADCs counts 65 MSignalCam *fCerPhotEvt; //! Cerenkov Photon Event used for calculation 66 MCalibConstCam *fCalibConstCam; //! Temporary calib consts storage 64 MGeomCam *fGeomCam; //! Camera geometry container 65 MBadPixelsCam *fBadPixels; //! Bad Pixels information 66 MCalibrationChargeCam *fCalibrations; //! Calibration constants 67 MCalibrationIntensityChargeCam *fIntensCalib; //! Calibration constants from interlaced calib. 68 MCalibrationQECam *fQEs; //! Quantum efficiencies 69 MCalibrationIntensityQECam *fIntensQE; //! Quantum efficiencies from interlaced calib. 70 MExtractedSignalCam *fSignals; //! Integrated charge in FADCs counts 71 MSignalCam *fCerPhotEvt; //! Cerenkov Photon Event used for calculation 72 MCalibConstCam *fCalibConstCam; //! Temporary calib consts storage 73 MCalibrationIntensityConstCam *fIntensConst; //! Temporary calib consts storage 67 74 68 75 CalibrationMode_t fCalibrationMode; // Flag defining the calibration mode (CalibrationMode_t) -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r7126 r7189 184 184 // + Float_t fPheErrUpperLimit; // Upper limit acceptance nr. phe's w.r.t. area idx mean (in sigmas) 185 185 // 186 // 186 187 // ClassVersion 3: 187 188 // + Bool_t fUseExtractorRes; // Include extractor resolution in F-Factor method 189 // 190 // ClassVersion 3: 191 // + Float_t fUnsuitablesLimit; // Limit for relative number of unsuitable pixels 192 // + Float_t fUnreliablesLimit; // Limit for relative number of unreliable pixels 193 // + Float_t fExternalNumPhes; // External mean number of photo-electrons set from outside 194 // + Float_t fExternalNumPhesRelVar; // External rel. var. number of photo-electrons set from outside 188 195 // 189 196 ////////////////////////////////////////////////////////////////////////////// … … 198 205 199 206 #include "MParList.h" 200 201 #include "MStatusDisplay.h"202 207 203 208 #include "MCalibrationPattern.h" … … 247 252 const Float_t MCalibrationChargeCalc::fgFFactorErrLimit = 4.5; 248 253 const Float_t MCalibrationChargeCalc::fgArrTimeRmsLimit = 3.5; 254 const Float_t MCalibrationChargeCalc::fgUnsuitablesLimit = 0.1; 255 const Float_t MCalibrationChargeCalc::fgUnreliablesLimit = 0.3; 249 256 const TString MCalibrationChargeCalc::fgNamePedestalCam = "MPedestalCam"; 250 257 … … 263 270 // 264 271 // Initializes: 265 // - fArrTimeRmsLimit to fgArrTimeRmsLimit 266 // - fChargeLimit to fgChargeLimit 267 // - fChargeErrLimit to fgChargeErrLimit 268 // - fChargeRelErrLimit to fgChargeRelErrLimit 269 // - fFFactorErrLimit to fgFFactorErrLimit 270 // - fLambdaCheckLimit to fgLambdaCheckLimit 271 // - fLambdaErrLimit to fgLambdaErrLimit 272 // - fNamePedestalCam to fgNamePedestalCam 273 // - fPheErrLowerLimit to fgPheErrLowerLimit 274 // - fPheErrUpperLimit to fgPheErrUpperLimit 275 // - fPulserColor to MCalibrationCam::kCT1 276 // - fOutputPath to "." 277 // - fOutputFile to "ChargeCalibStat.txt" 278 // - flag debug to kFALSE 272 // - fArrTimeRmsLimit to fgArrTimeRmsLimit 273 // - fChargeLimit to fgChargeLimit 274 // - fChargeErrLimit to fgChargeErrLimit 275 // - fChargeRelErrLimit to fgChargeRelErrLimit 276 // - fFFactorErrLimit to fgFFactorErrLimit 277 // - fLambdaCheckLimit to fgLambdaCheckLimit 278 // - fLambdaErrLimit to fgLambdaErrLimit 279 // - fNamePedestalCam to fgNamePedestalCam 280 // - fPheErrLowerLimit to fgPheErrLowerLimit 281 // - fPheErrUpperLimit to fgPheErrUpperLimit 282 // - fPulserColor to MCalibrationCam::kCT1 283 // - fOutputPath to "." 284 // - fOutputFile to "ChargeCalibStat.txt" 285 // - flag debug to kFALSE 286 // - IsUseExtractorRes to kFALSE 287 // - IsUseExternalNumPhes to kFALSE 288 // - fExternalNumPhes to 0. 289 // - fExternalNumPhesRelVar to 0. 279 290 // 280 291 // Sets all checks … … 284 295 // 285 296 MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title) 286 : fUseExtractorRes(kFALSE), 287 fGeom(NULL), fSignal(NULL), fCalibPattern(NULL), fExtractor(NULL) 297 : fGeom(NULL), fSignal(NULL), fCalibPattern(NULL), fExtractor(NULL) 288 298 { 289 299 … … 309 319 SetPheErrLowerLimit (); 310 320 SetPheErrUpperLimit (); 321 SetUnsuitablesLimit (); 322 SetUnreliablesLimit (); 323 SetUseExtractorRes (); 324 SetUseUnreliables (); 325 SetUseExternalNumPhes(kFALSE); 326 327 SetExternalNumPhes (); 328 SetExternalNumPhesRelVar(); 311 329 312 330 SetCheckArrivalTimes (); … … 560 578 } 561 579 580 fResultFlags.Set(fGeom->GetNumAreas()); 581 562 582 return kTRUE; 563 583 } … … 777 797 { 778 798 779 const MPedestalPix 799 const MPedestalPix &ped = fPedestals->GetAverageArea(aidx); 780 800 MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageArea(aidx); 801 const MArrayI &arr = fHCam->GetAverageAreaNum(); 781 802 782 803 FinalizePedestals(ped,pix,aidx); 804 805 // 806 // Correct for sqrt(number of valid pixels) in the pedestal RMS 807 // (already done for calibration sigma in MHCalibrationCam::CalcAverageSigma() 808 // 809 pix.SetPedRMS(pix.GetPedRms()*TMath::Sqrt((Float_t)arr[aidx]), 810 pix.GetPedRmsErr()*TMath::Sqrt((Float_t)arr[aidx])); 811 pix.SetSigma (pix.GetSigma()/pix.GetFFactorFADC2Phe()); 812 783 813 FinalizeCharges(pix, chargecam->GetAverageBadArea(aidx),"area id"); 784 814 FinalizeArrivalTimes(pix, chargecam->GetAverageBadArea(aidx), "area id"); … … 847 877 } 848 878 849 //850 // Finalize calibration statistics851 //852 FinalizeUnsuitablePixels();853 854 chargecam->SetReadyToSave();855 qecam ->SetReadyToSave();856 badcam ->SetReadyToSave();857 858 if (blindcam)859 blindcam->SetReadyToSave();860 if (fPINDiode)861 fPINDiode->SetReadyToSave();862 863 879 *fLog << inf << endl; 864 880 *fLog << GetDescriptor() << ": Fatal errors statistics:" << endl; … … 884 900 PrintUncalibrated(MBadPixelsPix::kDeviatingNumPhes, 885 901 "Deviating number of phes: "); 902 PrintUncalibrated(MBadPixelsPix::kLoGainBlackout, 903 "Too many blackout events in low gain: "); 886 904 PrintUncalibrated(MBadPixelsPix::kPreviouslyExcluded, 887 905 "Previously excluded: "); … … 906 924 SetLogStream(oldlog); 907 925 908 return kTRUE; 926 chargecam->SetReadyToSave(); 927 qecam ->SetReadyToSave(); 928 badcam ->SetReadyToSave(); 929 930 if (blindcam) 931 blindcam->SetReadyToSave(); 932 if (fPINDiode) 933 fPINDiode->SetReadyToSave(); 934 935 // 936 // Finalize calibration statistics 937 // 938 return FinalizeUnsuitablePixels(); 909 939 } 910 940 … … 1042 1072 } 1043 1073 1044 if (! fUseExtractorRes)1074 if (!IsUseExtractorRes()) 1045 1075 return kTRUE; 1046 1076 … … 1059 1089 : resinphes/cal.GetMeanConvFADC2Phe(); 1060 1090 1061 if (resinfadc > 1.5*cal.GetPedRms() ) 1062 { 1063 *fLog << warn << " Extractor Resolution: " << resinfadc << " bigger than Pedestal RMS " << cal.GetPedRms() << endl; 1064 resinfadc = cal.GetPedRms(); 1091 if (resinfadc > 3.0*cal.GetPedRms() ) 1092 { 1093 *fLog << warn << " Extractor Resolution: " << resinfadc << " bigger than 3 Pedestal RMS " 1094 << cal.GetPedRms() << endl; 1095 resinfadc = 3.0*cal.GetPedRms(); 1065 1096 } 1066 1097 … … 1152 1183 if (bad.IsUncalibrated( MBadPixelsPix::kChargeIsPedestal)) 1153 1184 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun ); 1154 1155 if (bad.IsUncalibrated( MBadPixelsPix::kChargeErrNotValid ))1156 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );1157 1158 if (bad.IsUncalibrated( MBadPixelsPix::kChargeRelErrNotValid ))1159 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );1160 1185 } 1161 1186 … … 1268 1293 if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid)) 1269 1294 continue; 1270 1295 1296 if (!IsUseUnreliables()) 1297 if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun)) 1298 continue; 1299 1271 1300 const Float_t nphe = pix.GetPheFFactorMethod(); 1272 1301 const Int_t aidx = (*fGeom)[i].GetAidx(); … … 1322 1351 if (ndf < 5) 1323 1352 { 1324 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the number of photo-electrons " 1325 << "in the camera with area index: " << i << endl; 1326 *fLog << warn << GetDescriptor() << ": Number of dof.: " << ndf << " is smaller than 5 " << endl; 1327 *fLog << warn << GetDescriptor() << ": Will use the simple mean and rms " << endl; 1328 delete hist; 1329 continue; 1353 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the number of photo-electrons " << endl; 1354 *fLog << " in the camera with area index: " << i << endl; 1355 *fLog << " Number of dof.: " << ndf << " is smaller than 5 " << endl; 1356 *fLog << " Will use the simple mean and rms " << endl; 1357 delete hist; 1358 SetPheFitOK(i,kFALSE); 1359 continue; 1330 1360 } 1331 1361 … … 1334 1364 if (prob < 0.001) 1335 1365 { 1336 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the number of photo-electrons "1337 << "in the camera with area index: " << i << endl;1338 *fLog << warn << GetDescriptor() << ": Fit probability " << prob1339 << " is smaller than 0.001" << endl;1340 *fLog << warn << GetDescriptor() << ": Will use the simple mean and rms " << endl;1341 delete hist;1342 continue;1366 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the number of photo-electrons " << endl; 1367 *fLog << " in the camera with area index: " << i << endl; 1368 *fLog << " Fit probability " << prob << " is smaller than 0.001 " << endl; 1369 *fLog << " Will use the simple mean and rms " << endl; 1370 delete hist; 1371 SetPheFitOK(i,kFALSE); 1372 continue; 1343 1373 } 1344 1374 1345 1375 if (mean < 0.) 1346 1376 { 1347 *fLog << inf << GetDescriptor() << ": Fitted mean number of photo-electrons " 1348 << "with area idx " << i << ": " << mean << " is smaller than 0. " << endl; 1349 *fLog << warn << GetDescriptor() << ": Will use the simple mean and rms " << endl; 1350 delete hist; 1351 continue; 1377 *fLog << inf << GetDescriptor() << ": Fitted mean number of photo-electrons " << endl; 1378 *fLog << " with area idx " << i << ": " << mean << " is smaller than 0. " << endl; 1379 *fLog << warn << " Will use the simple mean and rms " << endl; 1380 SetPheFitOK(i,kFALSE); 1381 delete hist; 1382 continue; 1352 1383 } 1353 1384 … … 1359 1390 1360 1391 delete hist; 1392 1393 SetPheFitOK(i,kTRUE); 1361 1394 } 1362 1395 … … 1383 1416 if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid)) 1384 1417 continue; 1418 1419 if (!IsUseUnreliables()) 1420 if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun)) 1421 continue; 1385 1422 1386 1423 const Float_t nvar = pix.GetPheFFactorMethodVar(); … … 1730 1767 MCalibrationQEPix &qepix = (MCalibrationQEPix&) qecam->GetAverageArea(0); 1731 1768 1732 const Float_t avphotons = avpix.GetPheFFactorMethod() 1769 if (IsDebug()) 1770 *fLog << dbginf << "External Phes: " << fExternalNumPhes 1771 << " Internal Phes: " << avpix.GetPheFFactorMethod() << endl; 1772 1773 const Float_t avphotons = ( IsUseExternalNumPhes() 1774 ? fExternalNumPhes 1775 : avpix.GetPheFFactorMethod() ) 1733 1776 / qepix.GetDefaultQE(fPulserColor) 1734 1777 / qepix.GetPMTCollectionEff() … … 1736 1779 / qecam->GetPlexiglassQE(); 1737 1780 1738 const Float_t avphotrelvar = avpix.GetPheFFactorMethodRelVar() 1781 const Float_t avphotrelvar = ( IsUseExternalNumPhes() 1782 ? fExternalNumPhesRelVar 1783 : avpix.GetPheFFactorMethodRelVar() ) 1739 1784 + qepix.GetDefaultQERelVar(fPulserColor) / fNumInnerFFactorMethodUsed 1740 1785 + qepix.GetPMTCollectionEffRelVar() … … 1846 1891 if (ndf < 2) 1847 1892 { 1848 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the F-Factor " 1849 << "in the camera with area index: " << i << endl;1850 *fLog << " Number of dof.: " << ndf << " is smaller than 2 " << endl;1851 *fLog << " Will use the simple mean and rms." << endl;1893 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the F-Factor " << endl; 1894 *fLog << " in the camera with area index: " << i << endl; 1895 *fLog << " Number of dof.: " << ndf << " is smaller than 2 " << endl; 1896 *fLog << " Will use the simple mean and rms." << endl; 1852 1897 delete hist; 1898 SetFFactorFitOK(i,kFALSE); 1853 1899 continue; 1854 1900 } … … 1858 1904 if (prob < 0.001) 1859 1905 { 1860 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the F-Factor " 1861 << "in the camera with area index: " << i << endl; 1862 *fLog << "Fit probability " << prob 1863 << " is smaller than 0.001 " << endl; 1864 *fLog << "Will use the simple mean and rms." << endl; 1906 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the F-Factor " << endl; 1907 *fLog << " in the camera with area index: " << i << endl; 1908 *fLog << " Fit probability " << prob << " is smaller than 0.001 " << endl; 1909 *fLog << " Will use the simple mean and rms." << endl; 1865 1910 delete hist; 1866 continue; 1911 SetFFactorFitOK(i,kFALSE); 1912 continue; 1867 1913 } 1868 1914 1869 1915 *fLog << inf << GetDescriptor() << ": Mean F-Factor " 1870 << "with area index #" << i << ": " 1871 << Form("%4.2f+-%4.2f",mean,sigma) << endl; 1916 << "with area index #" << i << ": " << Form("%4.2f+-%4.2f",mean,sigma) << endl; 1872 1917 1873 1918 lowlim [i] = 1.; … … 1875 1920 1876 1921 delete hist; 1922 1923 SetFFactorFitOK(i,kTRUE); 1877 1924 } 1878 1925 … … 2134 2181 // - store numbers of bad pixels of each type in fCam or fIntensCam 2135 2182 // 2136 voidMCalibrationChargeCalc::FinalizeUnsuitablePixels()2183 Bool_t MCalibrationChargeCalc::FinalizeUnsuitablePixels() 2137 2184 { 2138 2185 … … 2143 2190 const Int_t nareas = fGeom->GetNumAreas(); 2144 2191 2192 TArrayI suit(nareas); 2193 TArrayI unsuit(nareas); 2194 TArrayI unrel(nareas); 2195 2196 const MBadPixelsCam *badcam = fIntensBad ? (MBadPixelsCam*)fIntensBad->GetCam() : fBadPixels; 2197 MCalibrationChargeCam *chargecam = fIntensCam ? (MCalibrationChargeCam*)fIntensCam->GetCam() : fCam; 2198 2199 Int_t unsuitcnt=0; 2200 Int_t unrelcnt =0; 2201 2202 // Count number of succesfully calibrated pixels 2203 for (Int_t aidx=0; aidx<nareas; aidx++) 2204 { 2205 suit[aidx] = badcam->GetNumSuitable(MBadPixelsPix::kUnsuitableRun, fGeom, aidx); 2206 unsuit[aidx] = badcam->GetNumUnsuitable(MBadPixelsPix::kUnsuitableRun, fGeom, aidx); 2207 unrel[aidx] = badcam->GetNumUnsuitable(MBadPixelsPix::kUnreliableRun, fGeom, aidx); 2208 2209 unsuitcnt += unsuit[aidx]; 2210 unrelcnt += unrel[aidx]; 2211 2212 chargecam->SetNumUnsuitable(unsuit[aidx], aidx); 2213 chargecam->SetNumUnreliable(unrel[aidx], aidx); 2214 } 2215 2145 2216 TArrayI counts(nareas); 2146 2147 MBadPixelsCam *badcam = fIntensBad 2148 ? (MBadPixelsCam*)fIntensBad->GetCam() : fBadPixels; 2149 MCalibrationChargeCam *chargecam = fIntensCam 2150 ? (MCalibrationChargeCam*)fIntensCam->GetCam() : fCam; 2151 2152 for (Int_t i=0; i<badcam->GetSize(); i++) 2153 { 2154 MBadPixelsPix &bad = (*badcam)[i]; 2155 if (!bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 2156 { 2217 for (Int_t i=0; i<chargecam->GetSize(); i++) 2218 { 2219 MCalibrationPix &pix = (*chargecam)[i]; 2220 if (pix.IsHiGainSaturation()) 2221 { 2157 2222 const Int_t aidx = (*fGeom)[i].GetAidx(); 2158 2223 counts[aidx]++; 2159 2160 2224 } 2225 } 2161 2226 2162 2227 if (fGeom->InheritsFrom("MGeomCamMagic")) 2163 *fLog << " " << setw(7) << "Successfully calibrated Pixels: " 2164 << Form("%s%3i%s%3i","Inner: ",counts[0]," Outer: ",counts[1]) << endl; 2165 2166 counts.Reset(); 2167 2168 for (Int_t i=0; i<badcam->GetSize(); i++) 2169 { 2170 MBadPixelsPix &bad = (*badcam)[i]; 2171 2172 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 2173 { 2174 const Int_t aidx = (*fGeom)[i].GetAidx(); 2175 counts[aidx]++; 2176 } 2177 } 2178 2179 for (Int_t aidx=0; aidx<nareas; aidx++) 2180 chargecam->SetNumUnsuitable(counts[aidx], aidx); 2181 2182 if (fGeom->InheritsFrom("MGeomCamMagic")) 2183 *fLog << " " << setw(7) << "Uncalibrated Pixels: " 2184 << Form("%s%3i%s%3i","Inner: ",counts[0]," Outer: ",counts[1]) << endl; 2185 2186 counts.Reset(); 2187 2188 for (Int_t i=0; i<badcam->GetSize(); i++) 2189 { 2190 2191 MBadPixelsPix &bad = (*badcam)[i]; 2192 2193 if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun)) 2194 { 2195 const Int_t aidx = (*fGeom)[i].GetAidx(); 2196 counts[aidx]++; 2197 } 2198 } 2199 2200 for (Int_t aidx=0; aidx<nareas; aidx++) 2201 chargecam->SetNumUnreliable(counts[aidx], aidx); 2202 2203 *fLog << " " << setw(7) << "Unreliable Pixels: " 2204 << Form("%s%3i%s%3i","Inner: ",counts[0]," Outer: ",counts[1]) << endl; 2205 2228 { 2229 *fLog << " Successfully calibrated Pixels: Inner: " 2230 << Form("%3i",suit[0]) << " Outer: " << Form("%3i",suit[1]) << endl; 2231 *fLog << " Uncalibrated Pixels: Inner: " 2232 << Form("%3i",unsuit[0]) << " Outer: " << Form("%3i",unsuit[1]) << endl; 2233 *fLog << " Unreliable Pixels: Inner: " 2234 << Form("%3i",unrel[0]) << " Outer: " << Form("%3i",unrel[1]) << endl; 2235 *fLog << " High-gain saturated Pixels: Inner: " 2236 << Form("%3i",counts[0]) << " Outer: " << Form("%3i",counts[1]) << endl; 2237 *fLog << endl; 2238 } 2239 2240 return kTRUE; 2241 2242 if (unsuitcnt > fUnsuitablesLimit*fGeom->GetNumPixels()) 2243 { 2244 *fLog << err << "Number of unsuitable pixels: " << 100.*unsuitcnt/fGeom->GetNumPixels() 2245 << "% exceeds limit of " << fUnsuitablesLimit*100 << "%" << endl; 2246 return kFALSE; 2247 } 2248 2249 if (unrelcnt > fUnreliablesLimit*fGeom->GetNumPixels()) 2250 { 2251 *fLog << err << "Relative number of unreliable pixels: " << 100.*unrelcnt/fGeom->GetNumPixels() 2252 << "% exceeds limit of " << fUnreliablesLimit*100 << "%" << endl; 2253 return kFALSE; 2254 } 2255 return kTRUE; 2206 2256 } 2207 2257 … … 2232 2282 } 2233 2283 2234 *fLog << " " << setw(7) << text 2235 << Form("%s%3i%s%3i","Inner: ",countinner," Outer: ",countouter) << endl;2284 *fLog << " " << setw(7) << text << "Inner: " << Form("%3i",countinner) 2285 << " Outer: " << Form("%3i", countouter) << endl; 2236 2286 } 2237 2287 … … 2361 2411 rc = kTRUE; 2362 2412 } 2363 if (IsEnvDefined(env, prefix, "UseExtractorRes", print))2364 {2365 SetUseExtractorRes(GetEnvValue(env, prefix, "UseExtractorRes", fUseExtractorRes));2413 if (IsEnvDefined(env, prefix, "UseExtractorRes", print)) 2414 { 2415 SetUseExtractorRes(GetEnvValue(env, prefix, "UseExtractorRes", IsUseExtractorRes())); 2366 2416 rc = kTRUE; 2367 2417 } 2418 if (IsEnvDefined(env, prefix, "UseUnreliables", print)) 2419 { 2420 SetUseUnreliables(GetEnvValue(env, prefix, "UseUnreliables", IsUseUnreliables())); 2421 rc = kTRUE; 2422 } 2423 2424 if (IsEnvDefined(env, prefix, "UseExternalNumPhes", print)) 2425 { 2426 SetUseExternalNumPhes(GetEnvValue(env, prefix, "UseExternalNumPhes", IsUseExternalNumPhes())); 2427 rc = kTRUE; 2428 } 2429 2430 if (IsEnvDefined(env, prefix, "UnsuitablesLimit", print)) 2431 { 2432 SetUnsuitablesLimit(GetEnvValue(env, prefix, "UnsuitablesLimit", fUnsuitablesLimit)); 2433 rc = kTRUE; 2434 } 2435 2436 if (IsEnvDefined(env, prefix, "UnreliablesLimit", print)) 2437 { 2438 SetUnreliablesLimit(GetEnvValue(env, prefix, "UnreliablesLimit", fUnreliablesLimit)); 2439 rc = kTRUE; 2440 } 2441 2368 2442 2369 2443 return rc; -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
r7099 r7189 50 50 static const Float_t fgFFactorErrLimit; //! Default for fFFactorErrLimit (now set to: 4.5) 51 51 static const Float_t fgArrTimeRmsLimit; //! Default for fArrTimeRmsLimit (now set to: 3.5) 52 static const Float_t fgUnsuitablesLimit; //! Default for fUnsuitableLimit (now set to: 0.1) 53 static const Float_t fgUnreliablesLimit; //! Default for fUnreliableLimit (now set to: 0.3) 52 54 53 55 static const TString fgNamePedestalCam; //! "MPedestalCam" 54 56 55 57 // Variables 58 Float_t fArrTimeRmsLimit; // Limit acceptance RMS of absolute arrival times 56 59 Float_t fChargeLimit; // Limit acceptance mean charge (in units of PedRMS) 57 60 Float_t fChargeErrLimit; // Limit acceptance charge error (in abs. numbers) 58 61 Float_t fChargeRelErrLimit; // Limit acceptance rel. error mean (in abs. numbers) 62 Float_t fFFactorErrLimit; // Limit acceptance F-Factor w.r.t. area idx mean 59 63 Float_t fLambdaCheckLimit; // Limit rel. diff. lambda and lambdacheck in Blind Pixel 60 64 Float_t fLambdaErrLimit; // Limit acceptance lambda error in Blind Pixel … … 63 67 Float_t fPheErrLowerLimit; // Lower limit acceptance nr. phe's w.r.t. area idx mean (in sigmas) 64 68 Float_t fPheErrUpperLimit; // Upper limit acceptance nr. phe's w.r.t. area idx mean (in sigmas) 65 Float_t fFFactorErrLimit; // Limit acceptance F-Factor w.r.t. area idx mean66 Float_t fArrTimeRmsLimit; // Limit acceptance RMS of absolute arrival times67 69 Float_t fSqrtHiGainSamples; // Square root nr. High-Gain FADC slices used by extractor 68 70 Float_t fSqrtLoGainSamples; // Square root nr. Low -Gain FADC slices used by extractor 71 Float_t fUnsuitablesLimit; // Limit for relative number of unsuitable pixels 72 Float_t fUnreliablesLimit; // Limit for relative number of unreliable pixels 73 74 Float_t fExternalNumPhes; // External mean number of photo-electrons set from outside 75 Float_t fExternalNumPhesRelVar; // External rel. var. number of photo-electrons set from outside 69 76 70 77 MCalibrationCam::PulserColor_t fPulserColor; // Calibration LEDs colour … … 73 80 Int_t fNumInnerFFactorMethodUsed; // Number of inner pixels used for F-Factor Method calibration 74 81 75 Byte_t fFlags; // Bit-field for the general flags76 TArrayC fResultFlags; // Bit-fields for the fitting results (one field per area index)77 TArrayC fBlindPixelFlags; // Bit-fields for the blind pixel flags (one field per blind pixel)78 TArrayC fPINDiodeFlags; // Bit-fields for the PIN Diode flags (one field per PIN Diode )79 80 82 TString fOutputPath; // Path to the output file 81 83 TString fOutputFile; // Name of the output file … … 83 85 84 86 Int_t fNumProcessed; // Number of processed events (for Intensity calibration) 85 Bool_t fUseExtractorRes; // Include extractor resolution in F-Factor method86 87 87 88 // Pointers … … 115 116 116 117 Byte_t fCheckFlags; // Bit-field to hold the possible check flags 117 118 119 enum FitResult_t { kPheFitOK, 120 kFFactorFitOK, 121 kBlindPixelFitOK, 122 kBlindPixelPedFitOK, 123 kPINDiodeFitOK }; // Possible Fit Result flags 124 125 TArrayC fResultFlags; // Bit-fields for the fitting results (one field per area index) 126 TArrayC fBlindPixelFlags; // Bit-fields for the blind pixel flags (one field per blind pixel) 127 TArrayC fPINDiodeFlags; // Bit-fields for the PIN Diode flags (one field per PIN Diode ) 128 118 129 enum { kDebug, 119 kPheFitOK, kFFactorFitOK, kBlindPixelFitOK, kBlindPixelPedFitOK, kPINDiodeFitOK }; 130 kUseExtractorRes, 131 kUseUnreliables, 132 kUseExternalNumPhes }; // Possible general flags 133 134 Byte_t fFlags; // Bit-field to hold the general flags 120 135 121 136 // functions 137 void FinalizeArrivalTimes ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what); 138 void FinalizeBadPixels (); 139 Bool_t FinalizeBlindCam (); 140 void FinalizeBlindPixelQECam (); 141 Bool_t FinalizeCharges ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what); 142 void FinalizeCombinedQECam (); 143 void FinalizeFFactorQECam (); 144 Bool_t FinalizeFFactorMethod (); 122 145 void FinalizePedestals ( const MPedestalPix &ped, MCalibrationChargePix &cal, const Int_t aidx ); 123 void FinalizeArrivalTimes ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);124 Bool_t FinalizeCharges ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);125 146 Bool_t FinalizePINDiode (); 126 Bool_t FinalizeBlindCam ();127 Bool_t FinalizeFFactorMethod ();128 void FinalizeBadPixels ();129 void FinalizeFFactorQECam ();130 void FinalizeBlindPixelQECam ();131 147 void FinalizePINDiodeQECam (); 132 void FinalizeCombinedQECam (); 133 void FinalizeUnsuitablePixels(); 148 Bool_t FinalizeUnsuitablePixels(); 134 149 135 150 const char* GetOutputFile(); … … 143 158 Bool_t IsCheckArrivalTimes () const { return TESTBIT(fCheckFlags,kCheckArrivalTimes); } 144 159 160 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); } 161 Bool_t IsUseExtractorRes () const { return TESTBIT(fFlags,kUseExtractorRes); } 162 Bool_t IsUseUnreliables () const { return TESTBIT(fFlags,kUseUnreliables); } 163 Bool_t IsUseExternalNumPhes () const { return TESTBIT(fFlags,kUseExternalNumPhes); } 164 145 165 void PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const; 146 166 147 167 // Global fit results 148 void SetPheFitOK ( const Int_t aidx, const Bool_t b=kTRUE ) { 149 b ? SETBIT(fResultFlags[aidx], kPheFitOK) 150 : CLRBIT(fResultFlags[aidx], kPheFitOK); } 151 void SetFFactorFitOK ( const Int_t aidx, const Bool_t b=kTRUE ) { 152 b ? SETBIT(fResultFlags[aidx], kFFactorFitOK) 153 : CLRBIT(fResultFlags[aidx], kFFactorFitOK); } 154 void SetBlindPixelFitOK ( const Int_t idx, const Bool_t b=kTRUE ) { 155 b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelFitOK) 156 : CLRBIT(fBlindPixelFlags[idx], kBlindPixelFitOK); } 157 void SetBlindPixelPedFitOK( const Int_t idx, const Bool_t b=kTRUE ) { 158 b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK) 159 : CLRBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK); } 160 void SetPINDiodeFitOK ( const Int_t idx, const Bool_t b=kTRUE ) { 161 b ? SETBIT(fPINDiodeFlags[idx], kPINDiodeFitOK) 162 : CLRBIT(fPINDiodeFlags[idx], kPINDiodeFitOK); } 168 void SetPheFitOK (const Int_t aidx, const Bool_t b=kTRUE) { b ? SETBIT(fResultFlags[aidx], kPheFitOK) : CLRBIT(fResultFlags[aidx], kPheFitOK); } 169 void SetFFactorFitOK (const Int_t aidx, const Bool_t b=kTRUE) { b ? SETBIT(fResultFlags[aidx], kFFactorFitOK) : CLRBIT(fResultFlags[aidx], kFFactorFitOK); } 170 void SetBlindPixelFitOK (const Int_t idx, const Bool_t b=kTRUE) { b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelFitOK) : CLRBIT(fBlindPixelFlags[idx], kBlindPixelFitOK); } 171 void SetBlindPixelPedFitOK(const Int_t idx, const Bool_t b=kTRUE) { b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK): CLRBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK); } 172 void SetPINDiodeFitOK (const Int_t idx, const Bool_t b=kTRUE) { b ? SETBIT(fPINDiodeFlags[idx], kPINDiodeFitOK): CLRBIT(fPINDiodeFlags[idx], kPINDiodeFitOK); } 163 173 164 174 Int_t PreProcess (MParList *pList); … … 169 179 170 180 public: 171 172 181 MCalibrationChargeCalc(const char *name=NULL, const char *title=NULL); 173 182 … … 176 185 Int_t Finalize(); 177 186 178 Bool_t IsDebug() const { return TESTBIT(fFlags,kDebug); } 187 void SetChargeLimit (const Float_t f=fgChargeLimit ) { fChargeLimit = f; } 188 void SetChargeErrLimit (const Float_t f=fgChargeErrLimit ) { fChargeErrLimit = f; } 189 void SetChargeRelErrLimit(const Float_t f=fgChargeRelErrLimit) { fChargeRelErrLimit = f; } 190 191 // Checks 192 void SetCheckArrivalTimes(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckArrivalTimes) : CLRBIT(fCheckFlags,kCheckArrivalTimes); } 193 void SetCheckDeadPixels(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckDeadPixels) : CLRBIT(fCheckFlags,kCheckDeadPixels); } 194 void SetCheckDeviatingBehavior(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckDeviatingBehavior) : CLRBIT(fCheckFlags,kCheckDeviatingBehavior); } 195 void SetCheckExtractionWindow(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckExtractionWindow) : CLRBIT(fCheckFlags,kCheckExtractionWindow); } 196 void SetCheckHistOverflow(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckHistOverflow) : CLRBIT(fCheckFlags,kCheckHistOverflow); } 197 void SetCheckOscillations(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckOscillations) : CLRBIT(fCheckFlags,kCheckOscillations); } 198 void SetDebug(const Bool_t b=kTRUE) { b ? SETBIT(fFlags, kDebug) : CLRBIT(fFlags, kDebug); } 199 void SetUseExtractorRes(const Bool_t b=kTRUE) { b ? SETBIT(fFlags, kUseExtractorRes) : CLRBIT(fFlags, kUseExtractorRes); } 200 void SetUseUnreliables(const Bool_t b=kTRUE) { b ? SETBIT(fFlags, kUseUnreliables) : CLRBIT(fFlags, kUseUnreliables); } 201 void SetUseExternalNumPhes(const Bool_t b=kTRUE) { b ? SETBIT(fFlags, kUseExternalNumPhes) : CLRBIT(fFlags, kUseExternalNumPhes); } 202 203 // pointers 204 void SetPedestals(MPedestalCam *cam) { fPedestals=cam; } 205 void SetExtractor(MExtractor *ext) { fExtractor=ext; } 206 207 // limits 208 void SetArrTimeRmsLimit (const Float_t f=fgArrTimeRmsLimit ) { fArrTimeRmsLimit = f; } 209 void SetFFactorErrLimit (const Float_t f=fgFFactorErrLimit ) { fFFactorErrLimit = f; } 210 void SetLambdaErrLimit (const Float_t f=fgLambdaErrLimit ) { fLambdaErrLimit = f; } 211 void SetLambdaCheckLimit(const Float_t f=fgLambdaCheckLimit) { fLambdaCheckLimit = f; } 212 void SetUnsuitablesLimit(const Float_t f=fgUnsuitablesLimit) { fUnsuitablesLimit = f; } 213 void SetUnreliablesLimit(const Float_t f=fgUnreliablesLimit) { fUnreliablesLimit = f; } 214 215 // others 216 void SetExternalNumPhes ( const Float_t f=0. ) { fExternalNumPhes = f; } 217 void SetExternalNumPhesRelVar( const Float_t f=0. ) { fExternalNumPhesRelVar = f; } 218 void SetNamePedestalCam ( const char *name=fgNamePedestalCam.Data()) { fNamePedestalCam = name; } 219 void SetOutputPath ( const TString path="." ); 220 void SetOutputFile ( const TString file="ChargeCalibStat.txt" ); 221 void SetPheErrLowerLimit ( const Float_t f=fgPheErrLowerLimit ) { fPheErrLowerLimit = f; } 222 void SetPheErrUpperLimit ( const Float_t f=fgPheErrUpperLimit ) { fPheErrUpperLimit = f; } 223 void SetPulserColor ( const MCalibrationCam::PulserColor_t col ) { fPulserColor = col; } 179 224 180 void SetChargeLimit ( const Float_t f=fgChargeLimit ) { fChargeLimit = f; } 181 void SetChargeErrLimit ( const Float_t f=fgChargeErrLimit ) { fChargeErrLimit = f; } 182 void SetChargeRelErrLimit ( const Float_t f=fgChargeRelErrLimit ) { fChargeRelErrLimit = f; } 183 184 // Checks 185 void SetCheckArrivalTimes( const Bool_t b=kTRUE ) { 186 b ? SETBIT(fCheckFlags,kCheckArrivalTimes) 187 : CLRBIT(fCheckFlags,kCheckArrivalTimes); } 188 void SetCheckDeadPixels( const Bool_t b=kTRUE ) { 189 b ? SETBIT(fCheckFlags,kCheckDeadPixels) 190 : CLRBIT(fCheckFlags,kCheckDeadPixels); } 191 void SetCheckDeviatingBehavior( const Bool_t b=kTRUE ) { 192 b ? SETBIT(fCheckFlags,kCheckDeviatingBehavior) 193 : CLRBIT(fCheckFlags,kCheckDeviatingBehavior); } 194 void SetCheckExtractionWindow( const Bool_t b=kTRUE ) { 195 b ? SETBIT(fCheckFlags,kCheckExtractionWindow) 196 : CLRBIT(fCheckFlags,kCheckExtractionWindow); } 197 void SetCheckHistOverflow( const Bool_t b=kTRUE ) { 198 b ? SETBIT(fCheckFlags,kCheckHistOverflow) 199 : CLRBIT(fCheckFlags,kCheckHistOverflow); } 200 void SetCheckOscillations( const Bool_t b=kTRUE ) { 201 b ? SETBIT(fCheckFlags,kCheckOscillations) 202 : CLRBIT(fCheckFlags,kCheckOscillations); } 203 void SetDebug ( const Bool_t b=kTRUE ) { 204 b ? SETBIT(fFlags, kDebug) 205 : CLRBIT(fFlags, kDebug); } 206 207 void SetExtractor(MExtractor *ext) { fExtractor=ext; } 208 void SetPedestals(MPedestalCam *cam) { fPedestals=cam; } 209 210 void SetArrTimeRmsLimit ( const Float_t f=fgArrTimeRmsLimit ) { fArrTimeRmsLimit = f; } 211 void SetFFactorErrLimit ( const Float_t f=fgFFactorErrLimit ) { fFFactorErrLimit = f; } 212 void SetLambdaErrLimit ( const Float_t f=fgLambdaErrLimit ) { fLambdaErrLimit = f; } 213 void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit ) { fLambdaCheckLimit = f; } 214 void SetNamePedestalCam ( const char *name=fgNamePedestalCam.Data()) { fNamePedestalCam = name; } 215 void SetOutputPath ( TString path="." ); 216 void SetOutputFile ( TString file="ChargeCalibStat.txt" ); 217 void SetPheErrLowerLimit ( const Float_t f=fgPheErrLowerLimit ) { fPheErrLowerLimit = f; } 218 void SetPheErrUpperLimit ( const Float_t f=fgPheErrUpperLimit ) { fPheErrUpperLimit = f; } 219 void SetPulserColor ( const MCalibrationCam::PulserColor_t col ) { fPulserColor = col; } 220 void SetUseExtractorRes(Bool_t b=kTRUE) { fUseExtractorRes = b; } 221 222 ClassDef(MCalibrationChargeCalc, 3) // Task calculating Calibration Containers and Quantum Efficiencies 225 ClassDef(MCalibrationChargeCalc, 4) // Task calculating Calibration Containers and Quantum Efficiencies 223 226 }; 224 227 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h
r7188 r7189 188 188 Bool_t CalcMeanFFactor(const Float_t nphotons, const Float_t nphotonsrelvar); 189 189 190 ClassDef(MCalibrationChargePix, 3) // Container Charge Calibration Results Pixel190 ClassDef(MCalibrationChargePix, 4) // Container Charge Calibration Results Pixel 191 191 }; 192 192 -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityCam.cc
r7005 r7189 41 41 // MCalibrationChargeBlindPix, MCalibrationChargePINDiode 42 42 // 43 // Inline Functions: 44 // ----------------- 45 // 46 // GetSize(): Returns the current size of the TOrdCollection fCams 47 // independently if the MCalibrationCam is filled with values or not. 48 // 49 // GetAverageAreas(): Returns the current size of the TOrdCollection 50 // fAverageAreas of the current camera. 51 // 52 // GetAverageArea(UInt_t i): Get i-th High Gain pixel Area from the 53 // current camera 54 // 55 // GetAverageArea(UInt_t i): Get i-th High Gain pixel Area from the 56 // current camera 57 // 58 // GetAverageBadArea(UInt_t i): Get i-th High Gain pixel Area from the 59 // current camera 60 // 61 // GetAverageBadArea(UInt_t i): Get i-th High Gain pixel Area from the 62 // current camera 63 // 64 // GetAverageSectors(): Returns the current size of the TOrdCollection 65 // fAverageSectors or the current camera 66 // 67 // GetAverageSector(UInt_t i): Get i-th High Gain Sector from the 68 // current camera 69 // 70 // GetAverageSector(UInt_t i): Get i-th High Gain Sector from the current 71 // camera 72 // 73 // GetAverageBadSector(UInt_t i): Get i-th High Gain Sector from the 74 // current camera 75 // 76 // GetAverageBadSector(UInt_t i): Get i-th High Gain Sector from the 77 // current camera 78 // 79 // 43 80 // ClassVersion 2: 44 81 // + fHists 82 // 83 // ClassVersion 3: 84 // - MArrayD fOffsets; //! Arrays of Higain-vs-LoGain fit result Offsets 85 // - MArrayD fSlopes; //! Arrays of Higain-vs-LoGain fit result Slopes 45 86 // 46 87 ///////////////////////////////////////////////////////////////////////////// … … 127 168 128 169 MParContainer::Copy(calib); 129 130 calib.fOffsets = fOffsets;131 calib.fSlopes = fSlopes;132 170 133 171 const UInt_t n = GetSize(); … … 163 201 } 164 202 165 // -----------------------------------------------------166 //167 // Not yet installed...168 //169 void MCalibrationIntensityCam::DrawHiLoFits()170 {171 172 /*173 if (!fOffsets)174 fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.);175 if (!fSlopes)176 fSlopes = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.);177 if (!fOffvsSlope)178 fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.);179 180 TIter Next(fPixels);181 MCalibrationPix *pix;182 MHCalibrationPixel *hist;183 while ((pix=(MCalibrationPix*)Next()))184 {185 hist = pix->GetHist();186 hist->FitHiGainvsLoGain();187 fOffsets->Fill(hist->GetOffset(),1.);188 fSlopes->Fill(hist->GetSlope(),1.);189 fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.);190 }191 192 TCanvas *c1 = new TCanvas();193 194 c1->Divide(1,3);195 c1->cd(1);196 fOffsets->Draw();197 gPad->Modified();198 gPad->Update();199 200 c1->cd(2);201 fSlopes->Draw();202 gPad->Modified();203 gPad->Update();204 205 c1->cd(3);206 fOffvsSlope->Draw("col1");207 gPad->Modified();208 gPad->Update();209 */210 }211 212 203 // ------------------------------------------------------------------- 213 204 // … … 256 247 } 257 248 258 259 // -------------------------------------------------------------------------- 260 // 261 // Returns the current size of the TOrdCollection fCams 262 // independently if the MCalibrationCam is filled with values or not. 263 // 264 const Int_t MCalibrationIntensityCam::GetSize() const 265 { 266 return fCams->GetSize(); 267 } 268 269 // -------------------------------------------------------------------------- 270 // 271 // Get i-th pixel from current camera 272 // 273 MCalibrationPix &MCalibrationIntensityCam::operator[](UInt_t i) 274 { 275 return (*GetCam())[i]; 276 } 277 278 // -------------------------------------------------------------------------- 279 // 280 // Get i-th pixel from current camera 281 // 282 const MCalibrationPix &MCalibrationIntensityCam::operator[](UInt_t i) const 283 { 284 return (*GetCam())[i]; 285 } 286 287 288 // -------------------------------------------------------------------------- 289 // 290 // Returns the current size of the TOrdCollection fAverageAreas of the current camera. 291 // 292 const Int_t MCalibrationIntensityCam::GetAverageAreas() const 293 { 294 return GetCam()->GetAverageAreas(); 295 } 296 297 // -------------------------------------------------------------------------- 298 // 299 // Get i-th High Gain pixel Area from the current camera 300 // 301 MCalibrationPix &MCalibrationIntensityCam::GetAverageArea(UInt_t i) 302 { 303 return GetCam()->GetAverageArea(i); 304 } 305 306 // -------------------------------------------------------------------------- 307 // 308 // Get i-th High Gain pixel Area from the current camera 309 // 310 const MCalibrationPix &MCalibrationIntensityCam::GetAverageArea(UInt_t i) const 311 { 312 return GetCam()->GetAverageArea(i); 313 } 314 315 // -------------------------------------------------------------------------- 316 // 317 // Get i-th High Gain pixel Area from the current camera 318 // 319 MBadPixelsPix &MCalibrationIntensityCam::GetAverageBadArea(UInt_t i) 320 { 321 return GetCam()->GetAverageBadArea(i); 322 } 323 324 // -------------------------------------------------------------------------- 325 // 326 // Get i-th High Gain pixel Area from the current camera 327 // 328 const MBadPixelsPix &MCalibrationIntensityCam::GetAverageBadArea(UInt_t i) const 329 { 330 return GetCam()->GetAverageBadArea(i); 331 } 332 333 // -------------------------------------------------------------------------- 334 // 335 // Returns the current size of the TOrdCollection fAverageSectors or the current camera 336 // 337 const Int_t MCalibrationIntensityCam::GetAverageSectors() const 338 { 339 return GetCam()->GetAverageSectors(); 340 } 341 342 // -------------------------------------------------------------------------- 343 // 344 // Get i-th High Gain Sector from the current camera 345 // 346 MCalibrationPix &MCalibrationIntensityCam::GetAverageSector(UInt_t i) 347 { 348 return GetCam()->GetAverageSector(i); 349 } 350 351 // -------------------------------------------------------------------------- 352 // 353 // Get i-th High Gain Sector from the current camera 354 // 355 const MCalibrationPix &MCalibrationIntensityCam::GetAverageSector(UInt_t i) const 356 { 357 return GetCam()->GetAverageSector(i); 358 } 359 360 // -------------------------------------------------------------------------- 361 // 362 // Get i-th High Gain Sector from the current camera 363 // 364 MBadPixelsPix &MCalibrationIntensityCam::GetAverageBadSector(UInt_t i) 365 { 366 return GetCam()->GetAverageBadSector(i); 367 } 368 369 // -------------------------------------------------------------------------- 370 // 371 // Get i-th High Gain Sector from the current camera 372 // 373 const MBadPixelsPix &MCalibrationIntensityCam::GetAverageBadSector(UInt_t i) const 374 { 375 return GetCam()->GetAverageBadSector(i); 376 } 377 378 379 // -------------------------------------------------------------------------- 380 // 381 // Get i-th camera 382 // 383 MCalibrationCam *MCalibrationIntensityCam::GetCam(Int_t i) 384 { 385 return static_cast<MCalibrationCam*>(i==-1 ? fCams->Last() : fCams->At(i)); 386 } 387 388 // -------------------------------------------------------------------------- 389 // 390 // Get i-th camera 391 // 392 const MCalibrationCam *MCalibrationIntensityCam::GetCam(Int_t i) const 393 { 394 return static_cast<MCalibrationCam*>(i==-1 ? fCams->Last() : fCams->At(i)); 395 } 396 397 // -------------------------------------------------------------------------- 398 // 399 // Get camera with name 'name' 400 // 401 MCalibrationCam *MCalibrationIntensityCam::GetCam(const char *name ) 402 { 403 return static_cast<MCalibrationCam*>(fCams->FindObject(name)); 404 } 405 406 // -------------------------------------------------------------------------- 407 // 408 // Get camera with name 'name' 409 // 410 const MCalibrationCam *MCalibrationIntensityCam::GetCam(const char *name ) const 411 { 412 return static_cast<MCalibrationCam*>(fCams->FindObject(name)); 413 } 414 415 // -------------------------------------------------------------------------- 416 // 417 // Calls GetPixelContent for the current entry in fCams 418 // 419 Bool_t MCalibrationIntensityCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const 420 { 421 return GetCam()->GetPixelContent(val,idx,cam,type); 422 } 423 424 // -------------------------------------------------------------------------- 425 // 426 // Calls DrawPixelContent for the current entry in fCams 427 // 428 void MCalibrationIntensityCam::DrawPixelContent( Int_t num ) const 429 { 430 return GetCam()->DrawPixelContent(num); 431 } 432 433 Int_t MCalibrationIntensityCam::CountNumEntries(const MCalibrationCam::PulserColor_t col) const 249 // -------------------------------------------------------------------------- 250 // 251 Int_t MCalibrationIntensityCam::CountNumEntries(const MCalibrationCam::PulserColor_t col) const 434 252 { 435 253 … … 451 269 // -------------------------------------------------------------------------- 452 270 // 271 // Get i-th pixel from current camera 272 // 273 MCalibrationPix &MCalibrationIntensityCam::operator[](UInt_t i) 274 { 275 return (*GetCam())[i]; 276 } 277 278 // -------------------------------------------------------------------------- 279 // 280 // Get i-th pixel from current camera 281 // 282 const MCalibrationPix &MCalibrationIntensityCam::operator[](UInt_t i) const 283 { 284 return (*GetCam())[i]; 285 } 286 287 // -------------------------------------------------------------------------- 288 // 289 // Get camera with name 'name' 290 // 291 MCalibrationCam *MCalibrationIntensityCam::GetCam(const char *name) 292 { 293 return static_cast<MCalibrationCam*>(fCams->FindObject(name)); 294 } 295 296 // -------------------------------------------------------------------------- 297 // 298 // Get camera with name 'name' 299 // 300 const MCalibrationCam *MCalibrationIntensityCam::GetCam(const char *name) const 301 { 302 return static_cast<MCalibrationCam*>(fCams->FindObject(name)); 303 } 304 305 // -------------------------------------------------------------------------- 306 // 453 307 // Get i-th histogram class 454 308 // 455 309 MHCalibrationCam *MCalibrationIntensityCam::GetHist(Int_t i) 456 310 { 457 458 } 459 460 // -------------------------------------------------------------------------- 461 // 462 // Get i-th histogram class 463 // 464 const MHCalibrationCam *MCalibrationIntensityCam::GetHist(Int_t i) const 465 { 466 467 } 468 469 // -------------------------------------------------------------------------- 470 // 471 // Get histogram class with name 'name' 311 return static_cast<MHCalibrationCam*>(i==-1 ? fHists->Last() : fHists->At(i)); 312 } 313 314 // -------------------------------------------------------------------------- 315 // 316 // Get i-th histogram class 317 // 318 const MHCalibrationCam *MCalibrationIntensityCam::GetHist(Int_t i) const 319 { 320 return static_cast<MHCalibrationCam*>(i==-1 ? fHists->Last() : fHists->At(i)); 321 } 322 323 // -------------------------------------------------------------------------- 324 // 325 // Get histogram class with name 'name' 472 326 // 473 327 MHCalibrationCam *MCalibrationIntensityCam::GetHist(const char *name ) … … 478 332 // -------------------------------------------------------------------------- 479 333 // 480 // Get histogram class with name 'name' 481 // 482 const MHCalibrationCam *MCalibrationIntensityCam::GetHist(const char *name ) const 483 { 484 return static_cast<MHCalibrationCam*>(fHists->FindObject(name)); 485 } 334 // Get histogram class with name 'name' 335 // 336 const MHCalibrationCam *MCalibrationIntensityCam::GetHist(const char *name ) const 337 { 338 return static_cast<MHCalibrationCam*>(fHists->FindObject(name)); 339 } 340 341 // -------------------------------------------------------------------------- 342 // 343 // Calls DrawPixelContent for the current entry in fCams 344 // 345 void MCalibrationIntensityCam::DrawPixelContent( Int_t num ) const 346 { 347 return GetCam()->DrawPixelContent(num); 348 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityCam.h
r7005 r7189 14 14 #endif 15 15 16 class TOrdCollection; 16 #ifndef ROOT_TOrdCollection 17 #include <TOrdCollection.h> 18 #endif 19 17 20 class MCalibrationPix; 18 21 class MBadPixelsPix; … … 22 25 class MCalibrationIntensityCam : public MParContainer, public MCamEvent 23 26 { 24 private:25 MArrayD fOffsets; //! Arrays of Higain-vs-LoGain fit result Offsets26 MArrayD fSlopes; //! Arrays of Higain-vs-LoGain fit result Slopes27 28 27 protected: 29 28 TOrdCollection *fCams; // Array of MCalibrationCams, one per pulse colour and intensity … … 45 44 Int_t CountNumEntries(const MCalibrationCam::PulserColor_t col) const; 46 45 47 // Draws 48 void DrawHiLoFits(); 49 void DrawPixelContent( Int_t num) const; 50 51 // Getters 52 Bool_t GetPixelContent( Double_t &val, Int_t idx, const MGeomCam &cam,Int_t type=0) const; 53 const Int_t GetSize() const; 46 const Int_t GetSize() const { return fCams->GetSize(); } 54 47 55 const Int_t GetAverageAreas () const ;56 MCalibrationPix &GetAverageArea ( UInt_t i ) ;57 const MCalibrationPix &GetAverageArea ( UInt_t i ) const ;58 MBadPixelsPix &GetAverageBadArea ( UInt_t i ) ;59 const MBadPixelsPix &GetAverageBadArea ( UInt_t i ) const ;60 const Int_t GetAverageSectors () const ;61 MCalibrationPix &GetAverageSector ( UInt_t i ) ;62 const MCalibrationPix &GetAverageSector ( UInt_t i ) const ;63 MBadPixelsPix &GetAverageBadSector ( UInt_t i ) ;64 const MBadPixelsPix &GetAverageBadSector ( UInt_t i ) const ;48 const Int_t GetAverageAreas () const { return GetCam()->GetAverageAreas(); } 49 MCalibrationPix &GetAverageArea ( UInt_t i ) { return GetCam()->GetAverageArea(i); } 50 const MCalibrationPix &GetAverageArea ( UInt_t i ) const { return GetCam()->GetAverageArea(i); } 51 MBadPixelsPix &GetAverageBadArea ( UInt_t i ) { return GetCam()->GetAverageBadArea(i); } 52 const MBadPixelsPix &GetAverageBadArea ( UInt_t i ) const { return GetCam()->GetAverageBadArea(i); } 53 const Int_t GetAverageSectors () const { return GetCam()->GetAverageSectors(); } 54 MCalibrationPix &GetAverageSector ( UInt_t i ) { return GetCam()->GetAverageSector(i); } 55 const MCalibrationPix &GetAverageSector ( UInt_t i ) const { return GetCam()->GetAverageSector(i); } 56 MBadPixelsPix &GetAverageBadSector ( UInt_t i ) { return GetCam()->GetAverageBadSector(i); } 57 const MBadPixelsPix &GetAverageBadSector ( UInt_t i ) const { return GetCam()->GetAverageBadSector(i); } 65 58 66 MCalibrationCam *GetCam ( Int_t i=-1); 67 const MCalibrationCam *GetCam ( Int_t i=-1) const; 59 MCalibrationCam *GetCam ( Int_t i=-1) { 60 return static_cast<MCalibrationCam*>(i==-1 ? fCams->Last() : fCams->At(i)); } 61 const MCalibrationCam *GetCam ( Int_t i=-1) const { 62 return static_cast<MCalibrationCam*>(i==-1 ? fCams->Last() : fCams->At(i)); } 68 63 69 64 MCalibrationCam *GetCam ( const char *name ); 70 65 const MCalibrationCam *GetCam ( const char *name ) const; 71 66 72 MHCalibrationCam *GetHist ( Int_t i=-1); 67 MHCalibrationCam *GetHist ( Int_t i=-1); 73 68 const MHCalibrationCam *GetHist ( Int_t i=-1) const; 74 69 75 MHCalibrationCam *GetHist ( const char *name ); 70 MHCalibrationCam *GetHist ( const char *name ); 76 71 const MHCalibrationCam *GetHist ( const char *name ) const; 77 72 … … 87 82 void Init ( const MGeomCam &geom ); 88 83 89 // Prints84 // Prints 90 85 void Print(Option_t *o="") const; 91 86 … … 96 91 void SetNumUnreliable ( const UInt_t i, const Int_t aidx ) { GetCam()->SetNumUnreliable(i,aidx); } 97 92 void SetPulserColor ( const MCalibrationCam::PulserColor_t col=MCalibrationCam::kCT1) { 98 GetCam()->SetPulserColor(col); } 93 GetCam()->SetPulserColor(col); } 94 void SetCam( MCalibrationCam *cam, const Int_t i) { fCams->PutAt(cam,i); } 95 96 // MCamEvent 97 Bool_t GetPixelContent( Double_t &val, Int_t idx, const MGeomCam &cam,Int_t type=0) const 98 { return GetCam()->GetPixelContent(val,idx,cam,type); } 99 void DrawPixelContent( Int_t num) const; 99 100 100 ClassDef(MCalibrationIntensityCam, 2) // Base Container Intensity Calibration Results101 ClassDef(MCalibrationIntensityCam, 3) // Base Container Intensity Calibration Results 101 102 }; 102 103
Note:
See TracChangeset
for help on using the changeset viewer.