1 |
loizides |
1.3 |
//--------------------------------------------------------------------------------------------------
|
2 |
|
|
// $Id: IsolationTools.h,v 1.1 2008/10/15 06:02:05 loizides Exp $
|
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/
|
9 |
|
|
// Authors: P.Harris, C.Loizides
|
10 |
|
|
//--------------------------------------------------------------------------------------------------
|
11 |
|
|
|
12 |
pharris |
1.1 |
#ifndef MITPHYSICS_UTIL_MUONTOOLS_H
|
13 |
|
|
#define MITPHYSICS_UTIL_MUONTOOLS_H
|
14 |
|
|
|
15 |
loizides |
1.3 |
#include "MitAna/DataTree/interface/Muon.h"
|
16 |
|
|
#include "MitCommon/MathTools/interface/MathUtils.h"
|
17 |
pharris |
1.1 |
#include "TH2D.h"
|
18 |
|
|
|
19 |
|
|
namespace mithep {
|
20 |
|
|
class MuonTools {
|
21 |
loizides |
1.3 |
public:
|
22 |
|
|
MuonTools(const char *mutemp="$CMSSW_BASE/src/MitPhysics/data/MuonCaloTemplate.root",
|
23 |
|
|
const char *pitemp="$CMSSW_BASE/src/MitPhysics/data/PionCaloTemplate.root");
|
24 |
|
|
~MuonTools();
|
25 |
|
|
|
26 |
|
|
enum ESelType {
|
27 |
|
|
kAllArbitrated,
|
28 |
|
|
kPromptTight,
|
29 |
|
|
kTMLastStationLoose,
|
30 |
|
|
kTMLastStationTight,
|
31 |
|
|
kTMOneStationLoose,
|
32 |
|
|
kTMOneStationTight,
|
33 |
|
|
kTM2DCompatibilityLoose,
|
34 |
|
|
kTM2DCompatibilityTight
|
35 |
|
|
};
|
36 |
|
|
|
37 |
|
|
Bool_t Init(const char *mutemp, const char *pitemp);
|
38 |
|
|
Bool_t IsGood(const mithep::Muon *iMuon, ESelType iSel) const;
|
39 |
|
|
|
40 |
|
|
protected:
|
41 |
|
|
void DeleteHistos();
|
42 |
|
|
Double_t GetCaloCompatability(const mithep::Muon *iMuon,
|
43 |
|
|
Bool_t iEMSpecial, Bool_t iCorrectedHCAL) const;
|
44 |
|
|
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 |
|
|
|
48 |
|
|
private:
|
49 |
|
|
Bool_t fIsInit; //!
|
50 |
|
|
TH2D *fmuon_em_etaEmi; //!
|
51 |
|
|
TH2D *fmuon_had_etaEmi; //!
|
52 |
|
|
TH2D *fmuon_had_etaTmi; //!
|
53 |
|
|
TH2D *fmuon_em_etaB; //!
|
54 |
|
|
TH2D *fmuon_had_etaB; //!
|
55 |
|
|
TH2D *fmuon_ho_etaB; //!
|
56 |
|
|
TH2D *fmuon_had_etaTpl; //!
|
57 |
|
|
TH2D *fmuon_em_etaEpl; //!
|
58 |
|
|
TH2D *fmuon_had_etaEpl; //!
|
59 |
|
|
TH2D *fpion_em_etaEmi; //!
|
60 |
|
|
TH2D *fpion_had_etaEmi; //!
|
61 |
|
|
TH2D *fpion_had_etaTmi; //!
|
62 |
|
|
TH2D *fpion_em_etaB; //!
|
63 |
|
|
TH2D *fpion_had_etaB; //!
|
64 |
|
|
TH2D *fpion_ho_etaB; //!
|
65 |
|
|
TH2D *fpion_had_etaTpl; //!
|
66 |
|
|
TH2D *fpion_em_etaEpl; //!
|
67 |
|
|
TH2D *fpion_had_etaEpl; //!
|
68 |
|
|
|
69 |
|
|
TH2D *LoadHisto(const char *fname, TFile *file) const;
|
70 |
|
|
};
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
//--------------------------------------------------------------------------------------------------
|
74 |
|
|
inline Double_t mithep::MuonTools::SigWeight(Double_t iVal0, Double_t iVal1) const
|
75 |
|
|
{
|
76 |
|
|
//
|
77 |
|
|
|
78 |
|
|
if (iVal1 < 1.)
|
79 |
|
|
return 1.;
|
80 |
|
|
if (iVal0 < 3. && iVal1 > 3.) {
|
81 |
|
|
Double_t lVal = TMath::Max(iVal0,1.);
|
82 |
|
|
return 1./TMath::Power(lVal,0.25);
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
Double_t lVal = TMath::Max(iVal1,1.);
|
86 |
|
|
return 1./TMath::Power(lVal,0.25);
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
//--------------------------------------------------------------------------------------------------
|
90 |
|
|
inline Bool_t mithep::MuonTools::Overflow(const TH2D *iHist, Double_t lVal0, Double_t lVal1) const
|
91 |
|
|
{
|
92 |
|
|
// Check if values are in overflow bins of given histogram.
|
93 |
|
|
|
94 |
|
|
if(iHist == 0)
|
95 |
|
|
return kTRUE;
|
96 |
|
|
|
97 |
|
|
if (iHist ->GetXaxis()->FindBin(lVal0) == 0 ||
|
98 |
|
|
iHist ->GetXaxis()->FindBin(lVal0) > iHist->GetNbinsX() ||
|
99 |
|
|
iHist ->GetYaxis()->FindBin(lVal0) == 0 ||
|
100 |
|
|
iHist ->GetYaxis()->FindBin(lVal0) > iHist->GetNbinsY()) {
|
101 |
|
|
return kTRUE;
|
102 |
|
|
}
|
103 |
|
|
return kFALSE;
|
104 |
|
|
}
|
105 |
|
|
#endif
|
106 |
|
|
|
107 |
|
|
#if 0
|
108 |
pharris |
1.1 |
static inline MCParticle* etaPhiMatch(MCParticleCol* iMCParts,Muon *iMuon) {
|
109 |
loizides |
1.3 |
mithep::MCParticle *lMC = 0; Double_t lDR = 1.; Double_t lPt = -1.;
|
110 |
|
|
for(unsigned Int_t i0 = 0; i0 < iMCParts->GetEntries(); i0++) {
|
111 |
pharris |
1.1 |
mithep::MCParticle* pMC = iMCParts->At(i0);
|
112 |
|
|
if(pMC->Status() != 1) continue;
|
113 |
loizides |
1.3 |
Double_t pDR = mithep::MathUtils::DeltaR(pMC->Mom(),iMuon->Mom());
|
114 |
pharris |
1.1 |
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 |
loizides |
1.3 |
mithep::Muon *lMuon = 0; Double_t lDR = 1.; Double_t lPt = -1.;
|
124 |
|
|
for(unsigned Int_t i0 = 0; i0 < iMuons->GetEntries(); i0++) {
|
125 |
pharris |
1.1 |
mithep::Muon* pMuon = iMuons->At(i0);
|
126 |
loizides |
1.3 |
Double_t pDR = mithep::MathUtils::DeltaR(pMuon->Mom(),iTrack->Mom4(0.109));
|
127 |
pharris |
1.1 |
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 |
loizides |
1.3 |
#endif
|
136 |
ceballos |
1.2 |
|
137 |
pharris |
1.1 |
|