/[PAMELA software]/PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.h
ViewVC logotype

Diff of /PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by pam-fi, Thu Nov 12 16:41:43 2009 UTC revision 1.3 by pam-fi, Fri Feb 19 15:14:37 2010 UTC
# Line 15  Line 15 
15  #include <TH2F.h>  #include <TH2F.h>
16  #include <TTimeStamp.h>  #include <TTimeStamp.h>
17    
18  /*! @brief The tracker chi2 vs deflection cut.  /*! @brief The tracker chi2 vs |deflection| cut.
19   *   *
20   * Events whose track has been fitted with a chi2 greater than Chi2(eta) are discarded.   * Events whose track has been fitted with a chi2 greater than Chi2(|eta|) are discarded.
21   * Chi2(eta) is a function which gives the maximum value of chi2 associated to a certain   * Chi2(eta) is a function which gives the maximum value of chi2 associated to a certain
22   * deflection eta; in current implementation it is parameterized as:   * |deflection| (|eta|); in current implementation it is parameterized as:
23   *   *
24   *   Chi2(eta) = p0 + p1 * eta^2 + p2 * eta ^4   *   Chi2(|eta|) = p0 + ( p1 * |eta|^p2 * (1 + (p3 * |eta|)^2) )
25     *   with eta expressed in GV^-1
26   *   *
27   * where p0, p1 and p2 are parameters. These are read from a file, and are supposed to be   * where p0, p1 and p2 are parameters. These are read from a calibration text file, whose format must be:
28   * computed month by month.   * ...
29     * first_day    last_day        p0      p1      p2      p3
30     * with first_day and last_day expressed in the format YYMMDD
31     * ...
32     * where each row corresponds to a given time interval (first_day,last_day)
33     *
34     * For a given event the associated day is determined; the FIRST (starting from first row) time interval of the calibration file, which contains the event day, gives the parameters to be inserted in the Chi2(|eta|) for the given event.
35     * If the event day does not fall in any of the intervals of the calibration file, then the event is discarded.
36   *   *
37   */   */
38    
# Line 34  public: Line 42  public:
42    /*! @brief Constructor.    /*! @brief Constructor.
43     *     *
44     * @param cutName The cut's name.     * @param cutName The cut's name.
45     * @param calibFile Path for the calibration file. The format of the file's rows is:     * @param calibFile Path for the calibration text file.
    *                  YYMM efficiency p0 p1 p2  
46     */     */
47    TrkChi2DeflTimeCut(const char *cutName, const char *calibFile) :    TrkChi2DeflTimeCut(const char *cutName, const char *calibFile) :
48      PamCut(cutName), _calibFile(calibFile) {      PamCut(cutName), _calibFile(calibFile) {
# Line 44  public: Line 51  public:
51      while (! _chi2CutTable.eof()) {      while (! _chi2CutTable.eof()) {
52            
53        _chi2CutTable >> _tstringtemp;        _chi2CutTable >> _tstringtemp;
54        _iMonth.push_back(_tstringtemp.Atoi());        _iDayFirst.push_back(_tstringtemp.Atoi());
55          
56        _chi2CutTable >> _tstringtemp;        _chi2CutTable >> _tstringtemp;
57          _iDayLast.push_back(_tstringtemp.Atoi());
58                
59        _chi2CutTable >> _tstringtemp;        _chi2CutTable >> _tstringtemp;
60        _p0.push_back(_tstringtemp.Atof());        _p0.push_back(_tstringtemp.Atof());
# Line 56  public: Line 64  public:
64    
65        _chi2CutTable >> _tstringtemp;        _chi2CutTable >> _tstringtemp;
66        _p2.push_back(_tstringtemp.Atof());              _p2.push_back(_tstringtemp.Atof());      
67    
68          _chi2CutTable >> _tstringtemp;
69          _p3.push_back(_tstringtemp.Atof());      
70                
71      }      }
72      _chi2CutTable.close();      _chi2CutTable.close();
73    
 #ifdef DEBUGPAMCUT  
   
     TString hId;  
     TString hTitle;  
   
     for (UInt_t j = 0; j < 2; j++) {  
       hId.Form("h_trk_chi2_vs_defl_%i_", j);  
       hId.Append(TString(cutName));  
       hTitle.Form("TRK chi2 vs defl (%i)", j);  
       h_trk_chi2_defl[j] = new TH2F(hId.Data(), hTitle.Data(), 50, 0, 2.5, 50, 0, 20);  
     }  
   
 #endif  
   
74    }    }
75    
76    /*! @brief Destructor. */    /*! @brief Destructor. */
77    ~TrkChi2DeflTimeCut() {    ~TrkChi2DeflTimeCut() {
78    
 #ifdef DEBUGPAMCUT  
   
     for (UInt_t j = 0; j < 2; j++) {  
       h_trk_chi2_defl[j]->Write();  
     }  
   
 #endif  
   
79    }    }
80    
81    /*! @brief The tracker chi2 vs deflection check.    /*! @brief The tracker chi2 vs |deflection| check.
82     *     *
83     *     *
84     * @param event The event to analyze.     * @param event The event to analyze.
85     * @return #CUTOK if chi2 < Chi2(eta).     * @return #CUTOK if chi2 < Chi2(|eta|).
86     * @return 0 if not     * @return 0 if not
87     */     */
88    int Check(PamLevel2 *event);    int Check(PamLevel2 *event);
89    
90  private:  private:
91    
 #ifdef DEBUGPAMCUT  
   
   TH2F* h_trk_chi2_defl[2];  
   
 #endif  
   
   
92      virtual double _GetChi2(PamLevel2 *event);      virtual double _GetChi2(PamLevel2 *event);
93    
94      const char* _calibFile;      const char* _calibFile;
95    
96      TString _tstringtemp;      TString _tstringtemp;
97            
98      std::vector<Int_t> _iMonth;      std::vector<Int_t> _iDayFirst;
99        std::vector<Int_t> _iDayLast;
100      std::vector<Double_t> _p0;      std::vector<Double_t> _p0;
101      std::vector<Double_t> _p1;      std::vector<Double_t> _p1;
102      std::vector<Double_t> _p2;      std::vector<Double_t> _p2;
103        std::vector<Double_t> _p3;
104    
105      ifstream _chi2CutTable;      ifstream _chi2CutTable;
106            
107      Double_t _p0sel, _p1sel, _p2sel;      Double_t _p0sel, _p1sel, _p2sel, _p3sel;
108            
109      TTimeStamp _time;      TTimeStamp _time;
110    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.23