Ignore:
Timestamp:
08/17/05 17:36:32 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.