ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbbAnalysis/VHbbDataFormats/src/CutsAndHistos.cc
Revision: 1.8
Committed: Tue Aug 9 09:35:47 2011 UTC (13 years, 8 months ago) by arizzi
Content type: text/plain
Branch: MAIN
CVS Tags: AndreaAug10th
Changes since 1.7: +2 -2 lines
Log Message:
add methods for transverse mass computation

File Contents

# User Rev Content
1 tboccali 1.1 #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbEvent.h"
2     #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbCandidate.h"
3     #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbProxy.h"
4     #include "VHbbAnalysis/VHbbDataFormats/interface/CutsAndHistos.h"
5     #include <TH1F.h>
6     #include "DataFormats/GeometryVector/interface/VectorUtil.h"
7     #include <sstream>
8     #include "TKey.h"
9    
10     //class LeptonSelection : public Cut
11    
12 bortigno 1.2 class mcHPtCut : public Cut {
13 tboccali 1.1 public:
14 bortigno 1.2 mcHPtCut(Double_t mcHPtCutMin_):
15     mcHPtCutMin(mcHPtCutMin_) {}
16     mcHPtCut(Double_t mcHPtCutMin_, Double_t mcHPtCutMax_):
17     mcHPtCutMin(mcHPtCutMin_),
18     mcHPtCutMax(mcHPtCutMax_) {}
19 tboccali 1.1 std::string name() {
20 bortigno 1.2 oss_mcHPtCutMin << mcHPtCutMin;
21     if(!mcHPtCutMax)
22     return "mcHpT"+oss_mcHPtCutMin.str();
23     else{
24     oss_mcHPtCutMax << mcHPtCutMax;
25     return "mcHpT"+oss_mcHPtCutMin.str()+"To"+oss_mcHPtCutMax.str();
26     }
27 tboccali 1.1 }
28     bool pass(VHbbProxy &iProxy) {
29 bortigno 1.2 if(!mcHPtCutMax)
30 tboccali 1.5 return ( iProxy.getVHbbEventAuxInfo()->mcH.size() !=0 && ((iProxy.getVHbbEventAuxInfo()->mcH)[0]).p4.Pt() > mcHPtCutMin );
31 bortigno 1.2 else
32 tboccali 1.5 return ( iProxy.getVHbbEventAuxInfo()->mcH.size() !=0 && ((iProxy.getVHbbEventAuxInfo()->mcH)[0]).p4.Pt() > mcHPtCutMin
33     && iProxy.getVHbbEventAuxInfo()->mcH.size() !=0 && ((iProxy.getVHbbEventAuxInfo()->mcH)[0]).p4.Pt() < mcHPtCutMax );
34 tboccali 1.1 }
35     private:
36 bortigno 1.2 Double_t mcHPtCutMin;
37     Double_t mcHPtCutMax;
38     std::ostringstream oss_mcHPtCutMin;
39     std::ostringstream oss_mcHPtCutMax;
40 tboccali 1.1 };
41    
42 bortigno 1.2
43     class mcWPtCut : public Cut {
44 tboccali 1.1 public:
45 bortigno 1.2 mcWPtCut(Double_t mcWPtCutMin_):
46     mcWPtCutMin(mcWPtCutMin_) {}
47     mcWPtCut(Double_t mcWPtCutMin_, Double_t mcWPtCutMax_):
48     mcWPtCutMin(mcWPtCutMin_),
49     mcWPtCutMax(mcWPtCutMax_) {}
50 tboccali 1.1 std::string name() {
51 bortigno 1.2 oss_mcWPtCutMin << mcWPtCutMin;
52     if(!mcWPtCutMax)
53     return "mcWpT"+oss_mcWPtCutMin.str();
54     else{
55     oss_mcWPtCutMax << mcWPtCutMax;
56     return "mcWpT"+oss_mcWPtCutMin.str()+"To"+oss_mcWPtCutMax.str();
57     }
58 tboccali 1.1 }
59     bool pass(VHbbProxy &iProxy) {
60 bortigno 1.2 if(!mcWPtCutMax)
61 tboccali 1.5 return ( iProxy.getVHbbEventAuxInfo()->mcW.size() !=0 && ((iProxy.getVHbbEventAuxInfo()->mcW)[0]).p4.Pt() > mcWPtCutMin );
62 bortigno 1.2 else
63 tboccali 1.5 return ( iProxy.getVHbbEventAuxInfo()->mcW.size() !=0 && ((iProxy.getVHbbEventAuxInfo()->mcW)[0]).p4.Pt() > mcWPtCutMin
64     && iProxy.getVHbbEventAuxInfo()->mcW.size() !=0 && ((iProxy.getVHbbEventAuxInfo()->mcW)[0]).p4.Pt() < mcWPtCutMax );
65 tboccali 1.1 }
66     private:
67 bortigno 1.2 Double_t mcWPtCutMin;
68     Double_t mcWPtCutMax;
69     std::ostringstream oss_mcWPtCutMin;
70     std::ostringstream oss_mcWPtCutMax;
71 tboccali 1.1 };
72    
73 bortigno 1.2
74    
75     class mcZPtCut : public Cut {
76 tboccali 1.1 public:
77 bortigno 1.2 mcZPtCut(Double_t mcZPtCutMin_):
78     mcZPtCutMin(mcZPtCutMin_) {}
79     mcZPtCut(Double_t mcZPtCutMin_, Double_t mcZPtCutMax_):
80     mcZPtCutMin(mcZPtCutMin_),
81     mcZPtCutMax(mcZPtCutMax_) {}
82 tboccali 1.1 std::string name() {
83 bortigno 1.2 oss_mcZPtCutMin << mcZPtCutMin;
84     if(!mcZPtCutMax)
85     return "mcZpT"+oss_mcZPtCutMin.str();
86     else{
87     oss_mcZPtCutMax << mcZPtCutMax;
88     return "mcZpT"+oss_mcZPtCutMin.str()+"To"+oss_mcZPtCutMax.str();
89     }
90 tboccali 1.1 }
91     bool pass(VHbbProxy &iProxy) {
92 bortigno 1.2 if(!mcZPtCutMax)
93 tboccali 1.5 return ( iProxy.getVHbbEventAuxInfo()->mcZ.size() !=0 && ((iProxy.getVHbbEventAuxInfo()->mcZ)[0]).p4.Pt() > mcZPtCutMin );
94 bortigno 1.2 else
95 tboccali 1.5 return ( iProxy.getVHbbEventAuxInfo()->mcZ.size() !=0 && ((iProxy.getVHbbEventAuxInfo()->mcZ)[0]).p4.Pt() > mcZPtCutMin
96     && iProxy.getVHbbEventAuxInfo()->mcZ.size() !=0 && ((iProxy.getVHbbEventAuxInfo()->mcZ)[0]).p4.Pt() < mcZPtCutMax );
97 bortigno 1.2 }
98 tboccali 1.1 private:
99 bortigno 1.2 Double_t mcZPtCutMin;
100     Double_t mcZPtCutMax;
101     std::ostringstream oss_mcZPtCutMin;
102     std::ostringstream oss_mcZPtCutMax;
103 tboccali 1.1 };
104    
105 bortigno 1.2
106     class SimpleJet1PtCut: public Cut {
107 tboccali 1.1 public:
108 bortigno 1.2 SimpleJet1PtCut(Double_t simpleJet1PtCutMin_):
109     simpleJet1PtCutMin(simpleJet1PtCutMin_) {}
110     SimpleJet1PtCut(Double_t simpleJet1PtCutMin_, Double_t simpleJet1PtCutMax_):
111     simpleJet1PtCutMin(simpleJet1PtCutMin_),
112     simpleJet1PtCutMax(simpleJet1PtCutMax_) {}
113 tboccali 1.1 std::string name() {
114 bortigno 1.2 oss_simpleJet1PtCutMin << simpleJet1PtCutMin;
115     if(!simpleJet1PtCutMax){
116     return "SimpleJet1PtCut"+oss_simpleJet1PtCutMin.str();
117     }
118     else{
119     oss_simpleJet1PtCutMax << simpleJet1PtCutMax;
120     return "SimpleJet1PtCut"+oss_simpleJet1PtCutMin.str()+"To"+oss_simpleJet1PtCutMax.str();
121     }
122 tboccali 1.1 }
123     bool pass(VHbbProxy &iProxy) {
124     if(iProxy.getVHbbCandidate()->size() < 1)
125     return false;
126     else
127 bortigno 1.2 if(!simpleJet1PtCutMin)
128 tboccali 1.5 return ((iProxy.getVHbbCandidate()->at(0)).H.jets.at(0).p4.Pt() > simpleJet1PtCutMin);
129 bortigno 1.2 else
130 tboccali 1.5 return ((iProxy.getVHbbCandidate()->at(0)).H.jets.at(0).p4.Pt() > simpleJet1PtCutMin
131     && (iProxy.getVHbbCandidate()->at(0)).H.jets.at(0).p4.Pt() < simpleJet1PtCutMax);
132 bortigno 1.2 }
133 tboccali 1.1 private:
134 bortigno 1.2 Double_t simpleJet1PtCutMin;
135     Double_t simpleJet1PtCutMax;
136     std::ostringstream oss_simpleJet1PtCutMin;
137     std::ostringstream oss_simpleJet1PtCutMax;
138 tboccali 1.1 };
139    
140 bortigno 1.2 class VPtCut: public Cut {
141 tboccali 1.1 public:
142 bortigno 1.2 VPtCut(Double_t VptCutMin_):
143     VptCutMin(VptCutMin_) {}
144     VPtCut(Double_t VptCutMin_, Double_t VptCutMax_):
145     VptCutMin(VptCutMin_),
146     VptCutMax(VptCutMax_) {}
147 tboccali 1.1 std::string name() {
148 bortigno 1.2 oss_VptMin << VptCutMin;
149     if(! VptCutMax ){
150     return "VpT"+oss_VptMin.str();
151     }
152     else{
153     oss_VptMax << VptCutMax;
154     return "VpT"+oss_VptMin.str()+"To"+oss_VptMax.str();
155     }
156 tboccali 1.1 }
157     bool pass(VHbbProxy &iProxy) {
158     if(iProxy.getVHbbCandidate()->size() < 1)
159     return false;
160     else
161 bortigno 1.2 if(VptCutMax != 1e10)
162 tboccali 1.5 return ((iProxy.getVHbbCandidate()->at(0)).V.p4.Pt() > VptCutMin
163     && (iProxy.getVHbbCandidate()->at(0)).V.p4.Pt() < VptCutMax);
164 bortigno 1.2 else
165 tboccali 1.5 return ((iProxy.getVHbbCandidate()->at(0)).V.p4.Pt() > VptCutMin );
166 bortigno 1.2
167     }
168 tboccali 1.1 private:
169 bortigno 1.2 Double_t VptCutMin;
170     Double_t VptCutMax;
171     std::ostringstream oss_VptMin;
172     std::ostringstream oss_VptMax;
173 tboccali 1.1 };
174    
175 bortigno 1.2
176     class HPtCut: public Cut {
177 tboccali 1.1 public:
178 bortigno 1.2 HPtCut(Double_t hPtCutMin_):
179     hPtCutMin(hPtCutMin_) {}
180     HPtCut(Double_t hPtCutMin_, Double_t hPtCutMax_):
181     hPtCutMin(hPtCutMin_),
182     hPtCutMax(hPtCutMax_) {}
183    
184 tboccali 1.1 std::string name() {
185 bortigno 1.2 oss_HPtCutMin << hPtCutMin;
186     if(!hPtCutMax){
187     return "HpT"+oss_HPtCutMin.str();
188     }
189     else{
190     oss_HPtCutMax << hPtCutMax;
191     return "HpT"+oss_HPtCutMin.str()+"To"+oss_HPtCutMax.str();
192     }
193 tboccali 1.1 }
194     bool pass(VHbbProxy &iProxy) {
195     if(iProxy.getVHbbCandidate()->size() < 1)
196     return false;
197     else
198 bortigno 1.2 if(!hPtCutMax)
199 tboccali 1.5 return ((iProxy.getVHbbCandidate()->at(0)).H.p4.Pt() > hPtCutMin);
200 bortigno 1.2 else
201 tboccali 1.5 return ((iProxy.getVHbbCandidate()->at(0)).H.p4.Pt() > hPtCutMin
202     && (iProxy.getVHbbCandidate()->at(0)).H.p4.Pt() < hPtCutMax);
203 tboccali 1.1 }
204     private:
205 bortigno 1.2 Double_t hPtCutMin;
206     Double_t hPtCutMax;
207     std::ostringstream oss_HPtCutMin;
208     std::ostringstream oss_HPtCutMax;
209 tboccali 1.1 };
210    
211    
212 tboccali 1.6 class SignalRegionOld: public Cut {
213 tboccali 1.1 std::string name() {return "SignalRegion";};
214    
215     Bool_t pass(VHbbProxy &iProxy){
216    
217     const std::vector<VHbbCandidate> *iCand = iProxy.getVHbbCandidate();
218    
219     if(iCand->size() < 1)
220     return false;
221    
222     VHbbCandidate::VectorCandidate V = iProxy.getVHbbCandidate()->at(0).V;
223     VHbbCandidate::HiggsCandidate H = iProxy.getVHbbCandidate()->at(0).H;
224    
225     if(iCand->at(0).candidateType == VHbbCandidate::Zmumu || iCand->at(0).candidateType == VHbbCandidate::Zee){
226     btag_csv_min = 0.5;
227     btag_csv_max = 0.9;
228     Higgs_pt = 150;
229     V_pt = 150;
230     VH_deltaPhi = 2.70;
231     nOfAdditionalJets = 2;
232     pullAngle = 1.57;
233     helicityAngle = 0.8;
234     }
235     else if(iCand->at(0).candidateType == VHbbCandidate::Wmun || iCand->at(0).candidateType == VHbbCandidate::Wen){
236     btag_csv_min = 0.5;
237     btag_csv_max = 0.9;
238     Higgs_pt = 150;
239     V_pt = 150;
240     VH_deltaPhi = 2.95;
241     nOfAdditionalJets = 2;
242     pullAngle = 1.57;
243     helicityAngle = 0.8;
244     }
245     else if(iCand->at(0).candidateType == VHbbCandidate::Znn){
246     btag_csv_min = 0.5;
247     btag_csv_max = 0.9;
248     Higgs_pt = 150;
249     V_pt = 150;
250     VH_deltaPhi = 2.95;
251     nOfAdditionalJets = 2;
252     pullAngle = 1.57;
253     helicityAngle = 0.8;
254     }
255     else
256     std::cerr << "No vector boson reconstructed. No histos will be filled." << std::endl;
257    
258     Bool_t go = false;
259 tboccali 1.5 if( H.p4.Pt() > Higgs_pt
260     && V.p4.Pt() > V_pt
261     && TMath::Abs( Geom::deltaPhi(H.p4.Phi(), V.p4.Phi()) ) > VH_deltaPhi
262 tboccali 1.1 && ( H.jets.at(0).csv > btag_csv_min && H.jets.at(1).csv > btag_csv_min )
263     && ( H.jets.at(0).csv > btag_csv_max || H.jets.at(1).csv > btag_csv_max )
264     && iCand->at(0).additionalJets.size() < nOfAdditionalJets
265     // && V.additionalLeptons.size() < nOfAddionalLeptons
266     && TMath::Abs(H.deltaTheta) < pullAngle
267     // && TMath::Abs(H.helicityAngle) < helicityAngle
268     )
269     go = true;
270     return go;
271    
272     }
273    
274     private:
275    
276     Double_t btag_csv_min;
277     Double_t btag_csv_max;
278     Double_t Higgs_pt;
279     Double_t V_pt;
280     Double_t VH_deltaPhi;
281     unsigned int nOfAdditionalJets;
282     unsigned int nOfAdditionalLeptons;
283     Double_t pullAngle;
284     Double_t helicityAngle;
285    
286     };
287    
288    
289    
290    
291     class MCHistos : public Histos {
292    
293     public:
294    
295     virtual void book(TFile &f, std::string suffix) {
296    
297     TDirectory *subDir;
298    
299     if( ! f.GetDirectory(suffix.c_str()) )
300     subDir = f.mkdir(suffix.c_str());
301     else
302     subDir = f.GetDirectory(suffix.c_str());
303    
304     subDir->cd();
305    
306     bin_mass = 500;
307     min_mass = 0;
308     max_mass = 300;
309    
310     bin_pt = 500;
311     min_pt = 0;
312     max_pt = 500;
313    
314     bin_hel = 50;
315     min_hel = 0;
316     max_hel = 1;
317    
318     //from MC
319     McH_simHMass = new TH1F(("simHiggsMass"+suffix).c_str(),("Sim Higgs Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
320     McH_simHPt = new TH1F(("simHiggsPt"+suffix).c_str(),("Sim Higgs Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
321     McH_simZMass = new TH1F(("simZMass"+suffix).c_str(),("Sim Z Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
322     McH_simZPt = new TH1F(("simZPt"+suffix).c_str(),("Sim Z Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
323     McH_simWMass = new TH1F(("simWMass"+suffix).c_str(),("Sim W Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
324     McH_simWPt = new TH1F(("simWPt"+suffix).c_str(),("Sim W Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
325    
326     }
327    
328     virtual void fill(VHbbProxy &iProxy,float w) {
329    
330 tboccali 1.4 // const VHbbEvent *iEvent = iProxy.getVHbbEvent();
331     const VHbbEventAuxInfo *iAuxInfo = iProxy.getVHbbEventAuxInfo();
332     if(iAuxInfo) {
333 tboccali 1.1 //from MC
334 tboccali 1.4 if (iAuxInfo->mcH.size() )
335 tboccali 1.5 McH_simHMass->Fill(iAuxInfo->mcH[0].p4.M(), w);
336 tboccali 1.4 if (iAuxInfo->mcH.size() )
337 tboccali 1.5 McH_simHPt->Fill(iAuxInfo->mcH[0].p4.Pt(), w);
338 tboccali 1.4 if (iAuxInfo->mcZ.size() )
339 tboccali 1.5 McH_simZMass->Fill(iAuxInfo->mcZ[0].p4.M(), w);
340 tboccali 1.4 if (iAuxInfo->mcZ.size() )
341 tboccali 1.5 McH_simZPt->Fill(iAuxInfo->mcZ[0].p4.Pt(), w);
342 tboccali 1.4 if (iAuxInfo->mcW.size() )
343 tboccali 1.5 McH_simWMass->Fill(iAuxInfo->mcW[0].p4.M(), w);
344 tboccali 1.4 if (iAuxInfo->mcW.size() )
345 tboccali 1.5 McH_simWPt->Fill(iAuxInfo->mcW[0].p4.Pt(), w);
346 arizzi 1.3 }
347 tboccali 1.1 }
348    
349    
350     TH1F * McH_simHMass;
351     TH1F * McH_simHPt;
352     TH1F * McH_simWMass;
353     TH1F * McH_simWPt;
354     TH1F * McH_simZMass;
355     TH1F * McH_simZPt;
356    
357     private:
358    
359     Int_t bin_mass;
360     Double_t min_mass;
361     Double_t max_mass;
362    
363     Int_t bin_pt;
364     Double_t min_pt;
365     Double_t max_pt;
366    
367     Int_t bin_hel;
368     Double_t min_hel;
369     Double_t max_hel;
370    
371    
372     };
373    
374    
375     class BTagHistos : public Histos {
376    
377     public:
378    
379     virtual void book(TFile &f, std::string suffix) {
380    
381     TDirectory *subDir;
382     if( ! f.GetDirectory(suffix.c_str()) )
383     subDir = f.mkdir(suffix.c_str());
384     else
385     subDir = f.GetDirectory(suffix.c_str());
386     subDir->cd();
387    
388     bin_btag_prob = 20;
389     min_btag_prob = 0;
390     max_btag_prob = 1;
391    
392     bin_btag_count = 10;
393     min_btag_count = 0;
394     max_btag_count = 10;
395    
396     //Candidates
397     BTagH_bJet1_csv = new TH1F(("BJet1_CSV"+suffix).c_str(),("BJet1 CSV ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
398     BTagH_bJet2_csv = new TH1F(("BJet2_CSV"+suffix).c_str(),("BJet2 CSV ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
399     BTagH_bJet1_csvmva = new TH1F(("BJet1_CSVMVA"+suffix).c_str(),("BJet1 CSVMVA ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
400     BTagH_bJet2_csvmva = new TH1F(("BJet2_CSVMVA"+suffix).c_str(),("BJet2 CSVMVA ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
401     BTagH_bJet1_ssvhe = new TH1F(("BJet1_SSVHE"+suffix).c_str(),("BJet1 SSVHE ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
402     BTagH_bJet2_ssvhe = new TH1F(("BJet2_SSVHE"+suffix).c_str(),("BJet2 SSVHE ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
403     BTagH_bJet1_jpb = new TH1F(("BJet1_JPB"+suffix).c_str(),("BJet1 JPB ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
404     BTagH_bJet2_jpb = new TH1F(("BJet2_JPB"+suffix).c_str(),("BJet2 JPB ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
405     BTagH_bJet1_tche = new TH1F(("BJet1_TCHE"+suffix).c_str(),("BJet1 TCHE ("+suffix+")").c_str(), bin_btag_count, min_btag_count, max_btag_count );
406     BTagH_bJet2_tche = new TH1F(("BJet2_TCHE"+suffix).c_str(),("BJet2 TCHE ("+suffix+")").c_str(), bin_btag_count, min_btag_count, max_btag_count );
407     BTagH_bJet1_jp = new TH1F(("BJet1_JP"+suffix).c_str(),("BJet1 JP ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
408     BTagH_bJet2_jp = new TH1F(("BJet2_JP"+suffix).c_str(),("BJet2 JP ("+suffix+")").c_str(), bin_btag_prob, min_btag_prob, max_btag_prob );
409     BTagH_bJet1_tchp = new TH1F(("BJet1_TCHP"+suffix).c_str(),("BJet1 TCHP ("+suffix+")").c_str(), bin_btag_count, min_btag_count, max_btag_count );
410     BTagH_bJet2_tchp = new TH1F(("BJet2_TCHP"+suffix).c_str(),("BJet2 TCHP ("+suffix+")").c_str(), bin_btag_count, min_btag_count, max_btag_count );
411    
412     }
413    
414     virtual void fill(VHbbProxy &iProxy,float w) {
415    
416     const VHbbEvent *iEvent = iProxy.getVHbbEvent();
417     const std::vector<VHbbCandidate> *iCand = iProxy.getVHbbCandidate();
418    
419     //Candidates
420     if(iCand->size() > 0){
421     VHbbCandidate::CandidateType iCandType = iCand->at(0).candidateType;
422     VHbbCandidate::HiggsCandidate H = iCand->at(0).H;
423    
424     BTagH_bJet1_csv->Fill(H.jets.at(0).csv, w);
425     BTagH_bJet2_csv->Fill(H.jets.at(1).csv, w);
426     BTagH_bJet1_csvmva->Fill(H.jets.at(0).csvmva, w);
427     BTagH_bJet2_csvmva->Fill(H.jets.at(1).csvmva, w);
428     BTagH_bJet1_ssvhe->Fill(H.jets.at(0).ssvhe, w);
429     BTagH_bJet2_ssvhe->Fill(H.jets.at(1).ssvhe, w);
430     BTagH_bJet1_tche->Fill(H.jets.at(0).tche, w);
431     BTagH_bJet2_tche->Fill(H.jets.at(1).tche, w);
432     BTagH_bJet1_tchp->Fill(H.jets.at(0).tchp, w);
433     BTagH_bJet2_tchp->Fill(H.jets.at(1).tchp, w);
434     BTagH_bJet1_jpb->Fill(H.jets.at(0).jpb, w);
435     BTagH_bJet2_jpb->Fill(H.jets.at(1).jpb, w);
436     BTagH_bJet1_jp->Fill(H.jets.at(0).jp, w);
437     BTagH_bJet2_jp->Fill(H.jets.at(1).jp, w);
438    
439     }
440     }
441    
442     TH1F * BTagH_bJet1_csv;
443     TH1F * BTagH_bJet2_csv;
444     TH1F * BTagH_bJet1_csvmva;
445     TH1F * BTagH_bJet2_csvmva;
446     TH1F * BTagH_bJet1_ssvhe;
447     TH1F * BTagH_bJet2_ssvhe;
448     TH1F * BTagH_bJet1_jpb;
449     TH1F * BTagH_bJet2_jpb;
450     TH1F * BTagH_bJet1_tche;
451     TH1F * BTagH_bJet2_tche;
452     TH1F * BTagH_bJet1_jp;
453     TH1F * BTagH_bJet2_jp;
454     TH1F * BTagH_bJet1_tchp;
455     TH1F * BTagH_bJet2_tchp;
456    
457     private:
458    
459     Int_t bin_btag_prob;
460     Double_t min_btag_prob;
461     Double_t max_btag_prob;
462    
463     Int_t bin_btag_count;
464     Double_t min_btag_count;
465     Double_t max_btag_count;
466    
467     };
468 arizzi 1.7
469     class CountHisto : public Histos {
470     virtual void book(TFile &f, std::string suffix) {
471    
472     TDirectory *subDir;
473     if( ! f.GetDirectory(suffix.c_str()) )
474     subDir = f.mkdir(suffix.c_str());
475     else
476     subDir = f.GetDirectory(suffix.c_str());
477     subDir->cd();
478     count = new TH1F(("Count"+suffix).c_str(),("Count ("+suffix+")").c_str(), 1,0,2 );
479    
480     }
481     virtual void fill(VHbbProxy &iProxy,float w) {
482     count->Fill(1,w);
483     }
484    
485     TH1F * count;
486     };
487    
488 tboccali 1.1 class StandardHistos : public Histos {
489    
490     public:
491    
492     virtual void book(TFile &f, std::string suffix) {
493    
494     TDirectory *subDir;
495     if( ! f.GetDirectory(suffix.c_str()) )
496     subDir = f.mkdir(suffix.c_str());
497     else
498     subDir = f.GetDirectory(suffix.c_str());
499     subDir->cd();
500    
501     bin_mass = 500;
502     min_mass = 0;
503     max_mass = 300;
504    
505     bin_pt = 500;
506     min_pt = 0;
507     max_pt = 500;
508    
509     bin_hel = 50;
510     min_hel = 0;
511     max_hel = 1;
512    
513     bin_btag = 20;
514     min_btag = 0;
515     max_btag = 1;
516    
517     bin_deltaR = bin_deltaPhi = bin_deltaEta = 20;
518     min_deltaR = min_deltaPhi = min_deltaEta = 0;
519     max_deltaR = max_deltaPhi = max_deltaEta = 5;
520    
521     //Candidates
522     StH_simpleJet1_pt = new TH1F(("SimpleJet1_pt"+suffix).c_str(),("Simple Jet1 pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
523     StH_simpleJet2_pt = new TH1F(("SimpleJet2_pt"+suffix).c_str(),("Simple Jet2 pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
524     StH_simpleJet1_bTag = new TH1F(("SimpleJet1_bTag"+suffix).c_str(),("Simple Jet1 bTag ("+suffix+")").c_str(), bin_btag, min_btag, max_btag );
525     StH_simpleJet2_bTag = new TH1F(("SimpleJet2_bTag"+suffix).c_str(),("Simple Jet2 bTag ("+suffix+")").c_str(), bin_btag, min_btag, max_btag );
526     StH_simpleJets_dR = new TH1F(("SimpleJets_dR"+suffix).c_str(),("Simple Jets deltaR ("+suffix+")").c_str(), bin_deltaR, min_deltaR, max_deltaR );
527     StH_simpleJets_dPhi = new TH1F(("SimpleJets_dPhi"+suffix).c_str(),("Simple Jets deltaPhi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
528     StH_simpleJets_dEta = new TH1F(("SimpleJets_dEta"+suffix).c_str(),("Simple Jets deltaEta ("+suffix+")").c_str(), bin_deltaEta, min_deltaEta, max_deltaEta );
529    
530     StH_HMass = new TH1F(("HiggsMass"+suffix).c_str(),(" Higgs Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
531     StH_HPt = new TH1F(("HiggsPt"+suffix).c_str(),(" Higgs Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
532     StH_HHel = new TH1F(("HiggsHel"+suffix).c_str(),("Higgs helicity angle ("+suffix+")").c_str(), bin_hel, min_hel, max_hel );
533     StH_HPullAngle = new TH1F(("HiggsPullAngle"+suffix).c_str(),("Higgs pull angle ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
534    
535     StH_ZMass = new TH1F(("ZMass"+suffix).c_str(),(" Z Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
536     StH_ZPt = new TH1F(("ZPt"+suffix).c_str(),(" Z Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
537     StH_ZH_dPhi = new TH1F(("ZH_dPhi"+suffix).c_str(),(" ZH delta Phi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
538    
539 arizzi 1.8 StH_WMass = new TH1F(("WMass"+suffix).c_str(),(" W Transverse Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
540 tboccali 1.1 StH_WPt = new TH1F(("WPt"+suffix).c_str(),(" W Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
541     StH_WH_dPhi = new TH1F(("WH_dPhi"+suffix).c_str(),(" WH delta Phi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
542    
543     }
544    
545     virtual void fill(VHbbProxy &iProxy,float w) {
546    
547     const VHbbEvent *iEvent = iProxy.getVHbbEvent();
548     const std::vector<VHbbCandidate> *iCand = iProxy.getVHbbCandidate();
549    
550     //Candidates
551     if(iCand->size() > 0){
552     VHbbCandidate::CandidateType iCandType = iCand->at(0).candidateType;
553     VHbbCandidate::HiggsCandidate H = iCand->at(0).H;
554     VHbbCandidate::VectorCandidate V = iCand->at(0).V;
555    
556 tboccali 1.5 StH_simpleJet1_pt->Fill(H.jets.at(0).p4.Pt(), w);
557     StH_simpleJet2_pt->Fill(H.jets.at(1).p4.Pt(), w);
558 tboccali 1.1 StH_simpleJet1_bTag->Fill(H.jets.at(0).csv, w);
559     StH_simpleJet2_bTag->Fill(H.jets.at(1).csv, w);
560 tboccali 1.5 StH_simpleJets_dR->Fill(H.jets.at(0).p4.DeltaR(H.jets.at(1).p4), w);
561     StH_simpleJets_dPhi->Fill(H.jets.at(0).p4.DeltaPhi(H.jets.at(1).p4), w);
562     StH_simpleJets_dEta->Fill(TMath::Abs(H.jets.at(0).p4.Eta()-H.jets.at(1).p4.Eta()), w);
563 tboccali 1.1
564 tboccali 1.5 StH_HMass->Fill(H.p4.M(), w);
565     StH_HPt->Fill(H.p4.Pt(), w);
566 tboccali 1.1 // StH_HHel->Fill(H.hel(), w);
567     StH_HPullAngle->Fill(H.deltaTheta, w);
568     if( iCandType == VHbbCandidate::Zmumu || iCandType == VHbbCandidate::Zee || iCandType == VHbbCandidate::Znn ){
569 tboccali 1.5 StH_ZMass->Fill(V.p4.M(), w);
570     StH_ZPt->Fill(V.p4.Pt(), w);
571     StH_ZH_dPhi->Fill(V.p4.DeltaPhi(H.p4.Phi()), w);
572 tboccali 1.1 }
573     else if(iCandType == VHbbCandidate::Wen || iCandType == VHbbCandidate::Wmun){
574 arizzi 1.8 StH_WMass->Fill(V.Mt(iCandType), w);
575 tboccali 1.5 StH_WPt->Fill(V.p4.Pt(), w);
576     StH_WH_dPhi->Fill(V.p4.DeltaPhi(H.p4.Phi()), w);
577 tboccali 1.1 }
578    
579     }
580     }
581    
582     TH1F * StH_simpleJet1_pt;
583     TH1F * StH_simpleJet2_pt;
584     TH1F * StH_simpleJet1_bTag;
585     TH1F * StH_simpleJet2_bTag;
586     TH1F * StH_simpleJets_dR;
587     TH1F * StH_simpleJets_dPhi;
588     TH1F * StH_simpleJets_dEta;
589    
590     TH1F * StH_HMass;
591     TH1F * StH_HPt;
592     TH1F * StH_HHel;
593     TH1F * StH_HPullAngle;
594     TH1F * StH_WMass;
595     TH1F * StH_WPt;
596     TH1F * StH_WH_dPhi;
597     TH1F * StH_ZMass;
598     TH1F * StH_ZPt;
599     TH1F * StH_ZH_dPhi;
600    
601     private:
602    
603     Int_t bin_btag;
604     Double_t min_btag;
605     Double_t max_btag;
606    
607     Int_t bin_deltaEta;
608     Double_t min_deltaEta;
609     Double_t max_deltaEta;
610    
611     Int_t bin_deltaPhi;
612     Double_t min_deltaPhi;
613     Double_t max_deltaPhi;
614    
615     Int_t bin_deltaR;
616     Double_t min_deltaR;
617     Double_t max_deltaR;
618    
619     Int_t bin_mass;
620     Double_t min_mass;
621     Double_t max_mass;
622    
623     Int_t bin_pt;
624     Double_t min_pt;
625     Double_t max_pt;
626    
627     Int_t bin_hel;
628     Double_t min_hel;
629     Double_t max_hel;
630    
631     };
632    
633     class HardJetHistos : public Histos {
634    
635     public:
636    
637     virtual void book(TFile &f, std::string suffix) {
638    
639     TDirectory *subDir;
640     if( ! f.GetDirectory(suffix.c_str()) )
641     subDir = f.mkdir(suffix.c_str());
642     else
643     subDir = f.GetDirectory(suffix.c_str());
644     subDir->cd();
645    
646     bin_mass = 500;
647     min_mass = 0;
648     max_mass = 300;
649    
650     bin_pt = 500;
651     min_pt = 0;
652     max_pt = 500;
653    
654     bin_hel = 50;
655     min_hel = 0;
656     max_hel = 1;
657    
658     bin_btag = 20;
659     min_btag = 0;
660     max_btag = 1;
661    
662     bin_deltaR = bin_deltaPhi = bin_deltaEta = 20;
663     min_deltaR = min_deltaPhi = min_deltaEta = 0;
664     max_deltaR = max_deltaPhi = max_deltaEta = 5;
665    
666     //Candidates
667    
668     HardJetH_subJet1_pt = new TH1F(("SubJet1_pt"+suffix).c_str(),("Sub Jet1 pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
669     HardJetH_subJet2_pt = new TH1F(("SubJet2_pt"+suffix).c_str(),("Sub Jet2 pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
670     HardJetH_subJet1_bTag = new TH1F(("SubJet1_bTag"+suffix).c_str(),("Sub Jet1 bTag ("+suffix+")").c_str(), bin_btag, min_btag, max_btag );
671     HardJetH_subJet2_bTag = new TH1F(("SubJet2_bTag"+suffix).c_str(),("Sub Jet2 bTag ("+suffix+")").c_str(), bin_btag, min_btag, max_btag );
672     HardJetH_subJets_dR = new TH1F(("SubJets_dR"+suffix).c_str(),("Sub Jets deltaR ("+suffix+")").c_str(), bin_deltaR, min_deltaR, max_deltaR );
673     HardJetH_subJets_dPhi = new TH1F(("SubJets_dPhi"+suffix).c_str(),("Sub Jets deltaPhi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
674     HardJetH_subJets_dEta = new TH1F(("SubJets_dEta"+suffix).c_str(),("Sub Jets deltaEta ("+suffix+")").c_str(), bin_deltaEta, min_deltaEta, max_deltaEta );
675    
676     HardJetH_HMass = new TH1F(("HiggsMass"+suffix).c_str(),(" Higgs Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
677     HardJetH_HPt = new TH1F(("HiggsPt"+suffix).c_str(),(" Higgs Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
678     HardJetH_HHel = new TH1F(("HiggsHel"+suffix).c_str(),("Higgs helicity angle ("+suffix+")").c_str(), bin_hel, min_hel, max_hel );
679    
680     HardJetH_ZMass = new TH1F(("ZMass"+suffix).c_str(),(" Z Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
681     HardJetH_ZPt = new TH1F(("ZPt"+suffix).c_str(),(" Z Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
682     HardJetH_ZH_dPhi = new TH1F(("ZH_dPhi"+suffix).c_str(),(" ZH delta Phi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
683    
684     HardJetH_WMass = new TH1F(("WMass"+suffix).c_str(),(" W Mass ("+suffix+")").c_str(), bin_mass, min_mass, max_mass );
685     HardJetH_WPt = new TH1F(("WPt"+suffix).c_str(),(" W Pt ("+suffix+")").c_str(), bin_pt, min_pt, max_pt );
686     HardJetH_WH_dPhi = new TH1F(("WH_dPhi"+suffix).c_str(),(" WH delta Phi ("+suffix+")").c_str(), bin_deltaPhi, min_deltaPhi, max_deltaPhi );
687    
688     }
689    
690     virtual void fill(VHbbProxy &iProxy,float w) {
691    
692     const VHbbEvent *iEvent = iProxy.getVHbbEvent();
693 arizzi 1.3 if(iEvent)
694     { const std::vector<VHbbCandidate> *iCand = iProxy.getVHbbCandidate();
695 tboccali 1.1
696     //Candidates
697     if(iCand->size() > 0){
698     VHbbCandidate::CandidateType iCandType = iCand->at(0).candidateType;
699     VHbbCandidate::HiggsCandidate H = iCand->at(0).H;
700     VHbbCandidate::VectorCandidate V = iCand->at(0).V;
701     std::vector<VHbbEvent::HardJet> iHardJets = iEvent->hardJets;
702     VHbbEvent::HardJet iHardJet = iHardJets.at(0);
703    
704     HardJetH_subJet1_pt->Fill(iHardJet.subFourMomentum.at(0).Pt(), w);
705     HardJetH_subJet2_pt->Fill(iHardJet.subFourMomentum.at(1).Pt(), w);
706     //SubJet information on btag missing
707     // HardJetH_subJet1_bTag->Fill(iHardJet.at(0).csv, w);
708     // HardJetH_subJet2_bTag->Fill(iHardJet.at(1).csv, w);
709     HardJetH_subJets_dR->Fill(iHardJet.subFourMomentum.at(0).DeltaR(iHardJet.subFourMomentum.at(1)), w);
710     HardJetH_subJets_dPhi->Fill(iHardJet.subFourMomentum.at(0).DeltaPhi(iHardJet.subFourMomentum.at(1)), w);
711     HardJetH_subJets_dEta->Fill(TMath::Abs(iHardJet.subFourMomentum.at(0).Eta()-iHardJet.subFourMomentum.at(1).Eta()), w);
712    
713     //Here there should be the higgs candidate from HardJet
714 tboccali 1.5 // HardJetH_HMass->Fill(H.p4.M(), w);
715     // HardJetH_HPt->Fill(H.p4.Pt(), w);
716 tboccali 1.1 // // HardJetH_HHel->Fill(H.hel(), w);
717     // if( iCandType == VHbbCandidate::Zmumu || iCandType == VHbbCandidate::Zee || iCandType == VHbbCandidate::Znn ){
718 tboccali 1.5 // HardJetH_ZMass->Fill(V.p4.M(), w);
719     // HardJetH_ZPt->Fill(V.p4.Pt(), w);
720     // HardJetH_ZH_dPhi->Fill(V.p4.DeltaPhi(H.p4.Phi()), w);
721 tboccali 1.1 // }
722     // else if(iCandType == VHbbCandidate::Wen || iCandType == VHbbCandidate::Wmun){
723 tboccali 1.5 // HardJetH_WMass->Fill(V.p4.M(), w);
724     // HardJetH_WPt->Fill(V.p4.Pt(), w);
725     // HardJetH_WH_dPhi->Fill(V.p4.DeltaPhi(H.p4.Phi()), w);
726 tboccali 1.1 // }
727 arizzi 1.3 }
728 tboccali 1.1 }
729     }
730    
731     TH1F * HardJetH_subJet1_pt;
732     TH1F * HardJetH_subJet2_pt;
733     TH1F * HardJetH_subJet1_bTag;
734     TH1F * HardJetH_subJet2_bTag;
735     TH1F * HardJetH_subJets_dR;
736     TH1F * HardJetH_subJets_dPhi;
737     TH1F * HardJetH_subJets_dEta;
738    
739     TH1F * HardJetH_HMass;
740     TH1F * HardJetH_HPt;
741     TH1F * HardJetH_HHel;
742     TH1F * HardJetH_WMass;
743     TH1F * HardJetH_WPt;
744     TH1F * HardJetH_WH_dPhi;
745     TH1F * HardJetH_ZMass;
746     TH1F * HardJetH_ZPt;
747     TH1F * HardJetH_ZH_dPhi;
748    
749     private:
750    
751     Int_t bin_btag;
752     Double_t min_btag;
753     Double_t max_btag;
754    
755     Int_t bin_deltaEta;
756     Double_t min_deltaEta;
757     Double_t max_deltaEta;
758    
759     Int_t bin_deltaPhi;
760     Double_t min_deltaPhi;
761     Double_t max_deltaPhi;
762    
763     Int_t bin_deltaR;
764     Double_t min_deltaR;
765     Double_t max_deltaR;
766    
767     Int_t bin_mass;
768     Double_t min_mass;
769     Double_t max_mass;
770    
771     Int_t bin_pt;
772     Double_t min_pt;
773     Double_t max_pt;
774    
775     Int_t bin_hel;
776     Double_t min_hel;
777     Double_t max_hel;
778    
779     };