1 |
grimes |
1.1 |
#include "TrkUpgradeAnalysis/VHbb/interface/MuonInfoPlotSet.h"
|
2 |
|
|
|
3 |
|
|
#include <stdexcept>
|
4 |
|
|
|
5 |
|
|
#include <TDirectory.h>
|
6 |
|
|
#include <TH1F.h>
|
7 |
grimes |
1.2 |
#include <TTree.h>
|
8 |
grimes |
1.1 |
|
9 |
grimes |
1.2 |
#include "VHbbAnalysis/VHbbDataFormats/interface/VHbbEventAuxInfo.h"
|
10 |
grimes |
1.1 |
|
11 |
grimes |
1.2 |
trkupgradeanalysis::MuonInfoPlotSet::MuonInfoPlotSet( bool createIsolationTree )
|
12 |
|
|
: histogramHaveBeenBooked_(false), createIsolationTree_(createIsolationTree), pIsolationTree_(NULL)
|
13 |
grimes |
1.1 |
{
|
14 |
|
|
// No operation besides the initialiser list.
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
void trkupgradeanalysis::MuonInfoPlotSet::book( TDirectory* pDirectory )
|
18 |
|
|
{
|
19 |
|
|
if( histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::MuonInfoPlotSet::book() - histograms have already been booked" );
|
20 |
|
|
|
21 |
|
|
//
|
22 |
|
|
// Note that the root file which TDirectory is part of takes ownership of all
|
23 |
|
|
// of these objects, so I don't need to (and shouldn't) delete them when I'm
|
24 |
|
|
// finished.
|
25 |
|
|
//
|
26 |
|
|
|
27 |
|
|
|
28 |
grimes |
1.3 |
pGlobalChi2_=new TH1F( "globalChi2","Global chi2", 60, 0, 6 );
|
29 |
grimes |
1.1 |
pGlobalChi2_->SetDirectory(pDirectory);
|
30 |
|
|
|
31 |
grimes |
1.3 |
pNumberOfValidPixel_=new TH1F( "numberOfValidPixel", "Number of valid pixel", 11, -0.5, 10.5 );
|
32 |
|
|
pNumberOfValidPixel_->SetDirectory(pDirectory);
|
33 |
|
|
|
34 |
grimes |
1.1 |
pNumberOfPixelHits_=new TH1F( "numberOfPixelHits", "Number of pixel hits", 11, -0.5, 10.5 );
|
35 |
|
|
pNumberOfPixelHits_->SetDirectory(pDirectory);
|
36 |
|
|
|
37 |
|
|
pNumberOfGlobalHits_=new TH1F( "numberOfGlobalHits", "Number of global hits", 31, -0.5, 30.5 );
|
38 |
|
|
pNumberOfGlobalHits_->SetDirectory(pDirectory);
|
39 |
|
|
|
40 |
|
|
pNumberOfHits_=new TH1F( "numberOfHits", "Number of hits", 31, -0.5, 30.5 );
|
41 |
|
|
pNumberOfHits_->SetDirectory(pDirectory);
|
42 |
|
|
|
43 |
|
|
pCategory_=new TH1F( "category", "Category", 60, 0, 20 );
|
44 |
|
|
pCategory_->SetDirectory(pDirectory);
|
45 |
|
|
|
46 |
|
|
pNumberOfMatches_=new TH1F( "numberOfMatches", "Number of matches", 16, -0.5, 15.5 );
|
47 |
|
|
pNumberOfMatches_->SetDirectory(pDirectory);
|
48 |
|
|
|
49 |
|
|
pIPDB_=new TH1F( "ipDb", "ipDb, whatever that means", 60, 0, 2 );
|
50 |
|
|
pIPDB_->SetDirectory(pDirectory);
|
51 |
|
|
|
52 |
|
|
pEta_=new TH1F( "eta", "Eta", 60, -3, 3 );
|
53 |
|
|
pEta_->SetDirectory(pDirectory);
|
54 |
|
|
|
55 |
grimes |
1.3 |
pPhi_=new TH1F( "phi", "phi", 60, -3.15, 3.15 );
|
56 |
|
|
pPhi_->SetDirectory(pDirectory);
|
57 |
|
|
|
58 |
grimes |
1.1 |
pPt_=new TH1F( "pT", "pT", 60, 0, 250 );
|
59 |
|
|
pPt_->SetDirectory(pDirectory);
|
60 |
|
|
|
61 |
grimes |
1.2 |
pChargedIsolation_=new TH1F( "chargedIsolation", "chargedIsolation", 60, 0, 30 );
|
62 |
|
|
pChargedIsolation_->SetDirectory(pDirectory);
|
63 |
|
|
|
64 |
|
|
pPhotonIsolation_=new TH1F( "photonIsolation", "photonIsolation", 60, 0, 30 );
|
65 |
|
|
pPhotonIsolation_->SetDirectory(pDirectory);
|
66 |
|
|
|
67 |
|
|
pNeutralIsolation_=new TH1F( "neutralIsolation", "neutralIsolation", 60, 0, 30 );
|
68 |
|
|
pNeutralIsolation_->SetDirectory(pDirectory);
|
69 |
|
|
|
70 |
|
|
pPileupIsolation_=new TH1F( "pileupIsolation", "pileupIsolation", 60, 0, 30 );
|
71 |
|
|
pPileupIsolation_->SetDirectory(pDirectory);
|
72 |
|
|
|
73 |
|
|
pRelativeChargedIsolation_=new TH1F( "relativeChargedIsolation", "relativeChargedIsolation", 60, 0, 1 );
|
74 |
|
|
pRelativeChargedIsolation_->SetDirectory(pDirectory);
|
75 |
|
|
|
76 |
|
|
pRelativePhotonIsolation_=new TH1F( "relativePhotonIsolation", "relativePhotonIsolation", 60, 0, 1 );
|
77 |
|
|
pRelativePhotonIsolation_->SetDirectory(pDirectory);
|
78 |
|
|
|
79 |
|
|
pRelativeNeutralIsolation_=new TH1F( "relativeNeutralIsolation", "relativeNeutralIsolation", 60, 0, 1 );
|
80 |
|
|
pRelativeNeutralIsolation_->SetDirectory(pDirectory);
|
81 |
|
|
|
82 |
|
|
pRelativePileupIsolation_=new TH1F( "relativePileupIsolation", "relativePileupIsolation", 60, 0, 1 );
|
83 |
|
|
pRelativePileupIsolation_->SetDirectory(pDirectory);
|
84 |
|
|
|
85 |
|
|
pRelativeIsolation_=new TH1F( "relativeIsolation", "relativeIsolation", 120, 0, 2 );
|
86 |
|
|
pRelativeIsolation_->SetDirectory(pDirectory);
|
87 |
|
|
|
88 |
|
|
pDeltaBetaCorrectedIsolation_=new TH1F( "deltaBetaCorrectedIsolation", "deltaBetaCorrectedIsolation", 120, 0, 2 );
|
89 |
|
|
pDeltaBetaCorrectedIsolation_->SetDirectory(pDirectory);
|
90 |
|
|
|
91 |
|
|
pRho25CorrectedIsolation_=new TH1F( "rho25CorrectedIsolation", "rho25CorrectedIsolation", 120, 0, 2 );
|
92 |
|
|
pRho25CorrectedIsolation_->SetDirectory(pDirectory);
|
93 |
|
|
|
94 |
grimes |
1.3 |
pThirdRho25CorrectedIsolation_=new TH1F( "thirdRho25CorrectedIsolation", "thirdRho25CorrectedIsolation", 120, 0, 2 );
|
95 |
|
|
pThirdRho25CorrectedIsolation_->SetDirectory(pDirectory);
|
96 |
|
|
|
97 |
|
|
pDeltaBetaCorrectedIsolationNoZeroing_=new TH1F( "deltaBetaCorrectedIsolationNoZeroing", "deltaBetaCorrectedIsolationNoZeroing", 120, -1, 1 );
|
98 |
|
|
pDeltaBetaCorrectedIsolationNoZeroing_->SetDirectory(pDirectory);
|
99 |
|
|
|
100 |
|
|
pRho25CorrectedIsolationNoZeroing_=new TH1F( "rho25CorrectedIsolationNoZeroing", "rho25CorrectedIsolationNoZeroing", 120, -1, 1 );
|
101 |
|
|
pRho25CorrectedIsolationNoZeroing_->SetDirectory(pDirectory);
|
102 |
|
|
|
103 |
|
|
pThirdRho25CorrectedIsolationNoZeroing_=new TH1F( "thirdRho25CorrectedIsolationNoZeroing", "thirdRho25CorrectedIsolationNoZeroing", 120, -1, 1 );
|
104 |
|
|
pThirdRho25CorrectedIsolationNoZeroing_->SetDirectory(pDirectory);
|
105 |
|
|
|
106 |
grimes |
1.2 |
if( createIsolationTree_ )
|
107 |
|
|
{
|
108 |
|
|
pIsolationTree_=new TTree("isolationTree","Data about the muon isolation");
|
109 |
|
|
pIsolationTree_->Branch("numberOfPrimaryVertices",&numberOfPrimaryVertices_branch_,"numberOfPrimaryVertices/I");
|
110 |
|
|
pIsolationTree_->Branch("chargedIsolation",&chargedIsolation_branch_,"chargedIsolation/F");
|
111 |
|
|
pIsolationTree_->Branch("photonIsolation",&photonIsolation_branch_,"photonIsolation/F");
|
112 |
|
|
pIsolationTree_->Branch("neutralIsolation",&neutralIsolation_branch_,"neutralIsolation/F");
|
113 |
|
|
pIsolationTree_->Branch("pileupIsolation",&pileupIsolation_branch_,"pileupIsolation/F");
|
114 |
|
|
pIsolationTree_->Branch("rho25",&rho25_branch_,"rho25/F");
|
115 |
|
|
pIsolationTree_->Branch("pT",&pT_branch_,"pT/F");
|
116 |
|
|
pIsolationTree_->SetDirectory( pDirectory );
|
117 |
|
|
}
|
118 |
grimes |
1.1 |
histogramHaveBeenBooked_=true;
|
119 |
|
|
}
|
120 |
|
|
|
121 |
grimes |
1.2 |
void trkupgradeanalysis::MuonInfoPlotSet::fill( const VHbbEvent::MuonInfo& muon, const VHbbEventAuxInfo* pAuxInfo )
|
122 |
grimes |
1.1 |
{
|
123 |
|
|
if( !histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::MuonInfoPlotSet::book() - histograms have not been booked" );
|
124 |
|
|
|
125 |
grimes |
1.2 |
// Get the additional info about the event if it's available
|
126 |
|
|
int numberOfPrimaryVertices=-1;
|
127 |
|
|
float rho25=-1;
|
128 |
|
|
if( pAuxInfo )
|
129 |
|
|
{
|
130 |
|
|
numberOfPrimaryVertices=pAuxInfo->pvInfo.nVertices;
|
131 |
|
|
rho25=pAuxInfo->puInfo.rho25;
|
132 |
|
|
}
|
133 |
|
|
|
134 |
grimes |
1.1 |
pGlobalChi2_->Fill( muon.globChi2 );
|
135 |
|
|
pNumberOfPixelHits_->Fill( muon.nPixelHits );
|
136 |
|
|
pNumberOfGlobalHits_->Fill( muon.globNHits );
|
137 |
|
|
pNumberOfHits_->Fill( muon.nHits );
|
138 |
|
|
pCategory_->Fill( muon.cat );
|
139 |
|
|
pNumberOfMatches_->Fill( muon.nMatches );
|
140 |
|
|
pIPDB_->Fill( muon.ipDb );
|
141 |
|
|
pEta_->Fill( muon.p4.Eta() );
|
142 |
grimes |
1.3 |
pPhi_->Fill( muon.p4.Phi() );
|
143 |
grimes |
1.1 |
pPt_->Fill( muon.p4.Pt() );
|
144 |
grimes |
1.2 |
pChargedIsolation_->Fill( muon.pfChaIso );
|
145 |
|
|
pPhotonIsolation_->Fill( muon.pfPhoIso );
|
146 |
|
|
pNeutralIsolation_->Fill( muon.pfNeuIso );
|
147 |
|
|
pPileupIsolation_->Fill( muon.pfChaPUIso );
|
148 |
|
|
pRelativeChargedIsolation_->Fill( muon.pfChaIso/muon.p4.Pt() );
|
149 |
|
|
pRelativePhotonIsolation_->Fill( muon.pfPhoIso/muon.p4.Pt() );
|
150 |
|
|
pRelativeNeutralIsolation_->Fill( muon.pfNeuIso/muon.p4.Pt() );
|
151 |
|
|
pRelativePileupIsolation_->Fill( muon.pfChaPUIso/muon.p4.Pt() );
|
152 |
|
|
pRelativeIsolation_->Fill( combinedRelativeIsolation(muon) );
|
153 |
|
|
pDeltaBetaCorrectedIsolation_->Fill( deltaBetaCorrectedIsolation(muon) );
|
154 |
grimes |
1.3 |
pDeltaBetaCorrectedIsolationNoZeroing_->Fill( deltaBetaCorrectedIsolationNoZeroing(muon) );
|
155 |
|
|
if( pAuxInfo )
|
156 |
|
|
{
|
157 |
|
|
// Don't bother filling if I couldn't get the rho25 info
|
158 |
|
|
pRho25CorrectedIsolation_->Fill( rho25CorrectedIsolation(muon,rho25) );
|
159 |
|
|
pRho25CorrectedIsolationNoZeroing_->Fill( rho25CorrectedIsolationNoZeroing(muon,rho25) );
|
160 |
|
|
pThirdRho25CorrectedIsolation_->Fill( thirdRho25CorrectedIsolation(muon,rho25) );
|
161 |
|
|
pThirdRho25CorrectedIsolationNoZeroing_->Fill( thirdRho25CorrectedIsolationNoZeroing(muon,rho25) );
|
162 |
|
|
}
|
163 |
grimes |
1.2 |
|
164 |
|
|
// If the TTree is not null then isolation data has been requested
|
165 |
|
|
if( pIsolationTree_ )
|
166 |
|
|
{
|
167 |
|
|
numberOfPrimaryVertices_branch_=numberOfPrimaryVertices;
|
168 |
|
|
chargedIsolation_branch_=muon.pfChaIso;
|
169 |
|
|
photonIsolation_branch_=muon.pfPhoIso;
|
170 |
|
|
neutralIsolation_branch_=muon.pfNeuIso;
|
171 |
|
|
pileupIsolation_branch_=muon.pfChaPUIso;
|
172 |
|
|
rho25_branch_=rho25;
|
173 |
|
|
pT_branch_=muon.p4.Pt();
|
174 |
|
|
|
175 |
|
|
pIsolationTree_->Fill();
|
176 |
|
|
}
|
177 |
grimes |
1.1 |
}
|
178 |
|
|
|
179 |
grimes |
1.2 |
|
180 |
|
|
float trkupgradeanalysis::MuonInfoPlotSet::combinedRelativeIsolation( const VHbbEvent::MuonInfo& muon )
|
181 |
|
|
{
|
182 |
|
|
return (muon.pfChaIso+muon.pfPhoIso+muon.pfNeuIso)/muon.p4.Pt();
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
float trkupgradeanalysis::MuonInfoPlotSet::deltaBetaCorrectedIsolation( const VHbbEvent::MuonInfo& muon, float deltaBetaFactor )
|
186 |
|
|
{
|
187 |
|
|
// deltaBetaFactor defaults to -0.5
|
188 |
|
|
float correctedNeutralIsolation=muon.pfPhoIso+muon.pfNeuIso+deltaBetaFactor*muon.pfChaPUIso;
|
189 |
|
|
if( correctedNeutralIsolation<0 ) correctedNeutralIsolation=muon.pfPhoIso+muon.pfNeuIso;
|
190 |
|
|
return (muon.pfChaIso+correctedNeutralIsolation)/muon.p4.Pt();
|
191 |
|
|
}
|
192 |
|
|
|
193 |
|
|
float trkupgradeanalysis::MuonInfoPlotSet::rho25CorrectedIsolation( const VHbbEvent::MuonInfo& muon, float rho25 )
|
194 |
|
|
{
|
195 |
|
|
float uncorrectedIsolation=combinedRelativeIsolation(muon);
|
196 |
grimes |
1.3 |
float correctedIsolation=uncorrectedIsolation-(0.4*0.4*M_PI*rho25)/muon.p4.Pt();
|
197 |
grimes |
1.2 |
if( correctedIsolation<0 ) correctedIsolation=0;
|
198 |
|
|
|
199 |
|
|
return correctedIsolation;
|
200 |
|
|
}
|
201 |
grimes |
1.3 |
|
202 |
|
|
float trkupgradeanalysis::MuonInfoPlotSet::thirdRho25CorrectedIsolation( const VHbbEvent::MuonInfo& muon, float rho25 )
|
203 |
|
|
{
|
204 |
|
|
float uncorrectedIsolation=combinedRelativeIsolation(muon);
|
205 |
|
|
float correctedIsolation=uncorrectedIsolation-(0.4*0.4*M_PI*rho25)/3.0/muon.p4.Pt();
|
206 |
|
|
if( correctedIsolation<0 ) correctedIsolation=0;
|
207 |
|
|
|
208 |
|
|
return correctedIsolation;
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
float trkupgradeanalysis::MuonInfoPlotSet::deltaBetaCorrectedIsolationNoZeroing( const VHbbEvent::MuonInfo& muon, float deltaBetaFactor )
|
212 |
|
|
{
|
213 |
|
|
// deltaBetaFactor defaults to -0.5
|
214 |
|
|
float correctedNeutralIsolation=muon.pfPhoIso+muon.pfNeuIso+deltaBetaFactor*muon.pfChaPUIso;
|
215 |
|
|
|
216 |
|
|
return (muon.pfChaIso+correctedNeutralIsolation)/muon.p4.Pt();
|
217 |
|
|
}
|
218 |
|
|
|
219 |
|
|
float trkupgradeanalysis::MuonInfoPlotSet::rho25CorrectedIsolationNoZeroing( const VHbbEvent::MuonInfo& muon, float rho25 )
|
220 |
|
|
{
|
221 |
|
|
float uncorrectedIsolation=combinedRelativeIsolation(muon);
|
222 |
|
|
float correctedIsolation=uncorrectedIsolation-(0.4*0.4*M_PI*rho25)/muon.p4.Pt();
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
return correctedIsolation;
|
226 |
|
|
}
|
227 |
|
|
|
228 |
|
|
float trkupgradeanalysis::MuonInfoPlotSet::thirdRho25CorrectedIsolationNoZeroing( const VHbbEvent::MuonInfo& muon, float rho25 )
|
229 |
|
|
{
|
230 |
|
|
float uncorrectedIsolation=combinedRelativeIsolation(muon);
|
231 |
|
|
float correctedIsolation=uncorrectedIsolation-(0.4*0.4*M_PI*rho25)/3.0/muon.p4.Pt();
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
return correctedIsolation;
|
235 |
|
|
}
|