ATLAS Offline Software
Loading...
Searching...
No Matches
WeightToolBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ReweightUtils includes
7
10
11// #include <TLorentzVector.h>
12
13
14WeightToolBase::WeightToolBase( const std::string& name )
15 : asg::AsgTool( name ),
16 m_prefixWeightDecoration("weight_"){
17 declareProperty("PrefixWeightDecoration", m_prefixWeightDecoration);
18}
19
20
22 // Default implementation, such that users don't have to implement this any
23 // more for the simplest use cases.
24 ATH_MSG_DEBUG ("Initializing " << name() << "...");
25 //setting weight name for decoration
27 m_weightName.replace(m_weightName.find("ToolSvc."), std::string("ToolSvc.").length(), "");
28
29 return StatusCode::SUCCESS;
30}
31
32
34{
35 // Default implementation, such that users don't have to implement this any
36 // more for the simplest use cases.
37 ATH_MSG_DEBUG ("Finalizing " << name() << "...");
38 return StatusCode::SUCCESS;
39}
40
41
42bool WeightToolBase::addDecoration(const xAOD::EventInfo* evtInfo, float weight) const {
43 if (!evtInfo) {
44 ATH_MSG_ERROR("Cannot decorate empty EventInfo in "<< this->name());
45 return false;
46 }
48 if (! dec.isAvailable( *evtInfo ) )
49 dec( *evtInfo ) = weight;
50 return true;
51}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Helper class to provide type-safe access to aux data.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
std::string m_weightName
std::string m_prefixWeightDecoration
WeightToolBase(const std::string &name)
Create a proper constructor for Athena.
bool addDecoration(const xAOD::EventInfo *evtInfo, float weight) const
virtual StatusCode initialize() override
Usual initialize method of the framework.
virtual StatusCode finalize() override
Usual finalize method of the framework.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
EventInfo_v1 EventInfo
Definition of the latest event info version.