ATLAS Offline Software
ColumnarMETMaker.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // ColumnarMETMaker.cxx
8 // Implementation file for class ColumnarMETMaker
9 // Author: T.J.Khoo<khoo@cern.ch>
11 
12 // METUtilities includes
15 
16 // MET EDM
22 
23 // Jet EDM
24 #include "xAODJet/JetAttributes.h"
25 
26 // Tracking EDM
29 
30 // Shallow copy
31 #include "xAODCore/ShallowCopy.h"
32 
33 // Muon EDM
34 #include "xAODMuon/MuonContainer.h"
35 
36 // Electron EDM
39 
40 // framework includes
42 #include <AsgTools/AsgToolConfig.h>
46 
47 #include <memory>
48 
49 namespace met {
50 
51  using xAOD::MissingET;
57  using xAOD::IParticle;
59  using xAOD::JetContainer;
61  using xAOD::TrackParticle;
62 
64  static const SG::AuxElement::ConstAccessor< iplink_t > acc_originalObject("originalObjectLink");
65  static const SG::AuxElement::ConstAccessor< iplink_t > acc_nominalObject("nominalObjectLink");
66  static const SG::AuxElement::ConstAccessor< std::vector<iplink_t > > acc_ghostMuons("GhostMuon");
67 
68  static const SG::AuxElement::ConstAccessor<float> acc_Eloss("EnergyLoss");
69 
70  static const SG::AuxElement::Accessor< std::vector<iplink_t> > dec_constitObjLinks("ConstitObjectLinks");
71  static const SG::AuxElement::Accessor< std::vector<float> > dec_constitObjWeights("ConstitObjectWeights");
72 
74  // Public methods:
76 
77  // Constructors
80  AsgTool(name),
81  m_PVkey("PrimaryVertices"),
82  m_trkseltool(""),
83  m_JvtTool("", this)
84  {
85  //
86  // Property declaration
87  //
88  declareProperty("JetJvtMomentName", m_jetJvtMomentName = "Jvt" );
89  declareProperty("JetRejectionDec", m_jetRejectionDec = "" );
90  declareProperty("JetMinEFrac", m_jetMinEfrac = 0.0 );
91  declareProperty("JetMinWeightedPt", m_jetMinWeightedPt = 20.0e3 );
92  declareProperty("JetConstitScaleMom", m_jetConstitScaleMom = "JetConstitScaleMomentum");
93  declareProperty("CorrectJetPhi", m_jetCorrectPhi = false );
94  declareProperty("DoPFlow", m_doPFlow = false );
95  declareProperty("DoSoftTruth", m_doSoftTruth = false );
96  declareProperty("DoJetTruth", m_doConstJet = false );
97 
98  declareProperty("JetSelection", m_jetSelection = "Tight" );
99  declareProperty("JetEtaMax", m_JetEtaMax = 4.5 );
100  declareProperty("JetEtaForw", m_JetEtaForw = 2.5 );
101  declareProperty("CustomCentralJetPt", m_customCenJetPtCut = 20e3 );
102  declareProperty("CustomForwardJetPt", m_customFwdJetPtCut = 20e3 );
103  declareProperty("CustomJetJvtPtMax", m_customJvtPtMax = 60e3 );
104  declareProperty("CustomJetJvtWP", m_customJvtWP = "FixedEffPt" );
105 
106  declareProperty("DoMuonEloss", m_muEloss = false );
107  declareProperty("ORCaloTaggedMuons", m_orCaloTaggedMuon = true );
108  declareProperty("GreedyPhotons", m_greedyPhotons = false );
109  declareProperty("VeryGreedyPhotons", m_veryGreedyPhotons = false );
110 
111  declareProperty("UseGhostMuons", m_useGhostMuons = false );
112  declareProperty("DoRemoveMuonJets", m_doRemoveMuonJets = true );
113  declareProperty("DoSetMuonJetEMScale", m_doSetMuonJetEMScale = true );
114 
115  declareProperty("DoRemoveElecTrks", m_doRemoveElecTrks = true );
116  declareProperty("DoRemoveElecTrksEM", m_doRemoveElecTrksEM = false );
117 
118  declareProperty("skipSystematicJetSelection", m_skipSystematicJetSelection = false,
119  "EXPERIMENTAL: whether to use simplified OR based on nominal jets "
120  "and for jet-related systematics only. "
121  "WARNING: this property is strictly for doing physics studies of the feasibility "
122  "of this OR scheme, it should not be used in a regular analysis");
123 
124  // muon overlap variables (expert use only)
125  declareProperty("JetTrkNMuOlap", m_jetTrkNMuOlap = 5 );
126  declareProperty("JetWidthMuOlap", m_jetWidthMuOlap = 0.1 );
127  declareProperty("JetPsEMuOlap", m_jetPsEMuOlap = 2.5e3 );
128  declareProperty("JetEmfMuOlap", m_jetEmfMuOlap = 0.9 );
129  declareProperty("JetTrkPtMuPt", m_jetTrkPtMuPt = 0.8 );
130  declareProperty("muIDPTJetPtRatioMuOlap", m_muIDPTJetPtRatioMuOlap = 2.0 );
131 
132  declareProperty("MissingObjWarnThreshold", m_missObjWarningPtThreshold = 7.0e3 );
133 
134  declareProperty("TrackSelectorTool", m_trkseltool );
135  declareProperty("JvtSelTool", m_JvtTool );
136  }
137 
138  // Destructor
141  = default;
142 
143  // Athena algtool's Hooks
146  {
147  ATH_MSG_INFO ("Initializing " << name() << "...");
148 
149  ATH_MSG_INFO("Use jet selection criterion: " << m_jetSelection << " PFlow: " << m_doPFlow);
150  if (m_jetSelection == "Loose") { m_CenJetPtCut = 20e3; m_FwdJetPtCut = 20e3; m_JvtWP = "FixedEffPt"; m_JvtPtMax = 60e3; }
151  else if (m_jetSelection == "Tight") { m_CenJetPtCut = 20e3; m_FwdJetPtCut = 30e3; m_JvtWP = "FixedEffPt"; m_JvtPtMax = 60e3; }
152  else if (m_jetSelection == "Tighter"){ m_CenJetPtCut = 20e3; m_FwdJetPtCut = 35e3; m_JvtWP = "FixedEffPt"; m_JvtPtMax = 60e3; }
153  else if (m_jetSelection == "Tenacious"){ m_CenJetPtCut = 20e3; m_FwdJetPtCut = 40e3; m_JvtWP = "FixedEffPt"; m_JvtPtMax = 60e3; }
154  else if (m_jetSelection == "Tier0") { m_CenJetPtCut = 0; m_FwdJetPtCut = 0; m_JvtWP = "None"; }
155  else if (m_jetSelection == "Expert") {
156  ATH_MSG_INFO("Custom jet selection configured. *** FOR EXPERT USE ONLY ***");
161  }
162  else if (m_jetSelection == "HRecoil") {
163  ATH_MSG_INFO("Jet selection for hadronic recoil calculation is configured.");
164  m_CenJetPtCut = 9999e3;
165  m_FwdJetPtCut = 9999e3;
166  m_JetEtaMax = 5;
167  m_JvtWP = "None";
168  }
169  else {
170  if (m_jetSelection == "Default") ATH_MSG_WARNING( "WARNING: Default is now deprecated" );
171  ATH_MSG_ERROR( "Error: No available jet selection found! Please update JetSelection in ColumnarMETMaker. Choose one: Loose, Tight (recommended), Tighter, Tenacious" );
172  return StatusCode::FAILURE;
173  }
174 
175  if (!m_trkseltool.empty()) ATH_CHECK( m_trkseltool.retrieve() );
176 
177  if (m_JvtWP != "None"){
178  if (m_JvtTool.empty()) {
179  asg::AsgToolConfig config_jvt ("CP::NNJvtSelectionTool/JvtSelTool");
180  ATH_CHECK(config_jvt.setProperty("WorkingPoint", m_JvtWP));
181  ATH_CHECK(config_jvt.setProperty("JvtMomentName", "NNJvt"));
182  ATH_CHECK(config_jvt.setProperty("MaxPtForJvt", m_JvtPtMax));
183  ATH_CHECK(config_jvt.makePrivateTool(m_JvtTool));
184  }
185  ATH_CHECK(m_JvtTool.retrieve());
186  }
187 
188  // ReadHandleKey(s)
189  ATH_CHECK( m_PVkey.initialize() );
190 
191  // configurable accessors
192  if (!m_jetRejectionDec.empty()) {
193  m_acc_jetRejectionDec.emplace (*this, m_jetRejectionDec);
194  ATH_MSG_INFO("Applying additional jet rejection criterium in MET calculation: " << m_jetRejectionDec);
195  }
196 
197  ATH_MSG_INFO("Suppressing warnings of objects missing in METAssociationMap for objects with pT < " << m_missObjWarningPtThreshold/1e3 << " GeV.");
198 
199  // overlap removal simplification?
201  ATH_MSG_INFO("Requesting simplified overlap removal procedure in MET calculation");
202  }
203 
204  if (!m_inputPreselectionName.empty()) {
206  }
207  if (!m_jetConstitScaleMom.empty()) {
209  m_jetConstitScaleMomFixedAcc.emplace(*this, "JetConstitScaleMomentum");
210  }
211  return StatusCode::SUCCESS;
212  }
213 
214 
215  // **** Rebuild generic MET term ****
216 
217  StatusCode ColumnarMETMaker::rebuildMET(const std::string& metKey,
218  xAOD::Type::ObjectType metType,
219  xAOD::MissingETContainer* metCont,
220  const xAOD::IParticleContainer* collection,
223  {
224  if (!metCont)
225  {
226  ATH_MSG_ERROR("No MET container provided");
227  return StatusCode::FAILURE;
228  }
229  if (!collection)
230  {
231  ATH_MSG_ERROR("No input collection provided for MET term \"" << metKey << "\"");
232  return StatusCode::FAILURE;
233  }
234 
235  return rebuildMET(metKey,metType,columnar::MutableMetRange (*metCont),columnar::ParticleRange (*collection),m_assocAcc(helper),objScale);
236  }
237 
238  StatusCode ColumnarMETMaker::rebuildMET(const std::string& metKey,
239  xAOD::Type::ObjectType metType,
241  columnar::ParticleRange collection,
244  {
246  switch(metType) {
248  metSource = MissingETBase::Source::electron();
249  break;
250  case xAOD::Type::Photon:
251  metSource = MissingETBase::Source::photon();
252  break;
253  case xAOD::Type::Tau:
254  metSource = MissingETBase::Source::tau();
255  break;
256  case xAOD::Type::Muon:
257  metSource = MissingETBase::Source::muon();
258  break;
259  case xAOD::Type::Jet:
260  ATH_MSG_WARNING("Incorrect use of rebuildMET -- use rebuildJetMET for RefJet term");
261  return StatusCode::FAILURE;
262  default:
263  ATH_MSG_WARNING("Invalid object type provided: " << metType);
264  return StatusCode::FAILURE;
265  }
266 
267  columnar::MutableMetId met = m_outputMetMapAcc.fillMET (metCont, metKey, metSource);
268 
269  // If muon eloss corrections are required, create a new term to hold these if it doesn't already exist
270  if(metType==xAOD::Type::Muon && (m_muEloss || m_doSetMuonJetEMScale)) {
271  if (m_outputMetMapAcc.tryCreateIfMissing (metCont, "MuonEloss", MissingETBase::Source::Type::Muon | MissingETBase::Source::Category::Calo) != StatusCode::SUCCESS) {
272  ATH_MSG_ERROR("failed to create Muon Eloss MET term");
273  return StatusCode::FAILURE;
274  }
275  }
276 
277  return rebuildMET(met,collection,helper,objScale);
278  }
279 
281  const xAOD::IParticleContainer* collection,
284  {
285  if (!met)
286  {
287  ATH_MSG_ERROR("No MET object provided");
288  return StatusCode::FAILURE;
289  }
290  if (!collection)
291  {
292  ATH_MSG_ERROR("No input collection provided for MET term \"" << met->name() << "\"");
293  return StatusCode::FAILURE;
294  }
295 
297  }
298 
300  columnar::ParticleRange collection,
303  {
305  bool removeOverlap = true;
306  if (m_inputObjTypeAcc(collection) == xAOD::Type::Muon) {
308  removeOverlap = false;
309  }
312  return rebuildMET(met,collection,helper,p,removeOverlap,objScale);
313  }
314 
316  const xAOD::IParticleContainer* collection,
319  bool removeOverlap,
320  MissingETBase::UsageHandler::Policy objScale) const {
321  if(!met || !collection) {
322  ATH_MSG_ERROR("Invalid pointer supplied for "
323  << "MET (" << met << ") or "
324  << "collection (" << collection << ").");
325  return StatusCode::FAILURE;
326  }
327 
328  return rebuildMET(columnar::MutableMetId(*met),columnar::ParticleRange (*collection),m_assocAcc(helper),p,removeOverlap,objScale);
329  }
330 
332  columnar::ParticleRange collection,
335  bool removeOverlap,
336  MissingETBase::UsageHandler::Policy objScale) const {
337  if(helper.map().empty()) {
338  ATH_MSG_WARNING("Incomplete association map received. Cannot rebuild MET.");
339  ATH_MSG_WARNING("Note: ColumnarMETMaker should only be run on events containing at least one PV");
340  return StatusCode::SUCCESS;
341  }
342  ATH_MSG_VERBOSE("Building MET term " << met(m_outputMetNameAcc));
344 
345  if(collection.empty()) return StatusCode::SUCCESS;
346  columnar::MetHelpers::OriginalObjectHandle collectionOriginals(*this,collection);
347 
348  if(collectionOriginals.isShallowCopy() && collectionOriginals.originalInputs()) {
349  ATH_MSG_WARNING("Shallow copy provided without \"originalObjectLinks\" decoration! "
350  << "Overlap removal cannot be done. "
351  << "Will not compute this term.");
352  ATH_MSG_WARNING("Please apply xAOD::setOriginalObjectLink() from xAODBase/IParticleHelpers.h");
353  return StatusCode::SUCCESS;
354  }
355  ATH_MSG_VERBOSE("Original inputs? " << collectionOriginals.originalInputs());
356  for(const auto obj : collection) {
358  bool selected = false;
359  auto orig = collectionOriginals.getOriginal(obj);
360  auto assocs = helper.getAssociations(orig);
361  if(assocs.empty()) {
362  std::string message = "Object is not in association map. Did you make a deep copy but fail to set the \"originalObjectLinks\" decoration? "
363  "If not, Please apply xAOD::setOriginalObjectLink() from xAODBase/IParticleHelpers.h";
364  // Avoid warnings for leptons with pT below threshold for association map
367  } else {
369  }
370  // if this is an uncalibrated electron below the threshold, then we put it into the soft term
372  metWeights.emplace_back( obj, 0 );
373  message = "Missing an electron from the MET map. Included as a track in the soft term. pT: " + std::to_string(m_inputMomAcc.pt(obj)/1e3) + " GeV";
376  } else {
378  }
379  continue;
380  } else {
381  ATH_MSG_ERROR("Missing an object: " << m_inputObjTypeAcc(orig) << " pT: " << m_inputMomAcc.pt(obj)/1e3 << " GeV, may be duplicated in the soft term.");
382  }
383  }
384 
385  // If the object has already been selected and processed, ignore it.
386  if(helper.objSelected(orig)) continue;
387  selected = helper.selectIfNoOverlaps(orig,p) || !removeOverlap;
388  ATH_MSG_VERBOSE(m_inputObjTypeAcc(obj) << " (" << orig <<") with pt " << m_inputMomAcc.pt(obj)
389  << " is " << ( selected ? "non-" : "") << "overlapping");
390 
391  // Greedy photon options: set selection flags
393  for(auto assoc : assocs){
394  auto indices = m_assocAcc.overlapIndices(assoc,orig);
395  auto allObjects = m_assocAcc.objects(assoc);
396  for (size_t index : indices){
397  const xAOD::IParticle* thisObj = allObjects[index].getXAODObject();
398  if(!thisObj) continue;
399  if ((thisObj->type() == xAOD::Type::Jet && m_veryGreedyPhotons) ||
400  thisObj->type() == xAOD::Type::Electron)
401  helper.setObjSelectionFlag(assoc, thisObj, true);
402  }
403  }
404  }
405 
406  //Do special overlap removal for calo tagged muons
407  if(m_orCaloTaggedMuon && !removeOverlap && m_inputObjTypeAcc(orig)==xAOD::Type::Muon && m_inputMuonTypeAcc.getOptional(orig)==xAOD::Muon::CaloTagged) {
408  for (decltype(auto) assoc : assocs) {
409  auto ind = m_assocAcc.overlapIndices(assoc,orig);
410  auto allObjects = m_assocAcc.objects(assoc);
411  for (size_t indi = 0; indi < ind.size(); indi++) if (allObjects[ind[indi]]) {
412  if (allObjects[ind[indi]].isContainer<columnar::ContainerId::electron>()
413  && helper.objSelected(assoc, ind[indi])) {
414  selected = false;
415  break;
416  }
417  }
418  }
419  }
420  // Don't overlap remove muons, but flag the non-overlapping muons to take out their tracks from jets
421  // Removed eloss from here -- clusters already flagged.
422  // To be handled in rebuildJetMET
423  if(selected) {
425  ATH_MSG_VERBOSE("Add object with pt " << m_inputMomAcc.pt(obj));
427  } else {
428  MissingETBase::Types::constvec_t constvec = helper.getConstVec(obj,objScale);
429  ATH_MSG_VERBOSE("Add truth object with pt " << constvec.cpt());
430  m_outputMetMomAcc.addParticle (met, constvec.cpx(),constvec.cpy(),constvec.cpt());
431  }
432  metWeights.emplace_back( obj, 1. );
433  }
434  }
435  ATH_MSG_DEBUG("Built met term " << met(m_outputMetNameAcc) << ", with magnitude " << m_outputMetMomAcc.met(met));
436  return StatusCode::SUCCESS;
437  }
438 
439  StatusCode ColumnarMETMaker::rebuildJetMET(const std::string& metJetKey,
440  const std::string& softKey,
441  xAOD::MissingETContainer* metCont,
442  const xAOD::JetContainer* jets,
443  const xAOD::MissingETContainer* metCoreCont,
445  bool doJetJVT) const
446  {
447  if (!metCont || !metCoreCont)
448  {
449  ATH_MSG_ERROR("No MET container provided");
450  return StatusCode::FAILURE;
451  }
452  if (!jets)
453  {
454  ATH_MSG_ERROR("No input collection provided for MET term \"" << metJetKey << "\" and soft term: " << softKey);
455  return StatusCode::FAILURE;
456  }
457 
458  return rebuildJetMET(metJetKey,softKey,columnar::MutableMetRange(*metCont),columnar::JetRange(*jets),columnar::Met1Range(*metCoreCont),m_assocAcc(helper),doJetJVT);
459  }
460 
461  StatusCode ColumnarMETMaker::rebuildJetMET(const std::string& metJetKey,
462  const std::string& softKey,
465  columnar::Met1Range metCoreCont,
467  bool doJetJVT) const
468  {
469  ATH_MSG_VERBOSE("Rebuild jet term: " << metJetKey << " and soft term: " << softKey);
470 
471  columnar::MutableMetId metJet {m_outputMetMapAcc.fillMET (metCont, metJetKey, MissingETBase::Source::jet())};
472 
473  columnar::OptMet1Id coreSoftClus, coreSoftTrk;
474  columnar::OptMutableMetId metSoftClus, metSoftTrk;
475 
476  columnar::OptMet1Id coreSoft = m_inputMetMapAcc(metCoreCont,softKey+"Core");
477  if(!coreSoft) {
478  ATH_MSG_WARNING("Invalid soft term key supplied: " << softKey);
479  return StatusCode::FAILURE;
480  }
482  coreSoftTrk = coreSoft;
483 
484  metSoftTrk = m_outputMetMapAcc.fillMET (metCont, softKey, coreSoftTrk.value()(m_inputMetSourceAcc));
485  } else {
486  coreSoftClus = coreSoft;
487 
488  metSoftClus = m_outputMetMapAcc.fillMET (metCont, softKey, coreSoftClus.value()(m_inputMetSourceAcc));
489  }
490 
491  return rebuildJetMET(metJet, metCont, jets, helper,
492  metSoftClus, coreSoftClus,
493  metSoftTrk, coreSoftTrk,
494  doJetJVT);
495  }
496 
497  StatusCode ColumnarMETMaker::rebuildTrackMET(const std::string& metJetKey,
498  const std::string& softKey,
499  xAOD::MissingETContainer* metCont,
500  const xAOD::JetContainer* jets,
501  const xAOD::MissingETContainer* metCoreCont,
503  bool doJetJVT) const
504  {
505  if (!metCont)
506  {
507  ATH_MSG_ERROR("No MET container provided");
508  return StatusCode::FAILURE;
509  }
510  if (!jets)
511  {
512  ATH_MSG_ERROR("No input collection provided for MET term \"" << metJetKey << "\" and soft term: " << softKey);
513  return StatusCode::FAILURE;
514  }
515 
516  return rebuildTrackMET(metJetKey,softKey,columnar::MutableMetRange(*metCont),columnar::JetRange(*jets),columnar::Met1Range(*metCoreCont),m_assocAcc(helper),doJetJVT);
517  }
518 
519  StatusCode ColumnarMETMaker::rebuildTrackMET(const std::string& metJetKey,
520  const std::string& softKey,
523  columnar::Met1Range metCoreCont,
525  bool doJetJVT) const
526  {
527  ATH_MSG_VERBOSE("Rebuild jet term: " << metJetKey << " and soft term: " << softKey);
528 
530 
531  columnar::OptMet1Id coreSoft = m_inputMetMapAcc(metCoreCont,softKey+"Core");
532  if(!coreSoft) {
533  ATH_MSG_WARNING("Invalid soft term key supplied: " << softKey);
534  return StatusCode::FAILURE;
535  }
536  auto coreSoftTrk = coreSoft.value();
537 
538  columnar::MutableMetId metSoftTrk {m_outputMetMapAcc.fillMET (metCont, softKey, coreSoftTrk(m_inputMetSourceAcc))};
539 
540  return rebuildTrackMET(metJet, metCont, jets, helper,
541  metSoftTrk, coreSoftTrk,
542  doJetJVT);
543  }
544 
545  StatusCode ColumnarMETMaker::rebuildJetMET(const std::string& metJetKey,
546  const std::string& softClusKey,
547  const std::string& softTrkKey,
548  xAOD::MissingETContainer* metCont,
549  const xAOD::JetContainer* jets,
550  const xAOD::MissingETContainer* metCoreCont,
552  bool doJetJVT) const
553  {
554  if (!metCont)
555  {
556  ATH_MSG_ERROR("No MET container provided");
557  return StatusCode::FAILURE;
558  }
559  if (!jets)
560  {
561  ATH_MSG_ERROR("No input collection provided for MET term \"" << metJetKey << "\" and soft term: " << softClusKey << " and " << softTrkKey);
562  return StatusCode::FAILURE;
563  }
564 
565  return rebuildJetMET(metJetKey,softClusKey,softTrkKey,columnar::MutableMetRange(*metCont),columnar::JetRange(*jets),columnar::Met1Range(*metCoreCont),m_assocAcc(helper),doJetJVT);
566  }
567 
568  StatusCode ColumnarMETMaker::rebuildJetMET(const std::string& metJetKey,
569  const std::string& softClusKey,
570  const std::string& softTrkKey,
573  columnar::Met1Range metCoreCont,
575  bool doJetJVT) const
576  {
577 
578  ATH_MSG_VERBOSE("Create Jet MET " << metJetKey);
579  columnar::MutableMetId metJet {m_outputMetMapAcc.fillMET (metCont, metJetKey, MissingETBase::Source::jet())};
580  ATH_MSG_VERBOSE("Create SoftClus MET " << softClusKey);
581  auto coreSoftClus = m_inputMetMapAcc(metCoreCont,softClusKey+"Core");
582  ATH_MSG_VERBOSE("Create SoftTrk MET " << softTrkKey);
583  auto coreSoftTrk = m_inputMetMapAcc(metCoreCont,softTrkKey+"Core");
584  if(!coreSoftClus) {
585  ATH_MSG_WARNING("Invalid cluster soft term key supplied: " << softClusKey);
586  return StatusCode::FAILURE;
587  }
588  if(!coreSoftTrk) {
589  ATH_MSG_WARNING("Invalid track soft term key supplied: " << softTrkKey);
590  return StatusCode::FAILURE;
591  }
592  columnar::MutableMetId metSoftClus {m_outputMetMapAcc.fillMET (metCont, softClusKey, m_inputMetSourceAcc(coreSoftClus.value()))};
593 
594  columnar::MutableMetId metSoftTrk {m_outputMetMapAcc.fillMET (metCont, softTrkKey, m_inputMetSourceAcc(coreSoftTrk.value()))};
595 
596  return rebuildJetMET(metJet, metCont, jets, helper,
597  metSoftClus, coreSoftClus,
598  metSoftTrk, coreSoftTrk,
599  doJetJVT);
600  }
601 
603  const xAOD::JetContainer* jets,
605  xAOD::MissingET* metSoftClus,
606  const xAOD::MissingET* coreSoftClus,
607  xAOD::MissingET* metSoftTrk,
608  const xAOD::MissingET* coreSoftTrk,
609  bool doJetJVT,
610  bool tracksForHardJets,
611  std::vector<const xAOD::IParticle*>* softConst) const {
612  if(!metJet || !jets) {
613  ATH_MSG_ERROR("Invalid pointer supplied for "
614  << "MET (" << metJet << ") or "
615  << "jet collection (" << jets << ").");
616  return StatusCode::FAILURE;
617  }
618  columnar::MutableMetRange metCont (*static_cast<MissingETContainer*>(metJet->container()));
620  columnar::OptMutableMetId(metSoftClus), columnar::OptMet1Id (coreSoftClus),
621  columnar::OptMutableMetId(metSoftTrk), columnar::OptMet1Id (coreSoftTrk),
622  doJetJVT, tracksForHardJets, softConst);
623  }
624 
629  columnar::OptMutableMetId metSoftClus,
630  columnar::OptMet1Id coreSoftClus,
631  columnar::OptMutableMetId metSoftTrk,
632  columnar::OptMet1Id coreSoftTrk,
633  bool doJetJVT,
634  bool tracksForHardJets,
635  std::vector<const xAOD::IParticle*>* softConst) const {
636  if(softConst && m_trkseltool.empty() && !m_doPFlow && !m_doSoftTruth) {
637  ATH_MSG_WARNING( "Requested soft track element links, but no track selection tool supplied.");
638  }
639  const xAOD::Vertex *pv = softConst?getPV():nullptr;
640 
641  if(helper.map().empty()) {
642  ATH_MSG_WARNING("Incomplete association map received. Cannot rebuild MET.");
643  ATH_MSG_WARNING("Note: ColumnarMETMaker should only be run on events containing at least one PV");
644  return StatusCode::SUCCESS;
645  }
646 
647  if(doJetJVT && m_JvtWP == "None"){
648  ATH_MSG_WARNING("rebuildJetMET requested JVT, which is inconsistent with jet selection " << m_jetSelection << ". Ignoring JVT.");
649  doJetJVT = false;
650  }
651 
652  ATH_MSG_VERBOSE("Building MET jet term " << metJet(m_outputMetNameAcc));
653  if(!metSoftClus && !metSoftTrk) {
654  ATH_MSG_WARNING("Neither soft cluster nor soft track term has been supplied!");
655  return StatusCode::SUCCESS;
656  }
657  static const SG::AuxElement::ConstAccessor<std::vector<ElementLink<IParticleContainer> > > acc_softConst("softConstituents");
658  std::optional<columnar::MetHelpers::ObjectWeightHandle<columnar::ContainerId::mutableMet,columnar::ContainerId::jet>> metSoftClusLinks;
659  if(metSoftClus) {
660  metSoftClusLinks.emplace(*this,m_jetOutputMetWeightDecSoft,metSoftClus.value(),jets);
661  if(!coreSoftClus) {
662  ATH_MSG_ERROR("Soft cluster term provided without a core term!");
663  return StatusCode::FAILURE;
664  }
665  ATH_MSG_VERBOSE("Building MET soft cluster term " << metSoftClus.value()(m_outputMetNameAcc));
666  ATH_MSG_VERBOSE("Core soft cluster mpx " << m_inputMetMomAcc.mpx(coreSoftClus.value())
667  << ", mpy " << m_inputMetMomAcc.mpy(coreSoftClus.value())
668  << " sumet " << m_inputMetMomAcc.sumet(coreSoftClus.value()));
669  m_outputMetMomAcc.addMet (metSoftClus.value(), m_inputMetMomAcc, coreSoftClus.value());
670  // Fill a vector with the soft constituents, if one was provided.
671  // For now, only setting up to work with those corresponding to the jet constituents.
672  // Can expand if needed.
673  if(softConst && acc_softConst.isAvailable(*coreSoftClus.getXAODObject())) {
674  for(const auto& constit : acc_softConst(*coreSoftClus.getXAODObject())) {
675  softConst->push_back(*constit);
676  }
677  ATH_MSG_DEBUG(softConst->size() << " soft constituents from core term");
678  }
679  }
680  std::optional<columnar::MetHelpers::ObjectWeightHandle<columnar::ContainerId::mutableMet,columnar::ContainerId::jet>> metSoftTrkLinks;
681  if(metSoftTrk) {
682  metSoftTrkLinks.emplace(*this,m_jetOutputMetWeightDecSoft,metSoftTrk.value(),jets);
683  if(!coreSoftTrk) {
684  ATH_MSG_ERROR("Soft track term provided without a core term!");
685  return StatusCode::FAILURE;
686  }
687  ATH_MSG_VERBOSE("Building MET soft track term " << metSoftTrk.value()(m_outputMetNameAcc));
688  ATH_MSG_VERBOSE("Core soft track mpx " << m_inputMetMomAcc.mpx(coreSoftTrk.value())
689  << ", mpy " << m_inputMetMomAcc.mpy(coreSoftTrk.value())
690  << " sumet " << m_inputMetMomAcc.sumet(coreSoftTrk.value()));
691  m_outputMetMomAcc.addMet (metSoftTrk.value(), m_inputMetMomAcc, coreSoftTrk.value());
692  if(softConst && acc_softConst.isAvailable(*coreSoftTrk.getXAODObject()) && !m_doPFlow && !m_doSoftTruth) {
693  for(const auto& constit : acc_softConst(*coreSoftTrk.getXAODObject())) {
694  softConst->push_back(*constit);
695  }
696  ATH_MSG_DEBUG(softConst->size() << " soft constituents from trk core term");
697  }
698  }
699 
701 
702  // Get the hashed key of this jet, if we can. Though his only works if
703  // 1. the container is an owning container, and not just a view;
704  // 2. the container is in the event store already.
705  // Since we will be creating ElementLink-s to these jets later on in the
706  // code, and it should work in AnalysisBase, only the first one of these
707  // is checked. Since the code can not work otherwise.
708 
710  for(auto jet : jets) {
711  auto originalJet = jetsOriginals.getOriginal(jet);
712  auto assoc = helper.getJetAssociation(originalJet);
713  if(!assoc || m_assocAcc.isMisc(*assoc)) {
714  ATH_MSG_WARNING( "Jet without association found!" );
715  continue;
716  }
717 
719  // retrieve nominal calibrated jet
720  if (acc_nominalObject.isAvailable(jet.getXAODObject())){
721  ATH_MSG_VERBOSE( "Jet pt before nominal replacement = " << m_jetMomAcc.pt(jet));
722  jet = *static_cast<const xAOD::Jet*>(*acc_nominalObject(jet.getXAODObject()));
723  }
724  else
725  ATH_MSG_ERROR("No nominal calibrated jet available for jet " << jet << ". Cannot simplify overlap removal!");
726  }
727  ATH_MSG_VERBOSE( "Jet pt = " << m_jetMomAcc.pt(jet));
728 
729  bool selected = (std::abs(m_jetMomAcc.eta(jet))<m_JetEtaForw && m_jetMomAcc.pt(jet)>m_CenJetPtCut) || (std::abs(m_jetMomAcc.eta(jet))>=m_JetEtaForw && m_jetMomAcc.pt(jet)>m_FwdJetPtCut );
730  bool JVT_reject(false);
731  bool isMuFSRJet(false);
732 
733  // Apply a cut on the maximum jet eta. This restricts jets to those with calibration. Excluding more forward jets was found to have a minimal impact on the MET in Zee events
734  if (m_JetEtaMax > 0.0 && std::abs(m_jetMomAcc.eta(jet)) > m_JetEtaMax)
735  JVT_reject = true;
736 
737  if(doJetJVT) {
738  // intrinsically checks that is within range to apply Jvt requirement
739  JVT_reject = !bool(m_JvtTool->accept(&jet.getXAODObject()));
740  ATH_MSG_VERBOSE("Jet " << (JVT_reject ? "fails" : "passes") <<" JVT selection");
741  }
742 
743  // if defined apply additional jet criterium
744  if (m_acc_jetRejectionDec && (*m_acc_jetRejectionDec)(jet)==0) JVT_reject = true;
745  bool hardJet(false);
746  MissingETBase::Types::constvec_t calvec = helper.overlapCalVec(*assoc);
747  bool caloverlap = false;
748  caloverlap = calvec.ce()>0;
749  ATH_MSG_DEBUG("Jet " << jet << " is " << ( caloverlap ? "" : "non-") << "overlapping");
750 
751  if(m_veryGreedyPhotons && caloverlap) {
752  for(const auto object : m_assocAcc.objects(*assoc)) {
753  // Correctly handle this jet if we're using very greedy photons
754  if (object && object.getXAODObject()->type() == xAOD::Type::Photon) hardJet = true;
755  }
756  }
757 
758  xAOD::JetFourMom_t constjet;
759  double constSF(1);
761  constjet = m_assocAcc.getAlternateConstVec(*assoc);
762  } else {
763  constjet = m_jetConstitScaleMomAcc.value().jetP4(jet);//grab a constituent scale added by the JetMomentTool/JetConstitFourMomTool.cxx
765  constSF = denom>1e-9 ? constjet.E()/denom : 0.;
766  ATH_MSG_VERBOSE("Scale const jet by factor " << constSF);
767  calvec *= constSF;
768  }
769  double jpx = constjet.Px();
770  double jpy = constjet.Py();
771  double jpt = constjet.Pt();
772  double opx = jpx - calvec.cpx();
773  double opy = jpy - calvec.cpy();
774 
775  columnar::OptMutableMetId met_muonEloss;
777  // Get a term to hold the Eloss corrections
778  met_muonEloss = m_outputMetMapAcc.getRequired(metCont, "MuonEloss");
779  if(!met_muonEloss) {
780  ATH_MSG_WARNING("Attempted to apply muon Eloss correction, but corresponding MET term does not exist!");
781  return StatusCode::FAILURE;
782  }
783  }
784 
785  float total_eloss(0);
786  MissingETBase::Types::bitmask_t muons_selflags(0);
787  std::vector<columnar::MuonId> muons_in_jet;
788  std::vector<columnar::ElectronId> electrons_in_jet;
789  bool passJetForEl=false;
790  if(m_useGhostMuons) { // for backwards-compatibility
791  if(!acc_ghostMuons.isAvailable(jet.getXAODObject())){
792  ATH_MSG_ERROR("Ghost muons requested but not found!");
793  return StatusCode::FAILURE;
794  }
795  for(const auto& el : acc_ghostMuons(jet.getXAODObject())) {
796  if(!el.isValid()){
797  ATH_MSG_ERROR("Invalid element link to ghost muon! Quitting.");
798  return StatusCode::FAILURE;
799  }
800  muons_in_jet.push_back(*static_cast<const xAOD::Muon*>(*el));
801  }
802  }
803  for(const auto obj : m_assocAcc.objects(*assoc)) {
804  if(!obj) continue;
805  if(!m_useGhostMuons && obj.isContainer<columnar::ContainerId::muon>()) {
806  auto mu_test = obj.tryGetVariant<columnar::ContainerId::muon>().value();
807  ATH_MSG_VERBOSE("Muon " << mu_test << " found in jet " << jet);
810  if(acc_originalObject.isAvailable(mu_test.getXAODObject())) mu_test = *static_cast<const xAOD::Muon*>(*acc_originalObject(mu_test.getXAODObject()));
811  }
812  if(helper.objSelected(mu_test)) { //
813  muons_in_jet.push_back(mu_test);
814  ATH_MSG_VERBOSE("Muon is selected by MET.");
815  }
816  }
817  } else if(m_doRemoveElecTrks && obj.isContainer<columnar::ContainerId::electron>()) {
818  auto el_test = obj.tryGetVariant<columnar::ContainerId::electron>().value();
819  ATH_MSG_VERBOSE("Electron " << el_test << " found in jet " << jet);
821  if(acc_originalObject.isAvailable(el_test.getXAODObject())) el_test = *static_cast<const xAOD::Electron*>(*acc_originalObject(el_test.getXAODObject()));
822  }
823  if(helper.objSelected(*assoc,el_test)){
824  if(el_test(m_electronPtAcc)>90.0e3) { // only worry about high-pt electrons?
825  electrons_in_jet.push_back(el_test);
826  ATH_MSG_VERBOSE("High-pt electron is selected by MET.");
827  }
828  }
829  }
830  }
831  if(m_doRemoveElecTrks) {
832  MissingETBase::Types::constvec_t initialTrkMom = m_assocAcc.jetTrkVec(*assoc);
833  float jet_ORtrk_sumpt = helper.overlapTrkVec(*assoc).sumpt();
834  float jet_all_trk_pt = initialTrkMom.sumpt();
835  float jet_unique_trk_pt = jet_all_trk_pt - jet_ORtrk_sumpt;
838  for(const auto& elec : electrons_in_jet) {
839  el_calvec += m_assocAcc.calVec(*assoc,elec);
840  el_trkvec += m_assocAcc.trkVec(*assoc,&elec.getXAODObject());
841  }
842  float el_cal_pt = el_calvec.cpt();
843  float el_trk_pt = el_trkvec.cpt();
844  ATH_MSG_VERBOSE("Elec trk: " << el_trk_pt
845  << " jetalltrk: " << jet_all_trk_pt
846  << " jetORtrk: " << jet_ORtrk_sumpt
847  << " electrk-jetORtrk: " << (el_trk_pt-jet_ORtrk_sumpt)
848  << " elec cal: " << el_cal_pt
849  << " jetalltrk-electrk: " << (jet_all_trk_pt-el_trk_pt)
850  << " jetalltrk-jetORtrk: " << (jet_all_trk_pt-jet_ORtrk_sumpt) );
851  // Want to use the jet calo measurement if we had at least one electron
852  // and the jet has a lot of residual track pt
853  // Is the cut appropriate?
854  if(el_trk_pt>1e-9 && jet_unique_trk_pt>10.0e3) passJetForEl=true;
855  } // end ele-track removal
856 
857  for(auto mu_in_jet : muons_in_jet) {
858  float mu_Eloss = acc_Eloss(mu_in_jet.getXAODObject());
859 
860  if(!JVT_reject) {
861  if (m_doRemoveMuonJets) {
862  // need to investigate how this is affected by the recording of muon clusters in the map
863  float mu_id_pt = mu_in_jet.getXAODObject().trackParticle(xAOD::Muon::InnerDetectorTrackParticle) ? mu_in_jet.getXAODObject().trackParticle(xAOD::Muon::InnerDetectorTrackParticle)->pt() : 0.;
864  float jet_trk_sumpt = m_acc_trksumpt.isAvailable(jet) && this->getPV() ? m_acc_trksumpt(jet)[this->getPV()->index()] : 0.;
865 
866  // missed the muon, so we should add it back
867  if(0.9999*mu_id_pt>jet_trk_sumpt)
868  jet_trk_sumpt+=mu_id_pt;
869  float jet_trk_N = m_acc_trkN.isAvailable(jet) && this->getPV() ? m_acc_trkN(jet)[this->getPV()->index()] : 0.;
870  ATH_MSG_VERBOSE("Muon has ID pt " << mu_id_pt);
871  ATH_MSG_VERBOSE("Jet has pt " << m_jetMomAcc.pt(jet) << ", trk sumpt " << jet_trk_sumpt << ", trk N " << jet_trk_N);
872  bool jet_from_muon = mu_id_pt>1e-9 && jet_trk_sumpt>1e-9 && (m_jetMomAcc.pt(jet)/mu_id_pt < m_muIDPTJetPtRatioMuOlap && mu_id_pt/jet_trk_sumpt>m_jetTrkPtMuPt) && jet_trk_N<m_jetTrkNMuOlap;
873  if(jet_from_muon) {
874  ATH_MSG_VERBOSE("Jet is from muon -- remove.");
875  JVT_reject = true;
876  }
877  }
878 
879  if (m_doSetMuonJetEMScale) {
880  // need to investigate how this is affected by the recording of muon clusters in the map
881  float mu_id_pt = mu_in_jet.getXAODObject().trackParticle(xAOD::Muon::InnerDetectorTrackParticle) ? mu_in_jet.getXAODObject().trackParticle(xAOD::Muon::InnerDetectorTrackParticle)->pt() : 0.;
882  float jet_trk_sumpt = m_acc_trksumpt.isAvailable(jet) && this->getPV() ? m_acc_trksumpt(jet)[this->getPV()->index()] : 0.;
883  // missed the muon, so we should add it back
884  if(0.9999*mu_id_pt>jet_trk_sumpt)
885  jet_trk_sumpt+=mu_id_pt;
886  float jet_trk_N = m_acc_trkN.isAvailable(jet) && this->getPV() ? m_acc_trkN(jet)[this->getPV()->index()] : 0.;
887 
888  float jet_psE = 0.;
889  if (m_acc_psf.isAvailable(jet)){
890  jet_psE = m_acc_psf(jet);
891  } else if (m_acc_sampleE.isAvailable(jet)){
892  jet_psE = m_acc_sampleE(jet)[0] + m_acc_sampleE(jet)[4];
893  } else {
894  ATH_MSG_ERROR("Jet PS fraction or sampling energy must be available to calculate MET with doSetMuonJetEMScale");
895  return StatusCode::FAILURE;
896  }
897 
898  bool jet_from_muon = jet_trk_sumpt>1e-9 && jet_trk_N<3 && mu_id_pt / jet_trk_sumpt > m_jetTrkPtMuPt && m_acc_emf(jet)>m_jetEmfMuOlap && m_acc_width(jet)<m_jetWidthMuOlap && jet_psE>m_jetPsEMuOlap;
899  ATH_MSG_VERBOSE("Muon has ID pt " << mu_id_pt);
900  ATH_MSG_VERBOSE("Jet has trk sumpt " << jet_trk_sumpt << ", trk N " << jet_trk_N << ", PS E " << jet_psE << ", width " << m_acc_width(jet) << ", emfrac " << m_acc_emf(jet));
901 
902  if(jet_from_muon) {
903  ATH_MSG_VERBOSE("Jet is from muon -- set to EM scale and subtract Eloss.");
904  // Using constjet now because we focus on AntiKt4EMTopo.
905  // Probably not a massive difference to LC, but PF needs some consideration
906  ATH_MSG_VERBOSE("Jet e: " << constjet.E() << ", mu Eloss: " << mu_Eloss);
907  float elosscorr = mu_Eloss >= constjet.e() ? 0. : 1.-mu_Eloss/constjet.e();
908  // Effectively, take the unique fraction of the jet times the eloss-corrected fraction
909  // This might in some cases oversubtract, but should err on the side of undercounting the jet contribution
910  opx *= elosscorr;
911  opy *= elosscorr;
912  ATH_MSG_VERBOSE(" Jet eloss factor " << elosscorr << ", final pt: " << sqrt(opx*opx+opy*opy));
913  // Don't treat this jet normally. Instead, just add to the Eloss term
914  isMuFSRJet = true;
915  }
916  }
917  } // end muon-jet overlap-removal
918 
919  switch(mu_in_jet.getXAODObject().energyLossType()) {
920  case xAOD::Muon::Parametrized:
921  case xAOD::Muon::MOP:
922  case xAOD::Muon::Tail:
923  case xAOD::Muon::FSRcandidate:
924  case xAOD::Muon::NotIsolated:
925  // For now don't differentiate the behaviour
926  // Remove the Eloss assuming the parameterised value
927  // The correction is limited to the selected clusters
928  total_eloss += mu_Eloss;
929  muons_selflags |= (1<<m_assocAcc.findIndex(*assoc,mu_in_jet));
930  }
931  }
932  ATH_MSG_VERBOSE("Muon selection flags: " << muons_selflags);
933  ATH_MSG_VERBOSE("Muon total eloss: " << total_eloss);
934 
936  // borrowed from overlapCalVec
937  for(size_t iKey = 0; iKey < m_assocAcc.sizeCal(*assoc); iKey++) {
938  bool selector = (muons_selflags & m_assocAcc.calkey(*assoc)[iKey]);
939  if(selector) mu_calovec += m_assocAcc.calVec(*assoc,iKey);
940  ATH_MSG_VERBOSE("This key: " << m_assocAcc.calkey(*assoc)[iKey] << ", selector: " << selector);
941  }
942  ATH_MSG_VERBOSE("Mu calovec pt, no Eloss: " << mu_calovec.cpt());
943  if(m_muEloss) mu_calovec *= std::max<float>(0.,1-(total_eloss/mu_calovec.ce()));
944  ATH_MSG_VERBOSE("Mu calovec pt, with Eloss: " << mu_calovec.cpt());
945 
946  // re-add calo components of muons beyond Eloss correction
947  ATH_MSG_VERBOSE("Jet " << jet << " const pT before OR " << jpt);
948  ATH_MSG_VERBOSE("Jet " << jet << " const pT after OR " << sqrt(opx*opx+opy*opy));
949  opx += mu_calovec.cpx();
950  opy += mu_calovec.cpy();
951  double opt = sqrt( opx*opx+opy*opy );
952  ATH_MSG_VERBOSE("Jet " << jet << " const pT diff after OR readding muon clusters " << opt-jpt);
953  double uniquefrac = 1. - (calvec.ce() - mu_calovec.ce()) / constjet.E();
954  ATH_MSG_VERBOSE( "Jet constscale px, py, pt, E = " << jpx << ", " << jpy << ", " << jpt << ", " << constjet.E() );
955  ATH_MSG_VERBOSE( "Jet overlap E = " << calvec.ce() - mu_calovec.ce() );
956  ATH_MSG_VERBOSE( "Jet OR px, py, pt, E = " << opx << ", " << opy << ", " << opt << ", " << constjet.E() - calvec.ce() );
957 
958  if(isMuFSRJet) {
959  if(!met_muonEloss){
960  ATH_MSG_ERROR("Attempted to apply muon Eloss correction, but corresponding MET term does not exist!");
961  return StatusCode::FAILURE;
962  }
963  m_outputMetMomAcc.addParticle(met_muonEloss.value(),opx,opy,opt);
964  continue;
965  }
966 
967  if(selected && !JVT_reject) {
968  if(!caloverlap) {
969  // add jet full four-vector
970  hardJet = true;
971  if (!tracksForHardJets) {
972  if(m_doConstJet)
973  m_outputMetMomAcc.addParticle(metJet,jpx,jpy,jpt);
974  else
976  }
977  }
978  else if((uniquefrac>m_jetMinEfrac || passJetForEl) && opt>m_jetMinWeightedPt){
979  // add jet corrected for overlaps if sufficient unique fraction
980  hardJet = true;
981  if(!tracksForHardJets) {
982  if(m_jetCorrectPhi) {
983  if (m_doConstJet)
984  m_outputMetMomAcc.addParticle(metJet,opx,opy,opt);
985  else {
986  double jesF = m_jetMomAcc.pt(jet) / jpt;
987  m_outputMetMomAcc.addParticle(metJet,opx*jesF,opy*jesF,opt*jesF);
988  }
989  } else {
990  if (m_doConstJet)
991  m_outputMetMomAcc.addParticle(metJet,uniquefrac*jpx,uniquefrac*jpy,uniquefrac*jpt);
992  else{
993  if(passJetForEl && m_doRemoveElecTrksEM)
994  m_outputMetMomAcc.addParticle(metJet,opx,opy,opt);
995  else
996  m_outputMetMomAcc.addParticle(metJet,uniquefrac*m_jetMomAcc.px(jet),uniquefrac*m_jetMomAcc.py(jet),uniquefrac*m_jetMomAcc.pt(jet));
997  }
998  }
999  }
1000  }
1001  } // hard jet selection
1002 
1003  if(hardJet){
1004  ATH_MSG_VERBOSE("Jet added at full scale");
1005  metJetWeights.emplace_back(jet, uniquefrac);
1006  } else {
1007  if(metSoftClus && !JVT_reject) {
1008  // add fractional contribution
1009  ATH_MSG_VERBOSE("Jet added at const scale");
1010  if (std::abs(m_jetMomAcc.eta(jet))<2.5 || !(coreSoftClus.value()(m_inputMetSourceAcc)&MissingETBase::Source::Region::Central)) {
1011  metSoftClusLinks->emplace_back (jet, uniquefrac);
1012  m_outputMetMomAcc.addParticle(metSoftClus.value(),opx,opy,opt);
1013  }
1014 
1015  // Fill a vector with the soft constituents, if one was provided.
1016  // For now, only setting up to work with those corresponding to the jet constituents.
1017  // Can expand if needed.
1018  // This ignores overlap removal.
1019  //
1020  if(softConst) {
1021  for(size_t iConst=0; iConst<jet.getXAODObject().numConstituents(); ++iConst) {
1022  const IParticle* constit = jet.getXAODObject().rawConstituent(iConst);
1023  softConst->push_back(constit);
1024  }
1025  }
1026  }
1027  } // hard jet or CST
1028 
1029  if(!metSoftTrk || (hardJet && !tracksForHardJets)) continue;
1030 
1031  // use jet tracks
1032  // remove any tracks already used by other objects
1033  MissingETBase::Types::constvec_t trkvec = helper.overlapTrkVec(*assoc);
1035  if(jettrkvec.ce()>1e-9) {
1036  jpx = jettrkvec.cpx();
1037  jpy = jettrkvec.cpy();
1038  jpt = jettrkvec.sumpt();
1039  jettrkvec -= trkvec;
1040  opx = jettrkvec.cpx();
1041  opy = jettrkvec.cpy();
1042  opt = jettrkvec.sumpt();
1043  ATH_MSG_VERBOSE( "Jet track px, py, sumpt = " << jpx << ", " << jpy << ", " << jpt );
1044  ATH_MSG_VERBOSE( "Jet OR px, py, sumpt = " << opx << ", " << opy << ", " << opt );
1045  } else {
1046  opx = opy = opt = 0;
1047  ATH_MSG_VERBOSE( "This jet has no associated tracks" );
1048  }
1049  if (hardJet) m_outputMetMomAcc.addParticle(metJet,opx,opy,opt);
1050  else if (std::abs(m_jetMomAcc.eta(jet))<2.5 || !(coreSoftTrk.value()(m_inputMetSourceAcc)&MissingETBase::Source::Region::Central)) {
1051  m_outputMetMomAcc.addParticle(metSoftTrk.value(),opx,opy,opt);
1052  // Don't need to add if already done for softclus.
1053  if(!metSoftClus) {
1054  if (metSoftTrkLinks) metSoftTrkLinks->emplace_back (jet, uniquefrac);
1055  }
1056 
1057  // Fill a vector with the soft constituents, if one was provided.
1058  // For now, only setting up to work with those corresponding to the jet constituents.
1059  // Can expand if needed.
1060  // This ignores overlap removal.
1061  //
1062  if(softConst && !m_doPFlow && !m_doSoftTruth) {
1063  std::vector<const IParticle*> jettracks;
1064  jet.getXAODObject().getAssociatedObjects<IParticle>(xAOD::JetAttribute::GhostTrack,jettracks);
1065  for(size_t iConst=0; iConst<jettracks.size(); ++iConst) {
1066  const TrackParticle* pTrk = static_cast<const TrackParticle*>(jettracks[iConst]);
1067  if (acceptTrack(pTrk,pv)) softConst->push_back(pTrk);
1068  }
1069  }
1070  }
1071  } // jet loop
1072 
1073  ATH_MSG_DEBUG("Number of selected jets: " << metJetWeights.size());
1074 
1075  if(metSoftTrk) {
1076  ATH_MSG_DEBUG("Number of softtrk jets: " << metSoftTrkLinks->size());
1077  }
1078 
1079  if(metSoftClus) {
1080  ATH_MSG_DEBUG("Number of softclus jets: " << metSoftClusLinks->size());
1081  }
1082 
1083  if(softConst) ATH_MSG_DEBUG(softConst->size() << " soft constituents from core term + jets");
1084 
1085  auto assoc = helper.getMiscAssociation();
1086  if(!assoc) return StatusCode::SUCCESS;
1087 
1088  if(metSoftTrk) {
1089  // supplement track term with any tracks associated to isolated muons
1090  // these are recorded in the misc association
1091  MissingETBase::Types::constvec_t trkvec = helper.overlapTrkVec(*assoc);
1092  double opx = trkvec.cpx();
1093  double opy = trkvec.cpy();
1094  double osumpt = trkvec.sumpt();
1095  ATH_MSG_VERBOSE( "Misc track px, py, sumpt = " << opx << ", " << opy << ", " << osumpt );
1096  m_outputMetMomAcc.addParticle(metSoftTrk.value(),opx,opy,osumpt);
1097  ATH_MSG_VERBOSE("Final soft track mpx " << m_outputMetMomAcc.mpx(metSoftTrk.value())
1098  << ", mpy " << m_outputMetMomAcc.mpy(metSoftTrk.value())
1099  << " sumet " << m_outputMetMomAcc.sumet(metSoftTrk.value()));
1100  }
1101 
1102  if(metSoftClus) {
1103  // supplement cluster term with any clusters associated to isolated e/gamma
1104  // these are recorded in the misc association
1105  float total_eloss(0.);
1106  MissingETBase::Types::bitmask_t muons_selflags(0);
1107  MissingETBase::Types::constvec_t calvec = helper.overlapCalVec(*assoc);
1108  double opx = calvec.cpx();
1109  double opy = calvec.cpy();
1110  double osumpt = calvec.sumpt();
1111  for(const auto objId : m_assocAcc.objects(*assoc)) {
1112  auto *obj = objId.getXAODObject();
1113  if (!obj || obj->type() != xAOD::Type::Muon) continue;
1114  const xAOD::Muon* mu_test(static_cast<const xAOD::Muon*>(obj));
1115  if(acc_originalObject.isAvailable(*mu_test)) mu_test = static_cast<const xAOD::Muon*>(*acc_originalObject(*mu_test));
1116  if(helper.objSelected(mu_test)) { //
1117  float mu_Eloss = acc_Eloss(*mu_test);
1118  switch(mu_test->energyLossType()) {
1119  case xAOD::Muon::Parametrized:
1120  case xAOD::Muon::MOP:
1121  case xAOD::Muon::Tail:
1122  case xAOD::Muon::FSRcandidate:
1123  case xAOD::Muon::NotIsolated:
1124  // For now don't differentiate the behaviour
1125  // Remove the Eloss assuming the parameterised value
1126  // The correction is limited to the selected clusters
1127  total_eloss += mu_Eloss;
1128  muons_selflags |= (1<<m_assocAcc.findIndex(*assoc,mu_test));
1129  }
1130  ATH_MSG_VERBOSE("Mu index " << mu_test->index());
1131  }
1132  }
1133  ATH_MSG_VERBOSE("Mu selection flags " << muons_selflags);
1134  ATH_MSG_VERBOSE("Mu total eloss " << total_eloss);
1135 
1137  // borrowed from overlapCalVec
1138  for(size_t iKey = 0; iKey < m_assocAcc.sizeCal(*assoc); iKey++) {
1139  bool selector = (muons_selflags & m_assocAcc.calkey(*assoc)[iKey]);
1140  ATH_MSG_VERBOSE("This key: " << m_assocAcc.calkey(*assoc)[iKey] << ", selector: " << selector
1141  << " this calvec E: " << m_assocAcc.calVec(*assoc,iKey).ce());
1142  if(selector) mu_calovec += m_assocAcc.calVec(*assoc,iKey);
1143  }
1144  if(m_muEloss){
1145  mu_calovec *= std::max<float>(0.,1-(total_eloss/mu_calovec.ce()));
1146  opx += mu_calovec.cpx();
1147  opy += mu_calovec.cpy();
1148  osumpt += mu_calovec.sumpt();
1149  }
1150  ATH_MSG_VERBOSE("Mu cluster sumpt " << mu_calovec.sumpt());
1151 
1152  ATH_MSG_VERBOSE( "Misc cluster px, py, sumpt = " << opx << ", " << opy << ", " << osumpt );
1153  m_outputMetMomAcc.addParticle(metSoftClus.value(),opx,opy,osumpt);
1154  ATH_MSG_VERBOSE("Final soft cluster mpx " << m_outputMetMomAcc.mpx(metSoftClus.value())
1155  << ", mpy " << m_outputMetMomAcc.mpy(metSoftClus.value())
1156  << " sumet " << m_outputMetMomAcc.sumet(metSoftClus.value()));
1157  }
1158 
1159  return StatusCode::SUCCESS;
1160  }
1161 
1163  const xAOD::JetContainer* jets,
1165  xAOD::MissingET* metSoftTrk,
1166  const xAOD::MissingET* coreSoftTrk,
1167  bool doJetJVT) const {
1168  if (!metJet) {
1169  ATH_MSG_ERROR("No MET object provided for track MET rebuilding");
1170  return StatusCode::FAILURE;
1171  }
1172  if (!metSoftTrk) {
1173  ATH_MSG_ERROR("No MET object provided for soft track MET rebuilding");
1174  return StatusCode::FAILURE;
1175  }
1176  if (!jets) {
1177  ATH_MSG_ERROR("No jet container provided for track MET rebuilding");
1178  return StatusCode::FAILURE;
1179  }
1180 
1181  columnar::MutableMetRange metCont (*static_cast<MissingETContainer*>(metJet->container()));
1182  return rebuildJetMET(columnar::MutableMetId(*metJet),metCont,columnar::JetRange(*jets),m_assocAcc(helper),std::nullopt,nullptr,columnar::MutableMetId(*metSoftTrk),coreSoftTrk,doJetJVT,true);
1183  }
1184 
1186  columnar::MutableMetRange metCont,
1189  columnar::MutableMetId metSoftTrk,
1190  columnar::Met1Id coreSoftTrk,
1191  bool doJetJVT) const {
1192  return rebuildJetMET(metJet,metCont,jets,helper,std::nullopt,nullptr,metSoftTrk,coreSoftTrk,doJetJVT,true);
1193  }
1194 
1195  // **** Remove objects and any overlaps from MET calculation ****
1198  xAOD::MissingETContainer* metCont) const
1199  {
1200  if (!collection) {
1201  ATH_MSG_ERROR("No object container provided for marking invisible");
1202  return StatusCode::FAILURE;
1203  }
1204  if (!metCont) {
1205  ATH_MSG_ERROR("No MET container provided for marking invisible");
1206  return StatusCode::FAILURE;
1207  }
1208 
1210  }
1211 
1214  columnar::MutableMetRange metCont) const
1215  {
1216  columnar::MutableMetId met = m_outputMetMapAcc.fillMET (metCont, "Invisibles", invisSource);
1218  }
1219 
1221  {
1222  return static_cast<bool>(m_trkseltool->accept( *trk, vx ));
1223  }
1224 
1226 
1228 
1229  if(!h_PV.isValid()) {
1230  ATH_MSG_WARNING("Unable to retrieve primary vertex container PrimaryVertices");
1231  return nullptr;
1232  }
1233  ATH_MSG_DEBUG("Successfully retrieved primary vertex container");
1234  if(h_PV->empty()) ATH_MSG_WARNING("Event has no primary vertices!");
1235  for(const xAOD::Vertex* vx : *h_PV) {
1236  if(vx->vertexType()==xAOD::VxType::PriVtx) return vx;
1237  }
1238  return nullptr;
1239  }
1240 
1241 
1242 
1244  {
1246  {
1247  auto met = m_outputMetHandle (event);
1248  auto metcore = m_inputMetHandle (event);
1249  auto metassoc = m_metAssocHandle (event);
1250  if (m_columnarOperation.value() == 0u)
1251  {
1254  throw std::runtime_error ("Failed to rebuild MET");
1255  } else if (m_columnarOperation.value() == 1u)
1256  {
1257  auto jets = m_jetsHandle (event);
1258  if (rebuildJetMET (m_columnarJetKey.value(), m_columnarSoftClusKey.value(), met, jets, metcore, m_assocAcc(metassoc), m_columnarDoJetJVT.value()).isFailure())
1259  throw std::runtime_error ("Failed to rebuild jet MET");
1260  } else if (m_columnarOperation.value() == 2u)
1261  {
1262  auto jets = m_jetsHandle (event);
1263  if (rebuildTrackMET (m_columnarJetKey.value(), m_columnarSoftClusKey.value(), met, jets, metcore, m_assocAcc(metassoc), m_columnarDoJetJVT.value()).isFailure())
1264  throw std::runtime_error ("Failed to rebuild track MET");
1265  } else
1266  {
1267  throw std::runtime_error ("Unknown columnar operation");
1268  }
1269  }
1270  }
1271 
1272 } //> end namespace met
met::ColumnarMETMaker::m_columnarJetKey
Gaudi::Property< std::string > m_columnarJetKey
Definition: ColumnarMETMaker.h:326
ShallowCopy.h
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
met::ColumnarMETMaker::m_orCaloTaggedMuon
bool m_orCaloTaggedMuon
Definition: ColumnarMETMaker.h:260
columnar::ContainerId::muon
Definition: MuonDef.h:19
met::ColumnarMETMaker::markInvisible
virtual StatusCode markInvisible(const xAOD::IParticleContainer *collection, xAOD::MissingETAssociationHelper &helper, xAOD::MissingETContainer *metCont) const override final
Definition: ColumnarMETMaker.cxx:1196
met::ColumnarMETMaker::m_acc_psf
columnar::JetAccessor< float > m_acc_psf
Definition: ColumnarMETMaker.h:308
met::ColumnarMETMaker::m_jetConstitScaleMomFixedAcc
std::optional< columnar::MetHelpers::InputMomentumAccessors< columnar::ContainerId::jet > > m_jetConstitScaleMomFixedAcc
Definition: ColumnarMETMaker.h:315
columnar::MetAssocationAccessors::objects
auto objects(AssocId assoc) const
Definition: MetAssociation.h:250
met::ColumnarMETMaker::m_jetWidthMuOlap
double m_jetWidthMuOlap
Definition: ColumnarMETMaker.h:266
columnar::MetAssocationAccessors::hasAlternateConstVec
bool hasAlternateConstVec(AssocId assoc) const
Definition: MetAssociation.h:293
met::ColumnarMETMaker::m_assocAcc
columnar::MetAssocationAccessors m_assocAcc
Definition: ColumnarMETMaker.h:296
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
met::ColumnarMETMaker::m_muIDPTJetPtRatioMuOlap
double m_muIDPTJetPtRatioMuOlap
Definition: ColumnarMETMaker.h:270
met::ColumnarMETMaker::m_particlesHandle
columnar::ParticleAccessor< columnar::ObjectColumn > m_particlesHandle
Definition: ColumnarMETMaker.h:281
MissingETBase::Source::muon
static Types::bitmask_t muon(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed muons.
Definition: MissingETBase.h:250
met::ColumnarMETMaker::rebuildJetMET
virtual StatusCode rebuildJetMET(const std::string &metJetKey, const std::string &softClusKey, const std::string &softTrkKey, xAOD::MissingETContainer *metCont, const xAOD::JetContainer *jets, const xAOD::MissingETContainer *metCoreCont, xAOD::MissingETAssociationHelper &helper, bool doJetJVT) const override final
Definition: ColumnarMETMaker.cxx:545
xAOD::MissingETAuxContainer
MissingETAuxContainer_v1 MissingETAuxContainer
Definition: MissingETAuxContainer.h:16
MissingETBase::UsageHandler::PhysicsObject
@ PhysicsObject
Physics object based.
Definition: MissingETCompositionBase.h:187
met::ColumnarMETMaker::m_outputMetMapAcc
columnar::MetHelpers::MapLookupAccessor< columnar::ContainerId::mutableMet > m_outputMetMapAcc
Definition: ColumnarMETMaker.h:288
MissingETBase::UsageHandler::TruthParticle
@ TruthParticle
Truth particle based.
Definition: MissingETCompositionBase.h:189
met::ColumnarMETMaker::m_jetTrkPtMuPt
double m_jetTrkPtMuPt
Definition: ColumnarMETMaker.h:269
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
met::ColumnarMETMaker::m_acc_trkN
columnar::JetAccessor< std::vector< int > > m_acc_trkN
Definition: ColumnarMETMaker.h:310
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
ObjectType
ObjectType
Definition: BaseObject.h:11
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
met::ColumnarMETMaker::initialize
virtual StatusCode initialize() override final
Dummy implementation of the initialisation function.
Definition: ColumnarMETMaker.cxx:145
met::ColumnarMETMaker::m_inputMetHandle
columnar::Met1Accessor< columnar::ObjectColumn > m_inputMetHandle
Definition: ColumnarMETMaker.h:279
columnar::MetHelpers::OriginalObjectHandle
Definition: MetInput.h:71
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
index
Definition: index.py:1
met::ColumnarMETMaker::m_outputMetHandle
columnar::MutableMetAccessor< columnar::ObjectColumn > m_outputMetHandle
Definition: ColumnarMETMaker.h:278
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
MissingETBase::Source::electron
static Types::bitmask_t electron(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed electrons.
Definition: MissingETBase.h:229
columnar::getXAODObject
xAODContainer & getXAODObject() const noexcept
Definition: ObjectRange.h:147
AuxContainerBase.h
JetAttributes.h
MissingETBase::Source::track
static Types::bitmask_t track(Region reg=Region::FullAcceptance)
Bit mask for MET term from Track signal objects.
Definition: MissingETBase.h:291
met::ColumnarMETMaker::m_inputMetMomAcc
columnar::MetHelpers::MetMomentumAccessors< columnar::ContainerId::met1 > m_inputMetMomAcc
Definition: ColumnarMETMaker.h:293
columnar::MetHelpers::InputMomentumAccessors::px
float px(ObjectId< CI, CM > object) const
Definition: MetInput.h:58
defineDB.jets
jets
Definition: JetTagCalibration/share/defineDB.py:24
xAOD::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition: xAOD/xAODBase/xAODBase/IParticleContainer.h:32
xAOD::MissingET
MissingET_v1 MissingET
Version control by type defintion.
Definition: Event/xAOD/xAODMissingET/xAODMissingET/MissingET.h:15
xAOD::IParticle::type
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
columnar::MetHelpers::ObjectWeightHandle
a "handle" for recording object weights via ObjectWeightDecorator
Definition: MetOutput.h:70
met::ColumnarMETMaker::m_outputMetMomAcc
columnar::MetHelpers::MetMomentumAccessors< columnar::ContainerId::mutableMet > m_outputMetMomAcc
Definition: ColumnarMETMaker.h:289
MissingETBase::Source::Region::Central
@ Central
Indicator for MET contribution from the central region.
met::ColumnarMETMaker::m_greedyPhotons
bool m_greedyPhotons
Definition: ColumnarMETMaker.h:261
met::ColumnarMETMaker::m_columnarSoftClusKey
Gaudi::Property< std::string > m_columnarSoftClusKey
Definition: ColumnarMETMaker.h:327
athena.value
value
Definition: athena.py:124
met::ColumnarMETMaker::m_customJvtPtMax
double m_customJvtPtMax
Definition: ColumnarMETMaker.h:245
MissingETComposition
Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current MissingETComposition
Definition: RecTPCnv.cxx:86
xAOD::MissingETContainer
MissingETContainer_v1 MissingETContainer
Definition: Event/xAOD/xAODMissingET/xAODMissingET/MissingETContainer.h:16
met::ColumnarMETMaker::m_trkseltool
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkseltool
Definition: ColumnarMETMaker.h:272
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
columnar::OptObjectId
a class representing a single optional object (electron, muons, etc.)
Definition: ContainerId.h:177
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
met::ColumnarMETMaker::m_doRemoveElecTrks
bool m_doRemoveElecTrks
Definition: ColumnarMETMaker.h:254
met::ColumnarMETMaker::m_doPFlow
bool m_doPFlow
Definition: ColumnarMETMaker.h:248
MissingETBase::Types::bitmask_t
uint64_t bitmask_t
Type for status word bit mask.
Definition: MissingETBase.h:39
met::ColumnarMETMaker::m_acc_trksumpt
columnar::JetAccessor< std::vector< float > > m_acc_trksumpt
Definition: ColumnarMETMaker.h:311
xAOD::MissingETAssociation
MissingETAssociation_v1 MissingETAssociation
Version control by type definition.
Definition: MissingETAssociation.h:15
MissingETBase::UsageHandler::OnlyCluster
@ OnlyCluster
CaloCluster based only.
Definition: MissingETCompositionBase.h:184
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
MissingETBase::Source::isTrackTerm
static bool isTrackTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)
Definition: MissingETBase.h:404
met::ColumnarMETMaker::m_outputMetNameAcc
columnar::MutableMetAccessor< std::string > m_outputMetNameAcc
Definition: ColumnarMETMaker.h:287
columnar::ObjectRange
a class representing a continuous sequence of objects (a.k.a. a container)
Definition: ContainerId.h:175
columnar::MetHelpers::MetMomentumAccessors::met
double met(ObjectId< CI, CM > object) const
Definition: MetHelpers.h:183
ReweightUtils.message
message
Definition: ReweightUtils.py:15
met::ColumnarMETMaker::m_jetMinWeightedPt
double m_jetMinWeightedPt
Definition: ColumnarMETMaker.h:230
asg::AsgToolConfig::makePrivateTool
::StatusCode makePrivateTool(ToolHandle< T > &toolHandle) const
make a private tool with the given configuration
python.DataFormatRates.events
events
Definition: DataFormatRates.py:105
columnar::ContainerId::electron
Definition: EgammaDef.h:21
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
xAOD::MissingETAssociation_v1::ConstVec
Vector sum of constituents for subtractive overlap removal.
Definition: MissingETAssociation_v1.h:32
MissingETBase::Source::Type::Muon
@ Muon
Indicator for the MET term from reconstructed or MC truth muons.
met::ColumnarMETMaker::m_inputMetMapAcc
columnar::MetHelpers::MapLookupAccessor< columnar::ContainerId::met1 > m_inputMetMapAcc
Definition: ColumnarMETMaker.h:292
met::ColumnarMETMaker::m_columnarParticleType
Gaudi::Property< unsigned > m_columnarParticleType
Definition: ColumnarMETMaker.h:325
met::ColumnarMETMaker::rebuildTrackMET
virtual StatusCode rebuildTrackMET(const std::string &metJetKey, const std::string &softTrkKey, xAOD::MissingETContainer *metCont, const xAOD::JetContainer *jets, const xAOD::MissingETContainer *metCoreCont, xAOD::MissingETAssociationHelper &helper, bool doJetJVT) const override final
Definition: ColumnarMETMaker.cxx:497
met::ColumnarMETMaker::m_jetOutputMetWeightDecSoft
columnar::MetHelpers::ObjectWeightDecorator< columnar::ContainerId::mutableMet, columnar::ContainerId::jet > m_jetOutputMetWeightDecSoft
Definition: ColumnarMETMaker.h:319
columnar::MetAssocationAccessors::calkey
decltype(auto) calkey(AssocId assoc) const
Definition: MetAssociation.h:188
xAOD::Muon_v1::energyLossType
EnergyLossType energyLossType(void) const
Energy determined from parametrization or not (measured).
met::ColumnarMETMaker::m_jetSelection
std::string m_jetSelection
Definition: ColumnarMETMaker.h:240
met::ColumnarMETMaker::m_acc_sampleE
columnar::JetAccessor< std::vector< float > > m_acc_sampleE
Definition: ColumnarMETMaker.h:312
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:115
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
met::ColumnarMETMaker::m_muEloss
bool m_muEloss
Definition: ColumnarMETMaker.h:259
met::ColumnarMETMaker::m_JvtPtMax
double m_JvtPtMax
Definition: ColumnarMETMaker.h:236
met::ColumnarMETMaker::m_CenJetPtCut
double m_CenJetPtCut
Definition: ColumnarMETMaker.h:235
met::ColumnarMETMaker::m_jetConstitScaleMom
std::string m_jetConstitScaleMom
Definition: ColumnarMETMaker.h:231
ColumnarMETMaker.h
columnar::MetAssocationAccessors::isMisc
ColumnAccessor< ContainerId::metAssociation, char, CM > isMisc
Definition: MetAssociation.h:166
met::ColumnarMETMaker::m_customCenJetPtCut
double m_customCenJetPtCut
Definition: ColumnarMETMaker.h:244
met::ColumnarMETMaker::getPV
const xAOD::Vertex * getPV() const
Definition: ColumnarMETMaker.cxx:1225
met::ColumnarMETMaker::m_jetsHandle
columnar::JetAccessor< columnar::ObjectColumn > m_jetsHandle
Definition: ColumnarMETMaker.h:282
met::ColumnarMETMaker::ColumnarMETMaker
ColumnarMETMaker()
Default constructor:
met::ColumnarMETMaker::m_inputMetSourceAcc
columnar::Met1Accessor< MissingETBase::Types::bitmask_t > m_inputMetSourceAcc
Definition: ColumnarMETMaker.h:294
met::ColumnarMETMaker::m_acc_jetRejectionDec
std::optional< columnar::JetAccessor< char > > m_acc_jetRejectionDec
Definition: ColumnarMETMaker.h:316
METHelpers.h
met::ColumnarMETMaker::m_inputMomAcc
columnar::MetHelpers::InputMomentumAccessors m_inputMomAcc
Definition: ColumnarMETMaker.h:298
EgammaxAODHelpers.h
met
Definition: IMETSignificance.h:24
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
PFOAuxContainer.h
asg::AsgToolConfig
an object that can create a AsgTool
Definition: AsgToolConfig.h:22
met::ColumnarMETMaker::m_missObjWarningPtThreshold
float m_missObjWarningPtThreshold
Definition: ColumnarMETMaker.h:226
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
ElectronContainer.h
columnar::MetAssocationAccessors::calVec
ConstVec calVec(AssocId assoc, const xAOD::IParticle *pPart) const
Definition: MetAssociation.h:194
columnar::ColumnarModeXAOD::isXAOD
static constexpr bool isXAOD
Whether this is the xAOD mode.
Definition: ColumnarDef.h:17
met::ColumnarMETMaker::m_acc_emf
columnar::JetAccessor< float > m_acc_emf
Definition: ColumnarMETMaker.h:307
columnar::MetHelpers::MetMomentumAccessors::sumet
AccessorTemplate< CI, float, CAM, CM > sumet
Definition: MetHelpers.h:181
MissingETBase::Source::jet
static Types::bitmask_t jet(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed jets.
Definition: MissingETBase.h:257
columnar::MetHelpers::MetMomentumAccessors::mpy
AccessorTemplate< CI, float, CAM, CM > mpy
Definition: MetHelpers.h:180
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
MissingETAuxContainer.h
xAOD::MissingETAssociation_v1::ConstVec::cpy
float cpy() const
Returns .
xAOD::MissingETAssociation_v1::ConstVec::sumpt
float sumpt() const
Returns sum of component pt.
AsgToolConfig.h
met::ColumnarMETMaker::m_electronPtAcc
columnar::ElectronAccessor< columnar::RetypeColumn< double, float > > m_electronPtAcc
Definition: ColumnarMETMaker.h:321
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:572
MissingETBase::Source::Category::Calo
@ Calo
Indicator for MET terms reconstructed from calorimeter signals alone.
met::ColumnarMETMaker::m_inputMuonTypeAcc
columnar::ParticleAccessor< columnar::RetypeColumn< xAOD::Muon::MuonType, std::uint16_t > > m_inputMuonTypeAcc
Definition: ColumnarMETMaker.h:301
xAOD::MissingET_v1
Principal data object for Missing ET.
Definition: MissingET_v1.h:25
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
columnar::MetHelpers::MetMomentumAccessors::mpx
AccessorTemplate< CI, float, CAM, CM > mpx
Definition: MetHelpers.h:179
met::ColumnarMETMaker::m_PVkey
SG::ReadHandleKey< xAOD::VertexContainer > m_PVkey
Definition: ColumnarMETMaker.h:223
met::ColumnarMETMaker::m_veryGreedyPhotons
bool m_veryGreedyPhotons
Definition: ColumnarMETMaker.h:262
columnar::MetAssocationAccessors::jetTrkVec
ConstVec jetTrkVec(AssocId assoc) const
Definition: MetAssociation.h:244
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
compute_lumi.denom
denom
Definition: compute_lumi.py:76
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
met::ColumnarMETMaker::m_outputMetWeightDecRegular
columnar::MetHelpers::ObjectWeightDecorator m_outputMetWeightDecRegular
Definition: ColumnarMETMaker.h:304
met::ColumnarMETMaker::m_jetCorrectPhi
bool m_jetCorrectPhi
Definition: ColumnarMETMaker.h:228
met::ColumnarMETMaker::m_columnarTermName
Gaudi::Property< std::string > m_columnarTermName
Definition: ColumnarMETMaker.h:324
met::ColumnarMETMaker::m_skipSystematicJetSelection
bool m_skipSystematicJetSelection
Definition: ColumnarMETMaker.h:257
MissingETBase::UsageHandler::Policy
Policy
Policies on usage checks.
Definition: MissingETCompositionBase.h:182
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
columnar::ObjectId
a class representing a single object (electron, muons, etc.)
Definition: ContainerId.h:176
met::ColumnarMETMaker::m_columnarDoJetJVT
Gaudi::Property< bool > m_columnarDoJetJVT
Definition: ColumnarMETMaker.h:328
xAOD::MissingETContainer_v1
Container for xAOD::MissingET_v1 objects.
Definition: MissingETContainer_v1.h:21
met::ColumnarMETMaker::~ColumnarMETMaker
virtual ~ColumnarMETMaker()
Destructor:
xAOD::MissingETAssociationMap
MissingETAssociationMap_v1 MissingETAssociationMap
Version control by type defintion.
Definition: MissingETAssociationMap.h:16
met::ColumnarMETMaker::m_inputPreselectionAcc
std::optional< columnar::ParticleAccessor< char > > m_inputPreselectionAcc
Definition: ColumnarMETMaker.h:300
met::ColumnarMETMaker::m_jetEmfMuOlap
double m_jetEmfMuOlap
Definition: ColumnarMETMaker.h:268
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
MissingETBase::Source::tau
static Types::bitmask_t tau(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed tau leptons.
Definition: MissingETBase.h:243
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
met::ColumnarMETMaker::m_columnarOperation
Gaudi::Property< unsigned > m_columnarOperation
Definition: ColumnarMETMaker.h:323
met::ColumnarMETMaker::callEvents
void callEvents(columnar::EventContextRange events) const override
Definition: ColumnarMETMaker.cxx:1243
ReadHandle.h
Handle class for reading from StoreGate.
columnar::MetAssocationAccessors::overlapIndices
auto overlapIndices(AssocId assoc) const
Definition: MetAssociation.h:253
MissingETBase::UsageHandler::OnlyTrack
@ OnlyTrack
Track based only.
Definition: MissingETCompositionBase.h:185
columnar::MetAssocationAccessors::sizeCal
std::size_t sizeCal(AssocId assoc) const
Definition: MetAssociation.h:185
met::ColumnarMETMaker::m_jetRejectionDec
std::string m_jetRejectionDec
Definition: ColumnarMETMaker.h:233
met::ColumnarMETMaker::m_useGhostMuons
bool m_useGhostMuons
Definition: ColumnarMETMaker.h:252
xAOD::MissingETAssociationHelper
Definition: MissingETAssociationHelper.h:22
xAOD::Electron_v1
Definition: Electron_v1.h:34
columnar::MetAssocationAccessors::trkVec
ConstVec trkVec(AssocId assoc, const xAOD::IParticle *pPart) const
Definition: MetAssociation.h:221
MissingETBase::UsageHandler::ParticleFlow
@ ParticleFlow
Particle Flow Object based.
Definition: MissingETCompositionBase.h:188
MuonContainer.h
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
met::ColumnarMETMaker::m_jetPsEMuOlap
double m_jetPsEMuOlap
Definition: ColumnarMETMaker.h:267
Muon
struct TBPatternUnitContext Muon
columnar::MetHelpers::MetMomentumAccessors::addMet
void addMet(ObjectId< CI, CM > met, const MetMomentumAccessors< CI2, CM > &momAcc, ObjectId< CI2, CM > metSource) const requires(isMutable)
Definition: MetHelpers.h:197
met::ColumnarMETMaker::m_jetMomAcc
columnar::MetHelpers::InputMomentumAccessors< columnar::ContainerId::jet > m_jetMomAcc
Definition: ColumnarMETMaker.h:306
met::ColumnarMETMaker::m_inputPreselectionName
Gaudi::Property< std::string > m_inputPreselectionName
Definition: ColumnarMETMaker.h:299
TrackParticle.h
columnar::MetAssocationAccessors::findIndex
std::size_t findIndex(AssocId assoc, const xAOD::IParticle *pPart) const
Definition: MetAssociation.h:271
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
DeMoScan.index
string index
Definition: DeMoScan.py:362
VertexContainer.h
columnar::MetHelpers::InputMomentumAccessors::eta
ColumnAccessor< CI, RetypeColumn< double, float >, CM > eta
Definition: MetInput.h:49
python.selector.AtlRunQuerySelectorLhcOlc.selector
selector
Definition: AtlRunQuerySelectorLhcOlc.py:610
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
met::ColumnarMETMaker::m_inputObjTypeAcc
columnar::MetHelpers::ObjectTypeAccessor< columnar::ContainerId::particle > m_inputObjTypeAcc
Definition: ColumnarMETMaker.h:302
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::MissingETAssociation_v1::ConstVec::cpt
float cpt() const
Returns .
Definition: MissingETAssociation_v1.cxx:85
met::ColumnarMETMaker::m_JvtTool
ToolHandle< IAsgSelectionTool > m_JvtTool
Definition: ColumnarMETMaker.h:273
met::ColumnarMETMaker::m_JetEtaMax
double m_JetEtaMax
Definition: ColumnarMETMaker.h:237
met::ColumnarMETMaker::rebuildMET
virtual StatusCode rebuildMET(const std::string &metKey, xAOD::Type::ObjectType metType, xAOD::MissingETContainer *metCont, const xAOD::IParticleContainer *collection, xAOD::MissingETAssociationHelper &helper, MissingETBase::UsageHandler::Policy objScale) const override final
Definition: ColumnarMETMaker.cxx:217
met::ColumnarMETMaker::m_doSoftTruth
bool m_doSoftTruth
Definition: ColumnarMETMaker.h:249
asg::AsgComponentConfig::setProperty
StatusCode setProperty(const std::string &name, const T &value)
set the given property
met::ColumnarMETMaker::m_doSetMuonJetEMScale
bool m_doSetMuonJetEMScale
Definition: ColumnarMETMaker.h:256
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
python.changerun.pv
pv
Definition: changerun.py:79
columnar::MetAssociationHelper
a columnar version of xAOD::MissingETAssociationHelper
Definition: MetAssociation.h:85
xAODType::Tau
@ Tau
The object is a tau (jet)
Definition: ObjectType.h:49
MissingETBase::Source::photon
static Types::bitmask_t photon(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed photons.
Definition: MissingETBase.h:236
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
columnar::MetAssocationAccessors::getAlternateConstVec
xAOD::JetFourMom_t getAlternateConstVec(AssocId assoc) const
Definition: MetAssociation.h:299
xAOD::JetConstituentVector
A vector of jet constituents at the scale used during jet finding.
Definition: JetConstituentVector.h:117
MissingETAssociationMap.h
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition: JetContainer.h:17
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
met::ColumnarMETMaker::m_jetConstitScaleMomAcc
std::optional< columnar::MetHelpers::InputMomentumAccessors< columnar::ContainerId::jet > > m_jetConstitScaleMomAcc
Definition: ColumnarMETMaker.h:314
SG::AuxElement::container
const SG::AuxVectorData * container() const
Return the container holding this element.
xAOD::MissingETAssociation_v1::ConstVec::cpx
float cpx() const
Returns .
columnar::MetHelpers::InputMomentumAccessors::py
float py(ObjectId< CI, CM > object) const
Definition: MetInput.h:60
met::ColumnarMETMaker::m_metAssocHandle
columnar::ColumnAccessor< columnar::ContainerId::metAssociation, columnar::ObjectColumn > m_metAssocHandle
Definition: ColumnarMETMaker.h:280
xAODType::ObjectType
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition: ObjectType.h:32
columnar::MetHelpers::InputMomentumAccessors::pt
ColumnAccessor< CI, RetypeColumn< double, float >, CM > pt
Definition: MetInput.h:48
met::ColumnarMETMaker::m_jetJvtMomentName
std::string m_jetJvtMomentName
Definition: ColumnarMETMaker.h:232
xAOD::JetAttribute::GhostTrack
@ GhostTrack
Definition: JetAttributes.h:252
python.PyAthena.obj
obj
Definition: PyAthena.py:132
met::ColumnarMETMaker::m_doRemoveElecTrksEM
bool m_doRemoveElecTrksEM
Definition: ColumnarMETMaker.h:255
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
MissingETAssociationHelper.h
met::ColumnarMETMaker::acceptTrack
bool acceptTrack(const xAOD::TrackParticle *trk, const xAOD::Vertex *vx) const
Definition: ColumnarMETMaker.cxx:1220
met::ColumnarMETMaker::m_FwdJetPtCut
double m_FwdJetPtCut
Definition: ColumnarMETMaker.h:235
MissingETComposition.h
met::ColumnarMETMaker::m_customFwdJetPtCut
double m_customFwdJetPtCut
Definition: ColumnarMETMaker.h:244
MissingETContainer.h
xAOD::MissingETAssociation_v1::ConstVec::ce
float ce() const
Returns .
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition: Event/xAOD/xAODJet/xAODJet/Jet.h:17
met::ColumnarMETMaker::m_doRemoveMuonJets
bool m_doRemoveMuonJets
Definition: ColumnarMETMaker.h:253
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
columnar::MetHelpers::MetMomentumAccessors::addParticle
void addParticle(ObjectId< CI, CM > met, float px, float py, float pt) const requires(isMutable)
Definition: MetHelpers.h:188
met::ColumnarMETMaker::m_jetTrkNMuOlap
int m_jetTrkNMuOlap
Definition: ColumnarMETMaker.h:265
met::ColumnarMETMaker::m_jetMinEfrac
double m_jetMinEfrac
Definition: ColumnarMETMaker.h:229
met::ColumnarMETMaker::m_customJvtWP
std::string m_customJvtWP
Definition: ColumnarMETMaker.h:246
met::ColumnarMETMaker::m_acc_width
columnar::JetAccessor< float > m_acc_width
Definition: ColumnarMETMaker.h:309
AuxElement.h
Base class for elements of a container that can have aux data.
met::ColumnarMETMaker::m_JvtWP
std::string m_JvtWP
Definition: ColumnarMETMaker.h:241
met::ColumnarMETMaker::m_jetOutputMetWeightDecRegular
columnar::MetHelpers::ObjectWeightDecorator< columnar::ContainerId::mutableMet, columnar::ContainerId::jet > m_jetOutputMetWeightDecRegular
Definition: ColumnarMETMaker.h:318
met::ColumnarMETMaker::m_doConstJet
bool m_doConstJet
Definition: ColumnarMETMaker.h:250
met::ColumnarMETMaker::m_JetEtaForw
double m_JetEtaForw
Definition: ColumnarMETMaker.h:238