|
ATLAS Offline Software
|
#include <ParticleScaleFactorTool.h>
|
| ParticleScaleFactorTool (const std::string &name) |
|
| ~ParticleScaleFactorTool () |
|
virtual StatusCode | initialize () override |
| Initialize is required by AsgTool base class. More...
|
|
virtual double | evaluate (const xAOD::IParticle *particle) const override |
| returns: the value that was calculated from the xAOD::IParticle More...
|
|
bool | isAffectedBySystematic (const CP::SystematicVariation &systematic) const override |
| The ISystematicsTool methods. More...
|
|
CP::SystematicSet | affectingSystematics () const override |
| the list of all systematics this tool can be affected by More...
|
|
CP::SystematicSet | recommendedSystematics () const override |
| the list of all systematics this tool recommends to use More...
|
|
StatusCode | applySystematicVariation (const CP::SystematicSet &systConfig) override |
| effects: configure this tool for the given list of systematic variations. More...
|
|
virtual void | print () const |
| Print the state of the tool. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
Definition at line 19 of file ParticleScaleFactorTool.h.
◆ StoreGateSvc_t
◆ ParticleScaleFactorTool()
ParticleScaleFactorTool::ParticleScaleFactorTool |
( |
const std::string & |
name | ) |
|
◆ ~ParticleScaleFactorTool()
ParticleScaleFactorTool::~ParticleScaleFactorTool |
( |
| ) |
|
◆ affectingSystematics()
◆ applySystematicVariation()
effects: configure this tool for the given list of systematic variations.
any requested systematics that are not affecting this tool will be silently ignored (unless they cause other errors). failures: systematic unknown failures: requesting multiple variations on the same systematic (e.g. up & down) failures: requesting an unsupported variation on an otherwise supported systematic (e.g. a 2 sigma variation and the tool only supports 1 sigma variations) failures: unsupported combination of supported systematic failures: other tool specific errors
Implements CP::ISystematicsTool.
Definition at line 241 of file ParticleScaleFactorTool.cxx.
242 for(
auto& syst : systConfig) {
244 if(
s.basename()==syst.basename()) {
246 return StatusCode::SUCCESS;
252 return StatusCode::SUCCESS;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evaluate()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
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()
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
-
ptr | The 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.
121 #ifdef XAOD_STANDALONE
127 return (
proxy ==
nullptr ? 0 :
proxy->sgkey() );
128 #endif // XAOD_STANDALONE
◆ 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
-
ptr | The 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.
108 #ifdef XAOD_STANDALONE
114 static const std::string
dummy =
"";
116 #endif // XAOD_STANDALONE
◆ getProperty()
template<class T >
const T* asg::AsgTool::getProperty |
( |
const std::string & |
name | ) |
const |
|
inherited |
Get one of the tool's properties.
◆ initialize()
StatusCode ParticleScaleFactorTool::initialize |
( |
| ) |
|
|
overridevirtual |
Initialize is required by AsgTool base class.
Reimplemented from asg::AsgTool.
Definition at line 34 of file ParticleScaleFactorTool.cxx.
38 if(
file==
"")
return StatusCode::FAILURE;
40 TFile*
f = TFile::Open(
file.c_str());
44 return StatusCode::FAILURE;
50 std::unique_ptr<TIterator> itr(
f->GetListOfKeys()->MakeIterator());
52 while( (
key =
static_cast<TKey*
>(itr->Next())) ) {
53 TClass*
cl = TClass::GetClass(
key->GetClassName());
54 if(!
cl || !
cl->InheritsFrom(TDirectory::Class()))
continue;
58 ATH_MSG_ERROR(
"Systematic must be of form: <string>__Xup OR <string>__Xdown ... where X is a number");
59 return StatusCode::FAILURE;
64 while( (
key =
static_cast<TKey*
>(itr->Next())) ) {
65 TClass*
cl = TClass::GetClass(
key->GetClassName());
66 if(!
cl || !
cl->InheritsFrom(
"TH1"))
continue;
74 TH1*
hist =
static_cast<TH1*
>(
f->Get(
h));
81 return StatusCode::FAILURE;
93 return StatusCode::FAILURE;
97 if(strlen(
hist->GetXaxis()->GetTitle())==0 ||
98 (
hist->GetDimension()>1 && strlen(
hist->GetYaxis()->GetTitle())==0) ||
99 (
hist->GetDimension()>2 && strlen(
hist->GetZaxis()->GetTitle())==0) ) {
100 ATH_MSG_ERROR(
"All axis of histogram " <<
hist->GetName() <<
" need to be labelled");
101 return StatusCode::FAILURE;
104 TH1*& existHist =
m_hists[
type].hists[syst.name()];
107 existHist->GetXaxis()->GetTitle() <<
"," <<
hist->GetXaxis()->GetTitle() <<
108 ") = 2*f(" << existHist->GetXaxis()->GetTitle() <<
")*f(" <<
109 hist->GetXaxis()->GetTitle() <<
")/[f(" << existHist->GetXaxis()->GetTitle() <<
110 ")+f(" <<
hist->GetXaxis()->GetTitle() <<
")]");
113 if(existHist->GetDimension()==1 &&
hist->GetDimension()==1) {
114 std::vector<double> binEdges1, binEdges2;
115 for(
int i=1;
i<=existHist->GetNbinsX()+1;
i++) binEdges1.push_back(existHist->GetBinLowEdge(
i));
116 for(
int i=1;
i<=
hist->GetNbinsX()+1;
i++) binEdges2.push_back(
hist->GetBinLowEdge(
i));
117 newHist =
new TH2D(
"myHist",
"myHist",existHist->GetNbinsX(),&binEdges1[0],
hist->GetNbinsX(),&binEdges2[0]);
119 newHist->GetXaxis()->SetTitle(existHist->GetTitle());
121 for(
int i=0;
i<=existHist->GetNbinsX()+1;
i++) {
122 for(
int j=0;j<=
hist->GetNbinsX()+1;j++) {
123 double a = existHist->GetBinContent(
i);
double b =
hist->GetBinContent(j);
127 double da = existHist->GetBinError(
i);
double db =
hist->GetBinError(j);
135 ATH_MSG_ERROR(
"Unsupported scale factor reparamertization :-(");
136 return StatusCode::FAILURE;
140 existHist =
static_cast<TH1*
>(
hist->Clone(
"myHist")); existHist->SetDirectory(0);
146 for(
int i=0;
i<
hist->GetDimension();
i++) {
147 std::string axisTitle = (
i==0 ) ?
hist->GetXaxis()->GetTitle() : ( (
i==1) ?
hist->GetYaxis()->GetTitle() :
hist->GetZaxis()->GetTitle() );
148 axisTitle.erase(
remove_if(axisTitle.begin(), axisTitle.end(), isspace),axisTitle.end());
151 if(axisTitle==
"pt" || axisTitle==
"pt/MeV" || axisTitle==
"pt[MeV]") {
153 }
else if(axisTitle ==
"pt/GeV" || axisTitle==
"pt[GeV]") {
155 }
else if(axisTitle==
"eta") {
158 bfunc = std::bind(
part_decor, std::placeholders::_1, axisTitle);
173 for(
auto&
s : tmpSet) {
186 return StatusCode::SUCCESS;
◆ inputHandles()
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.
◆ isAffectedBySystematic()
◆ msg() [1/2]
◆ msg() [2/2]
◆ 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.
◆ msgLvl()
◆ outputHandles()
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.
◆ part_decor()
Definition at line 37 of file ParticleScaleFactorTool.h.
40 if( auxid == SG::null_auxid ) {
41 throw std::runtime_error(
"unknown aux id for decoration: " +
varname);
43 const std::type_info* ti = reg.
getType( auxid );
44 if( *ti ==
typeid(
double ) ) {
47 }
else if( *ti ==
typeid(
float ) ) {
50 }
else if( *ti ==
typeid(
int ) ) {
53 }
else if( *ti ==
typeid(
unsigned int ) ) {
57 throw std::runtime_error(
"Unrecognised type for decoration: " +
varname);
◆ part_eta()
◆ part_pt()
◆ part_pt_gev()
◆ print()
void asg::AsgTool::print |
( |
| ) |
const |
|
virtualinherited |
Print the state of the tool.
Implements asg::IAsgTool.
Reimplemented in JetRecTool, JetFinder, JetModifiedMassDrop, JetFromPseudojet, JetReclusterer, JetReclusteringTool, JetTruthLabelingTool, JetPileupLabelingTool, HI::HIPileupTool, JetDumper, JetBottomUpSoftDrop, JetRecursiveSoftDrop, JetSoftDrop, JetConstituentsRetriever, JetSubStructureMomentToolsBase, JetSplitter, JetToolRunner, JetPruner, JetPseudojetRetriever, JetTrimmer, AsgHelloTool, and KtDeltaRTool.
Definition at line 131 of file AsgTool.cxx.
◆ recommendedSystematics()
◆ renounce()
◆ renounceArray()
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_affectingSysts
◆ m_configFile
std::string ParticleScaleFactorTool::m_configFile |
|
private |
◆ m_currentSyst
◆ m_detStore
◆ m_evtStore
◆ m_hists
◆ m_isNominal
bool ParticleScaleFactorTool::m_isNominal =true |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Electron_v1 Electron
Definition of the current "egamma version".
static AuxTypeRegistry & instance()
Return the singleton registry instance.
SG::auxid_t findAuxID(const std::string &name, const std::string &clsname="") const
Look up a name -> auxid_t mapping.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Class to wrap a set of SystematicVariations.
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
static double part_decor(const xAOD::IParticle &p, const std::string &varname)
#define ATH_MSG_VERBOSE(x)
Class providing the definition of the 4-vector interface.
virtual void setOwner(IDataHandleHolder *o)=0
CP::SystematicSet affectingSystematics() const override
the list of all systematics this tool can be affected by
Handle mappings between names and auxid_t.
CP::SystematicVariation m_currentSyst
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
size_t auxid_t
Identifier for a particular aux data item.
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
static double part_pt(const xAOD::IParticle &p)
CP::SystematicSet m_affectingSysts
std::pair< std::vector< unsigned int >, bool > res
const_iterator end() const
description: const iterator to the end of the set
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
std::map< xAOD::Type::ObjectType, Hists > m_hists
Photon_v1 Photon
Definition of the current "egamma version".
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
struct TBPatternUnitContext Muon
void clear()
description: clear the set
iterator find(const SystematicVariation &sys) const
description: find an element in the set
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.
static double part_eta(const xAOD::IParticle &p)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
@ Tau
The object is a tau (jet)
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Jet_v1 Jet
Definition of the current "jet version".
static double part_pt_gev(const xAOD::IParticle &p)
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
float parameter() const
description: the numeric parameter contained in the subvariation(), or 0 if the subvariation can't be...