21 #include "TLorentzVector.h" 35 const float fltmax = numeric_limits<float>::max();
55 cfa(fileName, is_8TeV),
60 met_phi_corr_(bad_val){
62 jec_files.push_back(
"txt/jec/phys14_v4_mc/PHYS14_V4_MC_L1FastJet_AK4PFchs.txt");
63 jec_files.push_back(
"txt/jec/phys14_v4_mc/PHYS14_V4_MC_L2Relative_AK4PFchs.txt");
64 jec_files.push_back(
"txt/jec/phys14_v4_mc/PHYS14_V4_MC_L3Absolute_AK4PFchs.txt");
68 jec_files.push_back(
"txt/jec/summer15_v3/Summer15_50nsV3_DATA_L1FastJet_AK4PFchs.txt");
70 jec_files.push_back(
"txt/jec/summer15_v3/Summer15_50nsV3_DATA_L2Relative_AK4PFchs.txt");
71 jec_files.push_back(
"txt/jec/summer15_v3/Summer15_50nsV3_DATA_L3Absolute_AK4PFchs.txt");
72 jec_files.push_back(
"txt/jec/summer15_v3/Summer15_50nsV3_DATA_L2L3Residual_AK4PFchs.txt");
73 }
else if(
SampleName().rfind(
"50ns") != std::string::npos){
74 jec_files.push_back(
"txt/jec/summer15_v3/Summer15_50nsV3_MC_L1FastJet_AK4PFchs.txt");
76 jec_files.push_back(
"txt/jec/summer15_v3/Summer15_50nsV3_MC_L2Relative_AK4PFchs.txt");
77 jec_files.push_back(
"txt/jec/summer15_v3/Summer15_50nsV3_MC_L3Absolute_AK4PFchs.txt");
100 vector<float> &trig_prescale){
101 bool want_event(
yes_trig.size()==0);
102 bool duplicate(
false);
104 trig_dec.resize(trig_names.size(),
false);
105 trig_prescale.resize(trig_names.size(), 1.);
109 for(
unsigned itn(0); itn < trig_names.size(); itn++){
110 if(trigname.Contains(trig_names[itn])){
111 trig_dec[itn] = trigdec;
117 for(
unsigned ind(0); ind<
yes_trig.size() && !want_event && !duplicate; ind++)
118 if(trigname.Contains(
yes_trig[ind])) want_event = (want_event || trigdec);
119 for(
unsigned ind(0); ind<
no_trig.size() && !duplicate; ind++)
120 if(trigname.Contains(
no_trig[ind])) duplicate = (duplicate || trigdec);
123 return want_event&&!duplicate;
147 for(
unsigned index=0; index<
mus_pt()->size(); index++)
151 if(
IsVetoMuon(index, mini)) muons.push_back(index);
157 if(imu >=
mus_pt()->size())
return false;
164 if(imu >=
mus_pt()->size())
return false;
171 if(imu >=
mus_pt()->size())
return false;
176 return dec && fabs(
mus_eta()->at(imu))<2.4;
180 if(imu >=
mus_pt()->size())
return false;
185 return dec && fabs(
mus_eta()->at(imu))<2.4;
189 if(imu>=
mus_pt()->size())
return false;
191 bool pf_cut, global_cut, global_or_tracker_cut, globalprompttight_cut;
192 double chisq_cut, hits_cut, stations_cut, dxy_cut, dz_cut, pixel_cut, layers_cut;
206 global_or_tracker_cut =
true;
208 globalprompttight_cut =
false;
228 global_or_tracker_cut =
false;
230 globalprompttight_cut =
true;
248 return (!pf_cut || isPF)
252 && (
true || chisq_cut)
253 && (
true || hits_cut)
255 && dxy_cut > fabs(d0)
262 if(imu >=
mus_pt()->size())
return -999;
267 if(sumEt<0.0) sumEt=0.0;
279 for(
unsigned index=0; index<
els_pt()->size(); index++)
289 if(iel >=
els_pt()->size())
return false;
301 iso_cut = barrel ? 0.164369 : 0.212604;
309 if(iel >=
els_pt()->size())
return false;
316 if(iel >=
els_pt()->size())
return false;
321 if(iel >=
els_pt()->size())
return false;
326 if(iel>=
els_pt()->size())
return false;
328 if(fabs(
els_scEta()->at(iel))>2.5)
return false;
337 double deta_cut, dphi_cut, ieta_cut, hovere_cut, d0_cut, dz_cut,
338 ooeminusoop_cut, reliso_cut, misshits_cut;
344 const bool high_pt =
els_pt()->at(iel)>20.0;
348 deta_cut = barrel ? 0.007 : 0.01;
349 dphi_cut = barrel ? 0.8 : 0.7;
350 ieta_cut = barrel ? 0.01 : 0.03;
351 hovere_cut = barrel ? 0.15 :
fltmax;
352 d0_cut = barrel ? 0.04 : 0.04;
353 dz_cut = barrel ? 0.2 : 0.2;
355 reliso_cut = barrel ? 0.15 : 0.15;
357 req_conv_veto = barrel ?
true :
true;
360 deta_cut = barrel ? 0.007 : 0.009;
361 dphi_cut = barrel ? 0.15 : 0.10;
362 ieta_cut = barrel ? 0.01 : 0.03;
363 hovere_cut = barrel ? 0.12 : 0.10;
364 d0_cut = barrel ? 0.02 : 0.02;
365 dz_cut = barrel ? 0.2 : 0.2;
366 ooeminusoop_cut = barrel ? 0.05 : 0.05;
367 reliso_cut = barrel ? 0.15 : (high_pt ? 0.15 : 0.10);
368 misshits_cut = barrel ? 1 : 1;
369 req_conv_veto = barrel ?
true :
true;
372 deta_cut = barrel ? 0.004 : 0.007;
373 dphi_cut = barrel ? 0.06 : 0.03;
374 ieta_cut = barrel ? 0.01 : 0.03;
375 hovere_cut = barrel ? 0.12 : 0.1;
376 d0_cut = barrel ? 0.02 : 0.02;
377 dz_cut = barrel ? 0.1 : 0.1;
378 ooeminusoop_cut = barrel ? 0.05 : 0.05;
379 reliso_cut = barrel ? 0.15 : (high_pt ? 0.15 : 0.10);
380 misshits_cut = barrel ? 1 : 1;
381 req_conv_veto = barrel ?
true :
true;
384 deta_cut = barrel ? 0.004 : 0.005;
385 dphi_cut = barrel ? 0.03 : 0.02;
386 ieta_cut = barrel ? 0.01 : 0.03;
387 hovere_cut = barrel ? 0.12 : 0.10;
388 d0_cut = barrel ? 0.02 : 0.02;
389 dz_cut = barrel ? 0.1 : 0.1;
390 ooeminusoop_cut = barrel ? 0.05 : 0.05;
391 reliso_cut = barrel ? 0.10 : (high_pt ? 0.10 : 0.07);
392 misshits_cut = barrel ? 1 : 0;
393 req_conv_veto = barrel ?
true :
true;
401 ieta_cut =
chooseVal(threshold, 0.012, 0.0105, 0.0101, 0.0101 );
402 deta_cut =
chooseVal(threshold, 0.0126, 0.00976, 0.0094, 0.0095 );
403 dphi_cut =
chooseVal(threshold, 0.107, 0.0929, 0.0296, 0.0291 );
404 hovere_cut =
chooseVal(threshold, 0.186, 0.0765, 0.0372, 0.0372 );
405 reliso_cut =
chooseVal(threshold, 0.161, 0.118, 0.0987, 0.0468 );
406 ooeminusoop_cut =
chooseVal(threshold, 0.239, 0.184, 0.118, 0.0174 );
407 d0_cut =
chooseVal(threshold, 0.0621, 0.0227, 0.0151, 0.0144 );
408 dz_cut =
chooseVal(threshold, 0.613, 0.379, 0.238, 0.323 );
409 misshits_cut =
chooseVal(threshold, 2, 2, 2, 2 );
410 req_conv_veto =
chooseVal(threshold,
true,
true,
true,
true );
412 ieta_cut =
chooseVal(threshold, 0.0339, 0.0318, 0.0287, 0.0287 );
413 deta_cut =
chooseVal(threshold, 0.0109, 0.00952, 0.00773, 0.00762);
414 dphi_cut =
chooseVal(threshold, 0.219, 0.181, 0.148, 0.0439 );
415 hovere_cut =
chooseVal(threshold, 0.0962, 0.0824, 0.0546, 0.0544 );
416 reliso_cut =
chooseVal(threshold, 0.193, 0.118, 0.0902, 0.0759 );
417 ooeminusoop_cut =
chooseVal(threshold, 0.141, 0.125, 0.104, 0.01 );
418 d0_cut =
chooseVal(threshold, 0.279, 0.242, 0.0535, 0.0377 );
419 dz_cut =
chooseVal(threshold, 0.947, 0.921, 0.572, 0.571 );
420 misshits_cut =
chooseVal(threshold, 3, 1, 1, 1 );
421 req_conv_veto =
chooseVal(threshold,
true,
true,
true,
true );
428 const double dz = fabs(
els_vz()->at(iel)-
pv_z()->at(0));
429 const double sigietaieta = (
Type()==
typeid(
cfa_13)
435 && ieta_cut > sigietaieta
451 if(sumEt<0.0) sumEt=0;
459 return absiso/
els_pt()->at(iel);
461 throw std::logic_error(
"Unknown type " 462 +std::string(
Type().name())
463 +
" in phys_objects::GetElectronIsolation");
474 if( SCEta < 1.0 )
return 0.110;
475 else if(SCEta < 1.479)
return 0.130;
476 else if(SCEta < 2.0 )
return 0.089;
477 else if(SCEta < 2.2 )
return 0.130;
478 else if(SCEta < 2.3 )
return 0.150;
479 else if(SCEta < 2.4 )
return 0.160;
484 if( SCEta < 1.0 )
return 0.100;
485 else if(SCEta < 1.479)
return 0.120;
486 else if(SCEta < 2.0 )
return 0.085;
487 else if(SCEta < 2.2 )
return 0.110;
488 else if(SCEta < 2.4 )
return 0.120;
497 if (
taus_pt()->at(itau) < 20.)
return false;
498 if (fabs(
taus_eta()->at(itau)) > 2.3)
512 if(itrk>=
isotk_pt()->size())
return false;
550 bool do_metcorr(
false);
553 TLorentzVector corr_p4, uncorr_p4, miniaod_p4;
556 for(
size_t ijet = 0; ijet <
jets_pt()->size(); ++ijet){
560 corr_p4 = miniaod_p4;
570 if(uncorr_p4.Pt() > 10 && do_metcorr) {
571 METx += miniaod_p4.Px();
572 METy += miniaod_p4.Py();
573 METx -= corr_p4.Px();
574 METy -= corr_p4.Py();
581 float correctedMET = sqrt(METx*METx + METy*METy);
582 float correctedMETPhi = atan2(METy,METx);
593 double pt_thresh,
double eta_thresh)
const {
595 vector<bool> jet_is_lepton(
jets_corr_p4().size(),
false);
596 map<size_t,vector<size_t> > mu_matches, el_matches;
599 for(
size_t ijet = 0; ijet <
jets_corr_p4().size(); ++ijet){
600 if(mu_matches.find(ijet) != mu_matches.end()
601 || el_matches.find(ijet) != el_matches.end()){
602 jet_is_lepton[ijet] =
true;
607 for(
unsigned ijet = 0; ijet<
jets_corr_p4().size(); ijet++) {
608 if(!
IsGoodJet(ijet, pt_thresh, eta_thresh) || jet_is_lepton[ijet])
continue;
610 jets.push_back(ijet);
617 double pt_thresh,
double eta_thresh)
const {
618 vector<bool> jet_is_lepton(
jets_corr_p4().size(),
false);
619 map<size_t,vector<size_t> > mu_matches, el_matches;
622 for(
size_t ijet = 0; ijet <
jets_corr_p4().size(); ++ijet){
623 if(mu_matches.find(ijet) != mu_matches.end()
624 || el_matches.find(ijet) != el_matches.end()){
625 jet_is_lepton[ijet] =
true;
630 for(
unsigned ijet = 0; ijet<
jets_corr_p4().size(); ijet++) {
631 if(!jet_is_lepton[ijet] &&
jets_corr_p4().at(ijet).Pt()>pt_thresh &&
641 const vector<int> &veto_el,
642 map<
size_t,vector<size_t> > &mu_matches,
643 map<
size_t,vector<size_t> > &el_matches)
const{
647 for(
size_t ivmu = 0; ivmu < veto_mu.size(); ++ivmu){
648 int imu = veto_mu.at(ivmu);
650 float mindr = numeric_limits<float>::max();
651 for(
size_t ijet = 0; mindr > 0. && ijet <
jets_corr_p4().size(); ++ijet){
664 if(mindr < 0.4) mu_matches[imatch].push_back(imu);
665 else cout<<
"mus "<<imu<<
" not matched. p = ("<<
mus_pt()->at(imu)<<
","<<
mus_eta()->at(imu)
666 <<
","<<
mus_phi()->at(imu)<<
")"<<endl;
670 for(
size_t ivel = 0; ivel < veto_el.size(); ++ivel){
671 int iel = veto_el.at(ivel);
673 float mindr = numeric_limits<float>::max();
674 for(
size_t ijet = 0; mindr > 0. && ijet <
jets_corr_p4().size(); ++ijet){
687 if(mindr < 0.4) el_matches[imatch].push_back(iel);
688 else cout<<
"els "<<iel<<
" not matched. p = ("<<
els_pt()->at(iel)<<
","<<
els_eta()->at(iel)
689 <<
","<<
els_phi()->at(iel)<<
")"<<endl;
694 double pt_thresh,
double eta_thresh)
const{
696 map<size_t,vector<size_t> > mu_matches, el_matches;
701 for(
size_t ijet = 0; ijet <
jets_corr_p4().size(); ++ijet){
706 float mindr = numeric_limits<float>::max();
708 if(mu_matches.find(ijet) != mu_matches.end()){
709 const vector<size_t> &matches = mu_matches.at(ijet);
710 for(
size_t imatch = 0; imatch < matches.size(); ++imatch){
711 size_t imu = matches.at(imatch);
715 float dr = p4mu.DeltaR(p4jet);
716 if(dr<mindr) mindr = dr;
723 if(el_matches.find(ijet) != el_matches.end()){
724 const vector<size_t> &matches = el_matches.at(ijet);
725 for(
size_t imatch = 0; imatch < matches.size(); ++imatch){
726 size_t iel = matches.at(imatch);
730 float dr = p4el.DeltaR(p4jet);
731 if(dr<mindr) mindr = dr;
739 if(fabs(p4jet.Eta())>eta_thresh || p4jet.Pt()<pt_thresh)
continue;
742 jets.push_back(
Jet());
743 jets.back().p4 = p4jet;
745 jets.back().nleps = subtracted;
747 jets.back().p4sub = p4sub;
748 jets.back().mindr = mindr;
765 const double jetenergy =
jets_energy()->at(ijet) * rawRatio;
766 double NEMF = -999., CEMF = -999., NHF=-999., CHF=-999.;
779 bool eta_leq_3 = (NHF<0.99 && NEMF<0.99 && NumConst>1) && ((fabs(eta)<=2.4 && CHF>0 && CHM>0 && CEMF<0.99) || fabs(eta)>2.4);
780 bool eta_g_3 = NEMF<0.90 && NumNeutralParticles>10;
782 return (eta_leq_3 && fabs(eta)<=3.) || (eta_g_3 && fabs(eta)>3.);
792 if(index < 0 || index >= static_cast<int>(
mus_eta()->size()))
return -1;
794 closest_deltaR = 9999.;
795 int closest_imc = -1, idLepton = 0;
796 float RecPt =
mus_pt()->at(index), RecEta =
mus_eta()->at(index), RecPhi =
mus_phi()->at(index);
799 closest_deltaR = 9999.;
800 if(closest_imc >= 0){
801 idLepton =
static_cast<int>(
mc_doc_id()->at(closest_imc));
811 for(
unsigned imc=0; imc <
mc_doc_id()->size(); imc++){
815 float deltaR =
dR(RecEta,MCEta, RecPhi,MCPhi);
816 if(deltaR < closest_deltaR) closest_deltaR = deltaR;
819 closest_imc =
GetTrueParticle(RecPt, RecEta, RecPhi, closest_deltaR, 0);
820 if(closest_imc >= 0){
821 idLepton =
static_cast<int>(
mc_doc_id()->at(closest_imc));
841 if(index < 0 || index >= static_cast<int>(
els_eta()->size()))
return -1;
843 closest_deltaR = 9999.;
844 int closest_imc = -1, idLepton = 0;
845 float RecPt =
els_pt()->at(index), RecEta =
els_eta()->at(index), RecPhi =
els_phi()->at(index);
848 closest_deltaR = 9999.;
849 if(closest_imc >= 0){
850 idLepton =
static_cast<int>(
mc_doc_id()->at(closest_imc));
860 for(
unsigned imc=0; imc <
mc_doc_id()->size(); imc++){
864 float deltaR =
dR(RecEta,MCEta, RecPhi,MCPhi);
865 if(deltaR < closest_deltaR) closest_deltaR = deltaR;
868 closest_imc =
GetTrueParticle(RecPt, RecEta, RecPhi, closest_deltaR, 0);
869 if(closest_imc >= 0){
874 idLepton =
static_cast<int>(
mc_doc_id()->at(closest_imc));
889 float &closest_deltaR,
int ID)
const {
890 const float pT_Threshold(0.3), dR_Threshold(0.1);
891 int closest_imc = -1;
892 float deltaR = 9999.; closest_deltaR = 9999.;
894 for(
unsigned imc=0; imc <
mc_doc_id()->size(); imc++){
895 if(ID!=0 && abs(
mc_doc_id()->at(imc)) != ID)
continue;
897 deltaR =
dR(RecEta,MCEta, RecPhi,MCPhi);
898 if(deltaR > dR_Threshold || abs(
mc_doc_pt()->at(imc)-RecPt)/RecPt > pT_Threshold)
continue;
899 if(deltaR < closest_deltaR && deltaR < dR_Threshold) {
900 closest_deltaR = deltaR;
908 const float ggmom,
bool &fromW){
909 const int iid = TMath::Nint(
id);
910 const int imom = TMath::Nint(mom);
911 const int igmom = TMath::Nint(gmom);
912 const int iggmom = TMath::Nint(ggmom);
915 if(imom != iid) ret_mom = imom;
916 else if(igmom != iid) ret_mom = igmom;
917 else ret_mom = iggmom;
920 fromW = abs(ret_mom)==24 || (abs(ret_mom)==15 && (abs(igmom)==24 || abs(iggmom)==24));
929 double max_pt = -1.0;
930 for(
size_t imu = 0; imu <
mus_pt()->size(); ++imu){
932 if(
mus_pt()->at(imu)>max_pt){
933 max_pt =
mus_pt()->at(imu);
938 for(
size_t iel = 0; iel <
els_pt()->size(); ++iel){
940 if(
els_pt()->at(iel)>max_pt){
941 max_pt =
els_pt()->at(iel);
947 for(
size_t imu = 0; imu <
mus_pt()->size(); ++imu){
949 if(
mus_pt()->at(imu)>max_pt){
950 max_pt =
mus_pt()->at(imu);
955 for(
size_t iel = 0; iel <
els_pt()->size(); ++iel){
957 if(
els_pt()->at(iel)>max_pt){
958 max_pt =
els_pt()->at(iel);
965 for(
size_t imu = 0; imu <
mus_pt()->size(); ++imu){
966 if(
mus_pt()->at(imu)>max_pt){
967 max_pt =
mus_pt()->at(imu);
972 for(
size_t iel = 0; iel <
els_pt()->size(); ++iel){
973 if(
els_pt()->at(iel)>max_pt){
974 max_pt =
els_pt()->at(iel);
983 vector<mc_particle> parts;
984 for(
size_t idoc = 0; idoc <
mc_doc_id()->size(); ++idoc){
998 size_t to_search = parts.size();
1000 for(
size_t ifinal = 0; ifinal <
mc_final_id()->size(); ++ifinal){
1015 for(
size_t i = 0; !skip && i < to_search; ++i){
1017 if(TMath::Nint(3.*charge) == part.
charge_ 1020 && gmom == part.
gmom_ 1022 && (v-part.
momentum_).Vect().Mag()<0.01) skip =
true;
1025 parts.push_back(
mc_particle(v, charge,
id, mom, gmom, ggmom, 0));
1061 const size_t bad_index =
static_cast<size_t>(-1);
1062 if(index >= parts.size())
return bad_index;
1066 size_t low_cousin = index, high_cousin = index;
1068 for(
size_t imc = index - 1 ; !abort && imc < parts.size(); --imc){
1081 for(
size_t imc = index + 1 ; !abort && imc < parts.size(); ++imc){
1093 float best_score = numeric_limits<float>::max();
1094 size_t best_parent = bad_index;
1096 for(
size_t imc = 0; imc < index; ++imc){
1104 for(
size_t low = low_cousin; low <= index; ++low){
1106 for(
size_t high = low; high <= high_cousin; ++high){
1109 if(high < index)
continue;
1110 float this_score = diff.Mag2();
1111 if(this_score < best_score){
1112 best_score = this_score;
1123 vector<size_t> moms(parts.size());
1124 for(
size_t imc = 0; imc < moms.size(); ++imc){
1125 moms.at(imc) =
GetMom(imc, parts);
1131 const vector<mc_particle> &parts,
1132 const vector<size_t> &moms){
1133 if(index >= moms.size() || moms.at(index) >= moms.size())
return false;
1136 if(abs(
id) != 11 && abs(
id) != 13 && abs(
id) != 15)
return false;
1137 int mom = parts.at(moms.at(index)).id_;
1138 if(abs(mom) != 11 && abs(mom) != 13 && abs(mom) !=15)
return false;
1141 for(low = index; low < moms.size(); --low){
1142 if(moms.at(low) != moms.at(index))
break;
1145 for(high = index; high < moms.size(); ++high){
1146 if(moms.at(high) != moms.at(index))
break;
1149 unsigned p = 0, n = 0;
1150 size_t hp = 0, hn = 0;
1151 float pp = 0, np = 0;
1152 for(
size_t i = low; i < high; ++i){
1153 float p3 = parts.at(i).momentum_.Vect().Mag2();
1154 if(parts.at(i).id_ == abs(
id)){
1160 }
else if(parts.at(i).id_ == -abs(
id)){
1169 if(((p>n &&
id > 0 && index == hp) || (n>p &&
id < 0 && index == hn))){
1177 const vector<mc_particle> &parts,
1178 const vector<size_t> &moms){
1179 if(index >= moms.size())
return false;
1181 bool found_23 =
false;
1182 while(index < moms.size() && !found_23){
1183 if(parts.at(index).status_ == 23){
1186 index = moms.at(index);
1192 const vector<mc_particle> &parts,
1193 const vector<size_t> &moms){
1194 if(index >= moms.size())
return false;
1196 bool found_top =
false;
1197 while(index < moms.size() && !found_top){
1198 if(abs(parts.at(index).id_) == 6){
1201 index = moms.at(index);
1207 const vector<mc_particle> &parts,
1208 const vector<size_t> &moms){
1209 if(index >= moms.size())
return false;
1210 if(
IsBrem(index, parts, moms))
return false;
1212 index = moms.at(index);
1213 bool found_w =
false;
1214 bool found_bad =
false;
1215 while(index < moms.size()){
1216 int id = abs(parts.at(index).id_);
1217 bool bad = (id < 11 || id >16 ) &&
id != 24;
1232 index = moms.at(index);
1238 const vector<mc_particle> &parts,
1239 const vector<size_t> &moms){
1240 if(index >= moms.size())
return false;
1241 int id = parts.at(index).id_;
1242 size_t i = moms.at(index);
1243 while(i < moms.size()){
1244 if(abs(parts.at(i).id_) == 15 &&
FromW(i, parts, moms))
return true;
1245 if(parts.at(i).id_ != id)
return false;
1252 const vector<size_t> &moms,
1255 unsigned &ntauleps){
1259 set<size_t> used_by_emu, used_by_tau;
1260 used_by_emu.insert(-1);
1261 used_by_tau.insert(-1);
1262 for(
size_t i = 0; i < parts.size(); ++i){
1263 int id = abs(parts.at(i).id_);
1264 if((
id == 11 ||
id == 13 ||
id == 15) &&
FromW(i, parts, moms)){
1265 size_t parent_w =
ParentW(i, parts, moms);
1266 if(used_by_emu.find(parent_w) == used_by_emu.end()){
1271 used_by_emu.insert(parent_w);
1277 if(used_by_tau.find(parent_w) == used_by_tau.end()){
1278 used_by_tau.insert(parent_w);
1291 const vector<mc_particle> &parts,
1292 const vector<size_t> &moms){
1293 size_t w =
static_cast<size_t>(-1);
1294 while(index < moms.size()){
1295 if(abs(parts.at(index).id_) == 24) w = index;
1296 index = moms.at(index);
1302 const vector<mc_particle> &parts,
1303 const vector<size_t> &moms){
1304 size_t tau =
static_cast<size_t>(-1);
1305 while(index < moms.size()){
1306 if(abs(parts.at(index).id_) == 15 &&
FromW(index, parts, moms)) tau = index;
1307 index = moms.at(index);
1313 const vector<mc_particle> &parts,
1314 const vector<size_t> &moms){
1315 if(index >= moms.size())
return 0;
1316 size_t parent_tau =
ParentTau(index, parts, moms);
1321 const vector<mc_particle> &parts,
1322 const vector<size_t> &moms){
1323 if(index >= moms.size())
return false;
1324 size_t parent_tau =
ParentTau(index, parts, moms);
1325 for(
size_t ilep = parts.size()-1; ilep < parts.size(); --ilep){
1327 if((abs(part.
id_) == 11 || abs(part.
id_) == 13)
1337 const vector<mc_particle> &parts,
1338 const vector<size_t> &moms,
1340 unsigned num_children = 0;
1341 for(
size_t istart = index + 1; istart < moms.size(); ++istart){
1342 if(parts.at(istart).status_ == 0
1343 && (!req_chg || parts.at(istart).charge_!=0)
1344 && moms.at(istart)==index) ++num_children;
1346 return num_children;
1350 const vector<mc_particle> &parts,
1351 const vector<size_t> &moms,
1353 unsigned num_descendants = 0;
1354 for(
size_t istart = index + 1; istart < moms.size(); ++istart){
1355 if(parts.at(istart).status_ == 0
1356 && (!req_chg || parts.at(istart).charge_!=0)
1359 return num_descendants;
1363 const vector<size_t> &moms){
1364 if(descendant <= ancestor || descendant >= moms.size())
return false;
1365 size_t i = moms.at(descendant);
1366 while(i < moms.size()){
1367 if(i == ancestor)
return true;
1379 if(
pv_ndof()->at(0)>4 && fabs(
pv_z()->at(0))<24. && pv_rho<2.0 &&
pv_isFake()->at(0)==0)
return true;
1384 bool hbhe(
false), ecalTP(
false), scrapingVeto(
false);
1392 scrapingVeto =
true;
1405 double phys_objects::getDZ(
double vx,
double vy,
double vz,
double px,
double py,
double pz,
int firstGoodVertex)
const {
1406 return vz -
pv_z()->at(firstGoodVertex)
1407 -((vx-
pv_x()->at(firstGoodVertex))*px+(vy-
pv_y()->at(firstGoodVertex))*py)*pz/(px*px+py*py);
1415 return (
SampleName().find(
"Run201") != string::npos);
1420 long double pxa =
DeltaPhi(phi_x, phi_a);
1421 long double pxb =
DeltaPhi(phi_x, phi_b);
1422 long double sdp = pxa + pxb;
1424 long double pab =
DeltaPhi(phi_a, phi_b);
1441 dpN = dp / (
PI/2.0);
1443 dpN = dp / asin(deltaT/
met_corr());
1446 dpN = dp / atan2(deltaT, static_cast<double>(
met_corr()));
1452 float otherpt,
float 1458 if(i==goodJetI)
continue;
1460 double jetres = 0.1;
1464 double deltaT = sqrt(sum)/
jets_corr_p4().at(goodJetI).Pt();
1469 float otherpt,
float othereta,
bool useArcsin)
const {
1470 double mdpN=std::numeric_limits<double>::max();
1471 unsigned nGoodJets(0);
1473 if (!
IsGoodJet(i, mainpt, maineta))
continue;
1476 if (dpN>=0&&dpN<mdpN) mdpN=dpN;
1477 if (nGoodJets>=maxjets)
break;
1484 for(
size_t i = 0; i < good_jets.size(); ++i){
1485 const double pt =
jets_corr_p4().at(good_jets.at(i)).Pt();
1486 if(pt>pt_cut) ht += pt;
1492 double px(0.), py(0.);
1493 for(
size_t ijet = 0; ijet < good_jets.size(); ++ijet){
1494 const double pt =
jets_corr_p4().at(good_jets.at(ijet)).Pt();
1505 double csv_cut)
const{
1506 size_t num_jets = 0;
1507 for(
size_t i = 0; i < good_jets.size(); ++i){
1518 double xx = 0., xy=0., yy =0.;
1519 for(
size_t iv = 0; iv < vs.size(); ++iv){
1520 const TLorentzVector &v = vs.at(iv);
1522 double inv_pt = 1./v.Pt();
1523 xx += v.Px()*v.Px()*inv_pt;
1524 xy += v.Px()*v.Py()*inv_pt;
1525 yy += v.Py()*v.Py()*inv_pt;
1571 double pt_cut,
double csv_cut,
1572 size_t &lead,
size_t &sub){
1576 float pt1 = -1., pt2 = -1.;
1577 for(
size_t i = 0; i < good_jets.size(); ++i){
1578 size_t ijet = good_jets.at(i);
std::vector< bool > *const & taus_againstMuonLoose3() const
std::vector< float > *const & els_pt() const
std::vector< float > *const & mc_doc_energy() const
std::vector< float > *const & jets_neutralHadE() const
virtual void GetEntry(const long entry)
double getDZ(double vx, double vy, double vz, double px, double py, double pz, int firstGoodVertex) const
std::vector< bool > *const & taus_byDecayModeFinding() const
std::vector< float > *const & taus_chargedIsoPtSum() const
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
static size_t ParentW(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
std::vector< TString > yes_trig
std::vector< float > *const & mus_tk_d0dum() 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 PassPhys14TauID(const int itau, const bool againstEMu, const bool mt_cut) const
bool IsSignalElectron(unsigned iel, bool mini=true) const
std::vector< float > *const & trigger_prescalevalue() const
std::vector< float > *const & els_pfIsolationR03_sumNeutralHadronEt() const
int GetTrueParticle(float RecPt, float RecEta, float RecPhi, float &closest_dR, int ID) const
Float_t const & rho_kt6PFJetsForIsolation2011() const
bool inJSON(std::vector< std::vector< int > > VRunLumi, int Run, int LS)
Int_t const & cschalofilter_decision() const
std::vector< bool > *const & mus_isMediumMuon() const
static float MinSignalLeptonPt
std::vector< bool > *const & trigger_decision() const
std::vector< float > *const & mus_tk_vz() const
FactorizedJetCorrector * jet_corrector_
int GetTrueElectron(int index, int &momID, bool &fromW, float &closest_dR, double &els_mc_pt, double &els_mc_phi) const
Int_t const & hcallaserfilter_decision() const
std::vector< float > *const & els_energy() const
std::vector< float > *const & mc_final_grandmother_id() const
std::vector< float > *const & mus_numberOfMatchedStations() const
std::vector< float > *const & jets_neutralEmE() const
std::vector< float > *const & jets_parton_Id() const
std::vector< float > *const & els_hadOverEm() const
float GetEffectiveArea(float SCEta, bool isMC) const
std::vector< float > *const & jets_rawPt() const
std::vector< float > *const & els_dPhiIn() const
std::vector< float > *const & mc_final_mother_id() const
std::vector< float > *const & els_PFchargedHadronIsoR03() const
std::vector< float > *const & mc_doc_id() const
std::vector< float > *const & pv_isFake() 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 & mus_id_GlobalMuonPromptTight() const
std::vector< float > *const & jets_chg_Mult() const
std::vector< int > *const & els_jet_ind() const
std::vector< float > *const & pv_y() const
std::vector< float > *const & jets_mu_Mult() const
std::vector< float > *const & pv_x() const
float met_phi_corr() const
static float MinRA2bJetPt
std::vector< float > *const & isotk_iso() 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_PFphotonIsoR03() const
std::vector< float > *const & mus_miniso() const
std::vector< float > *const & beamSpot_x() const
std::vector< float > *const & els_vz() const
FactorizedJetCorrector * makeJetCorrector(std::vector< std::string > &vector_of_file_names)
std::vector< float > *const & els_pfIsolationR03_sumChargedHadronPt() const
Float_t const & mets_et() const
size_t GetNumJets(const std::vector< int > &good_jets, double pt_cut=0.0, double csv_cut=-std::numeric_limits< float >::max()) const
const std::type_info & Type() const
std::vector< float > *const & els_dEtaIn() const
bool IsBasicJet(unsigned ijet) const
std::vector< float > *const & isotk_pt() const
void GetBestLepton(bool &is_muon, size_t &index)
float GetMuonIsolation(unsigned imu, bool mini=true) const
double GetMinDeltaPhiMETN(unsigned maxjets, float mainpt, float maineta, float otherpt, float othereta, bool useArcsin) const
std::vector< TString > no_trig
std::vector< float > *const & jets_corrFactorRaw() const
std::vector< float > *const & els_d0dum() const
std::vector< float > *const & mc_final_id() const
bool IsSignalIdMuon(unsigned iel) const
std::vector< bool > *const & taus_againstElectronLooseMVA5() const
std::vector< std::string > *const & trigger_name() const
T chooseVal(CutLevel threshold, T valVeto, T valLoose, T valMedium, T valTight) const
Float_t const & mets_phi() const
bool IsIdElectron(unsigned iel, CutLevel threshold, bool do_iso=false) const
std::vector< float > *const & mc_final_charge() const
std::vector< float > *const & taus_pt() const
phys_objects(const std::string &filename, bool is_8TeV=false)
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 & els_pfIsolationR03_sumPhotonEt() const
quick veto to Loose Most MC is Spring15 with cfA v80 Added mumu_m and elel_m with the dilepton invariant mass Added online lepton pT
std::vector< float > *const & jets_chgHadE() const
const std::vector< std::vector< int > > VRunLumi2015golden(MakeVRunLumi("2015golden"))
std::vector< float > *const & mc_doc_px() const
bool IsSignalMuon(unsigned imu, bool mini=true) const
vector< string > jec_files
long double SumDeltaPhi(long double phi_x, long double phi_a, long double phi_b)
std::vector< float > *const & taus_eta() const
static unsigned NumDescendants(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms, bool req_chg=false)
Int_t const & hbhefilter_decision() const
static bool FromStatus23(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
std::vector< float > *const & mc_doc_py() const
std::vector< float > *const & jets_energy() const
static void CountLeptons(const std::vector< mc_particle > &parts, const std::vector< size_t > &moms, unsigned &nleps, unsigned &ntaus, unsigned &ntauleps)
std::vector< float > *const & els_PATpassConversionVeto() const
std::vector< float > *const & jets_mass() const
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< bool > *const & mus_isPF() const
std::vector< float > *const & mc_doc_eta() const
Float_t const & fixedGridRhoFastjetAll() const
bool IsVetoMuon(unsigned imu, bool mini=true) const
std::vector< float > *const & mus_tk_phi() const
static float MinVetoLeptonPt
std::vector< float > *const & els_expectedMissingInnerHits() const
std::vector< float > *const & mus_pfIsolationR04_sumPUPt() const
std::vector< float > *const & pv_z() const
Int_t const & trackingfailurefilter_decision() const
std::vector< float > *const & jets_btag_inc_secVertexCombined() const
std::vector< float > *const & mc_final_phi() const
std::vector< float > *const & els_sigmaIEtaIEta() const
std::vector< mc_particle > GetMCParticles() 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 & jets_neutral_Mult() 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
static size_t ParentTau(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
std::vector< int > GetElectrons(bool doSignal=true, bool mini=true) const
std::vector< TLorentzVector > jets_corr_p4_
std::vector< float > *const & els_miniso() const
std::vector< float > *const & mus_energy() const
std::vector< float > *const & els_eOverPIn() const
std::vector< float > *const & els_full5x5_sigmaIetaIeta() const
std::vector< float > *const & mus_pfIsolationR04_sumNeutralHadronEt() const
std::vector< float > *const & mc_final_eta() const
long double SignedDeltaPhi(long double phi1, long double phi2)
std::vector< float > *const & pv_ndof() const
std::vector< float > *const & mus_eta() const
std::vector< float > *const & isotk_phi() const
std::vector< float > *const & mus_phi() const
const std::vector< std::vector< int > > VRunLumi2015dcs(MakeVRunLumi("2015dcs"))
bool PassesJSONCut(TString type)
std::vector< float > *const & els_caloEnergy() const
Int_t const & eebadscfilter_decision() const
std::vector< float > *const & els_pfIsolationR03_sumPUPt() const
void GetLeadingBJets(const std::vector< int > &good_jets, double pt_cut, double csv_cut, size_t &lead, size_t &sub)
std::vector< float > *const & jets_phi() const
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
virtual void GetEntry(const long entry)
bool IsVetoElectron(unsigned iel, bool mini=true) const
std::vector< int > *const & mus_jet_ind() const
std::vector< float > *const & mc_doc_grandmother_id() const
bool AllGoodJets(const std::vector< int > &VetoEl, const std::vector< int > &VetoMu, double pt_thresh, double eta_thresh) const
std::vector< float > *const & mc_doc_pz() const
std::vector< float > *const & mus_isTrackerMuon() const
bool PassesMETCleaningCut() const
UInt_t const & lumiblock() const
static bool IsBrem(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
std::vector< float > *const & mus_pfIsolationR04_sumChargedHadronPt() const
std::vector< float > *const & mc_doc_mother_id() const
bool IsGoodIsoTrack(unsigned itrk, bool mt_cut) const
const std::vector< TLorentzVector > & jets_corr_p4() const
static bool FromTau(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
bool IsVetoIdMuon(unsigned iel) const
std::vector< float > *const & mus_tk_numvalPixelhits() const
long double DeltaPhi(long double phi1, long double phi2)
std::vector< float > *const & jets_chgEmE() const
std::vector< float > *const & mc_final_ggrandmother_id() const
double GetDeltaPhiMETN(unsigned goodJetI, float otherpt, float othereta, bool useArcsin) const
std::vector< std::vector< int > > MakeVRunLumi(std::string input)
std::vector< float > *const & mus_isPFMuon() const
std::vector< float > *const & isotk_dzpv() const
std::vector< float > *const & mus_isGlobalMuon() const
std::vector< float > *const & isotk_eta() const
std::vector< bool > *const & els_isPF() const
std::vector< float > *const & els_PFneutralHadronIsoR03() const
bool IsIdMuon(unsigned imu, CutLevel threshold) const
std::vector< float > *const & mus_pfIsolationR04_sumPhotonEt() const
std::vector< float > *const & mc_final_energy() const
std::vector< float > *const & jets_eta() const
std::vector< float > *const & jets_area() const
std::vector< float > *const & mc_doc_charge() const
quick veto to Loose Most MC is Spring15 with cfA v80 Added mumu_m and elel_m with the dilepton invariant mass Added online lepton nb Added nb[t, m, l] variables Changed MJ eta threshold to and removed pT GeV threshold All jets associated with signal leptons are included in don t skip pfcands in the miniso calculation It kills of good non PF electrons
std::vector< float > *const & els_phi() const
static unsigned ParentTauDescendants(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)
void setJetEta(float fEta)
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
Int_t const & scrapingVeto_decision() const
double GetDeltaPhiMETN_deltaT(unsigned goodJetI, float otherpt, float othereta) const
std::vector< float > *const & els_tk_phi() const
std::vector< float > *const & els_isEE() const
std::vector< float > *const & taus_phi() const
std::vector< bool > *const & mus_isLooseMuon() const
std::vector< float > *const & els_isEB() const
double GetHT(const std::vector< int > &good_jets, double pt_cut=0.0) const
static bool IsDescendantOf(size_t descendant, size_t ancestor, const std::vector< size_t > &moms)
Int_t const & ecalTPfilter_decision() const
std::vector< bool > *const & mus_isTightMuon() const
long double AddInQuadrature(long double x, long double y)
bool IsGoodJet(unsigned ijet, double ptThresh, double etaThresh) const
std::vector< float > *const & mus_tk_LayersWithMeasurement() const
static bool FromW(size_t index, const std::vector< mc_particle > &parts, const std::vector< size_t > &moms)