1 |
tboccali |
1.1 |
#ifndef VHBBCANDIDATETOOLS_H
|
2 |
|
|
#define VHBBCANDIDATETOOLS_H
|
3 |
|
|
|
4 |
|
|
#include "VHbbAnalysis/VHbbDataFormats/interface/VHbbCandidate.h"
|
5 |
|
|
|
6 |
|
|
#include <iostream>
|
7 |
|
|
|
8 |
|
|
class VHbbCandidateTools {
|
9 |
|
|
public:
|
10 |
|
|
|
11 |
|
|
VHbbCandidateTools(bool verbose = false): verbose_(verbose){}
|
12 |
|
|
|
13 |
|
|
float deltaPhi(float in2, float in1){
|
14 |
|
|
float dphi = in2-in1;
|
15 |
|
|
if ( dphi > M_PI ) {
|
16 |
|
|
dphi -= 2.0*M_PI;
|
17 |
|
|
} else if ( dphi <= -M_PI ) {
|
18 |
|
|
dphi += 2.0*M_PI;
|
19 |
|
|
}
|
20 |
|
|
return dphi;
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
VHbbCandidate getHZmumuCandidate(const VHbbCandidate & in, bool & ok){
|
24 |
|
|
if (verbose_){
|
25 |
|
|
std::cout <<" getHZmumuCandidate input mu "<<in.V.muons.size()<<" e "<<in.V.electrons.size()<<std::endl;
|
26 |
|
|
}
|
27 |
|
|
ok = false;
|
28 |
|
|
VHbbCandidate temp=in;
|
29 |
|
|
if (temp.V.muons.size()!=2) return in ;
|
30 |
|
|
if (temp.V.electrons.size()!=0) return in ;
|
31 |
|
|
temp.V.fourMomentum = temp.V.muons[0].fourMomentum+temp.V.muons[1].fourMomentum;
|
32 |
|
|
|
33 |
|
|
if (temp.V.muons[0].fourMomentum.Pt()<20 || temp.V.muons[1].fourMomentum.Pt()<20 ) return in;
|
34 |
|
|
|
35 |
|
|
// if (temp.V.Pt()<150 ) return in;
|
36 |
|
|
// if (temp.H.Pt()<150) return in;
|
37 |
|
|
// if (temp.H.firstJet().csv< 0.9) return in;
|
38 |
|
|
// if (temp.H.secondJet().csv<0.5) return in;
|
39 |
|
|
// if (deltaPhi(temp.V.Phi(),temp.H.Phi())<2.7) return in;
|
40 |
|
|
// if (temp.V.FourMomentum.Mass()<75 || temp.V.FourMomentum.Mass()>105) return in;
|
41 |
|
|
// if (temp.additionalJets.size()>0) return in;
|
42 |
|
|
// if (std::Abs(deltaTheta) ????
|
43 |
|
|
ok = true;
|
44 |
|
|
return temp;
|
45 |
|
|
}
|
46 |
|
|
VHbbCandidate getHZeeCandidate(const VHbbCandidate & in, bool & ok){
|
47 |
|
|
if (verbose_){
|
48 |
|
|
std::cout <<" getHZeeCandidate input mu "<<in.V.muons.size()<<" e "<<in.V.electrons.size()<<std::endl;
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
ok = false;
|
52 |
|
|
VHbbCandidate temp=in;
|
53 |
|
|
if (temp.V.electrons.size()!=2) return in ;
|
54 |
|
|
if (temp.V.muons.size()!=0) return in ;
|
55 |
|
|
|
56 |
|
|
temp.V.fourMomentum = temp.V.electrons[0].fourMomentum+temp.V.electrons[1].fourMomentum;
|
57 |
|
|
|
58 |
|
|
//
|
59 |
|
|
// i need to ask VBTF and pt NEEDS ADJUSTING!!!!!
|
60 |
|
|
//
|
61 |
|
|
if (temp.V.electrons[0].fourMomentum.Pt()<20 ||temp.V.electrons[1].fourMomentum.Pt()<20 ) return in;
|
62 |
|
|
if (temp.V.electrons[0].id95r < -100000 ||temp.V.electrons[1].id95r < -100000) return in;
|
63 |
|
|
|
64 |
|
|
// if (temp.V.fourMomentum.Pt()<150 ) return in;
|
65 |
|
|
// if (temp.H.fourMomentum.Pt()<150) return in;
|
66 |
|
|
// if (temp.H.firstJet().csv< 0.9) return in;
|
67 |
|
|
// if (temp.H.secondJet().csv<0.5) return in;
|
68 |
|
|
// if (deltaPhi(temp.V.fourMomentum.Phi(),temp.H.fourMomentum.Phi())<2.7) return in;
|
69 |
|
|
// if (temp.V.fourMomentum.M()<75 || temp.V.fourMomentum.M()>105) return in;
|
70 |
|
|
// if (temp.additionalJets.size()>0) return in;
|
71 |
|
|
// if (std::Abs(deltaTheta) ????
|
72 |
|
|
ok = true;
|
73 |
|
|
return temp;
|
74 |
|
|
}
|
75 |
|
|
VHbbCandidate getHZnnCandidate(const VHbbCandidate & in, bool & ok){
|
76 |
|
|
if (verbose_){
|
77 |
|
|
std::cout <<" getHZnnCandidate input mu "<<in.V.muons.size()<<" e "<<in.V.electrons.size()<<" met "<<in.V.mets.size()<<std::endl;
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
ok = false;
|
81 |
|
|
VHbbCandidate temp=in;
|
82 |
|
|
if (temp.V.mets.size()!=1) return in;
|
83 |
|
|
if (temp.V.muons.size()!=0) return in ;
|
84 |
|
|
if (temp.V.electrons.size()!=0) return in ;
|
85 |
|
|
|
86 |
|
|
temp.V.fourMomentum = temp.V.mets[0].fourMomentum;
|
87 |
|
|
if (verbose_) {
|
88 |
|
|
std::cout <<" debug met "<< temp.V.mets[0].metSig << " " << temp.V.mets[0].sumEt<< std::endl;
|
89 |
|
|
}
|
90 |
|
|
if (temp.V.mets[0].metSig<5) return in;
|
91 |
|
|
if (temp.V.mets[0].sumEt<50) return in;
|
92 |
|
|
// if (temp.H.fourMomentum.Pt()<150)return in;
|
93 |
|
|
// if (temp.H.firstJet().csv< 0.9) return in;
|
94 |
|
|
// if (temp.H.secondJet().csv<0.5) return in;
|
95 |
|
|
// if (deltaPhi(temp.V.fourMomentum.Phi(),temp.H.fourMomentum.Phi())<2.95) return in;
|
96 |
|
|
// if (temp.V.electrons.size()>0 || temp.V.muons.size()>0 ) return in;
|
97 |
|
|
// if (temp.additionalJets.size()>0) return in;
|
98 |
|
|
// if (std::Abs(deltaTheta) ????
|
99 |
|
|
|
100 |
|
|
ok = true;
|
101 |
|
|
return temp;
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
VHbbCandidate getHWmunCandidate(const VHbbCandidate & in, bool & ok){
|
105 |
|
|
ok = false;
|
106 |
|
|
VHbbCandidate temp=in;
|
107 |
tboccali |
1.2 |
// require a muon and no electrons
|
108 |
tboccali |
1.1 |
if (temp.V.muons.size()!=1) return in ;
|
109 |
|
|
if (temp.V.electrons.size()!=0) return in ;
|
110 |
tboccali |
1.3 |
if (temp.V.mets.size()<1) return in ;
|
111 |
tboccali |
1.1 |
//
|
112 |
tboccali |
1.2 |
/*pT(W) > 150 GeV (pt(W) computed using lepton px,y and PF MET x and y components)
|
113 |
|
|
pT(H) > 150 GeV
|
114 |
|
|
best btag, CSV > 0.90
|
115 |
|
|
second-best btag, CSV > 0.50
|
116 |
|
|
Dphi(W,H) > 2.95
|
117 |
|
|
no additional isolated leptons (pT > 15 GeV)
|
118 |
|
|
|
119 |
|
|
same lepton definition as in the physics objects section
|
120 |
|
|
|
121 |
|
|
No additional ak5PFjets (pT > 30 GeV; |eta| < 2.4)
|
122 |
|
|
MET>35. for the electron BDT analysis
|
123 |
|
|
|cos(theta * )| (TBO)
|
124 |
|
|
color flow pull angle (TBO)
|
125 |
|
|
We don't cut on the transverse mass (for boosted objects cutting on the transverse mass introduces an inefficiency due to the angle between the MET and the lepton being close to 0.)
|
126 |
|
|
*/
|
127 |
|
|
|
128 |
tboccali |
1.3 |
temp.V.fourMomentum = temp.V.muons[0].fourMomentum+temp.V.mets[0].fourMomentum;
|
129 |
tboccali |
1.2 |
|
130 |
|
|
ok=true;
|
131 |
tboccali |
1.3 |
return temp;
|
132 |
tboccali |
1.1 |
}
|
133 |
|
|
|
134 |
|
|
VHbbCandidate getHWenCandidate(const VHbbCandidate & in, bool & ok){
|
135 |
|
|
ok = false;
|
136 |
|
|
VHbbCandidate temp=in;
|
137 |
|
|
if (temp.V.electrons.size()!=1) return in ;
|
138 |
|
|
if (temp.V.muons.size()!=0) return in ;
|
139 |
tboccali |
1.3 |
if (temp.V.mets.size()<1) return in ;
|
140 |
tboccali |
1.1 |
//
|
141 |
tboccali |
1.2 |
/*pT(W) > 150 GeV (pt(W) computed using lepton px,y and PF MET x and y components)
|
142 |
|
|
pT(H) > 150 GeV
|
143 |
|
|
best btag, CSV > 0.90
|
144 |
|
|
second-best btag, CSV > 0.50
|
145 |
|
|
Dphi(W,H) > 2.95
|
146 |
|
|
no additional isolated leptons (pT > 15 GeV)
|
147 |
|
|
|
148 |
|
|
same lepton definition as in the physics objects section
|
149 |
|
|
|
150 |
|
|
No additional ak5PFjets (pT > 30 GeV; |eta| < 2.4)
|
151 |
|
|
MET>35. for the electron BDT analysis
|
152 |
|
|
|cos(theta * )| (TBO)
|
153 |
|
|
color flow pull angle (TBO)
|
154 |
|
|
We don't cut on the transverse mass (for boosted objects cutting on the transverse mass introduces an inefficiency due to the angle between the MET and the lepton being close to 0.)
|
155 |
|
|
*/
|
156 |
|
|
|
157 |
|
|
ok=true;
|
158 |
|
|
|
159 |
tboccali |
1.3 |
temp.V.fourMomentum = temp.V.electrons[0].fourMomentum+temp.V.mets[0].fourMomentum;
|
160 |
|
|
return temp;
|
161 |
tboccali |
1.1 |
}
|
162 |
|
|
|
163 |
|
|
public:
|
164 |
|
|
bool verbose_;
|
165 |
tboccali |
1.2 |
|
166 |
|
|
public:
|
167 |
|
|
float getDeltaTheta( const VHbbEvent::SimpleJet & j1, const VHbbEvent::SimpleJet & j2 ) const {
|
168 |
|
|
double deltaTheta = 1e10;
|
169 |
|
|
TLorentzVector pi(0,0,0,0);
|
170 |
|
|
TLorentzVector v_j1 = j1.chargedTracksFourMomentum;
|
171 |
|
|
TLorentzVector v_j2 = j2.chargedTracksFourMomentum;
|
172 |
|
|
|
173 |
|
|
if( v_j2.Mag() == 0
|
174 |
|
|
|| v_j1.Mag() == 0 )
|
175 |
|
|
return deltaTheta = 1e10;
|
176 |
|
|
|
177 |
|
|
//use j1 to calculate the pull vector
|
178 |
|
|
TVector2 t = j1.tVector;
|
179 |
|
|
|
180 |
|
|
if( t.Mod() == 0 )
|
181 |
|
|
return deltaTheta = 1e10;
|
182 |
|
|
|
183 |
|
|
Double_t dphi = v_j2.Phi()- v_j1.Phi();
|
184 |
|
|
if ( dphi > M_PI ) {
|
185 |
|
|
dphi -= 2.0*M_PI;
|
186 |
|
|
} else if ( dphi <= -M_PI ) {
|
187 |
|
|
dphi += 2.0*M_PI;
|
188 |
|
|
}
|
189 |
|
|
Double_t deltaeta = v_j2.Rapidity() - v_j1.Rapidity();
|
190 |
|
|
TVector2 BBdir( deltaeta, dphi );
|
191 |
|
|
|
192 |
|
|
deltaTheta = t.DeltaPhi(BBdir);
|
193 |
|
|
|
194 |
|
|
return deltaTheta;
|
195 |
|
|
|
196 |
|
|
}
|
197 |
|
|
|
198 |
tboccali |
1.1 |
|
199 |
|
|
};
|
200 |
|
|
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
#endif
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|