Event

class BasicEventSelection

This algorithm performs the very basic event selection. This should be the first algo in the algo chain. It can create weighted and unweighted cutflow objects to be picked up downstream by other xAH algos, and your own. The selection applied in data only is:

  • GRL (can be turned off)
  • LAr Error
  • Tile Error
  • Core Flag

Note

For MC only, the pileup reweight can also be applied.

In both data and simulation (MC), the following cuts are applied

For derivations, the metadata can be accessed and added to the cutflow for normalization. The parameters to control the trigger are described in this header file. If one wants to write out some of the trigger information into a tree using HelpTreeBase, flags must be set here.

Inherits from xAH::Algorithm

Public Functions

BasicEventSelection()
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

bool m_truthLevelOnly = false

Protection when running on truth xAOD.

bool m_applyGRLCut = false

Apply GRL selection.

std::string m_GRLxml = "xAODAnaHelpers/data15_13TeV.periodAllYear_HEAD_DQDefects-00-01-02_PHYS_StandardGRL_Atlas_Ready.xml"

Path to GRL XML file.

std::string m_GRLExcludeList = ""

Run numbers to skip in GRL.

bool m_cleanPowheg = false

Clean Powheg huge weight.

bool m_reweightSherpa22 = false

Reweight Sherpa 2.2 Samples.

bool m_doPUreweighting = false

Reweight pile-up profile \(\mu\)

bool m_doPUreweightingSys = false
std::string m_lumiCalcFileNames = ""

Comma separated list of filenames.

std::string m_PRWFileNames = ""

Comma separated list of filenames.

std::string m_periodConfig = "auto"

Use Period Configuration or auto.

int m_actualMuMin = -1

The minimum threshold for EventInfo::actualInteractionsPerCrossing()

int m_actualMuMax = -1

The maximum threshold for EventInfo::actualInteractionsPerCrossing()

bool m_savePrescaleDataWeight = false
std::string m_vertexContainerName = "PrimaryVertices"

Name of vertex container.

bool m_applyPrimaryVertexCut = false

Enable to apply a primary vertex cut.

int m_PVNTrack = 2

Minimum number of tracks from the primary vertex (Harmonized Cut)

bool m_applyEventCleaningCut = false
bool m_applyCoreFlagsCut = false
bool m_printBranchList = false
std::string m_triggerSelection = ""

RegEx expression to choose triggers to consider to be cut on with m_applyTriggerCut

std::string m_extraTriggerSelection = ""

Decisions of triggers which are saved but not cut on.

bool m_applyTriggerCut = false

Skip events in which the trigger string m_triggerSelection does not fire

bool m_storeTrigDecisions = false

Save string of fired triggers matching m_triggerSelection

bool m_storePassL1 = false

Save if any L1 trigger fired, e.g. "L1_.*"

bool m_storePassHLT = false

Save if any HLT trigger fired, e.g. "HLT_.*"

bool m_storeTrigKeys = false

Save master, L1, and HLT key.

std::string m_derivationName = ""

The name of the derivation (use this as an override)

bool m_useMetaData = true

Retrieve and save information on DAOD selection.

std::string m_metaDataStreamName = "metadata"
std::string m_cutFlowStreamName = "cutflow"
std::string m_duplicatesStreamName = "duplicates_tree"
bool m_checkDuplicatesData = false

Check for duplicated events in data

bool m_checkDuplicatesMC = false

Check for duplicated events in MC

std::string m_name = "UnnamedAlgorithm"

All algorithms initialized should have a unique name, to differentiate them at the TObject level.

Note, GetName() returns a char* while this returns a std::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 used

to 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 scanning xAH::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 of this

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::set<std::pair<uint32_t, uint32_t>> m_RunNr_VS_EvtNr
asg::AnaToolHandle<IGoodRunsListSelectionTool> m_grl_handle = {"GoodRunsListSelectionTool" , PRIVATETOOL}
asg::AnaToolHandle<CP::IPileupReweightingTool> m_pileup_tool_handle = {"CP::PileupReweightingTool/Pileup" }
asg::AnaToolHandle<TrigConf::ITrigConfigTool> m_trigConfTool_handle = {"TrigConf::xAODConfigTool/xAODConfigTool" , PRIVATETOOL}
asg::AnaToolHandle<Trig::TrigDecisionTool> m_trigDecTool_handle = {"Trig::TrigDecisionTool/TrigDecisionTool" }
asg::AnaToolHandle<IWeightTool> m_reweightSherpa22_tool_handle = {"PMGTools::PMGSherpa22VJetsWeightTool/PMGSherpa22VJetsWeightTool", PRIVATETOOL}
int m_eventCounter
TH1D *m_histEventCount = nullptr
uint64_t m_MD_initialNevents
uint64_t m_MD_finalNevents
double m_MD_initialSumW
double m_MD_finalSumW
double m_MD_initialSumWSquared
double m_MD_finalSumWSquared
TH1D *m_cutflowHist = nullptr
TH1D *m_cutflowHistW = nullptr
int m_cutflow_all
int m_cutflow_duplicates
int m_cutflow_grl
int m_cutflow_lar
int m_cutflow_tile
int m_cutflow_SCT
int m_cutflow_core
int m_cutflow_npv
int m_cutflow_trigger
TH1D *m_el_cutflowHist_1 = nullptr
TH1D *m_el_cutflowHist_2 = nullptr
TH1D *m_mu_cutflowHist_1 = nullptr
TH1D *m_mu_cutflowHist_2 = nullptr
TH1D *m_ph_cutflowHist_1 = nullptr
TH1D *m_tau_cutflowHist_1 = nullptr
TH1D *m_tau_cutflowHist_2 = nullptr
TH1D *m_jet_cutflowHist_1 = nullptr
TH1D *m_trk_cutflowHist_1 = nullptr
TH1D *m_truth_cutflowHist_1 = nullptr
TTree *m_duplicatesTree = nullptr

TTree for duplicates bookeeping

int m_duplRunNumber
long int m_duplEventNumber