ATLAS Offline Software
WeightToolBase.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // Base class for a per-event weight computation
8 // The getWeight() function computes and returns the weight
9 // while the evaluate() function (from IObservableTool) is dedicated
10 // to be called mainly when the information already exists
11 // The addDecoration function can be called to add the computed
12 // weight to the EventInfo
13 //
14 // Author: Olivier Arnaez <olivier.arnaez@cern.ch>
16 
17 #ifndef WEIGHTOOLBASE_H
18 #define WEIGHTOOLBASE_H 1
19 
20 // Include the base class
21 #include "AsgTools/AsgTool.h"
22 
26 
27 
28 class WeightToolBase : public asg::AsgTool, virtual public IWeightTool, virtual public IObservableTool
29  {
32 
33  public:
35  WeightToolBase( const std::string& name );
36 
38  virtual ~WeightToolBase() {};
39 
41  virtual StatusCode initialize() override;
42 
44 #ifndef XAOD_STANDALONE
45  virtual StatusCode finalize() override;
46 #else
47  virtual StatusCode finalize();
48 #endif
49 
50  /*/// returns: the value that was calculated from the xAOD::IParticle (composite built event object for instance)
51  virtual double evaluate( const xAOD::IParticle* part ) const=0;*/
52 
54  virtual double getWeight() const override = 0;
55 
56 
57  protected:
58  //add weight to EventInfo as decoration
59  bool addDecoration(const xAOD::EventInfo* evtInfo, float weight) const;
60 
62  std::string m_weightName;
63 
64  };
65 
66 #endif //> !WEIGHTOOLBASE_H
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
WeightToolBase::finalize
virtual StatusCode finalize() override
Usual finalize method of the framework.
Definition: WeightToolBase.cxx:33
ASG_TOOL_CLASS2
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Definition: AsgToolMacros.h:77
IObservableTool
Interface for tools that want to calculate a quantity from an xAOD::IParticle.
Definition: IObservableTool.h:32
WeightToolBase::initialize
virtual StatusCode initialize() override
Usual initialize method of the framework.
Definition: WeightToolBase.cxx:21
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
IWeightTool
Interface for tools that want to calculate a weight from different event information.
Definition: IWeightTool.h:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
WeightToolBase::m_prefixWeightDecoration
std::string m_prefixWeightDecoration
Definition: WeightToolBase.h:61
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
IObservableTool.h
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
WeightToolBase::WeightToolBase
WeightToolBase(const std::string &name)
Create a proper constructor for Athena.
Definition: WeightToolBase.cxx:14
WeightToolBase::~WeightToolBase
virtual ~WeightToolBase()
Default destructor.
Definition: WeightToolBase.h:38
IWeightTool.h
WeightToolBase
Definition: WeightToolBase.h:29
AsgTool.h
WeightToolBase::m_weightName
std::string m_weightName
Definition: WeightToolBase.h:62
WeightToolBase::getWeight
virtual double getWeight() const override=0
returns: the value that was calculated from the usual Athena storegate
WeightToolBase::addDecoration
bool addDecoration(const xAOD::EventInfo *evtInfo, float weight) const
Definition: WeightToolBase.cxx:42