ATLAS Offline Software
METMaker.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // METMaker.cxx
8 // Implementation file for class METMaker
9 // Author: T.J.Khoo<khoo@cern.ch>
11 
12 // METUtilities includes
13 #include "METUtilities/METMaker.h"
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 std::vector;
52 
53  using xAOD::MissingET;
59  //
60  using xAOD::IParticle;
62  //
63  using xAOD::JetContainer;
65  //
66  using xAOD::TrackParticle;
67  // using xAOD::VertexContainer;
68  // using xAOD::Vertex;
69 
71  static const SG::AuxElement::ConstAccessor< iplink_t > acc_originalObject("originalObjectLink");
72  static const SG::AuxElement::ConstAccessor< iplink_t > acc_nominalObject("nominalObjectLink");
73  static const SG::AuxElement::ConstAccessor< std::vector<iplink_t > > acc_ghostMuons("GhostMuon");
74  static const SG::AuxElement::ConstAccessor< std::vector<iplink_t > > acc_ghostElecs("GhostElec");
75 
76  static const SG::AuxElement::ConstAccessor< std::vector<int> > acc_trkN("NumTrkPt500");
77  static const SG::AuxElement::ConstAccessor< std::vector<float> > acc_trksumpt("SumPtTrkPt500");
78  static const SG::AuxElement::ConstAccessor< std::vector<float> > acc_sampleE("EnergyPerSampling");
79 
80  static const SG::AuxElement::ConstAccessor<float> acc_emf("EMFrac");
81  static const SG::AuxElement::ConstAccessor<float> acc_psf("PSFrac");
82  static const SG::AuxElement::ConstAccessor<float> acc_width("Width");
83  static const SG::AuxElement::ConstAccessor<float> acc_Eloss("EnergyLoss");
84 
85  static const SG::AuxElement::Accessor< std::vector<iplink_t> > dec_constitObjLinks("ConstitObjectLinks");
86  static const SG::AuxElement::Accessor< std::vector<float> > dec_constitObjWeights("ConstitObjectWeights");
87 
88 
90  // Public methods:
92 
93  // Constructors
95  METMaker::METMaker(const std::string& name) :
96  AsgTool(name),
97  m_PVkey("PrimaryVertices"),
98  m_acc_jetJvtMoment(nullptr),
99  m_acc_jetRejectionDec(nullptr),
100  m_JvtCutTight(-100.0),
101  m_JvtTightPtMax(-100.0),
102  m_JvtCutMedium(-100.0),
103  m_JvtMediumPtMax(-100.0),
104  m_trkseltool(""),
105  m_JvtTool("", this)
106  {
107  //
108  // Property declaration
109  //
110 
111  // declareProperty("VxColl", m_pvcoll = "PrimaryVertices" );
112 
113  declareProperty("JetJvtMomentName", m_jetJvtMomentName = "Jvt" );
114  declareProperty("JetRejectionDec", m_jetRejectionDec = "" );
115  declareProperty("JetMinEFrac", m_jetMinEfrac = 0.0 );
116  declareProperty("JetMinWeightedPt", m_jetMinWeightedPt = 20.0e3 );
117  //declareProperty("JetConstitScaleMom", m_jetConstitScaleMom = "JetLCScaleMomentum");
118  declareProperty("JetConstitScaleMom", m_jetConstitScaleMom = "JetConstitScaleMomentum");
119  declareProperty("CorrectJetPhi", m_jetCorrectPhi = false );
120  declareProperty("DoPFlow", m_doPFlow = false );
121  declareProperty("DoSoftTruth", m_doSoftTruth = false );
122  declareProperty("DoJetTruth", m_doConstJet = false );
123 
124  declareProperty("JetSelection", m_jetSelection = "Tight" );
125  declareProperty("JetEtaMax", m_JetEtaMax = 4.5 );
126  declareProperty("JetEtaForw", m_JetEtaForw = 2.5 );
127  declareProperty("UseR21JvtFallback", m_useR21JvtFallback = false );
128  declareProperty("CustomCentralJetPt", m_customCenJetPtCut = 20e3 );
129  declareProperty("CustomForwardJetPt", m_customFwdJetPtCut = 20e3 );
130  declareProperty("CustomJetJvtCut", m_customJvtCut = 0.59 );
131  declareProperty("CustomJetJvtPtMax", m_customJvtPtMax = 60e3 );
132 
133  declareProperty("DoMuonEloss", m_muEloss = false );
134  declareProperty("ORCaloTaggedMuons", m_orCaloTaggedMuon = true );
135  declareProperty("GreedyPhotons", m_greedyPhotons = false );
136  declareProperty("VeryGreedyPhotons", m_veryGreedyPhotons = false );
137 
138  declareProperty("UseGhostMuons", m_useGhostMuons = false );
139  declareProperty("DoRemoveMuonJets", m_doRemoveMuonJets = true );
140  declareProperty("DoSetMuonJetEMScale", m_doSetMuonJetEMScale = true );
141 
142  declareProperty("DoRemoveElecTrks", m_doRemoveElecTrks = true );
143  declareProperty("DoRemoveElecTrksEM", m_doRemoveElecTrksEM = false );
144 
145  declareProperty("skipSystematicJetSelection", m_skipSystematicJetSelection = false,
146  "EXPERIMENTAL: whether to use simplified OR based on nominal jets "
147  "and for jet-related systematics only. "
148  "WARNING: this property is strictly for doing physics studies of the feasibility "
149  "of this OR scheme, it should not be used in a regular analysis");
150 
151  // muon overlap variables (expert use only)
152  declareProperty("JetTrkNMuOlap", m_jetTrkNMuOlap = 5 );
153  declareProperty("JetWidthMuOlap", m_jetWidthMuOlap = 0.1 );
154  declareProperty("JetPsEMuOlap", m_jetPsEMuOlap = 2.5e3 );
155  declareProperty("JetEmfMuOlap", m_jetEmfMuOlap = 0.9 );
156  declareProperty("JetTrkPtMuPt", m_jetTrkPtMuPt = 0.8 );
157  declareProperty("muIDPTJetPtRatioMuOlap", m_muIDPTJetPtRatioMuOlap = 2.0 );
158 
159  declareProperty("MissingObjWarnThreshold", m_missObjWarningPtThreshold = 7.0e3 );
160 
161  declareProperty("TrackSelectorTool", m_trkseltool );
162  declareProperty("JvtSelTool", m_JvtTool );
163  }
164 
165  // Destructor
168  = default;
169 
170  // Athena algtool's Hooks
173  {
174  ATH_MSG_INFO ("Initializing " << name() << "...");
175 
176  //default jet selection i.e. pre-recommendation
177  ATH_MSG_INFO("Use jet selection criterion: " << m_jetSelection << " PFlow: " << m_doPFlow);
178  // note: default in R22 is to let the JvtTool apply the NNJvt cuts based on the chosen WP;
179  // only if m_useR21JvtFallback is used the Jvt requirements based on m_JvtCut are applied manually
180  if (m_jetSelection == "Loose") { m_CenJetPtCut = 20e3; m_FwdJetPtCut = 20e3; m_JvtWP = "FixedEffPt"; m_JvtCut = m_doPFlow ? 0.5 : 0.59; m_JvtPtMax = 60e3; }
181  else if (m_jetSelection == "Tight") { m_CenJetPtCut = 20e3; m_FwdJetPtCut = 30e3; m_JvtWP = "FixedEffPt"; m_JvtCut = m_doPFlow ? 0.5 : 0.59; m_JvtPtMax = 60e3; }
182  else if (m_jetSelection == "Tighter"){ m_CenJetPtCut = 20e3; m_FwdJetPtCut = 35e3; m_JvtWP = "FixedEffPt"; m_JvtCut = m_doPFlow ? 0.5 : 0.59; m_JvtPtMax = 60e3; }
183  else if (m_jetSelection == "Tenacious"){ m_CenJetPtCut = 20e3; m_FwdJetPtCut = 40e3; m_JvtWP = "FixedEffPt"; m_JvtCut = m_doPFlow ? 0.5 : 0.59; m_JvtPtMax = 60e3; }
184  else if (m_jetSelection == "Tier0") { m_CenJetPtCut = 0; m_FwdJetPtCut = 0; m_JvtCut = -1; m_JvtPtMax = 0; m_useR21JvtFallback = true;}
185  else if (m_jetSelection == "Expert") {
186  ATH_MSG_INFO("Custom jet selection configured. *** FOR EXPERT USE ONLY ***");
192  }
193  else if (m_jetSelection == "HRecoil") {
194  ATH_MSG_INFO("Jet selection for hadronic recoil calculation is configured.");
195  m_CenJetPtCut = 9999e3;
196  m_FwdJetPtCut = 9999e3;
197  m_JetEtaMax = 5;
198  //m_JvtCut = 0.; // currently skip
199  //m_JvtPtMax = 0.; // currently skip
200  // this WP also requires that we place the Jvt cuts manually
201  m_useR21JvtFallback = true;
202  }
203  else {
204  if (m_jetSelection == "Default") ATH_MSG_WARNING( "WARNING: Default is now deprecated" );
205  ATH_MSG_ERROR( "Error: No available jet selection found! Please update JetSelection in METMaker. Choose one: Loose, Tight (recommended), Tighter, Tenacious" );
206  return StatusCode::FAILURE;
207  }
208 
209  // if using the old R21 Jvt cuts also enforce the same forward threshold
211 
212  if (!m_trkseltool.empty()) ATH_CHECK( m_trkseltool.retrieve() );
213 
214  // do not setup Jvt tool if we use the fallback option, i.e. apply Jvt requirements manually
215  if (!m_useR21JvtFallback) {
216  if (m_JvtTool.empty()) {
217  asg::AsgToolConfig config_jvt ("CP::NNJvtSelectionTool/JvtSelTool");
218  ATH_CHECK(config_jvt.setProperty("WorkingPoint", m_JvtWP));
219  ATH_CHECK(config_jvt.setProperty("JvtMomentName", "NNJvt"));
220  ATH_CHECK(config_jvt.setProperty("MaxPtForJvt", m_JvtPtMax));
221  ATH_CHECK(config_jvt.makePrivateTool(m_JvtTool));
222  }
223  ATH_CHECK(m_JvtTool.retrieve());
224  }
225 
226  // ReadHandleKey(s)
227  ATH_CHECK( m_PVkey.initialize() );
228 
229  // configurable accessors
230  m_acc_jetJvtMoment = std::make_unique<SG::AuxElement::ConstAccessor<float>>(m_jetJvtMomentName);
231  if (!m_jetRejectionDec.empty()) {
232  m_acc_jetRejectionDec = std::make_unique<SG::AuxElement::ConstAccessor<char>>(m_jetRejectionDec);
233  ATH_MSG_INFO("Applying additional jet rejection criterium in MET calculation: " << m_jetRejectionDec);
234  }
235 
236  ATH_MSG_INFO("Suppressing warnings of objects missing in METAssociationMap for objects with pT < " << m_missObjWarningPtThreshold/1e3 << " GeV.");
237 
238  // overlap removal simplification?
240  ATH_MSG_INFO("Requesting simplified overlap removal procedure in MET calculation");
241  }
242 
243  return StatusCode::SUCCESS;
244  }
245 
246 
247  // **** Rebuild generic MET term ****
248 
249  StatusCode METMaker::rebuildMET(const std::string& metKey,
250  xAOD::Type::ObjectType metType,
251  xAOD::MissingETContainer* metCont,
252  const xAOD::IParticleContainer* collection,
255  {
257  switch(metType) {
259  metSource = MissingETBase::Source::electron();
260  break;
261  case xAOD::Type::Photon:
262  metSource = MissingETBase::Source::photon();
263  break;
264  case xAOD::Type::Tau:
265  metSource = MissingETBase::Source::tau();
266  break;
267  case xAOD::Type::Muon:
268  metSource = MissingETBase::Source::muon();
269  break;
270  case xAOD::Type::Jet:
271  ATH_MSG_WARNING("Incorrect use of rebuildMET -- use rebuildJetMET for RefJet term");
272  return StatusCode::FAILURE;
273  default:
274  ATH_MSG_WARNING("Invalid object type provided: " << metType);
275  return StatusCode::FAILURE;
276  }
277 
278  MissingET* met = nullptr;
279  if( fillMET(met,metCont, metKey , metSource) != StatusCode::SUCCESS) {
280  ATH_MSG_ERROR("failed to fill MET term \"" << metKey << "\"");
281  return StatusCode::FAILURE;
282  }
283 
284  // If muon eloss corrections are required, create a new term to hold these if it doesn't already exist
285  if(metType==xAOD::Type::Muon && (m_muEloss || m_doSetMuonJetEMScale) && !(*metCont)["MuonEloss"]) {
286  MissingET* met_muEloss = nullptr;
287  if( fillMET(met_muEloss,metCont,"MuonEloss",
289  ATH_MSG_ERROR("failed to create Muon Eloss MET term");
290  return StatusCode::FAILURE;
291  }
292  }
293 
294  return rebuildMET(met,collection,helper,objScale);
295  }
296 
298  const xAOD::IParticleContainer* collection,
301  {
303  bool removeOverlap = true;
304  if(!collection->empty()) {
305  const IParticle* obj = collection->front();
306  if(obj->type()==xAOD::Type::Muon) {
308  removeOverlap = false;
309  }
310  }
313  return rebuildMET(met,collection,helper,p,removeOverlap,objScale);
314  }
315 
317  const xAOD::IParticleContainer* collection,
320  bool removeOverlap,
322  if(!met || !collection) {
323  ATH_MSG_WARNING("Invalid pointer supplied for "
324  << "MET (" << met << ") or "
325  << "collection (" << collection << ").");
326  return StatusCode::SUCCESS;
327  }
328  const xAOD::MissingETAssociationMap* map = helper.map();
329  if(!map){
330  ATH_MSG_WARNING("MET Association Helper isn't associated with a MissingETAssociationMap!");
331  return StatusCode::SUCCESS;
332  }
333  if(map->empty()) {
334  ATH_MSG_WARNING("Incomplete association map received. Cannot rebuild MET.");
335  ATH_MSG_WARNING("Note: METMaker should only be run on events containing at least one PV");
336  return StatusCode::SUCCESS;
337  }
338  ATH_MSG_VERBOSE("Building MET term " << met->name());
339  dec_constitObjLinks(*met) = vector<iplink_t>(0);
340  dec_constitObjWeights(*met) = vector<float>(0);
341  std::vector<iplink_t>& uniqueLinks = dec_constitObjLinks(*met);
342  std::vector<float>& uniqueWeights = dec_constitObjWeights(*met);
343  uniqueLinks.reserve(collection->size());
344  uniqueWeights.reserve(collection->size());
345 
346  // Get the hashed key of this collection, if we can. Though his only works
347  // if
348  // 1. the container is an owning container, and not just a view;
349  // 2. the container is in the event store already.
350  // Since we will be creating ElementLink-s to these objects later on in the
351  // code, and it should work in AnalysisBase, only the first one of these
352  // is checked. Since the code can not work otherwise.
353  SG::sgkey_t collectionSgKey = 0;
354  if(collection->ownPolicy() == SG::OWN_ELEMENTS) {
355  collectionSgKey = getKey(collection);
356  if(collectionSgKey == 0) {
357  ATH_MSG_ERROR("Could not find the collection with pointer: "
358  << collection);
359  return StatusCode::FAILURE;
360  }
361  }
362 
363  if(!collection->empty()) {
364  bool originalInputs = !acc_originalObject.isAvailable(*collection->front());
365  bool isShallowCopy = dynamic_cast<const xAOD::ShallowAuxContainer*>(collection->front()->container()->getConstStore());
366  ATH_MSG_VERBOSE("const store = " << collection->front()->container()->getConstStore());
367  if(isShallowCopy && originalInputs) {
368  ATH_MSG_WARNING("Shallow copy provided without \"originalObjectLinks\" decoration! "
369  << "Overlap removal cannot be done. "
370  << "Will not compute this term.");
371  ATH_MSG_WARNING("Please apply xAOD::setOriginalObjectLinks() from xAODBase/IParticleHelpers.h");
372  return StatusCode::SUCCESS;
373  } else {
374  ATH_MSG_VERBOSE("Original inputs? " << originalInputs);
375  }
376  for(const auto *const obj : *collection) {
377  const IParticle* orig = obj;
378  bool selected = false;
379  if(!originalInputs) { orig = *acc_originalObject(*obj); }
380  std::vector<const xAOD::MissingETAssociation*> assocs = xAOD::MissingETComposition::getAssociations(map,orig);
381  if(assocs.empty()) {
382  std::string message = "Object is not in association map. Did you make a deep copy but fail to set the \"originalObjectLinks\" decoration? "
383  "If not, Please apply xAOD::setOriginalObjectLinks() from xAODBase/IParticleHelpers.h";
384  // Avoid warnings for leptons with pT below threshold for association map
385  if (orig->pt()>m_missObjWarningPtThreshold) {
387  } else {
389  }
390  // if this is an uncalibrated electron below the threshold, then we put it into the soft term
391  if(orig->type()==xAOD::Type::Electron){
392  iplink_t objLink;
393  if(collectionSgKey == 0) {
394  const xAOD::IParticleContainer* ipc = static_cast<const xAOD::IParticleContainer*>(obj->container());
395  objLink = iplink_t(*ipc, obj->index());
396  } else {
397  objLink = iplink_t(collectionSgKey, obj->index());
398  }
399  uniqueLinks.emplace_back( objLink );
400  uniqueWeights.emplace_back( 0. );
401  message = "Missing an electron from the MET map. Included as a track in the soft term. pT: " + std::to_string(obj->pt()/1e3) + " GeV";
402  if (orig->pt()>m_missObjWarningPtThreshold) {
404  } else {
406  }
407  continue;
408  } else {
409  ATH_MSG_ERROR("Missing an object: " << orig->type() << " pT: " << obj->pt()/1e3 << " GeV, may be duplicated in the soft term.");
410  }
411  }
412 
413  // If the object has already been selected and processed, ignore it.
414  if(MissingETComposition::objSelected(helper,orig)) continue;
415  selected = MissingETComposition::selectIfNoOverlaps(helper,orig,p) || !removeOverlap;
416  ATH_MSG_VERBOSE(obj->type() << " (" << orig <<") with pt " << obj->pt()
417  << " is " << ( selected ? "non-" : "") << "overlapping");
418 
419  // Greedy photon options: set selection flags
420  if ((m_greedyPhotons || m_veryGreedyPhotons) && selected && obj->type() == xAOD::Type::Photon){
421  for(const xAOD::MissingETAssociation* assoc : assocs){
422  std::vector<size_t> indices = assoc->overlapIndices(orig);
423  std::vector<const xAOD::IParticle*> allObjects = assoc->objects();
424  for (size_t index : indices){
425  const xAOD::IParticle* thisObj = allObjects[index];
426  if(!thisObj) continue;
427  if ((thisObj->type() == xAOD::Type::Jet && m_veryGreedyPhotons) ||
428  thisObj->type() == xAOD::Type::Electron)
429  helper.setObjSelectionFlag(assoc, thisObj, true);
430  }
431  }
432  }
433 
434  //Do special overlap removal for calo tagged muons
435  if(m_orCaloTaggedMuon && !removeOverlap && orig->type()==xAOD::Type::Muon && static_cast<const xAOD::Muon*>(orig)->muonType()==xAOD::Muon::CaloTagged) {
436  for (size_t i = 0; i < assocs.size(); i++) {
437  std::vector<size_t> ind = assocs[i]->overlapIndices(orig);
438  std::vector<const xAOD::IParticle*> allObjects = assocs[i]->objects();
439  for (size_t indi = 0; indi < ind.size(); indi++) if (allObjects[ind[indi]]) {
440  if (allObjects[ind[indi]]->type()==xAOD::Type::Electron
441  && helper.objSelected(assocs[i], ind[indi])) {
442  selected = false;
443  break;
444  }
445  }
446  }
447  }
448  // Don't overlap remove muons, but flag the non-overlapping muons to take out their tracks from jets
449  // Removed eloss from here -- clusters already flagged.
450  // To be handled in rebuildJetMET
451  if(selected) {
453  ATH_MSG_VERBOSE("Add object with pt " << obj->pt());
454  *met += obj;
455  } else {
457  ATH_MSG_VERBOSE("Add truth object with pt " << constvec.cpt());
458  met->add(constvec.cpx(),constvec.cpy(),constvec.cpt());
459  }
460  }
461  if(selected) {
462  iplink_t objLink;
463  if(collectionSgKey == 0) {
464  const xAOD::IParticleContainer* ipc =
465  static_cast<const xAOD::IParticleContainer*>(obj->container());
466  objLink = iplink_t(*ipc, obj->index());
467  } else {
468  objLink = iplink_t(collectionSgKey, obj->index());
469  }
470  uniqueLinks.push_back( objLink );
471  uniqueWeights.push_back( 1. );
472  }
473  }
474  }
475  ATH_MSG_DEBUG("Built met term " << met->name() << ", with magnitude " << met->met());
476  return StatusCode::SUCCESS;
477  }
478 
479  StatusCode METMaker::rebuildJetMET(const std::string& metJetKey,
480  const std::string& softKey,
481  xAOD::MissingETContainer* metCont,
482  const xAOD::JetContainer* jets,
483  const xAOD::MissingETContainer* metCoreCont,
485  bool doJetJVT)
486  {
487  ATH_MSG_VERBOSE("Rebuild jet term: " << metJetKey << " and soft term: " << softKey);
488 
489  MissingET* metJet = nullptr;
490  if( fillMET(metJet,metCont, metJetKey, MissingETBase::Source::jet()) != StatusCode::SUCCESS) {
491  ATH_MSG_ERROR("failed to fill MET term \"" << metJetKey << "\"");
492  return StatusCode::FAILURE;
493  }
494 
495  const MissingET *coreSoftClus(nullptr), *coreSoftTrk(nullptr);
496  MissingET *metSoftClus(nullptr), *metSoftTrk(nullptr);
497 
498  const MissingET* coreSoft = (*metCoreCont)[softKey+"Core"];
499  if(!coreSoft) {
500  ATH_MSG_WARNING("Invalid soft term key supplied: " << softKey);
501  return StatusCode::FAILURE;
502  }
503  if(MissingETBase::Source::isTrackTerm(coreSoft->source())) {
504  coreSoftTrk = coreSoft;
505 
506  metSoftTrk = nullptr;
507  if( fillMET(metSoftTrk,metCont, softKey , coreSoftTrk->source() ) != StatusCode::SUCCESS) {
508  ATH_MSG_ERROR("failed to fill MET term \"" << softKey << "\"");
509  return StatusCode::FAILURE;
510  }
511  } else {
512  coreSoftClus = coreSoft;
513 
514  metSoftClus = nullptr;
515  if( fillMET(metSoftClus, metCont, softKey , coreSoftClus->source() ) != StatusCode::SUCCESS) {
516  ATH_MSG_ERROR("failed to fill MET term \"" << softKey << "\"");
517  return StatusCode::FAILURE;
518  }
519  }
520 
521  return rebuildJetMET(metJet, jets, helper,
522  metSoftClus, coreSoftClus,
523  metSoftTrk, coreSoftTrk,
524  doJetJVT);
525  }
526 
527  StatusCode METMaker::rebuildTrackMET(const std::string& metJetKey,
528  const std::string& softKey,
529  xAOD::MissingETContainer* metCont,
530  const xAOD::JetContainer* jets,
531  const xAOD::MissingETContainer* metCoreCont,
533  bool doJetJVT)
534  {
535  ATH_MSG_VERBOSE("Rebuild jet term: " << metJetKey << " and soft term: " << softKey);
536 
537  MissingET* metJet = nullptr;
538  if( fillMET(metJet , metCont, metJetKey , MissingETBase::Source::jet() | MissingETBase::Source::track() ) != StatusCode::SUCCESS) {
539  ATH_MSG_ERROR("failed to fill MET term \"" << metJetKey << "\"");
540  return StatusCode::FAILURE;
541  }
542 
543  const MissingET *coreSoftTrk(nullptr);
544  MissingET *metSoftTrk(nullptr);
545 
546  const MissingET* coreSoft = (*metCoreCont)[softKey+"Core"];
547  if(!coreSoft) {
548  ATH_MSG_WARNING("Invalid soft term key supplied: " << softKey);
549  return StatusCode::FAILURE;
550  }
551  coreSoftTrk = coreSoft;
552 
553  metSoftTrk = nullptr;
554  if( fillMET(metSoftTrk , metCont, softKey , coreSoftTrk->source()) != StatusCode::SUCCESS) {
555  ATH_MSG_ERROR("failed to fill MET term \"" << softKey << "\"");
556  return StatusCode::FAILURE;
557  }
558 
559  return rebuildTrackMET(metJet, jets, helper,
560  metSoftTrk, coreSoftTrk,
561  doJetJVT);
562  }
563 
564  StatusCode METMaker::rebuildJetMET(const std::string& metJetKey,
565  const std::string& softClusKey,
566  const std::string& softTrkKey,
567  xAOD::MissingETContainer* metCont,
568  const xAOD::JetContainer* jets,
569  const xAOD::MissingETContainer* metCoreCont,
571  bool doJetJVT)
572  {
573 
574  ATH_MSG_VERBOSE("Create Jet MET " << metJetKey);
575  MissingET* metJet = nullptr;
576  if( fillMET(metJet , metCont ,metJetKey , MissingETBase::Source::jet()) != StatusCode::SUCCESS) {
577  ATH_MSG_ERROR("failed to fill MET term \"" << metJetKey << "\"");
578  return StatusCode::FAILURE;
579  }
580  ATH_MSG_VERBOSE("Create SoftClus MET " << softClusKey);
581  const MissingET* coreSoftClus = (*metCoreCont)[softClusKey+"Core"];
582  ATH_MSG_VERBOSE("Create SoftTrk MET " << softTrkKey);
583  const MissingET* coreSoftTrk = (*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  MissingET* metSoftClus = nullptr;
593  if( fillMET(metSoftClus, metCont, softClusKey, coreSoftClus->source()) != StatusCode::SUCCESS) {
594  ATH_MSG_ERROR("failed to fill MET term \"" << softClusKey << "\"");
595  return StatusCode::FAILURE;
596  }
597 
598  MissingET* metSoftTrk = nullptr;
599  if( fillMET(metSoftTrk, metCont, softTrkKey, coreSoftTrk->source()) != StatusCode::SUCCESS) {
600  ATH_MSG_ERROR("failed to fill MET term \"" << softTrkKey << "\"");
601  return StatusCode::FAILURE;
602  }
603 
604  return rebuildJetMET(metJet, jets, helper,
605  metSoftClus, coreSoftClus,
606  metSoftTrk, coreSoftTrk,
607  doJetJVT);
608  }
609 
611  const xAOD::JetContainer* jets,
613  xAOD::MissingET* metSoftClus,
614  const xAOD::MissingET* coreSoftClus,
615  xAOD::MissingET* metSoftTrk,
616  const xAOD::MissingET* coreSoftTrk,
617  bool doJetJVT,
618  bool tracksForHardJets,
619  std::vector<const xAOD::IParticle*>* softConst) {
620  if(!metJet || !jets) {
621  ATH_MSG_WARNING("Invalid pointer supplied for "
622  << "MET (" << metJet << ") or "
623  << "jet collection (" << jets << ").");
624  return StatusCode::SUCCESS;
625  }
626  const xAOD::MissingETAssociationMap* map = helper.map();
627  if(!map){
628  ATH_MSG_WARNING("MET Association Helper isn't associated with a MissingETAssociationMap!");
629  return StatusCode::SUCCESS;
630  }
631  if(softConst && m_trkseltool.empty() && !m_doPFlow && !m_doSoftTruth) {
632  ATH_MSG_WARNING( "Requested soft track element links, but no track selection tool supplied.");
633  }
634  const xAOD::Vertex *pv = softConst?getPV():nullptr;
635 
636  if(map->empty()) {
637  ATH_MSG_WARNING("Incomplete association map received. Cannot rebuild MET.");
638  ATH_MSG_WARNING("Note: METMaker should only be run on events containing at least one PV");
639  return StatusCode::SUCCESS;
640  }
641  ATH_MSG_VERBOSE("Building MET jet term " << metJet->name());
642  if(!metSoftClus && !metSoftTrk) {
643  ATH_MSG_WARNING("Neither soft cluster nor soft track term has been supplied!");
644  return StatusCode::SUCCESS;
645  }
646  static const SG::AuxElement::ConstAccessor<std::vector<ElementLink<IParticleContainer> > > acc_softConst("softConstituents");
647  if(metSoftClus) {
648  dec_constitObjLinks(*metSoftClus) = vector<iplink_t>(0);
649  if(coreSoftClus) {
650  ATH_MSG_VERBOSE("Building MET soft cluster term " << metSoftClus->name());
651  ATH_MSG_VERBOSE("Core soft cluster mpx " << coreSoftClus->mpx()
652  << ", mpy " << coreSoftClus->mpy()
653  << " sumet " << coreSoftClus->sumet());
654  *metSoftClus += *coreSoftClus;
655  } else {
656  ATH_MSG_WARNING("Soft cluster term provided without a core term!");
657  return StatusCode::SUCCESS;
658  }
659  // Fill a vector with the soft constituents, if one was provided.
660  // For now, only setting up to work with those corresponding to the jet constituents.
661  // Can expand if needed.
662  if(softConst && acc_softConst.isAvailable(*coreSoftClus)) {
663  for(const auto& constit : acc_softConst(*coreSoftClus)) {
664  softConst->push_back(*constit);
665  }
666  ATH_MSG_DEBUG(softConst->size() << " soft constituents from core term");
667  }
668  }
669  if(metSoftTrk) {
670  dec_constitObjLinks(*metSoftTrk) = vector<iplink_t>(0);
671  if(coreSoftTrk) {
672  ATH_MSG_VERBOSE("Building MET soft track term " << metSoftTrk->name());
673  ATH_MSG_VERBOSE("Core soft track mpx " << coreSoftTrk->mpx()
674  << ", mpy " << coreSoftTrk->mpy()
675  << " sumet " << coreSoftTrk->sumet());
676  *metSoftTrk += *coreSoftTrk;
677  } else {
678  ATH_MSG_WARNING("Soft track term provided without a core term!");
679  return StatusCode::SUCCESS;
680  }
681  if(softConst && acc_softConst.isAvailable(*coreSoftTrk) && !m_doPFlow && !m_doSoftTruth) {
682  for(const auto& constit : acc_softConst(*coreSoftTrk)) {
683  softConst->push_back(*constit);
684  }
685  ATH_MSG_DEBUG(softConst->size() << " soft constituents from trk core term");
686  }
687  }
688 
689  dec_constitObjLinks(*metJet) = std::vector<iplink_t>(0);
690  dec_constitObjWeights(*metJet) = std::vector<float>(0);
691  std::vector<iplink_t>& uniqueLinks = dec_constitObjLinks(*metJet);
692  std::vector<float>& uniqueWeights = dec_constitObjWeights(*metJet);
693  uniqueLinks.reserve(jets->size());
694  uniqueWeights.reserve(jets->size());
695  std::vector<iplink_t> softJetLinks;
696  std::vector<float> softJetWeights;
697  bool originalInputs = jets->empty() ? false : !acc_originalObject.isAvailable(*jets->front());
698 
699  // Get the hashed key of this jet, if we can. Though his only works if
700  // 1. the container is an owning container, and not just a view;
701  // 2. the container is in the event store already.
702  // Since we will be creating ElementLink-s to these jets later on in the
703  // code, and it should work in AnalysisBase, only the first one of these
704  // is checked. Since the code can not work otherwise.
705  SG::sgkey_t jetsSgKey = 0;
706  if(jets->ownPolicy() == SG::OWN_ELEMENTS) {
707  jetsSgKey = getKey(jets);
708  if(jetsSgKey == 0) {
709  ATH_MSG_ERROR("Could not find the jets with pointer: " << jets);
710  return StatusCode::FAILURE;
711  }
712  }
713 
714  for(const auto *const jet : *jets) {
715  const MissingETAssociation* assoc = nullptr;
716  if(originalInputs) {
718  } else {
719  const IParticle* orig = *acc_originalObject(*jet);
720  assoc = MissingETComposition::getAssociation(map,static_cast<const xAOD::Jet*>(orig));
721  }
722  if(assoc && !assoc->isMisc()) {
723 
724  // init nominal_jet and either actually asign nominal jet or fall back to systematic jet
725  const xAOD::Jet * nominal_jet = nullptr;
727  // retrieve nominal calibrated jet
728  if (acc_nominalObject.isAvailable(*jet))
729  nominal_jet = static_cast<const xAOD::Jet*>(*acc_nominalObject(*jet));
730  else {
731  ATH_MSG_ERROR("No nominal calibrated jet available for jet " << jet->index() << ". Cannot simplify overlap removal!");
732  nominal_jet = jet;
733  }
734  }
735  else
736  nominal_jet = jet;
737 
738  ATH_MSG_VERBOSE( "Jet (nom. calib) pt = " << nominal_jet->pt());
739  ATH_MSG_VERBOSE( "Jet pt = " << jet->pt());
740 
741  // use nominal calibrated jets instead
742  bool selected = (std::abs(nominal_jet->eta())<m_JetEtaForw && nominal_jet->pt()>m_CenJetPtCut) || (std::abs(nominal_jet->eta())>=m_JetEtaForw && nominal_jet->pt()>m_FwdJetPtCut );
743  bool JVT_reject(false);
744  bool isMuFSRJet(false);
745 
746  // 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
747  // use nominal calibrated jets instead
748  if (m_JetEtaMax > 0.0 && std::abs(nominal_jet->eta()) > m_JetEtaMax)
749  JVT_reject = true;
750 
751  if(doJetJVT) {
752  if (!m_useR21JvtFallback) {
753  // intrinsically checks that is within range to apply Jvt requirement
754  // use nominal calibrated jets instead
755  JVT_reject = !bool(m_JvtTool->accept(nominal_jet));
756  }
757  else {
758  if(jet->pt()<m_JvtPtMax && std::abs(jet->eta())<m_JetEtaForw) {
759  float jvt;
760  bool gotJVT = m_acc_jetJvtMoment->isAvailable(*jet);
761  if(gotJVT) {
762  jvt = (*m_acc_jetJvtMoment)(*jet);
763  JVT_reject = jvt<m_JvtCut;
764  if(m_JvtMediumPtMax>0.0 && jet->pt()<m_JvtMediumPtMax) JVT_reject = (jvt<m_JvtCutMedium);
765  if(m_JvtTightPtMax>0.0 && jet->pt()<m_JvtTightPtMax) JVT_reject = (jvt<m_JvtCutTight);
766  ATH_MSG_VERBOSE("Jet " << (JVT_reject ? "fails" : "passes") <<" JVT selection");
767  } else {
768  JVT_reject = true;
769  ATH_MSG_WARNING("Tried to retrieve JVT but this was not set. Failing this jet.");
770  }
771  }
772  }
773  ATH_MSG_VERBOSE("Jet " << (JVT_reject ? "fails" : "passes") <<" JVT selection");
774  }
775 
776  // if defined apply additional jet criterium
777  // use nominal calibrated jets instead
778  if (m_acc_jetRejectionDec && (*m_acc_jetRejectionDec)(*nominal_jet)==0) JVT_reject = true;
779  bool hardJet(false);
781  bool caloverlap = false;
782  caloverlap = calvec.ce()>0;
783  ATH_MSG_DEBUG("Jet " << jet->index() << " is " << ( caloverlap ? "" : "non-") << "overlapping");
784  if(caloverlap) {
785  for(const auto& object : assoc->objects()) {
786  if(helper.objSelected(assoc, object)) {
787  ATH_MSG_VERBOSE(" Jet overlaps with " << object->type() << " " << object->index()
788  << " with pt " << object->pt() << ", phi " << object->phi() );
789  }
790 
791  // Correctly handle this jet if we're using very greedy photons
792  if (object && object->type() == xAOD::Type::Photon && m_veryGreedyPhotons) hardJet = true;
793 
794  }
795  }
796 
797  xAOD::JetFourMom_t constjet;
798  double constSF(1);
799  if(m_jetConstitScaleMom.empty() && assoc->hasAlternateConstVec()){
800  constjet = assoc->getAlternateConstVec();
801  } else { // we use this case but I don't think I need to use nominal calibrated jets - has no effect on OR decision
802  constjet = jet->jetP4(m_jetConstitScaleMom);//grab a constituent scale added by the JetMomentTool/JetConstitFourMomTool.cxx
803  double denom = (assoc->hasAlternateConstVec() ? assoc->getAlternateConstVec() : jet->jetP4("JetConstitScaleMomentum")).E();
804  constSF = denom>1e-9 ? constjet.E()/denom : 0.;
805  ATH_MSG_VERBOSE("Scale const jet by factor " << constSF);
806  calvec *= constSF;
807  }
808  double jpx = constjet.Px();
809  double jpy = constjet.Py();
810  double jpt = constjet.Pt();
811  double opx = jpx - calvec.cpx();
812  double opy = jpy - calvec.cpy();
813 
814  MissingET* met_muonEloss(nullptr);
816  // Get a term to hold the Eloss corrections
817  MissingETContainer* metCont = static_cast<MissingETContainer*>(metJet->container());
818  met_muonEloss = (*metCont)["MuonEloss"];
819  if(!met_muonEloss) {
820  ATH_MSG_WARNING("Attempted to apply muon Eloss correction, but corresponding MET term does not exist!");
821  return StatusCode::FAILURE;
822  }
823  }
824 
825  float total_eloss(0);
826  MissingETBase::Types::bitmask_t muons_selflags(0);
827  std::vector<const xAOD::Muon*> muons_in_jet;
828  std::vector<const xAOD::Electron*> electrons_in_jet;
829  bool passJetForEl=false;
830  if(m_useGhostMuons) { // for backwards-compatibility
831  if(acc_ghostMuons.isAvailable(*jet)) {
832  for(const auto& el : acc_ghostMuons(*jet)) {
833  if(el.isValid()) {
834  muons_in_jet.push_back(static_cast<const xAOD::Muon*>(*el));
835  } else {
836  ATH_MSG_WARNING("Invalid element link to ghost muon! Quitting.");
837  return StatusCode::FAILURE;
838  }
839  }
840  } else {
841  ATH_MSG_WARNING("Ghost muons requested but not found!");
842  return StatusCode::FAILURE;
843  }
844  }
845  for(const auto& obj : assoc->objects()) {
846  if (!obj) { continue; }
847  if(obj->type()==xAOD::Type::Muon && !m_useGhostMuons) {
848  const xAOD::Muon* mu_test(static_cast<const xAOD::Muon*>(obj));
849  ATH_MSG_VERBOSE("Muon " << mu_test->index() << " found in jet " << jet->index());
851  if(acc_originalObject.isAvailable(*mu_test)) mu_test = static_cast<const xAOD::Muon*>(*acc_originalObject(*mu_test));
852  if(MissingETComposition::objSelected(helper,mu_test)) { //
853  muons_in_jet.push_back(mu_test);
854  ATH_MSG_VERBOSE("Muon is selected by MET.");
855  }
856  }
857  } else if(obj->type()==xAOD::Type::Electron && m_doRemoveElecTrks) {
858  const xAOD::Electron* el_test(static_cast<const xAOD::Electron*>(obj));
859  ATH_MSG_VERBOSE("Electron " << el_test->index() << " found in jet " << jet->index());
860  if(acc_originalObject.isAvailable(*el_test)) el_test = static_cast<const xAOD::Electron*>(*acc_originalObject(*el_test));
861  if(helper.objSelected(assoc,el_test)){
862  if(el_test->pt()>90.0e3) { // only worry about high-pt electrons?
863  electrons_in_jet.push_back(el_test);
864  ATH_MSG_VERBOSE("High-pt electron is selected by MET.");
865  }
866  }
867  }
868  }
869  if(m_doRemoveElecTrks) {
870  MissingETBase::Types::constvec_t initialTrkMom = assoc->jetTrkVec();
871  float jet_ORtrk_sumpt = assoc->overlapTrkVec(helper).sumpt();
872  float jet_all_trk_pt = initialTrkMom.sumpt();
873  float jet_unique_trk_pt = jet_all_trk_pt - jet_ORtrk_sumpt;
876  for(const auto& elec : electrons_in_jet) {
877  el_calvec += assoc->calVec(elec);
878  el_trkvec += assoc->trkVec(elec);
879  }
880  float el_cal_pt = el_calvec.cpt();
881  float el_trk_pt = el_trkvec.cpt();
882  ATH_MSG_VERBOSE("Elec trk: " << el_trk_pt
883  << " jetalltrk: " << jet_all_trk_pt
884  << " jetORtrk: " << jet_ORtrk_sumpt
885  << " electrk-jetORtrk: " << (el_trk_pt-jet_ORtrk_sumpt)
886  << " elec cal: " << el_cal_pt
887  << " jetalltrk-electrk: " << (jet_all_trk_pt-el_trk_pt)
888  << " jetalltrk-jetORtrk: " << (jet_all_trk_pt-jet_ORtrk_sumpt) );
889  // Want to use the jet calo measurement if we had at least one electron
890  // and the jet has a lot of residual track pt
891  // Is the cut appropriate?
892  if(el_trk_pt>1e-9 && jet_unique_trk_pt>10.0e3) passJetForEl=true;
893  } // end ele-track removal
894 
895  for(const xAOD::Muon* mu_in_jet : muons_in_jet) {
896  if (not mu_in_jet) continue;
897  float mu_Eloss = acc_Eloss(*mu_in_jet);
898 
899  if(!JVT_reject) {
900  if (m_doRemoveMuonJets) {
901  // need to investigate how this is affected by the recording of muon clusters in the map
902  float mu_id_pt = mu_in_jet->trackParticle(xAOD::Muon::InnerDetectorTrackParticle) ? mu_in_jet->trackParticle(xAOD::Muon::InnerDetectorTrackParticle)->pt() : 0.;
903  float jet_trk_sumpt = acc_trksumpt.isAvailable(*jet) && this->getPV() ? acc_trksumpt(*jet)[this->getPV()->index()] : 0.;
904 
905  // missed the muon, so we should add it back
906  if(0.9999*mu_id_pt>jet_trk_sumpt)
907  jet_trk_sumpt+=mu_id_pt;
908  float jet_trk_N = acc_trkN.isAvailable(*jet) && this->getPV() ? acc_trkN(*jet)[this->getPV()->index()] : 0.;
909  ATH_MSG_VERBOSE("Muon has ID pt " << mu_id_pt);
910  ATH_MSG_VERBOSE("Jet has pt " << jet->pt() << ", trk sumpt " << jet_trk_sumpt << ", trk N " << jet_trk_N);
911  // those corrections are negligible but use nominal calibrated jets instead
912  bool jet_from_muon = mu_id_pt>1e-9 && jet_trk_sumpt>1e-9 && (nominal_jet->pt()/mu_id_pt < m_muIDPTJetPtRatioMuOlap && mu_id_pt/jet_trk_sumpt>m_jetTrkPtMuPt) && jet_trk_N<m_jetTrkNMuOlap;
913  if(jet_from_muon) {
914  ATH_MSG_VERBOSE("Jet is from muon -- remove.");
915  JVT_reject = true;
916  }
917  }
918 
919  if (m_doSetMuonJetEMScale) {
920  // need to investigate how this is affected by the recording of muon clusters in the map
921  float mu_id_pt = mu_in_jet->trackParticle(xAOD::Muon::InnerDetectorTrackParticle) ? mu_in_jet->trackParticle(xAOD::Muon::InnerDetectorTrackParticle)->pt() : 0.;
922  float jet_trk_sumpt = acc_trksumpt.isAvailable(*jet) && this->getPV() ? acc_trksumpt(*jet)[this->getPV()->index()] : 0.;
923  // missed the muon, so we should add it back
924  if(0.9999*mu_id_pt>jet_trk_sumpt)
925  jet_trk_sumpt+=mu_id_pt;
926  float jet_trk_N = acc_trkN.isAvailable(*jet) && this->getPV() ? acc_trkN(*jet)[this->getPV()->index()] : 0.;
927 
928  float jet_psE = 0.;
929  if (acc_psf.isAvailable(*jet)){
930  jet_psE = acc_psf(*jet);
931  } else if (acc_sampleE.isAvailable(*jet)){
932  jet_psE = acc_sampleE(*jet)[0] + acc_sampleE(*jet)[4];
933  } else {
934  ATH_MSG_ERROR("Jet PS fraction or sampling energy must be available to calculate MET with doSetMuonJetEMScale");
935  return StatusCode::FAILURE;
936  }
937 
938  bool jet_from_muon = jet_trk_sumpt>1e-9 && jet_trk_N<3 && mu_id_pt / jet_trk_sumpt > m_jetTrkPtMuPt && acc_emf(*jet)>m_jetEmfMuOlap && acc_width(*jet)<m_jetWidthMuOlap && jet_psE>m_jetPsEMuOlap;
939  ATH_MSG_VERBOSE("Muon has ID pt " << mu_id_pt);
940  ATH_MSG_VERBOSE("Jet has trk sumpt " << jet_trk_sumpt << ", trk N " << jet_trk_N << ", PS E " << jet_psE << ", width " << acc_width(*jet) << ", emfrac " << acc_emf(*jet));
941 
942  if(jet_from_muon) {
943  ATH_MSG_VERBOSE("Jet is from muon -- set to EM scale and subtract Eloss.");
944  // Using constjet now because we focus on AntiKt4EMTopo.
945  // Probably not a massive difference to LC, but PF needs some consideration
946  ATH_MSG_VERBOSE("Jet e: " << constjet.E() << ", mu Eloss: " << mu_Eloss);
947  float elosscorr = mu_Eloss >= constjet.e() ? 0. : 1.-mu_Eloss/constjet.e();
948  // Effectively, take the unique fraction of the jet times the eloss-corrected fraction
949  // This might in some cases oversubtract, but should err on the side of undercounting the jet contribution
950  opx *= elosscorr;
951  opy *= elosscorr;
952  ATH_MSG_VERBOSE(" Jet eloss factor " << elosscorr << ", final pt: " << sqrt(opx*opx+opy*opy));
953  // Don't treat this jet normally. Instead, just add to the Eloss term
954  isMuFSRJet = true;
955  }
956  }
957  } // end muon-jet overlap-removal
958 
959  switch(mu_in_jet->energyLossType()) {
960  case xAOD::Muon::Parametrized:
961  case xAOD::Muon::MOP:
962  case xAOD::Muon::Tail:
963  case xAOD::Muon::FSRcandidate:
964  case xAOD::Muon::NotIsolated:
965  // For now don't differentiate the behaviour
966  // Remove the Eloss assuming the parameterised value
967  // The correction is limited to the selected clusters
968  total_eloss += mu_Eloss;
969  muons_selflags |= (1<<assoc->findIndex(mu_in_jet));
970  }
971  }
972  ATH_MSG_VERBOSE("Muon selection flags: " << muons_selflags);
973  ATH_MSG_VERBOSE("Muon total eloss: " << total_eloss);
974 
976  // borrowed from overlapCalVec
977  for(size_t iKey = 0; iKey < assoc->sizeCal(); iKey++) {
978  bool selector = (muons_selflags & assoc->calkey()[iKey]);
979  if(selector) mu_calovec += assoc->calVec(iKey);
980  ATH_MSG_VERBOSE("This key: " << assoc->calkey()[iKey] << ", selector: " << selector);
981  }
982  ATH_MSG_VERBOSE("Mu calovec pt, no Eloss: " << mu_calovec.cpt());
983  if(m_muEloss) mu_calovec *= std::max<float>(0.,1-(total_eloss/mu_calovec.ce()));
984  ATH_MSG_VERBOSE("Mu calovec pt, with Eloss: " << mu_calovec.cpt());
985 
986  // re-add calo components of muons beyond Eloss correction
987  ATH_MSG_VERBOSE("Jet " << jet->index() << " const pT before OR " << jpt);
988  ATH_MSG_VERBOSE("Jet " << jet->index() << " const pT after OR " << sqrt(opx*opx+opy*opy));
989  opx += mu_calovec.cpx();
990  opy += mu_calovec.cpy();
991  double opt = sqrt( opx*opx+opy*opy );
992  ATH_MSG_VERBOSE("Jet " << jet->index() << " const pT diff after OR readding muon clusters " << opt-jpt);
993  double uniquefrac = 1. - (calvec.ce() - mu_calovec.ce()) / constjet.E();
994  ATH_MSG_VERBOSE( "Jet constscale px, py, pt, E = " << jpx << ", " << jpy << ", " << jpt << ", " << constjet.E() );
995  ATH_MSG_VERBOSE( "Jet overlap E = " << calvec.ce() - mu_calovec.ce() );
996  ATH_MSG_VERBOSE( "Jet OR px, py, pt, E = " << opx << ", " << opy << ", " << opt << ", " << constjet.E() - calvec.ce() );
997 
998  if(isMuFSRJet) {
999 
1000  if(met_muonEloss) {
1001  met_muonEloss->add(opx,opy,opt);
1002  } else {
1003  ATH_MSG_WARNING("Attempted to apply muon Eloss correction, but corresponding MET term does not exist!");
1004  return StatusCode::FAILURE;
1005  }
1006  } else {
1007  if(selected && !JVT_reject) {
1008  if(!caloverlap) {
1009  // add jet full four-vector
1010  hardJet = true;
1011  if (!tracksForHardJets) {
1012  if(m_doConstJet) {
1013  metJet->add(jpx,jpy,jpt);
1014  } else {*metJet += jet;}
1015  }
1016  } else {
1017  // check unique fraction
1018  if((uniquefrac>m_jetMinEfrac || passJetForEl) && opt>m_jetMinWeightedPt) {
1019  // add jet corrected for overlaps
1020  hardJet = true;
1021  if(!tracksForHardJets) {
1022  if(m_jetCorrectPhi) {
1023  if (m_doConstJet) metJet->add(opx,opy,opt);
1024  else {
1025  double jesF = jet->pt() / jpt;
1026  metJet->add(opx*jesF,opy*jesF,opt*jesF);
1027  }
1028  } else {
1029  if (m_doConstJet){
1030  metJet->add(uniquefrac*jpx,uniquefrac*jpy,uniquefrac*jpt);
1031  }
1032  else{
1033  if(passJetForEl){
1034  if(m_doRemoveElecTrksEM) metJet->add(opx,opy,opt);
1035  else metJet->add(uniquefrac*jet->px(),uniquefrac*jet->py(),uniquefrac*jet->pt());
1036  }else{
1037  metJet->add(uniquefrac*jet->px(),uniquefrac*jet->py(),uniquefrac*jet->pt());
1038  }
1039  }
1040  }
1041  }
1042  }
1043  }
1044  } // hard jet selection
1045 
1046  // Create the appropriate ElementLink for this jet just the once.
1047  iplink_t jetLink;
1048  if(jetsSgKey == 0) {
1049  const xAOD::IParticleContainer* ipc =
1050  static_cast<const xAOD::IParticleContainer*>(jet->container());
1051  jetLink = iplink_t(*ipc, jet->index());
1052  } else {
1053  jetLink = iplink_t(jetsSgKey, jet->index());
1054  }
1055 
1056  if(hardJet){
1057  ATH_MSG_VERBOSE("Jet added at full scale");
1058  uniqueLinks.push_back( jetLink );
1059  uniqueWeights.push_back( uniquefrac );
1060  } else {
1061  if(metSoftClus && !JVT_reject) {
1062  // add fractional contribution
1063  ATH_MSG_VERBOSE("Jet added at const scale");
1064  if (std::abs(jet->eta())<2.5 || !(coreSoftClus->source()&MissingETBase::Source::Region::Central)) {
1065  softJetLinks.push_back( jetLink );
1066  softJetWeights.push_back( uniquefrac );
1067  metSoftClus->add(opx,opy,opt);
1068  }
1069 
1070  // Fill a vector with the soft constituents, if one was provided.
1071  // For now, only setting up to work with those corresponding to the jet constituents.
1072  // Can expand if needed.
1073  // This ignores overlap removal.
1074  //
1075  if(softConst) {
1076  for(size_t iConst=0; iConst<jet->numConstituents(); ++iConst) {
1077  const IParticle* constit = jet->rawConstituent(iConst);
1078  softConst->push_back(constit);
1079  }
1080  }
1081  }
1082  } // hard jet or CST
1083 
1084  if(metSoftTrk && (!hardJet || tracksForHardJets)) {
1085  // use jet tracks
1086  // remove any tracks already used by other objects
1088  MissingETBase::Types::constvec_t jettrkvec = assoc->jetTrkVec();
1089  if(jettrkvec.ce()>1e-9) {
1090  jpx = jettrkvec.cpx();
1091  jpy = jettrkvec.cpy();
1092  jpt = jettrkvec.sumpt();
1093  jettrkvec -= trkvec;
1094  opx = jettrkvec.cpx();
1095  opy = jettrkvec.cpy();
1096  opt = jettrkvec.sumpt();
1097  ATH_MSG_VERBOSE( "Jet track px, py, sumpt = " << jpx << ", " << jpy << ", " << jpt );
1098  ATH_MSG_VERBOSE( "Jet OR px, py, sumpt = " << opx << ", " << opy << ", " << opt );
1099  } else {
1100  opx = opy = opt = 0;
1101  ATH_MSG_VERBOSE( "This jet has no associated tracks" );
1102  }
1103  if (hardJet) metJet->add(opx,opy,opt);
1104  // use nominal calibrated jets instead
1105  else if (std::abs(nominal_jet->eta())<2.5 || !(coreSoftTrk->source()&MissingETBase::Source::Region::Central)) {
1106  metSoftTrk->add(opx,opy,opt);
1107  // Don't need to add if already done for softclus.
1108  if(!metSoftClus) {
1109  softJetLinks.push_back( jetLink );
1110  softJetWeights.push_back( uniquefrac );
1111  }
1112 
1113  // Fill a vector with the soft constituents, if one was provided.
1114  // For now, only setting up to work with those corresponding to the jet constituents.
1115  // Can expand if needed.
1116  // This ignores overlap removal.
1117  //
1118  if(softConst && !m_doPFlow && !m_doSoftTruth) {
1119  std::vector<const IParticle*> jettracks;
1120  jet->getAssociatedObjects<IParticle>(xAOD::JetAttribute::GhostTrack,jettracks);
1121  for(size_t iConst=0; iConst<jettracks.size(); ++iConst) {
1122  const TrackParticle* pTrk = static_cast<const TrackParticle*>(jettracks[iConst]);
1123  if (acceptTrack(pTrk,pv)) softConst->push_back(pTrk);
1124  }
1125  }
1126  }
1127  } // soft track
1128 
1129  } // is not from muon FSR
1130  } // association exists
1131  else {
1132  ATH_MSG_WARNING( "Jet without association found!" );
1133  }
1134  } // jet loop
1135 
1136  ATH_MSG_DEBUG("Number of selected jets: " << dec_constitObjLinks(*metJet).size());
1137 
1138  if(metSoftTrk) {
1139  dec_constitObjLinks(*metSoftTrk) = softJetLinks;
1140  ATH_MSG_DEBUG("Number of softtrk jets: " << dec_constitObjLinks(*metSoftTrk).size());
1141  }
1142 
1143  if(metSoftClus) {
1144  dec_constitObjLinks(*metSoftClus) = softJetLinks;
1145  ATH_MSG_DEBUG("Number of softclus jets: " << dec_constitObjLinks(*metSoftClus).size());
1146  }
1147 
1148  if(softConst) ATH_MSG_DEBUG(softConst->size() << " soft constituents from core term + jets");
1149 
1150  if(metSoftTrk) {
1151  // supplement track term with any tracks associated to isolated muons
1152  // these are recorded in the misc association
1153  const MissingETAssociation* assoc = map->getMiscAssociation();
1154  if(assoc) {
1156  double opx = trkvec.cpx();
1157  double opy = trkvec.cpy();
1158  double osumpt = trkvec.sumpt();
1159  ATH_MSG_VERBOSE( "Misc track px, py, sumpt = " << opx << ", " << opy << ", " << osumpt );
1160  metSoftTrk->add(opx,opy,osumpt);
1161  ATH_MSG_VERBOSE("Final soft track mpx " << metSoftTrk->mpx()
1162  << ", mpy " << metSoftTrk->mpy()
1163  << " sumet " << metSoftTrk->sumet());
1164  }
1165  }
1166 
1167  if(metSoftClus) {
1168  // supplement cluster term with any clusters associated to isolated e/gamma
1169  // these are recorded in the misc association
1170  const MissingETAssociation* assoc = map->getMiscAssociation();
1171  if(assoc) {
1172  float total_eloss(0.);
1173  MissingETBase::Types::bitmask_t muons_selflags(0);
1175  double opx = calvec.cpx();
1176  double opy = calvec.cpy();
1177  double osumpt = calvec.sumpt();
1178  for(const auto& obj : assoc->objects()) {
1179  if (!obj) continue;
1180  if(obj->type()==xAOD::Type::Muon) {
1181  const xAOD::Muon* mu_test(static_cast<const xAOD::Muon*>(obj));
1182  if(acc_originalObject.isAvailable(*mu_test)) mu_test = static_cast<const xAOD::Muon*>(*acc_originalObject(*mu_test));
1183  if(MissingETComposition::objSelected(helper,mu_test)) { //
1184  float mu_Eloss = acc_Eloss(*mu_test);
1185  switch(mu_test->energyLossType()) {
1186  case xAOD::Muon::Parametrized:
1187  case xAOD::Muon::MOP:
1188  case xAOD::Muon::Tail:
1189  case xAOD::Muon::FSRcandidate:
1190  case xAOD::Muon::NotIsolated:
1191  // For now don't differentiate the behaviour
1192  // Remove the Eloss assuming the parameterised value
1193  // The correction is limited to the selected clusters
1194  total_eloss += mu_Eloss;
1195  muons_selflags |= (1<<assoc->findIndex(mu_test));
1196  }
1197  ATH_MSG_VERBOSE("Mu index " << mu_test->index());
1198  }
1199  }
1200  }
1201  ATH_MSG_VERBOSE("Mu selection flags " << muons_selflags);
1202  ATH_MSG_VERBOSE("Mu total eloss " << total_eloss);
1203 
1205  // borrowed from overlapCalVec
1206  for(size_t iKey = 0; iKey < assoc->sizeCal(); iKey++) {
1207  bool selector = (muons_selflags & assoc->calkey()[iKey]);
1208  ATH_MSG_VERBOSE("This key: " << assoc->calkey()[iKey] << ", selector: " << selector
1209  << " this calvec E: " << assoc->calVec(iKey).ce());
1210  if(selector) mu_calovec += assoc->calVec(iKey);
1211  }
1212  if(m_muEloss){
1213  mu_calovec *= std::max<float>(0.,1-(total_eloss/mu_calovec.ce()));
1214  opx += mu_calovec.cpx();
1215  opy += mu_calovec.cpy();
1216  osumpt += mu_calovec.sumpt();
1217  }
1218  ATH_MSG_VERBOSE("Mu cluster sumpt " << mu_calovec.sumpt());
1219 
1220  ATH_MSG_VERBOSE( "Misc cluster px, py, sumpt = " << opx << ", " << opy << ", " << osumpt );
1221  metSoftClus->add(opx,opy,osumpt);
1222  ATH_MSG_VERBOSE("Final soft cluster mpx " << metSoftClus->mpx()
1223  << ", mpy " << metSoftClus->mpy()
1224  << " sumet " << metSoftClus->sumet());
1225  }
1226  }
1227 
1228  return StatusCode::SUCCESS;
1229  }
1230 
1232  const xAOD::JetContainer* jets,
1234  xAOD::MissingET* metSoftTrk,
1235  const xAOD::MissingET* coreSoftTrk,
1236  bool doJetJVT) {
1237  return rebuildJetMET(metJet,jets,helper,nullptr,nullptr,metSoftTrk,coreSoftTrk,doJetJVT,true);
1238  }
1239 
1240  // **** Remove objects and any overlaps from MET calculation ****
1241 
1244  xAOD::MissingETContainer* metCont)
1245  {
1246 
1247  MissingET* met = nullptr;
1248  if( fillMET(met,metCont, "Invisibles" , invisSource) != StatusCode::SUCCESS) {
1249  ATH_MSG_ERROR("failed to fill MET term \"Invisibles\"");
1250  return StatusCode::FAILURE;
1251  }
1252 
1254  }
1255 
1256 
1257 
1258  // Retrieve non overlapping constituents
1260 
1261  // Fill OverlapRemovedCHSParticleFlowObjects
1262  // and OverlapRemovedCHSCharged/NeutralParticleFlowObjects
1265  xAOD::PFOContainer *OR_cpfos,
1266  xAOD::PFOContainer *OR_npfos,
1267  bool retainMuon,
1268  const xAOD::IParticleContainer* muonCollection)//,
1269  //MissingETBase::UsageHandler::Policy p); //
1270  {
1271 
1272  const xAOD::PFOContainer *OR_cpfos_tmp = retrieveOverlapRemovedConstituents(cpfo, metHelper,retainMuon,muonCollection);
1273  const xAOD::PFOContainer *OR_npfos_tmp = retrieveOverlapRemovedConstituents(npfo, metHelper,retainMuon,muonCollection);
1274 
1275  for (auto tmp_constit : static_cast<xAOD::PFOContainer>(*cpfo)){
1276  xAOD::PFO* constit=new xAOD::PFO();
1277  OR_cpfos->push_back(constit);
1278  *constit=*tmp_constit;
1279 
1280  bool keep=false;
1281  for (const auto *const ORconstit : *OR_cpfos_tmp){
1282  if (ORconstit->index()==tmp_constit->index() && ORconstit->charge()==tmp_constit->charge()) {keep=true;}
1283  }
1284  if (!keep){constit->setP4(0., 0., 0., 0.);}
1285 
1286  ATH_MSG_VERBOSE("Constituent with index " << tmp_constit->index() << ", charge " << tmp_constit->charge()<< " pT " << tmp_constit->pt() << ((keep==true) ? "" : " not ") <<" in OverlapRemovedCHSParticleFlowObjects");
1287  } // end cPFO loop
1288 
1289  for (auto tmp_constit : static_cast<xAOD::PFOContainer>(*npfo)){
1290  xAOD::PFO* constit=new xAOD::PFO();
1291  OR_npfos->push_back(constit);
1292  *constit=*tmp_constit;
1293 
1294  bool keep=false;
1295  for (const auto *const ORconstit : *OR_npfos_tmp){
1296  if (ORconstit->index()==tmp_constit->index() && ORconstit->charge()==tmp_constit->charge()) {keep=true;}
1297  }
1298  if (!keep){ constit->setP4(0., 0., 0., 0.); }
1299 
1300  ATH_MSG_VERBOSE("Constituent with index " << tmp_constit->index() << ", charge " << tmp_constit->charge()<< " pT " << tmp_constit->pt() << ((keep==true) ? "" : " not ") <<" in OverlapRemovedCHSParticleFlowObjects");
1301  } // end nPFO loop/
1302 
1303 
1304 
1305  return StatusCode::SUCCESS;
1306  }
1307 
1308  // Fill OverlapRemovedCHSParticleFlowObjects
1311  const xAOD::PFOContainer **OR_pfos,
1312  bool retainMuon,
1313  const xAOD::IParticleContainer* muonCollection)//,
1314  //MissingETBase::UsageHandler::Policy p); //
1315  {
1316  *OR_pfos=retrieveOverlapRemovedConstituents(pfo,metHelper,retainMuon,muonCollection);
1317  return StatusCode::SUCCESS;
1318  }
1319 
1320 
1322  {
1323 
1325  const xAOD::MissingETAssociationMap* map = helper.map();
1326 
1327 
1328  // If muon is selected, flag it as non selected to retain its constituents in OR jets (to recover std. muon-jet overlap)
1329  std::vector<size_t> muon_index;
1330  if (retainMuon){
1331  bool originalInputs = !acc_originalObject.isAvailable(*muonCollection->front());
1332 
1333  for(const auto *const obj : *muonCollection) {
1334  const IParticle* orig = obj;
1335  if(!originalInputs) { orig = *acc_originalObject(*obj); }
1336  std::vector<const xAOD::MissingETAssociation*> assocs = xAOD::MissingETComposition::getAssociations(map,orig);
1337  if(assocs.empty()) {
1338  ATH_MSG_WARNING("Object is not in association map. Did you make a deep copy but fail to set the \"originalObjectLinks\" decoration?");
1339  ATH_MSG_WARNING("If not, Please apply xAOD::setOriginalObjectLinks() from xAODBase/IParticleHelpers.h");
1340  }
1342  ATH_MSG_DEBUG("Muon with index "<<orig->index() << " is selected. Flag it as non selected before getOverlapRemovedSignals");
1343  muon_index.push_back(orig->index());
1344  for(size_t i = 0; i < assocs.size(); i++) helper.setObjSelectionFlag(assocs[i],orig,false);
1345  }
1346  }
1347 
1348  /*ATH_MSG_VERBOSE("Check selected muons before getOverlapRemovedSignals");
1349  for(const auto& obj : *muonCollection) {
1350  const IParticle* orig = obj;
1351  if(!originalInputs) { orig = *acc_originalObject(*obj); }
1352  ATH_MSG_VERBOSE("Muon with index "<<orig->index() << " is " << (MissingETComposition::objSelected(helper,orig) ? "" : "non-") << "selected" );
1353  }*/
1354  } // end retainMuon
1355 
1356  const xAOD::PFOContainer* ORsignals =static_cast<const xAOD::PFOContainer*>(map->getOverlapRemovedSignals(helper,signals,p));
1357 
1358  /*for (const auto tmp_const : *signals){ // printout overlap removed constituents
1359  bool keep=false;
1360  for (const auto constit : *ORsignals){
1361  if (constit->index()==tmp_const->index() && constit->charge()==tmp_const->charge()){keep=true;}
1362  }
1363  if (keep==false){ANA_MSG_DEBUG("Retrieve OR constituents: DON'T keep " << tmp_const->index() << " with charge " << tmp_const->charge() << " and pt "<<tmp_const->pt());}
1364  }*/
1365 
1366  // Flag back muons as selected
1367  if (retainMuon && !muon_index.empty()){
1368  bool originalInputs = !acc_originalObject.isAvailable(*muonCollection->front());
1369  for(const auto *const obj : *muonCollection) {
1370  const IParticle* orig = obj;
1371  if(!originalInputs) { orig = *acc_originalObject(*obj); }
1372  std::vector<const xAOD::MissingETAssociation*> assocs = xAOD::MissingETComposition::getAssociations(map,orig);
1373  for (size_t ind=0; ind<muon_index.size();ind++){
1374  if(orig->index()==muon_index.at(ind)) {
1375  for(size_t i = 0; i < assocs.size(); i++) helper.setObjSelectionFlag(assocs[i],orig,true);
1376  }
1377  }
1378  }
1379  /*ATH_MSG_VERBOSE("Check selected muons after getOverlapRemovedSignals");
1380  for(const auto& obj : *muonCollection) {
1381  const IParticle* orig = obj;
1382  if(!originalInputs) { orig = *acc_originalObject(*obj); }
1383  ATH_MSG_VERBOSE("Muon with index "<<orig->index() << " is selected?" << MissingETComposition::objSelected(helper,orig));
1384  }*/
1385  }
1386 
1387  return ORsignals;
1388  }
1389 
1390 
1391  // Accept Track
1393  bool METMaker::acceptTrack(const xAOD::TrackParticle* trk, const xAOD::Vertex* vx) const
1394  {
1395  return static_cast<bool>(m_trkseltool->accept( *trk, vx ));
1396  }
1397 
1399 
1400  const xAOD::Vertex *pv = nullptr;
1401 
1403 
1404  if (!h_PV.isValid()) {
1405 
1406  ATH_MSG_WARNING("Unable to retrieve primary vertex container PrimaryVertices");
1407 
1408  } else if(h_PV->empty()) {
1409 
1410  ATH_MSG_WARNING("Event has no primary vertices!");
1411 
1412  } else {
1413 
1414  ATH_MSG_DEBUG("Successfully retrieved primary vertex container");
1415 
1416  for(const auto *const vx : *h_PV) {
1417 
1418  if(vx->vertexType()==xAOD::VxType::PriVtx) {
1419 
1420  pv = vx; break;
1421 
1422  }
1423 
1424  }
1425 
1426  }
1427 
1428  return pv;
1429 
1430  }
1431 
1432 
1433 } //> end namespace met
ShallowCopy.h
met::METMaker::m_muEloss
bool m_muEloss
Definition: METMaker.h:218
met::METMaker::m_jetTrkNMuOlap
int m_jetTrkNMuOlap
Definition: METMaker.h:224
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
met::METMaker::m_skipSystematicJetSelection
bool m_skipSystematicJetSelection
Definition: METMaker.h:216
MissingETBase::Source::muon
static Types::bitmask_t muon(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed muons.
Definition: MissingETBase.h:250
met::METMaker::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) override final
Definition: METMaker.cxx:564
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
xAOD::MissingETAuxContainer
MissingETAuxContainer_v1 MissingETAuxContainer
Definition: MissingETAuxContainer.h:16
MissingETBase::UsageHandler::PhysicsObject
@ PhysicsObject
Physics object based.
Definition: MissingETCompositionBase.h:187
met::METMaker::m_customFwdJetPtCut
double m_customFwdJetPtCut
Definition: METMaker.h:203
MissingETBase::UsageHandler::TruthParticle
@ TruthParticle
Truth particle based.
Definition: MissingETCompositionBase.h:189
xAOD::MissingETAssociation_v1::overlapCalVec
ConstVec overlapCalVec(const MissingETAssociationHelper &helper) const
Retrieve total cluster-based vector to be subtracted from the jet.
Definition: MissingETAssociation_v1.cxx:772
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
met::METMaker::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) override final
Definition: METMaker.cxx:527
met::METMaker::m_jetPsEMuOlap
double m_jetPsEMuOlap
Definition: METMaker.h:226
met::METMaker::m_JvtPtMax
double m_JvtPtMax
Definition: METMaker.h:190
met::METMaker::m_missObjWarningPtThreshold
float m_missObjWarningPtThreshold
Definition: METMaker.h:180
ObjectType
ObjectType
Definition: BaseObject.h:11
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
xAOD::MissingETAssociation_v1
MET association descriptor contains object links and corresponding parameters.
Definition: MissingETAssociation_v1.h:29
met::METMaker::m_acc_jetJvtMoment
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_acc_jetJvtMoment
Definition: METMaker.h:176
xAOD::MissingET_v1::sumet
float sumet() const
Returns.
met::METMaker::m_doSetMuonJetEMScale
bool m_doSetMuonJetEMScale
Definition: METMaker.h:215
xAOD::MissingETAssociationMap_v1::getOverlapRemovedSignals
const IParticleContainer * getOverlapRemovedSignals(const MissingETAssociationHelper &helper, const IParticleContainer *signals, MissingETBase::UsageHandler::Policy p=MissingETBase::UsageHandler::TrackCluster) const
Extract a container of constituents that do not overlap physics objects.
Definition: MissingETAssociationMap_v1.cxx:269
met::METMaker::m_doPFlow
bool m_doPFlow
Definition: METMaker.h:207
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::MissingETAssociation_v1::hasAlternateConstVec
bool hasAlternateConstVec() const
Definition: MissingETAssociation_v1.cxx:754
met::METMaker::m_jetConstitScaleMom
std::string m_jetConstitScaleMom
Definition: METMaker.h:185
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
met::METMaker::m_jetCorrectPhi
bool m_jetCorrectPhi
Definition: METMaker.h:182
met::METMaker::initialize
virtual StatusCode initialize() override final
Dummy implementation of the initialisation function.
Definition: METMaker.cxx:172
AuxContainerBase.h
met::METMaker::m_jetSelection
std::string m_jetSelection
Definition: METMaker.h:194
xAOD::MissingETComposition::objSelected
static bool objSelected(const MissingETAssociationHelper &helper, const IParticle *obj)
Definition: Event/xAOD/xAODMissingET/Root/MissingETComposition.cxx:375
JetAttributes.h
xAOD::ShallowAuxContainer
Class creating a shallow copy of an existing auxiliary container.
Definition: ShallowAuxContainer.h:54
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::METMaker::m_CenJetPtCut
double m_CenJetPtCut
Definition: METMaker.h:189
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.
met::METMaker::m_JetEtaForw
double m_JetEtaForw
Definition: METMaker.h:192
MissingETBase::Source::Region::Central
@ Central
Indicator for MET contribution from the central region.
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::METMaker::m_jetEmfMuOlap
double m_jetEmfMuOlap
Definition: METMaker.h:227
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
met::METMaker::m_FwdJetPtCut
double m_FwdJetPtCut
Definition: METMaker.h:189
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MissingETBase::Types::bitmask_t
uint64_t bitmask_t
Type for status word bit mask.
Definition: MissingETBase.h:39
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:40
MissingETBase::Source::isTrackTerm
static bool isTrackTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)
Definition: MissingETBase.h:404
met::METMaker::markInvisible
virtual StatusCode markInvisible(const xAOD::IParticleContainer *collection, xAOD::MissingETAssociationHelper &helper, xAOD::MissingETContainer *metCont) override final
Definition: METMaker.cxx:1242
met::METMaker::m_muIDPTJetPtRatioMuOlap
double m_muIDPTJetPtRatioMuOlap
Definition: METMaker.h:229
ReweightUtils.message
message
Definition: ReweightUtils.py:15
asg::AsgToolConfig::makePrivateTool
::StatusCode makePrivateTool(ToolHandle< T > &toolHandle) const
make a private tool with the given configuration
met::METMaker::m_customJvtCut
double m_customJvtCut
Definition: METMaker.h:204
met::METMaker::m_customCenJetPtCut
double m_customCenJetPtCut
Definition: METMaker.h:203
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:36
MissingETBase::Source::Type::Muon
@ Muon
Indicator for the MET term from reconstructed or MC truth muons.
xAOD::MissingETAssociationMap_v1
Definition: MissingETAssociationMap_v1.h:29
met::METMaker::~METMaker
virtual ~METMaker()
Destructor:
xAOD::Muon_v1::energyLossType
EnergyLossType energyLossType(void) const
Energy determined from parametrization or not (measured).
met::METMaker::m_doRemoveMuonJets
bool m_doRemoveMuonJets
Definition: METMaker.h:212
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::MissingETAssociation_v1::findIndex
size_t findIndex(const IParticle *pPart) const
Find index of given object in contributing object store.
Definition: MissingETAssociation_v1.cxx:268
met::METMaker::m_JetEtaMax
double m_JetEtaMax
Definition: METMaker.h:191
METHelpers.h
EgammaxAODHelpers.h
met
Definition: IMETSignificance.h:24
xAOD::MissingETComposition::getConstVec
static MissingETBase::Types::constvec_t getConstVec(const MissingETAssociationMap *pMap, const IParticle *pPart, MissingETBase::UsageHandler::Policy p)
Definition: Event/xAOD/xAODMissingET/Root/MissingETComposition.cxx:361
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
asg::AsgTool::getKey
SG::sgkey_t getKey(const void *ptr) const
Get the (hashed) key of an object that is in the event store.
Definition: AsgTool.cxx:119
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
ElectronContainer.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
met::METMaker::m_JvtWP
std::string m_JvtWP
Definition: METMaker.h:195
xAOD::PFO
PFO_v1 PFO
Definition of the current "pfo version".
Definition: PFO.h:17
ReadCalibFromCool.keep
keep
Definition: ReadCalibFromCool.py:85
met::METMaker::m_doSoftTruth
bool m_doSoftTruth
Definition: METMaker.h:208
MissingETBase::Source::jet
static Types::bitmask_t jet(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed jets.
Definition: MissingETBase.h:257
met::METMaker::m_jetTrkPtMuPt
double m_jetTrkPtMuPt
Definition: METMaker.h:228
met::METMaker::m_customJvtPtMax
double m_customJvtPtMax
Definition: METMaker.h:204
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector< float >
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
met::METMaker::m_jetMinEfrac
double m_jetMinEfrac
Definition: METMaker.h:183
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
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
met::METMaker::m_useGhostMuons
bool m_useGhostMuons
Definition: METMaker.h:211
DataVector::front
const T * front() const
Access the first element in the collection as an rvalue.
MissingETBase::Source::Category::Calo
@ Calo
Indicator for MET terms reconstructed from calorimeter signals alone.
met::METMaker::m_JvtMediumPtMax
double m_JvtMediumPtMax
Definition: METMaker.h:200
met::METMaker::m_PVkey
SG::ReadHandleKey< xAOD::VertexContainer > m_PVkey
Definition: METMaker.h:172
xAOD::MissingET_v1
Principal data object for Missing ET.
Definition: MissingET_v1.h:25
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
xAOD::MissingET_v1::mpx
float mpx() const
Returns .
met::METMaker::m_customJvtWP
std::string m_customJvtWP
Definition: METMaker.h:205
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
met::METMaker::m_useR21JvtFallback
bool m_useR21JvtFallback
Definition: METMaker.h:196
xAOD::MissingETAssociationMap_v1::getMiscAssociation
const MissingETAssociation_v1 * getMiscAssociation() const
Get an association for miscellaneous objects not associated to jets.
Definition: MissingETAssociationMap_v1.cxx:186
met::METMaker::m_doConstJet
bool m_doConstJet
Definition: METMaker.h:209
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
xAOD::MissingET_v1::name
const std::string & name() const
Identifier getters.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
met::METMaker::m_doRemoveElecTrksEM
bool m_doRemoveElecTrksEM
Definition: METMaker.h:214
compute_lumi.denom
denom
Definition: compute_lumi.py:76
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::MissingETAssociation_v1::calVec
ConstVec calVec(const IParticle *pPart) const
Get calo constituent vector for a given object.
Definition: MissingETAssociation_v1.cxx:540
xAOD::MissingETAssociation_v1::jetTrkVec
ConstVec jetTrkVec() const
Get track constituent vector for the reference jet.
Definition: MissingETAssociation_v1.cxx:570
xAOD::Jet_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: Jet_v1.cxx:49
xAOD::IParticle::pt
virtual double pt() const =0
The transverse momentum ( ) of the particle.
MissingETBase::UsageHandler::Policy
Policy
Policies on usage checks.
Definition: MissingETCompositionBase.h:182
xAOD::MissingET_v1::add
void add(const IParticle *particle)
Add particle kinematics to MET.
Definition: MissingET_v1.cxx:77
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
xAOD::MissingETContainer_v1
Container for xAOD::MissingET_v1 objects.
Definition: MissingETContainer_v1.h:21
xAOD::MissingETAssociationMap
MissingETAssociationMap_v1 MissingETAssociationMap
Version control by type defintion.
Definition: MissingETAssociationMap.h:16
xAOD::PFO_v1
Class describing a particle flow object.
Definition: PFO_v1.h:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
MissingETBase::Source::tau
static Types::bitmask_t tau(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed tau leptons.
Definition: MissingETBase.h:243
pmontree.opt
opt
Definition: pmontree.py:16
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
ReadHandle.h
Handle class for reading from StoreGate.
MissingETBase::UsageHandler::OnlyTrack
@ OnlyTrack
Track based only.
Definition: MissingETCompositionBase.h:185
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAOD::MissingET_v1::source
MissingETBase::Types::bitmask_t source() const
MET object source tag.
xAOD::MissingETComposition::getAssociation
static const MissingETAssociation * getAssociation(const MissingETAssociationMap *pMap, const Jet *pJet)
Definition: Event/xAOD/xAODMissingET/Root/MissingETComposition.cxx:415
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
met::METMaker::m_acc_jetRejectionDec
std::unique_ptr< SG::AuxElement::ConstAccessor< char > > m_acc_jetRejectionDec
Definition: METMaker.h:177
xAOD::MissingETAssociationHelper
Definition: MissingETAssociationHelper.h:26
met::METMaker::m_JvtTightPtMax
double m_JvtTightPtMax
Definition: METMaker.h:199
xAOD::Electron_v1
Definition: Electron_v1.h:34
met::METMaker::m_jetMinWeightedPt
double m_jetMinWeightedPt
Definition: METMaker.h:184
met::METMaker::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) override final
Definition: METMaker.cxx:249
xAOD::MissingETAssociation_v1::overlapTrkVec
ConstVec overlapTrkVec(const MissingETAssociationHelper &helper) const
Retrieve total track-based vector to be subtracted from the jet.
Definition: MissingETAssociation_v1.cxx:782
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::METMaker::m_doRemoveElecTrks
bool m_doRemoveElecTrks
Definition: METMaker.h:213
Muon
struct TBPatternUnitContext Muon
METMaker.h
TrackParticle.h
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
met::METMaker::m_JvtCutMedium
double m_JvtCutMedium
Definition: METMaker.h:200
xAOD::PFO_v1::setP4
void setP4(const FourMom_t &vec)
set the 4-vec
Definition: PFO_v1.cxx:107
met::METMaker::m_jetWidthMuOlap
double m_jetWidthMuOlap
Definition: METMaker.h:225
DeMoScan.index
string index
Definition: DeMoScan.py:362
VertexContainer.h
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
python.selector.AtlRunQuerySelectorLhcOlc.selector
selector
Definition: AtlRunQuerySelectorLhcOlc.py:611
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
xAOD::MissingETAssociation_v1::calkey
const std::vector< MissingETBase::Types::bitmask_t > & calkey() const
Get the vector of cal keys.
xAOD::MissingETAssociation_v1::isMisc
bool isMisc() const
Check if this association is a miscellaneous association.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
met::METMaker::getPV
const xAOD::Vertex * getPV() const
Definition: METMaker.cxx:1398
xAOD::MissingETAssociation_v1::ConstVec::cpt
float cpt() const
Returns .
Definition: MissingETAssociation_v1.cxx:87
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
met::METMaker::acceptTrack
bool acceptTrack(const xAOD::TrackParticle *trk, const xAOD::Vertex *vx) const
Definition: METMaker.cxx:1393
asg::AsgComponentConfig::setProperty
StatusCode setProperty(const std::string &name, const T &value)
set the given property
python.changerun.pv
pv
Definition: changerun.py:81
xAOD::Egamma_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: Egamma_v1.cxx:65
DataVector::ownPolicy
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
met::METMaker::m_JvtCutTight
double m_JvtCutTight
Definition: METMaker.h:199
met::METMaker::m_jetJvtMomentName
std::string m_jetJvtMomentName
Definition: METMaker.h:186
xAODType::Tau
@ Tau
The object is a tau (jet)
Definition: ObjectType.h:49
met::METMaker::METMaker
METMaker()
Default constructor:
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.
pickleTool.object
object
Definition: pickleTool.py:30
met::METMaker::m_veryGreedyPhotons
bool m_veryGreedyPhotons
Definition: METMaker.h:221
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
xAOD::JetConstituentVector
A vector of jet constituents at the scale used during jet finding.
Definition: JetConstituentVector.h:117
xAOD::MissingETAssociation_v1::trkVec
ConstVec trkVec(const IParticle *pPart) const
Get track constituent vector for a given object.
Definition: MissingETAssociation_v1.cxx:550
MissingETAssociationMap.h
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition: JetContainer.h:17
met::fillMET
StatusCode fillMET(xAOD::MissingET *&met, xAOD::MissingETContainer *metCont, const std::string &metKey, const MissingETBase::Types::bitmask_t metSource)
Definition: METHelpers.cxx:123
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
SG::AuxElement::container
const SG::AuxVectorData * container() const
Return the container holding this element.
xAOD::MissingETAssociation_v1::ConstVec::cpx
float cpx() const
Returns .
met::METMaker::m_greedyPhotons
bool m_greedyPhotons
Definition: METMaker.h:220
xAOD::MissingET_v1::mpy
float mpy() const
Returns .
xAOD::JetAttribute::GhostTrack
@ GhostTrack
Definition: JetAttributes.h:252
python.PyAthena.obj
obj
Definition: PyAthena.py:135
met::METMaker::retrieveOverlapRemovedConstituents
virtual StatusCode retrieveOverlapRemovedConstituents(const xAOD::PFOContainer *cpfo, const xAOD::PFOContainer *npfo, xAOD::MissingETAssociationHelper &metHelper, xAOD::PFOContainer *OR_cpfos, xAOD::PFOContainer *OR_npfos, bool retainMuon=false, const xAOD::IParticleContainer *muonCollection=0) override final
Definition: METMaker.cxx:1263
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
xAOD::Jet_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition: Jet_v1.cxx:44
xAOD::MissingETComposition::selectIfNoOverlaps
static bool selectIfNoOverlaps(MissingETAssociationHelper &helper, const IParticle *obj, MissingETBase::UsageHandler::Policy p)
Definition: Event/xAOD/xAODMissingET/Root/MissingETComposition.cxx:382
met::METMaker::m_JvtTool
ToolHandle< IAsgSelectionTool > m_JvtTool
Definition: METMaker.h:232
MissingETAssociationHelper.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
MissingETComposition.h
MissingETContainer.h
xAOD::MissingETAssociation_v1::ConstVec::ce
float ce() const
Returns .
met::METMaker::m_orCaloTaggedMuon
bool m_orCaloTaggedMuon
Definition: METMaker.h:219
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition: Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::MissingETAssociation_v1::objects
std::vector< const IParticle * > objects() const
Access contributing objects.
Definition: MissingETAssociation_v1.cxx:505
met::METMaker::m_jetRejectionDec
std::string m_jetRejectionDec
Definition: METMaker.h:187
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
xAOD::MissingETAssociation_v1::getAlternateConstVec
xAOD::JetFourMom_t getAlternateConstVec() const
Definition: MissingETAssociation_v1.cxx:759
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
AuxElement.h
Base class for elements of a container that can have aux data.
xAOD::MissingETComposition::getAssociations
static std::vector< const MissingETAssociation * > getAssociations(const MissingETAssociationMap *pMap, const IParticle *pPart)
Access non-modifiable contribution object.
Definition: Event/xAOD/xAODMissingET/Root/MissingETComposition.cxx:391
xAOD::Muon_v1::muonType
MuonType muonType() const
met::METMaker::m_trkseltool
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkseltool
Definition: METMaker.h:231
met::METMaker::m_JvtCut
double m_JvtCut
Definition: METMaker.h:190
met::iplink_t
ElementLink< xAOD::IParticleContainer > iplink_t
Definition: METMaker.cxx:70