Ignore:
Timestamp:
08/17/05 17:36:32 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc

    r7190 r7288  
    9393      fIntensBad(NULL),
    9494      fChargeCalc(NULL), fRelTimeCalc(NULL), fCalibrate(NULL),
    95       fNumCam(0), fNumEvents(0), fUpdateWithFFactorMethod(kTRUE), fUpdateNumPhes(kTRUE)
     95    fNumCam(0), fNumEvents(0), fUpdateWithFFactorMethod(kTRUE), fUpdateNumPhes(kTRUE),
     96    fNumFails(0)
    9697{
    9798
     
    252253    }
    253254
     255  fNumFails = 0;
     256
    254257  return kTRUE;
     258}
     259
     260// --------------------------------------------------------------------------
     261//
     262// Set fNumEvents=0
     263//
     264// This is necessary because the calibration histograms do reset themself
     265// if ReInit is called, so they are empty. MCalibCalcFromPast errornously
     266// ignores how many events are in the histograms but count the number
     267// itself.
     268//
     269Bool_t MCalibCalcFromPast::ReInit(MParList *pList)
     270{
     271    if (fNumEvents>0)
     272        *fLog << inf << fNumEvents << " calibration events at the end of the last file have been skipped." << endl;
     273
     274    fNumEvents = 0;
     275
     276    return kTRUE;
    255277}
    256278
     
    288310  if (fChargeCalc)
    289311    {
    290       if (!fChargeCalc->Finalize())
    291           return kERROR;
    292 
    293       if (fUpdateNumPhes)
     312        if (!fChargeCalc->Finalize())
     313        {
     314            fNumFails++;
     315            *fLog << warn << "WARNING - Finalization of charges failed the " << fNumFails << " time..." << endl;
     316        }
     317
     318        if (fUpdateNumPhes)
    294319        {
    295320          MCalibrationChargePix &avpix =(MCalibrationChargePix&)fIntensCharge->GetCam()->GetAverageArea(0);
     
    336361// - MHCalibrationCam::ResetHists()
    337362//
    338 Bool_t MCalibCalcFromPast::Finalize(const char* name)
    339 {
    340 
    341   MHCalibrationCam *hist = (MHCalibrationCam*)fParList->FindObject(name);
    342   if (hist)
    343     {
    344       hist->Finalize();
    345       hist->ResetHists();
    346       return kTRUE;
    347     }
    348 
    349   return kFALSE;
    350  
     363Bool_t MCalibCalcFromPast::Finalize(const char* name, Bool_t finalize)
     364{
     365    MHCalibrationCam *hist = (MHCalibrationCam*)fParList->FindObject(name, "MHCalibrationCam");
     366    if (!hist)
     367        return kFALSE;
     368
     369    if (finalize)
     370        hist->Finalize();
     371
     372    hist->ResetHists();
     373    return kTRUE;
    351374}
    352375
     
    398421Int_t MCalibCalcFromPast::PostProcess()
    399422{
    400   *fLog << inf << "Number of Calibration Cams: " << fNumCam << endl;
    401   return kTRUE;
    402  
     423    if (GetNumExecutions()==0)
     424        return kTRUE;
     425
     426    // Now we reset all histograms to make sure that the PostProcess
     427    // of the following tasks doesn't try to finalize a partly empty
     428    // histogram!
     429    Finalize("MHCalibrationChargeCam",      kFALSE);
     430    Finalize("MHCalibrationChargeBlindCam", kFALSE);
     431    Finalize("MHCalibrationRelTimeCam",     kFALSE);
     432
     433    if (fChargeCalc)
     434        fChargeCalc->ResetNumProcessed();
     435
     436    if (fNumCam==0)
     437        return kTRUE;
     438
     439    *fLog << inf << endl;
     440    *fLog << GetDescriptor() << " execution statistics:" << endl;
     441    *fLog << " " << setw(7) << fNumFails << " (" << Form("%5.1f", 100.*fNumFails/fNumCam) << "%) updates failed." << endl;
     442    *fLog << endl;
     443
     444    return kTRUE;
    403445}
    404446
     
    468510    }
    469511
    470 
    471 
    472512    return rc;
    473513}
  • trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h

    r7189 r7288  
    5959  TArrayF fPhesVar;
    6060
     61  Int_t fNumFails;          //! How often got the update skipped?
     62
    6163  // MTask
    6264  Int_t  PreProcess(MParList *pList);
    6365  Int_t  Process();
    64   Int_t  PostProcess(); 
     66  Int_t  PostProcess();
     67  Bool_t ReInit(MParList *pList);
    6568
    6669  // MCalibCalcFromPast
    6770  Bool_t ReInitialize();
    68   Bool_t Finalize(const char* name);
     71  Bool_t Finalize(const char* name, Bool_t finalize=kTRUE);
    6972
    7073  Bool_t UpdateMeanPhes();
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h

    r7189 r7288  
    183183  void Clear(const Option_t *o="");
    184184
     185  void ResetNumProcessed() { fNumProcessed=0; }
     186
    185187  Int_t Finalize();
    186188
Note: See TracChangeset for help on using the changeset viewer.