--- PamCut/TrkCuts/RigFillCut/RigFillCut.cpp 2009/05/27 13:30:08 1.1 +++ PamCut/TrkCuts/RigFillCut/RigFillCut.cpp 2009/06/10 12:44:55 1.2 @@ -9,6 +9,32 @@ #include "RigFillCut.h" +RigFillCut::RigFillCut(const char *cutName, const char* rigBinListFileName, float thresholdCoeff) : + PamCut(cutName), _binning(0), _histogram(0, 0, 0), _thresholdCoeff(thresholdCoeff) { + + ifstream rigBinList; + rigBinList.open(rigBinListFileName); + TString bin; + + while (!rigBinList.eof()) { + rigBinList >> bin; + if (bin != "") { + _binning.push_back(bin.Atof()); +#ifdef DEBUGPAMCUT + cout << "Bin: " << bin.Atof() << endl; +#endif + } + } + + rigBinList.close(); + + _histogram.Resize(_binning.size() - 1, _binning.size() - 1, 0); + +#ifdef DEBUGPAMCUT + cout << "\nNumber of bins: " << _binning.size() << endl; +#endif +} + int RigFillCut::Check(PamLevel2 *event) { float rigThreshold = _thresholdCoeff * event->GetOrbitalInfo()->GetCutoffSVL(); @@ -32,14 +58,14 @@ float rig = event->GetTrack(0)->GetTrkTrack()->GetRigidity(); //Bin identification: value must be less than (<) bin maximum - + int i = 1; while (rig >= _binning[i]) { i++; } i--; -// cout << _binning[i] << " < " << rig << " < " << _binning[i+1] << endl; + // cout << _binning[i] << " < " << rig << " < " << _binning[i+1] << endl; int j = 1; while (rigThreshold >= _binning[j]) { @@ -47,8 +73,8 @@ } j--; -// cout << _binning[j] << " < " << rigCutoff << " < " << _binning[j+1] << endl; -// cout << endl; + // cout << _binning[j] << " < " << rigCutoff << " < " << _binning[j+1] << endl; + // cout << endl; _histogram[i][j]++; }