ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/interface/MuonTools.h
Revision: 1.10
Committed: Mon Jul 20 04:55:33 2009 UTC (15 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010
Changes since 1.9: +4 -2 lines
Log Message:
Changes for docu

File Contents

# User Rev Content
1 loizides 1.3 //--------------------------------------------------------------------------------------------------
2 loizides 1.10 // $Id: MuonTools.h,v 1.9 2009/06/15 15:00:23 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 loizides 1.8 #ifndef MITPHYSICS_UTILS_MUONTOOLS_H
19     #define MITPHYSICS_UTILS_MUONTOOLS_H
20 pharris 1.1
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 loizides 1.10 virtual ~MuonTools();
31 loizides 1.3
32     enum ESelType {
33 loizides 1.7 kAllArbitrated, //All arbitration (DT/CSC/RPC Hits) put on at least one
34     // segments given a global Muon
35     kPromptTight, //Standard global muon identification
36 pharris 1.6 kTMLastStationLoose, //Loose matching requirements on lastmost muon station of reco
37     kTMLastStationTight, //Tight matching requirements on lastmost muon station of reco
38     kTMOneStationLoose, //Loose matching requirements on at least one muon station of reco
39     kTMOneStationTight, //Tight matching requirements on at least one muon station of reco
40 loizides 1.7 kTM2DCompatibilityLoose, //Loose requirement on sum of compatabiliity variables
41     // ===> 1.2 Segment compatability + 0.8 calo compatability > 0.8
42     kTM2DCompatibilityTight //Tight requirement on sum of compatabiliity variables
43     // ===> 1.2 Segment compatability + 0.8 calo compatability > 1.2
44 loizides 1.3 };
45    
46     Bool_t Init(const char *mutemp, const char *pitemp);
47 loizides 1.7 Bool_t IsGood(const mithep::Muon *iMuon, ESelType iSel) const;
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 loizides 1.3
52     protected:
53     void DeleteHistos();
54 pharris 1.6 Bool_t Overflow(const TH2D *iHist, Double_t lVal0, Double_t lVal1) const;
55     Double_t SigWeight(Double_t iVal0, Double_t iVal1) const;
56    
57 loizides 1.3 private:
58 loizides 1.4 Bool_t fIsInit; //!=true if histograms are loaded
59 loizides 1.7 TH2D *fmuon_em_etaEmi; //!Neg Endcap EM Calo Deposit Template for Muons
60     TH2D *fmuon_had_etaEmi; //!Neg Endcap Hadronic Calo Deposit Template for Muons
61     TH2D *fmuon_had_etaTmi; //!Neg Transition Hadronic Calo Deposit Template for Muons
62     TH2D *fmuon_em_etaB; //!Barrel EM Calo Deposit Template for Muons
63     TH2D *fmuon_had_etaB; //!Barrel Hadronic Calo Deposit Template for Muons
64     TH2D *fmuon_ho_etaB; //!Barrel HO Calo Deposit Template for Muons
65     TH2D *fmuon_had_etaTpl; //!Plus Transition Hadronic Calo Deposit Template for Muons
66     TH2D *fmuon_em_etaEpl; //!Plus Endcap EM Calo Deposit Template for Muons
67     TH2D *fmuon_had_etaEpl; //!Plus Endcap Hadronic Calo Deposit Template for Muons
68     TH2D *fpion_em_etaEmi; //!Neg Endcap EM Calo Deposit Template for Pions
69     TH2D *fpion_had_etaEmi; //!Neg Endcap Hadronic Calo Deposit Template for Pions
70     TH2D *fpion_had_etaTmi; //!Neg Transition Hadronic Calo Deposit Template for Pions
71     TH2D *fpion_em_etaB; //!Barrel EM Calo Deposit Template for Pions
72     TH2D *fpion_had_etaB; //!Barrel Hadronic Calo Deposit Template for Pions
73     TH2D *fpion_ho_etaB; //!Barrel HO Calo Deposit Template for Pions
74     TH2D *fpion_had_etaTpl; //!Plus Transition Hadronic Calo Deposit Template for Pions
75     TH2D *fpion_em_etaEpl; //!Plus Endcap EM Calo Deposit Template for Pions
76     TH2D *fpion_had_etaEpl; //!Plus Endcap Hadronic Calo Deposit Template for Pions
77 loizides 1.3
78     TH2D *LoadHisto(const char *fname, TFile *file) const;
79 loizides 1.10
80     ClassDef(MuonTools, 0) // Muon tools
81 loizides 1.3 };
82     }
83    
84     //--------------------------------------------------------------------------------------------------
85     inline Double_t mithep::MuonTools::SigWeight(Double_t iVal0, Double_t iVal1) const
86     {
87 loizides 1.7 // Returns weighted uncertainty given segment matching uncertainty (iVal0) and
88     // segment matching pull (iVal1).
89 loizides 1.3
90 loizides 1.7 if (iVal1 < 1.) //if pull defined and within range
91 loizides 1.3 return 1.;
92 loizides 1.7 if (iVal0 < 3. && iVal1 > 3.) { //if pull not well defined and uncertainty defined
93 loizides 1.3 Double_t lVal = TMath::Max(iVal0,1.);
94     return 1./TMath::Power(lVal,0.25);
95     }
96    
97 loizides 1.7 Double_t lVal = TMath::Max(iVal1,1.); //if pull > 1 and pull < 3 return 1/pull^4
98 loizides 1.3 return 1./TMath::Power(lVal,0.25);
99     }
100     //--------------------------------------------------------------------------------------------------
101     inline Bool_t mithep::MuonTools::Overflow(const TH2D *iHist, Double_t lVal0, Double_t lVal1) const
102     {
103     // Check if values are in overflow bins of given histogram.
104    
105     if(iHist == 0)
106     return kTRUE;
107    
108     if (iHist ->GetXaxis()->FindBin(lVal0) == 0 ||
109     iHist ->GetXaxis()->FindBin(lVal0) > iHist->GetNbinsX() ||
110     iHist ->GetYaxis()->FindBin(lVal0) == 0 ||
111     iHist ->GetYaxis()->FindBin(lVal0) > iHist->GetNbinsY()) {
112     return kTRUE;
113     }
114     return kFALSE;
115     }
116     #endif