4 |
|
|
5 |
|
#include <TDirectory.h> |
6 |
|
#include <TH1F.h> |
7 |
+ |
#include <TTree.h> |
8 |
|
|
9 |
+ |
#include "VHbbAnalysis/VHbbDataFormats/interface/VHbbEventAuxInfo.h" |
10 |
|
|
11 |
< |
trkupgradeanalysis::MuonInfoPlotSet::MuonInfoPlotSet() |
12 |
< |
: histogramHaveBeenBooked_(false) |
11 |
> |
trkupgradeanalysis::MuonInfoPlotSet::MuonInfoPlotSet( bool createIsolationTree ) |
12 |
> |
: histogramHaveBeenBooked_(false), createIsolationTree_(createIsolationTree), pIsolationTree_(NULL) |
13 |
|
{ |
14 |
|
// No operation besides the initialiser list. |
15 |
|
} |
52 |
|
pPt_=new TH1F( "pT", "pT", 60, 0, 250 ); |
53 |
|
pPt_->SetDirectory(pDirectory); |
54 |
|
|
55 |
+ |
pChargedIsolation_=new TH1F( "chargedIsolation", "chargedIsolation", 60, 0, 30 ); |
56 |
+ |
pChargedIsolation_->SetDirectory(pDirectory); |
57 |
+ |
|
58 |
+ |
pPhotonIsolation_=new TH1F( "photonIsolation", "photonIsolation", 60, 0, 30 ); |
59 |
+ |
pPhotonIsolation_->SetDirectory(pDirectory); |
60 |
+ |
|
61 |
+ |
pNeutralIsolation_=new TH1F( "neutralIsolation", "neutralIsolation", 60, 0, 30 ); |
62 |
+ |
pNeutralIsolation_->SetDirectory(pDirectory); |
63 |
+ |
|
64 |
+ |
pPileupIsolation_=new TH1F( "pileupIsolation", "pileupIsolation", 60, 0, 30 ); |
65 |
+ |
pPileupIsolation_->SetDirectory(pDirectory); |
66 |
+ |
|
67 |
+ |
pRelativeChargedIsolation_=new TH1F( "relativeChargedIsolation", "relativeChargedIsolation", 60, 0, 1 ); |
68 |
+ |
pRelativeChargedIsolation_->SetDirectory(pDirectory); |
69 |
+ |
|
70 |
+ |
pRelativePhotonIsolation_=new TH1F( "relativePhotonIsolation", "relativePhotonIsolation", 60, 0, 1 ); |
71 |
+ |
pRelativePhotonIsolation_->SetDirectory(pDirectory); |
72 |
+ |
|
73 |
+ |
pRelativeNeutralIsolation_=new TH1F( "relativeNeutralIsolation", "relativeNeutralIsolation", 60, 0, 1 ); |
74 |
+ |
pRelativeNeutralIsolation_->SetDirectory(pDirectory); |
75 |
+ |
|
76 |
+ |
pRelativePileupIsolation_=new TH1F( "relativePileupIsolation", "relativePileupIsolation", 60, 0, 1 ); |
77 |
+ |
pRelativePileupIsolation_->SetDirectory(pDirectory); |
78 |
+ |
|
79 |
+ |
pRelativeIsolation_=new TH1F( "relativeIsolation", "relativeIsolation", 120, 0, 2 ); |
80 |
+ |
pRelativeIsolation_->SetDirectory(pDirectory); |
81 |
+ |
|
82 |
+ |
pDeltaBetaCorrectedIsolation_=new TH1F( "deltaBetaCorrectedIsolation", "deltaBetaCorrectedIsolation", 120, 0, 2 ); |
83 |
+ |
pDeltaBetaCorrectedIsolation_->SetDirectory(pDirectory); |
84 |
+ |
|
85 |
+ |
pRho25CorrectedIsolation_=new TH1F( "rho25CorrectedIsolation", "rho25CorrectedIsolation", 120, 0, 2 ); |
86 |
+ |
pRho25CorrectedIsolation_->SetDirectory(pDirectory); |
87 |
+ |
|
88 |
+ |
if( createIsolationTree_ ) |
89 |
+ |
{ |
90 |
+ |
pIsolationTree_=new TTree("isolationTree","Data about the muon isolation"); |
91 |
+ |
pIsolationTree_->Branch("numberOfPrimaryVertices",&numberOfPrimaryVertices_branch_,"numberOfPrimaryVertices/I"); |
92 |
+ |
pIsolationTree_->Branch("chargedIsolation",&chargedIsolation_branch_,"chargedIsolation/F"); |
93 |
+ |
pIsolationTree_->Branch("photonIsolation",&photonIsolation_branch_,"photonIsolation/F"); |
94 |
+ |
pIsolationTree_->Branch("neutralIsolation",&neutralIsolation_branch_,"neutralIsolation/F"); |
95 |
+ |
pIsolationTree_->Branch("pileupIsolation",&pileupIsolation_branch_,"pileupIsolation/F"); |
96 |
+ |
pIsolationTree_->Branch("rho25",&rho25_branch_,"rho25/F"); |
97 |
+ |
pIsolationTree_->Branch("pT",&pT_branch_,"pT/F"); |
98 |
+ |
pIsolationTree_->SetDirectory( pDirectory ); |
99 |
+ |
} |
100 |
|
histogramHaveBeenBooked_=true; |
101 |
|
} |
102 |
|
|
103 |
< |
void trkupgradeanalysis::MuonInfoPlotSet::fill( const VHbbEvent::MuonInfo& muon ) |
103 |
> |
void trkupgradeanalysis::MuonInfoPlotSet::fill( const VHbbEvent::MuonInfo& muon, const VHbbEventAuxInfo* pAuxInfo ) |
104 |
|
{ |
105 |
|
if( !histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::MuonInfoPlotSet::book() - histograms have not been booked" ); |
106 |
|
|
107 |
+ |
// Get the additional info about the event if it's available |
108 |
+ |
int numberOfPrimaryVertices=-1; |
109 |
+ |
float rho25=-1; |
110 |
+ |
if( pAuxInfo ) |
111 |
+ |
{ |
112 |
+ |
numberOfPrimaryVertices=pAuxInfo->pvInfo.nVertices; |
113 |
+ |
rho25=pAuxInfo->puInfo.rho25; |
114 |
+ |
} |
115 |
+ |
|
116 |
|
pGlobalChi2_->Fill( muon.globChi2 ); |
117 |
|
pNumberOfPixelHits_->Fill( muon.nPixelHits ); |
118 |
|
pNumberOfGlobalHits_->Fill( muon.globNHits ); |
122 |
|
pIPDB_->Fill( muon.ipDb ); |
123 |
|
pEta_->Fill( muon.p4.Eta() ); |
124 |
|
pPt_->Fill( muon.p4.Pt() ); |
125 |
+ |
pChargedIsolation_->Fill( muon.pfChaIso ); |
126 |
+ |
pPhotonIsolation_->Fill( muon.pfPhoIso ); |
127 |
+ |
pNeutralIsolation_->Fill( muon.pfNeuIso ); |
128 |
+ |
pPileupIsolation_->Fill( muon.pfChaPUIso ); |
129 |
+ |
pRelativeChargedIsolation_->Fill( muon.pfChaIso/muon.p4.Pt() ); |
130 |
+ |
pRelativePhotonIsolation_->Fill( muon.pfPhoIso/muon.p4.Pt() ); |
131 |
+ |
pRelativeNeutralIsolation_->Fill( muon.pfNeuIso/muon.p4.Pt() ); |
132 |
+ |
pRelativePileupIsolation_->Fill( muon.pfChaPUIso/muon.p4.Pt() ); |
133 |
+ |
pRelativeIsolation_->Fill( combinedRelativeIsolation(muon) ); |
134 |
+ |
pDeltaBetaCorrectedIsolation_->Fill( deltaBetaCorrectedIsolation(muon) ); |
135 |
+ |
if( pAuxInfo ) pRho25CorrectedIsolation_->Fill( rho25CorrectedIsolation(muon,rho25) ); // Don't bother filling if I couldn't get the rho25 info |
136 |
+ |
|
137 |
+ |
// If the TTree is not null then isolation data has been requested |
138 |
+ |
if( pIsolationTree_ ) |
139 |
+ |
{ |
140 |
+ |
numberOfPrimaryVertices_branch_=numberOfPrimaryVertices; |
141 |
+ |
chargedIsolation_branch_=muon.pfChaIso; |
142 |
+ |
photonIsolation_branch_=muon.pfPhoIso; |
143 |
+ |
neutralIsolation_branch_=muon.pfNeuIso; |
144 |
+ |
pileupIsolation_branch_=muon.pfChaPUIso; |
145 |
+ |
rho25_branch_=rho25; |
146 |
+ |
pT_branch_=muon.p4.Pt(); |
147 |
+ |
|
148 |
+ |
pIsolationTree_->Fill(); |
149 |
+ |
} |
150 |
|
} |
151 |
|
|
152 |
+ |
|
153 |
+ |
float trkupgradeanalysis::MuonInfoPlotSet::combinedRelativeIsolation( const VHbbEvent::MuonInfo& muon ) |
154 |
+ |
{ |
155 |
+ |
return (muon.pfChaIso+muon.pfPhoIso+muon.pfNeuIso)/muon.p4.Pt(); |
156 |
+ |
} |
157 |
+ |
|
158 |
+ |
float trkupgradeanalysis::MuonInfoPlotSet::deltaBetaCorrectedIsolation( const VHbbEvent::MuonInfo& muon, float deltaBetaFactor ) |
159 |
+ |
{ |
160 |
+ |
// deltaBetaFactor defaults to -0.5 |
161 |
+ |
float correctedNeutralIsolation=muon.pfPhoIso+muon.pfNeuIso+deltaBetaFactor*muon.pfChaPUIso; |
162 |
+ |
if( correctedNeutralIsolation<0 ) correctedNeutralIsolation=muon.pfPhoIso+muon.pfNeuIso; |
163 |
+ |
return (muon.pfChaIso+correctedNeutralIsolation)/muon.p4.Pt(); |
164 |
+ |
} |
165 |
+ |
|
166 |
+ |
float trkupgradeanalysis::MuonInfoPlotSet::rho25CorrectedIsolation( const VHbbEvent::MuonInfo& muon, float rho25 ) |
167 |
+ |
{ |
168 |
+ |
float uncorrectedIsolation=combinedRelativeIsolation(muon); |
169 |
+ |
float correctedIsolation=uncorrectedIsolation-(M_PI*0.4*0.4*rho25)/muon.p4.Pt(); |
170 |
+ |
if( correctedIsolation<0 ) correctedIsolation=0; |
171 |
+ |
|
172 |
+ |
return correctedIsolation; |
173 |
+ |
} |