![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Example usage code: Athena only: To configure the tool, add the following to your joboptions: myTool = CfgMgr.HFORSelectionTool("ToolInstanceName",Property=4.0) import ROOT myTool.ENumProperty = ROOT.HFORSelectionTool.Val2 To use the tool in your algorithm (can use regular ToolHandle or asg::AnaToolHandle): #include "HFORTools/IHFORSelectionTool.h" ToolHandle<IHFORSelectionTool> myTool("HFORSelectionTool/ToolInstanceName") CHECK( myTool.retrieve() ); myTool->isSelected(...); //or whatever methods are implemented in IHFORSelectionTool.
More...
#include <HFORSelectionTool.h>
|
| HFORSelectionTool (const std::string &name) |
|
virtual StatusCode | initialize () override |
| Dummy implementation of the initialisation function. More...
|
|
virtual StatusCode | beginInputFile () override |
| Function called when a new input file is opened. More...
|
|
virtual StatusCode | endInputFile () override |
| Function called when the currently open input file got completely processed. More...
|
|
virtual bool | isSelected () override |
|
HFORType | getSampleType () override |
|
std::string | getSampleName () override |
|
HFORType | getDecisionType () override |
|
virtual StatusCode | sysInitialize () |
| Function initialising the tool in the correct way in Athena. 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 | 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 |
|
| ASG_TOOL_INTERFACE (IHFORSelectionTool) virtual bool isSelected()=0 |
|
Example usage code: Athena only: To configure the tool, add the following to your joboptions: myTool = CfgMgr.HFORSelectionTool("ToolInstanceName",Property=4.0) import ROOT myTool.ENumProperty = ROOT.HFORSelectionTool.Val2 To use the tool in your algorithm (can use regular ToolHandle or asg::AnaToolHandle): #include "HFORTools/IHFORSelectionTool.h" ToolHandle<IHFORSelectionTool> myTool("HFORSelectionTool/ToolInstanceName") CHECK( myTool.retrieve() ); myTool->isSelected(...); //or whatever methods are implemented in IHFORSelectionTool.
Dual use: Alternative for c++ configuration and usage (with or without athena): #include "AsgTools/AnaToolHandle.h" #include "HFORTools/IHFORSelectionTool.h" asg::AnaToolHandle<IHFORSelectionTool> myTool("HFORSelectionTool/ToolInstanceName"); myTool.setProperty( "Property", 4.0 ); myTool.setProperty( "ENumProperty", myTool.initialize(); myTool->isSelected(....); //or whatever methods are implemented in IHFORSelectionTool
Definition at line 42 of file HFORSelectionTool.h.
◆ MetaStore_t
◆ MetaStorePtr_t
Type of the metadata store pointer in standalone mode.
Definition at line 68 of file AsgMetadataTool.h.
◆ StoreGateSvc_t
◆ HFORSelectionTool()
HFORSelectionTool::HFORSelectionTool |
( |
const std::string & |
name | ) |
|
◆ ASG_TOOL_INTERFACE()
◆ beginEvent()
StatusCode asg::AsgMetadataTool::beginEvent |
( |
| ) |
|
|
protectedvirtualinherited |
Function called when a new events is loaded.
Dummy implementation that can be overridden by the derived tool.
Reimplemented in AsgElectronEfficiencyCorrectionTool, TrigConf::xAODConfigTool, TauAnalysisTools::TauSelectionTool, TauAnalysisTools::DiTauSelectionTool, TauAnalysisTools::CommonSmearingTool, TauAnalysisTools::DiTauEfficiencyCorrectionsTool, Trig::TrigDecisionTool, TauAnalysisTools::TauEfficiencyCorrectionsTool, Trig::TrigConfBunchCrossingTool, xAODMaker::TriggerMenuMetaDataTool, and Trig::xAODBunchCrossingTool.
Definition at line 196 of file AsgMetadataTool.cxx.
199 return StatusCode::SUCCESS;
◆ beginInputFile()
StatusCode HFORSelectionTool::beginInputFile |
( |
| ) |
|
|
overridevirtual |
Function called when a new input file is opened.
Dummy implementation that can be overridden by the derived tool.
Reimplemented from asg::AsgMetadataTool.
Definition at line 97 of file HFORSelectionTool.cxx.
103 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);
◆ 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.
◆ 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.
◆ 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()
◆ endInputFile()
StatusCode HFORSelectionTool::endInputFile |
( |
| ) |
|
|
overridevirtual |
Function called when the currently open input file got completely processed.
Dummy implementation that can be overridden by the derived tool.
Reimplemented from asg::AsgMetadataTool.
Definition at line 112 of file HFORSelectionTool.cxx.
114 ATH_MSG_DEBUG( __PRETTY_FUNCTION__ <<
" End Of File detected ");
119 ATH_MSG_DEBUG(
"****************************************************************************") ;
124 ATH_MSG_DEBUG(
"****************************************************************************") ;
132 return StatusCode::SUCCESS ;
◆ 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
◆ getDecisionType()
HFORType HFORSelectionTool::getDecisionType |
( |
| ) |
|
|
overridevirtual |
◆ 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
124 return evtStore()->event()->getKey( ptr );
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
111 return evtStore()->event()->getName( ptr );
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.
◆ getSampleName()
std::string HFORSelectionTool::getSampleName |
( |
| ) |
|
|
overridevirtual |
◆ getSampleType()
HFORType HFORSelectionTool::getSampleType |
( |
| ) |
|
|
overridevirtual |
◆ handle()
void asg::AsgMetadataTool::handle |
( |
const Incident & |
inc | ) |
|
|
protectedvirtualinherited |
Function receiving incidents from IncidentSvc/TEvent.
Reimplemented in Trig::TrigDecisionTool.
Definition at line 130 of file AsgMetadataTool.cxx.
136 if( inc.type() == IncidentType::BeginInputFile ) {
140 throw std::runtime_error(
"Couldn't call beginInputFile()" );
142 }
else if( inc.type() == IncidentType::EndInputFile ) {
145 throw std::runtime_error(
"Couldn't call endInputFile()" );
147 }
else if( inc.type() == IncidentType::BeginEvent ) {
155 throw std::runtime_error(
"Couldn't call beginInputFile()" );
160 throw std::runtime_error(
"Couldn't call beginEvent()" );
163 #ifdef XAOD_STANDALONE
164 }
else if( inc.type() == IncidentType::MetaDataStop ) {
167 throw std::runtime_error(
"Couldn't call metaDataStop()" );
170 #endif // XAOD_STANDALONE
172 ATH_MSG_WARNING(
"Unknown incident type received in AsgMetaDataTool: " << inc.type() );
◆ initialize()
StatusCode HFORSelectionTool::initialize |
( |
| ) |
|
|
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 57 of file HFORSelectionTool.cxx.
60 ATH_MSG_INFO( __PRETTY_FUNCTION__ <<
": Starting tool initialization ..." );
63 ATH_MSG_INFO( __PRETTY_FUNCTION__ <<
" ************************************ " );
64 ATH_MSG_INFO( __PRETTY_FUNCTION__ <<
" ** THIS TOOL IS UNDER DEVELOPMENT ** " );
65 ATH_MSG_INFO( __PRETTY_FUNCTION__ <<
" ************************************ " );
73 ATH_MSG_INFO( __PRETTY_FUNCTION__ <<
" ** Angular-Based HFOR ** " );
76 ATH_MSG_INFO( __PRETTY_FUNCTION__ <<
" ** Jet-Based HFOR ** " );
78 ATH_MSG_ERROR( __PRETTY_FUNCTION__ <<
" ** HFORStrategy is not known! ** " );
79 return StatusCode::FAILURE;
86 ATH_MSG_INFO( __PRETTY_FUNCTION__ <<
": Initialization done.");
89 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.
◆ inputMetaStore()
AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::inputMetaStore |
( |
| ) |
const |
|
inherited |
Accessor for the input metadata store.
Definition at line 88 of file AsgMetadataTool.cxx.
90 #ifdef XAOD_STANDALONE
92 #else // XAOD_STANDALONE
94 #endif // XAOD_STANDALONE
◆ isSelected()
bool HFORSelectionTool::isSelected |
( |
| ) |
|
|
overridevirtual |
Definition at line 144 of file HFORSelectionTool.cxx.
155 bool selected = true ;
162 const bool isSim = eventInfo->
eventType(xAOD::EventInfo::EventType::IS_SIMULATION);
164 ATH_MSG_DEBUG (__PRETTY_FUNCTION__ <<
"It is a data event... nothing to be done...");
172 std::string truthCollectionName =
"TruthEvents" ;
◆ metaDataStop()
StatusCode asg::AsgMetadataTool::metaDataStop |
( |
| ) |
|
|
protectedvirtualinherited |
◆ 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.
◆ outputMetaStore()
AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::outputMetaStore |
( |
| ) |
const |
|
inherited |
Accessor for the output metadata store.
Definition at line 97 of file AsgMetadataTool.cxx.
99 #ifdef XAOD_STANDALONE
101 #else // XAOD_STANDALONE
103 #endif // XAOD_STANDALONE
◆ 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, top::TopObjectSelection, JetDumper, JetBottomUpSoftDrop, JetRecursiveSoftDrop, JetSoftDrop, JetConstituentsRetriever, JetSubStructureMomentToolsBase, JetSplitter, JetToolRunner, JetPruner, JetPseudojetRetriever, JetTrimmer, AsgHelloTool, and KtDeltaRTool.
Definition at line 131 of file AsgTool.cxx.
◆ renounce()
◆ renounceArray()
◆ setSampleType()
StatusCode HFORSelectionTool::setSampleType |
( |
| ) |
|
|
private |
Definition at line 215 of file HFORSelectionTool.cxx.
226 const bool isSim = eventInfo->
eventType(xAOD::EventInfo::EventType::IS_SIMULATION);
228 ATH_MSG_DEBUG (__PRETTY_FUNCTION__ <<
"It is a data event... nothing to be done...");
229 return StatusCode::SUCCESS;
237 ATH_MSG_WARNING(__PRETTY_FUNCTION__ <<
"mcChannelNumber is 0, falling back to runNumber" ) ;
250 " ) is not an mc15 Alpgen+Pythia6 sample - this tool is useless ") ;
254 ": Good ! This is a valid Alpgen+Pythia6 sample ( " <<
m_sampleName <<
" )" ) ;
256 <<
" , MC Run Number = " << eventInfo->
runNumber() );
261 return StatusCode::SUCCESS;
◆ setUseIncidents()
void asg::AsgMetadataTool::setUseIncidents |
( |
const bool |
flag | ) |
|
|
inlineprotectedinherited |
◆ sysInitialize()
StatusCode asg::AsgMetadataTool::sysInitialize |
( |
| ) |
|
|
virtualinherited |
Function initialising the tool in the correct way in Athena.
This function is used to set up the callbacks from IncidentSvc in Athena at the right time during initialisation, without the user having to do anything special in his/her code.
Reimplemented from AthCommonDataStore< AthCommonMsg< AlgTool > >.
Definition at line 110 of file AsgMetadataTool.cxx.
112 #ifndef XAOD_STANDALONE
119 incSvc->addListener(
this, IncidentType::BeginEvent, 0,
false );
124 #endif // not XAOD_STANDALONE
127 return StatusCode::SUCCESS;
◆ 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_beginInputFileCalled
bool asg::AsgMetadataTool::m_beginInputFileCalled |
|
privateinherited |
Flag helping to discover when the tool misses the opening of the first input file.
Definition at line 126 of file AsgMetadataTool.h.
◆ m_decisionType
HFORType HFORSelectionTool::m_decisionType |
|
private |
◆ m_detStore
◆ m_evtCounterAll
unsigned long int HFORSelectionTool::m_evtCounterAll |
|
private |
◆ m_evtCounterKilled
unsigned long int HFORSelectionTool::m_evtCounterKilled |
|
private |
◆ m_evtStore
◆ m_HFORStrategy
std::string HFORSelectionTool::m_HFORStrategy |
|
private |
◆ m_hforTruth
◆ m_inputMetaStore
◆ m_isConfigured
bool HFORSelectionTool::m_isConfigured |
|
private |
◆ m_matchCone
double HFORSelectionTool::m_matchCone |
|
private |
◆ m_outputMetaStore
◆ m_runConfigFile
std::string HFORSelectionTool::m_runConfigFile |
|
private |
◆ m_sampleName
std::string HFORSelectionTool::m_sampleName |
|
private |
◆ m_sampleRunNumber
unsigned long int HFORSelectionTool::m_sampleRunNumber |
|
private |
◆ m_sampleType
HFORType HFORSelectionTool::m_sampleType |
|
private |
◆ m_truthJetCollectionName
std::string HFORSelectionTool::m_truthJetCollectionName |
|
private |
◆ m_useIncidents
bool asg::AsgMetadataTool::m_useIncidents |
|
privateinherited |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
void setSampleType(unsigned int runNumber)
std::vector< SG::VarHandleKeyArray * > m_vhka
#define ATH_MSG_VERBOSE(x)
int readRunConfig(std::string runConfigFile)
uint32_t runNumber() const
The current event's run number.
virtual void setOwner(IDataHandleHolder *o)=0
uint32_t mcChannelNumber() const
The MC generator's channel number.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
std::string getSampleName()
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
Class describing the basic event information.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
HFORType findOverlap(const xAOD::TruthEventContainer &truthEvent, const xAOD::JetContainer *jets=nullptr)
#define ATH_MSG_WARNING(x)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
void setAngularBasedHFOR()
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
bool eventType(EventType type) const
Check for one particular bitmask value.