Overlap Removal¶
-
class
OverlapRemover
¶ A wrapper of the overlap removal tool in the ASG AssociationUtils package.
The logic of the OLR belongs to the ASG tool itself, and is described extensively in the Analysis Harmonisation Task Force note.
If you wish to apply a custom OLR scheme, please contact the author marco.milesi@cern.ch for detailed instructions.
The idea behind this algorithm is to consistently thread together the inputs from upstream xAODAnaHelpers algorithms based on user’s configuration, handling also the case where systematics on the input physics objects are taken into account. Here follows a usage example.
Consider the simplified scenario where we care only about jets and electrons. Assuming the typical xAODAnaHelpers analysis configuration through
xAH_config
, the analysis workflow could look like the following:c = xAH_config() # ... c.setalg("JetSelector", JetSelectorDict) c.setalg("ElectronSelector", ElectronSelectorDict) # ... c.setalg("OverlapRemover", OverlapRemoverDict) # ...
where each algorithm has the following I/O systematics configuration (via python dictionaries):
JetSelectorDict = { # ... "m_inputAlgo" : "JetCalibrator_Syst", "m_outputAlgo" : "JetSelector_Syst", # ... } ElectronSelectorDict = { # ... "m_inputAlgo" : "ElectronCalibrator_Syst", "m_outputAlgo" : "ElectronSelector_Syst", # ... } OverlapRemoverDict = { # ... "m_inputAlgoJets" : "JetSelector_Syst", # leave empty when not considering jet systematics "m_inputAlgoElectrons" : "ElectronSelector_Syst", # leave empty when not considering electron systematics # ... }
In this way the overlap removal algorithm will be able to correctly work out all the combinatorics, generating output
xAOD
containers for jets and electrons for each input systematics combination to be subsequently used downstream according to the user’s needs. The overlap removal algorithm creates an output systematic list that is a combination of systematics from all input containers.Inherits from xAH::Algorithm
Public Functions
-
OverlapRemover
()¶
-
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
()¶
-
EL::StatusCode
fillObjectCutflow
(const xAOD::IParticleContainer *objCont, const std::string &overlapFlag = "passOR", const std::string &selectFlag = "passSel")¶ Fill the cutflow histograms.
- Parameters
objCont
: ThexAOD
container to be consideredoverlapFlag
: The string identifying objects not overlapping with another object, to be kept (default is"passOR"
)selectFlag
: The string identifying selected objects (default is"passSel"
)
-
EL::StatusCode
executeOR
(const xAOD::ElectronContainer *inElectrons, const xAOD::MuonContainer *inMuons, const xAOD::JetContainer *inJets, const xAOD::PhotonContainer *inPhotons, const xAOD::TauJetContainer *inTaus, SystType syst_type = NOMINAL, std::vector<std::string> *sysVec = nullptr)¶ Function that internally calls the OLR tool for the input containers (and systematics)
- Parameters
inElectrons
: InputxAOD
container for electronsinMuons
: InputxAOD
container for muonsinJets
: InputxAOD
container for jetsinPhotons
: InputxAOD
container for photonsinTaus
: InputxAOD
container for taussyst_type
: The type of object for which input systematics should be considered. Default isNOMINAL
sysVec
: The list of the input systematics for a given object. Must match with the choice ofsyst_type
. Default isnullptr
-
EL::StatusCode
setCutFlowHist
()¶ Setup cutflow histograms.
-
EL::StatusCode
setCounters
()¶ Initialise counters for events/objects.
-
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
-
bool
m_useCutFlow
= true¶ Fill the cutflow histogram(s) for object counting.
-
bool
m_decorateSelectedObjects
¶ Decorate selected objects (the default decoration string is
passSel
)
-
bool
m_createSelectedContainers
¶ Make a copy of input container(s) with selected objects (using
SG::VIEW_ELEMENTS
to be light weight)
-
bool
m_useSelected
= false¶ In the OLR, consider only objects passing a (pre)selection.
-
std::string
m_bTagWP
= ""¶ Use b-tagging decision, set previously with the given decoration name, to remove electrons and muons.
- Note
- This is automatically set by BJetEfficiencyCorrector
-
bool
m_linkOverlapObjects
= true¶ Create a link between overlapped objects.
-
bool
m_useBoostedLeptons
= false¶ Use boosted object working point.
-
bool
m_doEleEleOR
= false¶ Do overlap removal between electrons (HSG2 prescription)
-
std::string
m_outputAlgoSystNames
= "ORAlgo_Syst"¶ Output systematics list container name.
-
std::string
m_inContainerName_Electrons
= ""¶ Input container name.
-
std::string
m_outContainerName_Electrons
= ""¶ Output container name.
-
std::string
m_inputAlgoElectrons
= ""¶ Name of the
std::vector
of systematics coming from the upstream algorithm
-
std::string
m_inContainerName_Muons
= ""¶
-
std::string
m_outContainerName_Muons
= ""¶
-
std::string
m_inputAlgoMuons
= ""¶
-
std::string
m_inContainerName_Jets
= ""¶
-
std::string
m_outContainerName_Jets
= ""¶
-
std::string
m_inputAlgoJets
= ""¶
-
std::string
m_inContainerName_Photons
= ""¶
-
std::string
m_outContainerName_Photons
= ""¶
-
std::string
m_inputAlgoPhotons
= ""¶
-
std::string
m_inContainerName_Taus
= ""¶
-
std::string
m_outContainerName_Taus
= ""¶
-
std::string
m_inputAlgoTaus
= ""¶
-
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 Types
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
-
int
m_numEvent
¶ A counter for the number of processed events.
-
int
m_numObject
¶ A counter for the number of processed objects.
-
int
m_numEventPass
¶ A counter for the number of passed events.
-
int
m_weightNumEventPass
¶ A counter for the number of passed weighted events.
-
int
m_numObjectPass
¶ A counter for the number of passed objects.
-
std::vector<std::string> *
m_vecOutContainerNames
¶ Container to be filled by executeOR with combined systematics.
-
bool
m_useElectrons
= false¶ Consider electrons in the OLR.
This is set to
false
ifm_inContainerName_Electrons
is set as an empty string. Electrons (unlike jets) are considered “optional” objetcs in the OLR.
-
bool
m_useMuons
= false¶ Consider muons in the OLR.
This is set to
false
ifm_inContainerName_Muons
is set as an empty string. Muons (unlike jets) are considered “optional” objects in the OLR.
-
bool
m_usePhotons
= false¶ Consider photons in the OLR.
This is set to
false
ifm_inContainerName_Photons
is set as an empty string. Photons (unlike jets) are considered “optional” objects in the OLR.
-
bool
m_useTaus
= false¶ Consider taus in the OLR.
This is set to
false
ifm_inContainerName_Taus
is set as an empty string. Taus (unlike jets) are considered “optional” objects in the OLR.
-
std::string
m_outAuxContainerName_Electrons
¶ Output auxiliary container name.
-
std::string
m_outAuxContainerName_Muons
¶ Output auxiliary container name.
-
std::string
m_outAuxContainerName_Jets
¶ Output auxiliary container name.
-
std::string
m_outAuxContainerName_Photons
¶ Output auxiliary container name.
-
std::string
m_outAuxContainerName_Taus
¶ Output auxiliary container name.
-
ORUtils::ToolBox
m_ORToolbox
¶ Pointer to the CP Tool which performs the actual OLR.
-
TH1D *
m_el_cutflowHist_1
= nullptr¶ Pointer to the histogram for the electron cutflow.
-
TH1D *
m_mu_cutflowHist_1
= nullptr¶ Pointer to the histogram for the muon cutflow.
-
TH1D *
m_jet_cutflowHist_1
= nullptr¶ Pointer to the histogram for the jet cutflow.
-
TH1D *
m_ph_cutflowHist_1
= nullptr¶ Pointer to the histogram for the photon cutflow.
-
TH1D *
m_tau_cutflowHist_1
= nullptr¶ Pointer to the histogram for the tau cutflow.
-
int
m_el_cutflow_OR_cut
¶
-
int
m_mu_cutflow_OR_cut
¶
-
int
m_jet_cutflow_OR_cut
¶
-
int
m_ph_cutflow_OR_cut
¶
-
int
m_tau_cutflow_OR_cut
¶
-
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
-