--- PamCut/CollectionActions/LiveTimeAction/LiveTimeAction.cpp 2009/08/05 17:43:15 1.3 +++ PamCut/CollectionActions/LiveTimeAction/LiveTimeAction.cpp 2009/08/26 16:34:14 1.4 @@ -33,7 +33,7 @@ LiveTimeAction::LiveTimeAction(const char *actionName, TString outFileBase, vector &bins, float thresholdCoeff) : CollectionAction(actionName), _outFileBase(outFileBase), _bins(0), _rootHisto(), _textHisto(0), _thresholdCoeff( - thresholdCoeff), _total(0.), _zeroBin(0.) + thresholdCoeff), _totalNorm(0.), _infBin(0.), _nGoodHisto(0), _nGoodInfBin(0) #ifdef DEBUGPAMCUT , _outUp(0), _outDown(0) #endif @@ -43,7 +43,7 @@ LiveTimeAction::LiveTimeAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff) : CollectionAction(actionName), _outFileBase(outFileBase), _bins(0), _rootHisto(), _textHisto(0), _thresholdCoeff( - thresholdCoeff), _total(0.), _zeroBin(0.) + thresholdCoeff), _totalNorm(0.), _infBin(0.), _nGoodHisto(0), _nGoodInfBin(0) #ifdef DEBUGPAMCUT , _outUp(0), _outDown(0) #endif @@ -69,22 +69,27 @@ void LiveTimeAction::OnGood(PamLevel2 *event) { - float lt = 0.16 * (float) event->GetTrigLevel2()->dltime[0] / 1000.; // In seconds - _total += lt; + double lt = 0.16 * (double) event->GetTrigLevel2()->dltime[0] / 1000.; // In seconds + +// cout << 0.16 * event->GetTrigLevel2()->dltime[0] / 1000. << endl; +// cout << lt << endl; + float cRig = _thresholdCoeff * event->GetOrbitalInfo()->GetCutoffSVL(); if (cRig >= _bins[0]) { int i = 1; int binningSize = _bins.size(); bool found = false; while (!found && i < binningSize) { - if (cRig < _bins[i]) + if (cRig < _bins[i]) // less than bin[i-1] maximum edge found = true; else i++; } if (found) { - _textHisto[i - 1] += lt; + _totalNorm += lt; // use double for sums of many real numbers + _textHisto[i - 1] += lt; // use double for sums of many real numbers _rootHisto.Fill(cRig, lt); + _nGoodHisto++; } #ifdef DEBUGPAMCUT @@ -93,8 +98,9 @@ #endif } - else { - _zeroBin += lt; + else if (cRig > 0.) { + _infBin += lt; + _nGoodInfBin++; #ifdef DEBUGPAMCUT _outDown++; #endif @@ -115,8 +121,8 @@ outTextFile << _textHisto[i] << "\n"; outTextFile.close(); outTextFile.open((_outFileBase + "-report.txt").Data(), ios_base::out); - outTextFile << "Zero bin: " << GetZeroBin() << "\n"; - outTextFile << "Total live time: " << GetTotalLT() << "\n"; + outTextFile << "Inferior bin: " << GetLTInfBin() << "\n"; + outTextFile << "Total live time within normal bins: " << GetTotalLTHisto() << "\n"; outTextFile.close(); outTextFile.precision(oldPrec); outTextFile << resetiosflags(ios::floatfield);