Changeset 7005 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 05/10/05 12:13:12 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc
r6963 r7005 79 79 fIntensCharge(NULL), fIntensBlind(NULL), fIntensRelTime(NULL), fIntensBad(NULL), 80 80 fChargeCalc(NULL), fRelTimeCalc(NULL), fCalibrate(NULL), 81 fNumEvents(0), fNumCam(0) 81 fNumEvents(0), fNumCam(0), fUpdateWithFFactorMethod(kFALSE) 82 82 { 83 83 … … 249 249 fRelTimeCalc->Finalize(); 250 250 if (fCalibrate) 251 fCalibrate->UpdateConversionFactors((MCalibrationChargeCam*)fIntensCharge->GetCam()); 251 fCalibrate->UpdateConversionFactors(fUpdateWithFFactorMethod ? NULL : 252 (MCalibrationChargeCam*)fIntensCharge->GetCam()); 252 253 253 254 ReInitialize(); … … 324 325 Int_t MCalibCalcFromPast::PostProcess() 325 326 { 326 *fLog << "Number of Calibration Cams: " << fNumCam << endl;327 *fLog << inf << "Number of Calibration Cams: " << fNumCam << endl; 327 328 return kTRUE; 328 329 329 330 } 330 331 332 // -------------------------------------------------------------------------- 333 // 334 // Read the setup from a TEnv, eg: 335 // MCalibCalcFromPast.UpdateWithFFactorMethod: Off, On 336 // 337 Int_t MCalibCalcFromPast::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 338 { 339 Bool_t rc = kFALSE; 340 if (IsEnvDefined(env, prefix, "UpdateWithFFactorMethod", print)) 341 { 342 rc = kTRUE; 343 SetUpdateWithFFactorMethod(GetEnvValue(env, prefix, "UpdateWithFFactorMethod", fUpdateWithFFactorMethod)); 344 } 345 346 return rc; 347 } -
trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h
r6963 r7005 41 41 UInt_t fNumEvents; //! Event counter only for calibration events 42 42 UInt_t fNumCam; //! Number of currently used Calibration Cam 43 43 44 Bool_t fUpdateWithFFactorMethod; // Update the interlaced calib events with the full F-Factor method 45 44 46 Int_t PreProcess(MParList *pList); 45 47 Int_t Process(); … … 48 50 Bool_t ReInitialize(); 49 51 Bool_t Finalize(const char* name); 52 53 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 50 54 51 55 public: … … 61 65 void SetChargeCalc ( MCalibrationChargeCalc *c ) { fChargeCalc = c; } 62 66 void SetRelTimeCalc ( MCalibrationRelTimeCalc *c ) { fRelTimeCalc = c; } 67 68 void SetUpdateWithFFactorMethod(const Bool_t b=kTRUE){ fUpdateWithFFactorMethod = b; } 63 69 64 70 ClassDef(MCalibCalcFromPast, 1) // Task to steer the processing of interlace calibration events -
trunk/MagicSoft/Mars/mcalib/MCalibColorSteer.cc
r6963 r7005 22 22 ! 23 23 \* ======================================================================== */ 24 24 25 ////////////////////////////////////////////////////////////////////////////// 25 26 // … … 81 82 : fCalibPattern(NULL), fGeom(NULL), fParList(NULL), 82 83 fIntensCharge(NULL), fIntensRelTime(NULL), fIntensBad(NULL), 83 fBad(NULL), fChargeCalc(NULL), fRelTimeCalc(NULL) 84 fBad(NULL), fChargeCalc(NULL), fRelTimeCalc(NULL), fHistCopy(kFALSE) 84 85 { 85 86 … … 285 286 } 286 287 288 // -------------------------------------------------------------------------- 289 // 290 // Reads the pattern from MCalibrationPattern and initializes new containers in the 291 // Intensity Cams, if the pattern has changed. Executes Finalize of the 292 // MCalibration*Calc classes in that case. 293 // 294 Int_t MCalibColorSteer::PostProcess() 295 { 296 // 297 // Finalize Possible calibration histogram classes... 298 // 299 *fLog << inf << "Finalize calibration histograms..." << flush; 300 if (Finalize("MHCalibrationChargeCam")) *fLog << inf << "MHCalibrationChargeCam..." << flush; 301 if (Finalize("MHCalibrationChargeBlindCam")) *fLog << inf << "MHCalibrationChargeBlindCam..." << flush; 302 if (Finalize("MHCalibrationRelTimeCam")) *fLog << inf << "MHCalibrationRelTimeCam..." << flush; 303 if (Finalize("MHCalibrationTestCam")) *fLog << inf << "MHCalibrationChargeCam..." << flush; 304 if (Finalize("MHCalibrationTestTimeCam")) *fLog << inf << "MHCalibrationChargeCam..." << flush; 305 *fLog << inf << "done." << endl; 306 307 return kTRUE; 308 } 287 309 288 310 // -------------------------------------------------------------------------- … … 300 322 301 323 hist->Finalize(); 324 CopyHist(name); 302 325 hist->ResetHists(); 303 326 hist->SetColor( fCalibPattern->GetPulserColor()); … … 331 354 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)fIntensCharge->GetCam(); 332 355 cam->SetPulserColor(fCalibPattern->GetPulserColor()); 333 if (!cam-> CopyHiLoConversionFactors(*oldcam))334 return kFALSE;356 if (!cam->MergeHiLoConversionFactors(*oldcam)) 357 return kFALSE; 335 358 *fLog << inf << "New MCalibrationChargeCam with name: " << cam->GetName() << endl; 336 359 } … … 388 411 return result; 389 412 } 413 414 // -------------------------------------------------------------------------- 415 // 416 // Copies the histogram classes into the intensity cams 417 // 418 void MCalibColorSteer::CopyHist(const char* name) 419 { 420 MHCalibrationCam *hcam = (MHCalibrationCam*)fParList->FindObject(name); 421 TString n(name); 422 if (n.Contains("ChargeCam")) 423 { 424 if (fIntensCharge) 425 fIntensCharge->AddHist((MHCalibrationCam*)hcam->Clone()); 426 } 427 if (n.Contains("Blind")) 428 if (fIntensBlind) 429 fIntensBlind->AddHist((MHCalibrationCam*)hcam->Clone()); 430 431 if (n.Contains("RelTime")) 432 if (fIntensRelTime) 433 fIntensRelTime->AddHist((MHCalibrationCam*)hcam->Clone()); 434 } 435 436 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mcalib/MCalibColorSteer.h
r6963 r7005 27 27 { 28 28 private: 29 30 31 29 MCalibrationPattern *fCalibPattern; //! 32 30 MRawRunHeader *fRunHeader; //! … … 45 43 MCalibrationCam::PulserColor_t fColor; 46 44 Float_t fStrength; 45 46 Bool_t fHistCopy; // Decide whether MHCalibrationCams will get copied 47 47 48 48 Int_t PreProcess(MParList *pList); 49 49 Int_t Process(); 50 Int_t PostProcess(); 50 51 51 52 Bool_t ReInitialize(); 52 53 Bool_t Finalize(const char* name); 54 55 void CopyHist(const char* name); 53 56 TString GetNamePattern(); 54 57 55 58 public: 59 MCalibColorSteer(const char *name=NULL, const char *title=NULL); 56 60 57 MCalibColorSteer(const char *name=NULL, const char *title=NULL); 58 ~MCalibColorSteer() {} 61 void SetHistCopy(const Bool_t b=kTRUE) { fHistCopy = b; } 59 62 60 63 ClassDef(MCalibColorSteer, 1) // Task to steer the processing of multiple calibration colours -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r6963 r7005 252 252 // Copy High-gain vs. low-gain conversion factors from cam to this. 253 253 // 254 Bool_t MCalibrationChargeCam:: CopyHiLoConversionFactors(const MCalibrationChargeCam &cam) const254 Bool_t MCalibrationChargeCam::MergeHiLoConversionFactors(const MCalibrationChargeCam &cam) const 255 255 { 256 256 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r6963 r7005 59 59 const UInt_t sec=0, MBadPixelsCam *bad=NULL); 60 60 61 Bool_t CopyHiLoConversionFactors(const MCalibrationChargeCam &cam) const;61 Bool_t MergeHiLoConversionFactors(const MCalibrationChargeCam &cam) const; 62 62 63 63 // Prints -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityCam.cc
r5651 r7005 30 30 // Contains TOrdCollections for the following objects: 31 31 // - fCams: Array of classes derived from MCalibrationCam, one entry 32 // per calibration camera result. Has to be created 32 // per calibration camera result. 33 // - fHists: Array of classes derived from MHCalibrationPix, one entry 34 // per calibration camera result and area index 33 35 // 34 36 // See also: MCalibrationIntensityChargeCam, MCalibrationIntensityQECam, … … 39 41 // MCalibrationChargeBlindPix, MCalibrationChargePINDiode 40 42 // 43 // ClassVersion 2: 44 // + fHists 41 45 // 42 46 ///////////////////////////////////////////////////////////////////////////// … … 45 49 #include <TOrdCollection.h> 46 50 51 #include "MLog.h" 52 #include "MLogManip.h" 53 47 54 #include "MGeomCam.h" 55 #include "MHCalibrationCam.h" 48 56 49 57 ClassImp(MCalibrationIntensityCam); … … 57 65 // Set the following pointer to NULL: 58 66 // - fCams 67 // - fHists 59 68 // 60 69 MCalibrationIntensityCam::MCalibrationIntensityCam(const char *name, const char *title) … … 66 75 fCams = new TOrdCollection; 67 76 fCams->SetOwner(); 68 77 78 fHists = new TOrdCollection; 79 fHists->SetOwner(); 69 80 } 70 81 … … 76 87 MCalibrationIntensityCam::~MCalibrationIntensityCam() 77 88 { 78 if (fCams)79 89 delete fCams; 90 delete fHists; 91 } 92 93 // -------------------------------------------------------------------------- 94 // 95 // Add a new MHCalibrationCam to fHists 96 // 97 void MCalibrationIntensityCam::AddHist( const MHCalibrationCam *cam) 98 { 99 const Int_t size = fHists->GetSize(); 100 fHists->AddAt((TObject*)cam,size); 101 102 if (size != GetSize()-1) 103 *fLog << warn << "Histogram Cams and Calibration Cams size mismatch! " << endl; 80 104 } 81 105 … … 100 124 void MCalibrationIntensityCam::Copy(TObject& object) const 101 125 { 102 103 MCalibrationIntensityCam &calib = (MCalibrationIntensityCam&)object; 104 105 MParContainer::Copy(calib); 106 107 calib.fOffsets = fOffsets; 108 calib.fSlopes = fSlopes; 109 110 const UInt_t n = GetSize(); 111 if (n != 0) 126 MCalibrationIntensityCam &calib = (MCalibrationIntensityCam&)object; 127 128 MParContainer::Copy(calib); 129 130 calib.fOffsets = fOffsets; 131 calib.fSlopes = fSlopes; 132 133 const UInt_t n = GetSize(); 134 if (n != 0) 112 135 { 113 calib.InitSize(n); 114 for (UInt_t i=0; i<n; i++) 115 GetCam(i)->Copy(*(calib.GetCam(i))); 136 calib.InitSize(n); 137 for (UInt_t i=0; i<n; i++) 138 { 139 GetCam(i)->Copy(*(calib.GetCam(i))); 140 GetHist(i)->Copy(*(calib.GetHist(i))); 141 } 116 142 } 117 118 143 } 119 144 … … 124 149 void MCalibrationIntensityCam::Clear(Option_t *o) 125 150 { 126 127 fCams->ForEach(MCalibrationCam, Clear)(); 128 129 return; 151 fCams->ForEach(MCalibrationCam, Clear)(); 152 fHists->ForEach(MHCalibrationCam, Clear)(); 130 153 } 131 154 … … 136 159 void MCalibrationIntensityCam::Print(Option_t *o) const 137 160 { 138 fCams->ForEach(MCalibrationCam, Print)(o); 161 fCams->ForEach(MCalibrationCam, Print)(o); 162 fHists->ForEach(MHCalibrationCam, Print)(o); 139 163 } 140 164 … … 424 448 return size; 425 449 } 450 451 // -------------------------------------------------------------------------- 452 // 453 // Get i-th histogram class 454 // 455 MHCalibrationCam *MCalibrationIntensityCam::GetHist(Int_t i) 456 { 457 return static_cast<MHCalibrationCam*>(i==-1 ? fHists->Last() : fHists->At(i)); 458 } 459 460 // -------------------------------------------------------------------------- 461 // 462 // Get i-th histogram class 463 // 464 const MHCalibrationCam *MCalibrationIntensityCam::GetHist(Int_t i) const 465 { 466 return static_cast<MHCalibrationCam*>(i==-1 ? fHists->Last() : fHists->At(i)); 467 } 468 469 // -------------------------------------------------------------------------- 470 // 471 // Get histogram class with name 'name' 472 // 473 MHCalibrationCam *MCalibrationIntensityCam::GetHist(const char *name ) 474 { 475 return static_cast<MHCalibrationCam*>(fHists->FindObject(name)); 476 } 477 478 // -------------------------------------------------------------------------- 479 // 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 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityCam.h
r5651 r7005 18 18 class MBadPixelsPix; 19 19 class MGeomCam; 20 class MHCalibrationCam; 21 20 22 class MCalibrationIntensityCam : public MParContainer, public MCamEvent 21 23 { 22 24 private: 23 24 MArrayD fOffsets; //! Arrays of Higain-vs-LoGain fit result Offsets 25 MArrayD fSlopes; //! Arrays of Higain-vs-LoGain fit result Slopes 25 MArrayD fOffsets; //! Arrays of Higain-vs-LoGain fit result Offsets 26 MArrayD fSlopes; //! Arrays of Higain-vs-LoGain fit result Slopes 26 27 27 28 protected: 28 29 TOrdCollection *f Cams; // Array of MCalibrationCams, one per pulse colour and intensity29 TOrdCollection *fCams; // Array of MCalibrationCams, one per pulse colour and intensity 30 TOrdCollection *fHists; // Array of MHCalibrationCam's, containing the mean charges per area histograms 30 31 31 32 virtual void Add(const UInt_t from, const UInt_t to); … … 33 34 34 35 public: 35 36 36 MCalibrationIntensityCam(const char *name=NULL, const char *title=NULL); 37 37 ~MCalibrationIntensityCam(); … … 40 40 void Copy(TObject& object) const; 41 41 42 void AddToList( const char* name, const MGeomCam &geom ); 42 void AddToList(const char* name, const MGeomCam &geom); 43 void AddHist(const MHCalibrationCam *cam); 43 44 44 45 Int_t CountNumEntries(const MCalibrationCam::PulserColor_t col) const; … … 69 70 const MCalibrationCam *GetCam ( const char *name ) const; 70 71 72 MHCalibrationCam *GetHist ( Int_t i=-1); 73 const MHCalibrationCam *GetHist ( Int_t i=-1) const; 74 75 MHCalibrationCam *GetHist ( const char *name ); 76 const MHCalibrationCam *GetHist ( const char *name ) const; 77 71 78 MCalibrationPix &operator[] ( UInt_t i ); 72 79 const MCalibrationPix &operator[] ( UInt_t i ) const; … … 91 98 GetCam()->SetPulserColor(col); } 92 99 93 ClassDef(MCalibrationIntensityCam, 1) // Base Container Intensity Calibration Results100 ClassDef(MCalibrationIntensityCam, 2) // Base Container Intensity Calibration Results 94 101 }; 95 102 -
trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc
r4710 r7005 242 242 { 243 243 // 244 // Exclude events with some saturated pixel244 // Exclude events with some high-gain saturated pixel 245 245 // 246 246 if (fPar->GetNumSatPixelsHG()>0) … … 266 266 // 267 267 268 const Float_t inner_photel = (Float_t) fMcEvt->GetPhotElfromShower() * innersize / size; 269 const Float_t outer_photel = (Float_t) fMcEvt->GetPhotElfromShower() - inner_photel; 270 271 const Float_t corrected_photel = inner_photel + outer_photel / fOuterPixelsLightCollection; 272 273 274 // fHistADC2PhotEl->Fill(TMath::Log10(fMcEvt->GetPhotElfromShower()/size)); 268 const Float_t corrected_photel = (Float_t) fMcEvt->GetPhotElfromShower() / 269 (fOuterPixelsLightCollection + innersize / size * (1. - fOuterPixelsLightCollection)); 275 270 276 271 fHistADC2PhotEl->Fill(TMath::Log10(corrected_photel/size));
Note:
See TracChangeset
for help on using the changeset viewer.