ATLAS Offline Software
JetTagMonitorAlgorithm.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 JetTagMonitorAlgorithm::JetTagMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
8  :AthMonitorAlgorithm(name,pSvcLocator)
9 {
10  declareProperty("JetsCollection",m_JetContainerKey);
11  declareProperty("MuonsCollection",m_MuonContainerKey);
12  declareProperty("ElectronsCollection",m_ElectronContainerKey);
13 
14  declareProperty("SkipPreSelection", m_SkipPreSelection);
15  declareProperty("SkipJetFilter", m_SkipJetFilter);
16  declareProperty("DoExtraTaggerHistos", m_DoExtraTaggerHistos);
17 
18  declareProperty("JetEtaCut", m_JetEtaCut);
19  declareProperty("JetPtCut", m_JetPtCut);
20  declareProperty("SoftMuonPtMin", m_SoftMuonPtMin);
21  declareProperty("SoftMuonPtMax", m_SoftMuonPtMax);
22 
23  declareProperty("MinGoodTrackCut", m_MinGoodTrackCut);
24  declareProperty("TrackPtCut", m_TrackPtCut);
25  declareProperty("Trackd0Cut", m_Trackd0Cut);
26  declareProperty("Trackz0sinCut", m_Trackz0sinCut);
27  declareProperty("TrackHitIBLCut", m_TrackHitIBLCut);
28 
29  declareProperty("ElectronPtCut", m_ElectronPtCut);
30  declareProperty("MuonPtCut", m_MuonPtCut);
31  declareProperty("ElectronEtaCut", m_ElectronEtaCut);
32  declareProperty("MuonEtaCut", m_MuonEtaCut);
33  declareProperty("ElectronEtaCrackLowCut", m_ElectronEtaCrackLowCut);
34  declareProperty("ElectronEtaCrackHighCut", m_ElectronEtaCrackHighCut);
35 
36  declareProperty("ElectronTopoEtCone20Cut", m_ElectronTopoEtCone20Cut);
37  declareProperty("MuonTopoEtCone20Cut", m_MuonTopoEtCone20Cut);
38  declareProperty("ElectronPtVarCone20Cut", m_ElectronPtVarCone20Cut);
39  declareProperty("MuonPtVarCone30Cut", m_MuonPtVarCone30Cut);
40 
41  declareProperty("JVTCut", m_JVTCut);
42  declareProperty("JVTpTCut", m_JVTpTCut);
43  declareProperty("JVTetaCut", m_JVTetaCut);
44 
45  declareProperty("TaggerName", m_TaggerName);
46  declareProperty("cFraction", m_cFraction);
47  declareProperty("WP60Cut", m_WP60Cut);
48  declareProperty("WP70Cut", m_WP70Cut);
49  declareProperty("WP77Cut", m_WP77Cut);
50  declareProperty("WP85Cut", m_WP85Cut);
51 }
52 
54 
56 
58  ATH_CHECK(m_JetContainerKey.initialize());
59  ATH_CHECK(m_MuonContainerKey.initialize());
61 
62  ATH_CHECK(m_VertContainerKey.initialize());
64 
65  if (m_btagLinkKey.empty()) {
66  m_btagLinkKey = m_JetContainerKey.key() + ".btaggingLink";
67  }
68  ATH_CHECK(m_btagLinkKey.initialize());
69 
70  if (m_btagResultKey.empty()) {
71  std::string rawJetContainerName = m_JetContainerKey.key();
72  const size_t jetStringItr = rawJetContainerName.find("Jets");
73  if (jetStringItr != std::string::npos)
74  rawJetContainerName = rawJetContainerName.replace(jetStringItr, std::string::npos, "");
75  m_btagResultKey = "BTagging_" + rawJetContainerName + "." + m_TaggerName + "_pb";
76  }
78 
79  ATH_CHECK(m_MuonEtIsoDecorKey.initialize());
80  ATH_CHECK(m_MuonPtIsoDecorKey.initialize());
81  ATH_CHECK(m_EleEtIsoDecorKey.initialize());
82  ATH_CHECK(m_ElePtIsoDecorKey.initialize());
83  return StatusCode::SUCCESS;
84 }
85 
86 
87 StatusCode JetTagMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const {
88 
89  using namespace Monitored;
90 
91  auto Run_event = Monitored::Scalar<int>("Run_event",0);
92  auto Run_lb = Monitored::Scalar<int>("Run_lb",0);
93  auto Run_mu = Monitored::Scalar<float>("Run_mu",0);
94 
95  Run_event = GetEventInfo(ctx)->eventNumber();
96  Run_lb = GetEventInfo(ctx)->lumiBlock();
97  Run_mu = lbInteractionsPerCrossing(ctx);
98 
99  auto tool = getGroup("JetTagMonitor");
100 
101  auto Cutflow_Event = Monitored::Scalar<int>("Cutflow_Event",0);
102  Cutflow_Event = 0;
103  fill(tool,Run_lb,Run_mu,Cutflow_Event);
104 
106  GetEventInfo(ctx)->errorState(xAOD::EventInfo::EventFlagSubDet::LAr) == xAOD::EventInfo::Error ||
107  GetEventInfo(ctx)->isEventFlagBitSet(xAOD::EventInfo::Core, 18) ) {
108  ATH_MSG_DEBUG("Event cleaning : skip event");
109  return StatusCode::SUCCESS;
110  }
111 
112  Cutflow_Event = 1;
113  fill(tool,Cutflow_Event);
114 
116  //* Primary vertex *//
118 
119  auto PV_n = Monitored::Scalar<int>("PV_n",0);
120  auto PV_x = Monitored::Scalar<float>("PV_x",0);
121  auto PV_y = Monitored::Scalar<float>("PV_y",0);
122  auto PV_z = Monitored::Scalar<float>("PV_z",0);
123  auto PV_tracks_n = Monitored::Scalar<int>("PV_tracks_n",0);
124 
125  auto PV_n_on_mu = Monitored::Scalar<float>("PV_n_on_mu",0);
126  auto PV_tracks_n_on_mu = Monitored::Scalar<float>("PV_tracks_n_on_mu",0);
127 
128  float PVZ=0;
129 
131  if (!vertices.isValid()) {
132  ATH_MSG_DEBUG("Could not find vertex AOD container with name " << m_VertContainerKey);
133  return StatusCode::SUCCESS;
134  }
135 
136  PV_n = vertices->size();
137  if (Run_mu > 0) {
138  PV_n_on_mu = PV_n/Run_mu;
139  }
140  fill(tool,PV_n,PV_n_on_mu);
141 
142  if (vertices->size() < 2) {
143  ATH_MSG_DEBUG("No vertices reconstructed");
144  return StatusCode::SUCCESS;
145  }
146 
147  Cutflow_Event = 2;
148  fill(tool,Cutflow_Event);
149 
150  bool foundVxTypePriVtx = false;
151 
152  for (const auto vertItr : *vertices) {
153  ATH_MSG_DEBUG("Simple vertex: x = " << PV_x << ", y = " << PV_y << ", z = " << PV_z);
154 
155  if (vertItr->vertexType() == xAOD::VxType::PriVtx && vertItr->numberDoF() > 0 ) {
156  foundVxTypePriVtx = true;
157 
158  PV_x = vertItr->x();
159  PV_y = vertItr->y();
160  PV_z = vertItr->z();
161  PVZ=PV_z;
162  ATH_MSG_DEBUG("Primary vertex: x = " << PV_x << ", y = " << PV_y << ", z = " << PV_z);
163 
164  if (PV_x == 0 && PV_y == 0 && PV_z == 0)
165  ATH_MSG_DEBUG("Primary Vertex is (0,0,0)");
166 
167  if (vertItr->nTrackParticles()>0) {
168  PV_tracks_n = vertItr->nTrackParticles();
169  if (Run_mu > 0){
170  PV_tracks_n_on_mu = PV_tracks_n/Run_mu;
171  }
172  ATH_MSG_DEBUG("PV has "<< PV_tracks_n <<" tracks");
173  }
174 
175  fill(tool,PV_x,PV_y,PV_z,PV_tracks_n,PV_tracks_n_on_mu);
176 
177  }
178  }
179 
180  if ( ! foundVxTypePriVtx ) {
181  ATH_MSG_DEBUG("xAOD::Vertex of type xAOD::VxType::PriVtx was not found in vertex container.");
182  return StatusCode::SUCCESS;
183  }
184 
185  if ( PV_tracks_n < 4 )
186  return StatusCode::SUCCESS;
187 
188  Cutflow_Event = 3;
189  fill(tool,Cutflow_Event);
190 
191  //----------------------Start Muon & Electron Part for pre-selection and ttbar events ------------------------
192 
194  //* Muon container *//
196 
197  auto Muon_pT = Monitored::Scalar<float>("Muon_pT",0.0);
198  auto IsolatedMuons_n = Monitored::Scalar<int>("IsolatedMuons_n",0.0);
199  int Muon_charge = 0;
200 
202  if (! muons.isValid() ) {
203  ATH_MSG_DEBUG("evtStore() does not contain muon Collection with name "<< m_MuonContainerKey);
204  return StatusCode::SUCCESS;
205  }
206 
207  for (const auto muonItr : *muons) {
208  ATH_MSG_DEBUG("Muon kinematics: eta = " << muonItr->eta() << ", phi= " << muonItr->phi() << ", pT= " << muonItr->pt() / Gaudi::Units::GeV);
209  Muon_pT = muonItr->pt();
210  fill(tool,Muon_pT);
211 
212  //Look for isolated muons (for pre-selection and ttbar events selection)
213  //Select muons which passed pT cut
214  if (muonItr->pt() / Gaudi::Units::GeV < m_MuonPtCut) continue;
215  bool inAcceptance = TMath::Abs(muonItr->eta()) < m_MuonEtaCut;
216  if (!inAcceptance) continue;
217  //Select medium muons
218  if (muonItr->quality() > 1) continue; // 0 tight, 1 medium, medium <= 1 (includes 0)
219  //Select isolated muons
220  float topoetcone20_value = -999.;
221  float ptvarcone30_value = -999.;
222  muonItr-> isolation(topoetcone20_value, xAOD::Iso::topoetcone20);
223  muonItr-> isolation(ptvarcone30_value, xAOD::Iso::ptvarcone30);
224  if (topoetcone20_value/muonItr->pt() > m_MuonTopoEtCone20Cut) continue;
225  if (ptvarcone30_value/muonItr->pt() > m_MuonPtVarCone30Cut) continue;
226  Muon_charge = muonItr->charge();
227  ++IsolatedMuons_n;
228  }
229 
230  if(IsolatedMuons_n>0)
231  ATH_MSG_DEBUG(IsolatedMuons_n << " Muon(s) isolated in event "<< Run_event);
232 
234  //* Electron container *//
236 
237  auto Electron_pT = Monitored::Scalar<float>("Electron_pT",0.0);
238  auto IsolatedElectrons_n = Monitored::Scalar<int>("IsolatedElectrons_n",0.0);
239  int Electron_charge = 0;
240 
242  if (! electrons.isValid() ) {
243  ATH_MSG_DEBUG("evtStore() does not contain electron Collection with name "<< m_ElectronContainerKey);
244  return StatusCode::SUCCESS;
245  }
246 
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();
250  fill(tool,Electron_pT);
251 
252  //Look for isolated electrons (for pre-selection and ttbar events selection)
253  //Select electrons which passed author and pT cut
254  if (!electronItr->author(xAOD::EgammaParameters::AuthorElectron)) continue;
255  if (electronItr->pt() / Gaudi::Units::GeV < m_ElectronPtCut) continue;
256  bool inAcceptance = (TMath::Abs(electronItr->eta()) > m_ElectronEtaCrackHighCut || TMath::Abs(electronItr->eta()) < m_ElectronEtaCrackLowCut)
257  && TMath::Abs(electronItr->eta()) < m_ElectronEtaCut;
258  if (!inAcceptance) continue;
259  //Select mediumLH electron
260  bool lhmedium = false;
261  electronItr->passSelection(lhmedium, "LHMedium");
262  if (!lhmedium) continue;
263  //Select isolated electrons
264  float topoetcone20_value = -999.;
265  float ptvarcone20_value = -999.;
266  electronItr-> isolationValue(topoetcone20_value, xAOD::Iso::topoetcone20);
267  electronItr-> isolationValue(ptvarcone20_value, xAOD::Iso::ptvarcone20);
268  if (topoetcone20_value/electronItr->pt() > m_ElectronTopoEtCone20Cut) continue;
269  if (ptvarcone20_value/electronItr->pt() > m_ElectronPtVarCone20Cut) continue;
270  Electron_charge = electronItr->charge();
271  ++IsolatedElectrons_n;
272  }
273 
274  if(IsolatedElectrons_n>0)
275  ATH_MSG_DEBUG(IsolatedElectrons_n << " Electron(s) isolated in event "<< Run_event);
276 
277  fill(tool,IsolatedMuons_n,IsolatedElectrons_n);
278 
279  // Require eventually opposite sign electron + muon to identify ttbar candidate events (used to fill few plots with ttbar jets)
280  bool isTTbarEvent = false;
281  if (IsolatedElectrons_n == 1 && IsolatedMuons_n == 1 && Electron_charge*Muon_charge == -1) isTTbarEvent = true;
282 
283  if(isTTbarEvent)
284  ATH_MSG_DEBUG("This is a candidate ttbar event "<< Run_event);
285 
286  // Require isolated electron or muon to reduce pile-up dependency (replace trigger pre-selection)
287  if (IsolatedElectrons_n>0 || IsolatedMuons_n>0){
288  Cutflow_Event = 4;
289  fill(tool,Cutflow_Event);
290 
291  if (IsolatedElectrons_n>0){ //at least one electron
292  Cutflow_Event = 5;
293  fill(tool,Cutflow_Event);
294  }
295  else if(IsolatedMuons_n>0){ //at least one muon
296  Cutflow_Event = 6;
297  fill(tool,Cutflow_Event);
298  }
299 
300  }
301  else { //no single lepton
302  if (m_SkipPreSelection){ //In case of Ion-Ion or Ion-proton collision
303  ATH_MSG_DEBUG("Skip single lepton pre-selection"); // Event accepted (skip pre-selection)
304  }
305  else{
306  ATH_MSG_DEBUG("Event not accepted by single lepton pre-selection");
307  return StatusCode::SUCCESS; // Event not accepted
308  }
309  }
310 
311  //Events are selected
312  //Fill track plots with ID tracks
313  //Fill jet histograms (after Jet Selection)
314 
316  //* TrackParticle container *//
318 
319  auto Tracks_n = Monitored::Scalar<int>("Tracks_n",0);
320  auto Tracks_n_on_mu = Monitored::Scalar<float>("Tracks_n_on_mu",0);
321 
322  uint8_t nIBLHits = 0;
323  uint8_t nPixelHits = 0;
324  uint8_t nSCTHits = 0;
325  uint8_t nTRTHits = 0;
326 
327  auto Hits_IBL = Monitored::Scalar<int>("Hits_IBL",0);
328  auto Hits_Pixel = Monitored::Scalar<int>("Hits_Pixel",0);
329  auto Hits_SCT = Monitored::Scalar<int>("Hits_SCT",0);
330  auto Hits_Si = Monitored::Scalar<int>("Hits_Si",0);
331  auto Hits_TRT = Monitored::Scalar<int>("Hits_TRT",0);
332  auto Hits_ID = Monitored::Scalar<int>("Hits_ID",0);
333 
335  if (!tracks.isValid()) {
336  ATH_MSG_DEBUG("Could not find track AOD container with name " << m_TrackContainerKey);
337  return StatusCode::SUCCESS;
338  }
339 
340  Tracks_n = tracks->size();
341  if (Run_mu > 0) {
342  Tracks_n_on_mu = Tracks_n/Run_mu;
343  }
344  fill(tool,Tracks_n,Tracks_n_on_mu);
345 
346  for (const auto trackItr : *tracks) {
347  trackItr->summaryValue(nIBLHits, xAOD::numberOfInnermostPixelLayerHits);
348  Hits_IBL = (int)nIBLHits;
349  trackItr->summaryValue(nPixelHits, xAOD::numberOfPixelHits);
350  Hits_Pixel=(int)nPixelHits;
351  trackItr->summaryValue(nSCTHits, xAOD::numberOfSCTHits);
352  Hits_SCT=(int)nSCTHits;
353  trackItr->summaryValue(nTRTHits, xAOD::numberOfTRTHits);
354  Hits_TRT=(int)nTRTHits;
355  Hits_Si=(int)nPixelHits+(int)nSCTHits;
356  Hits_ID=(int)nPixelHits+(int)nSCTHits+(int)nTRTHits;
357  fill(tool,Hits_IBL,Hits_Pixel,Hits_SCT, Hits_TRT,Hits_Si,Hits_ID);
358 
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);
362 
363  }
364 
366  //* Jet container *//
368 
369  ATH_MSG_DEBUG("Start jet part");
370 
371  //----------------------Start Jet Part---------------------------
372 
374  if (!jets.isValid()) {
375  ATH_MSG_DEBUG("Could not find jet AOD container with name " << m_JetContainerKey);
376  return StatusCode::SUCCESS;
377  }
378 
379  auto Cutflow_Jet = Monitored::Scalar<int>("Cutflow_Jet",0);
380 
381  auto jet_n_all = Monitored::Scalar<int>("jet_n_all",0.0);
382 
383  auto jet_pT_all = Monitored::Scalar<float>("jet_pT_all",0.0);
384  auto jet_pT_good = Monitored::Scalar<float>("jet_pT_good",0.0);
385 
386  auto jet_eta_all = Monitored::Scalar<float>("jet_eta_all",0.0);
387  auto jet_phi_all = Monitored::Scalar<float>("jet_phi_all",0.0);
388  auto jet_eta_filter = Monitored::Scalar<float>("jet_eta_filter",0.0);
389  auto jet_phi_filter = Monitored::Scalar<float>("jet_phi_filter",0.0);
390  auto jet_eta_kin = Monitored::Scalar<float>("jet_eta_kin",0.0);
391  auto jet_phi_kin = Monitored::Scalar<float>("jet_phi_kin",0.0);
392  auto jet_eta_jvt = Monitored::Scalar<float>("jet_eta_jvt",0.0);
393  auto jet_phi_jvt = Monitored::Scalar<float>("jet_phi_jvt",0.0);
394  auto jet_eta_overlap = Monitored::Scalar<float>("jet_eta_overlap",0.0);
395  auto jet_phi_overlap = Monitored::Scalar<float>("jet_phi_overlap",0.0);
396  auto jet_eta_good = Monitored::Scalar<float>("jet_eta_good",0.0);
397  auto jet_phi_good = Monitored::Scalar<float>("jet_phi_good",0.0);
398  auto jet_eta_suspect = Monitored::Scalar<float>("jet_eta_suspect",0.0);
399  auto jet_phi_suspect = Monitored::Scalar<float>("jet_phi_suspect",0.0);
400  auto jet_eta_bad = Monitored::Scalar<float>("jet_eta_bad",0.0);
401  auto jet_phi_bad = Monitored::Scalar<float>("jet_phi_bad",0.0);
402  auto jet_eta_smt = Monitored::Scalar<float>("jet_eta_smt",0.0);
403  auto jet_phi_smt = Monitored::Scalar<float>("jet_phi_smt",0.0);
404 
405  auto jet_MV_all = Monitored::Scalar<float>("jet_MV_all",0.0);
406  auto jet_MV_2_beforeJVTCut = Monitored::Scalar<float>("jet_MV_2_beforeJVTCut",0.0);
407  auto jet_MV_3_afterJVTCut = Monitored::Scalar<float>("jet_MV_3_afterJVTCut",0.0);
408 
409  //Variables for TTbar events
410  const xAOD::Jet* firstTTbarJet = nullptr;
411  auto nTTbarGoodJets = Monitored::Scalar<int>("nTTbarGoodJets",0.0);
412 
413  // soft muon observables
414  auto SoftMuons_n = Monitored::Scalar<int>("SoftMuons_n",0.0);
415  auto SMTJets_n = Monitored::Scalar<int>("SMTJets_n",0.0);
416  auto SMTJets_dr = Monitored::Scalar<float>("SMTJets_dr",0.0);
417  auto SoftMuons_pT = Monitored::Scalar<float>("SoftMuons_pT",0.0);
418  auto SMTJets_pT = Monitored::Scalar<float>("SMTJets_pT",0.0);
419  auto SMTJets_pTratio = Monitored::Scalar<float>("SMTJets_pTratio",0.0);
420  auto SMTJets_MV = Monitored::Scalar<float>("SMTJets_MV",0.0);
421  TLorentzVector smt_jet, smt_mu;
422  auto SMTJets_pTrel = Monitored::Scalar<float>("SMTJets_pTrel",0.0);
423 
424  jet_n_all = jets->size();
425  fill(tool,jet_n_all);
426 
427  for (const auto jetItr : *jets) {
428 
429  jet_pT_all = jetItr->pt() / Gaudi::Units::GeV;
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);
433 
434  double mv = 0;
435  mv = getTaggerWeight(jetItr);
436  jet_MV_all = mv;
437 
438  // All jets
439  Cutflow_Jet = 0;
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);
443 
444  if( !passJetFilterCut(jetItr) ) continue;
445 
446  // Jets passing filter cuts --> filtered jets (standard jet cleaning cuts)
447  Cutflow_Jet = 1;
448  jet_eta_filter = jetItr->eta();
449  jet_phi_filter = jetItr->phi();
450  fill(tool,Cutflow_Jet,jet_eta_filter,jet_phi_filter);
451 
452  if ( !passKinematicCut(jetItr) ) continue;
453 
454  // Jets passing kinematic cuts
455  Cutflow_Jet = 2;
456  jet_eta_kin = jetItr->eta();
457  jet_phi_kin = jetItr->phi();
458  fill(tool,Cutflow_Jet,jet_eta_kin,jet_phi_kin);
459 
460  jet_MV_2_beforeJVTCut = mv;
461  fill(tool,jet_MV_2_beforeJVTCut);
462 
463  if ( !passJVTCut(jetItr) ) continue;
464 
465  jet_MV_3_afterJVTCut = mv;
466  fill(tool,jet_MV_3_afterJVTCut);
467 
468  // Jets passing JVT cuts
469  Cutflow_Jet = 3;
470  jet_eta_jvt = jetItr->eta();
471  jet_phi_jvt = jetItr->phi();
472  fill(tool,Cutflow_Jet,jet_eta_jvt,jet_phi_jvt);
473 
474  //Loop over muon container
475  int n_isoMuons = 0, n_ptMuons = 0;
476  for (const auto muonItr : *muons) {
477  //Select muons which passed pT cut
478  if (muonItr->pt() / Gaudi::Units::GeV < m_MuonPtCut) continue;
479  bool inAcceptance = TMath::Abs(muonItr->eta()) < m_MuonEtaCut;
480  if (!inAcceptance) continue;
481  //Select medium muons?
482  //if ((*muonItr)->quality() > 1) continue; // 0 tight, 1 medium, medium <= 1 (includes 0)
483 
484  //Look for isolated muons, then check for DR < 0.4
485  float topoetcone20_value = -999.;
486  float ptvarcone30_value = -999.;
487  muonItr-> isolation(topoetcone20_value, xAOD::Iso::topoetcone20);
488  muonItr-> isolation(ptvarcone30_value, xAOD::Iso::ptvarcone30);
489  if (topoetcone20_value/muonItr->pt() > m_MuonTopoEtCone20Cut) continue;
490  if (ptvarcone30_value/muonItr->pt() > m_MuonPtVarCone30Cut) continue;
491  if (jetItr->p4().DeltaR(muonItr->p4())<0.4) ++n_isoMuons;
492 
493  //Look for muons with pT > 90% of jet pT, then check for DR < 0.4
494  if ( (muonItr->pt() > (0.9*jetItr->pt())) && (jetItr->p4().DeltaR(muonItr->p4())<0.4) ) ++n_ptMuons;
495  }
496 
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);
499 
500  if(n_isoMuons>0) continue;
501  if(n_ptMuons>0) continue;
502 
503  // Jets passing basic isolated-muon overlap
504  Cutflow_Jet = 4;
505  jet_eta_overlap = jetItr->eta();
506  jet_phi_overlap = jetItr->phi();
507  fill(tool,Cutflow_Jet,jet_eta_overlap,jet_phi_overlap);
508 
509  // Fill histograms with properties of jet associated tracks
510  // Check if jet is taggable (defined as goodJet or suspectJet or badJet)
511  Jet_t qualityLabel = getQualityLabel(jetItr, PVZ);
512 
513  //Fill Good jet plots including both good and suspect jets
514  if ( qualityLabel == goodJet || qualityLabel == suspectJet ) {
515  Cutflow_Jet = 5;
516 
517  jet_pT_good = jetItr->pt() / Gaudi::Units::GeV;
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);
521 
522  //fill good jet histograms, also with main High Level Tagger information
523  fillGoodJetHistos(jetItr);
524 
525  //fill good jet histograms, with Extra Taggers information, only if needed
527 
528  //Fill MV plots vs <mu>
529  auto jet_MV_mu_0_30 = Monitored::Scalar<float>("jet_MV_mu_0_30",0);
530  auto jet_MV_mu_30_50 = Monitored::Scalar<float>("jet_MV_mu_30_50",0);
531  auto jet_MV_mu_50_100 = Monitored::Scalar<float>("jet_MV_mu_50_100",0);
532 
533  if ( Run_mu > 0. && Run_mu < 30. ) {
534  jet_MV_mu_0_30 = mv;
535  fill(tool,jet_MV_mu_0_30);}
536  else if ( Run_mu > 30. && Run_mu < 50. ) {
537  jet_MV_mu_30_50 = mv;
538  fill(tool,jet_MV_mu_30_50);}
539  else if ( Run_mu > 50. && Run_mu < 100. ) {
540  jet_MV_mu_50_100 = mv;
541  fill(tool,jet_MV_mu_50_100);}
542 
543  //Fill ttbar plots
544  if (isTTbarEvent){// Looking for ttbar events
545  ++nTTbarGoodJets; //good jet counter, to check if jets are more than 2
546  if (nTTbarGoodJets == 1) firstTTbarJet = jetItr; //1st jet needed to fill ttbar histograms (if a 2nd jet is found later)
547  if(nTTbarGoodJets >= 2) { //at least 2 good jets --> fill ttbar histograms
548  fillTTbarEventJetHistos(jetItr); // fill histograms with b-tagging information
549  if (nTTbarGoodJets == 2) { //(at least) two good jets --> fill also for 1st jet
550  fillTTbarEventJetHistos(firstTTbarJet); // fill histograms with b-tagging information
551  }
552  }
553  }
554 
555  //Fill SMT jet plots (loop over muons looking for soft muons)
556  if (jetItr-> pt() / Gaudi::Units::GeV < m_JetPtCut) continue; // stronger Jet pT cut (25 GeV, eta < 2.5)
557  bool inAcceptance = TMath::Abs(jetItr-> eta()) < m_JetEtaCut; // usual eta cut
558  if (!inAcceptance) continue;
559 
560  SoftMuons_n = 0; //restarting counter;
561 
562  for (const auto softMuonItr : *muons) {
563  //Look for soft muons (for SMT jets selection)
564  //select soft muons which pass eta and pT cut
565  bool inAcceptance = TMath::Abs(softMuonItr->eta()) < m_MuonEtaCut;
566  if (!inAcceptance) continue;
567  //fixed pT cut > 5 GeV and < 25 GeV (accepted in pre-selection)
568  if (softMuonItr->pt() / Gaudi::Units::GeV < m_SoftMuonPtMin) continue;
569  if (softMuonItr->pt() / Gaudi::Units::GeV > m_SoftMuonPtMax) continue;
570  // NO QUALITY (previously tight muons)
571  //if (softMuonItr->quality() > 0) continue; // 0 tight, 1 medium, 1 & 0 tight & medium
572  const ElementLink< xAOD::TrackParticleContainer >& pMuIDTrack=softMuonItr->inDetTrackParticleLink();
573  const ElementLink< xAOD::TrackParticleContainer >& pMuMSTrack=softMuonItr->muonSpectrometerTrackParticleLink();
574  if ( !pMuIDTrack.isValid() || !pMuMSTrack.isValid()) continue;
575  if (softMuonItr->muonType()!= xAOD::Muon::Combined) continue; //combined
576  if (softMuonItr->primaryTrackParticle()->d0() > 0.4) continue; // d0 cut < 0.4 mm
577  //this need to be done at jet level
578  SMTJets_dr = (jetItr->p4()).DeltaR(softMuonItr->p4());
579  if ( SMTJets_dr >= 0.4) continue; //jet muon DR < 0.4
580  SoftMuons_pT = softMuonItr->pt() / Gaudi::Units::GeV;
581  smt_mu.SetPtEtaPhiE(softMuonItr->pt(),softMuonItr->eta(),softMuonItr->phi(),softMuonItr->e());
582  ++SoftMuons_n;
583  }//end loop on muons
584 
585  ATH_MSG_DEBUG("Number of soft muons per jet is " << SoftMuons_n);
586  fill(tool,SoftMuons_n);
587 
588  if( SoftMuons_n == 1){
589  SMTJets_pT = jetItr->pt() / Gaudi::Units::GeV;
590  jet_eta_smt = jetItr->eta();
591  jet_phi_smt = jetItr->phi();
592  smt_jet.SetPtEtaPhiE(jetItr->pt(),jetItr->eta(),jetItr->phi(),jetItr->e());
593  SMTJets_MV = mv;
594  ++SMTJets_n;
595  }
596 
597  //Suspect jets as sub-group of Good jets, but with separate plots
598  if ( qualityLabel == suspectJet ) {
599  Cutflow_Jet = 6;
600  jet_eta_suspect = jetItr->eta();
601  jet_phi_suspect = jetItr->phi();
602  fill(tool,Cutflow_Jet,jet_eta_suspect,jet_phi_suspect);
603  fillSuspectJetHistos(jetItr); //other histograms to fill
604  }
605  }
606  else if ( qualityLabel == badJet ) {
607  Cutflow_Jet = 7;
608  jet_eta_bad = jetItr->eta();
609  jet_phi_bad = jetItr->phi();
610  fill(tool,Cutflow_Jet,jet_eta_bad,jet_phi_bad);
611  }
612 
613  }
614  //end of jetItr loop
615 
616  if(isTTbarEvent){
617  ATH_MSG_DEBUG("Number of jets in ttbar events " << nTTbarGoodJets);
618  fill(tool,nTTbarGoodJets);
619  }
620 
621  ATH_MSG_DEBUG("Number of jets with == 1 soft muon per event is " << SMTJets_n);
622  fill(tool,SMTJets_n);
623 
624  if (SMTJets_n == 1){
625  SMTJets_pTratio = SoftMuons_pT/SMTJets_pT;
626  SMTJets_pTrel = smt_mu.Perp((smt_jet+smt_mu).Vect()) / Gaudi::Units::GeV;
627  fill(tool,SoftMuons_pT,SMTJets_pT,SMTJets_pTratio,SMTJets_pTrel,SMTJets_dr,SMTJets_MV,jet_eta_smt,jet_phi_smt);
628  }
629 
630  return StatusCode::SUCCESS;
631 }
632 
634 
635  bool pass_cuts = false;
636 
637  float jetQuality = jet->getAttribute<float>(xAOD::JetAttribute::LArQuality);
638  float jetTime = jet->getAttribute<float>(xAOD::JetAttribute::Timing);
639  float hecq = jet->getAttribute<float>(xAOD::JetAttribute::HECQuality);
640  float negE = jet->getAttribute<float>(xAOD::JetAttribute::NegativeE);
641  std::vector<float> SumPtTrkPt1000;
642  jet->getAttribute(xAOD::JetAttribute::SumPtTrkPt1000,SumPtTrkPt1000);
643  float chf = SumPtTrkPt1000.size() > 0 ? SumPtTrkPt1000.at(0)/jet->pt() : -1;
644  float emf = jet->getAttribute<float>(xAOD::JetAttribute::EMFrac);
645  float hecf = jet->getAttribute<float>(xAOD::JetAttribute::HECFrac);
646  float fracSamplingMax = jet->getAttribute<float>(xAOD::JetAttribute::FracSamplingMax);
647 
648  if (
649  !(
650  (hecf>0.5 && std::abs(hecq)>0.5) || (std::abs(negE) > 60*Gaudi::Units::GeV) ||
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)
656  )
657  ){
658  pass_cuts = true;
659  }
660 
661  if (m_SkipJetFilter) //In case of Ion-Ion or Ion-proton collision
662  pass_cuts = true; //Skip the Jet Filter cuts (thresholds tuned on pp event jets)
663 
664  return pass_cuts;
665 }
666 
668 
669  ATH_MSG_DEBUG("passKinematicCut()");
670  ATH_MSG_DEBUG("Jet kinematics: eta = " << jet->eta() << ", phi= " << jet->phi() << ", pT= " << jet->pt() / Gaudi::Units::GeV);
671 
672  if ( jet->pt() / Gaudi::Units::GeV < m_JetPtCut || std::abs(jet->eta()) > m_JetEtaCut )
673  return false;
674 
675  return true;
676 }
677 
678 
680 
681  ATH_MSG_DEBUG("passJVTCut()");
682 
683  static const SG::AuxElement::Accessor<float> JVT( "Jvt" );
684  float jvt = JVT(*jet);
685 
686  if( (jet->pt()/Gaudi::Units::GeV < m_JVTpTCut) && (std::abs(jet->eta())<m_JVTetaCut) && (jvt < m_JVTCut) )
687  return false;
688 
689  return true;
690 }
691 
693 
694  ATH_MSG_DEBUG("retrieving DL1* weight");
695 
696  const xAOD::BTagging *bTaggingObject = xAOD::BTaggingUtilities::getBTagging( *jet );
697  if ( !bTaggingObject ) {
698  ATH_MSG_DEBUG( "Could not retrieve b-tagging object from selected jet." );
699  return 0;
700  }
701 
702  double mv = 0, mv_pu = 0, mv_pb = 0, mv_pc = 0;
703 
704  bTaggingObject->pu(m_TaggerName,mv_pu);
705  bTaggingObject->pc(m_TaggerName,mv_pc);
706  bTaggingObject->pb(m_TaggerName,mv_pb);
707  //DL1* formula (standard)
708  if ( mv_pb != 0 && (mv_pu != 0 || mv_pc != 0)) {
709  mv = log( mv_pb / ( mv_pu * ( 1 - m_cFraction ) + mv_pc * m_cFraction ) );
710  }
711 
712  return mv;
713 }
714 
716 
717  double mv = getTaggerWeight(jet);
718 
719  auto tool = getGroup("JetTagMonitor");
720 
721  auto TTbarJets_MV = Monitored::Scalar<float>("TTbarJets_MV",0);
722 
723  TTbarJets_MV=mv;
724  fill(tool,TTbarJets_MV);
725 
726  auto TTbarJets_n_60tag = Monitored::Scalar<int>("TTbarJets_n_60tag",0);
727  auto TTbarJets_n_70tag = Monitored::Scalar<int>("TTbarJets_n_70tag",0);
728  auto TTbarJets_n_77tag = Monitored::Scalar<int>("TTbarJets_n_77tag",0);
729  auto TTbarJets_n_85tag = Monitored::Scalar<int>("TTbarJets_n_85tag",0);
730 
731  auto TTbarJets_pT_60tag = Monitored::Scalar<float>("TTbarJets_pT_60tag",0);
732  auto TTbarJets_pT_70tag = Monitored::Scalar<float>("TTbarJets_pT_70tag",0);
733  auto TTbarJets_pT_77tag = Monitored::Scalar<float>("TTbarJets_pT_77tag",0);
734  auto TTbarJets_pT_85tag = Monitored::Scalar<float>("TTbarJets_pT_85tag",0);
735 
736  if (mv > m_WP85Cut) {
737  fill(tool,TTbarJets_n_85tag);
738  TTbarJets_pT_85tag=jet->pt() / Gaudi::Units::GeV;
739  fill(tool,TTbarJets_pT_85tag);
740  if (mv > m_WP77Cut) {
741  fill(tool,TTbarJets_n_77tag);
742  TTbarJets_pT_77tag=jet->pt() / Gaudi::Units::GeV;
743  fill(tool,TTbarJets_pT_77tag);
744  if (mv > m_WP70Cut) {
745  fill(tool,TTbarJets_n_70tag);
746  TTbarJets_pT_70tag=jet->pt() / Gaudi::Units::GeV;
747  fill(tool,TTbarJets_pT_70tag);
748  if (mv > m_WP60Cut) {
749  fill(tool,TTbarJets_n_60tag);
750  TTbarJets_pT_60tag=jet->pt() / Gaudi::Units::GeV;
751  fill(tool,TTbarJets_pT_60tag);
752  }
753  }
754  }
755  }
756 
757  auto TTbarJets_n = Monitored::Scalar<int>("TTbarJets_n",0);
758  auto pass85n = Monitored::Scalar<bool>("pass85n",false);
759  auto pass77n = Monitored::Scalar<bool>("pass77n",false);
760  auto pass70n = Monitored::Scalar<bool>("pass70n",false);
761  auto pass60n = Monitored::Scalar<bool>("pass60n",false);
762  pass85n = mv > m_WP85Cut;
763  pass77n = mv > m_WP77Cut;
764  pass70n = mv > m_WP70Cut;
765  pass60n = mv > m_WP60Cut;
766 
767  auto TTbarJets_pT = Monitored::Scalar<float>("TTbarJets_pT",0);
768  TTbarJets_pT=jet->pt() / Gaudi::Units::GeV;
769  auto pass85p = Monitored::Scalar<bool>("pass85p",false);
770  auto pass77p = Monitored::Scalar<bool>("pass77p",false);
771  auto pass70p = Monitored::Scalar<bool>("pass70p",false);
772  auto pass60p = Monitored::Scalar<bool>("pass60p",false);
773  pass85p = mv > m_WP85Cut;
774  pass77p = mv > m_WP77Cut;
775  pass70p = mv > m_WP70Cut;
776  pass60p = mv > m_WP60Cut;
777  fill(tool,TTbarJets_n,pass85n,pass77n,pass70n,pass60n,TTbarJets_pT,pass85p,pass77p,pass70p,pass60p);
778 
779  return;
780 }
781 
782 
784 
785  double mv = getTaggerWeight(jet);
786 
787  auto tool = getGroup("JetTagMonitor");
788 
789  auto jet_MV_good = Monitored::Scalar<float>("jet_MV_good",0);
790 
791  jet_MV_good = mv;
792  fill(tool,jet_MV_good);
793 
794  auto jet_MV_pt_0_20 = Monitored::Scalar<float>("jet_MV_pt_0_20",0);
795  auto jet_MV_pt_20_40 = Monitored::Scalar<float>("jet_MV_pt_20_40",0);
796  auto jet_MV_pt_40_70 = Monitored::Scalar<float>("jet_MV_pt_40_70",0);
797  auto jet_MV_pt_70_100 = Monitored::Scalar<float>("jet_MV_pt_70_100",0);
798  auto jet_MV_pt_100_150 = Monitored::Scalar<float>("jet_MV_pt_100_150",0);
799  auto jet_MV_pt_150_200 = Monitored::Scalar<float>("jet_MV_pt_150_200",0);
800  auto jet_MV_pt_200_1000 = Monitored::Scalar<float>("jet_MV_pt_200_1000",0);
801 
802  if ( jet->pt() / Gaudi::Units::GeV < 1000. ) {
803  if ( jet->pt() / Gaudi::Units::GeV > 200. ) {
804  jet_MV_pt_200_1000=mv;
805  fill(tool,jet_MV_pt_200_1000);}
806  else if ( jet->pt() / Gaudi::Units::GeV > 150. ) {
807  jet_MV_pt_150_200=mv;
808  fill(tool,jet_MV_pt_150_200);}
809  else if ( jet->pt() / Gaudi::Units::GeV > 100. ) {
810  jet_MV_pt_100_150=mv;
811  fill(tool,jet_MV_pt_100_150);}
812  else if ( jet->pt() / Gaudi::Units::GeV > 70. ) {
813  jet_MV_pt_70_100=mv;
814  fill(tool,jet_MV_pt_70_100);}
815  else if ( jet->pt() / Gaudi::Units::GeV > 40. ) {
816  jet_MV_pt_40_70=mv;
817  fill(tool,jet_MV_pt_40_70);}
818  else if ( jet->pt() / Gaudi::Units::GeV > 20. ) {
819  jet_MV_pt_20_40=mv;
820  fill(tool,jet_MV_pt_20_40);}
821  else if ( jet->pt() / Gaudi::Units::GeV > 0. ) {
822  jet_MV_pt_0_20=mv;
823  fill(tool,jet_MV_pt_0_20);}
824 
825  }
826 
827  auto jet_MV_eta_00_05 = Monitored::Scalar<float>("jet_MV_eta_00_05",0);
828  auto jet_MV_eta_05_10 = Monitored::Scalar<float>("jet_MV_eta_05_10",0);
829  auto jet_MV_eta_10_15 = Monitored::Scalar<float>("jet_MV_eta_10_15",0);
830  auto jet_MV_eta_15_20 = Monitored::Scalar<float>("jet_MV_eta_15_20",0);
831  auto jet_MV_eta_20_25 = Monitored::Scalar<float>("jet_MV_eta_20_25",0);
832 
833  auto jet_MV_phi_00_05 = Monitored::Scalar<float>("jet_MV_phi_00_05",0);
834  auto jet_MV_phi_05_10 = Monitored::Scalar<float>("jet_MV_phi_05_10",0);
835  auto jet_MV_phi_10_15 = Monitored::Scalar<float>("jet_MV_phi_10_15",0);
836  auto jet_MV_phi_15_20 = Monitored::Scalar<float>("jet_MV_phi_15_20",0);
837  auto jet_MV_phi_20_25 = Monitored::Scalar<float>("jet_MV_phi_20_25",0);
838  auto jet_MV_phi_25_31 = Monitored::Scalar<float>("jet_MV_phi_25_31",0);
839 
840  if ( std::abs(jet->eta()) > 2.0 ) {
841  jet_MV_eta_20_25=mv;
842  fill(tool,jet_MV_eta_20_25);}
843  else if ( std::abs(jet->eta()) > 1.5 ) {
844  jet_MV_eta_15_20=mv;
845  fill(tool,jet_MV_eta_15_20);}
846  else if ( std::abs(jet->eta()) > 1.0 ) {
847  jet_MV_eta_10_15=mv;
848  fill(tool,jet_MV_eta_10_15);}
849  else if ( std::abs(jet->eta()) > 0.5 ) {
850  jet_MV_eta_05_10=mv;
851  fill(tool,jet_MV_eta_05_10);}
852  else if ( std::abs(jet->eta()) > 0.0 ) {
853  jet_MV_eta_00_05=mv;
854  fill(tool,jet_MV_eta_00_05);}
855 
856  if ( std::abs(jet->phi()) > 2.5 ) {
857  jet_MV_phi_25_31=mv;
858  fill(tool,jet_MV_phi_25_31);}
859  else if ( std::abs(jet->phi()) > 2.0 ) {
860  jet_MV_phi_20_25=mv;
861  fill(tool,jet_MV_phi_20_25);}
862  else if ( std::abs(jet->phi()) > 1.5 ) {
863  jet_MV_phi_15_20=mv;
864  fill(tool,jet_MV_phi_15_20);}
865  else if ( std::abs(jet->phi()) > 1.0 ) {
866  jet_MV_phi_10_15=mv;
867  fill(tool,jet_MV_phi_10_15);}
868  else if ( std::abs(jet->phi()) > 0.5 ) {
869  jet_MV_phi_05_10=mv;
870  fill(tool,jet_MV_phi_05_10);}
871  else if ( std::abs(jet->phi()) > 0.0 ) {
872  jet_MV_phi_00_05=mv;
873  fill(tool,jet_MV_phi_00_05);}
874 
875  auto jet_eta_60tag = Monitored::Scalar<float>("jet_eta_60tag",0);
876  auto jet_eta_70tag = Monitored::Scalar<float>("jet_eta_70tag",0);
877  auto jet_eta_77tag = Monitored::Scalar<float>("jet_eta_77tag",0);
878  auto jet_eta_85tag = Monitored::Scalar<float>("jet_eta_85tag",0);
879 
880  auto jet_phi_60tag = Monitored::Scalar<float>("jet_phi_60tag",0);
881  auto jet_phi_70tag = Monitored::Scalar<float>("jet_phi_70tag",0);
882  auto jet_phi_77tag = Monitored::Scalar<float>("jet_phi_77tag",0);
883  auto jet_phi_85tag = Monitored::Scalar<float>("jet_phi_85tag",0);
884 
885  if ( mv > m_WP85Cut ) {
886  jet_eta_85tag = jet->eta();
887  jet_phi_85tag = jet->phi();
888  fill(tool,jet_eta_85tag,jet_phi_85tag);
889  if ( mv > m_WP77Cut ) {
890  jet_eta_77tag = jet->eta();
891  jet_phi_77tag = jet->phi();
892  fill(tool,jet_eta_77tag,jet_phi_77tag);
893  if ( mv > m_WP70Cut ) {
894  jet_eta_70tag = jet->eta();
895  jet_phi_70tag = jet->phi();
896  fill(tool,jet_eta_70tag,jet_phi_70tag);
897  if ( mv > m_WP60Cut ) {
898  jet_eta_60tag = jet->eta();
899  jet_phi_60tag = jet->phi();
900  fill(tool,jet_eta_60tag,jet_phi_60tag);
901  }
902  }
903  }
904  }
905 
906  auto jet_eta = Monitored::Scalar<float>("jet_eta",0);
907  jet_eta = jet->eta();
908  auto pass85e = Monitored::Scalar<bool>("pass85e",false);
909  auto pass77e = Monitored::Scalar<bool>("pass77e",false);
910  auto pass70e = Monitored::Scalar<bool>("pass70e",false);
911  auto pass60e = Monitored::Scalar<bool>("pass60e",false);
912  pass85e = mv > m_WP85Cut;
913  pass77e = mv > m_WP77Cut;
914  pass70e = mv > m_WP70Cut;
915  pass60e = mv > m_WP60Cut;
916 
917  auto jet_phi = Monitored::Scalar<float>("jet_phi",0);
918  auto pass85f = Monitored::Scalar<bool>("pass85f",false);
919  auto pass77f = Monitored::Scalar<bool>("pass77f",false);
920  auto pass70f = Monitored::Scalar<bool>("pass70f",false);
921  auto pass60f = Monitored::Scalar<bool>("pass60f",false);
922  jet_phi = jet->phi();
923  pass85f = mv > m_WP85Cut;
924  pass77f = mv > m_WP77Cut;
925  pass70f = mv > m_WP70Cut;
926  pass60f = mv > m_WP60Cut;
927  fill(tool,jet_eta,pass85e,pass77e,pass70e,pass60e,jet_phi,pass85f,pass77f,pass70f,pass60f);
928 
929  return;
930 }
931 
933 
934  double mv = getTaggerWeight(jet);
935 
936  auto tool = getGroup("JetTagMonitor");
937 
938  auto jet_MV_suspect = Monitored::Scalar<float>("jet_MV_suspect",0);
939  auto jet_pT_suspect = Monitored::Scalar<float>("jet_pT_suspect",0);
940 
941  jet_MV_suspect = mv;
942  jet_pT_suspect = jet->pt() / Gaudi::Units::GeV;
943  fill(tool,jet_MV_suspect,jet_pT_suspect);
944 
945  auto sus_jet_MV_pt_0_20 = Monitored::Scalar<float>("sus_jet_MV_pt_0_20",0);
946  auto sus_jet_MV_pt_20_40 = Monitored::Scalar<float>("sus_jet_MV_pt_20_40",0);
947  auto sus_jet_MV_pt_40_70 = Monitored::Scalar<float>("sus_jet_MV_pt_40_70",0);
948  auto sus_jet_MV_pt_70_100 = Monitored::Scalar<float>("sus_jet_MV_pt_70_100",0);
949  auto sus_jet_MV_pt_100_150 = Monitored::Scalar<float>("sus_jet_MV_pt_100_150",0);
950  auto sus_jet_MV_pt_150_200 = Monitored::Scalar<float>("sus_jet_MV_pt_150_200",0);
951  auto sus_jet_MV_pt_200_1000 = Monitored::Scalar<float>("sus_jet_MV_pt_200_1000",0);
952 
953  if ( jet->pt() / Gaudi::Units::GeV < 1000. ) {
954  if ( jet->pt() / Gaudi::Units::GeV > 200. ) {
955  sus_jet_MV_pt_200_1000=mv;
956  fill(tool,sus_jet_MV_pt_200_1000);}
957  else if ( jet->pt() / Gaudi::Units::GeV > 150. ) {
958  sus_jet_MV_pt_150_200=mv;
959  fill(tool,sus_jet_MV_pt_150_200);}
960  else if ( jet->pt() / Gaudi::Units::GeV > 100. ) {
961  sus_jet_MV_pt_100_150=mv;
962  fill(tool,sus_jet_MV_pt_100_150);}
963  else if ( jet->pt() / Gaudi::Units::GeV > 70. ) {
964  sus_jet_MV_pt_70_100=mv;
965  fill(tool,sus_jet_MV_pt_70_100);}
966  else if ( jet->pt() / Gaudi::Units::GeV > 40. ) {
967  sus_jet_MV_pt_40_70=mv;
968  fill(tool,sus_jet_MV_pt_40_70);}
969  else if ( jet->pt() / Gaudi::Units::GeV > 20. ) {
970  sus_jet_MV_pt_20_40=mv;
971  fill(tool,sus_jet_MV_pt_20_40);}
972  else if ( jet->pt() / Gaudi::Units::GeV > 0. ) {
973  sus_jet_MV_pt_0_20=mv;
974  fill(tool,sus_jet_MV_pt_0_20);}
975 
976  }
977 
978  auto sus_jet_MV_eta_00_05 = Monitored::Scalar<float>("sus_jet_MV_eta_00_05",0);
979  auto sus_jet_MV_eta_05_10 = Monitored::Scalar<float>("sus_jet_MV_eta_05_10",0);
980  auto sus_jet_MV_eta_10_15 = Monitored::Scalar<float>("sus_jet_MV_eta_10_15",0);
981  auto sus_jet_MV_eta_15_20 = Monitored::Scalar<float>("sus_jet_MV_eta_15_20",0);
982  auto sus_jet_MV_eta_20_25 = Monitored::Scalar<float>("sus_jet_MV_eta_20_25",0);
983 
984  auto sus_jet_MV_phi_00_05 = Monitored::Scalar<float>("sus_jet_MV_phi_00_05",0);
985  auto sus_jet_MV_phi_05_10 = Monitored::Scalar<float>("sus_jet_MV_phi_05_10",0);
986  auto sus_jet_MV_phi_10_15 = Monitored::Scalar<float>("sus_jet_MV_phi_10_15",0);
987  auto sus_jet_MV_phi_15_20 = Monitored::Scalar<float>("sus_jet_MV_phi_15_20",0);
988  auto sus_jet_MV_phi_20_25 = Monitored::Scalar<float>("sus_jet_MV_phi_20_25",0);
989  auto sus_jet_MV_phi_25_31 = Monitored::Scalar<float>("sus_jet_MV_phi_25_31",0);
990 
991  if ( std::abs(jet->eta()) > 2.0 ) {
992  sus_jet_MV_eta_20_25=mv;
993  fill(tool,sus_jet_MV_eta_20_25);}
994  else if ( std::abs(jet->eta()) > 1.5 ) {
995  sus_jet_MV_eta_15_20=mv;
996  fill(tool,sus_jet_MV_eta_15_20);}
997  else if ( std::abs(jet->eta()) > 1.0 ) {
998  sus_jet_MV_eta_10_15=mv;
999  fill(tool,sus_jet_MV_eta_10_15);}
1000  else if ( std::abs(jet->eta()) > 0.5 ) {
1001  sus_jet_MV_eta_05_10=mv;
1002  fill(tool,sus_jet_MV_eta_05_10);}
1003  else if ( std::abs(jet->eta()) > 0.0 ) {
1004  sus_jet_MV_eta_00_05=mv;
1005  fill(tool,sus_jet_MV_eta_00_05);}
1006 
1007  if ( std::abs(jet->phi()) > 2.5 ) {
1008  sus_jet_MV_phi_25_31=mv;
1009  fill(tool,sus_jet_MV_phi_25_31);}
1010  else if ( std::abs(jet->phi()) > 2.0 ) {
1011  sus_jet_MV_phi_20_25=mv;
1012  fill(tool,sus_jet_MV_phi_20_25);}
1013  else if ( std::abs(jet->phi()) > 1.5 ) {
1014  sus_jet_MV_phi_15_20=mv;
1015  fill(tool,sus_jet_MV_phi_15_20);}
1016  else if ( std::abs(jet->phi()) > 1.0 ) {
1017  sus_jet_MV_phi_10_15=mv;
1018  fill(tool,sus_jet_MV_phi_10_15);}
1019  else if ( std::abs(jet->phi()) > 0.5 ) {
1020  sus_jet_MV_phi_05_10=mv;
1021  fill(tool,sus_jet_MV_phi_05_10);}
1022  else if ( std::abs(jet->phi()) > 0.0 ) {
1023  sus_jet_MV_phi_00_05=mv;
1024  fill(tool,sus_jet_MV_phi_00_05);}
1025 
1026  auto sus_jet_eta_60tag = Monitored::Scalar<float>("sus_jet_eta_60tag",0);
1027  auto sus_jet_eta_70tag = Monitored::Scalar<float>("sus_jet_eta_70tag",0);
1028  auto sus_jet_eta_77tag = Monitored::Scalar<float>("sus_jet_eta_77tag",0);
1029  auto sus_jet_eta_85tag = Monitored::Scalar<float>("sus_jet_eta_85tag",0);
1030 
1031  auto sus_jet_phi_60tag = Monitored::Scalar<float>("sus_jet_phi_60tag",0);
1032  auto sus_jet_phi_70tag = Monitored::Scalar<float>("sus_jet_phi_70tag",0);
1033  auto sus_jet_phi_77tag = Monitored::Scalar<float>("sus_jet_phi_77tag",0);
1034  auto sus_jet_phi_85tag = Monitored::Scalar<float>("sus_jet_phi_85tag",0);
1035 
1036  if ( mv > m_WP85Cut ) {
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);
1040  if ( mv > m_WP77Cut ) {
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);
1044  if ( mv > m_WP70Cut ) {
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);
1048  if ( mv > m_WP60Cut ) {
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);
1052  }
1053  }
1054  }
1055  }
1056 
1057  auto sus_jet_eta = Monitored::Scalar<float>("sus_jet_eta",0);
1058  sus_jet_eta = jet->eta();
1059  auto pass85e = Monitored::Scalar<bool>("pass85e",false);
1060  auto pass77e = Monitored::Scalar<bool>("pass77e",false);
1061  auto pass70e = Monitored::Scalar<bool>("pass70e",false);
1062  auto pass60e = Monitored::Scalar<bool>("pass60e",false);
1063  pass85e = mv > m_WP85Cut;
1064  pass77e = mv > m_WP77Cut;
1065  pass70e = mv > m_WP70Cut;
1066  pass60e = mv > m_WP60Cut;
1067 
1068  auto sus_jet_phi = Monitored::Scalar<float>("sus_jet_phi",0);
1069  auto pass85f = Monitored::Scalar<bool>("pass85f",false);
1070  auto pass77f = Monitored::Scalar<bool>("pass77f",false);
1071  auto pass70f = Monitored::Scalar<bool>("pass70f",false);
1072  auto pass60f = Monitored::Scalar<bool>("pass60f",false);
1073  sus_jet_phi = jet->phi();
1074  pass85f = mv > m_WP85Cut;
1075  pass77f = mv > m_WP77Cut;
1076  pass70f = mv > m_WP70Cut;
1077  pass60f = mv > m_WP60Cut;
1078  fill(tool,sus_jet_eta,pass85e,pass77e,pass70e,pass60e,sus_jet_phi,pass85f,pass77f,pass70f,pass60f);
1079 
1080  return;
1081 }
1082 
1084 
1085  const xAOD::BTagging *bTaggingObject = xAOD::BTaggingUtilities::getBTagging( *jet );
1086  if ( !bTaggingObject ) {
1087  ATH_MSG_DEBUG( "Could not retrieve b-tagging object from selected jet." );
1088  return;
1089  }
1090 
1091  auto tool = getGroup("JetTagMonitor");
1092 
1093  auto jet_MV_pu_good = Monitored::Scalar<float>("jet_MV_pu_good",0);
1094  auto jet_MV_pc_good = Monitored::Scalar<float>("jet_MV_pc_good",0);
1095  auto jet_MV_pb_good = Monitored::Scalar<float>("jet_MV_pb_good",0);
1096 
1097  double mv_pu = 0, mv_pb = 0, mv_pc = 0;
1098 
1099  bTaggingObject->pu(m_TaggerName,mv_pu);
1100  bTaggingObject->pc(m_TaggerName,mv_pc);
1101  bTaggingObject->pb(m_TaggerName,mv_pb);
1102  jet_MV_pu_good = mv_pu;
1103  jet_MV_pc_good = mv_pc;
1104  jet_MV_pb_good = mv_pb;
1105 
1106  fill(tool,jet_MV_pu_good,jet_MV_pc_good,jet_MV_pb_good);
1107 
1108  return;
1109 }
1110 
1111 
1113 
1114  const xAOD::BTagging *bTaggingObject = xAOD::BTaggingUtilities::getBTagging( *jet );
1115  if ( !bTaggingObject ) {
1116  ATH_MSG_DEBUG( "Could not retrieve b-tagging object from selected jet." );
1117  return badJet;
1118  }
1119 
1120  auto tool = getGroup("JetTagMonitor");
1121 
1122  float jetTrack_pT = 0;
1123  float jetTrack_eta = 0;
1124  float jetTrack_phi = 0;
1125 
1126  int nTracks = 0;
1127  int nLooseTracks = 0;
1128  int nKinTracks = 0;
1129  int nIPTracks = 0;
1130  int nIBLTracks = 0;
1131 
1132  auto JetTracks_n_0_all = Monitored::Scalar<int>("JetTracks_n_0_all",0);
1133  auto JetTracks_pT_0_all = Monitored::Scalar<float>("JetTracks_pT_0_all",0);
1134  auto JetTracks_eta_0_all = Monitored::Scalar<float>("JetTracks_eta_0_all",0);
1135  auto JetTracks_phi_0_all = Monitored::Scalar<float>("JetTracks_phi_0_all",0);
1136  auto JetTracks_DR_0_all = Monitored::Scalar<float>("JetTracks_DR_0_all",0);
1137 
1138  auto JetTracks_n_1_loose = Monitored::Scalar<int>("JetTracks_n_1_loose",0);
1139  auto JetTracks_pT_1_loose = Monitored::Scalar<float>("JetTracks_pT_1_loose",0);
1140  auto JetTracks_eta_1_loose = Monitored::Scalar<float>("JetTracks_eta_1_loose",0);
1141  auto JetTracks_phi_1_loose = Monitored::Scalar<float>("JetTracks_phi_1_loose",0);
1142 
1143  //Loose tracks --> fill hits and impact parameters distributions
1144  auto JetTracks_Hits_IBL = Monitored::Scalar<int>("JetTracks_Hits_IBL",0);
1145  auto JetTracks_Hits_IBL_expect = Monitored::Scalar<int>("JetTracks_Hits_IBL_expect",0);
1146  auto JetTracks_eta_loose_IBL = Monitored::Scalar<float>("JetTracks_eta_loose_IBL",0);
1147  auto JetTracks_phi_loose_IBL = Monitored::Scalar<float>("JetTracks_phi_loose_IBL",0);
1148  auto JetTracks_Hits_BL = Monitored::Scalar<int>("JetTracks_Hits_BL",0);
1149  auto JetTracks_Hits_BL_expect = Monitored::Scalar<int>("JetTracks_Hits_BL_expect",0);
1150  auto JetTracks_eta_loose_BL = Monitored::Scalar<float>("JetTracks_eta_loose_BL",0);
1151  auto JetTracks_phi_loose_BL = Monitored::Scalar<float>("JetTracks_phi_loose_BL",0);
1152 
1153  auto JetTracks_Hits_PIX = Monitored::Scalar<int>("JetTracks_Hits_PIX",0);
1154  auto JetTracks_Hits_SCT = Monitored::Scalar<int>("JetTracks_Hits_SCT",0);
1155  auto JetTracks_Hits_TRT = Monitored::Scalar<int>("JetTracks_Hits_TRT",0);
1156 
1157  auto JetTracks_Holes_PIX = Monitored::Scalar<int>("JetTracks_Holes_PIX",0);
1158  auto JetTracks_Holes_SCT = Monitored::Scalar<int>("JetTracks_Holes_SCT",0);
1159  auto JetTracks_Holes_TRT = Monitored::Scalar<int>("JetTracks_Holes_TRT",0);
1160 
1161  auto JetTracks_Hits_Si = Monitored::Scalar<int>("JetTracks_Hits_Si",0);
1162  auto JetTracks_Holes_Si = Monitored::Scalar<int>("JetTracks_Holes_Si",0);
1163 
1164  auto JetTracks_IP_d0 = Monitored::Scalar<float>("JetTracks_IP_d0",0);
1165  auto JetTracks_IP_d0s = Monitored::Scalar<float>("JetTracks_IP_d0s",0);
1166  auto JetTracks_IP_d0si = Monitored::Scalar<float>("JetTracks_IP_d0si",0);
1167  auto JetTracks_IP_z0 = Monitored::Scalar<float>("JetTracks_IP_z0",0);
1168  auto JetTracks_IP_z0s = Monitored::Scalar<float>("JetTracks_IP_z0s",0);
1169  auto JetTracks_IP_z0si = Monitored::Scalar<float>("JetTracks_IP_z0si",0);
1170  auto JetTracks_IP_z0sin = Monitored::Scalar<float>("JetTracks_IP_z0sin",0);
1171 
1172  //Complete selection for jet quality classification
1173  auto JetTracks_n_2_kin = Monitored::Scalar<int>("JetTracks_n_2_kin",0);
1174  auto JetTracks_eta_2_kin = Monitored::Scalar<float>("JetTracks_eta_2_kin",0);
1175  auto JetTracks_phi_2_kin = Monitored::Scalar<float>("JetTracks_phi_2_kin",0);
1176 
1177  auto JetTracks_n_3_IP = Monitored::Scalar<int>("JetTracks_n_3_IP",0);
1178  auto JetTracks_eta_3_IP = Monitored::Scalar<float>("JetTracks_eta_3_IP",0);
1179  auto JetTracks_phi_3_IP = Monitored::Scalar<float>("JetTracks_phi_3_IP",0);
1180 
1181  auto JetTracks_n_4_IBL = Monitored::Scalar<int>("JetTracks_n_4_IBL",0);
1182  auto JetTracks_eta_4_IBL = Monitored::Scalar<float>("JetTracks_eta_4_IBL",0);
1183  auto JetTracks_phi_4_IBL = Monitored::Scalar<float>("JetTracks_phi_4_IBL",0);
1184 
1185  TLorentzVector jet_TLV;
1186  jet_TLV.SetPtEtaPhiE(jet->pt(), jet->eta(), jet->phi(), jet->e());
1187 
1189  BTagTrackToJetAssociatorAcc("BTagTrackToJetAssociator");
1190  std::vector<ElementLink<xAOD::TrackParticleContainer>> assocTracks =
1191  BTagTrackToJetAssociatorAcc(*bTaggingObject);
1192 
1193  nTracks = assocTracks.size();
1194 
1195  for ( const ElementLink< xAOD::TrackParticleContainer >& jetTracks : assocTracks ) {
1196  if ( not jetTracks.isValid() ) continue;
1197  const xAOD::TrackParticle* jetTrackItr = *jetTracks;
1198 
1199  jetTrack_pT = jetTrackItr->pt() / Gaudi::Units::GeV;
1200  jetTrack_eta = jetTrackItr->eta();
1201  jetTrack_phi = jetTrackItr->phi();
1202 
1203  JetTracks_pT_0_all = jetTrack_pT;
1204  JetTracks_eta_0_all = jetTrack_eta;
1205  JetTracks_phi_0_all = jetTrack_phi;
1206 
1207  TLorentzVector JetTrack_TLV;
1208  JetTrack_TLV.SetPtEtaPhiE(jetTrackItr->pt(), jetTrackItr->eta(), jetTrackItr->phi(), jetTrackItr->e());
1209 
1210  JetTracks_DR_0_all = jet_TLV.DeltaR(JetTrack_TLV);
1211 
1212  fill(tool,JetTracks_eta_0_all,JetTracks_phi_0_all,JetTracks_pT_0_all,JetTracks_DR_0_all);
1213 
1214  //Select Loose tracks
1215  if(m_TrackSelectionTool->accept(*jetTracks)){
1216 
1217  nLooseTracks++;
1218 
1219  JetTracks_pT_1_loose = jetTrack_pT;
1220  JetTracks_eta_1_loose = jetTrack_eta;
1221  JetTracks_phi_1_loose = jetTrack_phi;
1222 
1223  //Hits, holes
1224  uint8_t expectHitIBL=0;
1225  uint8_t nHitIBL=0;
1226  jetTrackItr->summaryValue(expectHitIBL, xAOD::expectInnermostPixelLayerHit);
1227  jetTrackItr->summaryValue(nHitIBL, xAOD::numberOfInnermostPixelLayerHits);
1228  JetTracks_Hits_IBL = nHitIBL;
1229  if(expectHitIBL < 1)
1230  JetTracks_Hits_IBL_expect = -1;
1231  else{
1232  JetTracks_Hits_IBL_expect = nHitIBL;
1233  JetTracks_eta_loose_IBL = jetTrack_eta;
1234  JetTracks_phi_loose_IBL = jetTrack_phi;
1235  }
1236 
1237  uint8_t expectHitBL=0;
1238  uint8_t nHitBL=0;
1239  jetTrackItr->summaryValue(expectHitBL, xAOD::expectNextToInnermostPixelLayerHit);
1241  JetTracks_Hits_BL = nHitBL;
1242  if(expectHitBL < 1)
1243  JetTracks_Hits_BL_expect = -1;
1244  else{
1245  JetTracks_Hits_BL_expect = nHitBL;
1246  JetTracks_eta_loose_BL = jetTrack_eta;
1247  JetTracks_phi_loose_BL = jetTrack_phi;
1248  }
1249 
1250  uint8_t nHitPix=0;
1251  uint8_t nHolePix=0;
1252  uint8_t nDeadPix;
1253  jetTrackItr->summaryValue(nHitPix, xAOD::numberOfPixelHits);
1254  jetTrackItr->summaryValue(nHolePix, xAOD::numberOfPixelHoles);
1255  jetTrackItr->summaryValue(nDeadPix, xAOD::numberOfPixelDeadSensors);
1256  nHitPix += std::max((int)nDeadPix, 0);
1257  JetTracks_Hits_PIX = nHitPix;
1258  JetTracks_Holes_PIX = nHolePix;
1259 
1260  uint8_t nHitSCT=0;
1261  uint8_t nHoleSCT=0;
1262  uint8_t nDeadSCT;
1263  jetTrackItr->summaryValue(nHitSCT, xAOD::numberOfSCTHits);
1264  jetTrackItr->summaryValue(nHoleSCT, xAOD::numberOfSCTHoles);
1265  jetTrackItr->summaryValue(nDeadSCT, xAOD::numberOfSCTDeadSensors);
1266  nHitSCT += std::max((int)nDeadSCT, 0);
1267  JetTracks_Hits_SCT = nHitSCT;
1268  JetTracks_Holes_SCT = nHoleSCT;
1269 
1270  uint8_t nHitTRT=0;
1271  jetTrackItr->summaryValue(nHitTRT, xAOD::numberOfTRTHits);
1272  JetTracks_Hits_TRT = nHitTRT;
1273 
1274  JetTracks_Hits_Si = nHitPix + nHitSCT;
1275  JetTracks_Holes_Si = nHolePix + nHoleSCT;
1276 
1277  //Impact parameters
1278  JetTracks_IP_d0 = jetTrackItr->d0();
1279  JetTracks_IP_d0s = sqrt( jetTrackItr->definingParametersCovMatrix()( Trk::d0, Trk::d0 ) ); //sigma
1280  JetTracks_IP_d0si = JetTracks_IP_d0/JetTracks_IP_d0s; //significance
1281 
1282  float PVZ = PV_Z;
1283  JetTracks_IP_z0 = jetTrackItr->z0() + jetTrackItr->vz() - PVZ;
1284  JetTracks_IP_z0s = sqrt( jetTrackItr->definingParametersCovMatrix()( Trk::z0, Trk::z0 ) ); //sigma
1285  JetTracks_IP_z0si = JetTracks_IP_z0/JetTracks_IP_z0s; //significance
1286  JetTracks_IP_z0sin = JetTracks_IP_z0*sin(jetTrackItr->theta()); //z0_sin(theta)
1287 
1288  fill(tool,
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,
1294  JetTracks_Hits_TRT,
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
1297  );
1298 
1299  //Tracks passing pT cut (1 GeV)
1300  if(JetTracks_pT_0_all > m_TrackPtCut){
1301 
1302  //Number of tracks passing pT cut
1303  nKinTracks++;
1304 
1305  JetTracks_eta_2_kin = jetTrack_eta;
1306  JetTracks_phi_2_kin = jetTrack_phi;
1307 
1308  fill(tool,JetTracks_eta_2_kin,JetTracks_phi_2_kin);
1309 
1310  // Tracks passing IP selection (d0, z0sin)
1311  if(std::abs(JetTracks_IP_d0) < m_Trackd0Cut && std::abs(JetTracks_IP_z0sin) < m_Trackz0sinCut){
1312 
1313  //Number of tracks passing IP cuts
1314  nIPTracks++;
1315 
1316  JetTracks_eta_3_IP = jetTrack_eta;
1317  JetTracks_phi_3_IP = jetTrack_phi;
1318 
1319  fill(tool,JetTracks_eta_3_IP,JetTracks_phi_3_IP);
1320 
1321  // Tracks passing IBL or BLayer selection (if expected, hit)
1322  if(m_TrackHitIBLCut == 0 || (JetTracks_Hits_IBL_expect != 0 && JetTracks_Hits_BL_expect != 0) ){
1323 
1324  nIBLTracks++;
1325 
1326  JetTracks_eta_4_IBL = jetTrack_eta;
1327  JetTracks_phi_4_IBL = jetTrack_phi;
1328 
1329  fill(tool,JetTracks_eta_4_IBL,JetTracks_phi_4_IBL);
1330 
1331  }//IBL sel
1332  }//IP sel
1333  }//kin sel
1334  }//loose sel
1335  }//jet tracks loop
1336 
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);
1343 
1344  // goodJet = jet with at least one associated track passing loose selection
1345  // suspectJet = as goodJet but, at least one associated track does not pass IBL or BL hit additional selection
1346  // badJet = not goodJet (i.e. no associated track passing loose selection)
1347 
1348  if(nLooseTracks < m_MinGoodTrackCut) return badJet;
1349 
1350  if(nIBLTracks < nIPTracks) return suspectJet;
1351 
1352  return goodJet;
1353 }
JetTagMonitorAlgorithm::m_WP60Cut
float m_WP60Cut
Definition: JetTagMonitorAlgorithm.h:111
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
xAOD::numberOfPixelHoles
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
Definition: TrackingPrimitives.h:261
JetTagMonitorAlgorithm::m_JVTpTCut
float m_JVTpTCut
Definition: JetTagMonitorAlgorithm.h:106
xAOD::Iso::ptvarcone30
@ ptvarcone30
Definition: IsolationType.h:56
JetTagMonitorAlgorithm::m_MuonContainerKey
SG::ReadHandleKey< xAOD::MuonContainer > m_MuonContainerKey
Definition: JetTagMonitorAlgorithm.h:68
JetTagMonitorAlgorithm::goodJet
@ goodJet
Definition: JetTagMonitorAlgorithm.h:116
JetTagMonitorAlgorithm::suspectJet
@ suspectJet
Definition: JetTagMonitorAlgorithm.h:116
AthMonitorAlgorithm::lbInteractionsPerCrossing
virtual float lbInteractionsPerCrossing(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate instantaneous number of interactions, i.e.
Definition: AthMonitorAlgorithm.cxx:234
xAOD::Iso::topoetcone20
@ topoetcone20
Topo-cluster ET-sum.
Definition: IsolationType.h:48
xAOD::Iso::ptvarcone20
@ ptvarcone20
Mini-Isolation http://arxiv.org/abs/1007.2221.
Definition: IsolationType.h:55
xAOD::JetAttribute::LArQuality
@ LArQuality
Definition: JetAttributes.h:83
max
#define max(a, b)
Definition: cfImp.cxx:41
JetTagMonitorAlgorithm::m_JetEtaCut
float m_JetEtaCut
Definition: JetTagMonitorAlgorithm.h:92
xAOD::JetAttribute::FracSamplingMax
@ FracSamplingMax
Definition: JetAttributes.h:116
JetTagMonitorAlgorithm::fillExtraTaggerHistos
void fillExtraTaggerHistos(const xAOD::Jet *jet) const
Definition: JetTagMonitorAlgorithm.cxx:1083
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
JetTagMonitorAlgorithm::m_WP77Cut
float m_WP77Cut
Definition: JetTagMonitorAlgorithm.h:113
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
TauGNNUtils::Variables::Track::nPixelHits
bool nPixelHits(const xAOD::TauJet &, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:542
JetTagMonitorAlgorithm::m_MuonEtaCut
float m_MuonEtaCut
Definition: JetTagMonitorAlgorithm.h:96
JetTagMonitorAlgorithm::m_WP85Cut
float m_WP85Cut
Definition: JetTagMonitorAlgorithm.h:114
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
JetTagMonitorAlgorithm::passJVTCut
bool passJVTCut(const xAOD::Jet *jet) const
Definition: JetTagMonitorAlgorithm.cxx:679
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
met::DeltaR
@ DeltaR
Definition: METRecoCommon.h:11
xAOD::TrackParticle_v1::summaryValue
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
Definition: TrackParticle_v1.cxx:736
xAOD::TrackParticle_v1::vz
float vz() const
The z origin for the parameters.
JetTagMonitorAlgorithm::m_ElectronContainerKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_ElectronContainerKey
Definition: JetTagMonitorAlgorithm.h:69
JetTagMonitorAlgorithm::m_ElectronEtaCut
float m_ElectronEtaCut
Definition: JetTagMonitorAlgorithm.h:98
JetTagMonitorAlgorithm::Jet_t
Jet_t
Definition: JetTagMonitorAlgorithm.h:116
test_pyathena.pt
pt
Definition: test_pyathena.py:11
xAOD::TrackParticle_v1::z0
float z0() const
Returns the parameter.
Trk::z0
@ z0
Definition: ParamDefs.h:70
JetTagMonitorAlgorithm::m_TrackHitIBLCut
int m_TrackHitIBLCut
Definition: JetTagMonitorAlgorithm.h:89
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
JetTagMonitorAlgorithm::fillSuspectJetHistos
void fillSuspectJetHistos(const xAOD::Jet *jet) const
Definition: JetTagMonitorAlgorithm.cxx:932
xAOD::expectInnermostPixelLayerHit
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
Definition: TrackingPrimitives.h:236
xAOD::numberOfTRTHits
@ numberOfTRTHits
number of TRT hits [unit8_t].
Definition: TrackingPrimitives.h:275
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
JetTagMonitorAlgorithm::m_MuonEtIsoDecorKey
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_MuonEtIsoDecorKey
Definition: JetTagMonitorAlgorithm.h:73
xAOD::TrackParticle_v1::d0
float d0() const
Returns the parameter.
JetTagMonitorAlgorithm::m_cFraction
float m_cFraction
Definition: JetTagMonitorAlgorithm.h:110
xAOD::EventInfo_v1::Error
@ Error
The sub-detector issued an error.
Definition: EventInfo_v1.h:349
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
JetTagMonitorAlgorithm::passKinematicCut
bool passKinematicCut(const xAOD::Jet *jet) const
Definition: JetTagMonitorAlgorithm.cxx:667
JetTagMonitorAlgorithm::m_JVTCut
float m_JVTCut
Definition: JetTagMonitorAlgorithm.h:105
xAOD::JetAttribute::HECQuality
@ HECQuality
Definition: JetAttributes.h:80
JetTagMonitorAlgorithm::JetTagMonitorAlgorithm
JetTagMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition: JetTagMonitorAlgorithm.cxx:7
JetTagMonitorAlgorithm::m_btagResultKey
SG::ReadDecorHandleKey< xAOD::BTaggingContainer > m_btagResultKey
Definition: JetTagMonitorAlgorithm.h:71
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
JetTagMonitorAlgorithm::m_TrackSelectionTool
ToolHandle< InDet::IInDetTrackSelectionTool > m_TrackSelectionTool
Definition: JetTagMonitorAlgorithm.h:78
xAOD::expectNextToInnermostPixelLayerHit
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
Definition: TrackingPrimitives.h:247
xAOD::BTagging_v1::pc
bool pc(const std::string &taggername, double &value) const
Definition: BTagging_v1.cxx:367
JetTagMonitorAlgorithm::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: JetTagMonitorAlgorithm.cxx:87
Monitored
Generic monitoring tool for athena components.
Definition: GenericMonitoringTool.h:30
JetTagMonitorAlgorithm::m_btagLinkKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_btagLinkKey
Definition: JetTagMonitorAlgorithm.h:70
xAOD::JetAttribute::EMFrac
@ EMFrac
Definition: JetAttributes.h:112
JetTagMonitorAlgorithm::m_DoExtraTaggerHistos
bool m_DoExtraTaggerHistos
Definition: JetTagMonitorAlgorithm.h:83
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JetTagMonitorAlgorithm::m_WP70Cut
float m_WP70Cut
Definition: JetTagMonitorAlgorithm.h:112
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
JetTagMonitorAlgorithm::m_SoftMuonPtMin
float m_SoftMuonPtMin
Definition: JetTagMonitorAlgorithm.h:93
JetTagMonitorAlgorithm::m_TrackPtCut
float m_TrackPtCut
Definition: JetTagMonitorAlgorithm.h:86
xAOD::JetAttribute::SumPtTrkPt1000
@ SumPtTrkPt1000
Definition: JetAttributes.h:107
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
xAOD::JetAttribute::Timing
@ Timing
Definition: JetAttributes.h:90
JetTagMonitorAlgorithm.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
JetTagMonitorAlgorithm::fillTTbarEventJetHistos
void fillTTbarEventJetHistos(const xAOD::Jet *jet) const
Definition: JetTagMonitorAlgorithm.cxx:715
JetTagMonitorAlgorithm::m_SkipPreSelection
bool m_SkipPreSelection
Definition: JetTagMonitorAlgorithm.h:80
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
JetTagMonitorAlgorithm::m_MinGoodTrackCut
int m_MinGoodTrackCut
Definition: JetTagMonitorAlgorithm.h:85
xAOD::numberOfSCTHoles
@ numberOfSCTHoles
number of SCT holes [unit8_t].
Definition: TrackingPrimitives.h:270
JetTagMonitorAlgorithm::m_Trackd0Cut
float m_Trackd0Cut
Definition: JetTagMonitorAlgorithm.h:87
xAOD::BTagging_v1
Definition: BTagging_v1.h:39
AthMonitorAlgorithm::GetEventInfo
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
Definition: AthMonitorAlgorithm.cxx:107
JetTagMonitorAlgorithm::m_MuonPtCut
float m_MuonPtCut
Definition: JetTagMonitorAlgorithm.h:95
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
JetTagMonitorAlgorithm::m_TaggerName
std::string m_TaggerName
Definition: JetTagMonitorAlgorithm.h:109
xAOD::BTagging_v1::pu
bool pu(const std::string &taggername, double &value) const
Definition: BTagging_v1.cxx:353
xAOD::numberOfNextToInnermostPixelLayerHits
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
Definition: TrackingPrimitives.h:248
xAOD::TrackParticle_v1::definingParametersCovMatrix
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
Definition: TrackParticle_v1.cxx:246
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Trk::d0
@ d0
Definition: ParamDefs.h:69
JetTagMonitorAlgorithm::m_MuonPtVarCone30Cut
float m_MuonPtVarCone30Cut
Definition: JetTagMonitorAlgorithm.h:104
JetTagMonitorAlgorithm::getTaggerWeight
double getTaggerWeight(const xAOD::Jet *jet) const
Definition: JetTagMonitorAlgorithm.cxx:692
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
TauGNNUtils::Variables::Track::nSCTHits
bool nSCTHits(const xAOD::TauJet &, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:549
JetTagMonitorAlgorithm::m_ElePtIsoDecorKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_ElePtIsoDecorKey
Definition: JetTagMonitorAlgorithm.h:76
xAOD::TrackParticle_v1::e
virtual double e() const override final
The total energy of the particle.
Definition: TrackParticle_v1.cxx:109
JetTagMonitorAlgorithm::m_JetPtCut
float m_JetPtCut
Definition: JetTagMonitorAlgorithm.h:91
JetTagMonitorAlgorithm::m_JetContainerKey
SG::ReadHandleKey< xAOD::JetContainer > m_JetContainerKey
Definition: JetTagMonitorAlgorithm.h:67
JetTagMonitorAlgorithm::getQualityLabel
Jet_t getQualityLabel(const xAOD::Jet *jet, float PV_Z) const
Definition: JetTagMonitorAlgorithm.cxx:1112
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
xAOD::BTaggingUtilities::getBTagging
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
Definition: BTaggingUtilities.cxx:37
JetTagMonitorAlgorithm::m_MuonPtIsoDecorKey
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_MuonPtIsoDecorKey
Definition: JetTagMonitorAlgorithm.h:74
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
JetTagMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: JetTagMonitorAlgorithm.cxx:55
JetTagMonitorAlgorithm::~JetTagMonitorAlgorithm
virtual ~JetTagMonitorAlgorithm()
Definition: JetTagMonitorAlgorithm.cxx:53
xAOD::numberOfSCTDeadSensors
@ numberOfSCTDeadSensors
number of dead SCT sensors crossed [unit8_t].
Definition: TrackingPrimitives.h:273
JetTagMonitorAlgorithm::m_ElectronPtCut
float m_ElectronPtCut
Definition: JetTagMonitorAlgorithm.h:97
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
JetTagMonitorAlgorithm::m_JVTetaCut
float m_JVTetaCut
Definition: JetTagMonitorAlgorithm.h:107
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
JetTagMonitorAlgorithm::m_ElectronTopoEtCone20Cut
float m_ElectronTopoEtCone20Cut
Definition: JetTagMonitorAlgorithm.h:101
JetTagMonitorAlgorithm::m_EleEtIsoDecorKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_EleEtIsoDecorKey
Definition: JetTagMonitorAlgorithm.h:75
xAOD::JetAttribute::HECFrac
@ HECFrac
Definition: JetAttributes.h:113
JetTagMonitorAlgorithm::m_SoftMuonPtMax
float m_SoftMuonPtMax
Definition: JetTagMonitorAlgorithm.h:94
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
JetTagMonitorAlgorithm::m_ElectronPtVarCone20Cut
float m_ElectronPtVarCone20Cut
Definition: JetTagMonitorAlgorithm.h:102
Trk::jet_phi
@ jet_phi
Definition: JetVtxParamDefs.h:28
xAOD::numberOfPixelDeadSensors
@ numberOfPixelDeadSensors
number of dead pixel sensors crossed [unit8_t].
Definition: TrackingPrimitives.h:266
JetTagMonitorAlgorithm::fillGoodJetHistos
void fillGoodJetHistos(const xAOD::Jet *jet) const
Definition: JetTagMonitorAlgorithm.cxx:783
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
JetTagMonitorAlgorithm::m_VertContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_VertContainerKey
Definition: JetTagMonitorAlgorithm.h:64
JetTagMonitorAlgorithm::m_ElectronEtaCrackLowCut
float m_ElectronEtaCrackLowCut
Definition: JetTagMonitorAlgorithm.h:99
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
JetTagMonitorAlgorithm::passJetFilterCut
bool passJetFilterCut(const xAOD::Jet *jet) const
Definition: JetTagMonitorAlgorithm.cxx:633
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
xAOD::TrackParticle_v1::theta
float theta() const
Returns the parameter, which has range 0 to .
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
JetTagMonitorAlgorithm::badJet
@ badJet
Definition: JetTagMonitorAlgorithm.h:116
JetTagMonitorAlgorithm::m_ElectronEtaCrackHighCut
float m_ElectronEtaCrackHighCut
Definition: JetTagMonitorAlgorithm.h:100
xAOD::EventInfo_v1::Core
@ Core
Core flags describing the event.
Definition: EventInfo_v1.h:339
JetTagMonitorAlgorithm::m_MuonTopoEtCone20Cut
float m_MuonTopoEtCone20Cut
Definition: JetTagMonitorAlgorithm.h:103
JetTagMonitorAlgorithm::m_Trackz0sinCut
float m_Trackz0sinCut
Definition: JetTagMonitorAlgorithm.h:88
AthMonitorAlgorithm::getGroup
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
Definition: AthMonitorAlgorithm.cxx:164
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
HI::SubCalo::Lists::Tile
constexpr std::initializer_list< int > Tile
Definition: HIEventDefs.h:70
xAOD::JetAttribute::NegativeE
@ NegativeE
Definition: JetAttributes.h:84
xAOD::TrackParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
xAOD::numberOfInnermostPixelLayerHits
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
Definition: TrackingPrimitives.h:237
JetTagMonitorAlgorithm::m_TrackContainerKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackContainerKey
Definition: JetTagMonitorAlgorithm.h:65
xAOD::EgammaParameters::AuthorElectron
const uint16_t AuthorElectron
Object Reconstructed by standard cluster-based algorithm.
Definition: EgammaDefs.h:24
xAOD::BTagging_v1::pb
bool pb(const std::string &taggername, double &value) const
Definition: BTagging_v1.cxx:360
JetTagMonitorAlgorithm::m_SkipJetFilter
bool m_SkipJetFilter
Definition: JetTagMonitorAlgorithm.h:81