72 const size_t jetStringItr = rawJetContainerName.find(
"Jets");
73 if (jetStringItr != std::string::npos)
74 rawJetContainerName = rawJetContainerName.replace(jetStringItr, std::string::npos,
"");
83 return StatusCode::SUCCESS;
103 fill(
tool,Run_lb,Run_mu,Cutflow_Event);
109 return StatusCode::SUCCESS;
133 return StatusCode::SUCCESS;
136 PV_n = vertices->
size();
138 PV_n_on_mu = PV_n/Run_mu;
142 if (vertices->
size() < 2) {
144 return StatusCode::SUCCESS;
150 bool foundVxTypePriVtx =
false;
152 for (
const auto vertItr : *vertices) {
153 ATH_MSG_DEBUG(
"Simple vertex: x = " << PV_x <<
", y = " << PV_y <<
", z = " << PV_z);
156 foundVxTypePriVtx =
true;
162 ATH_MSG_DEBUG(
"Primary vertex: x = " << PV_x <<
", y = " << PV_y <<
", z = " << PV_z);
164 if (PV_x == 0 && PV_y == 0 && PV_z == 0)
167 if (vertItr->nTrackParticles()>0) {
168 PV_tracks_n = vertItr->nTrackParticles();
170 PV_tracks_n_on_mu = PV_tracks_n/Run_mu;
175 fill(
tool,PV_x,PV_y,PV_z,PV_tracks_n,PV_tracks_n_on_mu);
180 if ( ! foundVxTypePriVtx ) {
181 ATH_MSG_DEBUG(
"xAOD::Vertex of type xAOD::VxType::PriVtx was not found in vertex container.");
182 return StatusCode::SUCCESS;
185 if ( PV_tracks_n < 4 )
186 return StatusCode::SUCCESS;
204 return StatusCode::SUCCESS;
207 for (
const auto muonItr : *muons) {
209 Muon_pT = muonItr->pt();
215 bool inAcceptance = TMath::Abs(muonItr->eta()) <
m_MuonEtaCut;
216 if (!inAcceptance)
continue;
218 if (muonItr->quality() > 1)
continue;
220 float topoetcone20_value = -999.;
221 float ptvarcone30_value = -999.;
226 Muon_charge = muonItr->charge();
230 if(IsolatedMuons_n>0)
231 ATH_MSG_DEBUG(IsolatedMuons_n <<
" Muon(s) isolated in event "<< Run_event);
239 int Electron_charge = 0;
244 return StatusCode::SUCCESS;
247 for (
const auto electronItr : *
electrons) {
248 ATH_MSG_DEBUG(
"Electron kinematics: eta = " << electronItr->eta() <<
", phi= " << electronItr->phi() <<
", pT= " << electronItr->pt() /
Gaudi::Units::GeV);
249 Electron_pT = electronItr->pt();
258 if (!inAcceptance)
continue;
260 bool lhmedium =
false;
261 electronItr->passSelection(lhmedium,
"LHMedium");
262 if (!lhmedium)
continue;
264 float topoetcone20_value = -999.;
265 float ptvarcone20_value = -999.;
270 Electron_charge = electronItr->charge();
271 ++IsolatedElectrons_n;
274 if(IsolatedElectrons_n>0)
275 ATH_MSG_DEBUG(IsolatedElectrons_n <<
" Electron(s) isolated in event "<< Run_event);
277 fill(
tool,IsolatedMuons_n,IsolatedElectrons_n);
280 bool isTTbarEvent =
false;
281 if (IsolatedElectrons_n == 1 && IsolatedMuons_n == 1 && Electron_charge*Muon_charge == -1) isTTbarEvent =
true;
284 ATH_MSG_DEBUG(
"This is a candidate ttbar event "<< Run_event);
287 if (IsolatedElectrons_n>0 || IsolatedMuons_n>0){
291 if (IsolatedElectrons_n>0){
295 else if(IsolatedMuons_n>0){
306 ATH_MSG_DEBUG(
"Event not accepted by single lepton pre-selection");
307 return StatusCode::SUCCESS;
337 return StatusCode::SUCCESS;
340 Tracks_n = tracks->
size();
342 Tracks_n_on_mu = Tracks_n/Run_mu;
346 for (
const auto trackItr : *tracks) {
348 Hits_IBL = (
int)nIBLHits;
354 Hits_TRT=(
int)nTRTHits;
357 fill(
tool,Hits_IBL,Hits_Pixel,Hits_SCT, Hits_TRT,Hits_Si,Hits_ID);
359 ATH_MSG_DEBUG(
"Track hits: IBL = " << Hits_IBL <<
", PIX = " << Hits_Pixel);
360 ATH_MSG_DEBUG(
"Track hits: SCT = " << Hits_SCT <<
", Si = " << Hits_Si);
361 ATH_MSG_DEBUG(
"Track hits: TRT = " << Hits_TRT <<
", ID = " << Hits_ID);
374 if (!
jets.isValid()) {
376 return StatusCode::SUCCESS;
410 const xAOD::Jet* firstTTbarJet =
nullptr;
421 TLorentzVector smt_jet, smt_mu;
424 jet_n_all =
jets->size();
427 for (
const auto jetItr : *
jets) {
430 jet_eta_all = jetItr->eta();
431 jet_phi_all = jetItr->phi();
432 ATH_MSG_DEBUG(
"Jet kinematics: eta = " << jet_eta_all <<
", phi= " << jet_phi_all <<
", pT= " << jet_pT_all);
440 jet_eta_all = jetItr->eta();
441 jet_phi_all = jetItr->phi();
442 fill(
tool,Cutflow_Jet,jet_pT_all,jet_MV_all,jet_eta_all,jet_phi_all);
448 jet_eta_filter = jetItr->eta();
449 jet_phi_filter = jetItr->phi();
450 fill(
tool,Cutflow_Jet,jet_eta_filter,jet_phi_filter);
456 jet_eta_kin = jetItr->eta();
457 jet_phi_kin = jetItr->phi();
458 fill(
tool,Cutflow_Jet,jet_eta_kin,jet_phi_kin);
460 jet_MV_2_beforeJVTCut = mv;
465 jet_MV_3_afterJVTCut = mv;
470 jet_eta_jvt = jetItr->eta();
471 jet_phi_jvt = jetItr->phi();
472 fill(
tool,Cutflow_Jet,jet_eta_jvt,jet_phi_jvt);
475 int n_isoMuons = 0, n_ptMuons = 0;
476 for (
const auto muonItr : *muons) {
479 bool inAcceptance = TMath::Abs(muonItr->eta()) <
m_MuonEtaCut;
480 if (!inAcceptance)
continue;
485 float topoetcone20_value = -999.;
486 float ptvarcone30_value = -999.;
491 if (jetItr->p4().DeltaR(muonItr->p4())<0.4) ++n_isoMuons;
494 if ( (muonItr->pt() > (0.9*jetItr->pt())) && (jetItr->p4().DeltaR(muonItr->p4())<0.4) ) ++n_ptMuons;
497 ATH_MSG_DEBUG(
"Number of isolated muons within this jet: \"" << n_isoMuons);
498 ATH_MSG_DEBUG(
"Number of muons with 90% pT within this jet: \"" << n_ptMuons);
500 if(n_isoMuons>0)
continue;
501 if(n_ptMuons>0)
continue;
505 jet_eta_overlap = jetItr->eta();
506 jet_phi_overlap = jetItr->phi();
507 fill(
tool,Cutflow_Jet,jet_eta_overlap,jet_phi_overlap);
518 jet_eta_good = jetItr->eta();
519 jet_phi_good = jetItr->phi();
520 fill(
tool,Cutflow_Jet,jet_eta_good,jet_phi_good,jet_pT_good);
533 if ( Run_mu > 0. && Run_mu < 30. ) {
536 else if ( Run_mu > 30. && Run_mu < 50. ) {
537 jet_MV_mu_30_50 = mv;
539 else if ( Run_mu > 50. && Run_mu < 100. ) {
540 jet_MV_mu_50_100 = mv;
546 if (nTTbarGoodJets == 1) firstTTbarJet = jetItr;
547 if(nTTbarGoodJets >= 2) {
549 if (nTTbarGoodJets == 2) {
558 if (!inAcceptance)
continue;
562 for (
const auto softMuonItr : *muons) {
565 bool inAcceptance = TMath::Abs(softMuonItr->eta()) <
m_MuonEtaCut;
566 if (!inAcceptance)
continue;
576 if (softMuonItr->primaryTrackParticle()->d0() > 0.4)
continue;
578 SMTJets_dr = (jetItr->p4()).
DeltaR(softMuonItr->p4());
579 if ( SMTJets_dr >= 0.4)
continue;
581 smt_mu.SetPtEtaPhiE(softMuonItr->pt(),softMuonItr->eta(),softMuonItr->phi(),softMuonItr->e());
585 ATH_MSG_DEBUG(
"Number of soft muons per jet is " << SoftMuons_n);
588 if( SoftMuons_n == 1){
590 jet_eta_smt = jetItr->eta();
591 jet_phi_smt = jetItr->phi();
592 smt_jet.SetPtEtaPhiE(jetItr->pt(),jetItr->eta(),jetItr->phi(),jetItr->e());
600 jet_eta_suspect = jetItr->eta();
601 jet_phi_suspect = jetItr->phi();
602 fill(
tool,Cutflow_Jet,jet_eta_suspect,jet_phi_suspect);
606 else if ( qualityLabel ==
badJet ) {
608 jet_eta_bad = jetItr->eta();
609 jet_phi_bad = jetItr->phi();
610 fill(
tool,Cutflow_Jet,jet_eta_bad,jet_phi_bad);
617 ATH_MSG_DEBUG(
"Number of jets in ttbar events " << nTTbarGoodJets);
621 ATH_MSG_DEBUG(
"Number of jets with == 1 soft muon per event is " << SMTJets_n);
625 SMTJets_pTratio = SoftMuons_pT/SMTJets_pT;
627 fill(
tool,SoftMuons_pT,SMTJets_pT,SMTJets_pTratio,SMTJets_pTrel,SMTJets_dr,SMTJets_MV,jet_eta_smt,jet_phi_smt);
630 return StatusCode::SUCCESS;
635 bool pass_cuts =
false;
641 std::vector<float> SumPtTrkPt1000;
643 float chf = SumPtTrkPt1000.size() > 0 ? SumPtTrkPt1000.at(0)/
jet->pt() : -1;
651 (emf>0.95 && std::abs(jetQuality)>0.8 && std::abs(
jet->eta()) < 2.8) ||
652 (std::abs(jetTime)>25) ||
653 (emf<0.05 && chf<0.05 && std::abs(
jet->eta())<2) ||
654 (emf<0.05 && std::abs(
jet->eta())>= 2) ||
655 (fracSamplingMax>0.99 && std::abs(
jet->eta())<2)
684 float jvt = JVT(*
jet);
697 if ( !bTaggingObject ) {
698 ATH_MSG_DEBUG(
"Could not retrieve b-tagging object from selected jet." );
702 double mv = 0, mv_pu = 0, mv_pb = 0, mv_pc = 0;
708 if ( mv_pb != 0 && (mv_pu != 0 || mv_pc != 0)) {
777 fill(
tool,TTbarJets_n,pass85n,pass77n,pass70n,pass60n,TTbarJets_pT,pass85p,pass77p,pass70p,pass60p);
804 jet_MV_pt_200_1000=mv;
807 jet_MV_pt_150_200=mv;
810 jet_MV_pt_100_150=mv;
840 if ( std::abs(
jet->eta()) > 2.0 ) {
843 else if ( std::abs(
jet->eta()) > 1.5 ) {
846 else if ( std::abs(
jet->eta()) > 1.0 ) {
849 else if ( std::abs(
jet->eta()) > 0.5 ) {
852 else if ( std::abs(
jet->eta()) > 0.0 ) {
856 if ( std::abs(
jet->phi()) > 2.5 ) {
859 else if ( std::abs(
jet->phi()) > 2.0 ) {
862 else if ( std::abs(
jet->phi()) > 1.5 ) {
865 else if ( std::abs(
jet->phi()) > 1.0 ) {
868 else if ( std::abs(
jet->phi()) > 0.5 ) {
871 else if ( std::abs(
jet->phi()) > 0.0 ) {
886 jet_eta_85tag =
jet->eta();
887 jet_phi_85tag =
jet->phi();
888 fill(
tool,jet_eta_85tag,jet_phi_85tag);
890 jet_eta_77tag =
jet->eta();
891 jet_phi_77tag =
jet->phi();
892 fill(
tool,jet_eta_77tag,jet_phi_77tag);
894 jet_eta_70tag =
jet->eta();
895 jet_phi_70tag =
jet->phi();
896 fill(
tool,jet_eta_70tag,jet_phi_70tag);
898 jet_eta_60tag =
jet->eta();
899 jet_phi_60tag =
jet->phi();
900 fill(
tool,jet_eta_60tag,jet_phi_60tag);
907 jet_eta =
jet->eta();
927 fill(
tool,jet_eta,pass85e,pass77e,pass70e,pass60e,
jet_phi,pass85f,pass77f,pass70f,pass60f);
943 fill(
tool,jet_MV_suspect,jet_pT_suspect);
955 sus_jet_MV_pt_200_1000=mv;
958 sus_jet_MV_pt_150_200=mv;
961 sus_jet_MV_pt_100_150=mv;
964 sus_jet_MV_pt_70_100=mv;
967 sus_jet_MV_pt_40_70=mv;
970 sus_jet_MV_pt_20_40=mv;
973 sus_jet_MV_pt_0_20=mv;
991 if ( std::abs(
jet->eta()) > 2.0 ) {
992 sus_jet_MV_eta_20_25=mv;
994 else if ( std::abs(
jet->eta()) > 1.5 ) {
995 sus_jet_MV_eta_15_20=mv;
997 else if ( std::abs(
jet->eta()) > 1.0 ) {
998 sus_jet_MV_eta_10_15=mv;
1000 else if ( std::abs(
jet->eta()) > 0.5 ) {
1001 sus_jet_MV_eta_05_10=mv;
1003 else if ( std::abs(
jet->eta()) > 0.0 ) {
1004 sus_jet_MV_eta_00_05=mv;
1007 if ( std::abs(
jet->phi()) > 2.5 ) {
1008 sus_jet_MV_phi_25_31=mv;
1010 else if ( std::abs(
jet->phi()) > 2.0 ) {
1011 sus_jet_MV_phi_20_25=mv;
1013 else if ( std::abs(
jet->phi()) > 1.5 ) {
1014 sus_jet_MV_phi_15_20=mv;
1016 else if ( std::abs(
jet->phi()) > 1.0 ) {
1017 sus_jet_MV_phi_10_15=mv;
1019 else if ( std::abs(
jet->phi()) > 0.5 ) {
1020 sus_jet_MV_phi_05_10=mv;
1022 else if ( std::abs(
jet->phi()) > 0.0 ) {
1023 sus_jet_MV_phi_00_05=mv;
1037 sus_jet_eta_85tag =
jet->eta();
1038 sus_jet_phi_85tag =
jet->phi();
1039 fill(
tool,sus_jet_eta_85tag,sus_jet_phi_85tag);
1041 sus_jet_eta_77tag =
jet->eta();
1042 sus_jet_phi_77tag =
jet->phi();
1043 fill(
tool,sus_jet_eta_77tag,sus_jet_phi_77tag);
1045 sus_jet_eta_70tag =
jet->eta();
1046 sus_jet_phi_70tag =
jet->phi();
1047 fill(
tool,sus_jet_eta_70tag,sus_jet_phi_70tag);
1049 sus_jet_eta_60tag =
jet->eta();
1050 sus_jet_phi_60tag =
jet->phi();
1051 fill(
tool,sus_jet_eta_60tag,sus_jet_phi_60tag);
1058 sus_jet_eta =
jet->eta();
1073 sus_jet_phi =
jet->phi();
1078 fill(
tool,sus_jet_eta,pass85e,pass77e,pass70e,pass60e,sus_jet_phi,pass85f,pass77f,pass70f,pass60f);
1086 if ( !bTaggingObject ) {
1087 ATH_MSG_DEBUG(
"Could not retrieve b-tagging object from selected jet." );
1097 double mv_pu = 0, mv_pb = 0, mv_pc = 0;
1102 jet_MV_pu_good = mv_pu;
1103 jet_MV_pc_good = mv_pc;
1104 jet_MV_pb_good = mv_pb;
1106 fill(
tool,jet_MV_pu_good,jet_MV_pc_good,jet_MV_pb_good);
1115 if ( !bTaggingObject ) {
1116 ATH_MSG_DEBUG(
"Could not retrieve b-tagging object from selected jet." );
1122 float jetTrack_pT = 0;
1123 float jetTrack_eta = 0;
1124 float jetTrack_phi = 0;
1127 int nLooseTracks = 0;
1185 TLorentzVector jet_TLV;
1186 jet_TLV.SetPtEtaPhiE(
jet->pt(),
jet->eta(),
jet->phi(),
jet->e());
1189 BTagTrackToJetAssociatorAcc(
"BTagTrackToJetAssociator");
1190 std::vector<ElementLink<xAOD::TrackParticleContainer>> assocTracks =
1191 BTagTrackToJetAssociatorAcc(*bTaggingObject);
1193 nTracks = assocTracks.size();
1196 if ( not jetTracks.isValid() )
continue;
1200 jetTrack_eta = jetTrackItr->
eta();
1201 jetTrack_phi = jetTrackItr->
phi();
1203 JetTracks_pT_0_all = jetTrack_pT;
1204 JetTracks_eta_0_all = jetTrack_eta;
1205 JetTracks_phi_0_all = jetTrack_phi;
1207 TLorentzVector JetTrack_TLV;
1208 JetTrack_TLV.SetPtEtaPhiE(jetTrackItr->
pt(), jetTrackItr->
eta(), jetTrackItr->
phi(), jetTrackItr->
e());
1210 JetTracks_DR_0_all = jet_TLV.DeltaR(JetTrack_TLV);
1212 fill(
tool,JetTracks_eta_0_all,JetTracks_phi_0_all,JetTracks_pT_0_all,JetTracks_DR_0_all);
1219 JetTracks_pT_1_loose = jetTrack_pT;
1220 JetTracks_eta_1_loose = jetTrack_eta;
1221 JetTracks_phi_1_loose = jetTrack_phi;
1228 JetTracks_Hits_IBL = nHitIBL;
1229 if(expectHitIBL < 1)
1230 JetTracks_Hits_IBL_expect = -1;
1232 JetTracks_Hits_IBL_expect = nHitIBL;
1233 JetTracks_eta_loose_IBL = jetTrack_eta;
1234 JetTracks_phi_loose_IBL = jetTrack_phi;
1241 JetTracks_Hits_BL = nHitBL;
1243 JetTracks_Hits_BL_expect = -1;
1245 JetTracks_Hits_BL_expect = nHitBL;
1246 JetTracks_eta_loose_BL = jetTrack_eta;
1247 JetTracks_phi_loose_BL = jetTrack_phi;
1256 nHitPix +=
std::max((
int)nDeadPix, 0);
1257 JetTracks_Hits_PIX = nHitPix;
1258 JetTracks_Holes_PIX = nHolePix;
1266 nHitSCT +=
std::max((
int)nDeadSCT, 0);
1267 JetTracks_Hits_SCT = nHitSCT;
1268 JetTracks_Holes_SCT = nHoleSCT;
1272 JetTracks_Hits_TRT = nHitTRT;
1274 JetTracks_Hits_Si = nHitPix + nHitSCT;
1275 JetTracks_Holes_Si = nHolePix + nHoleSCT;
1278 JetTracks_IP_d0 = jetTrackItr->
d0();
1280 JetTracks_IP_d0si = JetTracks_IP_d0/JetTracks_IP_d0s;
1283 JetTracks_IP_z0 = jetTrackItr->
z0() + jetTrackItr->
vz() - PVZ;
1285 JetTracks_IP_z0si = JetTracks_IP_z0/JetTracks_IP_z0s;
1286 JetTracks_IP_z0sin = JetTracks_IP_z0*
sin(jetTrackItr->
theta());
1289 JetTracks_eta_1_loose,JetTracks_phi_1_loose,JetTracks_pT_1_loose,
1290 JetTracks_Hits_IBL,JetTracks_Hits_IBL_expect,JetTracks_eta_loose_IBL,JetTracks_phi_loose_IBL,
1291 JetTracks_Hits_BL, JetTracks_Hits_BL_expect, JetTracks_eta_loose_BL, JetTracks_phi_loose_BL,
1292 JetTracks_Hits_PIX,JetTracks_Holes_PIX,
1293 JetTracks_Hits_SCT,JetTracks_Holes_SCT,
1295 JetTracks_Hits_Si,JetTracks_Holes_Si,
1296 JetTracks_IP_d0,JetTracks_IP_d0s,JetTracks_IP_d0si,JetTracks_IP_z0,JetTracks_IP_z0s,JetTracks_IP_z0si,JetTracks_IP_z0sin
1305 JetTracks_eta_2_kin = jetTrack_eta;
1306 JetTracks_phi_2_kin = jetTrack_phi;
1308 fill(
tool,JetTracks_eta_2_kin,JetTracks_phi_2_kin);
1316 JetTracks_eta_3_IP = jetTrack_eta;
1317 JetTracks_phi_3_IP = jetTrack_phi;
1319 fill(
tool,JetTracks_eta_3_IP,JetTracks_phi_3_IP);
1322 if(
m_TrackHitIBLCut == 0 || (JetTracks_Hits_IBL_expect != 0 && JetTracks_Hits_BL_expect != 0) ){
1326 JetTracks_eta_4_IBL = jetTrack_eta;
1327 JetTracks_phi_4_IBL = jetTrack_phi;
1329 fill(
tool,JetTracks_eta_4_IBL,JetTracks_phi_4_IBL);
1337 JetTracks_n_0_all = nTracks;
1338 JetTracks_n_1_loose = nLooseTracks;
1339 JetTracks_n_2_kin = nKinTracks;
1340 JetTracks_n_3_IP = nIPTracks;
1341 JetTracks_n_4_IBL = nIBLTracks;
1342 fill(
tool,JetTracks_n_0_all,JetTracks_n_1_loose,JetTracks_n_2_kin,JetTracks_n_3_IP,JetTracks_n_4_IBL);
1350 if(nIBLTracks < nIPTracks)
return suspectJet;