1 |
#ifndef HISTOS_H
|
2 |
#define HISTOS_H
|
3 |
|
4 |
#include "VHbbAnalysis/VHbbDataFormats/interface/VHbbEvent.h"
|
5 |
#include "VHbbAnalysis/VHbbDataFormats/interface/VHbbCandidate.h"
|
6 |
#include "VHbbAnalysis/VHbbDataFormats/interface/VHbbProxy.h"
|
7 |
#include "VHbbAnalysis/VHbbDataFormats/interface/CutsAndHistos.h"
|
8 |
#include <TH1F.h>
|
9 |
#include "DataFormats/GeometryVector/interface/VectorUtil.h"
|
10 |
#include "DataFormats/Math/interface/deltaR.h"
|
11 |
#include <sstream>
|
12 |
#include "TKey.h"
|
13 |
#include "TMVA/Reader.h"
|
14 |
#include "TMVA/Config.h"
|
15 |
#include "TMVA/Tools.h"
|
16 |
#include "TMVA/MethodCuts.h"
|
17 |
|
18 |
class MCHistos : public Histos {
|
19 |
|
20 |
public:
|
21 |
|
22 |
virtual void book(TFile &f, std::string suffix) {
|
23 |
|
24 |
TDirectory *subDir;
|
25 |
|
26 |
if( ! f.GetDirectory(suffix.c_str()) )
|
27 |
subDir = f.mkdir(suffix.c_str());
|
28 |
else
|
29 |
subDir = f.GetDirectory(suffix.c_str());
|
30 |
|
31 |
subDir->cd();
|
32 |
|
33 |
bin_mass = 500;
|
34 |
min_mass = 0;
|
35 |
max_mass = 300;
|
36 |
|
37 |
bin_pt = 500;
|
38 |
min_pt = 0;
|
39 |
max_pt = 500;
|
40 |
|
41 |
bin_hel = 50;
|
42 |
min_hel = 0;
|
43 |
max_hel = 1;
|
44 |
|
45 |
//from MC
|
46 |
McH_simHMass = new TH1F(("simHiggsMass"+suffix).c_str(),("Sim Higgs Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
|
47 |
McH_simHPt = new TH1F(("simHiggsPt"+suffix).c_str(),("Sim Higgs Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
48 |
McH_simZMass = new TH1F(("simZMass"+suffix).c_str(),("Sim Z Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
|
49 |
McH_simZPt = new TH1F(("simZPt"+suffix).c_str(),("Sim Z Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
50 |
McH_simWMass = new TH1F(("simWMass"+suffix).c_str(),("Sim W Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
|
51 |
McH_simWPt = new TH1F(("simWPt"+suffix).c_str(),("Sim W Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
52 |
|
53 |
}
|
54 |
|
55 |
virtual void fill(VHbbProxy &iProxy,float w) {
|
56 |
|
57 |
const VHbbEvent *iEvent = iProxy.getVHbbEvent();
|
58 |
const VHbbEventAuxInfo *iAuxInfo = iProxy.getVHbbEventAuxInfo();
|
59 |
if(iAuxInfo)
|
60 |
{
|
61 |
//from MC
|
62 |
if (iAuxInfo->mcH.size()!=0)
|
63 |
McH_simHMass->Fill(iAuxInfo->mcH[0].p4.M(), w);
|
64 |
if (iAuxInfo->mcH.size()!=0)
|
65 |
McH_simHPt->Fill(iAuxInfo->mcH[0].p4.Pt(), w);
|
66 |
if (iAuxInfo->mcZ.size()!=0)
|
67 |
McH_simZMass->Fill(iAuxInfo->mcZ[0].p4.M(), w);
|
68 |
if (iAuxInfo->mcZ.size()!=0)
|
69 |
McH_simZPt->Fill(iAuxInfo->mcZ[0].p4.Pt(), w);
|
70 |
if (iAuxInfo->mcW.size()!=0)
|
71 |
McH_simWMass->Fill(iAuxInfo->mcW[0].p4.M(), w);
|
72 |
if (iAuxInfo->mcW.size()!=0)
|
73 |
McH_simWPt->Fill(iAuxInfo->mcW[0].p4.Pt(), w);
|
74 |
}
|
75 |
}
|
76 |
|
77 |
|
78 |
TH1F * McH_simHMass;
|
79 |
TH1F * McH_simHPt;
|
80 |
TH1F * McH_simWMass;
|
81 |
TH1F * McH_simWPt;
|
82 |
TH1F * McH_simZMass;
|
83 |
TH1F * McH_simZPt;
|
84 |
|
85 |
private:
|
86 |
|
87 |
Int_t bin_mass;
|
88 |
Double_t min_mass;
|
89 |
Double_t max_mass;
|
90 |
|
91 |
Int_t bin_pt;
|
92 |
Double_t min_pt;
|
93 |
Double_t max_pt;
|
94 |
|
95 |
Int_t bin_hel;
|
96 |
Double_t min_hel;
|
97 |
Double_t max_hel;
|
98 |
|
99 |
|
100 |
};
|
101 |
|
102 |
|
103 |
class BTagHistos : public Histos {
|
104 |
|
105 |
public:
|
106 |
|
107 |
virtual void book(TFile &f, std::string suffix) {
|
108 |
|
109 |
TDirectory *subDir;
|
110 |
if( ! f.GetDirectory(suffix.c_str()) )
|
111 |
subDir = f.mkdir(suffix.c_str());
|
112 |
else
|
113 |
subDir = f.GetDirectory(suffix.c_str());
|
114 |
subDir->cd();
|
115 |
|
116 |
bin_btag_prob = 20;
|
117 |
min_btag_prob = 0;
|
118 |
max_btag_prob = 1;
|
119 |
|
120 |
bin_btag_count = 10;
|
121 |
min_btag_count = 0;
|
122 |
max_btag_count = 10;
|
123 |
|
124 |
//Candidates
|
125 |
BTagH_bJet1_csv = new TH1F(("BJet1_CSV"+suffix).c_str(),("BJet1 CSV ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
126 |
BTagH_bJet2_csv = new TH1F(("BJet2_CSV"+suffix).c_str(),("BJet2 CSV ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
127 |
BTagH_bJet1_csvmva = new TH1F(("BJet1_CSVMVA"+suffix).c_str(),("BJet1 CSVMVA ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
128 |
BTagH_bJet2_csvmva = new TH1F(("BJet2_CSVMVA"+suffix).c_str(),("BJet2 CSVMVA ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
129 |
BTagH_bJet1_ssvhe = new TH1F(("BJet1_SSVHE"+suffix).c_str(),("BJet1 SSVHE ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
130 |
BTagH_bJet2_ssvhe = new TH1F(("BJet2_SSVHE"+suffix).c_str(),("BJet2 SSVHE ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
131 |
BTagH_bJet1_jpb = new TH1F(("BJet1_JPB"+suffix).c_str(),("BJet1 JPB ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
132 |
BTagH_bJet2_jpb = new TH1F(("BJet2_JPB"+suffix).c_str(),("BJet2 JPB ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
133 |
BTagH_bJet1_tche = new TH1F(("BJet1_TCHE"+suffix).c_str(),("BJet1 TCHE ("+suffix+")").c_str(), bin_btag_count, min_btag_count, max_btag_count );
|
134 |
BTagH_bJet2_tche = new TH1F(("BJet2_TCHE"+suffix).c_str(),("BJet2 TCHE ("+suffix+")").c_str(), bin_btag_count, min_btag_count, max_btag_count );
|
135 |
BTagH_bJet1_jp = new TH1F(("BJet1_JP"+suffix).c_str(),("BJet1 JP ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
136 |
BTagH_bJet2_jp = new TH1F(("BJet2_JP"+suffix).c_str(),("BJet2 JP ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
|
137 |
BTagH_bJet1_tchp = new TH1F(("BJet1_TCHP"+suffix).c_str(),("BJet1 TCHP ("+suffix+")").c_str(), bin_btag_count, min_btag_count, max_btag_count );
|
138 |
BTagH_bJet2_tchp = new TH1F(("BJet2_TCHP"+suffix).c_str(),("BJet2 TCHP ("+suffix+")").c_str(), bin_btag_count, min_btag_count, max_btag_count );
|
139 |
|
140 |
}
|
141 |
|
142 |
virtual void fill(VHbbProxy &iProxy,float w) {
|
143 |
|
144 |
const VHbbEvent *iEvent = iProxy.getVHbbEvent();
|
145 |
const std::vector<VHbbCandidate> *iCand = iProxy.getVHbbCandidate();
|
146 |
|
147 |
//Candidates
|
148 |
if(iCand->size() > 0){
|
149 |
VHbbCandidate::CandidateType iCandType = iCand->at(0).candidateType;
|
150 |
VHbbCandidate::HiggsCandidate H = iCand->at(0).H;
|
151 |
|
152 |
BTagH_bJet1_csv->Fill(H.jets.at(0).csv, w);
|
153 |
BTagH_bJet2_csv->Fill(H.jets.at(1).csv, w);
|
154 |
BTagH_bJet1_csvmva->Fill(H.jets.at(0).csvmva, w);
|
155 |
BTagH_bJet2_csvmva->Fill(H.jets.at(1).csvmva, w);
|
156 |
BTagH_bJet1_ssvhe->Fill(H.jets.at(0).ssvhe, w);
|
157 |
BTagH_bJet2_ssvhe->Fill(H.jets.at(1).ssvhe, w);
|
158 |
BTagH_bJet1_tche->Fill(H.jets.at(0).tche, w);
|
159 |
BTagH_bJet2_tche->Fill(H.jets.at(1).tche, w);
|
160 |
BTagH_bJet1_tchp->Fill(H.jets.at(0).tchp, w);
|
161 |
BTagH_bJet2_tchp->Fill(H.jets.at(1).tchp, w);
|
162 |
BTagH_bJet1_jpb->Fill(H.jets.at(0).jpb, w);
|
163 |
BTagH_bJet2_jpb->Fill(H.jets.at(1).jpb, w);
|
164 |
BTagH_bJet1_jp->Fill(H.jets.at(0).jp, w);
|
165 |
BTagH_bJet2_jp->Fill(H.jets.at(1).jp, w);
|
166 |
|
167 |
}
|
168 |
}
|
169 |
|
170 |
TH1F * BTagH_bJet1_csv;
|
171 |
TH1F * BTagH_bJet2_csv;
|
172 |
TH1F * BTagH_bJet1_csvmva;
|
173 |
TH1F * BTagH_bJet2_csvmva;
|
174 |
TH1F * BTagH_bJet1_ssvhe;
|
175 |
TH1F * BTagH_bJet2_ssvhe;
|
176 |
TH1F * BTagH_bJet1_jpb;
|
177 |
TH1F * BTagH_bJet2_jpb;
|
178 |
TH1F * BTagH_bJet1_tche;
|
179 |
TH1F * BTagH_bJet2_tche;
|
180 |
TH1F * BTagH_bJet1_jp;
|
181 |
TH1F * BTagH_bJet2_jp;
|
182 |
TH1F * BTagH_bJet1_tchp;
|
183 |
TH1F * BTagH_bJet2_tchp;
|
184 |
|
185 |
private:
|
186 |
|
187 |
Int_t bin_btag_prob;
|
188 |
Double_t min_btag_prob;
|
189 |
Double_t max_btag_prob;
|
190 |
|
191 |
Int_t bin_btag_count;
|
192 |
Double_t min_btag_count;
|
193 |
Double_t max_btag_count;
|
194 |
|
195 |
};
|
196 |
|
197 |
|
198 |
class CountHisto : public Histos {
|
199 |
virtual void book(TFile &f, std::string suffix) {
|
200 |
|
201 |
TDirectory *subDir;
|
202 |
if( ! f.GetDirectory(suffix.c_str()) )
|
203 |
subDir = f.mkdir(suffix.c_str());
|
204 |
else
|
205 |
subDir = f.GetDirectory(suffix.c_str());
|
206 |
subDir->cd();
|
207 |
count = new TH1F(("Count"+suffix).c_str(),("Count ("+suffix+")").c_str(), 1,0,2 );
|
208 |
|
209 |
}
|
210 |
virtual void fill(VHbbProxy &iProxy,float w) {
|
211 |
count->Fill(1,w);
|
212 |
}
|
213 |
|
214 |
TH1F * count;
|
215 |
};
|
216 |
|
217 |
|
218 |
class StandardHistos : public Histos {
|
219 |
|
220 |
public:
|
221 |
|
222 |
virtual void book(TFile &f, std::string suffix) {
|
223 |
|
224 |
TDirectory *subDir;
|
225 |
if( ! f.GetDirectory(suffix.c_str()) )
|
226 |
subDir = f.mkdir(suffix.c_str());
|
227 |
else
|
228 |
subDir = f.GetDirectory(suffix.c_str());
|
229 |
subDir->cd();
|
230 |
|
231 |
bin_mass = 500;
|
232 |
min_mass = 0;
|
233 |
max_mass = 300;
|
234 |
|
235 |
bin_pt = 500;
|
236 |
min_pt = 0;
|
237 |
max_pt = 500;
|
238 |
|
239 |
bin_hel = 50;
|
240 |
min_hel = 0;
|
241 |
max_hel = 1;
|
242 |
|
243 |
bin_btag = 20;
|
244 |
min_btag = 0;
|
245 |
max_btag = 1;
|
246 |
|
247 |
bin_deltaR = bin_deltaPhi = bin_deltaEta = 20;
|
248 |
min_deltaR = min_deltaPhi = min_deltaEta = 0;
|
249 |
max_deltaR = max_deltaPhi = max_deltaEta = 5;
|
250 |
|
251 |
//Candidates
|
252 |
StH_simpleJet1_pt = new TH1F(("SimpleJet1_pt"+suffix).c_str(),("Simple Jet1 pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
253 |
StH_simpleJet2_pt = new TH1F(("SimpleJet2_pt"+suffix).c_str(),("Simple Jet2 pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
254 |
StH_simpleJet1_bTag = new TH1F(("SimpleJet1_bTag"+suffix).c_str(),("Simple Jet1 bTag ("+suffix+")").c_str(), bin_btag, min_btag, max_btag );
|
255 |
StH_simpleJet2_bTag = new TH1F(("SimpleJet2_bTag"+suffix).c_str(),("Simple Jet2 bTag ("+suffix+")").c_str(), bin_btag, min_btag, max_btag );
|
256 |
StH_simpleJets_dR = new TH1F(("SimpleJets_dR"+suffix).c_str(),("Simple Jets deltaR ("+suffix+")").c_str(), bin_deltaR, min_deltaR, max_deltaR );
|
257 |
StH_simpleJets_dPhi = new TH1F(("SimpleJets_dPhi"+suffix).c_str(),("Simple Jets deltaPhi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
|
258 |
StH_simpleJets_dEta = new TH1F(("SimpleJets_dEta"+suffix).c_str(),("Simple Jets deltaEta ("+suffix+")").c_str(), bin_deltaEta, min_deltaEta, max_deltaEta );
|
259 |
|
260 |
StH_HMass = new TH1F(("HiggsMass"+suffix).c_str(),(" Higgs Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
|
261 |
StH_HPt = new TH1F(("HiggsPt"+suffix).c_str(),(" Higgs Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
262 |
StH_HHel = new TH1F(("HiggsHel"+suffix).c_str(),("Higgs helicity angle ("+suffix+")").c_str(), bin_hel, min_hel, max_hel );
|
263 |
StH_HPullAngle = new TH1F(("HiggsPullAngle"+suffix).c_str(),("Higgs pull angle ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
|
264 |
|
265 |
StH_ZMass = new TH1F(("ZMass"+suffix).c_str(),(" Z Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
|
266 |
StH_ZPt = new TH1F(("ZPt"+suffix).c_str(),(" Z Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
267 |
StH_ZH_dPhi = new TH1F(("ZH_dPhi"+suffix).c_str(),(" ZH delta Phi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
|
268 |
|
269 |
StH_WMass = new TH1F(("WMass"+suffix).c_str(),(" W Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
|
270 |
StH_WPt = new TH1F(("WPt"+suffix).c_str(),(" W Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
271 |
StH_WH_dPhi = new TH1F(("WH_dPhi"+suffix).c_str(),(" WH delta Phi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
|
272 |
|
273 |
}
|
274 |
|
275 |
virtual void fill(VHbbProxy &iProxy,float w) {
|
276 |
|
277 |
const VHbbEvent *iEvent = iProxy.getVHbbEvent();
|
278 |
const std::vector<VHbbCandidate> *iCand = iProxy.getVHbbCandidate();
|
279 |
|
280 |
//Candidates
|
281 |
if(iCand->size() > 0){
|
282 |
VHbbCandidate::CandidateType iCandType = iCand->at(0).candidateType;
|
283 |
VHbbCandidate::HiggsCandidate H = iCand->at(0).H;
|
284 |
VHbbCandidate::VectorCandidate V = iCand->at(0).V;
|
285 |
|
286 |
StH_simpleJet1_pt->Fill(H.jets.at(0).p4.Pt(), w);
|
287 |
StH_simpleJet2_pt->Fill(H.jets.at(1).p4.Pt(), w);
|
288 |
StH_simpleJet1_bTag->Fill(H.jets.at(0).csv, w);
|
289 |
StH_simpleJet2_bTag->Fill(H.jets.at(1).csv, w);
|
290 |
StH_simpleJets_dR->Fill(H.jets.at(0).p4.DeltaR(H.jets.at(1).p4), w);
|
291 |
StH_simpleJets_dPhi->Fill(H.jets.at(0).p4.DeltaPhi(H.jets.at(1).p4), w);
|
292 |
StH_simpleJets_dEta->Fill(TMath::Abs(H.jets.at(0).p4.Eta()-H.jets.at(1).p4.Eta()), w);
|
293 |
|
294 |
StH_HMass->Fill(H.p4.M(), w);
|
295 |
StH_HPt->Fill(H.p4.Pt(), w);
|
296 |
// StH_HHel->Fill(H.hel(), w);
|
297 |
StH_HPullAngle->Fill(H.deltaTheta, w);
|
298 |
|
299 |
if( iCandType == VHbbCandidate::Zmumu || iCandType == VHbbCandidate::Zee || iCandType == VHbbCandidate::Znn ){
|
300 |
StH_ZMass->Fill(V.p4.M(), w);
|
301 |
StH_ZPt->Fill(V.p4.Pt(), w);
|
302 |
StH_ZH_dPhi->Fill(V.p4.DeltaPhi(H.p4.Phi()), w);
|
303 |
}
|
304 |
else if(iCandType == VHbbCandidate::Wen || iCandType == VHbbCandidate::Wmun){
|
305 |
StH_WMass->Fill(V.Mt(iCandType), w);
|
306 |
//StH_WMass->Fill(V.p4.M(), w);
|
307 |
StH_WPt->Fill(V.p4.Pt(), w);
|
308 |
StH_WH_dPhi->Fill(V.p4.DeltaPhi(H.p4.Phi()), w);
|
309 |
}
|
310 |
|
311 |
}
|
312 |
}
|
313 |
|
314 |
TH1F * StH_simpleJet1_pt;
|
315 |
TH1F * StH_simpleJet2_pt;
|
316 |
TH1F * StH_simpleJet1_bTag;
|
317 |
TH1F * StH_simpleJet2_bTag;
|
318 |
TH1F * StH_simpleJets_dR;
|
319 |
TH1F * StH_simpleJets_dPhi;
|
320 |
TH1F * StH_simpleJets_dEta;
|
321 |
|
322 |
TH1F * StH_HMass;
|
323 |
TH1F * StH_HPt;
|
324 |
TH1F * StH_HHel;
|
325 |
TH1F * StH_HPullAngle;
|
326 |
TH1F * StH_WMass;
|
327 |
TH1F * StH_WPt;
|
328 |
TH1F * StH_WH_dPhi;
|
329 |
TH1F * StH_ZMass;
|
330 |
TH1F * StH_ZPt;
|
331 |
TH1F * StH_ZH_dPhi;
|
332 |
|
333 |
private:
|
334 |
|
335 |
Int_t bin_btag;
|
336 |
Double_t min_btag;
|
337 |
Double_t max_btag;
|
338 |
|
339 |
Int_t bin_deltaEta;
|
340 |
Double_t min_deltaEta;
|
341 |
Double_t max_deltaEta;
|
342 |
|
343 |
Int_t bin_deltaPhi;
|
344 |
Double_t min_deltaPhi;
|
345 |
Double_t max_deltaPhi;
|
346 |
|
347 |
Int_t bin_deltaR;
|
348 |
Double_t min_deltaR;
|
349 |
Double_t max_deltaR;
|
350 |
|
351 |
Int_t bin_mass;
|
352 |
Double_t min_mass;
|
353 |
Double_t max_mass;
|
354 |
|
355 |
Int_t bin_pt;
|
356 |
Double_t min_pt;
|
357 |
Double_t max_pt;
|
358 |
|
359 |
Int_t bin_hel;
|
360 |
Double_t min_hel;
|
361 |
Double_t max_hel;
|
362 |
|
363 |
};
|
364 |
|
365 |
|
366 |
class MVAHistos : public Histos {
|
367 |
|
368 |
public:
|
369 |
MVAHistos( const std::string &channel_):
|
370 |
channel(channel_) {}
|
371 |
|
372 |
virtual void book(TFile &f, std::string suffix) {
|
373 |
|
374 |
// std::clog << "Start booking" << std::endl;
|
375 |
|
376 |
TDirectory *subDir;
|
377 |
if( ! f.GetDirectory(suffix.c_str()) )
|
378 |
subDir = f.mkdir(suffix.c_str());
|
379 |
else
|
380 |
subDir = f.GetDirectory(suffix.c_str());
|
381 |
subDir->cd();
|
382 |
|
383 |
bin_BDT = 100;
|
384 |
min_BDT = -0.8;
|
385 |
max_BDT = 0.8;
|
386 |
|
387 |
MVAH_BDT = new TH1F(("BDT"+suffix).c_str(),(" BDT output ("+suffix+")").c_str(), bin_BDT, min_BDT, max_BDT );
|
388 |
|
389 |
}
|
390 |
|
391 |
virtual void fill(VHbbProxy &iProxy,float w) {
|
392 |
|
393 |
// std::clog << "Start filling" << std::endl;
|
394 |
|
395 |
const VHbbEvent *iEvent = iProxy.getVHbbEvent();
|
396 |
const std::vector<VHbbCandidate> *iCand = iProxy.getVHbbCandidate();
|
397 |
|
398 |
TMVA::Reader * reader = new TMVA::Reader();
|
399 |
|
400 |
float bbMass,bbPt,btag1,btag2,NaddJet,DeltaRbb,helicity,DeltaPhiVH,bPt1,bPt2,VMass,VPt,pullAngle,DeltaEtabb,deltaPhipfMETjet1,deltaPhipfMETjet2,pfMET,pfMETsig;
|
401 |
|
402 |
if(channel == "Zmm"){
|
403 |
reader->AddVariable( "bbMass", &bbMass );
|
404 |
reader->AddVariable( "VMass", &VMass );
|
405 |
reader->AddVariable( "bbPt", &bbPt );
|
406 |
reader->AddVariable( "VPt", &VPt );
|
407 |
reader->AddVariable( "btag1", &btag1 );
|
408 |
reader->AddVariable( "btag2", &btag2 );
|
409 |
reader->AddVariable( "DeltaPhiVH", &DeltaPhiVH);
|
410 |
reader->AddVariable( "DeltaEtabb", &DeltaEtabb);
|
411 |
}
|
412 |
else if(channel == "Zee"){
|
413 |
reader->AddVariable( "bbMass", &bbMass );
|
414 |
reader->AddVariable( "VMass", &VMass );
|
415 |
reader->AddVariable( "bbPt", &bbPt );
|
416 |
reader->AddVariable( "VPt", &VPt );
|
417 |
reader->AddVariable( "btag1", &btag1 );
|
418 |
reader->AddVariable( "btag2", &btag2 );
|
419 |
reader->AddVariable( "DeltaPhiVH", &DeltaPhiVH);
|
420 |
reader->AddVariable( "DeltaEtabb", &DeltaEtabb);
|
421 |
}
|
422 |
else if(channel == "Znn"){
|
423 |
reader->AddVariable( "bbMass", &bbMass );
|
424 |
reader->AddVariable( "bbPt", &bbPt );
|
425 |
reader->AddVariable( "pfMET", &pfMET );
|
426 |
reader->AddVariable( "btag1", &btag1 );
|
427 |
reader->AddVariable( "btag2", &btag2 );
|
428 |
reader->AddVariable( "DeltaPhiVH", &DeltaPhiVH);
|
429 |
}
|
430 |
else if(channel == "We"){
|
431 |
reader->AddVariable( "bbMass", &bbMass );
|
432 |
reader->AddVariable( "bbPt", &bbPt );
|
433 |
reader->AddVariable( "VPt", &VPt );
|
434 |
reader->AddVariable( "btag1", &btag1 );
|
435 |
reader->AddVariable( "btag2", &btag2 );
|
436 |
reader->AddVariable( "DeltaPhiVH", &DeltaPhiVH);
|
437 |
reader->AddVariable( "DeltaEtabb", &DeltaEtabb);
|
438 |
}
|
439 |
else if(channel == "Wm"){
|
440 |
reader->AddVariable( "bbMass", &bbMass );
|
441 |
reader->AddVariable( "bbPt", &bbPt );
|
442 |
reader->AddVariable( "VPt", &VPt );
|
443 |
reader->AddVariable( "btag1", &btag1 );
|
444 |
reader->AddVariable( "btag2", &btag2 );
|
445 |
reader->AddVariable( "DeltaPhiVH", &DeltaPhiVH);
|
446 |
reader->AddVariable( "DeltaEtabb", &DeltaEtabb);
|
447 |
}
|
448 |
|
449 |
// --- Book the MVA methods
|
450 |
|
451 |
std::vector<std::string> methods;
|
452 |
methods.push_back("BDT");
|
453 |
TString dir = "weights/";
|
454 |
TString prefix = "TMVAClassification";
|
455 |
// std::clog << "Booking MVA method..." << std::endl;
|
456 |
for (size_t it = 0; it < methods.size(); ++it) {
|
457 |
TString methodName = methods.at(it)+ " method";
|
458 |
TString weightfile = dir + prefix + "_" + methods.at(it) + "." + channel + TString("_weight.xml");
|
459 |
reader->BookMVA( methodName, weightfile );
|
460 |
}
|
461 |
|
462 |
//Candidates
|
463 |
if(iCand->size() > 0 and iCand->at(0).H.jets.size() > 1){
|
464 |
VHbbCandidate::CandidateType iCandType = iCand->at(0).candidateType;
|
465 |
VHbbCandidate::HiggsCandidate H = iCand->at(0).H;
|
466 |
VHbbCandidate::VectorCandidate V = iCand->at(0).V;
|
467 |
|
468 |
bbMass = iCand->at(0).H.p4.M();
|
469 |
bbPt = iCand->at(0).H.p4.Pt();
|
470 |
btag1 = iCand->at(0).H.jets[0].csv;
|
471 |
btag2 = iCand->at(0).H.jets[1].csv;
|
472 |
NaddJet = iCand->at(0).additionalJets.size();
|
473 |
DeltaRbb = deltaR(iCand->at(0).H.jets[0].p4.Eta(),iCand->at(0).H.jets[0].p4.Phi(),iCand->at(0).H.jets[1].p4.Eta(),iCand->at(0).H.jets[1].p4.Phi());
|
474 |
helicity = iCand->at(0).H.helicities[0];
|
475 |
DeltaPhiVH = Geom::deltaPhi(iCand->at(0).H.p4.Phi(),iCand->at(0).V.p4.Phi()) ;
|
476 |
bPt1 = iCand->at(0).H.jets[0].p4.Pt();
|
477 |
bPt2 = iCand->at(0).H.jets[1].p4.Pt();
|
478 |
VMass = iCand->at(0).V.p4.M();
|
479 |
VPt = iCand->at(0).V.p4.Pt();
|
480 |
pullAngle = iCand->at(0).H.deltaTheta;
|
481 |
DeltaEtabb = TMath::Abs( iCand->at(0).H.jets[0].p4.Eta() - iCand->at(0).H.jets[1].p4.Eta() );
|
482 |
deltaPhipfMETjet1 = Geom::deltaPhi( iCand->at(0).V.mets.at(0).p4.Phi(), iCand->at(0).H.jets[0].p4.Phi() );
|
483 |
deltaPhipfMETjet2 = Geom::deltaPhi( iCand->at(0).V.mets.at(0).p4.Phi(), iCand->at(0).H.jets[1].p4.Phi() );
|
484 |
pfMET = iCand->at(0).V.mets.at(0).p4.Pt();
|
485 |
pfMETsig = iCand->at(0).V.mets.at(0).metSig;
|
486 |
|
487 |
|
488 |
MVAH_BDT->Fill( reader->EvaluateMVA( "BDT method" ) );
|
489 |
|
490 |
}
|
491 |
}
|
492 |
|
493 |
TH1F * MVAH_BDT;
|
494 |
|
495 |
private:
|
496 |
|
497 |
const std::string &channel;
|
498 |
Int_t bin_BDT;
|
499 |
Double_t min_BDT;
|
500 |
Double_t max_BDT;
|
501 |
|
502 |
};
|
503 |
|
504 |
|
505 |
class HardJetHistos : public Histos {
|
506 |
|
507 |
public:
|
508 |
|
509 |
virtual void book(TFile &f, std::string suffix) {
|
510 |
|
511 |
TDirectory *subDir;
|
512 |
if( ! f.GetDirectory(suffix.c_str()) )
|
513 |
subDir = f.mkdir(suffix.c_str());
|
514 |
else
|
515 |
subDir = f.GetDirectory(suffix.c_str());
|
516 |
subDir->cd();
|
517 |
|
518 |
bin_mass = 500;
|
519 |
min_mass = 0;
|
520 |
max_mass = 300;
|
521 |
|
522 |
bin_pt = 500;
|
523 |
min_pt = 0;
|
524 |
max_pt = 500;
|
525 |
|
526 |
bin_hel = 50;
|
527 |
min_hel = 0;
|
528 |
max_hel = 1;
|
529 |
|
530 |
bin_btag = 20;
|
531 |
min_btag = 0;
|
532 |
max_btag = 1;
|
533 |
|
534 |
bin_deltaR = bin_deltaPhi = bin_deltaEta = 20;
|
535 |
min_deltaR = min_deltaPhi = min_deltaEta = 0;
|
536 |
max_deltaR = max_deltaPhi = max_deltaEta = 5;
|
537 |
|
538 |
//Candidates
|
539 |
|
540 |
HardJetH_subJet1_pt = new TH1F(("SubJet1_pt"+suffix).c_str(),("Sub Jet1 pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
541 |
HardJetH_subJet2_pt = new TH1F(("SubJet2_pt"+suffix).c_str(),("Sub Jet2 pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
542 |
HardJetH_subJet1_bTag = new TH1F(("SubJet1_bTag"+suffix).c_str(),("Sub Jet1 bTag ("+suffix+")").c_str(), bin_btag, min_btag, max_btag );
|
543 |
HardJetH_subJet2_bTag = new TH1F(("SubJet2_bTag"+suffix).c_str(),("Sub Jet2 bTag ("+suffix+")").c_str(), bin_btag, min_btag, max_btag );
|
544 |
HardJetH_subJets_dR = new TH1F(("SubJets_dR"+suffix).c_str(),("Sub Jets deltaR ("+suffix+")").c_str(), bin_deltaR, min_deltaR, max_deltaR );
|
545 |
HardJetH_subJets_dPhi = new TH1F(("SubJets_dPhi"+suffix).c_str(),("Sub Jets deltaPhi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
|
546 |
HardJetH_subJets_dEta = new TH1F(("SubJets_dEta"+suffix).c_str(),("Sub Jets deltaEta ("+suffix+")").c_str(), bin_deltaEta, min_deltaEta, max_deltaEta );
|
547 |
|
548 |
HardJetH_HMass = new TH1F(("HiggsMass"+suffix).c_str(),(" Higgs Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
|
549 |
HardJetH_HPt = new TH1F(("HiggsPt"+suffix).c_str(),(" Higgs Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
550 |
HardJetH_HHel = new TH1F(("HiggsHel"+suffix).c_str(),("Higgs helicity angle ("+suffix+")").c_str(), bin_hel, min_hel, max_hel );
|
551 |
|
552 |
HardJetH_ZMass = new TH1F(("ZMass"+suffix).c_str(),(" Z Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
|
553 |
HardJetH_ZPt = new TH1F(("ZPt"+suffix).c_str(),(" Z Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
554 |
HardJetH_ZH_dPhi = new TH1F(("ZH_dPhi"+suffix).c_str(),(" ZH delta Phi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
|
555 |
|
556 |
HardJetH_WMass = new TH1F(("WMass"+suffix).c_str(),(" W Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
|
557 |
HardJetH_WPt = new TH1F(("WPt"+suffix).c_str(),(" W Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
|
558 |
HardJetH_WH_dPhi = new TH1F(("WH_dPhi"+suffix).c_str(),(" WH delta Phi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
|
559 |
|
560 |
}
|
561 |
|
562 |
virtual void fill(VHbbProxy &iProxy,float w) {
|
563 |
|
564 |
const VHbbEvent *iEvent = iProxy.getVHbbEvent();
|
565 |
if(iEvent)
|
566 |
{ const std::vector<VHbbCandidate> *iCand = iProxy.getVHbbCandidate();
|
567 |
|
568 |
//Candidates
|
569 |
if(iCand->size() > 0){
|
570 |
VHbbCandidate::CandidateType iCandType = iCand->at(0).candidateType;
|
571 |
VHbbCandidate::HiggsCandidate H = iCand->at(0).H;
|
572 |
VHbbCandidate::VectorCandidate V = iCand->at(0).V;
|
573 |
std::vector<VHbbEvent::HardJet> iHardJets = iEvent->hardJets;
|
574 |
VHbbEvent::HardJet iHardJet = iHardJets.at(0);
|
575 |
|
576 |
HardJetH_subJet1_pt->Fill(iHardJet.subFourMomentum.at(0).Pt(), w);
|
577 |
HardJetH_subJet2_pt->Fill(iHardJet.subFourMomentum.at(1).Pt(), w);
|
578 |
//SubJet information on btag missing
|
579 |
// HardJetH_subJet1_bTag->Fill(iHardJet.at(0).csv, w);
|
580 |
// HardJetH_subJet2_bTag->Fill(iHardJet.at(1).csv, w);
|
581 |
HardJetH_subJets_dR->Fill(iHardJet.subFourMomentum.at(0).DeltaR(iHardJet.subFourMomentum.at(1)), w);
|
582 |
HardJetH_subJets_dPhi->Fill(iHardJet.subFourMomentum.at(0).DeltaPhi(iHardJet.subFourMomentum.at(1)), w);
|
583 |
HardJetH_subJets_dEta->Fill(TMath::Abs(iHardJet.subFourMomentum.at(0).Eta()-iHardJet.subFourMomentum.at(1).Eta()), w);
|
584 |
|
585 |
//Here there should be the higgs candidate from HardJet
|
586 |
// HardJetH_HMass->Fill(H.p4.M(), w);
|
587 |
// HardJetH_HPt->Fill(H.p4.Pt(), w);
|
588 |
// // HardJetH_HHel->Fill(H.hel(), w);
|
589 |
// if( iCandType == VHbbCandidate::Zmumu || iCandType == VHbbCandidate::Zee || iCandType == VHbbCandidate::Znn ){
|
590 |
// HardJetH_ZMass->Fill(V.p4.M(), w);
|
591 |
// HardJetH_ZPt->Fill(V.p4.Pt(), w);
|
592 |
// HardJetH_ZH_dPhi->Fill(V.p4.DeltaPhi(H.p4.Phi()), w);
|
593 |
// }
|
594 |
// else if(iCandType == VHbbCandidate::Wen || iCandType == VHbbCandidate::Wmun){
|
595 |
// HardJetH_WMass->Fill(V.p4.M(), w);
|
596 |
// HardJetH_WPt->Fill(V.p4.Pt(), w);
|
597 |
// HardJetH_WH_dPhi->Fill(V.p4.DeltaPhi(H.p4.Phi()), w);
|
598 |
// }
|
599 |
}
|
600 |
}
|
601 |
}
|
602 |
|
603 |
TH1F * HardJetH_subJet1_pt;
|
604 |
TH1F * HardJetH_subJet2_pt;
|
605 |
TH1F * HardJetH_subJet1_bTag;
|
606 |
TH1F * HardJetH_subJet2_bTag;
|
607 |
TH1F * HardJetH_subJets_dR;
|
608 |
TH1F * HardJetH_subJets_dPhi;
|
609 |
TH1F * HardJetH_subJets_dEta;
|
610 |
|
611 |
TH1F * HardJetH_HMass;
|
612 |
TH1F * HardJetH_HPt;
|
613 |
TH1F * HardJetH_HHel;
|
614 |
TH1F * HardJetH_WMass;
|
615 |
TH1F * HardJetH_WPt;
|
616 |
TH1F * HardJetH_WH_dPhi;
|
617 |
TH1F * HardJetH_ZMass;
|
618 |
TH1F * HardJetH_ZPt;
|
619 |
TH1F * HardJetH_ZH_dPhi;
|
620 |
|
621 |
private:
|
622 |
|
623 |
Int_t bin_btag;
|
624 |
Double_t min_btag;
|
625 |
Double_t max_btag;
|
626 |
|
627 |
Int_t bin_deltaEta;
|
628 |
Double_t min_deltaEta;
|
629 |
Double_t max_deltaEta;
|
630 |
|
631 |
Int_t bin_deltaPhi;
|
632 |
Double_t min_deltaPhi;
|
633 |
Double_t max_deltaPhi;
|
634 |
|
635 |
Int_t bin_deltaR;
|
636 |
Double_t min_deltaR;
|
637 |
Double_t max_deltaR;
|
638 |
|
639 |
Int_t bin_mass;
|
640 |
Double_t min_mass;
|
641 |
Double_t max_mass;
|
642 |
|
643 |
Int_t bin_pt;
|
644 |
Double_t min_pt;
|
645 |
Double_t max_pt;
|
646 |
|
647 |
Int_t bin_hel;
|
648 |
Double_t min_hel;
|
649 |
Double_t max_hel;
|
650 |
|
651 |
};
|
652 |
|
653 |
|
654 |
#endif
|