ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/interface/MuonTools.h
Revision: 1.5
Committed: Mon Mar 23 22:17:04 2009 UTC (16 years, 1 month ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_008
Changes since 1.4: +2 -2 lines
Log Message:
Cleanup

File Contents

# User Rev Content
1 loizides 1.3 //--------------------------------------------------------------------------------------------------
2 loizides 1.5 // $Id: MuonTools.h,v 1.4 2008/11/28 09:13:35 loizides Exp $
3 loizides 1.3 //
4     // MuonTools
5     //
6 loizides 1.4 // This class allows you to classify a given muon according to defined criteria. For this purpose
7     // is loads histograms from two ROOT files, specified in the constructor. The main function then
8     // is "IsGood(*muon, selection)" which returns true if the given muon fulfills the selection
9     // criteria.
10     //
11     // Logically, the code has been put together by Phil who took most of the ideas from
12     // http://cmslxr.fnal.gov/lxr/source/RecoMuon/MuonIdentification/
13     // http://cmslxr.fnal.gov/lxr/source/DataFormats/MuonReco/
14     //
15 loizides 1.3 // Authors: P.Harris, C.Loizides
16     //--------------------------------------------------------------------------------------------------
17    
18 pharris 1.1 #ifndef MITPHYSICS_UTIL_MUONTOOLS_H
19     #define MITPHYSICS_UTIL_MUONTOOLS_H
20    
21 loizides 1.3 #include "MitAna/DataTree/interface/Muon.h"
22     #include "MitCommon/MathTools/interface/MathUtils.h"
23 pharris 1.1 #include "TH2D.h"
24    
25     namespace mithep {
26     class MuonTools {
27 loizides 1.3 public:
28     MuonTools(const char *mutemp="$CMSSW_BASE/src/MitPhysics/data/MuonCaloTemplate.root",
29     const char *pitemp="$CMSSW_BASE/src/MitPhysics/data/PionCaloTemplate.root");
30     ~MuonTools();
31    
32     enum ESelType {
33 loizides 1.5 kAllArbitrated, //
34 loizides 1.4 kPromptTight, //
35     kTMLastStationLoose, //
36     kTMLastStationTight, //
37     kTMOneStationLoose, //
38     kTMOneStationTight, //
39     kTM2DCompatibilityLoose, //
40     kTM2DCompatibilityTight //
41 loizides 1.3 };
42    
43     Bool_t Init(const char *mutemp, const char *pitemp);
44     Bool_t IsGood(const mithep::Muon *iMuon, ESelType iSel) const;
45    
46     protected:
47     void DeleteHistos();
48     Double_t GetCaloCompatability(const mithep::Muon *iMuon,
49     Bool_t iEMSpecial, Bool_t iCorrectedHCAL) const;
50     Double_t GetSegmentCompatability(const mithep::Muon *iMuon) const;
51     Bool_t Overflow(const TH2D *iHist, Double_t lVal0, Double_t lVal1) const;
52     Double_t SigWeight(Double_t iVal0, Double_t iVal1) const;
53    
54     private:
55 loizides 1.4 Bool_t fIsInit; //!=true if histograms are loaded
56     TH2D *fmuon_em_etaEmi; //!todo by phil
57 loizides 1.3 TH2D *fmuon_had_etaEmi; //!
58     TH2D *fmuon_had_etaTmi; //!
59     TH2D *fmuon_em_etaB; //!
60     TH2D *fmuon_had_etaB; //!
61     TH2D *fmuon_ho_etaB; //!
62     TH2D *fmuon_had_etaTpl; //!
63     TH2D *fmuon_em_etaEpl; //!
64     TH2D *fmuon_had_etaEpl; //!
65     TH2D *fpion_em_etaEmi; //!
66     TH2D *fpion_had_etaEmi; //!
67     TH2D *fpion_had_etaTmi; //!
68     TH2D *fpion_em_etaB; //!
69     TH2D *fpion_had_etaB; //!
70     TH2D *fpion_ho_etaB; //!
71     TH2D *fpion_had_etaTpl; //!
72     TH2D *fpion_em_etaEpl; //!
73     TH2D *fpion_had_etaEpl; //!
74    
75     TH2D *LoadHisto(const char *fname, TFile *file) const;
76     };
77     }
78    
79     //--------------------------------------------------------------------------------------------------
80     inline Double_t mithep::MuonTools::SigWeight(Double_t iVal0, Double_t iVal1) const
81     {
82 loizides 1.4 // todo
83 loizides 1.3
84     if (iVal1 < 1.)
85     return 1.;
86     if (iVal0 < 3. && iVal1 > 3.) {
87     Double_t lVal = TMath::Max(iVal0,1.);
88     return 1./TMath::Power(lVal,0.25);
89     }
90    
91     Double_t lVal = TMath::Max(iVal1,1.);
92     return 1./TMath::Power(lVal,0.25);
93     }
94    
95     //--------------------------------------------------------------------------------------------------
96     inline Bool_t mithep::MuonTools::Overflow(const TH2D *iHist, Double_t lVal0, Double_t lVal1) const
97     {
98     // Check if values are in overflow bins of given histogram.
99    
100     if(iHist == 0)
101     return kTRUE;
102    
103     if (iHist ->GetXaxis()->FindBin(lVal0) == 0 ||
104     iHist ->GetXaxis()->FindBin(lVal0) > iHist->GetNbinsX() ||
105     iHist ->GetYaxis()->FindBin(lVal0) == 0 ||
106     iHist ->GetYaxis()->FindBin(lVal0) > iHist->GetNbinsY()) {
107     return kTRUE;
108     }
109     return kFALSE;
110     }
111     #endif