Changeset 8977


Ignore:
Timestamp:
06/18/08 19:09:16 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8976 r8977  
    2323   * mjobs/MJSpectrum.cc:
    2424     - small improvement to output
     25     - handle underflow bin of effective on-time more accurate
    2526
    2627
  • trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc

    r8976 r8977  
    242242    }
    243243
    244     TH1D *vstime = (TH1D*)arr.FindObjectInCanvas("Theta",      "TH1D", "OnTime");
    245     TH1D *size   = (TH1D*)arr.FindObjectInCanvas("Excess",     "TH1D", "Hist");
    246     TH1D *time   = (TH1D*)arr.FindObjectInCanvas("ExcessTime", "TH1D", "Hist");
     244    TH1D *vstime = (TH1D*)arr.FindObjectInCanvas("Theta",  "TH1D", "OnTime");
     245    TH1D *size   = (TH1D*)arr.FindObjectInCanvas("Excess", "TH1D", "Hist");
    247246    if (!vstime)
    248247    {
     
    253252    {
    254253        *fLog << err << dbginf << "ERROR - Excess [TH1D] not found in Hist-tab... abort." << endl;
    255         return -1;
    256     }
    257     if (!size)
    258     {
    259         *fLog << err << dbginf << "ERROR - ExcessTime [TH1D] not found in Hist-tab... abort." << endl;
    260254        return -1;
    261255    }
     
    297291        return -1;
    298292
    299     if (vstime->GetBinContent(0)>0)
    300     {
    301         *fLog << err << "ERROR - Undeflow bin of OnTime histogram not empty as it ought to be." << endl;
     293    const Double_t ufl = vstime->GetBinContent(0);
     294    if (ufl>0)
     295    {
     296        if (vstime->GetBinLowEdge(1)<=0)
     297        {
     298            *fLog << err << "ERROR - Undeflow bin of OnTime histogram not empty as it ought to be." << endl;
     299            return -1;
     300        }
     301        *fLog << warn << "WARNING - " << Form("%.1f%% (%.0fs)", 100*ufl/eff, ufl) << " of the eff. observation time is in the underflow bin." << endl;
     302    }
     303
     304    const Double_t ofl = vstime->GetBinContent(vstime->GetNbinsX()+1);
     305    const Double_t eff = vstime->Integral()+ufl+ofl;
     306    if (ofl>0)
     307        *fLog << warn << "WARNING - " << Form("%.1f%% (%.0fs)", 100*ofl/eff, ofl) << " of the eff. observation time is in the overflow bin." << endl;
     308
     309    if (!fForceRunTime)
     310        return eff;
     311
     312    TH1D *time   = (TH1D*)arr.FindObjectInCanvas("ExcessTime", "TH1D", "Hist");
     313    if (!size)
     314    {
     315        *fLog << err;
     316        *fLog << "ERROR - ExcessTime [TH1D] not found in Hist-tab... abort." << endl;
     317        *fLog << "        Did you try to process Monte Carlos with --force-runtime?" <<endl;
    302318        return -1;
    303319    }
    304320
    305     const Double_t ofl = vstime->GetBinContent(vstime->GetNbinsX()+1);
    306     const Double_t eff = vstime->Integral()+ofl;
    307     if (ofl>0)
    308         *fLog << warn << "WARNING - " << Form("%.1f%% (%.0fs)", 100*ofl/eff, ofl) << " of the eff. observation time is out of histogram range." << endl;
    309 
    310321    const Double_t obs = time->GetXaxis()->GetXmax()-time->GetXaxis()->GetXmin();
    311     if (fForceRunTime)
    312     {
    313         *fLog << inf;
    314         *fLog << "Total run time: " << obs/60 << "min" << endl;
    315         *fLog << "Eff. obs. time: " << eff/60 << "min  (" << Form("%.1f%%", 100*eff/obs) << ")" << endl;
    316     }
    317 
    318     return fForceRunTime ? obs : eff;
     322
     323    *fLog << inf;
     324    *fLog << "Total run time: " << obs/60 << "min" << endl;
     325    *fLog << "Eff. obs. time: " << eff/60 << "min  (" << Form("%.1f%%", 100*eff/obs) << ")" << endl;
     326
     327    return obs;
    319328}
    320329
Note: See TracChangeset for help on using the changeset viewer.