3 |
|
// |
4 |
|
// MuonTools |
5 |
|
// |
6 |
< |
// Isolation functions to compute various kinds of isolation. |
7 |
< |
// http://cmslxr.fnal.gov/lxr/source/RecoMuon/MuonIdentification/ |
8 |
< |
// http://cmslxr.fnal.gov/lxr/source/DataFormats/MuonReco/ |
6 |
> |
// 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 |
|
// Authors: P.Harris, C.Loizides |
16 |
|
//-------------------------------------------------------------------------------------------------- |
17 |
|
|
19 |
|
#define MITPHYSICS_UTIL_MUONTOOLS_H |
20 |
|
|
21 |
|
#include "MitAna/DataTree/interface/Muon.h" |
22 |
+ |
#include "MitAna/DataTree/interface/Collections.h" |
23 |
|
#include "MitCommon/MathTools/interface/MathUtils.h" |
24 |
|
#include "TH2D.h" |
25 |
|
|
31 |
|
~MuonTools(); |
32 |
|
|
33 |
|
enum ESelType { |
34 |
< |
kAllArbitrated, |
35 |
< |
kPromptTight, |
36 |
< |
kTMLastStationLoose, |
37 |
< |
kTMLastStationTight, |
38 |
< |
kTMOneStationLoose, |
39 |
< |
kTMOneStationTight, |
40 |
< |
kTM2DCompatibilityLoose, |
41 |
< |
kTM2DCompatibilityTight |
34 |
> |
kAllArbitrated, //All Arbitration(DT/CSC/RPC Hits) put on at least One Segements given a global Muon |
35 |
> |
kPromptTight, //Standard Global Muon Id |
36 |
> |
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 |
> |
kTM2DCompatibilityLoose, //Loose requirement on sum of compatabiliity variables ===> 1.2 Segment Compatability + 0.8 Calo Compatability > 0.8 |
41 |
> |
kTM2DCompatibilityTight //Tight requirement on sum of compatabiliity variables ===> 1.2 Segment Compatability + 0.8 Calo Compatability > 1.2 |
42 |
|
}; |
43 |
|
|
44 |
|
Bool_t Init(const char *mutemp, const char *pitemp); |
45 |
< |
Bool_t IsGood(const mithep::Muon *iMuon, ESelType iSel) const; |
45 |
> |
Bool_t IsGood(const mithep::Muon *iMuon, ESelType iSel) const; //Muon Id boolean which performs Id test above |
46 |
|
|
47 |
+ |
Double_t GetCaloCompatability(const mithep::Muon *iMuon, //Compataibility varible of Muon to be muon based on Calorimeter Templates |
48 |
+ |
Bool_t iEMSpecial, Bool_t iCorrectedHCAL) const; //EM Special => different arrangement of ECAL for compat |
49 |
+ |
Double_t GetSegmentCompatability(const mithep::Muon *iMuon) const; //Compatability variable based on likelihood of well define track through chamnbers |
50 |
|
protected: |
51 |
|
void DeleteHistos(); |
52 |
< |
Double_t GetCaloCompatability(const mithep::Muon *iMuon, |
53 |
< |
Bool_t iEMSpecial, Bool_t iCorrectedHCAL) const; |
54 |
< |
Double_t GetSegmentCompatability(const mithep::Muon *iMuon) const; |
45 |
< |
Bool_t Overflow(const TH2D *iHist, Double_t lVal0, Double_t lVal1) const; |
46 |
< |
Double_t SigWeight(Double_t iVal0, Double_t iVal1) const; |
47 |
< |
|
52 |
> |
Bool_t Overflow(const TH2D *iHist, Double_t lVal0, Double_t lVal1) const; |
53 |
> |
Double_t SigWeight(Double_t iVal0, Double_t iVal1) const; |
54 |
> |
|
55 |
|
private: |
56 |
< |
Bool_t fIsInit; //! |
57 |
< |
TH2D *fmuon_em_etaEmi; //! |
58 |
< |
TH2D *fmuon_had_etaEmi; //! |
59 |
< |
TH2D *fmuon_had_etaTmi; //! |
60 |
< |
TH2D *fmuon_em_etaB; //! |
61 |
< |
TH2D *fmuon_had_etaB; //! |
62 |
< |
TH2D *fmuon_ho_etaB; //! |
63 |
< |
TH2D *fmuon_had_etaTpl; //! |
64 |
< |
TH2D *fmuon_em_etaEpl; //! |
65 |
< |
TH2D *fmuon_had_etaEpl; //! |
66 |
< |
TH2D *fpion_em_etaEmi; //! |
67 |
< |
TH2D *fpion_had_etaEmi; //! |
68 |
< |
TH2D *fpion_had_etaTmi; //! |
69 |
< |
TH2D *fpion_em_etaB; //! |
70 |
< |
TH2D *fpion_had_etaB; //! |
71 |
< |
TH2D *fpion_ho_etaB; //! |
72 |
< |
TH2D *fpion_had_etaTpl; //! |
73 |
< |
TH2D *fpion_em_etaEpl; //! |
74 |
< |
TH2D *fpion_had_etaEpl; //! |
56 |
> |
Bool_t fIsInit; //!=true if histograms are loaded |
57 |
> |
TH2D *fmuon_em_etaEmi; //!=Minus Endcap EM Calorimeter Deposit Template for Muons |
58 |
> |
TH2D *fmuon_had_etaEmi; //!=Minus Endcap Hadronic Calorimeter Deposit Template for Muons |
59 |
> |
TH2D *fmuon_had_etaTmi; //!=Minus Transition Hadronic Calorimeter Deposit Template for Muons |
60 |
> |
TH2D *fmuon_em_etaB; //!= Barrel EM Calorimeter Deposit Template for Muons |
61 |
> |
TH2D *fmuon_had_etaB; //!= Barrel Hadronic Calorimeter Deposit Template for Muons |
62 |
> |
TH2D *fmuon_ho_etaB; //!= Barrel HO Calorimeter Deposit Template for Muons |
63 |
> |
TH2D *fmuon_had_etaTpl; //!=Plus Transition Hadronic Calorimeter Deposit Template for Muons |
64 |
> |
TH2D *fmuon_em_etaEpl; //!=Plus Endcap EM Calorimeter Deposit Template for Muons |
65 |
> |
TH2D *fmuon_had_etaEpl; //!=Plus Endcap Hadronic Calorimeter Deposit Template for Muons |
66 |
> |
TH2D *fpion_em_etaEmi; //!=Minus Endcap EM Calorimeter Deposit Template for Pions |
67 |
> |
TH2D *fpion_had_etaEmi; //!=Minus Endcap Hadronic Calorimeter Deposit Template for Pions |
68 |
> |
TH2D *fpion_had_etaTmi; //!=Minus Transition Hadronic Calorimeter Deposit Template for Pions |
69 |
> |
TH2D *fpion_em_etaB; //!= Barrel EM Calorimeter Deposit Template for Pions |
70 |
> |
TH2D *fpion_had_etaB; //!= Barrel Hadronic Calorimeter Deposit Template for Pions |
71 |
> |
TH2D *fpion_ho_etaB; //!= Barrel HO Calorimeter Deposit Template for Pions |
72 |
> |
TH2D *fpion_had_etaTpl; //!=Plus Transition Hadronic Calorimeter Deposit Template for Pions |
73 |
> |
TH2D *fpion_em_etaEpl; //!=Plus Endcap EM Calorimeter Deposit Template for Pions |
74 |
> |
TH2D *fpion_had_etaEpl; //!=Plus Endcap Hadronic Calorimeter Deposit Template for Pions |
75 |
|
|
76 |
|
TH2D *LoadHisto(const char *fname, TFile *file) const; |
77 |
|
}; |
80 |
|
//-------------------------------------------------------------------------------------------------- |
81 |
|
inline Double_t mithep::MuonTools::SigWeight(Double_t iVal0, Double_t iVal1) const |
82 |
|
{ |
83 |
< |
// |
83 |
> |
//Returns Weighted uncertainty given segment matching uncertainty=iVal0,segment matching Pull=iVal1 |
84 |
|
|
85 |
< |
if (iVal1 < 1.) |
85 |
> |
if (iVal1 < 1.) ///if Pull defined and within range |
86 |
|
return 1.; |
87 |
< |
if (iVal0 < 3. && iVal1 > 3.) { |
87 |
> |
if (iVal0 < 3. && iVal1 > 3.) { //If Pull not well defined and uncertainty defined |
88 |
|
Double_t lVal = TMath::Max(iVal0,1.); |
89 |
|
return 1./TMath::Power(lVal,0.25); |
90 |
|
} |
91 |
|
|
92 |
< |
Double_t lVal = TMath::Max(iVal1,1.); |
92 |
> |
Double_t lVal = TMath::Max(iVal1,1.); //If Pull > 1 and Pull < 3 return 1/Pull^4 |
93 |
|
return 1./TMath::Power(lVal,0.25); |
94 |
|
} |
88 |
– |
|
95 |
|
//-------------------------------------------------------------------------------------------------- |
96 |
|
inline Bool_t mithep::MuonTools::Overflow(const TH2D *iHist, Double_t lVal0, Double_t lVal1) const |
97 |
|
{ |
109 |
|
return kFALSE; |
110 |
|
} |
111 |
|
#endif |
106 |
– |
|
107 |
– |
#if 0 |
108 |
– |
static inline MCParticle* etaPhiMatch(MCParticleCol* iMCParts,Muon *iMuon) { |
109 |
– |
mithep::MCParticle *lMC = 0; Double_t lDR = 1.; Double_t lPt = -1.; |
110 |
– |
for(unsigned Int_t i0 = 0; i0 < iMCParts->GetEntries(); i0++) { |
111 |
– |
mithep::MCParticle* pMC = iMCParts->At(i0); |
112 |
– |
if(pMC->Status() != 1) continue; |
113 |
– |
Double_t pDR = mithep::MathUtils::DeltaR(pMC->Mom(),iMuon->Mom()); |
114 |
– |
if(pDR > lDR && pDR > 0.01) continue; |
115 |
– |
if(fabs(pMC->Pt()) < lPt) continue; |
116 |
– |
lDR = pDR; |
117 |
– |
lMC = pMC; |
118 |
– |
lPt = pMC->Pt(); |
119 |
– |
} |
120 |
– |
return lMC; |
121 |
– |
} |
122 |
– |
static inline Muon* match(MuonCol* iMuons,Track *iTrack) { |
123 |
– |
mithep::Muon *lMuon = 0; Double_t lDR = 1.; Double_t lPt = -1.; |
124 |
– |
for(unsigned Int_t i0 = 0; i0 < iMuons->GetEntries(); i0++) { |
125 |
– |
mithep::Muon* pMuon = iMuons->At(i0); |
126 |
– |
Double_t pDR = mithep::MathUtils::DeltaR(pMuon->Mom(),iTrack->Mom4(0.109)); |
127 |
– |
if(pDR > lDR && pDR > 0.01) continue; |
128 |
– |
if(fabs(pMuon->Pt()) < lPt) continue; |
129 |
– |
lDR = pDR; |
130 |
– |
lMuon = pMuon; |
131 |
– |
lPt = pMuon->Pt(); |
132 |
– |
} |
133 |
– |
return lMuon; |
134 |
– |
} |
135 |
– |
#endif |
136 |
– |
|
137 |
– |
|