11 #include "TLorentzVector.h" 17 #include "fastjet/ClusterSequence.hh" 22 #include "small_tree_full.hpp" 29 const double CSVCuts[] = {0.423, 0.814, 0.941};
32 const float fltmax = numeric_limits<float>::max();
40 TFile out_file(out_file_name,
"recreate");
45 float luminosity = 1000.;
47 Timer timer(num_entries, 1.);
49 for(
int entry = 0; entry < num_entries; ++entry){
53 tree.event() =
event();
56 tree.weight() =
Sign(
weight())*xsec*luminosity /
static_cast<double>(num_total_entries);
69 vector<TString> trig_name;
70 vector<bool> trig_decision;
71 vector<float> trig_prescale;
74 tree.trigger_name()= trig_name;
75 tree.trigger_decision()=trig_decision;
76 tree.trigger_prescale()=trig_prescale;
89 size_t primary_lep=
static_cast<size_t>(-1);
90 size_t primary_lep_reliso = primary_lep;
91 vector<size_t> sigleps;
92 TLorentzVector lepmax_p4(0., 0., 0., 0.), lepmax_p4_reliso(0., 0., 0., 0.);
93 short lepmax_chg = 0, lepmax_chg_reliso = 0;
94 tree.nels() = 0; tree.nvels() = 0;
95 tree.nels_reliso() = 0; tree.nvels_reliso() = 0;
97 vector<int> sig_muons =
GetMuons(
true,
true);
99 for(
size_t index(0); index<
els_pt()->size(); index++) {
102 tree.els_ispf().push_back(
els_isPF()->at(index));
103 tree.els_pt().push_back(
els_pt()->at(index));
104 tree.els_eta().push_back(
els_eta()->at(index));
105 tree.els_sceta().push_back(
els_scEta()->at(index));
106 tree.els_phi().push_back(
els_phi()->at(index));
107 tree.els_charge().push_back(TMath::Nint(
els_charge()->at(index)));
110 tree.els_d0().push_back(
els_d0dum()->at(index)
113 tree.els_dz().push_back(
els_vz()->at(index)-
pv_z()->at(0));
114 tree.els_dz_miniaod().push_back(
els_dz()->at(index));
120 int mcID =
GetTrueElectron(static_cast<int>(index), mcmomID, fromW, deltaR);
121 tree.els_tru_id().push_back(mcID);
122 tree.els_tru_momid().push_back(mcmomID);
124 tree.els_tru_dr().push_back(deltaR);
132 if(tree.els_sigid().back() && tree.els_pt().back()>
MinSignalLeptonPt && has_match){
133 sigleps.push_back(the_cand);
139 lepmax_p4 = TLorentzVector(
els_px()->at(index),
els_py()->at(index),
141 if(has_match) primary_lep = the_cand;
145 lepmax_p4_reliso = TLorentzVector(
els_px()->at(index),
els_py()->at(index),
147 if(has_match) primary_lep_reliso = the_cand;
152 if(
IsVetoIdElectron(index) && tree.els_miniso_tr10().back()<0.1) ++(tree.nvels());
157 tree.nmus() = 0; tree.nvmus() = 0;
158 tree.nmus_reliso() = 0; tree.nvmus_reliso() = 0;
159 for(
size_t index(0); index<
mus_pt()->size(); index++) {
162 tree.mus_pt().push_back(
mus_pt()->at(index));
163 tree.mus_eta().push_back(
mus_eta()->at(index));
164 tree.mus_phi().push_back(
mus_phi()->at(index));
165 tree.mus_charge().push_back(TMath::Nint(
mus_charge()->at(index)));
171 tree.mus_dz().push_back(
mus_tk_vz()->at(index)-
pv_z()->at(0));
172 tree.mus_dz_miniaod().push_back(
mus_tk_dz()->at(index));
178 int mcID =
GetTrueMuon(static_cast<int>(index), mcmomID, fromW, deltaR);
179 tree.mus_tru_id().push_back(mcID);
180 tree.mus_tru_momid().push_back(mcmomID);
182 tree.mus_tru_dr().push_back(deltaR);
190 if(tree.mus_sigid().back() && tree.mus_pt().back()>
MinSignalLeptonPt && has_match){
191 sigleps.push_back(the_cand);
195 if(
mus_pt()->at(index) > lepmax_p4.Pt() &&
IsSignalIdMuon(index) && tree.mus_miniso_tr10().back()<0.2){
197 lepmax_p4 = TLorentzVector(
mus_px()->at(index),
mus_py()->at(index),
199 if(has_match) primary_lep = the_cand;
203 lepmax_p4_reliso = TLorentzVector(
mus_px()->at(index),
mus_py()->at(index),
205 if(has_match) primary_lep_reliso = the_cand;
208 if(
IsVetoMuon(index)) ++(tree.nvmus_reliso());
210 if(
IsVetoIdMuon(index) && tree.mus_miniso_tr10().back()<0.2) ++(tree.nvmus());
215 tree.nleps() =
static_cast<int>(
bad_val);
216 if(tree.nels()+tree.nmus() == tree.nvels()+tree.nvmus()){
217 tree.nleps() = tree.nels() + tree.nmus();
220 tree.nleps_reliso() =
static_cast<int>(
bad_val);
221 if(tree.nels_reliso()+tree.nmus_reliso() == tree.nvels_reliso()+tree.nvmus_reliso()){
222 tree.nleps_reliso() = tree.nels_reliso() + tree.nmus_reliso();
225 if(lepmax_p4.Pt()>0.){
226 tree.lep_pt() = lepmax_p4.Pt();
227 tree.lep_phi() = lepmax_p4.Phi();
228 tree.lep_eta() = lepmax_p4.Eta();
229 tree.lep_charge() = lepmax_chg;
230 tree.st() = lepmax_p4.Pt()+
met_corr();
232 float wx = mets_ex()->at(0) + lepmax_p4.Px();
233 float wy = mets_ey()->at(0) + lepmax_p4.Py();
234 float wphi = atan2(wy, wx);
236 tree.dphi_wlep() =
DeltaPhi(wphi, lepmax_p4.Phi());
240 if(lepmax_p4_reliso.Pt()>0.){
241 tree.lep_pt_reliso() = lepmax_p4_reliso.Pt();
242 tree.lep_phi_reliso() = lepmax_p4_reliso.Phi();
243 tree.lep_eta_reliso() = lepmax_p4_reliso.Eta();
244 tree.lep_charge_reliso() = lepmax_chg_reliso;
245 tree.st_reliso() = lepmax_p4_reliso.Pt()+
met_corr();
247 float wx = mets_ex()->at(0) + lepmax_p4_reliso.Px();
248 float wy = mets_ey()->at(0) + lepmax_p4_reliso.Py();
249 float wphi = atan2(wy, wx);
251 tree.dphi_wlep_reliso() =
DeltaPhi(wphi, lepmax_p4_reliso.Phi());
256 vector<size_t> moms =
GetMoms(parts);
257 vector<size_t> indices;
258 for(
size_t imc = 0; imc < parts.size(); ++imc){
262 if ((abs(part.
id_)==5 || abs(part.
id_)==24) && (abs(part.
mom_)==6) ){
263 size_t last_top = moms.at(imc);
265 bool already_saved =
false;
266 for(
size_t i = 0; i < indices.size() && !already_saved; i++){
267 if(indices.at(i) == last_top) already_saved =
true;
271 if (abs(parts.at(last_top).id_) == 6){
272 tree.mc_pt().push_back(parts.at(last_top).momentum_.Pt());
273 tree.mc_phi().push_back(parts.at(last_top).momentum_.Phi());
274 tree.mc_eta().push_back(parts.at(last_top).momentum_.Eta());
275 tree.mc_id().push_back(parts.at(last_top).id_);
276 tree.mc_status().push_back(parts.at(last_top).status_);
277 indices.push_back(last_top);
280 bool found_mom =
false;
281 size_t imom = last_top;
282 while (imom < moms.size() && !found_mom){
283 imom = moms.at(imom);
284 for(
size_t i = 0; i < indices.size() && !found_mom; i++){
285 if(indices.at(i) == imom){
291 if(found_mom) tree.mc_mom().push_back(imom);
292 else tree.mc_mom().push_back(part.
mom_+10000);
297 bool hardscatter(
false), isr(
false), fsr(
false);
298 if(part.
status_ == 22 || part.
status_ == 23 ||
FromW(imc, parts, moms)) hardscatter =
true;
299 if(abs(part.
id_)!=6 && abs(part.
id_)!=5 && abs(part.
id_)!=24 && abs(part.
mom_)==6 && part.
momentum_.Pt()>10.) fsr =
true;
300 if(abs(part.
id_)!=6 && abs(part.
mom_)==2212 && part.
momentum_.Pt()>10.) isr =
true;
303 tree.mc_pt().push_back(part.
momentum_.Pt());
304 tree.mc_phi().push_back(part.
momentum_.Phi());
305 tree.mc_eta().push_back(part.
momentum_.Eta());
306 tree.mc_id().push_back(part.
id_);
307 tree.mc_status().push_back(part.
status_);
308 indices.push_back(imc);
310 bool found_mom =
false;
312 while (imom < moms.size() && !found_mom){
313 imom = moms.at(imom);
314 for(
size_t i = 0; i < indices.size() && !found_mom; i++){
315 if(indices.at(i) == imom){
321 if(found_mom) tree.mc_mom().push_back(imom);
322 else tree.mc_mom().push_back(part.
mom_+10000);
325 tree.mc_type() =
TypeCode(parts, moms);
326 std::vector<int> mc_mus, mc_els, mc_taush, mc_tausl;
328 tree.ntrumus() = mc_mus.size();
329 tree.ntruels() = mc_els.size();
330 tree.ntrutaush() = mc_taush.size();
331 tree.ntrutausl() = mc_tausl.size();
332 tree.ntruleps() = tree.ntrumus()+tree.ntruels()+tree.ntrutaush()+tree.ntrutausl();
335 vector<Jet> subtracted_jets =
GetSubtractedJets(sig_electrons, sig_muons, 20., 2.4);
342 tree.subjets_pt().resize(subtracted_jets.size());
343 tree.subjets_eta().resize(subtracted_jets.size());
344 tree.subjets_phi().resize(subtracted_jets.size());
345 tree.subjets_m().resize(subtracted_jets.size());
346 tree.subjets_csv().resize(subtracted_jets.size());
347 tree.subjets_id().resize(subtracted_jets.size());
348 tree.subjets_nsub().resize(subtracted_jets.size());
349 tree.subjets_mindr().resize(subtracted_jets.size());
350 tree.subjets_subpt().resize(subtracted_jets.size());
351 tree.subjets_subeta().resize(subtracted_jets.size());
352 tree.subjets_subphi().resize(subtracted_jets.size());
353 tree.subjets_subm().resize(subtracted_jets.size());
354 tree.subjets_fsubjet_index() = vector<int>(subtracted_jets.size(), -1);
355 double pxsub = 0., pysub = 0.;
356 for(
size_t ijet = 0; ijet < subtracted_jets.size(); ++ijet){
357 const Jet &jet = subtracted_jets.at(ijet);
359 tree.subjets_pt().at(ijet) = jet.
p4.Pt();
360 tree.subjets_eta().at(ijet) = jet.
p4.Eta();
361 tree.subjets_phi().at(ijet) = jet.
p4.Phi();
362 tree.subjets_m().at(ijet) = jet.
p4.M();
363 tree.subjets_csv().at(ijet) = jet.
csv;
364 tree.subjets_id().at(ijet) = jet.
id;
365 tree.subjets_nsub().at(ijet) = jet.
nleps;
366 tree.subjets_mindr().at(ijet) = jet.
mindr;
367 tree.subjets_subpt().at(ijet) = jet.
p4sub.Pt();
368 tree.subjets_subeta().at(ijet) = jet.
p4sub.Eta();
369 tree.subjets_subphi().at(ijet) = jet.
p4sub.Phi();
370 tree.subjets_subm().at(ijet) = jet.
p4sub.M();
377 tree.ht_sub() += jet.
p4.Pt();
378 pxsub += jet.
p4.Px();
379 pysub += jet.
p4.Py();
383 vector<PseudoJet> sjets(0);
384 vector<int> ijets(0);
385 vector<float> csvs(0);
386 for(
size_t ijet = 0; ijet < subtracted_jets.size(); ++ijet){
387 const Jet &jet = subtracted_jets.at(ijet);
388 const PseudoJet pj(jet.
p4.Px(), jet.
p4.Py(), jet.
p4.Pz(), jet.
p4.Energy());
391 ijets.push_back(ijet);
392 csvs.push_back(jet.
csv);
395 JetDefinition jet_def(antikt_algorithm, 1.2);
396 ClusterSequence cs(sjets, jet_def);
397 vector<PseudoJet> fjets =
sorted_by_m(cs.inclusive_jets());
398 tree.nfsubjets() = 0;
400 tree.fsubjets_pt().resize(fjets.size());
401 tree.fsubjets_eta().resize(fjets.size());
402 tree.fsubjets_phi().resize(fjets.size());
403 tree.fsubjets_m().resize(fjets.size());
404 tree.fsubjets_nconst().resize(fjets.size());
405 tree.fsubjets_sumcsv().resize(fjets.size());
406 tree.fsubjets_poscsv().resize(fjets.size());
407 tree.fsubjets_btags().resize(fjets.size());
408 for(
size_t ipj = 0; ipj < fjets.size(); ++ipj){
409 const PseudoJet &pj = fjets.at(ipj);
410 tree.fsubjets_pt().at(ipj) = pj.pt();
411 tree.fsubjets_eta().at(ipj) = pj.eta();
412 tree.fsubjets_phi().at(ipj) = pj.phi_std();
413 tree.fsubjets_m().at(ipj) = pj.m();
414 const vector<PseudoJet> &cjets = pj.constituents();
415 tree.fsubjets_nconst().at(ipj) = cjets.size();
417 tree.mj_sub() += pj.m();
418 ++(tree.nfsubjets());
420 tree.fsubjets_btags().at(ipj) = 0;
421 tree.fsubjets_sumcsv().at(ipj) = 0.;
422 tree.fsubjets_poscsv().at(ipj) = 0.;
423 for(
size_t ijet = 0; ijet < ijets.size(); ++ijet){
424 size_t i = ijets.at(ijet);
425 for(
size_t cjet = 0; cjet < cjets.size(); ++ cjet){
426 if((cjets.at(cjet) - sjets.at(ijet)).pt() < 0.0001){
427 tree.subjets_fsubjet_index().at(i) = ipj;
428 tree.fsubjets_sumcsv().at(ipj) += csvs.at(ijet);
429 if(csvs.at(ijet) > 0.){
430 tree.fsubjets_poscsv().at(ipj) += csvs.at(ijet);
432 if(csvs.at(ijet) >
CSVCuts[1]){
433 ++(tree.fsubjets_btags().at(ipj));
449 vector<int> good_jets40 =
GetJets(sig_electrons, sig_muons, 40. , 2.4);
456 double genmetx = 0., genmety = 0.;
457 for(
size_t imc = 0; imc <
mc_final_id()->size(); ++imc){
461 if(
id==12 ||
id==14 ||
id==16 ||
id==18
462 ||
id==1000012 ||
id==1000014 ||
id==1000016
463 ||
id==1000022 ||
id==1000023 ||
id==1000025 ||
id==1000035 ||
id==1000039){
469 tree.gen_met_phi() = atan2(genmety, genmetx);
472 size_t lead_b, sub_b;
474 for(
size_t i = 0; i < good_jets.size(); ++i){
475 size_t ijet = good_jets.at(i);
478 && ijet!=lead_b && ijet!=sub_b){
482 vector<int> dirty_jets =
GetJets(vector<int>(0), vector<int>(0), 30., 5.0);
483 tree.jets_pt().resize(dirty_jets.size());
484 tree.jets_eta().resize(dirty_jets.size());
485 tree.jets_phi().resize(dirty_jets.size());
486 tree.jets_m().resize(dirty_jets.size());
487 tree.jets_pt_from_mini().resize(dirty_jets.size());
488 tree.jets_csv().resize(dirty_jets.size());
489 tree.jets_id().resize(dirty_jets.size());
490 tree.jets_islep().resize(dirty_jets.size());
491 tree.jets_gen_pt().resize(dirty_jets.size());
492 tree.jets_parton_pt().resize(dirty_jets.size());
493 tree.jets_isr_code().resize(dirty_jets.size());
495 for(
size_t idirty = 0; idirty < dirty_jets.size(); ++idirty){
496 int ijet = dirty_jets.at(idirty);
497 tree.jets_pt().at(idirty) =
jets_corr_p4().at(ijet).Pt();
498 tree.jets_eta().at(idirty) =
jets_corr_p4().at(ijet).Eta();
499 tree.jets_phi().at(idirty) =
jets_corr_p4().at(ijet).Phi();
501 tree.jets_pt_from_mini().at(idirty) =
jets_pt()->at(ijet);
504 tree.jets_islep().at(idirty) = !(find(good_jets.begin(), good_jets.end(), ijet) != good_jets.end());
505 tree.jets_gen_pt().at(idirty) =
jets_gen_pt()->at(ijet);
508 float min_dpt = numeric_limits<float>::max();
509 size_t match_jet = 0;
510 for(
size_t genjet = 0; genjet <
mc_jets_pt()->size(); ++genjet){
519 tree.jets_isr_code().at(idirty) = 0;
521 min_dpt = numeric_limits<float>::max();
524 for(
size_t mc = 0; mc < parts.size(); ++mc){
525 float dpt = fabs(parts.at(mc).momentum_.Pt() -
jets_parton_pt()->at(ijet));
531 if(min_dpt != numeric_limits<float>::max()){
532 if(
FromTop(match_mc, parts, moms)){
533 tree.jets_isr_code().at(idirty) = 1;
535 tree.jets_isr_code().at(idirty) = 2;
538 tree.jets_isr_code().at(idirty) = 3;
541 tree.jets_isr_code().at(idirty) = 3;
545 if(!tree.jets_islep().at(idirty)
546 && tree.jets_pt().at(idirty) >
MinJetPt 547 && fabs(tree.jets_eta().at(idirty))<2.4
548 && tree.jets_isr_code().at(idirty)>1.5){
549 tree.ht_isr() += tree.jets_pt().at(idirty);
553 tree.ht_isr_me() = 0.;
555 tree.ht_isr_nonme() = 0;
556 tree.n_isr_nonme() = 0;
557 vector<TLorentzVector> p4s;
558 for(
size_t i = 0; i < parts.size(); ++i){
559 if(parts.at(i).status_== 23 && !
FromTop(i, parts, moms)){
560 tree.ht_isr_me() += parts.at(i).momentum_.Pt();
564 for(
size_t j = 0; j < p4s.size() && !found; ++j){
565 if((p4s.at(j)-parts.at(i).momentum_).Vect().Mag()<0.001){
570 p4s.push_back(parts.at(i).momentum_);
571 tree.ht_isr_nonme() += parts.at(i).momentum_.Pt();
572 ++(tree.n_isr_nonme());
577 map<size_t,vector<size_t> > mu_matches, el_matches;
579 for(
unsigned ijet(0); ijet<
jets_corr_p4().size(); ijet++) {
583 tree.badjets_pt().push_back(
jets_corr_p4().at(ijet).Pt());
584 tree.badjets_eta().push_back(
jets_corr_p4().at(ijet).Eta());
585 tree.badjets_phi().push_back(
jets_corr_p4().at(ijet).Phi());
586 tree.badjets_m().push_back(
jets_corr_p4().at(ijet).M());
588 tree.badjets_islep().push_back((mu_matches.find(ijet) != mu_matches.end()) || (el_matches.find(ijet) != el_matches.end()));
590 tree.nbadjets() = tree.badjets_pt().size();
593 tree.ht_isr_tru() = 0.;
595 vector<int> good_mc_jets(0);
596 for(
size_t jet = 0; jet <
mc_jets_pt()->size(); ++jet){
600 good_mc_jets.push_back(jet);
601 tree.genjets_pt().push_back(
mc_jets_pt()->at(jet));
602 tree.genjets_eta().push_back(
mc_jets_eta()->at(jet));
603 tree.genjets_phi().push_back(
mc_jets_phi()->at(jet));
605 tree.genjets_genfjet_index().push_back(-1);
615 float mindr = numeric_limits<float>::max();
617 bool found_match =
false;
618 for(
size_t mc = 0; mc < parts.size(); ++mc){
622 || part.
momentum_.Pt() <= std::numeric_limits<float>::epsilon())
continue;
632 if(
FromTop(match_mc, parts, moms)){
633 tree.genjets_isr_code().push_back(1);
635 tree.genjets_isr_code().push_back(2);
637 tree.genjets_isr_code().push_back(3);
640 tree.genjets_isr_code().push_back(3);
643 if(tree.genjets_pt().back() >
MinJetPt 644 && fabs(tree.genjets_eta().back())<2.4
645 && tree.genjets_isr_code().back()>1.5){
646 tree.ht_isr_tru() += tree.genjets_pt().back();
650 tree.min_dphi_bb() = numeric_limits<float>::max();
651 tree.max_dphi_bb() = -numeric_limits<float>::max();
652 tree.min_dr_bb() = numeric_limits<float>::max();
653 tree.max_dr_bb() = -numeric_limits<float>::max();
654 tree.min_m_bb() = numeric_limits<float>::max();
655 tree.max_m_bb() = -numeric_limits<float>::max();
656 tree.min_pt_bb() = numeric_limits<float>::max();
657 tree.max_pt_bb() = -numeric_limits<float>::max();
659 tree.min_dphi_blep() = numeric_limits<float>::max();
660 tree.max_dphi_blep() = -numeric_limits<float>::max();
661 tree.min_dr_blep() = numeric_limits<float>::max();
662 tree.max_dr_blep() = -numeric_limits<float>::max();
663 tree.min_m_blep() = numeric_limits<float>::max();
664 tree.max_m_blep() = -numeric_limits<float>::max();
665 tree.min_pt_blep() = numeric_limits<float>::max();
666 tree.max_pt_blep() = -numeric_limits<float>::max();
668 tree.min_dphi_bmet() = numeric_limits<float>::max();
669 tree.max_dphi_bmet() = -numeric_limits<float>::max();
670 tree.min_mt_bmet() = numeric_limits<float>::max();
671 tree.max_mt_bmet() = -numeric_limits<float>::max();
672 tree.min_pt_bmet() = numeric_limits<float>::max();
673 tree.max_pt_bmet() = -numeric_limits<float>::max();
674 for(
size_t ib1 = 0; ib1 < good_jets.size(); ++ib1){
675 size_t b1 = good_jets.at(ib1);
680 float dphi_blep =
DeltaPhi(vb1.Phi(), lepmax_p4.Phi());
681 if(dphi_blep < tree.min_dphi_blep()) tree.min_dphi_blep() = dphi_blep;
682 if(dphi_blep > tree.max_dphi_blep()) tree.max_dphi_blep() = dphi_blep;
683 float dr_blep = vb1.DeltaR(lepmax_p4);
684 if(dr_blep < tree.min_dr_blep()) tree.min_dr_blep() = dr_blep;
685 if(dr_blep > tree.max_dr_blep()) tree.max_dr_blep() = dr_blep;
686 float m_blep = (vb1+lepmax_p4).M();
687 if(m_blep < tree.min_m_blep()) tree.min_m_blep() = m_blep;
688 if(m_blep > tree.max_m_blep()) tree.max_m_blep() = m_blep;
689 float pt_blep = (vb1+lepmax_p4).Pt();
690 if(pt_blep < tree.min_pt_blep()) tree.min_pt_blep() = pt_blep;
691 if(pt_blep > tree.max_pt_blep()) tree.max_pt_blep() = pt_blep;
693 float dphi_bmet =
DeltaPhi(vb1.Phi(), vmet.Phi());
694 if(dphi_bmet < tree.min_dphi_bmet()) tree.min_dphi_bmet() = dphi_bmet;
695 if(dphi_bmet > tree.max_dphi_bmet()) tree.max_dphi_bmet() = dphi_bmet;
696 float mt_bmet =
GetMT(vb1.M(), vb1.Pt(), vb1.Phi(),
698 if(mt_bmet < tree.min_mt_bmet()) tree.min_mt_bmet() = mt_bmet;
699 if(mt_bmet > tree.max_mt_bmet()) tree.max_mt_bmet() = mt_bmet;
700 float pt_bmet = (vb1+vmet).Pt();
701 if(pt_bmet < tree.min_pt_bmet()) tree.min_pt_bmet() = pt_bmet;
702 if(pt_bmet > tree.max_pt_bmet()) tree.max_pt_bmet() = pt_bmet;
704 for(
size_t ib2 = ib1+1; ib2 < good_jets.size(); ++ib2){
705 size_t b2 = good_jets.at(ib2);
710 float dphi_bb =
DeltaPhi(vb1.Phi(), vb2.Phi());
711 if(dphi_bb < tree.min_dphi_bb()) tree.min_dphi_bb() = dphi_bb;
712 if(dphi_bb > tree.max_dphi_bb()) tree.max_dphi_bb() = dphi_bb;
713 float dr_bb = vb1.DeltaR(vb2);
714 if(dr_bb < tree.min_dr_bb()) tree.min_dr_bb() = dr_bb;
715 if(dr_bb > tree.max_dr_bb()) tree.max_dr_bb() = dr_bb;
716 float m_bb = (vb1+vb2).M();
717 if(m_bb < tree.min_m_bb()) tree.min_m_bb() = m_bb;
718 if(m_bb > tree.max_m_bb()) tree.max_m_bb() = m_bb;
719 float pt_bb = (vb1+vb2).Pt();
720 if(pt_bb < tree.min_pt_bb()) tree.min_pt_bb() = pt_bb;
721 if(pt_bb > tree.max_pt_bb()) tree.max_pt_bb() = pt_bb;
727 int it1 = -1, it2 = -1;
729 for(
unsigned i = 0; i <
mc_doc_id()->size(); ++i){
730 const int id =
static_cast<int>(floor(fabs(
mc_doc_id()->at(i))+0.5));
731 const int mom =
static_cast<int>(floor(fabs(
mc_doc_mother_id()->at(i))+0.5));
736 if(
mc_doc_status()->at(i)==23 &&
id!=6 && mom!=6 && mom!=24 && gmom!=6 && ggmom!=6) nisr++;
738 tree.trutop1_pt() = toppt1;
739 tree.trutop2_pt() = toppt2;
740 tree.trutop1_phi() = topphi1;
741 tree.trutop2_phi() = topphi2;
744 if(it1>=0 && it2>=0){
746 TLorentzVector p4_top1, p4_top2;
751 TLorentzVector sum = p4_top1+p4_top2;
752 TLorentzVector diff = p4_top1-p4_top2;
753 tree.tru_tt_m() = sum.M();
754 tree.tru_tt_pt() = sum.Pt();
755 tree.tru_tt_ptdiff() = diff.Pt();
758 size_t ig1 = 0, ig2 = 0;
759 bool found_g1 =
false, found_g2 =
false;
760 for(
size_t it = parts.size()-1; it < parts.size() && !(found_g1 && found_g2); --it){
761 if(parts.at(it).id_ == 1000021 && parts.at(it).mom_ != 1000021){
771 if(found_g1 && found_g2){
772 tree.tru_gluglu_dphi() =
DeltaPhi(parts.at(ig1).momentum_.Phi(), parts.at(ig2).momentum_.Phi());
773 TLorentzVector sum = parts.at(ig1).momentum_+parts.at(ig2).momentum_;
774 TLorentzVector diff = parts.at(ig1).momentum_-parts.at(ig2).momentum_;
775 tree.tru_gluglu_m() = sum.M();
776 tree.tru_gluglu_pt() = sum.Pt();
777 tree.tru_gluglu_ptdiff() = diff.Pt();
780 size_t in1 = 0, in2 = 0;
781 bool found_n1 =
false, found_n2 =
false;
782 for(
size_t it = 0; it < parts.size() && !(found_n1 && found_n2); ++it){
783 if(parts.at(it).id_ != 1000022 || parts.at(it).mom_ != 1000021)
continue;
792 tree.glu_proj_frac().clear();
793 if(found_n1 && found_n2){
794 tree.dphi_neutralinos() =
DeltaPhi(parts.at(in1).momentum_.Phi(), parts.at(in2).momentum_.Phi());
795 if(in2+2 < parts.size()
796 && abs(parts.at(in1+1).id_)==6 && parts.at(in1+1).mom_==1000021
797 && abs(parts.at(in1+2).id_)==6 && parts.at(in1+2).mom_==1000021
798 && abs(parts.at(in2+1).id_)==6 && parts.at(in2+1).mom_==1000021
799 && abs(parts.at(in2+2).id_)==6 && parts.at(in2+2).mom_==1000021){
802 if(ig1<parts.size() && ig2<parts.size()){
803 const TLorentzVector &vg1 = parts.at(ig1).momentum_;
804 const TLorentzVector &vg2 = parts.at(ig2).momentum_;
805 TLorentzVector vs1 = parts.at(in1).momentum_ + parts.at(in1+1).momentum_ + parts.at(in1+2).momentum_;
806 TLorentzVector vs2 = parts.at(in2).momentum_ + parts.at(in2+1).momentum_ + parts.at(in2+2).momentum_;
807 float dra1 = vg1.DeltaR(vs1);
808 float dra2 = vg2.DeltaR(vs2);
809 float drb1 = vg1.DeltaR(vs2);
810 float drb2 = vg2.DeltaR(vs1);
817 TLorentzVector vstemp = vs2;
821 TVector2 v2g1(vg1.Vect().XYvector().Unit());
822 TVector2 v2g2(vg2.Vect().XYvector().Unit());
823 double proj1[3], proj2[3];
824 double sum1 = 0., sum2 = 0.;
825 tree.glu_proj_frac() = vector<float>(2, 0.);
826 for(
size_t i = 0; i < 3; ++i){
827 proj1[i] = v2g1.Px()*parts.at(in2+i).momentum_.Px()+v2g1.Py()*parts.at(in2+i).momentum_.Py();
828 proj2[i] = v2g2.Px()*parts.at(in1+i).momentum_.Px()+v2g2.Py()*parts.at(in1+i).momentum_.Py();
829 sum1 += fabs(proj1[i]);
830 sum2 += fabs(proj2[i]);
831 if(proj1[i]>0.) tree.glu_proj_frac().at(0) += proj1[i];
832 if(proj2[i]>0.) tree.glu_proj_frac().at(1) += proj2[i];
834 tree.glu_proj_frac().at(0)/=sum1;
835 tree.glu_proj_frac().at(1)/=sum2;
837 vector<TLorentzVector> vs;
838 vs.push_back(parts.at(in1).momentum_);
839 vs.push_back(parts.at(in1+1).momentum_);
840 vs.push_back(parts.at(in1+2).momentum_);
841 vs.push_back(parts.at(in2).momentum_);
842 vs.push_back(parts.at(in2+1).momentum_);
843 vs.push_back(parts.at(in2+2).momentum_);
850 vector<bool> mj_jets_islep;
851 for(
unsigned ijet(0); ijet<
jets_corr_p4().size(); ijet++) {
852 if(mu_matches.find(ijet) != mu_matches.end() || el_matches.find(ijet) != el_matches.end()){
853 mj_jets.push_back(static_cast<int>(ijet));
854 mj_jets_islep.push_back(
true);
866 for(
unsigned ijet(0); ijet<good_jets.size(); ijet++) {
867 mj_jets.push_back(static_cast<int>(ijet));
868 mj_jets_islep.push_back(
false);
872 tree.fjets_pt(), tree.fjets_eta(),
873 tree.fjets_phi(), tree.fjets_m(),
875 tree.fjets_sumcsv(), tree.fjets_poscsv(),
876 tree.fjets_btags(), tree.jets_fjet_index(),
879 tree.fjets08_pt(), tree.fjets08_eta(),
880 tree.fjets08_phi(), tree.fjets08_m(),
881 tree.fjets08_nconst(),
882 tree.fjets08_sumcsv(), tree.fjets08_poscsv(),
883 tree.fjets08_btags(), tree.jets_fjet08_index(),
886 tree.fjets15_pt(), tree.fjets15_eta(),
887 tree.fjets15_phi(), tree.fjets15_m(),
888 tree.fjets15_nconst(),
889 tree.fjets15_sumcsv(), tree.fjets15_poscsv(),
890 tree.fjets15_btags(), tree.jets_fjet15_index(),
892 vector<float> genfjets_csv(tree.genfjets_pt().size());
893 vector<int> genfjets_btags(tree.genfjets_pt().size());
895 tree.genfjets_pt(), tree.genfjets_eta(),
896 tree.genfjets_phi(), tree.genfjets_m(),
897 tree.genfjets_nconst(),
898 genfjets_csv, genfjets_csv,
899 genfjets_btags, tree.genjets_genfjet_index(),
900 1.2, good_mc_jets,
true);
902 WriteTks(tree, parts, moms, lepmax_chg, lepmax_chg_reliso, sigleps, primary_lep, primary_lep_reliso);
911 TString type = tree.Type();
912 TString root_version = gROOT->GetVersion();
913 TString root_tutorial_dir = gROOT->GetTutorialsDir();
914 TTree treeglobal(
"treeglobal",
"treeglobal");
915 treeglobal.Branch(
"nev_file", &num_entries);
916 treeglobal.Branch(
"nev_sample", &num_total_entries);
917 treeglobal.Branch(
"commit", &commit);
918 treeglobal.Branch(
"model", &model);
919 treeglobal.Branch(
"type", &type);
920 treeglobal.Branch(
"root_version", &root_version);
921 treeglobal.Branch(
"root_tutorial_dir", &root_tutorial_dir);
932 vector<float> &fjets_pt,
933 vector<float> &fjets_eta,
934 vector<float> &fjets_phi,
935 vector<float> &fjets_m,
936 vector<int> &fjets_nconst,
937 vector<float> &fjets_sumcsv,
938 vector<float> &fjets_poscsv,
939 vector<int> &fjets_btags,
940 vector<int> &jets_fjet_index,
942 const vector<int> &jets,
945 const vector<bool> &to_clean){
946 vector<PseudoJet> sjets(0);
947 vector<int> ijets(0);
948 vector<float> csvs(0);
949 jets_fjet_index = vector<int>(jets.size(), -1);
952 for(
size_t idirty = 0; idirty<jets.size(); ++idirty){
953 int jet = jets.at(idirty);
957 const PseudoJet this_pj(v.Px(), v.Py(), v.Pz(), v.E());
958 sjets.push_back(this_pj);
959 ijets.push_back(idirty);
963 for(
size_t idirty = 0; idirty<jets.size(); ++idirty){
965 int jet = jets.at(idirty);
968 || (clean && to_clean.at(idirty)))
continue;
970 const PseudoJet this_pj(this_lv.Px(), this_lv.Py(), this_lv.Pz(), this_lv.E());
972 sjets.push_back(this_pj);
973 ijets.push_back(idirty);
978 JetDefinition jet_def(antikt_algorithm, radius);
979 ClusterSequence cs(sjets, jet_def);
980 vector<PseudoJet> fjets =
sorted_by_m(cs.inclusive_jets());
983 fjets_pt.resize(fjets.size());
984 fjets_eta.resize(fjets.size());
985 fjets_phi.resize(fjets.size());
986 fjets_m.resize(fjets.size());
987 fjets_nconst.resize(fjets.size());
988 fjets_sumcsv.resize(fjets.size());
989 fjets_poscsv.resize(fjets.size());
990 fjets_btags.resize(fjets.size());
992 for(
size_t ipj = 0; ipj < fjets.size(); ++ipj){
993 const PseudoJet &pj = fjets.at(ipj);
994 fjets_pt.at(ipj) = pj.pt();
995 fjets_eta.at(ipj) = pj.eta();
996 fjets_phi.at(ipj) = pj.phi_std();
997 fjets_m.at(ipj) = pj.m();
998 const vector<PseudoJet> &cjets = pj.constituents();
999 fjets_nconst.at(ipj) = cjets.size();
1002 fjets_btags.at(ipj) = 0;
1003 fjets_sumcsv.at(ipj) = 0.;
1004 fjets_poscsv.at(ipj) = 0.;
1005 for(
size_t ijet = 0; ijet < ijets.size(); ++ijet){
1006 size_t i = ijets.at(ijet);
1007 for(
size_t cjet = 0; cjet < cjets.size(); ++ cjet){
1008 if((cjets.at(cjet) - sjets.at(ijet)).pt() < 0.0001){
1009 jets_fjet_index.at(i) = ipj;
1010 fjets_sumcsv.at(ipj) += csvs.at(ijet);
1011 if(csvs.at(ijet) > 0.){
1012 fjets_poscsv.at(ipj) += csvs.at(ijet);
1014 if(csvs.at(ijet) >
CSVCuts[1]){
1015 ++(fjets_btags.at(ipj));
1024 const vector<mc_particle> &parts,
1025 const vector<size_t> &moms,
1027 short lepmax_chg_reliso,
1028 const vector<size_t> &sigleps,
1030 size_t primary_lep_reliso){
1032 tree.ntks_chg() = 0;
1033 tree.ntks_chg_reliso() = 0;
1034 for(
size_t cand = 0; cand <
pfcand_pt()->size(); ++cand){
1039 int absid = abs(TMath::Nint(
pfcand_pdgId()->at(cand)));
1040 bool islep = ((absid == 11) || (absid == 13));
1041 if (
pfcand_charge()->at(cand)==0 || pfcand_fromPV()->at(cand)<0 ||
1044 TLorentzVector vcand;
1047 tree.tks_pt().push_back(
pfcand_pt()->at(cand));
1048 tree.tks_eta().push_back(
pfcand_eta()->at(cand));
1049 tree.tks_phi().push_back(
pfcand_phi()->at(cand));
1050 tree.tks_id().push_back(TMath::Nint(
pfcand_pdgId()->at(cand)));
1053 tree.tks_from_pv().push_back(TMath::Nint(pfcand_fromPV()->at(cand)));
1055 tree.tks_dxy().push_back(pfcand_dxy()->at(cand));
1056 tree.tks_dz().push_back(pfcand_dz()->at(cand));
1059 tree.tks_tru_id().push_back(ipart<parts.size()?parts.at(ipart).id_:0);
1060 tree.tks_tru_dr().push_back(ipart<parts.size()
1061 ?vcand.DeltaR(parts.at(ipart).momentum_)
1063 tree.tks_tru_dp().push_back(ipart<parts.size()
1064 ?(vcand-parts.at(ipart).momentum_).Vect().Mag()
1066 tree.tks_from_w().push_back(
FromW(ipart, parts, moms));
1067 tree.tks_from_tau().push_back(
FromTau(ipart, parts, moms));
1068 tree.tks_from_taulep().push_back(
FromTauLep(ipart, parts, moms));
1069 tree.tks_from_tauhad().push_back(tree.tks_from_tau().back()
1070 && !tree.tks_from_taulep().back());
1072 tree.tks_charge().push_back(TMath::Nint(
pfcand_charge()->at(cand)));
1073 if(cand == primary_lep){
1074 tree.tks_is_primary().push_back(
true);
1076 tree.tks_is_primary().push_back(
false);
1078 if(cand == primary_lep_reliso){
1079 tree.tks_is_primary_reliso().push_back(
true);
1081 tree.tks_is_primary_reliso().push_back(
false);
1083 if(find(sigleps.begin(), sigleps.end(), cand)!=sigleps.end()){
1084 tree.tks_is_sig_lep().push_back(
true);
1086 tree.tks_is_sig_lep().push_back(
false);
1091 if(!tree.tks_is_primary().back() && tree.tks_mt().back()<90.){
1092 bool pass_iso, pass_pt;
1094 switch(abs(tree.tks_id().back())){
1096 pass_pt = (tree.tks_pt().back() > 5.);
1097 pass_iso = (tree.tks_pt().back()*(tree.tks_mini_ch().back()+tree.tks_mini_ne().back()) < 10.);
1101 pass_pt = (tree.tks_pt().back() > 5.);
1102 pass_iso = (tree.tks_pt().back()*(tree.tks_mini_ch().back()+tree.tks_mini_ne().back()) < 30.);
1106 pass_pt = (tree.tks_pt().back() > 10.);
1107 pass_iso = (tree.tks_pt().back()*tree.tks_mini_ch().back() < 2.5);
1112 if(pass_pt && pass_iso){
1114 if(
Sign(tree.tks_id().back())*lepmax_chg*chg_mult<0){
1115 ++(tree.ntks_chg());
1117 if(
Sign(tree.tks_id().back())*lepmax_chg_reliso*chg_mult<0){
1118 ++(tree.ntks_chg_reliso());
1126 double bignum = std::numeric_limits<double>::max();
1127 switch(ParticleType){
1129 tree.els_reliso_r01().push_back(
GetMiniIsolation(ParticleType, ilep, 0.1, 0.1));
1130 tree.els_reliso_r015().push_back(
GetMiniIsolation(ParticleType, ilep, 0.15, 0.15));
1131 tree.els_reliso_r02().push_back(
GetMiniIsolation(ParticleType, ilep, 0.2, 0.2));
1132 tree.els_reliso_r03().push_back(
GetMiniIsolation(ParticleType, ilep, 0.3, 0.3));
1133 tree.els_reliso_r04().push_back(
GetMiniIsolation(ParticleType, ilep, 0.4, 0.4));
1134 tree.els_miniso_10().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, bignum));
1135 tree.els_miniso_tr10().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, 0.2));
1136 tree.els_miniso_10_ch().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, bignum,
false,
false));
1137 tree.els_miniso_tr10_ch().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, 0.2,
false,
false));
1140 tree.mus_reliso_r01().push_back(
GetMiniIsolation(ParticleType, ilep, 0.1, 0.1));
1141 tree.mus_reliso_r015().push_back(
GetMiniIsolation(ParticleType, ilep, 0.15, 0.15));
1142 tree.mus_reliso_r02().push_back(
GetMiniIsolation(ParticleType, ilep, 0.2, 0.2));
1143 tree.mus_reliso_r03().push_back(
GetMiniIsolation(ParticleType, ilep, 0.3, 0.3));
1144 tree.mus_reliso_r04().push_back(
GetMiniIsolation(ParticleType, ilep, 0.4, 0.4));
1145 tree.mus_miniso_10().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, bignum));
1146 tree.mus_miniso_tr10().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, 0.2));
1147 tree.mus_miniso_10_ch().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, bignum,
false,
false));
1148 tree.mus_miniso_tr10_ch().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, 0.2,
false,
false));
1151 tree.tks_r05_ch().push_back(
GetMiniIsolation(ParticleType, ilep, 0.5, 0.5,
false,
false,
true));
1152 tree.tks_r04_ch().push_back(
GetMiniIsolation(ParticleType, ilep, 0.4, 0.4,
false,
false,
true));
1153 tree.tks_r03_ch().push_back(
GetMiniIsolation(ParticleType, ilep, 0.3, 0.3,
false,
false,
true));
1154 tree.tks_r02_ch().push_back(
GetMiniIsolation(ParticleType, ilep, 0.2, 0.2,
false,
false,
true));
1155 tree.tks_mini_ch().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, bignum,
false,
false,
true));
1156 tree.tks_r05_ne().push_back(
GetMiniIsolation(ParticleType, ilep, 0.5, 0.5,
true,
true,
false));
1157 tree.tks_r04_ne().push_back(
GetMiniIsolation(ParticleType, ilep, 0.4, 0.4,
true,
true,
false));
1158 tree.tks_r03_ne().push_back(
GetMiniIsolation(ParticleType, ilep, 0.3, 0.3,
true,
true,
false));
1159 tree.tks_r02_ne().push_back(
GetMiniIsolation(ParticleType, ilep, 0.2, 0.2,
true,
true,
false));
1160 tree.tks_mini_ne().push_back(
GetMiniIsolation(ParticleType, ilep, 0.05, bignum,
true,
true,
false));
1166 const double pt_cut,
1167 const double bTag_req,
1168 const bool use_W_mass)
const{
1170 for (uint ijet(0); ijet<good_jets.size(); ijet++) {
1171 uint jet = good_jets[ijet];
1176 if (mT<min_mT) min_mT=mT;
1183 const vector<size_t> &moms){
1185 unsigned sample_code = 0xF;
1188 }
else if(
Contains(sample_name,
"TTJets")
1191 }
else if(
Contains(sample_name,
"WJets")){
1193 }
else if(
Contains(sample_name,
"T_s-channel")
1194 ||
Contains(sample_name,
"T_tW-channel")
1195 ||
Contains(sample_name,
"T_t-channel")
1196 ||
Contains(sample_name,
"Tbar_s-channel")
1197 ||
Contains(sample_name,
"Tbar_tW-channel")
1198 ||
Contains(sample_name,
"Tbar_t-channel")){
1200 }
else if(
Contains(sample_name,
"QCD")){
1202 }
else if(
Contains(sample_name,
"DY")){
1207 unsigned nlep, ntau, ntaul;
1209 if(nlep > 0xF) nlep = 0xF;
1210 if(ntau > 0xF) ntau = 0xF;
1211 if(ntaul > 0xF) ntaul = 0xF;
1212 return (sample_code << 12) | (nlep << 8) | (ntaul << 4) | ntau;
1217 vector<int> &true_had_taus, vector<int> &true_lep_taus) {
1218 true_electrons.clear();
1220 true_had_taus.clear();
1221 true_lep_taus.clear();
1222 bool tau_to_3tau(
false);
1223 vector<int> lep_from_tau;
1224 for(
unsigned i = 0; i <
mc_doc_id()->size(); ++i){
1225 const int id =
static_cast<int>(floor(fabs(
mc_doc_id()->at(i))+0.5));
1226 const int mom =
static_cast<int>(floor(fabs(
mc_doc_mother_id()->at(i))+0.5));
1229 if((
id == 11 ||
id == 13) && (mom == 24 || (mom == 15 && (gmom == 24 || (gmom == 15 && ggmom == 24))))){
1231 if (
id==11) true_electrons.push_back(i);
1232 else if (
id==13) true_muons.push_back(i);
1233 }
else if(!tau_to_3tau) {
1235 for(uint j=i+1; j<
mc_doc_id()->size(); ++j) {
1236 const int idb =
static_cast<int>(floor(fabs(
mc_doc_id()->at(j))+0.5));
1237 const int momb =
static_cast<int>(floor(fabs(
mc_doc_mother_id()->at(j))+0.5));
1238 if(momb==15 && (idb==11 || idb==13)) nlep++;
1239 if(momb!=15 || (momb==15&&idb==16) || j==
mc_doc_id()->size()-1){
1243 lep_from_tau.push_back(i);
1251 if(
id == 15 && mom == 24){
1252 true_had_taus.push_back(i);
1255 if((
id == 15) && (mom == 15 && (gmom == 24 || (gmom == 15 && ggmom == 24)))){
1257 for(uint j=i+1; j<
mc_doc_id()->size(); ++j) {
1258 const int idb =
static_cast<int>(floor(fabs(
mc_doc_id()->at(j))+0.5));
1259 const int momb =
static_cast<int>(floor(fabs(
mc_doc_mother_id()->at(j))+0.5));
1260 if(momb==15 && idb==15) nlep++;
1261 if(momb!=15 || (momb==15&&idb==16) || j==
mc_doc_id()->size()-1){
1262 if(nlep>1) tau_to_3tau =
true;
1270 for(
unsigned ind = 0; ind < lep_from_tau.size(); ++ind){
1271 float minDr(9999.), lepEta(
mc_doc_eta()->at(lep_from_tau[ind])), lepPhi(
mc_doc_phi()->at(lep_from_tau[ind]));
1273 for(
unsigned itau=0; itau < true_had_taus.size(); itau++){
1275 float tauEta(
mc_doc_eta()->at(true_had_taus[itau])), tauPhi(
mc_doc_phi()->at(true_had_taus[itau]));
1276 float tauDr(
dR(tauEta,lepEta, tauPhi,lepPhi));
1283 true_lep_taus.push_back(imintau);
1284 true_had_taus.erase(true_had_taus.begin()+imintau);
1285 }
else cout<<
"Not found a tau match for lepton "<<ind<<endl;
1291 return a.m() > b.m();
1295 sort(pjs.begin(), pjs.end(),
greater_m);
std::vector< float > *const & els_pt() const
void GetTrueLeptons(std::vector< int > &true_electrons, std::vector< int > &true_muons, std::vector< int > &true_had_taus, std::vector< int > &true_lep_taus)
std::vector< float > *const & mc_doc_energy() const
std::vector< float > *const & els_pz() const
virtual void GetEntry(const long entry)
const std::string & SampleName() const
static int GetMom(float id, float mom, float gmom, float ggmom, bool &fromW)
static bool FromTop(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
std::vector< float > *const & els_eta() const
std::vector< float > *const & mus_tk_d0dum() const
std::vector< float > *const & mc_jets_mass() const
bool GetTriggerInfo(std::vector< TString > &trig_names, std::vector< bool > &trig_dec, std::vector< float > &trig_prescale)
long double GetMT(long double m1, long double pt1, long double phi1, long double m2, long double pt2, long double phi2)
bool IsSignalElectron(unsigned iel, bool mini=true) const
std::vector< float > *const & PU_TrueNumInteractions() const
static float MinSignalLeptonPt
std::vector< float > *const & mus_tk_vz() const
int GetTrueElectron(int index, int &momID, bool &fromW, float &closest_dR, double &els_mc_pt, double &els_mc_phi) const
void SetMiniIso(small_tree_full &tree, int ilep, int ParticleType)
std::vector< float > *const & els_energy() const
void WriteFatJets(int &nfjets, float &mj, std::vector< float > &fjets_pt, std::vector< float > &fjets_eta, std::vector< float > &fjets_phi, std::vector< float > &fjets_m, std::vector< int > &fjets_nconst, std::vector< float > &fjets_sumcsv, std::vector< float > &fjets_poscsv, std::vector< int > &fjets_btags, std::vector< int > &jets_fjet_index, double radius, const std::vector< int > &jets, bool gen=false, bool clean=false, const std::vector< bool > &to_clean=std::vector< bool >(0))
float GetMinMTWb(const std::vector< int > &good_jets, const double pt_cut, const double bTag_req, const bool use_W_mass) const
std::vector< float > *const & jets_parton_Id() const
std::vector< float > *const & pfcand_pdgId() const
bool Contains(const std::string &text, const std::string &pattern)
std::vector< float > *const & mc_doc_id() const
std::vector< int > *const & PU_NumInteractions() const
double GetMiniIsolation(int particle_type, int ilep, double riso_min=0.05, double riso_max=0.2, bool add_ph=true, bool add_nh=true, bool add_ch=true, bool use_pf_weight=false, double kt_scale=10.) const
std::vector< float > *const & mc_final_pt() const
static std::vector< size_t > GetMoms(const std::vector< mc_particle > &parts)
std::vector< float > *const & pv_y() const
std::vector< int > *const & PU_bunchCrossing() const
std::vector< float > *const & pv_x() const
std::vector< float > *const & mus_charge() const
float met_phi_corr() const
void WriteTks(small_tree_full &tree, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms, short lepmax_chg, short lepmax_chg_reliso, const std::vector< size_t > &sigleps, size_t primary_lep, size_t primary_lep_reliso)
std::vector< float > *const & els_px() const
std::vector< float > *const & jets_pt() const
bool IsVetoIdElectron(unsigned iel, bool do_iso=false) const
std::vector< float > *const & mc_doc_pt() const
static unsigned NumChildren(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms, bool req_chg=false)
std::vector< float > *const & els_vz() const
event_handler_full(const std::string &file_name)
size_t GetNumJets(const std::vector< int > &good_jets, double pt_cut=0.0, double csv_cut=-std::numeric_limits< float >::max()) const
bool IsBasicJet(unsigned ijet) const
static std::vector< fastjet::PseudoJet > sorted_by_m(std::vector< fastjet::PseudoJet > pjs)
std::string execute(const std::string &cmd)
float GetMuonIsolation(unsigned imu, bool mini=true) const
UInt_t const & event() const
double GetMinDeltaPhiMETN(unsigned maxjets, float mainpt, float maineta, float otherpt, float othereta, bool useArcsin) const
std::vector< float > *const & els_d0dum() const
std::vector< float > *const & mc_final_id() const
bool IsSignalIdMuon(unsigned iel) const
size_t MatchCandToStatus1(size_t icand, const std::vector< mc_particle > &parts) const
std::vector< float > *const & mus_pt() const
void GetMatchedLeptons(const std::vector< int > &veto_mu, const std::vector< int > &veto_el, std::map< size_t, std::vector< size_t > > &mu_matches, std::map< size_t, std::vector< size_t > > &el_matches) const
std::vector< float > *const & pfcand_charge() const
std::vector< float > *const & jets_parton_pt() const
bool IsSignalMuon(unsigned imu, bool mini=true) const
static bool greater_m(const fastjet::PseudoJet &a, const fastjet::PseudoJet &b)
unsigned TypeCode(const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
bool hasPFMatch(int index, particleId::leptonType type, int &pfIdx) const
static bool FromStatus23(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
static void CountLeptons(const std::vector< mc_particle > &parts, const std::vector< size_t > &moms, unsigned &nleps, unsigned &ntaus, unsigned &ntauleps)
UInt_t const & run() const
std::vector< int > GetJets(const std::vector< int > &VetoEl, const std::vector< int > &VetoMu, double pt_thresh, double eta_thresh) const
std::vector< float > *const & mc_doc_eta() const
std::vector< float > *const & pfcand_energy() const
float cross_section(const TString &file)
bool IsVetoMuon(unsigned imu, bool mini=true) const
std::vector< float > *const & mus_tk_phi() const
static float MinVetoLeptonPt
std::vector< float > *const & pv_z() const
std::vector< float > *const & jets_btag_inc_secVertexCombined() const
std::vector< float > *const & mc_final_phi() const
std::vector< mc_particle > GetMCParticles() const
std::vector< float > *const & els_dz() const
std::vector< int > GetMuons(bool doSignal=true, bool mini=true) const
std::vector< float > *const & mc_doc_status() const
std::vector< Jet > GetSubtractedJets(const std::vector< int > &veto_el, const std::vector< int > &veto_mu, double pt_thresh, double eta_thresh) const
std::vector< float > *const & mc_doc_phi() const
float dR(float eta1, float eta2, float phi1, float phi2)
bool IsSignalIdElectron(unsigned iel, bool do_iso=false) const
std::vector< float > *const & pfcand_eta() const
std::vector< float > *const & els_py() const
std::vector< int > GetElectrons(bool doSignal=true, bool mini=true) const
std::vector< float > *const & mus_px() const
std::vector< float > *const & mus_energy() const
virtual void ReduceTree(int num_entries, const TString &out_file_name, int num_total_entries)
std::string *const & model_params() const
std::vector< float > *const & mus_eta() const
std::vector< float > *const & mus_phi() const
bool PassesJSONCut(TString type)
std::string RemoveTrailingNewlines(std::string str)
virtual ~event_handler_full()
void GetLeadingBJets(const std::vector< int > &good_jets, double pt_cut, double csv_cut, size_t &lead, size_t &sub)
std::vector< float > *const & mc_doc_ggrandmother_id() const
double GetMHT(const std::vector< int > &good_jets, double pt_cut) const
std::vector< float > *const & els_scEta() const
std::vector< float > *const & mc_jets_phi() const
std::vector< float > *const & mc_jets_eta() const
bool IsVetoElectron(unsigned iel, bool mini=true) const
std::vector< float > *const & mus_py() const
std::vector< float > *const & mc_doc_grandmother_id() const
std::vector< float > *const & pfcand_pt() const
std::vector< float > *const & mus_tk_dz() const
std::vector< float > *const & mc_jets_pt() const
UInt_t const & lumiblock() const
std::vector< float > *const & mc_doc_mother_id() const
const std::vector< TLorentzVector > & jets_corr_p4() const
std::vector< float > *const & jets_gen_pt() const
static bool FromTau(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
bool IsVetoIdMuon(unsigned iel) const
long double DeltaPhi(long double phi1, long double phi2)
std::vector< bool > *const & els_isPF() const
std::vector< float > *const & mus_pz() const
std::vector< float > *const & els_phi() const
std::vector< float > *const & pfcand_phi() const
UInt_t const & Npv() const
static unsigned ParentTauDescendants(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
static bool FromTauLep(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
float GetElectronIsolation(unsigned iel, bool mini=true) const
static double GetSphericity(const std::vector< TLorentzVector > &vs)
int GetTrueMuon(int index, int &momID, bool &fromW, float &closest_dR, double &mus_mc_pt, double &mus_mc_phi) const
std::vector< float > *const & els_tk_phi() const
double GetHT(const std::vector< int > &good_jets, double pt_cut=0.0) const
std::vector< float > *const & els_charge() const
std::vector< float > *const & mc_jets_energy() const
Float_t const & weight() const
long double AddInQuadrature(long double x, long double y)
static bool FromW(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)