25 |
|
m_logger << DEBUG << "Constructor called." << SLogger::endmsg; |
26 |
|
m_bcc = NULL; |
27 |
|
m_lumi = NULL; |
28 |
+ |
m_primlep = NULL; |
29 |
|
} |
30 |
|
|
31 |
|
EventCalc::~EventCalc() |
49 |
|
b_HT = false; |
50 |
|
b_HTlep = false; |
51 |
|
|
52 |
+ |
m_primlep = NULL; |
53 |
+ |
|
54 |
|
} |
55 |
|
|
56 |
|
BaseCycleContainer* EventCalc::GetBaseCycleContainer() |
131 |
|
return m_HTlep; |
132 |
|
} |
133 |
|
|
134 |
+ |
Particle* EventCalc::GetPrimaryLepton(){ |
135 |
+ |
|
136 |
+ |
if(!m_primlep){ |
137 |
+ |
double ptmax = -999; |
138 |
+ |
for(unsigned int i=0; i<m_bcc->electrons->size(); ++i){ |
139 |
+ |
if(m_bcc->electrons->at(i).pt()>ptmax){ |
140 |
+ |
ptmax = m_bcc->electrons->at(i).pt(); |
141 |
+ |
m_primlep = &m_bcc->electrons->at(i); |
142 |
+ |
} |
143 |
+ |
} |
144 |
+ |
for(unsigned int i=0; i<m_bcc->muons->size(); ++i){ |
145 |
+ |
if(m_bcc->muons->at(i).pt()>ptmax){ |
146 |
+ |
ptmax = m_bcc->muons->at(i).pt(); |
147 |
+ |
m_primlep = &m_bcc->muons->at(i); |
148 |
+ |
} |
149 |
+ |
} |
150 |
+ |
} |
151 |
+ |
|
152 |
+ |
return m_primlep; |
153 |
+ |
} |
154 |
+ |
|
155 |
+ |
|
156 |
+ |
std::vector<LorentzVector> EventCalc::NeutrinoReconstruction(const LorentzVector lepton, const LorentzVector met){ |
157 |
+ |
|
158 |
+ |
|
159 |
+ |
TVector3 lepton_pT = toVector(lepton); |
160 |
+ |
lepton_pT.SetZ(0); |
161 |
+ |
|
162 |
+ |
TVector3 neutrino_pT = toVector(met); |
163 |
+ |
neutrino_pT.SetZ(0); |
164 |
+ |
|
165 |
+ |
const float mass_w = 80.399; |
166 |
+ |
float mu = mass_w * mass_w / 2 + lepton_pT * neutrino_pT; |
167 |
+ |
|
168 |
+ |
float A = - (lepton_pT * lepton_pT); |
169 |
+ |
float B = mu * lepton.pz(); |
170 |
+ |
float C = mu * mu - lepton.e() * lepton.e() * (neutrino_pT * neutrino_pT); |
171 |
+ |
|
172 |
+ |
float discriminant = B * B - A * C; |
173 |
+ |
|
174 |
+ |
std::vector<LorentzVector> solutions; |
175 |
+ |
|
176 |
+ |
if (0 >= discriminant) |
177 |
+ |
{ |
178 |
+ |
// Take only real part of the solution |
179 |
+ |
// |
180 |
+ |
LorentzVectorXYZE solution (0,0,0,0); |
181 |
+ |
solution.SetPx(met.Px()); |
182 |
+ |
solution.SetPy(met.Py()); |
183 |
+ |
solution.SetPz(-B / A); |
184 |
+ |
solution.SetE(toVector(solution).Mag()); |
185 |
+ |
|
186 |
+ |
solutions.push_back(toPtEtaPhi(solution)); |
187 |
+ |
|
188 |
+ |
//_solutions = 0 > discriminant ? 0 : 1; |
189 |
+ |
} |
190 |
+ |
else |
191 |
+ |
{ |
192 |
+ |
discriminant = sqrt(discriminant); |
193 |
+ |
|
194 |
+ |
LorentzVectorXYZE solution (0,0,0,0); |
195 |
+ |
solution.SetPx(met.Px()); |
196 |
+ |
solution.SetPy(met.Py()); |
197 |
+ |
solution.SetPz((-B - discriminant) / A); |
198 |
+ |
solution.SetE(toVector(solution).Mag()); |
199 |
+ |
|
200 |
+ |
solutions.push_back(toPtEtaPhi(solution)); |
201 |
+ |
|
202 |
+ |
LorentzVectorXYZE solution2 (0,0,0,0); |
203 |
+ |
solution2.SetPx(met.Px()); |
204 |
+ |
solution2.SetPy(met.Py()); |
205 |
+ |
solution2.SetPz((-B + discriminant) / A); |
206 |
+ |
solution2.SetE(toVector(solution2).Mag()); |
207 |
+ |
|
208 |
+ |
solutions.push_back(toPtEtaPhi(solution2)); |
209 |
+ |
|
210 |
+ |
//_solutions = 2; |
211 |
+ |
} |
212 |
+ |
|
213 |
+ |
return solutions; |
214 |
+ |
} |
215 |
+ |
|
216 |
+ |
void EventCalc::FillHighMassTTbarHypotheses(){ |
217 |
+ |
|
218 |
+ |
//clear hypothesis list |
219 |
+ |
m_bcc->recoHyps->clear(); |
220 |
+ |
|
221 |
+ |
//find primary charged lepton |
222 |
+ |
Particle* lepton = GetPrimaryLepton(); |
223 |
+ |
|
224 |
+ |
//reconstruct neutrino |
225 |
+ |
std::vector<LorentzVector> neutrinos = NeutrinoReconstruction( lepton->v4(), m_bcc->met->v4()); |
226 |
+ |
|
227 |
+ |
ReconstructionHypothesis hyp; |
228 |
+ |
|
229 |
+ |
hyp.set_lepton(*lepton); |
230 |
+ |
|
231 |
+ |
//loop over neutrino solutions and jet assignments to fill hyotheses |
232 |
+ |
for(unsigned int i=0; i< neutrinos.size();++i){ |
233 |
+ |
|
234 |
+ |
hyp.set_neutrino_v4(neutrinos[i]); |
235 |
+ |
LorentzVector wlep_v4 = lepton->v4()+neutrinos[i]; |
236 |
+ |
|
237 |
+ |
unsigned int n_jets = m_bcc->jets->size(); |
238 |
+ |
unsigned int max_j = myPow(3, n_jets); |
239 |
+ |
for (unsigned int j=0; j < max_j; j++) { |
240 |
+ |
LorentzVector tophad_v4(0,0,0,0); |
241 |
+ |
LorentzVector toplep_v4 = wlep_v4; |
242 |
+ |
int hadjets=0; |
243 |
+ |
int lepjets=0; |
244 |
+ |
int num = j; |
245 |
+ |
hyp.clear_jetindices(); |
246 |
+ |
for (unsigned int k=0; k<n_jets; k++) { |
247 |
+ |
// num is the k-th digit of j if you |
248 |
+ |
// write j in a base-3 system. According |
249 |
+ |
// to the value of this digit (which takes |
250 |
+ |
// values from 0 to 2, |
251 |
+ |
// in all possible combinations with the other digits), |
252 |
+ |
// decide how to treat the jet. |
253 |
+ |
|
254 |
+ |
if(num%3==0) { |
255 |
+ |
tophad_v4 = tophad_v4 + m_bcc->jets->at(k).v4(); |
256 |
+ |
hyp.add_tophad_jet_index(k); |
257 |
+ |
hadjets++; |
258 |
+ |
} |
259 |
+ |
|
260 |
+ |
if(num%3==1) { |
261 |
+ |
toplep_v4 = toplep_v4 + m_bcc->jets->at(k).v4(); |
262 |
+ |
hyp.add_toplep_jet_index(k); |
263 |
+ |
lepjets++; |
264 |
+ |
} |
265 |
+ |
//if(num%3==2); //do not take this jet |
266 |
+ |
|
267 |
+ |
//shift the trigits of num to the right: |
268 |
+ |
num /= 3; |
269 |
+ |
} |
270 |
+ |
|
271 |
+ |
|
272 |
+ |
//fill only hypotheses with at least on ejet assigned to each top quark |
273 |
+ |
if(hadjets>0 && lepjets>0){ |
274 |
+ |
hyp.set_tophad_v4(tophad_v4); |
275 |
+ |
hyp.set_toplep_v4(toplep_v4); |
276 |
+ |
m_bcc->recoHyps->push_back(hyp); |
277 |
+ |
} |
278 |
+ |
} |
279 |
+ |
} |
280 |
+ |
|
281 |
+ |
} |
282 |
+ |
|
283 |
+ |
|
284 |
|
void EventCalc::PrintEventContent(){ |
285 |
|
|
286 |
|
m_logger << INFO << "----------------- event content -----------------" << SLogger::endmsg; |
288 |
|
m_logger << INFO << "MET = " << m_bcc->met->pt() << " METphi = " << m_bcc->met->phi() << " HTlep = " << GetHTlep() << SLogger::endmsg; |
289 |
|
if(m_bcc->electrons){m_logger << INFO << "Electrons:" << SLogger::endmsg; |
290 |
|
for(unsigned int i=0; i<m_bcc->electrons->size(); ++i){ |
291 |
< |
m_logger << INFO << " " << i+1 << " pt = " << m_bcc->electrons->at(i).pt() <<" eta = " << m_bcc->electrons->at(i).eta() << SLogger::endmsg; |
291 |
> |
m_logger << INFO << " " << i+1 << " pt = " << m_bcc->electrons->at(i).pt() <<" eta = " << m_bcc->electrons->at(i).eta() |
292 |
> |
<< " supercluster eta = " <<m_bcc->electrons->at(i).supercluster_eta() << " IP wrt bsp = " << fabs(m_bcc->electrons->at(i).gsfTrack_dxy_vertex(m_bcc->pvs->at(0).x(), m_bcc->pvs->at(0).y())) |
293 |
> |
<< " pass conv veto = " << m_bcc->electrons->at(i).passconversionveto() << " mvaTrigV0 = " << m_bcc->electrons->at(i).mvaTrigV0() |
294 |
> |
<< " dEtaIn = " << m_bcc->electrons->at(i).dEtaIn() << " sigmaIEtaIEta = " << m_bcc->electrons->at(i).sigmaIEtaIEta() |
295 |
> |
<< " HoverE = " << m_bcc->electrons->at(i).HoverE() << " EcalEnergy = " << m_bcc->electrons->at(i).EcalEnergy() |
296 |
> |
<< " EoverPIn = " << m_bcc->electrons->at(i).EoverPIn() << " trackMomentumAtVtx = " << m_bcc->electrons->at(i).EcalEnergy()/m_bcc->electrons->at(i).EoverPIn() |
297 |
> |
<< SLogger::endmsg; |
298 |
|
} |
299 |
|
} |
300 |
|
if(m_bcc->muons){m_logger << INFO << "Muons:" << SLogger::endmsg; |