Class Algorithm¶
Defined in File Algorithm.h
Inheritance Relationships¶
Base Type¶
public Algorithm
Derived Types¶
public BasicEventSelection
(Class BasicEventSelection)public BJetEfficiencyCorrector
(Class BJetEfficiencyCorrector)public ClusterHistsAlgo
(Class ClusterHistsAlgo)public DebugTool
(Class DebugTool)public ElectronCalibrator
(Class ElectronCalibrator)public ElectronEfficiencyCorrector
(Class ElectronEfficiencyCorrector)public ElectronSelector
(Class ElectronSelector)public HLTJetGetter
(Class HLTJetGetter)public HLTJetRoIBuilder
(Class HLTJetRoIBuilder)public IParticleHistsAlgo
(Class IParticleHistsAlgo)public JetCalibrator
(Class JetCalibrator)public JetSelector
(Class JetSelector)public MessagePrinterAlgo
(Class MessagePrinterAlgo)public METConstructor
(Class METConstructor)public MetHistsAlgo
(Class MetHistsAlgo)public MinixAOD
(Class MinixAOD)public MuonCalibrator
(Class MuonCalibrator)public MuonEfficiencyCorrector
(Class MuonEfficiencyCorrector)public MuonInFatJetCorrector
(Class MuonInFatJetCorrector)public MuonSelector
(Class MuonSelector)public OverlapRemover
(Class OverlapRemover)public PhotonCalibrator
(Class PhotonCalibrator)public PhotonSelector
(Class PhotonSelector)public TauCalibrator
(Class TauCalibrator)public TauEfficiencyCorrector
(Class TauEfficiencyCorrector)public TauJetMatching
(Class TauJetMatching)public TauSelector
(Class TauSelector)public TrackHistsAlgo
(Class TrackHistsAlgo)public TrackSelector
(Class TrackSelector)public TreeAlgo
(Class TreeAlgo)public TrigMatcher
(Class TrigMatcher)public TruthSelector
(Class TruthSelector)public Writer
(Class Writer)
Class Documentation¶
-
class
Algorithm
: public Algorithm¶ This is used by all algorithms within xAODAnaHelpers.
Note
The expectation is that the user does not directly use this class but rather inherits from it.
The main goal of this algorithm class is to standardize how everyone defines an algorithm that plugs into xAODAnaHelpers. A series of common utilities are provided such as
m_className
which defines the class name so we can manage a registrym_instanceRegistry
to keep xAODAnaHelpers as flexible as possible to our users.We expect the user to create a new algorithm, such as a selector for jets:
class JetSelector : public xAH::Algorithm { // ... };
The above example is taken from our implementation in
JetSelector
. Just remember that when you write your initializer, you will be expected to do something like:// this is needed to distribute the algorithm to the workers ClassImp(JetSelector) JetSelector :: JetSelector () : Algorithm("JetSelector"), ... { // ... }
which this class will automatically register all instances of for you. Each instance can have a different algorithm name but will have the same
m_className
so we can track how many references have been made. This is useful for selectors to deal with cutflows, but can be useful for other algorithms that need to know how many times they’ve been instantiated in a single job.Subclassed by BasicEventSelection, BJetEfficiencyCorrector, ClusterHistsAlgo, DebugTool, ElectronCalibrator, ElectronEfficiencyCorrector, ElectronSelector, HLTJetGetter, HLTJetRoIBuilder, IParticleHistsAlgo, JetCalibrator, JetSelector, MessagePrinterAlgo, METConstructor, MetHistsAlgo, MinixAOD, MuonCalibrator, MuonEfficiencyCorrector, MuonInFatJetCorrector, MuonSelector, OverlapRemover, PhotonCalibrator, PhotonSelector, TauCalibrator, TauEfficiencyCorrector, TauJetMatching, TauSelector, TrackHistsAlgo, TrackSelector, TreeAlgo, TrigMatcher, TruthSelector, Writer
Public Functions
-
Algorithm
(std::string className = "Algorithm")¶ Initialization.
- Parameters
className
: This is the name of the class that inherits from :cpp:namespace:~xAH::Algorithm
-
~Algorithm
()¶
-
StatusCode
algInitialize
()¶ Run any initializations commmon to all xAH Algorithms (such as registerInstance). Call this inside
histInitialize
for best results.
-
StatusCode
algFinalize
()¶ Run any finalizations common to all xAH Algorithms (such as unregisterInstance). Call this inside
histFinalize
for best results.
-
StatusCode
parseSystValVector
()¶ Parse string of systematic sigma levels in m_systValVectorString into m_systValVector.
Public Members
-
std::string
m_name
= "UnnamedAlgorithm"¶ All algorithms initialized should have a unique name, to differentiate them at the TObject level.
Note,
GetName()
returns achar*
while this returns astd::string
.
-
bool
m_debug
= false¶ m_debug is being deprecated
-
bool
m_verbose
= false¶ m_verbose is being deprecated
-
MSG::Level
m_msgLevel
= MSG::INFO¶ debug level
-
std::string
m_systName
= ""¶ If running systematics, the name of the systematic
-
float
m_systVal
= 0.0¶ If running systematics, the value to set the systematic to
Note
This will set the systematic to the value \(\pm x\).
-
std::string
m_systValVectorString
= ""¶ If running systematics, you can run multiple points and store them in here. A comma separated list of working points should be given to m_systValVectorString, and then parsed by calling parseSystValVector.
-
std::vector<float>
m_systValVector
¶
-
std::string
m_eventInfoContainerName
= "EventInfo"¶ If the xAOD has a different EventInfo container name, set it here
-
std::string
m_vertexContainerName
= "PrimaryVertices"¶ If the xAOD has a different PrimaryVertex container name, set it here
-
int
m_isMC
= -1¶ This stores the isMC decision, and can also be used to override at the algorithm level to force analyzing MC or not.
Value
Meaning
-1
Default, use eventInfo object to determine if data or mc
0
Treat the input as data
1
Treat the input as MC
-
int
m_isFastSim
= -1¶ This stores the isFastSim decision, and can also be used to override at the algorithm level to force analyzing FastSim or not.
Value
Meaning
-1
Default, use Metadata object to determine if FullSim or FastSim
0
Treat the input as FullSim
1
Treat the input as FastSim
-
bool
m_forceFastSim
= false¶ Flags to force a specific data-type, even if it disagrees with your input
-
bool
m_forceFullSim
= false¶
-
bool
m_forceData
= false¶
-
bool
m_setAFII
= false¶ Backwards compatibility, same as m_forceFastSim
Protected Functions
-
bool
isMC
()¶ Try to determine if we are running over data or MC. The
xAH::Algorithm::m_isMC
can be usedto fix the return value. Otherwise the EventInfo object is queried.
An exception is thrown if the type cannot be determined.
Return Value
Meaning
0
Data
1
MC
-
bool
isFastSim
()¶ Try to determine if we are running over data or MC. The
xAH::Algorithm::m_isFastSim
can be usedto fix the return value. Otherwise the metadata is queried.
An exception is thrown if the type cannot be determined.
Return Value
Meaning
0
FullSim (or Data)
1
FastSim
-
bool
isPHYS
()¶ Determines if using DAOD_PHYS or not.
-
void
registerInstance
()¶ Register the given instance under the moniker
xAH::Algorithm::m_className
This will increase the reference count by 1.
-
int
numInstances
()¶ Return number of instances registered under the moniker
xAH::Algorithm::m_className
This will return the reference count.
Warning
If for some reason the instance wasn’t registered, we spit out a warning.
-
void
unregisterInstance
()¶ Unregister the given instance under the moniker
xAH::Algorithm::m_className
This will decrease the reference count by 1.
Warning
If for some reason the instance wasn’t registered, we spit out a warning.
-
template<typename
T
>
StatusCodecheckToolStore
(const std::string &tool_name)¶ Check whether the input CP tool already exists with this* name in the asg::ToolStore
Depending on the outcome, the content of the map
xAH::Algorithm::m_toolAlreadyUsed
wll be set accordingly.
-
bool
isToolAlreadyUsed
(const std::string &tool_name)¶ Check whether the input CP tool has been already used by any
xAH::Algorithm
in the current job by scanningxAH::Algorithm::m_toolAlreadyUsed
.
-
template<typename
T
>
voidsetToolName
(__attribute__((unused)) asg::AnaToolHandle<T> &handle, __attribute__((unused)) const std::string &name = "") const¶ Sets the name of a tool. If no name is needed, the tool will use the name of the algorithm plus a unique identifier (
xAH::Algorithm::getAddress()
) appended to ensure the tool is unique and effectively private.The tool will not be guaranteed unique if two tools of the same type are created without a name passed in. But this is, at this point, up to the user and a more complex scenario than what this function tries to simplify on its own.
-
std::string
getAddress
() const¶ Return a
std::string
representation ofthis
Protected Attributes
-
std::string
m_className
= "Algorithm"¶ The moniker by which all instances are tracked in
xAH::Algorithm::m_instanceRegistry
-
xAOD::TEvent *
m_event
= nullptr¶ The TEvent object
-
xAOD::TStore *
m_store
= nullptr¶ The TStore object
-