| 1 | 
/* | 
| 2 | 
 * TrkSigmaDeflCut.cpp | 
| 3 | 
 * | 
| 4 | 
 *  Created on:23-apr-2009 | 
| 5 | 
 *      Author: S. Ricciarini | 
| 6 | 
 */ | 
| 7 | 
 | 
| 8 | 
/*! @file TrkSigmaDeflCut.cpp The TrkRigGeoCut class implementation file */ | 
| 9 | 
 | 
| 10 | 
#include "TrkSigmaDeflCut.h" | 
| 11 | 
 | 
| 12 | 
TrkSigmaDeflCut::TrkSigmaDeflCut(const char *cutName, const char* rigBinListFileName) : | 
| 13 | 
    PamCut(cutName), _binning(0) { | 
| 14 | 
 | 
| 15 | 
    ifstream rigBinList; | 
| 16 | 
    rigBinList.open(rigBinListFileName); | 
| 17 | 
    TString bin; | 
| 18 | 
 | 
| 19 | 
    while (!rigBinList.eof()) { | 
| 20 | 
      rigBinList >> bin; | 
| 21 | 
      if (bin != "") { | 
| 22 | 
        _binning.push_back(bin.Atof()); | 
| 23 | 
#ifdef DEBUGPAMCUT | 
| 24 | 
        cout << "Bin: " << bin.Atof() << endl; | 
| 25 | 
#endif | 
| 26 | 
      } | 
| 27 | 
    } | 
| 28 | 
 | 
| 29 | 
    rigBinList.close(); | 
| 30 | 
 | 
| 31 | 
#ifdef DEBUGPAMCUT | 
| 32 | 
    cout << "\nNumber of bins: " << _binning.size() << endl; | 
| 33 | 
#endif | 
| 34 | 
  } | 
| 35 | 
 | 
| 36 | 
int TrkSigmaDeflCut::Check(PamLevel2 *event) { | 
| 37 | 
 | 
| 38 | 
  TrkTrack *trkTrack = event->GetTrack(0)->GetTrkTrack(); | 
| 39 | 
 | 
| 40 | 
  float sigmaDefl = pow(trkTrack->coval[4][4],0.5); | 
| 41 | 
  float rigMod = trkTrack->GetRigidity(); | 
| 42 | 
 | 
| 43 | 
//  cout << "sigmaDefl: " << sigmaDefl << endl; | 
| 44 | 
//  cout << "rigMod: " << rigMod << endl; | 
| 45 | 
 | 
| 46 | 
  // check on overall binning interval | 
| 47 | 
  if (rigMod >= _binning[_binning.size() - 1] || rigMod < _binning[0]) { | 
| 48 | 
    return 0; | 
| 49 | 
  } | 
| 50 | 
 | 
| 51 | 
  //Bin upper limit identification: after this loop, the bin containing rigMod is defined as (_binning[i-1] , _binning[i]) | 
| 52 | 
  int i = 1; | 
| 53 | 
  while (_binning[i] < rigMod) { | 
| 54 | 
    i++; | 
| 55 | 
  } | 
| 56 | 
 | 
| 57 | 
//  cout << "binmax: " << _binning[i] << endl; | 
| 58 | 
 | 
| 59 | 
  if ( ! ( sigmaDefl < 1./_binning[i]) ) { // required condition: sigma_defl < |defl_min(bin)| = 1./|rig_max(bin)| = 1./_binning[i] | 
| 60 | 
    return 1; | 
| 61 | 
  } | 
| 62 | 
 | 
| 63 | 
//  cout << "OK" << endl; | 
| 64 | 
//  cout << endl; | 
| 65 | 
 | 
| 66 | 
  return CUTOK; | 
| 67 | 
} |