ATLAS Offline Software
Loading...
Searching...
No Matches
AsgPhotonEfficiencyCorrectionTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Dear emacs, this is -*-c++-*-
6
7#ifndef PHOTONEFFICIENCYCORRECTION_ASGPHOTONEFFICIENCYCORRECTIONTOOL
8#define PHOTONEFFICIENCYCORRECTION_ASGPHOTONEFFICIENCYCORRECTIONTOOL
9
17
18// STL includes
19#include <vector>
20#include <string>
21#include <fstream>
22#include <unordered_map>
23
24//xAOD includes
25#include "AsgTools/AsgTool.h"
32
40
43 virtual public CP::ISystematicsTool,
44 public asg::AsgTool,
46{
48
49public:
51 AsgPhotonEfficiencyCorrectionTool ( const std::string& myname );
52
55
57 virtual StatusCode initialize() override;
58
59
60public:
62 virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Egamma& inputObject, double& efficiencyScaleFactor) const override;
63 CP::CorrectionCode getEfficiencyScaleFactor(columnar::EgammaId inputObject, columnar::EventInfoId eventInfo, double& efficiencyScaleFactor) const;
64 virtual CP::CorrectionCode getEfficiencyScaleFactorError(const xAOD::Egamma& inputObject, double& efficiencyScaleFactorError) const override;
65 CP::CorrectionCode getEfficiencyScaleFactorError(columnar::EgammaId inputObject, columnar::EventInfoId eventInfo, double& efficiencyScaleFactorError) const;
66 virtual CP::CorrectionCode applyEfficiencyScaleFactor(xAOD::Egamma& inputObject) const override;
67
69
71 virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const override;
72
74 virtual CP::SystematicSet affectingSystematics() const override;
75
77 virtual CP::SystematicSet recommendedSystematics() const override;
78
81 assert (m_appliedSystematics != nullptr);
83 }
84
86 virtual StatusCode applySystematicVariation ( const CP::SystematicSet& systConfig ) override;
87
88 StatusCode registerSystematics();
89
90 // Private member variables
91private:
95
99
101 std::unordered_map<CP::SystematicSet, CP::SystematicSet> m_systFilter;
102
105
106 // The prefix for the systematic name
107 std::string m_sysSubstring;
108
109 // Get the correction filename from the map
110 std::string getFileName(const std::string& isoWP, const std::string& trigWP, bool isConv);
111
112 // Set prefix of the corresponding calibration filenames:
113 std::string m_file_prefix_ID="efficiencySF.offline.";
114 std::string m_file_prefix_ISO="efficiencySF.Isolation.";
115 std::string m_file_prefix_Trig="efficiencySF.";
116 std::string m_file_prefix_TrigEff="efficiency.";
117
118 // Properties
119
123
125 std::string m_resultPrefix;
126
128 std::string m_resultName;
129
132
134 std::string m_isoWP;
135
137 std::string m_trigger;
138
140 std::string m_mapFile;
141
142 // bin boundaries of correction files
143 std::map<float, std::vector<float>> m_pteta_bins;
144
145 //use RandomRun Number
148
149 // remove TRT converted photon for Run-3
151
152 Gaudi::Property<bool> m_allowMissingLinks{ this, "AllowMissingLinks", false, "Allow missing links in the input objects. This should only be used by experts running on expert formats." };
153
154 // an accessor structure that hides the columnar accessors from the
155 // root dictionaries that can't handle them. these dictionaries are
156 // used by some users to instantiate the tools (instead of using the
157 // factory mechanism).
179 std::unique_ptr<Accessors> m_accessors {std::make_unique<Accessors>(*this)};
180
181
182public:
183
185 void callEvents (columnar::EventContextRange events) const override;
186
187}; // End: class definition
188
189
190#endif
191
#define ASG_TOOL_CLASS3(CLASSNAME, INT1, INT2, INT3)
CP::SystematicSet * m_appliedSystematics
Currently applied systematics.
int m_dataTypeOverwrite
Force the data type to a given value.
std::string m_resultPrefix
The prefix string for the result.
std::string getFileName(const std::string &isoWP, const std::string &trigWP, bool isConv)
CP::CorrectionCode calculate(columnar::EgammaId egam, columnar::EventInfoId eventInfo, Result &result) const
I think these calculate methods are only used internally.
virtual CP::CorrectionCode applyEfficiencyScaleFactor(xAOD::Egamma &inputObject) const override
Decorate the photon with its scale factor.
std::string m_isoWP
Isolation working point.
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systConfig) override
Configure this tool for the given systematics.
std::string m_corrFileNameConv
The list of input file names.
std::string m_trigger
Trigger name for trigger SF.
Root::TElectronEfficiencyCorrectionTool * m_rootTool_unc
Pointer to the underlying ROOT based tool.
virtual StatusCode initialize() override
Gaudi Service Interface method implementations.
virtual CP::SystematicSet recommendedSystematics() const override
returns: the list of all systematics this tool recommends to use
virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Egamma &inputObject, double &efficiencyScaleFactor) const override
Add some method for now as a first step to move the tool to then new interface.
const CP::SystematicSet & appliedSystematics() const
returns: the currently applied systematics
void callEvents(columnar::EventContextRange events) const override
virtual CP::CorrectionCode getEfficiencyScaleFactorError(const xAOD::Egamma &inputObject, double &efficiencyScaleFactorError) const override
Get the "photon scale factor error" as a return value.
Root::TElectronEfficiencyCorrectionTool::Result Result
void callSingleEvent(columnar::EgammaRange photons, columnar::EventInfoId event) const
std::string m_resultName
The string for the result.
virtual CP::SystematicSet affectingSystematics() const override
returns: the list of all systematics this tool can be affected by
virtual ~AsgPhotonEfficiencyCorrectionTool()
Standard destructor.
virtual bool isAffectedBySystematic(const CP::SystematicVariation &systematic) const override
The methods below should notify the user of what is actually in the list , without him having to go i...
Root::TElectronEfficiencyCorrectionTool * m_rootTool_con
StatusCode registerSystematics()
Register the systematics with the registry and add them to the recommended list.
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_systFilter
Systematics filter map.
std::map< float, std::vector< float > > m_pteta_bins
AsgPhotonEfficiencyCorrectionTool(const std::string &myname)
Standard constructor.
Return value from object correction CP tools.
interface for all CP tools supporting systematic variations within a reentrant algorithm
Interface for all CP tools supporting systematic variations.
Class to wrap a set of SystematicVariations.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
the base class for all columnar components
AccessorTemplate< ContainerId::track, CT, ColumnAccessMode::input, CM > TrackAccessor
Definition TrackDef.h:48
AccessorTemplate< ContainerId::egamma, CT, ColumnAccessMode::output, CM > EgammaDecorator
Definition EgammaDef.h:53
ObjectRange< ContainerId::egamma > EgammaRange
Definition EgammaDef.h:49
AccessorTemplate< ContainerId::eventInfo, CT, ColumnAccessMode::input, CM > EventInfoAccessor
ObjectId< ContainerId::egamma > EgammaId
Definition EgammaDef.h:50
ObjectRange< ContainerId::eventContext > EventContextRange
AccessorTemplate< ContainerId::egamma, CT, ColumnAccessMode::input, CM > EgammaAccessor
Definition EgammaDef.h:52
AccessorTemplate< ContainerId::vertex, CT, ColumnAccessMode::input, CM > VertexAccessor
Definition TrackDef.h:69
AccessorTemplate< ContainerId::cluster, CT, ColumnAccessMode::input, CM > ClusterAccessor
Definition ClusterDef.h:28
ObjectId< ContainerId::eventInfo > EventInfoId
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17
columnar::EventInfoAccessor< columnar::ObjectColumn > eventInfoAcc
columnar::ClusterAccessor< columnar::ObjectColumn > clusterAcc
columnar::EventInfoAccessor< uint32_t > randomRunNumberAcc
columnar::TrackAccessor< columnar::ObjectColumn > tracksAcc
columnar::EgammaAccessor< std::vector< columnar::OptClusterId > > caloClusterAcc
columnar::EgammaHelpers::IsConvertedPhotonAccessor isConvertedPhotonAcc
columnar::EgammaAccessor< columnar::ObjectColumn > photonsAcc
columnar::VertexAccessor< columnar::ObjectColumn > verticesAcc