1 |
amagnan |
1.1 |
#ifndef HbbAnalysis_HistosPairsBase_hh
|
2 |
|
|
#define HbbAnalysis_HistosPairsBase_hh
|
3 |
|
|
|
4 |
|
|
#include <vector>
|
5 |
|
|
#include <string>
|
6 |
|
|
|
7 |
amagnan |
1.3 |
#include "CommonTools/UtilAlgos/interface/TFileService.h"
|
8 |
amagnan |
1.1 |
|
9 |
|
|
#ifdef _FLAGANALYSIS_
|
10 |
|
|
#include "UserCode/HbbAnalysis/interface/TFileDirectory.hh"
|
11 |
|
|
#endif
|
12 |
|
|
|
13 |
|
|
#include "TH1F.h"
|
14 |
|
|
#include "TH2F.h"
|
15 |
|
|
|
16 |
|
|
#include "UserCode/HbbAnalysis/interface/Met.hh"
|
17 |
|
|
#include "UserCode/HbbAnalysis/interface/HbbEvent.hh"
|
18 |
|
|
|
19 |
|
|
namespace HbbAnalysis {//namespace
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
class HistosPairsBase {
|
23 |
|
|
|
24 |
|
|
public:
|
25 |
|
|
|
26 |
|
|
HistosPairsBase():
|
27 |
|
|
doGenMatched_(false)
|
28 |
|
|
{};
|
29 |
|
|
~HistosPairsBase(){};
|
30 |
|
|
|
31 |
|
|
void Initialise(TFileDirectory & aDir, std::string aName, bool aDoGenMatched=false);
|
32 |
|
|
|
33 |
|
|
template <class Ta>
|
34 |
|
|
void FillEventHistograms(const std::vector<Ta> & aCol,
|
35 |
|
|
const HbbAnalysis::Met & aMet,
|
36 |
|
|
bool isLead = false,
|
37 |
|
|
unsigned short signReq = 0,
|
38 |
|
|
double deltaRcut = 0.3
|
39 |
|
|
);
|
40 |
|
|
|
41 |
|
|
//signReq = 0: no requirement,
|
42 |
|
|
// = 1: SameSign,
|
43 |
|
|
// = 2: OppSign.
|
44 |
|
|
template <class Ta, class Tb>
|
45 |
|
|
void FillEventHistograms(const std::vector<Ta> & aCol1,
|
46 |
|
|
const std::vector<Tb> & aCol2,
|
47 |
|
|
const HbbAnalysis::Met & aMet,
|
48 |
|
|
bool isLead = false,
|
49 |
|
|
unsigned short signReq = 0,
|
50 |
|
|
double deltaRcut = 0.3);
|
51 |
|
|
|
52 |
|
|
template <class Ta, class Tb>
|
53 |
|
|
void FillHistograms(const Ta & aLeg1,
|
54 |
|
|
const Tb & aLeg2,
|
55 |
|
|
const HbbAnalysis::Met & aMet);
|
56 |
|
|
|
57 |
|
|
template <class Ta, class Tb>
|
58 |
|
|
bool MatchesGenParticle(const Ta & aLeg1, const Tb & aLeg2);
|
59 |
|
|
|
60 |
|
|
private:
|
61 |
|
|
|
62 |
|
|
bool pairSelection(HbbAnalysis::BaseVars v1,
|
63 |
|
|
HbbAnalysis::BaseVars v2,
|
64 |
|
|
unsigned short signReq,
|
65 |
|
|
double deltaRcut);
|
66 |
|
|
|
67 |
|
|
protected:
|
68 |
|
|
|
69 |
|
|
bool doGenMatched_;
|
70 |
|
|
|
71 |
|
|
TH1F *p_nPairs;
|
72 |
|
|
|
73 |
|
|
TH1F *p_Vis_px;
|
74 |
|
|
TH1F *p_Vis_py;
|
75 |
|
|
TH1F *p_Vis_pz;
|
76 |
|
|
TH1F *p_Vis_pt;
|
77 |
|
|
TH1F *p_Vis_Et;
|
78 |
|
|
TH1F *p_Vis_mt;
|
79 |
|
|
TH1F *p_Vis_mass;
|
80 |
|
|
TH1F *p_Vis_energy;
|
81 |
|
|
TH1F *p_Vis_eta;
|
82 |
|
|
TH1F *p_Vis_phi;
|
83 |
|
|
|
84 |
|
|
TH1F *p_Coll_px;
|
85 |
|
|
TH1F *p_Coll_py;
|
86 |
|
|
TH1F *p_Coll_pz;
|
87 |
|
|
TH1F *p_Coll_pt;
|
88 |
|
|
TH1F *p_Coll_Et;
|
89 |
|
|
TH1F *p_Coll_mt;
|
90 |
|
|
TH1F *p_Coll_mass;
|
91 |
|
|
TH1F *p_Coll_energy;
|
92 |
|
|
TH1F *p_Coll_eta;
|
93 |
|
|
TH1F *p_Coll_phi;
|
94 |
|
|
|
95 |
|
|
TH1F *p_CDF_px;
|
96 |
|
|
TH1F *p_CDF_py;
|
97 |
|
|
TH1F *p_CDF_pz;
|
98 |
|
|
TH1F *p_CDF_pt;
|
99 |
|
|
TH1F *p_CDF_Et;
|
100 |
|
|
TH1F *p_CDF_mt;
|
101 |
|
|
TH1F *p_CDF_mass;
|
102 |
|
|
TH1F *p_CDF_energy;
|
103 |
|
|
TH1F *p_CDF_eta;
|
104 |
|
|
TH1F *p_CDF_phi;
|
105 |
|
|
|
106 |
|
|
TH1F *p_charge;
|
107 |
|
|
|
108 |
|
|
TH1F *p_mt12MET;
|
109 |
|
|
|
110 |
|
|
TH1F *p_mt1MET;
|
111 |
|
|
TH1F *p_mt2MET;
|
112 |
|
|
TH1F *p_dPhi1MET;
|
113 |
|
|
TH1F *p_dPhi2MET;
|
114 |
|
|
|
115 |
|
|
TH1F *p_dPhi12;
|
116 |
|
|
TH1F *p_dR12;
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
};
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
template <class Ta>
|
123 |
|
|
void HistosPairsBase::FillEventHistograms(const std::vector<Ta> & aCol,
|
124 |
|
|
const HbbAnalysis::Met & aMet,
|
125 |
|
|
bool isLead,
|
126 |
|
|
unsigned short signReq,
|
127 |
|
|
double deltaRcut)
|
128 |
|
|
{
|
129 |
|
|
unsigned int lNPairs = 0;
|
130 |
|
|
for (unsigned int iLeg1(0); iLeg1<aCol.size(); iLeg1++)
|
131 |
|
|
{
|
132 |
|
|
for (unsigned int iLeg2(iLeg1+1); iLeg2<aCol.size(); iLeg2++)
|
133 |
|
|
{
|
134 |
|
|
bool lIsGenMatched = !doGenMatched_ || (doGenMatched_ && MatchesGenParticle(aCol.at(iLeg1),aCol.at(iLeg2)));
|
135 |
|
|
|
136 |
|
|
if (pairSelection(aCol.at(iLeg1).recoVars(),
|
137 |
|
|
aCol.at(iLeg2).recoVars(),
|
138 |
|
|
signReq,
|
139 |
|
|
deltaRcut) &&
|
140 |
|
|
lIsGenMatched) {
|
141 |
|
|
if ((isLead && lNPairs == 0) || !isLead) FillHistograms<Ta,Ta>(aCol.at(iLeg1),aCol.at(iLeg2),aMet);
|
142 |
|
|
lNPairs++;
|
143 |
|
|
}
|
144 |
|
|
}
|
145 |
|
|
}
|
146 |
|
|
|
147 |
|
|
p_nPairs->Fill(lNPairs);
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
template <class Ta, class Tb>
|
153 |
|
|
void HistosPairsBase::FillEventHistograms(const std::vector<Ta> & aCol1,
|
154 |
|
|
const std::vector<Tb> & aCol2,
|
155 |
|
|
const HbbAnalysis::Met & aMet,
|
156 |
|
|
bool isLead,
|
157 |
|
|
unsigned short signReq,
|
158 |
|
|
double deltaRcut)
|
159 |
|
|
{
|
160 |
|
|
unsigned int lNPairs = 0;
|
161 |
|
|
for (unsigned int iLeg1(0); iLeg1<aCol1.size(); iLeg1++)
|
162 |
|
|
{
|
163 |
|
|
for (unsigned int iLeg2(0); iLeg2<aCol2.size(); iLeg2++)
|
164 |
|
|
{
|
165 |
|
|
bool lIsGenMatched = !doGenMatched_ || (doGenMatched_ && MatchesGenParticle(aCol1.at(iLeg1),aCol2.at(iLeg2)));
|
166 |
|
|
if ( pairSelection(aCol1.at(iLeg1).recoVars(),
|
167 |
|
|
aCol2.at(iLeg2).recoVars(),
|
168 |
|
|
signReq,
|
169 |
|
|
deltaRcut) &&
|
170 |
|
|
lIsGenMatched) {
|
171 |
|
|
if ((isLead && lNPairs == 0) || !isLead) FillHistograms<Ta,Tb>(aCol1.at(iLeg1),aCol2.at(iLeg2),aMet);
|
172 |
|
|
lNPairs++;
|
173 |
|
|
}
|
174 |
|
|
}
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
p_nPairs->Fill(lNPairs);
|
178 |
|
|
}
|
179 |
|
|
|
180 |
|
|
template <class Ta, class Tb>
|
181 |
|
|
void HistosPairsBase::FillHistograms(const Ta & aLeg1,
|
182 |
|
|
const Tb & aLeg2,
|
183 |
|
|
const HbbAnalysis::Met & aMet)
|
184 |
|
|
{
|
185 |
|
|
|
186 |
|
|
TLorentzVector lp4 = FourMomentum(aLeg1.recoVars())+FourMomentum(aLeg2.recoVars());
|
187 |
|
|
|
188 |
|
|
p_Vis_px->Fill(lp4.Px());
|
189 |
|
|
p_Vis_py->Fill(lp4.Py());
|
190 |
|
|
p_Vis_pz->Fill(lp4.Pz());
|
191 |
|
|
p_Vis_pt->Fill(lp4.Pt());
|
192 |
|
|
p_Vis_Et->Fill(lp4.Et());
|
193 |
|
|
p_Vis_mt->Fill(lp4.Mt());
|
194 |
|
|
p_Vis_mass->Fill(lp4.M());
|
195 |
|
|
p_Vis_energy->Fill(lp4.E());
|
196 |
amagnan |
1.2 |
if (lp4.Pt() > 0)
|
197 |
|
|
p_Vis_eta->Fill(lp4.Eta());
|
198 |
|
|
else p_Vis_eta->Fill(0);
|
199 |
amagnan |
1.1 |
p_Vis_phi->Fill(lp4.Phi());
|
200 |
|
|
|
201 |
|
|
lp4 = FourMomentumCollinearApprox(aLeg1.recoVars(),
|
202 |
|
|
aLeg2.recoVars(),
|
203 |
|
|
aMet.recoVars().mEx,
|
204 |
|
|
aMet.recoVars().mEy);
|
205 |
|
|
p_Coll_px->Fill(lp4.Px());
|
206 |
|
|
p_Coll_py->Fill(lp4.Py());
|
207 |
|
|
p_Coll_pz->Fill(lp4.Pz());
|
208 |
|
|
p_Coll_pt->Fill(lp4.Pt());
|
209 |
|
|
p_Coll_Et->Fill(lp4.Et());
|
210 |
|
|
p_Coll_mt->Fill(lp4.Mt());
|
211 |
|
|
p_Coll_mass->Fill(lp4.M());
|
212 |
|
|
p_Coll_energy->Fill(lp4.E());
|
213 |
amagnan |
1.2 |
if (lp4.Pt() > 0)
|
214 |
|
|
p_Coll_eta->Fill(lp4.Eta());
|
215 |
|
|
else p_Coll_eta->Fill(0);
|
216 |
amagnan |
1.1 |
p_Coll_phi->Fill(lp4.Phi());
|
217 |
|
|
|
218 |
|
|
lp4 = FourMomentumCDFmethod(aLeg1.recoVars(),
|
219 |
|
|
aLeg2.recoVars(),
|
220 |
|
|
aMet.recoVars().mEx,
|
221 |
|
|
aMet.recoVars().mEy);
|
222 |
|
|
p_CDF_px->Fill(lp4.Px());
|
223 |
|
|
p_CDF_py->Fill(lp4.Py());
|
224 |
|
|
p_CDF_pz->Fill(lp4.Pz());
|
225 |
|
|
p_CDF_pt->Fill(lp4.Pt());
|
226 |
|
|
p_CDF_Et->Fill(lp4.Et());
|
227 |
|
|
p_CDF_mt->Fill(lp4.Mt());
|
228 |
|
|
p_CDF_mass->Fill(lp4.M());
|
229 |
|
|
p_CDF_energy->Fill(lp4.E());
|
230 |
amagnan |
1.2 |
if (lp4.Pt() > 0)
|
231 |
|
|
p_CDF_eta->Fill(lp4.Eta());
|
232 |
|
|
else p_CDF_eta->Fill(0);
|
233 |
amagnan |
1.1 |
p_CDF_phi->Fill(lp4.Phi());
|
234 |
|
|
|
235 |
|
|
p_charge->Fill(aLeg1.recoVars().charge+aLeg2.recoVars().charge);
|
236 |
|
|
|
237 |
|
|
p_mt12MET->Fill(TransverseMass(aLeg1.recoVars(),aLeg2.recoVars(),aMet.recoVars().mEx,aMet.recoVars().mEy));
|
238 |
|
|
|
239 |
|
|
p_mt1MET->Fill(TransverseMass(aLeg1.recoVars(),aMet.recoVars().mEx,aMet.recoVars().mEy));
|
240 |
|
|
p_mt2MET->Fill(TransverseMass(aLeg2.recoVars(),aMet.recoVars().mEx,aMet.recoVars().mEy));
|
241 |
|
|
p_dPhi1MET->Fill(DeltaPhi(aLeg1.recoVars().phi,aMet.recoVars().phi));
|
242 |
|
|
p_dPhi2MET->Fill(DeltaPhi(aLeg2.recoVars().phi,aMet.recoVars().phi));
|
243 |
|
|
|
244 |
|
|
p_dPhi12->Fill(DeltaPhi(aLeg1.recoVars().phi,aLeg2.recoVars().phi));
|
245 |
|
|
p_dR12->Fill(DeltaR(aLeg1.recoVars(),aLeg2.recoVars()));
|
246 |
|
|
|
247 |
|
|
}
|
248 |
|
|
|
249 |
|
|
template <class Ta, class Tb>
|
250 |
|
|
bool HistosPairsBase::MatchesGenParticle(const Ta & aLeg1,
|
251 |
|
|
const Tb & aLeg2)
|
252 |
|
|
{
|
253 |
|
|
|
254 |
|
|
return (aLeg1.genVars().valid && aLeg2.genVars().valid);
|
255 |
|
|
|
256 |
|
|
}
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
}//namespace
|
261 |
|
|
|
262 |
|
|
#endif
|
263 |
|
|
|