ATLAS Offline Software
Loading...
Searching...
No Matches
met::METNet Class Referencefinal

METNet tool class used to create a missing transverse momentum estimate using a pre-trained neural network. More...

#include <METNet.h>

Inheritance diagram for met::METNet:
Collaboration diagram for met::METNet:

Public Member Functions

 METNet (const std::string &name)
virtual ~METNet ()=default
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
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
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
virtual StatusCode evaluateNNMET (const std::string &totalName, xAOD::MissingETContainer *metCont) const override
virtual StatusCode rebuildMET (xAOD::MissingET *met, const xAOD::IParticleContainer *collection, xAOD::MissingETAssociationHelper &helper, MissingETBase::UsageHandler::Policy objScale) const override
virtual StatusCode rebuildMET (xAOD::MissingET *met, const xAOD::IParticleContainer *collection, xAOD::MissingETAssociationHelper &helper, MissingETBase::UsageHandler::Policy p, bool removeOverlap, MissingETBase::UsageHandler::Policy objScale) const override
virtual StatusCode rebuildJetMET (const std::string &metJetKey, const std::string &softClusKey, const std::string &softTrkKey, xAOD::MissingETContainer *metCont, const xAOD::JetContainer *jets, const xAOD::MissingETContainer *metCoreCont, xAOD::MissingETAssociationHelper &helper, bool doJetJVT) const override
virtual StatusCode rebuildJetMET (xAOD::MissingET *metJet, const xAOD::JetContainer *jets, xAOD::MissingETAssociationHelper &helper, xAOD::MissingET *metSoftClus, const xAOD::MissingET *coreSoftClus, xAOD::MissingET *metSoftTrk, const xAOD::MissingET *coreSoftTrk, bool doJetJVT, bool tracksForHardJets=false, std::vector< const xAOD::IParticle * > *softConst=0) const override
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
virtual StatusCode rebuildTrackMET (xAOD::MissingET *metJet, const xAOD::JetContainer *jets, xAOD::MissingETAssociationHelper &helper, xAOD::MissingET *metSoftTrk, const xAOD::MissingET *coreSoftTrk, bool doJetJVT) const override
virtual StatusCode markInvisible (const xAOD::IParticleContainer *collection, xAOD::MissingETAssociationHelper &helper, xAOD::MissingETContainer *metCont) const override
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode addMETFinal (const std::string &WP_name, xAOD::MissingETContainer *met_container, std::vector< std::string > &name_vec, std::vector< float > &val_vec) const
StatusCode addMETTerm (const std::string &WP_name, xAOD::MissingET *met, std::vector< std::string > &name_vec, std::vector< float > &val_vec) const
StatusCode addInputValue (const std::string &var_name, float value, std::vector< std::string > &name_vec, std::vector< float > &val_vec) const
StatusCode copyMETContainer (xAOD::MissingETContainer *new_container, const xAOD::MissingETContainer *old_container) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< std::string > m_netLocation {this, "NetworkFile", "", "Location of NN file to use"}
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this, "EventInfoKey", "EventInfo", "Event info key"}
SG::ReadHandleKey< xAOD::VertexContainerm_pvContainerKey {this, "PVContainerKey", "PrimaryVertices", "Primary vertex container"}
SG::ReadHandleKey< xAOD::JetContainerm_jetContainerKey {this, "JetContainer", "", "Name of input jet container"}
std::unique_ptr< const METNetHandlerm_metNetHandler
ToolHandle< IMETMakerm_metmaker_loose {this, "METMakerLoose", "", "METMaker for Loose WP. Do not configure manually except for expert usage." }
ToolHandle< IMETMakerm_metmaker_tight {this, "METMakerTight", "", "METMaker for Tight WP. Do not configure manually except for expert usage." }
ToolHandle< IMETMakerm_metmaker_tghtr {this, "METMakerTighter", "", "METMaker for Tighter WP. Do not configure manually except for expert usage." }
ToolHandle< IMETMakerm_metmaker_tenac {this, "METMakerTenacious", "", "METMaker for Tenacious WP. Do not configure manually except for expert usage." }
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

METNet tool class used to create a missing transverse momentum estimate using a pre-trained neural network.

The tool inherits from the same interface as METMaker and so it should be largely interchangable. However, it does not use every public method as METMaker, as it must ensure that the exact variables are constructed for the network's inputs. Uses an ONNX runtime environment for inference.

Definition at line 42 of file METNet.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ METNet()

met::METNet::METNet ( const std::string & name)

Definition at line 42 of file METNet.cxx.

42 :
43 AsgTool(name){}
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58

◆ ~METNet()

virtual met::METNet::~METNet ( )
virtualdefault

Member Function Documentation

◆ addInputValue()

StatusCode met::METNet::addInputValue ( const std::string & var_name,
float value,
std::vector< std::string > & name_vec,
std::vector< float > & val_vec ) const
private

Definition at line 298 of file METNet.cxx.

301 {
302 // This is the only place we push_back to either vector
303 // Ensuring that they are always consistant with each other!!
304 ATH_MSG_VERBOSE( "Adding variable: " << var_name << " = " << value << " to the network input vector" );
305 name_vec.push_back( var_name );
306 val_vec.push_back( value );
307 return StatusCode::SUCCESS;
308 }
#define ATH_MSG_VERBOSE(x)

◆ addMETFinal()

StatusCode met::METNet::addMETFinal ( const std::string & WP_name,
xAOD::MissingETContainer * met_container,
std::vector< std::string > & name_vec,
std::vector< float > & val_vec ) const
private

Definition at line 264 of file METNet.cxx.

267 {
268 // Add the jet, soft, and final terms to the vector
269 ATH_CHECK( addMETTerm( WP_name, (*met_container)["RefJet"], name_vec, val_vec ) );
270 ATH_CHECK( addMETTerm( WP_name, (*met_container)["PVSoftTrk"], name_vec, val_vec ) );
271 ATH_CHECK( addMETTerm( WP_name, (*met_container)["FinalTrk"], name_vec, val_vec ) );
272 ATH_CHECK( addMETTerm( WP_name, (*met_container)["SoftClus"], name_vec, val_vec ) );
273 ATH_CHECK( addMETTerm( WP_name, (*met_container)["FinalClus"], name_vec, val_vec ) );
274 return StatusCode::SUCCESS;
275 }
#define ATH_CHECK
Evaluate an expression and check for errors.
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:277

◆ addMETTerm()

StatusCode met::METNet::addMETTerm ( const std::string & WP_name,
xAOD::MissingET * met,
std::vector< std::string > & name_vec,
std::vector< float > & val_vec ) const
private

Definition at line 277 of file METNet.cxx.

280 {
281
282 if(!met){
283 ATH_MSG_ERROR("addMETTerm was called with a null pointer for the input MET value!");
284 return StatusCode::FAILURE;
285 }
286
287 // Build the name of the term from the WP and the Object type from the container
288 std::string tname = WP_name + "_" + met->name();
289
290 // Add the MET components and SumET
291 ATH_CHECK( addInputValue( tname+"_mpx", met->mpx(), name_vec, val_vec ) );
292 ATH_CHECK( addInputValue( tname+"_mpy", met->mpy(), name_vec, val_vec ) );
293 ATH_CHECK( addInputValue( tname+"_sumet", met->sumet(), name_vec, val_vec ) );
294
295 return StatusCode::SUCCESS;
296 }
#define ATH_MSG_ERROR(x)
StatusCode addInputValue(const std::string &var_name, float value, std::vector< std::string > &name_vec, std::vector< float > &val_vec) const
Definition METNet.cxx:298
float sumet() const
Returns.
const std::string & name() const
Identifier getters.
float mpx() const
Returns .
float mpy() const
Returns .

◆ copyMETContainer()

StatusCode met::METNet::copyMETContainer ( xAOD::MissingETContainer * new_container,
const xAOD::MissingETContainer * old_container ) const
private

Definition at line 310 of file METNet.cxx.

311 {
312 xAOD::MissingET* blank_met;
313
314 for ( const xAOD::MissingET* old_met : *old_container ) {
315 blank_met = nullptr;
316 const std::string& name = old_met->name();
317
318 ATH_CHECK( fillMET( blank_met, new_container, name, old_met->source() ) ); // Initialize the blank met with the new name in the new container
319 *(*new_container)[name] = *(*old_container)[name]; // Copy over the contents of this "term" from old container to new
320
321 // Also need to copy the original object links
322 dec_constitObjLinks(*(*new_container)[name]) = acc_constitObjLinks(*(*old_container)[name]);
323 }
324
325 return StatusCode::SUCCESS;
326 }
static const SG::AuxElement::Accessor< std::vector< iplink_t > > dec_constitObjLinks("ConstitObjectLinks")
static const SG::AuxElement::ConstAccessor< std::vector< iplink_t > > acc_constitObjLinks("ConstitObjectLinks")
StatusCode fillMET(xAOD::MissingET *&met, xAOD::MissingETContainer *metCont, const std::string &metKey, const MissingETBase::Types::bitmask_t metSource)
MissingET_v1 MissingET
Version control by type defintion.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evaluateNNMET()

StatusCode met::METNet::evaluateNNMET ( const std::string & totalName,
xAOD::MissingETContainer * metCont ) const
overridevirtual

Reimplemented from IMETMaker.

Definition at line 228 of file METNet.cxx.

229 {
230
231 // First we check that the container has the correct decorations
232 ATH_MSG_VERBOSE( "Checking MET container for network inputs" );
233 if ( (*metCont)["NetInputDummy"] == NULL ) {
234 ATH_MSG_ERROR( "Could not find the NetInputDummy MET object in the container. Did you run rebuildJetMET?" );
235 return StatusCode::FAILURE;
236 }
237
238 // Pull out the vector from the met containter
239 std::vector<float> tmp_inputs = acc_inputvalues(*(*metCont)["NetInputDummy"]);
240 ATH_MSG_VERBOSE( "Loaded " << tmp_inputs.size() << " network inputs" );
241
242 // Check that the list of inputs matches the network size
243 if ( tmp_inputs.size() != m_metNetHandler->getReqSize() ) {
244 ATH_MSG_ERROR( "The MET container provided " << tmp_inputs.size()
245 << " elements, but the ONNX network needs exactly " << m_metNetHandler->getReqSize() << "!" );
246 return StatusCode::FAILURE;
247 }
248
249 // Passing the inputs through the network
250 std::vector<float> net_met;
251 m_metNetHandler->predict(net_met, tmp_inputs);
252
253 // Adding the network output to the Final Met container
254 xAOD::MissingET* metFinal = nullptr;
255 ATH_CHECK( fillMET( metFinal, metCont, totalName, MissingETBase::Source::total() ) );
256 metFinal->setMpx( net_met[0] );
257 metFinal->setMpy( net_met[1] );
258
259 ATH_MSG_VERBOSE( "Writing the Final Network MET: (" << net_met[0] << ", " << net_met[1] << ")" );
260
261 return StatusCode::SUCCESS;
262 }
std::unique_ptr< const METNetHandler > m_metNetHandler
Definition METNet.h:142
void setMpy(float value)
Set the component.
void setMpx(float value)
Set the component.
static const SG::AuxElement::ConstAccessor< std::vector< float > > acc_inputvalues("input_values")
static Types::bitmask_t total(Region reg=Region::FullAcceptance)
Standard full reconstructed MET.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode met::METNet::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 45 of file METNet.cxx.

45 {
46 ATH_MSG_INFO( "Initializing " << name() << "..." );
47
48 ATH_CHECK(m_eventInfoKey.initialize());
49 ATH_CHECK(m_pvContainerKey.initialize());
50 ATH_CHECK(m_jetContainerKey.initialize());
51
52 if( m_netLocation.empty()){
53 ATH_MSG_ERROR("NetworkFile property was not specified!");
54 return StatusCode::FAILURE;
55 }
56 std::string netFilePath = PathResolverFindCalibFile(m_netLocation);
57 std::unique_ptr<METNetHandler> metNetHandler = std::make_unique<METNetHandler>( netFilePath );
58 if( metNetHandler->initialize() != 0){
59 ATH_MSG_ERROR("METNet model file not found!");
60 return StatusCode::FAILURE;
61 }
62 ATH_MSG_INFO("Resolved METNet ONNX file at " + netFilePath);
63 m_metNetHandler = std::move(metNetHandler);
64
65 if(m_metmaker_loose.empty()){
66 asg::AsgToolConfig toolConfig("met::METMaker/metmaker_loose");
67 ATH_CHECK( toolConfig.setProperty("JetContainer", m_jetContainerKey.key()) );
68 ATH_CHECK( toolConfig.setProperty("DoPFlow", true) );
69 ATH_CHECK( toolConfig.setProperty("JetSelection", "Loose") );
70 ATH_CHECK( toolConfig.makePrivateTool(m_metmaker_loose) );
71 }
72 ATH_CHECK( m_metmaker_loose.retrieve() );
73
74 if(m_metmaker_tight.empty()){
75 asg::AsgToolConfig toolConfig("met::METMaker/metmaker_tight");
76 ATH_CHECK( toolConfig.setProperty("JetContainer", m_jetContainerKey.key()) );
77 ATH_CHECK( toolConfig.setProperty("DoPFlow", true) );
78 ATH_CHECK( toolConfig.setProperty("JetSelection", "Tight") );
79 ATH_CHECK( toolConfig.makePrivateTool(m_metmaker_tight) );
80 }
81 ATH_CHECK( m_metmaker_tight.retrieve() );
82
83 if(m_metmaker_tghtr.empty()){
84 asg::AsgToolConfig toolConfig("met::METMaker/metmaker_tghtr");
85 ATH_CHECK( toolConfig.setProperty("JetContainer", m_jetContainerKey.key()) );
86 ATH_CHECK( toolConfig.setProperty("DoPFlow", true) );
87 ATH_CHECK( toolConfig.setProperty("JetSelection", "Tighter") );
88 ATH_CHECK( toolConfig.makePrivateTool(m_metmaker_tghtr) );
89 }
90 ATH_CHECK( m_metmaker_tghtr.retrieve() );
91
92 if(m_metmaker_tenac.empty()){
93 asg::AsgToolConfig toolConfig("met::METMaker/metmaker_tenac");
94 ATH_CHECK( toolConfig.setProperty("JetContainer", m_jetContainerKey.key()) );
95 ATH_CHECK( toolConfig.setProperty("DoPFlow", true) );
96 ATH_CHECK( toolConfig.setProperty("JetSelection", "Tenacious") );
97 ATH_CHECK( toolConfig.makePrivateTool(m_metmaker_tenac) );
98 }
99 ATH_CHECK( m_metmaker_tenac.retrieve() );
100
101 return StatusCode::SUCCESS;
102 }
#define ATH_MSG_INFO(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
ToolHandle< IMETMaker > m_metmaker_tenac
Definition METNet.h:147
ToolHandle< IMETMaker > m_metmaker_tghtr
Definition METNet.h:146
Gaudi::Property< std::string > m_netLocation
Definition METNet.h:136
ToolHandle< IMETMaker > m_metmaker_loose
Definition METNet.h:144
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition METNet.h:138
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerKey
Definition METNet.h:140
ToolHandle< IMETMaker > m_metmaker_tight
Definition METNet.h:145
SG::ReadHandleKey< xAOD::VertexContainer > m_pvContainerKey
Definition METNet.h:139

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ markInvisible()

StatusCode met::METNet::markInvisible ( const xAOD::IParticleContainer * collection,
xAOD::MissingETAssociationHelper & helper,
xAOD::MissingETContainer * metCont ) const
overridevirtual

Implements IMETMaker.

Definition at line 421 of file METNet.cxx.

423 {
424 ATH_MSG_ERROR( "METNet does not support markInvisible!");
425 return StatusCode::FAILURE;
426 }

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ rebuildJetMET() [1/3]

StatusCode met::METNet::rebuildJetMET ( const std::string & metJetKey,
const std::string & softClusKey,
const std::string & softTrkKey,
xAOD::MissingETContainer * metCont,
const xAOD::JetContainer * jets,
const xAOD::MissingETContainer * metCoreCont,
xAOD::MissingETAssociationHelper & helper,
bool doJetJVT ) const
overridevirtual

Implements IMETMaker.

Definition at line 113 of file METNet.cxx.

120 {
121
122 // Retrieving the event information (Needed for METSig, so we do it early)
123 SG::ReadHandle<xAOD::EventInfo> ei(m_eventInfoKey);
124
125 float avgmu = ei->averageInteractionsPerCrossing();
126 float actmu = ei->actualInteractionsPerCrossing();
127
128 // Creating the new containers for all the WPs
129 auto metCont_loose = std::make_shared<xAOD::MissingETContainer>();
130 auto metCont_looseAux = std::make_shared<xAOD::MissingETAuxContainer>();
131 metCont_loose->setStore( metCont_looseAux.get() );
132
133 auto metCont_tight = std::make_shared<xAOD::MissingETContainer>();
134 auto metCont_tightAux = std::make_shared<xAOD::MissingETAuxContainer>();
135 metCont_tight->setStore( metCont_tightAux.get() );
136
137 auto metCont_tghtr = std::make_shared<xAOD::MissingETContainer>();
138 auto metCont_tghtrAux = std::make_shared<xAOD::MissingETAuxContainer>();
139 metCont_tghtr->setStore( metCont_tghtrAux.get() );
140
141 auto metCont_tenac = std::make_shared<xAOD::MissingETContainer>();
142 auto metCont_tenacAux = std::make_shared<xAOD::MissingETAuxContainer>();
143 metCont_tenac->setStore( metCont_tenacAux.get() );
144
145 // Copying the contents of the original container into each WP container
146 // Avoids redundant calculation of identical terms.
147 ATH_MSG_VERBOSE( "Making copies of base MET container" );
148 ATH_CHECK( copyMETContainer( metCont_loose.get(), metCont ) );
149 ATH_CHECK( copyMETContainer( metCont_tight.get(), metCont ) );
150 ATH_CHECK( copyMETContainer( metCont_tghtr.get(), metCont ) );
151 ATH_CHECK( copyMETContainer( metCont_tenac.get(), metCont ) );
152
153 // Selected objects may differ between WPs due to jets, muon-in-jet treatment, etc. Need unique helpers, so copy current state.
154 xAOD::MissingETAssociationHelper helper_loose(helper);
155 xAOD::MissingETAssociationHelper helper_tight(helper);
156 xAOD::MissingETAssociationHelper helper_tghtr(helper);
157 xAOD::MissingETAssociationHelper helper_tenac(helper);
158
159 // Building the jet and soft terms for each WP
160 ATH_MSG_VERBOSE( "Building jet and soft terms for each MET WP" );
161 ATH_CHECK( m_metmaker_loose->rebuildJetMET( "RefJet", softClusKey, softTrkKey, metCont_loose.get(), jets, metCoreCont, helper_loose, true ) );
162 ATH_CHECK( m_metmaker_tight->rebuildJetMET( "RefJet", softClusKey, softTrkKey, metCont_tight.get(), jets, metCoreCont, helper_tight, true ) );
163 ATH_CHECK( m_metmaker_tghtr->rebuildJetMET( "RefJet", softClusKey, softTrkKey, metCont_tghtr.get(), jets, metCoreCont, helper_tghtr, true ) );
164 ATH_CHECK( m_metmaker_tenac->rebuildJetMET( "RefJet", softClusKey, softTrkKey, metCont_tenac.get(), jets, metCoreCont, helper_tenac, true ) );
165
166 // Building and adding the "Final" MET object to each WP container
167 ATH_MSG_VERBOSE( "Building the Final MET object for each MET WP" );
172 // CST uses the LCTopo source bitmask even if the clusters are actually at EM scale
173 ATH_CHECK( met::buildMETSum( "FinalClus", metCont_loose.get(), static_cast<MissingETBase::Types::bitmask_t>(MissingETBase::Source::Signal::LCTopo)) );
174 ATH_CHECK( met::buildMETSum( "FinalClus", metCont_tight.get(), static_cast<MissingETBase::Types::bitmask_t>(MissingETBase::Source::Signal::LCTopo)) );
175 ATH_CHECK( met::buildMETSum( "FinalClus", metCont_tghtr.get(), static_cast<MissingETBase::Types::bitmask_t>(MissingETBase::Source::Signal::LCTopo)) );
176 ATH_CHECK( met::buildMETSum( "FinalClus", metCont_tenac.get(), static_cast<MissingETBase::Types::bitmask_t>(MissingETBase::Source::Signal::LCTopo)) );
177
179
180 // Initialise two vectors: One for holding the network input values and another for the input names
181 std::vector<std::string> input_names;
182 std::vector<float> input_values;
183
184 ATH_CHECK( addMETFinal( "Loose", metCont_loose.get(), input_names, input_values ) );
185
186 // Tight gets all its hard terms included as well (same as all th others, only needed once)
187 ATH_CHECK( addMETTerm( "Tight", *(metCont_tight->find(MissingETBase::Source::electron())), input_names, input_values ) );
188 ATH_CHECK( addMETTerm( "Tight", *(metCont_tight->find(MissingETBase::Source::photon())), input_names, input_values ) );
189 ATH_CHECK( addMETTerm( "Tight", *(metCont_tight->find(MissingETBase::Source::tau())), input_names, input_values ) );
190 ATH_CHECK( addMETTerm( "Tight", *(metCont_tight->find(MissingETBase::Source::muon())), input_names, input_values ) );
191 ATH_CHECK( addMETFinal( "Tight", metCont_tight.get(), input_names, input_values ) );
192
193 ATH_CHECK( addMETFinal( "Tighter", metCont_tghtr.get(), input_names, input_values ) );
194 ATH_CHECK( addMETFinal( "Tenacious", metCont_tenac.get(), input_names, input_values ) );
195
196 // Pileup information and tracking information (using the user provided primary vertex container name)
197 SG::ReadHandle<xAOD::VertexContainer> pvtxs(m_pvContainerKey);
198 if(!pvtxs.isValid()){
199 ATH_MSG_ERROR("Could not retrieve primary vertex container!");
200 return StatusCode::FAILURE;
201 }
202 int NVx_2Tracks = 0;
203 int NVx_4Tracks = 0;
204 int PV_NTracks = 0;
205 int n_tracks = 0;
206 for ( const xAOD::Vertex* vx : *pvtxs ) {
207 n_tracks = vx->nTrackParticles();
208 if ( n_tracks>=2 ) NVx_2Tracks++;
209 if ( n_tracks>=4 ) NVx_4Tracks++;
210 if ( vx->vertexType() == xAOD::VxType::PriVtx ) PV_NTracks = n_tracks;
211 }
212 ATH_CHECK( addInputValue( "ActualMu", actmu, input_names, input_values ) );
213 ATH_CHECK( addInputValue( "AverageMu", avgmu, input_names, input_values ) );
214 ATH_CHECK( addInputValue( "NPV_2Tracks", NVx_2Tracks, input_names, input_values ) );
215 ATH_CHECK( addInputValue( "NPV_4Tracks", NVx_4Tracks, input_names, input_values ) );
216 ATH_CHECK( addInputValue( "PV_NTracks", PV_NTracks, input_names, input_values ) );
217
218 // Creating a dummy MET object on the output container to carry the NN features and decorate it with the two vectors
219 ATH_MSG_VERBOSE( "Saving network inputs to base MET container" );
220 xAOD::MissingET* net_inpts = nullptr;
221 ATH_CHECK( fillMET( net_inpts, metCont, "NetInputDummy", static_cast<MissingETBase::Types::bitmask_t>(MissingETBase::Source::Type::UnknownType) ) );
222 dec_inputnames( *(*metCont)["NetInputDummy"] ) = input_names;
223 dec_inputvalues( *(*metCont)["NetInputDummy"] ) = input_values;
224
225 return StatusCode::SUCCESS;
226 }
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:264
StatusCode copyMETContainer(xAOD::MissingETContainer *new_container, const xAOD::MissingETContainer *old_container) const
Definition METNet.cxx:310
uint64_t bitmask_t
Type for status word bit mask.
StatusCode buildMETSum(const std::string &totalName, xAOD::MissingETContainer *metCont)
static const SG::AuxElement::Decorator< std::vector< std::string > > dec_inputnames("input_names")
static const SG::AuxElement::Decorator< std::vector< float > > dec_inputvalues("input_values")
@ PriVtx
Primary vertex.
Vertex_v1 Vertex
Define the latest version of the vertex class.
static Types::bitmask_t muon(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed muons.
static Types::bitmask_t tau(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed tau leptons.
static Types::bitmask_t electron(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed electrons.
static Types::bitmask_t photon(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed photons.
@ LCTopo
Indicator for MET contribution from TopoClusters with LCW calibration applied.
@ Track
Indicator for MET contribution from reconstructed charged particle tracks.

◆ rebuildJetMET() [2/3]

StatusCode met::METNet::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
overridevirtual

Implements IMETMaker.

Definition at line 364 of file METNet.cxx.

370 {
371 return rebuildJetMET(metJetKey, "SoftClus", "PVSoftTrk", metCont, jets, metCoreCont, helper, doJetJVT);
372 }
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:364

◆ rebuildJetMET() [3/3]

StatusCode met::METNet::rebuildJetMET ( xAOD::MissingET * metJet,
const xAOD::JetContainer * jets,
xAOD::MissingETAssociationHelper & helper,
xAOD::MissingET * metSoftClus,
const xAOD::MissingET * coreSoftClus,
xAOD::MissingET * metSoftTrk,
const xAOD::MissingET * coreSoftTrk,
bool doJetJVT,
bool tracksForHardJets = false,
std::vector< const xAOD::IParticle * > * softConst = 0 ) const
overridevirtual

Implements IMETMaker.

Definition at line 374 of file METNet.cxx.

383 {
384 ATH_MSG_ERROR( "METNet has not overloaded this version of rebuildJetMET from IMETMaker!\n"
385 "Please use the method with the following arguments:\n"
386 "StatusCode METNet::rebuildJetMET(\n"
387 "const std::string& metJetKey,\n"
388 "const std::string& softClusKey,\n"
389 "const std::string& softTrkKey,\n"
390 "xAOD::MissingETContainer* metCont,\n"
391 "const xAOD::JetContainer* jets,\n"
392 "const xAOD::MissingETContainer* metCoreCont,\n"
393 "xAOD::MissingETAssociationHelper& helper,\n"
394 "bool doJetJVT\n"
395 ")" );
396 return StatusCode::FAILURE;
397 }

◆ rebuildMET() [1/3]

StatusCode met::METNet::rebuildMET ( const std::string & metKey,
xAOD::Type::ObjectType metType,
xAOD::MissingETContainer * metCont,
const xAOD::IParticleContainer * collection,
xAOD::MissingETAssociationHelper & helper,
MissingETBase::UsageHandler::Policy objScale ) const
overridevirtual

Implements IMETMaker.

Definition at line 104 of file METNet.cxx.

109 {
110 return m_metmaker_tight->rebuildMET( metKey, metType, metCont, collection, helper, objScale );
111 }

◆ rebuildMET() [2/3]

StatusCode met::METNet::rebuildMET ( xAOD::MissingET * met,
const xAOD::IParticleContainer * collection,
xAOD::MissingETAssociationHelper & helper,
MissingETBase::UsageHandler::Policy objScale ) const
overridevirtual

Implements IMETMaker.

Definition at line 328 of file METNet.cxx.

331 {
332 ATH_MSG_ERROR( "METNet has not overloaded this version of rebuildMET from IMETMaker!\n"
333 "Please only use this method:\n"
334 "StatusCode METMaker::rebuildMET("
335 "const std::string& metKey,\n"
336 "xAOD::Type::ObjectType metType,\n"
337 "xAOD::MissingETContainer* metCont,\n"
338 "const xAOD::IParticleContainer* collection,\n"
339 "xAOD::MissingETAssociationHelper& helper,\n"
340 "MissingETBase::UsageHandler::Policy objScale\n"
341 ")" );
342 return StatusCode::FAILURE;
343 }

◆ rebuildMET() [3/3]

StatusCode met::METNet::rebuildMET ( xAOD::MissingET * met,
const xAOD::IParticleContainer * collection,
xAOD::MissingETAssociationHelper & helper,
MissingETBase::UsageHandler::Policy p,
bool removeOverlap,
MissingETBase::UsageHandler::Policy objScale ) const
overridevirtual

Implements IMETMaker.

Definition at line 345 of file METNet.cxx.

350 {
351 ATH_MSG_ERROR( "METNet has not overloaded this version of rebuildMET from IMETMaker!\n"
352 "Please only use this method:\n"
353 "StatusCode METMaker::rebuildMET("
354 "const std::string& metKey,\n"
355 "xAOD::Type::ObjectType metType,\n"
356 "xAOD::MissingETContainer* metCont,\n"
357 "const xAOD::IParticleContainer* collection,\n"
358 "xAOD::MissingETAssociationHelper& helper,\n"
359 "MissingETBase::UsageHandler::Policy objScale\n"
360 ")" );
361 return StatusCode::FAILURE;
362 }

◆ rebuildTrackMET() [1/2]

StatusCode met::METNet::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
overridevirtual

Implements IMETMaker.

Definition at line 399 of file METNet.cxx.

405 {
406 ATH_MSG_ERROR( "Please don't use the method METNet::rebuildTrackMET!\n"
407 "It has no use in METNet and is a holdover from its inheritance from IMETMaker." );
408 return StatusCode::FAILURE;
409 }

◆ rebuildTrackMET() [2/2]

StatusCode met::METNet::rebuildTrackMET ( xAOD::MissingET * metJet,
const xAOD::JetContainer * jets,
xAOD::MissingETAssociationHelper & helper,
xAOD::MissingET * metSoftTrk,
const xAOD::MissingET * coreSoftTrk,
bool doJetJVT ) const
overridevirtual

Implements IMETMaker.

Definition at line 411 of file METNet.cxx.

416 {
417 ATH_MSG_ERROR( "METNet does not support Track MET!" );
418 return StatusCode::FAILURE;
419 }

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> met::METNet::m_eventInfoKey {this, "EventInfoKey", "EventInfo", "Event info key"}
private

Definition at line 138 of file METNet.h.

138{this, "EventInfoKey", "EventInfo", "Event info key"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_jetContainerKey

SG::ReadHandleKey<xAOD::JetContainer> met::METNet::m_jetContainerKey {this, "JetContainer", "", "Name of input jet container"}
private

Definition at line 140 of file METNet.h.

140{this, "JetContainer", "", "Name of input jet container"};

◆ m_metmaker_loose

ToolHandle<IMETMaker> met::METNet::m_metmaker_loose {this, "METMakerLoose", "", "METMaker for Loose WP. Do not configure manually except for expert usage." }
private

Definition at line 144 of file METNet.h.

144{this, "METMakerLoose", "", "METMaker for Loose WP. Do not configure manually except for expert usage." };

◆ m_metmaker_tenac

ToolHandle<IMETMaker> met::METNet::m_metmaker_tenac {this, "METMakerTenacious", "", "METMaker for Tenacious WP. Do not configure manually except for expert usage." }
private

Definition at line 147 of file METNet.h.

147{this, "METMakerTenacious", "", "METMaker for Tenacious WP. Do not configure manually except for expert usage." };

◆ m_metmaker_tghtr

ToolHandle<IMETMaker> met::METNet::m_metmaker_tghtr {this, "METMakerTighter", "", "METMaker for Tighter WP. Do not configure manually except for expert usage." }
private

Definition at line 146 of file METNet.h.

146{this, "METMakerTighter", "", "METMaker for Tighter WP. Do not configure manually except for expert usage." };

◆ m_metmaker_tight

ToolHandle<IMETMaker> met::METNet::m_metmaker_tight {this, "METMakerTight", "", "METMaker for Tight WP. Do not configure manually except for expert usage." }
private

Definition at line 145 of file METNet.h.

145{this, "METMakerTight", "", "METMaker for Tight WP. Do not configure manually except for expert usage." };

◆ m_metNetHandler

std::unique_ptr<const METNetHandler> met::METNet::m_metNetHandler
private

Definition at line 142 of file METNet.h.

◆ m_netLocation

Gaudi::Property<std::string> met::METNet::m_netLocation {this, "NetworkFile", "", "Location of NN file to use"}
private

Definition at line 136 of file METNet.h.

136{this, "NetworkFile", "", "Location of NN file to use"};

◆ m_pvContainerKey

SG::ReadHandleKey<xAOD::VertexContainer> met::METNet::m_pvContainerKey {this, "PVContainerKey", "PrimaryVertices", "Primary vertex container"}
private

Definition at line 139 of file METNet.h.

139{this, "PVContainerKey", "PrimaryVertices", "Primary vertex container"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: