ATLAS Offline Software
METAssociator.h
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 // METAssociator.h
8 // Header file for class METAssociator
9 //
10 // This is the base class for tools that construct MET terms
11 // from other object collections.
12 //
13 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
14 //
15 // Author: P Loch, S Resconi, TJ Khoo, AS Mete
17 #ifndef METRECONSTRUCTION_METASSOCIATOR_H
18 #define METRECONSTRUCTION_METASSOCIATOR_H
19 
20 // STL includes
21 #include <string>
22 
23 // FrameWork includes
24 #include "AsgTools/AsgTool.h"
25 #include "AsgTools/ToolHandle.h"
26 
27 // METRecoInterface includes
29 
30 #include "xAODJet/JetContainer.h"
31 #include "xAODMuon/MuonContainer.h"
35 
37 #include "xAODTracking/Vertex.h"
38 #include "xAODPFlow/PFOContainer.h"
39 #include "xAODPFlow/PFO.h"
41 
42 namespace InDet {
43  class IInDetTrackSelectionTool;
44 }
45 
46 namespace xAOD {
47  class ITrackIsolationTool;
48  class ICaloTopoClusterIsolationTool;
49 }
50 
51 namespace met {
53  : virtual public asg::AsgTool,
54  virtual public IMETAssocToolBase
55  {
56 
58  // Public methods:
60  public:
61 
62  struct ConstitHolder {
64  // Use IParticleContainer for flexibility e.g. if combining clusters & towers
68  const xAOD::Vertex* pv = 0;
69  };
70 
71  // Constructor w/ name
72  METAssociator(const std::string& name);
73  // Default Destructor
74  virtual ~METAssociator();
75 
76  // AsgTool Handles
77  virtual StatusCode initialize() override;
78  virtual StatusCode execute (xAOD::MissingETContainer* metCont, xAOD::MissingETAssociationMap* metMap) const override;
79 
81  // Protected methods:
83  protected:
84 
85  ToolHandle<InDet::IInDetTrackSelectionTool> m_trkseltool;
86  ToolHandle<xAOD::ITrackIsolationTool> m_trkIsolationTool;
87  ToolHandle<xAOD::ICaloTopoClusterIsolationTool> m_caloIsolationTool;
88 
89  std::string m_neutralFELinksKey;
90  std::string m_chargedFELinksKey;
91  std::string m_neutralPFOLinksKey;
92  std::string m_chargedPFOLinksKey;
94  bool m_useFELinks;
95 
96  SG::ReadHandleKey<xAOD::VertexContainer> m_pvcollKey{this,"PrimVxColl","PrimaryVertices","Primary Vertex Collection"};
97  SG::ReadHandleKey<xAOD::IParticleContainer> m_clcollKey{this,"ClusColl","CaloCalTopoClusters","Topo cluster Collection"};
98  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trkcollKey{this,"TrkColl","InDetTrackParticles","Track particle Collection"};
99  SG::ReadHandleKey<xAOD::PFOContainer> m_pfcollKey{this,"PFlowColl","","PFO Collection"};
100  SG::ReadHandleKey<xAOD::FlowElementContainer> m_fecollKey{this,"FlowElementCollection","","FlowElement Collection (overrides PFO if not empty)"};
101  SG::ReadHandleKey<xAOD::IParticleContainer> m_hybridContKey{this,"HybridKey","","Hybrid Collection"};
102 
103  //for HR implementation migrated from release 21.2
104  Gaudi::Property<bool> m_recoil{this, "HRecoil", false, ""};
105 
106  bool m_pflow;
109  bool m_useIsolationTools = false;
111  bool m_weight_charged_pfo = false;
113 
115  std::string m_forcoll;
116  double m_foreta;
117 
120 
121 
122 
123  // reconstruction process to be defined in the individual tools
124  // pure virtual -- we have no default
127 
128  bool acceptTrack (const xAOD::TrackParticle* trk, const xAOD::Vertex* pv) const;
129  bool isGoodEoverP(const xAOD::TrackParticle* trk) const;
130 
132  const xAOD::IParticleContainer* hardObjs) const;
134  std::vector<const xAOD::IParticle*>& pfolist,
135  const met::METAssociator::ConstitHolder& constits,
136  std::map<const xAOD::IParticle*,MissingETBase::Types::constvec_t> &momenta) const = 0;
137 
138  //Get UE correction for HR implementation using METMaker
140  std::vector<TLorentzVector>& v_clus,
141  TLorentzVector& clus,
142  TLorentzVector& HR,
143  const float Drcone,
144  const float MinDistCone,
145  float& UEcorr) const;
146 
148  std::vector<const xAOD::IParticle*>& felist,
149  const met::METAssociator::ConstitHolder& constits,
150  std::map<const xAOD::IParticle*,MissingETBase::Types::constvec_t> &momenta) const = 0;
151 
152  //HR implementation dealing with FEs instead of PFOs
153  virtual StatusCode extractFEHR(const xAOD::IParticle* /*obj*/,
154  std::vector<const xAOD::IParticle*> /*hardObjs*/,
155  std::vector<const xAOD::IParticle*>& /*pfolist*/,
156  const met::METAssociator::ConstitHolder& /*constits*/,
157  std::map<const xAOD::IParticle*,MissingETBase::Types::constvec_t> &/*momenta*/,
158  float& /*UEcorr*/) const
159  {return StatusCode::FAILURE;}
160 
162  std::vector<const xAOD::IParticle*>& constlist,
163  const met::METAssociator::ConstitHolder& constits) const = 0;
165  std::vector<const xAOD::IParticle*>& tclist,
166  const met::METAssociator::ConstitHolder& constits) const = 0;
167  static inline bool greaterPt(const xAOD::IParticle* part1, const xAOD::IParticle* part2) {
168  return part1->pt()>part2->pt();
169  }
170  static inline bool greaterPtPFO(const xAOD::PFO* part1, const xAOD::PFO* part2) {
171  if (part1->charge()==0 && part2->charge()!=0) return false;
172  if (part1->charge()!=0 && part2->charge()==0) return true;
173  if (part1->charge()==0 && part2->charge()==0) return part1->ptEM()>part2->ptEM();
174  return part1->pt()>part2->pt();
175  }
176  static inline bool greaterPtFE(const xAOD::FlowElement* part1, const xAOD::FlowElement* part2) {
177  if (!(part1->isCharged()) && part2->isCharged()) return false;
178  if (part1->isCharged() && !(part2->isCharged())) return true;
179  return part1->pt() > part2->pt();
180  }
182  // Private methods:
184  private:
185 
186  // Default Constructor
188  };
189 }
190 
191 #endif // METRECONSTRUCTION_METASSOCBUILDERTOOL_H
met::METAssociator::m_forcoll
std::string m_forcoll
Definition: METAssociator.h:115
met::METAssociator::greaterPt
static bool greaterPt(const xAOD::IParticle *part1, const xAOD::IParticle *part2)
Definition: METAssociator.h:167
met::METAssociator::m_neutralPFOLinksKey
std::string m_neutralPFOLinksKey
Definition: METAssociator.h:91
met::METAssociator::m_useModifiedClus
bool m_useModifiedClus
Definition: METAssociator.h:110
met::METAssociator::m_foreta
double m_foreta
Definition: METAssociator.h:116
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
FlowElementContainer.h
met::METAssociator::extractFE
virtual StatusCode extractFE(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &felist, const met::METAssociator::ConstitHolder &constits, std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > &momenta) const =0
met::METAssociator::m_useFELinks
bool m_useFELinks
Definition: METAssociator.h:94
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
met::METAssociator::m_weight_charged_pfo
bool m_weight_charged_pfo
Definition: METAssociator.h:111
met::METAssociator::m_forTrackPtThr
double m_forTrackPtThr
Definition: METAssociator.h:119
met::METAssociator::retrieveConstituents
StatusCode retrieveConstituents(met::METAssociator::ConstitHolder &constits) const
Definition: METAssociator.cxx:170
met::METAssociator::m_trkcollKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trkcollKey
Definition: METAssociator.h:98
IMETAssocToolBase
Definition: IMETAssocToolBase.h:25
met::METAssociator::m_trkseltool
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkseltool
Definition: METAssociator.h:85
PFOContainer.h
met::METAssociator::m_clcollKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_clcollKey
Definition: METAssociator.h:97
met::METAssociator::ConstitHolder::pfoCont
const xAOD::PFOContainer * pfoCont
Definition: METAssociator.h:66
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
met::METAssociator::ConstitHolder::feCont
const xAOD::FlowElementContainer * feCont
Definition: METAssociator.h:67
met::METAssociator::m_pfcollKey
SG::ReadHandleKey< xAOD::PFOContainer > m_pfcollKey
Definition: METAssociator.h:99
met::METAssociator::m_chargedPFOLinksKey
std::string m_chargedPFOLinksKey
Definition: METAssociator.h:92
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
met::METAssociator::m_useRapidity
bool m_useRapidity
Definition: METAssociator.h:108
met::METAssociator::extractTracks
virtual StatusCode extractTracks(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &constlist, const met::METAssociator::ConstitHolder &constits) const =0
met::METAssociator::m_fecollKey
SG::ReadHandleKey< xAOD::FlowElementContainer > m_fecollKey
Definition: METAssociator.h:100
xAOD::MissingETAssociationMap_v1
Definition: MissingETAssociationMap_v1.h:29
met::METAssociator::METAssociator
METAssociator()
met::METAssociator::m_useTracks
bool m_useTracks
Definition: METAssociator.h:107
met::METAssociator::m_pvcollKey
SG::ReadHandleKey< xAOD::VertexContainer > m_pvcollKey
Definition: METAssociator.h:96
met::METAssociator::m_cenTrackPtThr
double m_cenTrackPtThr
Definition: METAssociator.h:118
met::METAssociator::ConstitHolder::pv
const xAOD::Vertex * pv
Definition: METAssociator.h:68
PFO.h
part1
Definition: part1.py:1
met::METAssociator::ConstitHolder::tcCont
const xAOD::IParticleContainer * tcCont
Definition: METAssociator.h:65
met
Definition: IMETSignificance.h:24
met::METAssociator::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: METAssociator.cxx:95
met::METAssociator::m_trkIsolationTool
ToolHandle< xAOD::ITrackIsolationTool > m_trkIsolationTool
Definition: METAssociator.h:86
ElectronContainer.h
met::METAssociator::m_recoil
Gaudi::Property< bool > m_recoil
Definition: METAssociator.h:104
met::METAssociator::greaterPtPFO
static bool greaterPtPFO(const xAOD::PFO *part1, const xAOD::PFO *part2)
Definition: METAssociator.h:170
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IMETAssocToolBase.h
met::METAssociator::m_neutralFELinksKey
std::string m_neutralFELinksKey
Definition: METAssociator.h:89
met::METAssociator::~METAssociator
virtual ~METAssociator()
met::METAssociator::extractPFO
virtual StatusCode extractPFO(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &pfolist, const met::METAssociator::ConstitHolder &constits, std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > &momenta) const =0
met::METAssociator::m_chargedFELinksKey
std::string m_chargedFELinksKey
Definition: METAssociator.h:90
met::METAssociator::m_useIsolationTools
bool m_useIsolationTools
Definition: METAssociator.h:109
TauJetContainer.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Vertex.h
part2
Definition: part2.py:1
met::METAssociator
Definition: METAssociator.h:55
xAOD::MissingETContainer_v1
Container for xAOD::MissingET_v1 objects.
Definition: MissingETContainer_v1.h:21
xAOD::PFO_v1
Class describing a particle flow object.
Definition: PFO_v1.h:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
met::METAssociator::isGoodEoverP
bool isGoodEoverP(const xAOD::TrackParticle *trk) const
Definition: METAssociator.cxx:384
met::METAssociator::extractFEHR
virtual StatusCode extractFEHR(const xAOD::IParticle *, std::vector< const xAOD::IParticle * >, std::vector< const xAOD::IParticle * > &, const met::METAssociator::ConstitHolder &, std::map< const xAOD::IParticle *, MissingETBase::Types::constvec_t > &, float &) const
Definition: METAssociator.h:153
met::METAssociator::acceptTrack
bool acceptTrack(const xAOD::TrackParticle *trk, const xAOD::Vertex *pv) const
Definition: METAssociator.cxx:376
MuonContainer.h
met::METAssociator::fillAssocMap
virtual StatusCode fillAssocMap(xAOD::MissingETAssociationMap *metMap, const xAOD::IParticleContainer *hardObjs) const
Definition: METAssociator.cxx:304
met::METAssociator::executeTool
virtual StatusCode executeTool(xAOD::MissingETContainer *metCont, xAOD::MissingETAssociationMap *metMap) const =0
met::METAssociator::GetUEcorr
StatusCode GetUEcorr(const met::METAssociator::ConstitHolder &constits, std::vector< TLorentzVector > &v_clus, TLorentzVector &clus, TLorentzVector &HR, const float Drcone, const float MinDistCone, float &UEcorr) const
Definition: METAssociator.cxx:446
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
met::METAssociator::m_hybridContKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_hybridContKey
Definition: METAssociator.h:101
JetContainer.h
met::METAssociator::m_pflow
bool m_pflow
Definition: METAssociator.h:106
python.changerun.pv
pv
Definition: changerun.py:79
met::METAssociator::m_usePFOLinks
bool m_usePFOLinks
Definition: METAssociator.h:93
met::METAssociator::execute
virtual StatusCode execute(xAOD::MissingETContainer *metCont, xAOD::MissingETAssociationMap *metMap) const override
Definition: METAssociator.cxx:150
met::METAssociator::m_skipconst
bool m_skipconst
Definition: METAssociator.h:114
met::METAssociator::ConstitHolder::trkCont
const xAOD::TrackParticleContainer * trkCont
Definition: METAssociator.h:63
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ToolHandle.h
met::METAssociator::greaterPtFE
static bool greaterPtFE(const xAOD::FlowElement *part1, const xAOD::FlowElement *part2)
Definition: METAssociator.h:176
AsgTool.h
python.PyAthena.obj
obj
Definition: PyAthena.py:132
met::METAssociator::m_cleanChargedPFO
bool m_cleanChargedPFO
Definition: METAssociator.h:112
PhotonContainer.h
TrackParticleContainer.h
met::METAssociator::extractTopoClusters
virtual StatusCode extractTopoClusters(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &tclist, const met::METAssociator::ConstitHolder &constits) const =0
met::METAssociator::ConstitHolder
Definition: METAssociator.h:62
met::METAssociator::m_caloIsolationTool
ToolHandle< xAOD::ICaloTopoClusterIsolationTool > m_caloIsolationTool
Definition: METAssociator.h:87
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25