ATLAS Offline Software
METNet.h
Go to the documentation of this file.
1 /*
3  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4 */
5 // Author: Bill Balunas <balunas@cern.ch>, based on earlier implementation by M. Leigh
7 
8 #ifndef METUTILITIES_MET_METNET_H
9 #define METUTILITIES_MET_METNET_H
10 
11 // STL includes
12 #include <string>
13 
14 // Asg tool includes
15 #include "AsgTools/AsgTool.h"
16 #include "AsgTools/ToolHandle.h"
19 
20 // EDM includes
23 
24 // METInterface includes
25 #include "METInterface/IMETMaker.h"
26 
27 // Network handler
28 #include "METNetHandler.h"
29 
30 // Forward declarations
31 class IMETMaker;
32 class METNetHandler;
33 
34 namespace met {
35 
42  class METNet final: public asg::AsgTool, virtual public IMETMaker {
43 
44  // This macro defines the constructor with the interface declaration
46 
47  public:
48 
49  METNet( const std::string& name );
50 
51  virtual ~METNet() = default;
52 
53  virtual StatusCode initialize() override;
54 
55  // Adds a collection of objects to the core MET container, must be done for photons, elections and muons.
56  virtual StatusCode rebuildMET( const std::string& metKey,
57  xAOD::Type::ObjectType metType,
58  xAOD::MissingETContainer* metCont,
59  const xAOD::IParticleContainer* collection,
61  MissingETBase::UsageHandler::Policy objScale ) const override;
62 
63  // Adds multiple jet definitions to seperate MET containers and creates the collection of input features for the neural network
64  virtual StatusCode rebuildJetMET( const std::string& metJetKey,
65  const std::string& softTrkKey,
66  xAOD::MissingETContainer* metCont,
67  const xAOD::JetContainer* jets,
68  const xAOD::MissingETContainer* metCoreCont,
70  bool doJetJVT = false) const override;
71 
72  // Uses ONNX runtime to propagate the input features created in rebuildJetMET through the trained network
73  virtual StatusCode evaluateNNMET( const std::string& totalName,
74  xAOD::MissingETContainer* metCont ) const override;
75 
76  // Unsupported method inherited from METMaker. Please do not use.
78  const xAOD::IParticleContainer* collection,
80  MissingETBase::UsageHandler::Policy objScale ) const override;
81 
82  // Unsupported method inherited from METMaker. Please do not use.
84  const xAOD::IParticleContainer* collection,
87  bool removeOverlap,
88  MissingETBase::UsageHandler::Policy objScale ) const override;
89 
90  // Unsupported method inherited from METMaker. Please do not use.
91  virtual StatusCode rebuildJetMET( const std::string& metJetKey,
92  const std::string& softClusKey,
93  const std::string& softTrkKey,
94  xAOD::MissingETContainer* metCont,
95  const xAOD::JetContainer* jets,
96  const xAOD::MissingETContainer* metCoreCont,
98  bool doJetJVT ) const override;
99 
100  // Unsupported method inherited from METMaker. Please do not use.
101  virtual StatusCode rebuildJetMET( xAOD::MissingET* metJet,
102  const xAOD::JetContainer* jets,
104  xAOD::MissingET* metSoftClus,
105  const xAOD::MissingET* coreSoftClus,
106  xAOD::MissingET* metSoftTrk,
107  const xAOD::MissingET* coreSoftTrk,
108  bool doJetJVT,
109  bool tracksForHardJets = false,
110  std::vector<const xAOD::IParticle*>* softConst = 0 ) const override;
111 
112  // Unsupported method inherited from METMaker. Please do not use.
113  virtual StatusCode rebuildTrackMET( const std::string& metJetKey,
114  const std::string& softTrkKey,
115  xAOD::MissingETContainer* metCont,
116  const xAOD::JetContainer* jets,
117  const xAOD::MissingETContainer* metCoreCont,
119  bool doJetJVT ) const override;
120 
121  // Unsupported method inherited from METMaker. Please do not use.
122  virtual StatusCode rebuildTrackMET( xAOD::MissingET* metJet,
123  const xAOD::JetContainer* jets,
125  xAOD::MissingET* metSoftTrk,
126  const xAOD::MissingET* coreSoftTrk,
127  bool doJetJVT ) const override;
128 
129  // Unsupported method inherited from METMaker. Please do not use.
130  virtual StatusCode markInvisible( const xAOD::IParticleContainer* collection,
132  xAOD::MissingETContainer* metCont ) const override;
133 
134  private:
135 
136  Gaudi::Property<std::string> m_netLocation{this, "NetworkFile", "", "Location of NN file to use"};
137 
138  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoKey", "EventInfo", "Event info key"};
139  SG::ReadHandleKey<xAOD::VertexContainer> m_pvContainerKey{this, "PVContainerKey", "PrimaryVertices", "Primary vertex container"};
140 
141  std::unique_ptr<const METNetHandler> m_metNetHandler;
142  // Users do not need to interact with these ToolHandles; they're managed by METNet
143  ToolHandle<IMETMaker> m_metmaker_loose{this, "METMakerLoose", "", "METMaker for Loose WP. Do not configure manually except for expert usage." };
144  ToolHandle<IMETMaker> m_metmaker_tight{this, "METMakerTight", "", "METMaker for Tight WP. Do not configure manually except for expert usage." };
145  ToolHandle<IMETMaker> m_metmaker_tghtr{this, "METMakerTighter", "", "METMaker for Tighter WP. Do not configure manually except for expert usage." };
146  ToolHandle<IMETMaker> m_metmaker_tenac{this, "METMakerTenacious", "", "METMaker for Tenacious WP. Do not configure manually except for expert usage." };
147 
148  StatusCode addMETFinal( const std::string& WP_name, xAOD::MissingETContainer* met_container, std::vector<std::string>& name_vec, std::vector<float>& val_vec ) const;
149  StatusCode addMETTerm( const std::string& WP_name, xAOD::MissingET* met, std::vector<std::string>& name_vec, std::vector<float>& val_vec ) const;
150  StatusCode addInputValue( const std::string& var_name, float value,std::vector<std::string>& name_vec, std::vector<float>& val_vec ) const;
151  StatusCode copyMETContainer( xAOD::MissingETContainer* new_container, const xAOD::MissingETContainer* old_container) const;
152 
153  };
154 
155 }
156 
157 #endif
met::METNet::rebuildJetMET
virtual StatusCode rebuildJetMET(const std::string &metJetKey, const std::string &softTrkKey, xAOD::MissingETContainer *metCont, const xAOD::JetContainer *jets, const xAOD::MissingETContainer *metCoreCont, xAOD::MissingETAssociationHelper &helper, bool doJetJVT=false) const override
Definition: METNet.cxx:359
met::METNet::~METNet
virtual ~METNet()=default
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
ObjectType
ObjectType
Definition: BaseObject.h:11
met::METNet
METNet tool class used to create a missing transverse momentum estimate using a pre-trained neural ne...
Definition: METNet.h:42
CheckAppliedSFs.var_name
var_name
Definition: CheckAppliedSFs.py:241
met::METNet::copyMETContainer
StatusCode copyMETContainer(xAOD::MissingETContainer *new_container, const xAOD::MissingETContainer *old_container) const
Definition: METNet.cxx:305
met::METNet::m_netLocation
Gaudi::Property< std::string > m_netLocation
Definition: METNet.h:136
defineDB.jets
jets
Definition: JetTagCalibration/share/defineDB.py:24
met::METNet::m_metmaker_tghtr
ToolHandle< IMETMaker > m_metmaker_tghtr
Definition: METNet.h:145
athena.value
value
Definition: athena.py:124
IMETMaker.h
SG::ReadHandleKey< xAOD::EventInfo >
met::METNet::markInvisible
virtual StatusCode markInvisible(const xAOD::IParticleContainer *collection, xAOD::MissingETAssociationHelper &helper, xAOD::MissingETContainer *metCont) const override
Definition: METNet.cxx:416
met::METNet::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: METNet.h:138
met::METNet::m_metmaker_tight
ToolHandle< IMETMaker > m_metmaker_tight
Definition: METNet.h:144
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:115
met::METNet::m_pvContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_pvContainerKey
Definition: METNet.h:139
IMETMaker
Definition: IMETMaker.h:28
met::METNet::m_metNetHandler
std::unique_ptr< const METNetHandler > m_metNetHandler
Definition: METNet.h:141
met
Definition: IMETSignificance.h:24
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
met::METNet::rebuildTrackMET
virtual StatusCode rebuildTrackMET(const std::string &metJetKey, const std::string &softTrkKey, xAOD::MissingETContainer *metCont, const xAOD::JetContainer *jets, const xAOD::MissingETContainer *metCoreCont, xAOD::MissingETAssociationHelper &helper, bool doJetJVT) const override
Definition: METNet.cxx:394
xAOD::MissingET_v1
Principal data object for Missing ET.
Definition: MissingET_v1.h:25
METNetHandler.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:795
met::METNet::addMETFinal
StatusCode addMETFinal(const std::string &WP_name, xAOD::MissingETContainer *met_container, std::vector< std::string > &name_vec, std::vector< float > &val_vec) const
Definition: METNet.cxx:259
met::METNet::addMETTerm
StatusCode addMETTerm(const std::string &WP_name, xAOD::MissingET *met, std::vector< std::string > &name_vec, std::vector< float > &val_vec) const
Definition: METNet.cxx:272
columnar::final
CM final
Definition: ColumnAccessor.h:106
met::METNet::METNet
METNet(const std::string &name)
Definition: METNet.cxx:42
MissingETBase::UsageHandler::Policy
Policy
Policies on usage checks.
Definition: MissingETCompositionBase.h:182
xAOD::MissingETContainer_v1
Container for xAOD::MissingET_v1 objects.
Definition: MissingETContainer_v1.h:21
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
xAOD::MissingETAssociationHelper
Definition: MissingETAssociationHelper.h:22
met::METNet::m_metmaker_tenac
ToolHandle< IMETMaker > m_metmaker_tenac
Definition: METNet.h:146
EventInfo.h
VertexContainer.h
met::METNet::evaluateNNMET
virtual StatusCode evaluateNNMET(const std::string &totalName, xAOD::MissingETContainer *metCont) const override
Definition: METNet.cxx:223
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
met::METNet::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: METNet.cxx:45
ToolHandle.h
AsgTool.h
met::METNet::addInputValue
StatusCode addInputValue(const std::string &var_name, float value, std::vector< std::string > &name_vec, std::vector< float > &val_vec) const
Definition: METNet.cxx:293
met::METNet::rebuildMET
virtual StatusCode rebuildMET(const std::string &metKey, xAOD::Type::ObjectType metType, xAOD::MissingETContainer *metCont, const xAOD::IParticleContainer *collection, xAOD::MissingETAssociationHelper &helper, MissingETBase::UsageHandler::Policy objScale) const override
Definition: METNet.cxx:99
met::METNet::m_metmaker_loose
ToolHandle< IMETMaker > m_metmaker_loose
Definition: METNet.h:143