PamCut: TrkCuts/TrkSigmaDeflCut/TrkSigmaDeflCut.cpp Source File

- Main Page
- Classes
- Files

- File List
- File Members

# TrkCuts/TrkSigmaDeflCut/TrkSigmaDeflCut.cpp

Go to the documentation of this file.

    00001 /*
    00002  * TrkSigmaDeflCut.cpp
    00003  *
    00004  *  Created on:23-apr-2009
    00005  *      Author: S. Ricciarini
    00006  */
    00007
    00010 #include "TrkSigmaDeflCut.h"
    00011
    00012 TrkSigmaDeflCut::TrkSigmaDeflCut(const char *cutName, const char* rigBinListFileName) :
    00013     PamCut(cutName), _binning(0) {
    00014
    00015     ifstream rigBinList;
    00016     rigBinList.open(rigBinListFileName);
    00017     TString bin;
    00018
    00019     while (!rigBinList.eof()) {
    00020       rigBinList >> bin;
    00021       if (bin != "") {
    00022         _binning.push_back(bin.Atof());
    00023 #ifdef DEBUGPAMCUT
    00024         cout << "Bin: " << bin.Atof() << endl;
    00025 #endif
    00026       }
    00027     }
    00028
    00029     rigBinList.close();
    00030
    00031 #ifdef DEBUGPAMCUT
    00032     cout << "\nNumber of bins: " << _binning.size() << endl;
    00033 #endif
    00034   }
    00035
    00036 int TrkSigmaDeflCut::Check(PamLevel2 *event) {
    00037
    00038   TrkTrack *trkTrack = event->GetTrack(0)->GetTrkTrack();
    00039
    00040   float sigmaDefl = pow(trkTrack->coval[4][4],0.5);
    00041   float rigMod = trkTrack->GetRigidity();
    00042
    00043 //  cout << "sigmaDefl: " << sigmaDefl << endl;
    00044 //  cout << "rigMod: " << rigMod << endl;
    00045
    00046   // check on overall binning interval
    00047   if (rigMod >= _binning[_binning.size() - 1] || rigMod < _binning[0]) {
    00048     return 0;
    00049   }
    00050
    00051   //Bin upper limit identification: after this loop, the bin containing rigMod is defined as (_binning[i-1] , _binning[i])
    00052   int i = 1;
    00053   while (_binning[i] < rigMod) {
    00054     i++;
    00055   }
    00056
    00057 //  cout << "binmax: " << _binning[i] << endl;
    00058
    00059   if ( ! ( sigmaDefl < 1./_binning[i]) ) { // required condition: sigma_defl < |defl_min(bin)| = 1./|rig_max(bin)| = 1./_binning[i]
    00060     return 1;
    00061   }
    00062
    00063 //  cout << "OK" << endl;
    00064 //  cout << endl;
    00065
    00066   return CUTOK;
    00067 }