Mini-xAOD¶
-
class
MinixAOD
¶ Produce xAOD outputs.
Warning
Care must be taken when managing memory and using copies. You need to think about how copies point to each other and whether you can use shallow copies or deep copies or both.
I can think up the following cases when a user is doing an EL Algorithm:
- input containers in TEvent (simple)
- deep-copied containers in TStore (deep-copy)
- shallow-copied containers in TStore (shallow)
- CDV containers in TStore (cdv)
For the above use-cases, we might produce outputs like so:
- write the input container to the output. This uses
TEvent::copy()
. - write the deep-copied containers to the output. This calls
TStore::retrieve()
and thenTEvent::record()
. - two options when we have shallow-copies:
shallowIO=false
: write to the output as a deep-copy like in the previous optionshallowIO=true
: write to the output as a shallow-copy, but make sure the original container is also written to the output
- make a deep-copy of the ConstDataVector and then move from
TStore
toTEvent
. The problem is that we point to local memory that will not persist when making the CDV.
The trickiest case is with shallow copies because those could be our systematics – and you might want to copy the original container, and only copy over systematics via true shallow copies to conserve memory and space.
Inherits from xAH::Algorithm
Public Functions
-
MinixAOD
()¶
-
EL::StatusCode
setupJob
(EL::Job &job)¶
-
EL::StatusCode
fileExecute
()¶
-
EL::StatusCode
histInitialize
()¶
-
EL::StatusCode
changeInput
(bool firstFile)¶
-
EL::StatusCode
initialize
()¶
-
EL::StatusCode
execute
()¶
-
EL::StatusCode
postExecute
()¶
-
EL::StatusCode
finalize
()¶
-
EL::StatusCode
histFinalize
()¶
-
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_outputFileName
= "out_miniXAOD"¶ name of the output file to use for xAOD dumping
-
bool
m_createOutputFile
= true¶ enable to create the output file for xAOD dumping
-
bool
m_copyFileMetaData
= false¶ copy the file metadata over
-
bool
m_copyTriggerInfo
= false¶ copy the trigger containers and meta data over
-
bool
m_copyCutBookkeeper
= false¶ copy the cutbookkeeper data over
-
std::string
m_simpleCopyKeys
= ""¶ names of containers to copy from the input file
Container names should be space-delimited:
"m_simpleCopyKeys": "EventInfo AntiKt4EMTopoJets"
-
std::string
m_storeCopyKeys
= ""¶ names of containers in the TStore to copy over
Note
This option is appropriate for deep-copied containers.
Container names should be space-delimited:
"m_storeCopyKeys": "BrandNewJetContainer ReclusteredJets"
-
std::string
m_shallowCopyKeys
= ""¶ names of containers that have been shallow-copied
Note
This option is appropriate for shallow-copied containers.
This option is a little different because shallow-copied containers have parent containers. However, there are two options depending on the
setShallowIO
option- True
If this is set to true, you will want to specify the parent container so that we copy it over as well (it is assumed that the parent container is in TStore or TEvent):
"m_shallowCopyKeys": "SCAntiKt4EMTopoJets|AntiKt4EMTopoJets SCMuons|Muons_Presel"
- False
If this is set to false, you will not want to specify the parent container
“m_shallowCopyKeys”: “SCAntiKt4EMTopoJets| SCMuons|”
Warning
Please note that the
shallowIO
option is what determines how the memory is managed. If you run into issues with shallow-copied containers here, make sure you know whether this option was enabled or not before asking for help.Always specify your string in a space-delimited format where pairs are split up by
shallow container name|parent container name
.
-
std::string
m_deepCopyKeys
= ""¶ names of containers that have been shallow-copied
Note
This option is appropriate for view-only containers such as
ConstDataVector
.Here, we will do the deep-copying for you, so that the containers can be correctly recorded into the output. Due to the way view-only containers work, we can’t figure out whether the memory points to a specific parent container we can copy, or to a non-persistable, local (stack) memory. The best option is to just deep-copy and allocate new memory instead:
"m_deepCopyKeys": "AntiKt4EMTopoJets|DeepCopyAntiKt4Jets Muons|DeepCopyMuons"
Always specify your string in a space-delimited format where pairs are split up by
input container name|output container name
.
-
std::string
m_vectorCopyKeys
= ""¶ names of vectors that have container names for its contents
Note
This option is appropriate for groups shallow-copied containers such as when you are dealing with systematics.
Here, we will do the copying for you by retrieving the vector of container names and copy each one over. See how
MinixAOD::m_shallowCopyKeys
works.Always specify your string in a space-delimited format where pairs are split up by
vector name|parent container name
.
-
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
-
int
m_isMC
= -1¶ This is an 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
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
-
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>
-
StatusCode
checkToolStore
(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>
-
void
setToolName
(asg::AnaToolHandle<T> &handle, std::string name = "") const¶ Note: This function does nothing in release 21.1! The native private tool mechanism is used instead.
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
Private Members
-
std::vector<std::string>
m_simpleCopyKeys_vec
¶ A vector of containers that are in TEvent that just need to be written to the output.
-
std::vector<std::pair<std::string, std::string>>
m_shallowCopyKeys_vec
¶ A vector of (container name, parent name) pairs for shallow-copied objects if parent is empty, deep-copy it.
-
std::vector<std::pair<std::string, std::string>>
m_deepCopyKeys_vec
¶ A vector of (in container, output container) that need to be deep-copied first before moving to TStore.
-
std::vector<std::pair<std::string, std::string>>
m_vectorCopyKeys_vec
¶ A vector of (name of vector of container names, parent name) pairs for shallow-copied objects (like systematics) if parent is empty, deep-copy it.
-
std::vector<std::string>
m_copyFromStoreToEventKeys_vec
¶ A vector of containers (and aux-pairs) in TStore to record in TEvent.
-
xAODMaker::FileMetaDataTool *
m_fileMetaDataTool
= nullptr¶ Pointer for the File MetaData Tool.
-
xAODMaker::TriggerMenuMetaDataTool *
m_trigMetaDataTool
= nullptr¶ Pointer for the TriggerMenu MetaData Tool.
-
xAOD::CutBookkeeperContainer *
m_outputCBKContainer
= nullptr¶ Pointer for our CutBookkeeper.
-
xAOD::CutBookkeeperAuxContainer *
m_outputCBKContainer_aux
= nullptr¶
-
xAOD::CutBookkeeperContainer *
m_outputInCBKContainer
= nullptr¶
-
xAOD::CutBookkeeperAuxContainer *
m_outputInCBKContainer_aux
= nullptr¶
-
xAOD::CutBookkeeper *
m_outputCBK
= nullptr¶