ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
RatesEmulationExample Class Reference

#include <RatesEmulationExample.h>

Inheritance diagram for RatesEmulationExample:
Collaboration diagram for RatesEmulationExample:

Public Types

enum  Method_t { kMANUAL, kAUTO, kEXISTING }
 Method by which the trigger pass/fail decision is calculated. More...
 

Public Member Functions

 RatesEmulationExample (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~RatesEmulationExample ()
 
virtual StatusCode ratesInitialize () override
 To be implemented by the user. More...
 
virtual StatusCode ratesExecute () override
 To be implemented by the user. More...
 
virtual StatusCode ratesFinalize () override
 To be implemented by the user. More...
 
StatusCode newTrigger (const std::string &name, const double prescale=1., const double expressPrescale=-1., const std::string &seedName="", const double seedPrecale=1., const std::string &groups="", const Method_t method=kMANUAL, const ExtrapStrat_t extrapolation=kLINEAR)
 Version of newTrigger which accepts a set of group names rather than a comma separated string. More...
 
StatusCode newTrigger (const std::string &name, const double prescale=1., const double expressPrescale=-1., const std::string &seedName="", const double seedPrecale=1., const std::set< std::string > &groups=std::set< std::string >(), const Method_t method=kMANUAL, const ExtrapStrat_t extrapolation=kLINEAR)
 Register a new trigger for emulation. More...
 
StatusCode newScanTrigger (const std::string &name, const double thresholdMin, const double thresholdMax, const uint32_t thresholdBins=100, const RatesScanTrigger::TriggerBehaviour_t behaviour=RatesScanTrigger::TriggerBehaviour_t::kTriggerBelowThreshold, const double prescale=1., const std::string &seedName="", const double seedPrecale=1., const Method_t method=kMANUAL, const ExtrapStrat_t extrapolation=kLINEAR)
 Register a new threshold scan trigger which plots rate as a function of some dependent variable. More...
 
StatusCode newScanTrigger (const std::string &name, const std::vector< double > &thresholdBinEdges, const RatesScanTrigger::TriggerBehaviour_t behaviour=RatesScanTrigger::TriggerBehaviour_t::kTriggerAboveThreshold, const double prescale=1., const std::string &seedName="", const double seedPrecale=1., const Method_t method=kMANUAL, const ExtrapStrat_t extrapolation=kLINEAR)
 Version of newScanTrigger which takes a vector of bin edges. More...
 
StatusCode addAllExisting ()
 Register all existing triggers in the AOD into the rates algorithm. More...
 
StatusCode addExisting (const std::string &pattern)
 Register some existing triggers based on wild-card match, e.g. More...
 
StatusCode setTriggerDesicison (const std::string &name, const bool triggerIsPassed=true, const bool triggerIsActive=true)
 Set the pass/fail decision for an item. More...
 
StatusCode setTriggerDesicison (const std::string &name, const double threshold)
 Set the pass threshold for a Scan Trigger item. More...
 
void setTargetLumiMu (const double lumi, const double mu)
 Set the target instantaneous luminosity and mu. More...
 
void setTargetLumiBunches (const double lumi, const int32_t bunches)
 Set the target instantaneous luminosity and number of bunches. More...
 
void setTargetMuBunches (const double mu, const int32_t bunches)
 Set the target mu and number of bunches. More...
 
void setTargetLumi (const double lumi)
 Set the target instantaneous luminosity. More...
 
void setTargetMu (const double mu)
 Set the target pileup. More...
 
void setExponentialMuScalingFactor (const double f)
 Set the exponential scaling factor for relevant chains. More...
 
virtual StatusCode sysInitialize () override
 Function initialising the tool in the correct way in Athena. More...
 
virtual StatusCode sysExecute (const EventContext &) override
 override to do firstEvent method More...
 
template<typename T >
StatusCode retrieveMetadata (const std::string &folder, const std::string &key, T &out)
 Helper function to access IOVMetaDataContainer information helped in the MetaDataStore. More...
 
template<typename T >
StatusCode retrieveMetadata (const std::string &folder, const std::string &key, T &out, const IOVTime &time, int channel=-1)
 Helper function to access IOVMetaDataContainer information held in InputMetaDataStore, but will check IOVTime. More...
 
const ServiceHandle< ITHistSvc > & histSvc () const
 The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a pointer to the THistSvc. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. 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, V, H > &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
 

Protected Member Functions

virtual StatusCode initialize ()
 Get the trigger decision tool and set up global groups. More...
 
StatusCode pass_HstpFilter (bool &pass)
 Boolean indicating if the event passes the HS-softer-than-PU (HSTP) filter. More...
 
const std::unordered_map< std::string, std::unique_ptr< RatesTrigger > > & getTriggerMap () const
 
void updateEvtStore (Gaudi::Details::PropertyBase &prop)
 
virtual void handle (const Incident &inc) override
 Function receiving incidents from IncidentSvc/TEvent Experts can override but they should ensure they add AthAnalysisAlgorithm::handle(); to the end of their own implementation. More...
 
virtual StatusCode beginInputFile ()
 Function called when a new input file is opened user can read input metadata from inputMetaStore() More...
 
virtual StatusCode endInputFile ()
 Function called as an input file is being closed. More...
 
virtual StatusCode metaDataStop ()
 Function called before finalize user can read output metadata from outputMetaStore() More...
 
virtual StatusCode firstExecute ()
 Function called when first execute is encountered user can read event information with evtStore() More...
 
virtual TFile * currentFile (const char *evtSelName="EventSelector") final
 Function returning the TFile pointer of the currently open file of the given EventSelector (in athena jobs this defaults to "EventSelector") More...
 
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 
StatusCode configAthHistogramming (const ServiceHandle< ITHistSvc > &histSvc, const std::string &prefix, const std::string &rootDir, const std::string &histNamePrefix, const std::string &histNamePostfix, const std::string &histTitlePrefix, const std::string &histTitlePostfix)
 To be called by the derived classes to fill the internal configuration. More...
 
TH1 * bookGetPointer (const TH1 &hist, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms. More...
 
TH1 * bookGetPointer (TH1 *hist, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms. More...
 
TH1 * bookGetPointer (TH1 &histRef, std::string tDir="", std::string stream="")
 Simplify the booking and registering (into THistSvc) of histograms. More...
 
TTree * bookGetPointer (const TTree &treeRef, std::string tDir="", std::string stream="")
 Simplify the booking and registering (into THistSvc) of TTrees. More...
 
TGraph * bookGetPointer (const TGraph &graphRef, std::string tDir="", std::string stream="")
 Simplify the booking and registering (into THistSvc) of TGraphs. More...
 
TEfficiency * bookGetPointer (const TEfficiency &eff, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency. More...
 
TEfficiency * bookGetPointer (TEfficiency *eff, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency. More...
 
TEfficiency * bookGetPointer (TEfficiency &effRef, std::string tDir="", std::string stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency. More...
 
StatusCode book (const TH1 &hist, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms. More...
 
StatusCode book (TH1 *hist, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms. More...
 
StatusCode book (TH1 &histRef, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms. More...
 
StatusCode book (const TTree &treeRef, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TTrees. More...
 
StatusCode book (const TGraph &graphRef, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TGraphs. More...
 
StatusCode book (const TEfficiency &eff, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency. More...
 
StatusCode book (TEfficiency *eff, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency. More...
 
StatusCode book (TEfficiency &effRef, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency. More...
 
TH1 * hist (const std::string &histName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered histograms of any type. More...
 
TH2 * hist2d (const std::string &histName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered 2-d histograms. More...
 
TH3 * hist3d (const std::string &histName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered 3-d histograms. More...
 
TTree * tree (const std::string &treeName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered TTrees. More...
 
TGraph * graph (const std::string &graphName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered TGraphs. More...
 
TEfficiency * efficiency (const std::string &effName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered TEfficiency. More...
 

Protected Attributes

double m_linearLumiFactor
 
WeightingValuesSummary_t m_weightingValues
 Possible weighting & lumi extrapolation values for the current event. More...
 
double m_ratesDenominator
 How much walltime is seen by the algorithm. More...
 
Gaudi::Property< bool > m_doHistograms {this, "DoHistograms", true, "Switch on histogram output of rate vs. mu and position in train."}
 
Gaudi::Property< bool > m_doMultiSliceDiJet {this, "DoMultiSliceDiJet", false, "Enable the HS-softer-than-PU (HSTP) filter; reweight the Slices according to Jet/ETMiss procedure; recommended by PMG for di-jet slices."}
 
std::unordered_map< std::string, std::unique_ptr< RatesTrigger > > m_triggers
 All individual triggers (L1 or HLT) More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 
typedef uint32_t hash_t
 typedef for the internal hash More...
 
typedef std::map< const hash_t, TH1 * > HistMap_t
 Typedef for convenience. More...
 
typedef std::map< const hash_t, TEfficiency * > EffMap_t
 Typedef for convenience. More...
 
typedef std::map< const hash_t, TTree * > TreeMap_t
 Typedef for convenience. More...
 
typedef std::map< const hash_t, TGraph * > GraphMap_t
 Typedef for convenience. More...
 

Private Member Functions

virtual StatusCode initialize_extra_content () override
 Initialization of additional payload for inherited classes. More...
 
virtual StatusCode execute ()
 In first call - register all triggers. More...
 
virtual StatusCode finalize ()
 Print rates. More...
 
StatusCode populateTriggers ()
 Register all triggers to emulate. More...
 
StatusCode executeTrigDecisionToolTriggers ()
 Internal call to get the pass/fail for all TDT triggers. More...
 
StatusCode executeTriggerEmulation ()
 Internal call to get the pass/fail for all automatically emulated triggers. More...
 
StatusCode checkExistingTrigger (const std::string &name, const std::string &seedName)
 Internal function to check if a supplied HLT trigger and L1 seed match what is stored in the AOD config. More...
 
StatusCode checkGotTDT ()
 Internal check that the TDT is fetched. More...
 
void printInputSummary () const
 Print the input data instantaneous luminosity, mu and number of bunches. More...
 
void printStatistics () const
 Print some extra statistics on events processed. More...
 
void printTarget () const
 Print the target instantaneous luminosity, mu and number of bunches. More...
 
void writeMetadata ()
 Write to outpute tree (if any) the metadata needed downstream. More...
 
bool isCPS (const std::string &group) const
 String match coherent prescale groups. More...
 
bool isRandomSeed (const std::string &me, const std::string &seed) const
 String match random L1 items. More...
 
uint32_t getLevel (const std::string &name) const
 String match to a trigger level. More...
 
bool isZero (double v) const
 Helper function for floating point subtraction. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 
void buildBookingString (std::string &bookingString, std::string &histName, std::string &tDir, std::string &stream, bool usePrefixPostfix=false)
 Method to build individual booking string. More...
 
void myReplace (std::string &str, const std::string &oldStr, const std::string &newStr)
 Helper method to replace sub-string. More...
 
hash_t hash (const std::string &histName) const
 Method to calculate a 32-bit hash from a string. More...
 

Private Attributes

Gaudi::Property< float > m_lumi {this, "TargetLuminosity", 2e34, "Targer inst. luminosity, assuming full ring."}
 
SG::ReadHandleKey< xAOD::JetContainerm_jet_RHKey {this, "JetsKey", "AntiKt4EMTopoJets", "Key for the jet collection"}
 
SG::ReadHandleKey< xAOD::ElectronContainerm_electron_RHKey {this, "ElectronsKey", "Electrons", "Key for the electrons collection"}
 
std::unordered_map< std::string, std::unique_ptr< RatesScanTrigger > > m_scanTriggers
 All individual rates-scan triggers (L1 or HLT) More...
 
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_groups
 All regular and CPS groups. More...
 
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_globalGroups
 Big (master) groups which do the OR of the whole menu. More...
 
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_uniqueGroups
 Groups used to obtain unique rates for chains. More...
 
std::unordered_set< RatesTrigger * > m_activatedTriggers
 Triggers which were changed & hence need to be reset at the event end. More...
 
std::unordered_set< RatesTrigger * > m_expressTriggers
 Triggers with non-zero express PS, used to print them at the end. More...
 
std::unordered_set< RatesGroup * > m_activeGroups
 All groups which are enabled (PS >= 1) More...
 
std::unordered_map< size_t, double > m_lowestPrescale
 Lowest prescale within a CPS group, key is the hash of the CPS group name. More...
 
std::vector< std::string > m_autoTriggers
 List of triggers which it is up to us to the algorithm to work out the pass/fail for. More...
 
std::unordered_map< std::string, const Trig::ChainGroup * > m_existingTriggers
 Map of triggers which we ask the TDT ChainGroup for the pass/fail. More...
 
std::unordered_map< std::string, std::string > m_lowerTrigger
 Map of triggers lower chain, to tell if a HLT trigger ran or not. More...
 
std::vector< std::vector< std::string > > m_hltChainIDGroup
 
std::vector< std::vector< std::string > > m_l1ItemID
 
const std::string m_l1GroupName = "L1"
 
const std::string m_l2GroupName = "HLT"
 
const std::string m_expressGroupName = "Express"
 
ToolHandle< IEnhancedBiasWeighterm_enhancedBiasRatesTool {this, "EnhancedBiasRatesTool", "EnhancedBiasWeighter/EnhancedBiasRatesTool"}
 
ToolHandle< Trig::TrigDecisionToolm_tdt {this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool"}
 
ServiceHandle< TrigConf::ITrigConfigSvcm_configSvc {this, "TrigConfigSvc", "TrigConf::xAODConfigSvc"}
 
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this, "EventInfo", "EventInfo", "EventInfo name"}
 
SG::ReadHandleKey< xAOD::JetContainerm_truthHS_jets_RHKey {this, "TruthHSJetsKey", "AntiKt4TruthJets", "Key for the hard scatter truth jet collection"}
 
SG::ReadHandleKey< xAOD::JetContainerm_truthPU_jets_RHKey {this, "truthPUJetsKey", "InTimeAntiKt4TruthJets", "Key for the pileup jet collection"}
 
Gaudi::Property< double > m_expoScalingFactor {this, "ExpoScalingFactor", 0.1, "Optional. Exponential factor if using exponential-mu rates scaling."}
 
Gaudi::Property< double > m_inelasticCrossSection {this, "InelasticCrossSection", 8e-26, "Inelastic cross section in units cm^2. Default 80 mb at 13 TeV."}
 
Gaudi::Property< bool > m_doUniqueRates {this, "DoUniqueRates", false, "Calculate unique rates for all chains (slow). Requires DoGlobalGroups=True too."}
 
Gaudi::Property< bool > m_doGlobalGroups {this, "DoGlobalGroups", false, "Calculate total rates for each trigger level."}
 
Gaudi::Property< bool > m_doTriggerGroups {this, "DoTriggerGroups", false, "Calculate total rates for each group of triggers."}
 
Gaudi::Property< bool > m_doExpressRates {this, "DoExpressRates", false, "Calculate total rates for the express stream."}
 
Gaudi::Property< bool > m_useBunchCrossingData {this, "UseBunchCrossingData", true, "BunchCrossing data requires CONDBR2 access. Can be disabled here if this is a problem."}
 
Gaudi::Property< bool > m_currentEventIsUnbiased
 If the current event was triggered online by RDx or not. More...
 
Gaudi::Property< bool > m_enableLumiExtrapolation {this, "EnableLumiExtrapolation", true, "If false then no extrapolation in L, N_bunch or <mu> will be performed.."}
 
Gaudi::Property< uint32_t > m_vetoStartOfTrain {this, "VetoStartOfTrain", 0, "How many BCID to veto at the start of a bunch train."}
 
Gaudi::Property< std::map< std::string, std::map< std::string, double > > > m_prescalesJSON {this, "PrescalesJSON", {}, "Optional JSON of prescales from the TrigMenuRuleBook to apply."}
 
Gaudi::Property< std::string > m_histogramSuffix {this, "histogramSuffix", "", "Optional suffix to add to the name of the rate denominator histogram."}
 
double m_targetMu
 What pileup level the prediction is targeting. More...
 
double m_targetBunches
 How many bunches the prediction is targeting. More...
 
double m_targetLumi
 What instantaneous luminosity the prediction is targeting. More...
 
uint32_t m_runNumber
 What is the RunNumber. More...
 
uint32_t m_eventCounter
 Count how many events processed. More...
 
double m_weightedEventCounter
 Count how many weighted events were processed. More...
 
TH1D * m_scalingHist
 One-bin histogram to store the normalisation of the sample, for use in later combinations. More...
 
TH1D * m_bcidHist
 Histogram of the BCIDs distribution of the processing. More...
 
TTree * m_metadataTree
 Used to write out some metadata needed by post-processing (e.g. More...
 
ServiceHandle< StoreGateSvcm_inputMetaStore
 Object accessing the input metadata store. More...
 
ServiceHandle< StoreGateSvcm_outputMetaStore
 Object accessing the output metadata store. More...
 
TFile * m_currentFile {nullptr}
 
bool m_doneFirstEvent {false}
 
ServiceHandle< ITHistSvc > m_histSvc
 Default constructor: AthHistogramAlgorithm();. More...
 
std::string m_prefix
 Name of the ROOT output stream (file) More...
 
std::string m_rootDir
 Name of the ROOT directory. More...
 
std::string m_histNamePrefix
 The prefix for the histogram THx name. More...
 
std::string m_histNamePostfix
 The postfix for the histogram THx name. More...
 
std::string m_histTitlePrefix
 The prefix for the histogram THx title. More...
 
std::string m_histTitlePostfix
 The postfix for the histogram THx title. More...
 
DataObjIDColl m_extendedExtraObjects
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 
HistMap_t m_histMap
 The map of histogram names to their pointers. More...
 
EffMap_t m_effMap
 The map of histogram names to their pointers. More...
 
TreeMap_t m_treeMap
 The map of TTree names to their pointers. More...
 
GraphMap_t m_graphMap
 The map of TGraph names to their pointers. More...
 
std::string m_streamName
 Name of the ROOT output stream (file) More...
 
std::string m_name
 Instance name. More...
 
MsgStream m_msg
 Cached Message Stream. More...
 

Detailed Description

Definition at line 10 of file RatesEmulationExample.h.

Member Typedef Documentation

◆ EffMap_t

typedef std::map< const hash_t, TEfficiency* > AthHistogramming::EffMap_t
privateinherited

Typedef for convenience.

Definition at line 205 of file AthHistogramming.h.

◆ GraphMap_t

typedef std::map< const hash_t, TGraph* > AthHistogramming::GraphMap_t
privateinherited

Typedef for convenience.

Definition at line 219 of file AthHistogramming.h.

◆ hash_t

typedef uint32_t AthHistogramming::hash_t
privateinherited

typedef for the internal hash

Definition at line 169 of file AthHistogramming.h.

◆ HistMap_t

typedef std::map< const hash_t, TH1* > AthHistogramming::HistMap_t
privateinherited

Typedef for convenience.

Definition at line 198 of file AthHistogramming.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

◆ TreeMap_t

typedef std::map< const hash_t, TTree* > AthHistogramming::TreeMap_t
privateinherited

Typedef for convenience.

Definition at line 212 of file AthHistogramming.h.

Member Enumeration Documentation

◆ Method_t

Method by which the trigger pass/fail decision is calculated.

Via manual or automated emulator or using the Trigger Decision Tool for a pre-existing item.

Enumerator
kMANUAL 

The pass/fail decision is evaluated by the user and supplied per event using setTriggerDesicison.

kAUTO 

The pass/fail decision is automatically emulated per event based on decoding the trigger name.

kEXISTING 

The pass/fail decision is taken from the Trigger Decision Tool for an existing trigger.

Definition at line 43 of file RatesAnalysisAlg.h.

43  {
44  kMANUAL,
45  kAUTO,
46  kEXISTING
47  };

Constructor & Destructor Documentation

◆ RatesEmulationExample()

RatesEmulationExample::RatesEmulationExample ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 10 of file RatesEmulationExample.cxx.

10  : RatesAnalysisAlg(name, pSvcLocator) {
11 }

◆ ~RatesEmulationExample()

RatesEmulationExample::~RatesEmulationExample ( )
virtual

Definition at line 13 of file RatesEmulationExample.cxx.

13  {
14 }

Member Function Documentation

◆ addAllExisting()

StatusCode RatesAnalysisAlg::addAllExisting ( )
inherited

Register all existing triggers in the AOD into the rates algorithm.

Definition at line 189 of file RatesAnalysisAlg.cxx.

189  {
191  return addExisting(".*");
192 }

◆ addExisting()

StatusCode RatesAnalysisAlg::addExisting ( const std::string &  pattern)
inherited

Register some existing triggers based on wild-card match, e.g.

"L1_.*" for all L1.

Parameters
patternWild-card string to match in trigger name

Definition at line 198 of file RatesAnalysisAlg.cxx.

198  {
199  // Check we have the TDT
201 
202  const auto& triggers = m_tdt->getListOfTriggers(pattern);
203  ATH_MSG_INFO("Read " << triggers.size() << " triggers from AOD.");
204 
205  // Check if chain was disabled in athena job
206  const bool runWithPrescaleJSON = !m_prescalesJSON.value().empty();
207  const TrigConf::HLTPrescalesSet& hltPrescalesSet = m_configSvc->hltPrescalesSet(Gaudi::Hive::currentContext());
208  for( auto & p : hltPrescalesSet.data().get_child("prescales") ) {
209  if ((!m_prescalesJSON.value().count(p.first) && !runWithPrescaleJSON) || hltPrescalesSet.prescale(p.first).prescale < 0){
210  m_prescalesJSON[p.first]["prescale"] = (hltPrescalesSet.prescale(p.first).enabled ? hltPrescalesSet.prescale(p.first).prescale : -1);
211  m_prescalesJSON[p.first]["prescale_express"] = (hltPrescalesSet.prescale_express(p.first).enabled ? hltPrescalesSet.prescale_express(p.first).prescale : -1);
212  if (hltPrescalesSet.prescale(p.first).prescale < 0){
213  ATH_MSG_WARNING("Trigger " << p.first << " disabled in supplied AOD file. DISABLING");
214  }
215  }
216  }
217 
218  const TrigConf::L1PrescalesSet& l1PrescalesSet = m_configSvc->l1PrescalesSet(Gaudi::Hive::currentContext());
219  for( auto & p : l1PrescalesSet.prescales() ) {
220  if ((!m_prescalesJSON.value().count(p.first) && !runWithPrescaleJSON) || p.second.prescale < 0){
221  m_prescalesJSON[p.first]["prescale"] = p.second.prescale;
222 
223  if (p.second.prescale < 0){
224  ATH_MSG_WARNING("Trigger " << p.first << " disabled in supplied AOD file. DISABLING");
225  }
226  }
227  }
228 
229  // Iterate over the triggers and add them
230  for (const auto& trigger : triggers) {
231  ATH_MSG_DEBUG("Considering " << trigger );
232  const bool isHLT = (getLevel(trigger) == 2);
233  const auto trigConf = (isHLT ? m_tdt->ExperimentalAndExpertMethods().getChainConfigurationDetails(trigger) : nullptr);
234  if (isHLT && !trigConf) {
235  ATH_MSG_ERROR("Problem with TDT trig conf - cannot get details for " << trigger << ", will be ignored.");
236  continue;
237  }
238  const std::string lowerName = (isHLT ? trigConf->lower_chain_name() : "");
239  std::set<std::string> groups = std::set<std::string>(); // To be filled later from the HLTMenu
240 
241  if (isHLT) {
242  // If this is a HLT item, we require it to be seeded by at most one item. This allows us to use a factorising rates algorithm
243  if (lowerName.find(",") != std::string::npos) {
244  ATH_MSG_WARNING("Can not add " << trigger << " due to multiple L1 seeds." );
245  continue;
246  }
247 
248  if (lowerName.empty()) {
249  ATH_MSG_WARNING("Can not add " << trigger << " due to multiple L1 seeds: L1All" );
250  continue;
251  }
252 
253  // Check it also wasn't disabled in the reprocessing (e.g. auto prescaled out in a perf or tightperf menu)
254  if (trigConf->prescale() < 1.) { // Note this prescale is from ATHENA
255  ATH_MSG_DEBUG("Will not add " << trigger << ", it was disabled in the reprocessing.");
256  continue;
257  }
258 
259  ATH_CHECK(m_configSvc.isValid());
260  const TrigConf::HLTMenu& hltMenu = m_configSvc->hltMenu(Gaudi::Hive::currentContext());
261 
262  TrigConf::HLTMenu::const_iterator chain = std::find_if(hltMenu.begin(), hltMenu.end(), [&] (const TrigConf::Chain& c) {return c.name() == trigger;});
263  if (chain == hltMenu.end()){
264  ATH_MSG_WARNING("Chain " << trigger << " not found in the menu!");
265  continue;
266  }
267 
268  std::vector<std::string> chainGroups = (*chain).groups();
269  std::vector<std::string> chainStreams = (*chain).streams();
270 
271  ATH_MSG_DEBUG(" chain " << trigger << " has " << chainGroups.size() << " groups and " << chainStreams.size() << " streams");
272 
273  groups.insert(chainGroups.begin(), chainGroups.end());
274  for (const std::string& stream : chainStreams){
275  groups.insert("STREAM:" + stream );
276  }
277  }
278 
279  // Get the prescale, express prescale and lower prescale. Note these prescales are from SUPPLIED JSON.
280  double prescale = 1., expressPrescale = -1., lowerPrescale = 1.;
281  if (m_prescalesJSON.size() != 0) {
282  if (m_prescalesJSON.value().count(trigger) == 0) {
283  ATH_MSG_WARNING("Unable to find " << trigger << " in supplied JSON. DISABLING." );
284  prescale = 0.;
285  } else {
286  prescale = m_prescalesJSON[trigger]["prescale"];
287  expressPrescale = m_prescalesJSON[trigger]["prescale_express"];
288  }
289  if (isHLT) {
290  if (m_prescalesJSON.value().count(lowerName) == 0) {
291  ATH_MSG_WARNING("Unable to find " << trigger << "'s seed, " << lowerName << ", in supplied JSON. DISABLING." );
292  lowerPrescale = 0.;
293  } else {
294  lowerPrescale = m_prescalesJSON[lowerName]["prescale"];
295  }
296  }
297  }
298 
299 
300  // We now have all the info needed to add this trigger
301  ATH_MSG_DEBUG("Registering existing trigger " << trigger << " for automatic TDT based rates prediction." );
302  ATH_CHECK( newTrigger(trigger, prescale, expressPrescale, lowerName, lowerPrescale, groups, kEXISTING) );
303  }
304 
305  for (const auto& trigger : m_prescalesJSON) {
306  if (trigger.second.at("prescale") > 0 && std::find(triggers.begin(), triggers.end(), trigger.first) == triggers.end()) {
307  ATH_MSG_WARNING( "Trigger " << trigger.first << " in supplied JSON is NOT AVAILABLE in the supplied AOD file.");
308  }
309  }
310 
311  return StatusCode::SUCCESS;
312 }

◆ beginInputFile()

StatusCode AthAnalysisAlgorithm::beginInputFile ( )
protectedvirtualinherited

Function called when a new input file is opened user can read input metadata from inputMetaStore()

Dummy implementation that can be overridden by the derived tool.

Reimplemented in MuonVal::MetaDataAlg.

Definition at line 114 of file AthAnalysisAlgorithm.cxx.

114  {
115 
116  // Return gracefully:
117  return StatusCode::SUCCESS;
118 }

◆ book() [1/8]

StatusCode AthHistogramming::book ( const TEfficiency &  eff,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 335 of file AthHistogramming.h.

336 {
337  // We need to create a non-const clone
338  TEfficiency* effClone = dynamic_cast< TEfficiency* >( eff.Clone() );
339  if ( !effClone ) {
340  m_msg << MSG::ERROR << "Couldn't create a TEfficiency clone" << endmsg;
341  return StatusCode::FAILURE;
342  }
343  return this->book( *effClone, tDir, stream );
344 }

◆ book() [2/8]

StatusCode AthHistogramming::book ( const TGraph &  graphRef,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TGraphs.

◆ book() [3/8]

StatusCode AthHistogramming::book ( const TH1 &  hist,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 303 of file AthHistogramming.h.

304 {
305  // We need to create a non-const clone
306  TH1* histClone = dynamic_cast< TH1* >( hist.Clone() );
307  if ( !histClone ) {
308  m_msg << MSG::ERROR << "Couldn't create a TH1 clone" << endmsg;
309  return StatusCode::FAILURE;
310  }
311  return this->book( *histClone, tDir, stream );
312 }

◆ book() [4/8]

StatusCode AthHistogramming::book ( const TTree &  treeRef,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TTrees.

Definition at line 403 of file AthHistogramming.h.

404 {
405  // Call the other Book method and see if it returns a valid pointer
406  TTree* treePointer = this->bookGetPointer( treeRef, tDir, stream );
407  if ( treePointer )
408  {
409  return StatusCode::SUCCESS;
410  }
411  else
412  {
413  return StatusCode::FAILURE;
414  }
415 }

◆ book() [5/8]

StatusCode AthHistogramming::book ( TEfficiency &  effRef,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 356 of file AthHistogramming.h.

357 {
358  // Call the other Book method and see if it returns a valid pointer
359  TEfficiency* effPointer = this->bookGetPointer( effRef, tDir, stream );
360  if ( !effPointer ) {
361  m_msg << MSG::ERROR << "Couldn't book a TEfficiency" << endmsg;
362  return StatusCode::FAILURE;
363  }
364  return StatusCode::SUCCESS;
365 }

◆ book() [6/8]

StatusCode AthHistogramming::book ( TEfficiency *  eff,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 346 of file AthHistogramming.h.

347 {
348  if ( !eff ) {
349  m_msg << MSG::ERROR << "Got a zero pointer to a TEfficiency" << endmsg;
350  return StatusCode::FAILURE;
351  }
352  return this->book( *eff, tDir, stream );
353 }

◆ book() [7/8]

StatusCode AthHistogramming::book ( TH1 &  histRef,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 324 of file AthHistogramming.h.

325 {
326  // Call the other Book method and see if it returns a valid pointer
327  TH1* histPointer = this->bookGetPointer( histRef, tDir, stream );
328  if ( !histPointer ) {
329  m_msg << MSG::ERROR << "Couldn't book a TH1" << endmsg;
330  return StatusCode::FAILURE;
331  }
332  return StatusCode::SUCCESS;
333 }

◆ book() [8/8]

StatusCode AthHistogramming::book ( TH1 *  hist,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 314 of file AthHistogramming.h.

315 {
316  if ( !hist ) {
317  m_msg << MSG::ERROR << "Got a zero pointer to a TH1" << endmsg;
318  return StatusCode::FAILURE;
319  }
320  return this->book( *hist, tDir, stream );
321 }

◆ bookGetPointer() [1/8]

TEfficiency * AthHistogramming::bookGetPointer ( const TEfficiency &  eff,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 281 of file AthHistogramming.h.

282 {
283  // We need to create a non-const clone
284  TEfficiency* histClone = dynamic_cast< TEfficiency* >( hist.Clone() );
285  if ( !histClone ) {
286  m_msg << MSG::ERROR << "Couldn't create a TEfficiency clone in bookGetPointer" << endmsg;
287  return 0;
288  }
289  return this->bookGetPointer( *histClone, tDir, stream );
290 
291 }

◆ bookGetPointer() [2/8]

TGraph * AthHistogramming::bookGetPointer ( const TGraph &  graphRef,
std::string  tDir = "",
std::string  stream = "" 
)
protectedinherited

Simplify the booking and registering (into THistSvc) of TGraphs.

Definition at line 427 of file AthHistogramming.cxx.

428 {
429  // Get a pointer
430  const TGraph* graphPointer = &graphRef;
431 
432  // Check that we got a valid pointer
433  if ( !graphPointer )
434  {
435  m_msg << MSG::WARNING
436  << "We got an invalid TGraph pointer in the BookGetPointer(TGraph*) method of the class" << m_name
437  << "!" << endmsg;
438  return NULL;
439  }
440 
441  // Modify the name and title according to the prefixes of this classes instance
442  std::string graphName = graphPointer->GetName();
443  const std::string graphTitle = graphPointer->GetTitle();
444 
445  // Check if the hash for this graphName already exists, i.e., if we have a hash collision
446  const hash_t graphHash = this->hash(graphName);
447  GraphMap_t::const_iterator it = m_graphMap.find( graphHash );
448  if ( it != m_graphMap.end() ) // It does exist!
449  {
450  m_msg << MSG::WARNING
451  << "Detected a hash collision. The hash for the TGraph with name=" << graphName
452  << " already exists and points to a TGraph with name=" << it->second->GetName()
453  << " NOT going to book the new histogram and returning a NULL pointer!" << endmsg;
454  return NULL;
455  }
456 
457  // Create a clone that has the new name
458  TGraph* graphClone = dynamic_cast< TGraph* >( graphPointer->Clone((m_histNamePrefix+graphName+m_histNamePostfix).c_str()) );
459  if( !graphClone )
460  {
461  m_msg << MSG::WARNING
462  << "We couldn't clone the TGraph in the BookGetPointer(TGraph&) method of the class" << m_name
463  << "!" << endmsg;
464  return NULL;
465  }
466  graphClone->SetTitle ((m_histTitlePrefix+graphTitle+m_histTitlePostfix).c_str());
467 
468  // Massage the final string to book things
469  std::string bookingString("");
470  this->buildBookingString( bookingString, graphName, tDir, stream );
471 
472  // Register the TGraph into the THistSvc
473  if ( !((histSvc()->regGraph(bookingString, graphClone)).isSuccess()) )
474  {
475  m_msg << MSG::WARNING
476  << "Problem registering TGraph with name " << graphName
477  << ", title " << graphTitle
478  << " in " << m_name << "!" << endmsg;
479  return NULL;
480  }
481 
482  // Also register it in the local map of string to pointer
483  m_graphMap.insert( m_graphMap.end(), std::pair< const hash_t, TGraph* >( graphHash, graphClone ) );
484 
485  return graphClone;
486 }

◆ bookGetPointer() [3/8]

TH1 * AthHistogramming::bookGetPointer ( const TH1 &  hist,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 260 of file AthHistogramming.h.

261 {
262  // We need to create a non-const clone
263  TH1* histClone = dynamic_cast< TH1* >( hist.Clone() );
264  if ( !histClone ) {
265  m_msg << MSG::ERROR << "Couldn't create a TH1 clone in bookGetPointer" << endmsg;
266  return 0;
267  }
268  return this->bookGetPointer( *histClone, tDir, stream );
269 
270 }

◆ bookGetPointer() [4/8]

TTree * AthHistogramming::bookGetPointer ( const TTree &  treeRef,
std::string  tDir = "",
std::string  stream = "" 
)
protectedinherited

Simplify the booking and registering (into THistSvc) of TTrees.

Definition at line 312 of file AthHistogramming.cxx.

313 {
314  // Get a pointer
315  const TTree* treePointer = &treeRef;
316 
317  // Check that we got a valid pointer
318  if ( !treePointer )
319  {
320  m_msg << MSG::WARNING
321  << "We got an invalid TTree pointer in the BookGetPointer(TTree*) method of the class" << m_name
322  << "!" << endmsg;
323  return NULL;
324  }
325 
326  // Modify the name and title according to the prefixes of this classes instance
327  std::string treeName = treePointer->GetName();
328  const std::string treeTitle = treePointer->GetTitle();
329 
330  // Check if the hash for this treeName already exists, i.e., if we have a hash collision
331  const hash_t treeHash = this->hash(treeName);
332  TreeMap_t::const_iterator it = m_treeMap.find( treeHash );
333  if ( it != m_treeMap.end() ) // It does exist!
334  {
335  m_msg << MSG::WARNING
336  << "Detected a hash collision. The hash for the TTree with name=" << treeName
337  << " already exists and points to a TTree with name=" << it->second->GetName()
338  << " NOT going to book the new histogram and returning a NULL pointer!" << endmsg;
339  return NULL;
340  }
341 
342  // Create a clone that has the new name
343  TTree* treeClone = dynamic_cast< TTree* >( treePointer->Clone(treeName.c_str()) );
344  if( !treeClone )
345  {
346  m_msg << MSG::WARNING
347  << "We couldn't clone the TTree in the BookGetPointer(TTree&) method of the class" << m_name
348  << "!" << endmsg;
349  return NULL;
350  }
351  treeClone->SetTitle (treeTitle.c_str());
352 
353  // Massage the final string to book things
354  std::string bookingString("");
355  this->buildBookingString( bookingString, treeName, tDir, stream );
356 
357  // Register the TTree into the THistSvc
358  if ( !((histSvc()->regTree(bookingString, treeClone)).isSuccess()) )
359  {
360  m_msg << MSG::WARNING
361  << "Problem registering TTree with name " << treeName
362  << ", title " << treeTitle
363  << " in " << m_name << "!" << endmsg;
364  return NULL;
365  }
366 
367  // Also register it in the local map of string to pointer
368  m_treeMap.insert( m_treeMap.end(), std::pair< const hash_t, TTree* >( treeHash, treeClone ) );
369 
370  return treeClone;
371 }

◆ bookGetPointer() [5/8]

TEfficiency * AthHistogramming::bookGetPointer ( TEfficiency &  effRef,
std::string  tDir = "",
std::string  stream = "" 
)
protectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 146 of file AthHistogramming.cxx.

147 {
148  // Modify the name and title according to the prefixes of this classes instance
149  std::string effName(effRef.GetName());
150  const std::string effTitle(effRef.GetTitle());
151  std::string bookingString("");
152 
153  this->buildBookingString( bookingString, effName, tDir, stream );
154  effRef.SetTitle((m_histTitlePrefix+effTitle+m_histTitlePostfix).c_str() );
155  effRef.SetName(effName.c_str());
156 
157  // Check if the hash for this effName already exists, i.e., if we have a hash collision
158  const hash_t effHash = this->hash(effName);
159  EffMap_t::const_iterator it = m_effMap.find( effHash );
160  if ( it != m_effMap.end() ) // It does exist!
161  {
162  m_msg << MSG::WARNING
163  << "Detected a hash collision. The hash for the TEfficiency with name=" << effName
164  << " already exists and points to a TEfficiency with name=" << it->second->GetName()
165  << " NOT going to book the new TEfficiency and returning a NULL pointer!" << endmsg;
166  return NULL;
167  }
168 
169  // Set the new name and title for the TEfficiency, based on the prefixes that the user set for this class instance
170  // Create a clone that has the new name
171 
172  // Massage the final string to book things
173 
174  // Register the TEfficiency into the THistSvc
175  if ( !((histSvc()->regEfficiency(bookingString, &effRef)).isSuccess()) )
176  {
177  m_msg << MSG::WARNING
178  << "Problem registering TEfficiency with name " << effName
179  << ", name prefix " << m_histNamePrefix
180  << ", title " << effTitle
181  << ", tile prefix " << m_histTitlePrefix
182  << ", and tile postfix " << m_histTitlePostfix
183  << " in " << m_name << "!" << endmsg;
184  return NULL;
185  }
186 
187  // Also register it in the local map of string to pointer
188  m_effMap.insert( m_effMap.end(), std::pair< const hash_t, TEfficiency* >( effHash, &effRef ) );
189 
190  return &effRef;
191 }

◆ bookGetPointer() [6/8]

TEfficiency * AthHistogramming::bookGetPointer ( TEfficiency *  eff,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 293 of file AthHistogramming.h.

294 {
295  if ( !hist ) {
296  m_msg << MSG::ERROR << "Got a zero pointer to a TEfficiency in bookGetPointer" << endmsg;
297  return 0;
298  }
299  return this->bookGetPointer( *hist, tDir, stream );
300 }

◆ bookGetPointer() [7/8]

TH1 * AthHistogramming::bookGetPointer ( TH1 &  histRef,
std::string  tDir = "",
std::string  stream = "" 
)
protectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 98 of file AthHistogramming.cxx.

99 {
100  // Modify the name and title according to the prefixes of this classes instance
101  std::string histName(histRef.GetName());
102  const std::string histTitle(histRef.GetTitle());
103  std::string bookingString("");
104 
105  this->buildBookingString( bookingString, histName, tDir, stream );
106  histRef.SetTitle((m_histTitlePrefix+histTitle+m_histTitlePostfix).c_str() );
107  histRef.SetName(histName.c_str());
108 
109  // Check if the hash for this histName already exists, i.e., if we have a hash collision
110  const hash_t histHash = this->hash(histName);
111  HistMap_t::const_iterator it = m_histMap.find( histHash );
112  if ( it != m_histMap.end() ) // It does exist!
113  {
114  m_msg << MSG::WARNING
115  << "Detected a hash collision. The hash for the histogram with name=" << histName
116  << " already exists and points to a histogram with name=" << it->second->GetName()
117  << " NOT going to book the new histogram and returning a NULL pointer!" << endmsg;
118  return NULL;
119  }
120 
121  // Set the new name and title for the histogram, based on the prefixes that the user set for this class instance
122  // Create a clone that has the new name
123 
124  // Massage the final string to book things
125 
126  // Register the histogram into the THistSvc
127  if ( !((histSvc()->regHist(bookingString, &histRef)).isSuccess()) )
128  {
129  m_msg << MSG::WARNING
130  << "Problem registering histogram with name " << histName
131  << ", name prefix " << m_histNamePrefix
132  << ", title " << histTitle
133  << ", tile prefix " << m_histTitlePrefix
134  << ", and tile postfix " << m_histTitlePostfix
135  << " in " << m_name << "!" << endmsg;
136  return NULL;
137  }
138 
139  // Also register it in the local map of string to pointer
140  m_histMap.insert( m_histMap.end(), std::pair< const hash_t, TH1* >( histHash, &histRef ) );
141 
142  return &histRef;
143 }

◆ bookGetPointer() [8/8]

TH1 * AthHistogramming::bookGetPointer ( TH1 *  hist,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 272 of file AthHistogramming.h.

273 {
274  if ( !hist ) {
275  m_msg << MSG::ERROR << "Got a zero pointer to a TH1 in bookGetPointer" << endmsg;
276  return 0;
277  }
278  return this->bookGetPointer( *hist, tDir, stream );
279 }

◆ buildBookingString()

void AthHistogramming::buildBookingString ( std::string &  bookingString,
std::string &  histName,
std::string &  tDir,
std::string &  stream,
bool  usePrefixPostfix = false 
)
privateinherited

Method to build individual booking string.

Definition at line 560 of file AthHistogramming.cxx.

565 {
566  // Massage the final string to book things
567  if(tDir.empty()) tDir = m_rootDir;
568  size_t pos = histName.rfind('/');
569  if(pos != std::string::npos){
570  tDir+='/';
571  tDir.append(histName, 0,pos);
572  histName.erase(0,pos+1);
573  };
574  if(stream.empty()) stream = m_streamName;
575 
576  if(usePrefixPostfix){
577  bookingString = "/"+stream+"/"+tDir+"/"+m_histNamePrefix+histName+m_histNamePostfix;
578  } else {
579  bookingString = "/"+stream+"/"+tDir+"/"+histName;
580  }
581  while(bookingString.find("//") != std::string::npos){
582  this->myReplace(bookingString,"//","/");
583  }
584 
585  return;
586 }

◆ checkExistingTrigger()

StatusCode RatesAnalysisAlg::checkExistingTrigger ( const std::string &  name,
const std::string &  seedName 
)
privateinherited

Internal function to check if a supplied HLT trigger and L1 seed match what is stored in the AOD config.

Parameters
nameName of the L1 or HLT trigger.
seedNameFor HLT triggers, name of the L1 seed item.
Returns
StatusCode::FAILURE if the trigger does not match the AOD.

Definition at line 329 of file RatesAnalysisAlg.cxx.

329  {
331  const auto& triggers = m_tdt->getListOfTriggers(name);
332  if (triggers.size() != 1) {
333  ATH_MSG_FATAL("Unable to find existing trigger " << name << " in this AOD.");
334  return StatusCode::FAILURE;
335  }
336  if (getLevel(name) == 1) return StatusCode::SUCCESS;
337  // L1 items will crash if we call this on them.
338  const auto trigConf = m_tdt->ExperimentalAndExpertMethods().getChainConfigurationDetails(triggers.at(0));
339  if (trigConf->lower_chain_name() != seedName) {
340  ATH_MSG_FATAL("Tried to register an existing trigger '" << name << "' seeding from '" << seedName << "' but in this AOD it seeds from '" << trigConf->lower_chain_name() << "'");
341  return StatusCode::FAILURE;
342  }
343  return StatusCode::SUCCESS;
344 }

◆ checkGotTDT()

StatusCode RatesAnalysisAlg::checkGotTDT ( )
privateinherited

Internal check that the TDT is fetched.

Definition at line 314 of file RatesAnalysisAlg.cxx.

314  {
315  if (m_tdt.empty()){
316  ATH_MSG_ERROR("TriggerDecisionTool is not available!");
317  return StatusCode::FAILURE;
318  }
319  [[maybe_unused]] static std::atomic<bool> printed = [&]() {
320  ATH_MSG_INFO("TDT contains: " << m_tdt->getListOfTriggers().size() << " triggers, "
321  << m_tdt->getListOfStreams().size() << " streams and "
322  << m_tdt->getListOfGroups().size() << " groups.");
323  return true;
324  }();
325  return StatusCode::SUCCESS;
326 }

◆ configAthHistogramming()

StatusCode AthHistogramming::configAthHistogramming ( const ServiceHandle< ITHistSvc > &  histSvc,
const std::string &  prefix,
const std::string &  rootDir,
const std::string &  histNamePrefix,
const std::string &  histNamePostfix,
const std::string &  histTitlePrefix,
const std::string &  histTitlePostfix 
)
protectedinherited

To be called by the derived classes to fill the internal configuration.

Definition at line 66 of file AthHistogramming.cxx.

70 {
73  m_rootDir = rootDir;
74  m_histNamePrefix = histNamePrefix;
75  m_histNamePostfix = histNamePostfix;
76  m_histTitlePrefix = histTitlePrefix;
77  m_histTitlePostfix = histTitlePostfix;
78 
79  return StatusCode::SUCCESS;
80 }

◆ currentFile()

TFile * AthAnalysisAlgorithm::currentFile ( const char *  evtSelName = "EventSelector")
finalprotectedvirtualinherited

Function returning the TFile pointer of the currently open file of the given EventSelector (in athena jobs this defaults to "EventSelector")

Definition at line 147 of file AthAnalysisAlgorithm.cxx.

147  {
148  if(m_currentFile) return m_currentFile;
149 
150  //get the EventSelector so we can get it's list of input files
151  //dont get it with a ServiceHandle, because that invokes initialize, can get into init loop
152 
153  SmartIF<IProperty> evtSelector{service(evtSelName, false)};
154  if(!evtSelector) {
155  ATH_MSG_ERROR("currentFile(): Couldn't find the service: " << evtSelName);return 0;
156  }
157 
158  try {
159  //get the list of input files - use this to determine which open file is the current input file
160  const StringArrayProperty& inputCollectionsName = dynamic_cast<const StringArrayProperty&>(evtSelector->getProperty("InputCollections"));
161 
162  ATH_MSG_VERBOSE("nOpenFile=" << gROOT->GetListOfFiles()->GetSize() << ". nFilesInInputCollection=" << inputCollectionsName.value().size());
163  if(msgLvl(MSG::VERBOSE)) {
164  for(int i=0;i<gROOT->GetListOfFiles()->GetSize();i++) {
165  ATH_MSG_VERBOSE("Open file: " << gROOT->GetListOfFiles()->At(i)->GetName());
166  }
167  }
168 
169  //look through list of files and find the one from the input collection that is currently open
170 
171  for(int i=0;i<gROOT->GetListOfFiles()->GetSize();i++) {
172  TFile *g = (TFile*)gROOT->GetListOfFiles()->At(i);
173  //see if this file is in the input file list
174  //strip everything except stuff either side of last /
175  TString s(g->GetName());
176  TObjArray* tokens = s.Tokenize("/");
177  TObjString* lastToken = static_cast<TObjString*>(tokens->Last());
178  TString sToCompare("");
179  bool shortComparison(false);
180  if(tokens->GetEntries()>1) {
181  TString beforeSlash((static_cast<TObjString*>(tokens->At(tokens->GetEntries()-2)))->GetString());
182  if(beforeSlash.Length()>0) sToCompare += beforeSlash;
183  sToCompare += "/";
184  } else {
185  shortComparison=true;
186  }
187  sToCompare += lastToken->GetString();
188  TString sToCompare_short(lastToken->GetString()); //short versions search
189  delete tokens;
190 
191  for(unsigned int j=0;j<inputCollectionsName.value().size();j++) {
192  TString t(inputCollectionsName.value()[j].c_str());
193  //try perfect match first
194  if(s.EqualTo(t)) {
195  ATH_MSG_VERBOSE("Current File is: " << inputCollectionsName.value()[j]);
196  m_currentFile = g;
197  return g;
198  }
199  TObjArray* tokens = t.Tokenize("/");
200  TObjString* lastToken = dynamic_cast<TObjString*>(tokens->Last());
201  if (!lastToken) {
202  ATH_MSG_ERROR("Cannot cast token string to TObjString");
203  return nullptr;
204  }
205  TString tToCompare = "";
206  bool shortComparison2(false);
207  if(tokens->GetEntries()>1) {
208  TObjString* beforeSlashStr = dynamic_cast<TObjString*>(tokens->At(tokens->GetEntries()-2));
209  if (!beforeSlashStr) {
210  ATH_MSG_ERROR("Cannot cast token string to TObjString");
211  return nullptr;
212  }
213  TString beforeSlash(beforeSlashStr->GetString());
214  if(beforeSlash.Length()>0) tToCompare += beforeSlash;
215  tToCompare += "/";
216  } else {
217  shortComparison2=true;
218  }
219  tToCompare += lastToken->GetString();
220  TString tToCompare_short(lastToken->GetString());
221  delete tokens;
222 
223  if(shortComparison || shortComparison2) { //doing short version search, no directories to distinguish files!
224  if(sToCompare_short.EqualTo(tToCompare_short)) {
225  ATH_MSG_VERBOSE("Current File is: " << inputCollectionsName.value()[j]);
226  m_currentFile = g;
227  return g;
228  }
229  } else
230  if(sToCompare.EqualTo(tToCompare)) {
231  ATH_MSG_VERBOSE("Current File is: " << inputCollectionsName.value()[j]);
233  return g;
234  }
235  }
236  }
237 
238  } catch(...) {
239  ATH_MSG_ERROR("currentFile(): Couldn't load InputCollections property of " << evtSelName); return 0;
240  }
241 
242  ATH_MSG_ERROR("currentFile(): Could not find the current file!");
243  return 0; //something went wrong :-(
244 
245 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ efficiency()

TEfficiency * AthHistogramming::efficiency ( const std::string &  effName,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
protectedinherited

Simplify the retrieval of registered TEfficiency.

Definition at line 250 of file AthHistogramming.cxx.

251 {
252  // Build a 32 bit hash out of the name
253  const hash_t effHash = this->hash(effName);
254 
255  // See if this entry exists in the map
256  EffMap_t::const_iterator it = m_effMap.find( effHash );
257  if ( it == m_effMap.end() ) // It doesn't exist!
258  { // Let's see into the THistSvc if somebody else has registered the TEfficiency...
259 
260  // Need to copy the strings as we will massage them from here on
261  std::string effNameCopy = effName;
262  std::string tDirCopy = tDir;
263  std::string streamCopy = stream;
264 
265  // Massage the final string to book things
266  std::string bookingString("");
267  this->buildBookingString( bookingString, effNameCopy, tDirCopy, streamCopy ,false);
268 
269  TEfficiency* effPointer(NULL);
270  if ( !((histSvc()->getEfficiency(bookingString, effPointer)).isSuccess()) )
271  {
272  // Massage the final string to book things
273  std::string bookingString("");
274  this->buildBookingString( bookingString, effNameCopy, tDirCopy, streamCopy, true );
275 
276  if ( !((histSvc()->getEfficiency(bookingString, effPointer)).isSuccess()) )
277  {
278  m_msg << MSG::WARNING
279  << "Problem retrieving the TEfficiency with name (including pre- and post-fixes) "
280  << m_histNamePrefix + effNameCopy + m_histNamePostfix
281  << " or with name " << effNameCopy
282  << " in " << m_name << "... it doesn't exist, neither in the cached map nor in the THistSvc!"
283  << " Will return an NULL pointer... you have to handle it correctly!" << endmsg;
284  return NULL;
285  }
286  // If we get to here, we actually found the TEfficiency in the THistSvc.
287  // So let's add it to the local cache map and return its pointer
288  m_effMap.insert( m_effMap.end(), std::pair< const hash_t, TEfficiency* >( effHash, effPointer ) );
289  return effPointer;
290  }
291  // If we get to here, we actually found the TEfficiency in the THistSvc.
292  // So let's add it to the local cache map and return its pointer
293  m_effMap.insert( m_effMap.end(), std::pair< const hash_t, TEfficiency* >( effHash, effPointer ) );
294  return effPointer;
295  }
296 
297  // Return the pointer to the TEfficiency that we got from the local cache map
298  return it->second;
299 }

◆ endInputFile()

StatusCode AthAnalysisAlgorithm::endInputFile ( )
protectedvirtualinherited

Function called as an input file is being closed.

Dummy implementation that can be overridden by the derived tool.

Definition at line 122 of file AthAnalysisAlgorithm.cxx.

122  {
123 
124  // Return gracefully:
125  return StatusCode::SUCCESS;
126 }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode RatesAnalysisAlg::execute ( )
privatevirtualinherited

In first call - register all triggers.

Then load event weighting parameters, fill trigger decisions, compute group rates.

Definition at line 634 of file RatesAnalysisAlg.cxx.

634  {
635  ATH_MSG_VERBOSE("Executing " << name() << " on event " << m_eventCounter << "...");
636  if (m_eventCounter++ == 0) { // First time in execute loop - cannot access TDT before this.
638  }
639 
640  // Get event characteristics
642  ATH_CHECK( eventInfo.isValid() );
643  uint32_t distance = 0;
644  ATH_CHECK( m_enhancedBiasRatesTool->getDistanceIntoTrain(eventInfo.get(), distance) );
645  const bool isMC = m_enhancedBiasRatesTool->isMC();
646 
647  // Get the weighting & scaling characteristics
648  m_weightingValues.m_enhancedBiasWeight = m_enhancedBiasRatesTool->getEBWeight(eventInfo.get());
649  m_weightingValues.m_eventMu = std::ceil(eventInfo->actualInteractionsPerCrossing()); // This always seems to be a half integer
650  m_weightingValues.m_eventLumi = m_enhancedBiasRatesTool->getLBLumi(eventInfo.get());
651  m_weightingValues.m_isUnbiased = m_enhancedBiasRatesTool->isUnbiasedEvent(eventInfo.get());
653  m_weightingValues.m_eventLiveTime = m_enhancedBiasRatesTool->getEBLiveTime(eventInfo.get());
655 
656  // Bunch factor doesn't change as a fn. of the run. Reminder: m_bunchFactor = m_targetBunches / (double)ebPairedBunches;
660 
661  // Ignore zero weighted events. Typically these come from bad LB
663  return StatusCode::SUCCESS;
664  }
665 
666  const double weightedEvents = (isMC ? eventInfo->mcEventWeight() : m_weightingValues.m_enhancedBiasWeight);
667  m_weightedEventCounter += weightedEvents;
668 
669  double ratesDenominator = 0.0;
670  if (m_doMultiSliceDiJet) {
671  ratesDenominator = eventInfo->mcEventWeight(); // In multi-slice mode we only normalize to the weighted number of events
672  } else {
673  ratesDenominator = m_weightingValues.m_eventLiveTime * (isMC ? eventInfo->mcEventWeight() : 1.0); // Otherwise, we need to keep track of elapsed walltime as well
674  }
675  m_ratesDenominator += ratesDenominator;
676 
677  if (m_doHistograms) {
678  m_bcidHist->Fill(eventInfo->bcid(), m_weightingValues.m_enhancedBiasWeight);
679  m_scalingHist->Fill(0.5, ratesDenominator); // Walltime
680  m_scalingHist->Fill(1.5, 1.); // Total events
681  m_scalingHist->Fill(2.5, weightedEvents ); // Total weighted events
682  }
683 
684  // HSTP filter check
685  if (isMC) {
686  bool filterPass = true;
687  ATH_CHECK( pass_HstpFilter(filterPass) );
688  if (!filterPass) {return StatusCode::SUCCESS;}
689  }
690 
691  // Do automated triggers
693 
694  // Do TDT-controlled triggers
696 
697  // Run user's code. Do manual triggers
698  ATH_CHECK( ratesExecute() );
699 
700  // Execute groups
701  for (const auto& group : m_globalGroups) group.second->execute(m_weightingValues); // Physics, L1, express: Must execute before m_uniqueGroups (which are in active groups). Map.
702  for (const auto& group : m_activeGroups) group->execute(m_weightingValues); // Individual groups, CPS groups and active unique groups. Set.
703 
704  // Reset triggers
705  for (const auto& trigger : m_activatedTriggers) trigger->reset();
706  m_activatedTriggers.clear();
707 
708  // Some debug info
709  if (m_eventCounter % 1000 == 0) {
710  ATH_MSG_INFO( "Event " << m_eventCounter << " " << m_weightingValues.print() << " currentWallTime:" << m_ratesDenominator );
711  }
712 
713  setFilterPassed(true); //if got here, assume that means algorithm passed
714  return StatusCode::SUCCESS;
715 }

◆ executeTrigDecisionToolTriggers()

StatusCode RatesAnalysisAlg::executeTrigDecisionToolTriggers ( )
privateinherited

Internal call to get the pass/fail for all TDT triggers.

Definition at line 717 of file RatesAnalysisAlg.cxx.

717  {
718  for (const auto& trigger : m_existingTriggers) {
719  const bool passed = trigger.second->isPassed();
720  // L1 chains are always active, HLT chains are active if their L1 passed.
721  const std::string& lower = m_lowerTrigger[trigger.first];
722  // Expect this find operation to fail for L1 chains (lower = "")
723  const std::unordered_map<std::string, const Trig::ChainGroup*>::const_iterator it = m_existingTriggers.find(lower);
724  const bool active = (it == m_existingTriggers.end() ? true : it->second->isPassed());
725  ATH_CHECK( setTriggerDesicison(trigger.first, passed, active) );
726  }
727  return StatusCode::SUCCESS;
728 }

◆ executeTriggerEmulation()

StatusCode RatesAnalysisAlg::executeTriggerEmulation ( )
privateinherited

Internal call to get the pass/fail for all automatically emulated triggers.

Definition at line 730 of file RatesAnalysisAlg.cxx.

730  {
731  // TODO emulation code here
732  for (const auto& trigger : m_autoTriggers) {
733  ATH_MSG_WARNING("Cannot do rates for " << trigger << ". Automatic trigger emulation is not yet included, sorry :(");
734  }
735  return StatusCode::SUCCESS;
736 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51 {
52  // If we didn't find any symlinks to add, just return the collection
53  // from the base class. Otherwise, return the extended collection.
54  if (!m_extendedExtraObjects.empty()) {
56  }
57  return Algorithm::extraOutputDeps();
58 }

◆ finalize()

StatusCode RatesAnalysisAlg::finalize ( )
privatevirtualinherited

Print rates.

Definition at line 738 of file RatesAnalysisAlg.cxx.

738  {
739  ATH_MSG_INFO ("Finalizing " << name() << "...");
740 
742  if (!m_doMultiSliceDiJet) { // Cannot estimate multi-slice rates before the merging stage
743  if (m_scanTriggers.size()) {
744  ATH_MSG_INFO("################## Computed Rate Scans for Threshold-Scan Items:");
745  for (const auto& trigger : m_scanTriggers) ATH_MSG_INFO(trigger.second->printRate(m_ratesDenominator));
746  }
747  if (m_triggers.size()) {
748  ATH_MSG_INFO("################## Computed Rate Estimations for Single Items:");
749  std::set<std::string> keys; // Used an unordered map for speed, but now we'd like the items in order
750  for (const auto& trigger : m_triggers) keys.insert(trigger.first);
751  for (const std::string& key : keys) ATH_MSG_INFO(m_triggers.at(key)->printRate(m_ratesDenominator));
752  }
753  if (m_expressTriggers.size()) {
754  ATH_MSG_INFO("################## Computed Express Rate Estimations for Single Items:");
755  for (const auto& trigger : m_expressTriggers) ATH_MSG_INFO(trigger->printExpressRate(m_ratesDenominator));
756  }
757  if (m_groups.size()) {
758  ATH_MSG_INFO("################## Computed Rate Estimations for Groups:");
759  for (const auto& group : m_groups) ATH_MSG_INFO(group.second->printRate(m_ratesDenominator));
760  }
761  if (m_globalGroups.size()) {
762  ATH_MSG_INFO("################## Computed Rate Estimations for Global Groups:");
763  for (const auto& group : m_globalGroups) ATH_MSG_INFO(group.second->printRate(m_ratesDenominator));
764  }
765  }
766  ATH_MSG_INFO("################## LHC Conditions and weighting information:");
768  printTarget();
769  printStatistics();
770  ATH_MSG_INFO("##################");
771  writeMetadata();
772 
773  return StatusCode::SUCCESS;
774 }

◆ firstExecute()

StatusCode AthAnalysisAlgorithm::firstExecute ( )
protectedvirtualinherited

Function called when first execute is encountered user can read event information with evtStore()

Dummy implementation that can be overridden by the derived tool.

Reimplemented in CP::JetTileCorrectionAlg.

Definition at line 139 of file AthAnalysisAlgorithm.cxx.

139  {
140 
141  // Return gracefully:
142  return StatusCode::SUCCESS;
143 }

◆ getLevel()

uint32_t RatesAnalysisAlg::getLevel ( const std::string &  name) const
privateinherited

String match to a trigger level.

If unknown, we assume HLT.

Returns
trigger level (1 or 2)

Definition at line 867 of file RatesAnalysisAlg.cxx.

867  {
868  if (name.find("HLT_") != std::string::npos) return 2;
869  if (name.find("L1_") != std::string::npos) return 1;
870  return 2;
871 }

◆ getTriggerMap()

const std::unordered_map< std::string, std::unique_ptr< RatesTrigger > > & RatesAnalysisAlg::getTriggerMap ( ) const
protectedinherited

Definition at line 194 of file RatesAnalysisAlg.cxx.

194  {
195  return m_triggers;
196 }

◆ graph()

TGraph * AthHistogramming::graph ( const std::string &  graphName,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
protectedinherited

Simplify the retrieval of registered TGraphs.

Definition at line 492 of file AthHistogramming.cxx.

493 {
494  // Build a 32 bit hash out of the name
495  const hash_t graphHash = this->hash(graphName);
496 
497  // See if this entry exists in the map
498  GraphMap_t::const_iterator it = m_graphMap.find( graphHash );
499  if ( it == m_graphMap.end() ) // It doesn't exist!
500  { // Let's see into the THistSvc if somebody else has registered the TGraph...
501 
502  // Need to copy the strings as we will massage them from here on
503  std::string graphNameCopy = graphName;
504  std::string tDirCopy = tDir;
505  std::string streamCopy = stream;
506 
507  // Massage the final string to book things
508  std::string bookingString("");
509  this->buildBookingString( bookingString, graphNameCopy, tDirCopy, streamCopy, true);
510 
511  TGraph* graphPointer(NULL);
512  if ( !((histSvc()->getGraph(bookingString, graphPointer)).isSuccess()) )
513  {
514  // Massage the final string to book things
515  std::string bookingString("");
516  this->buildBookingString( bookingString, graphNameCopy, tDirCopy, streamCopy, false );
517 
518  if ( !((histSvc()->getGraph(bookingString, graphPointer)).isSuccess()) )
519  {
520  m_msg << MSG::WARNING
521  << "Problem retrieving the TGraph with name (including pre- and post-fixes) "
522  << m_histNamePrefix + graphNameCopy + m_histNamePostfix
523  << " or with name " << graphNameCopy
524  << " in " << m_name << "... it doesn't exist, neither in the cached map nor in the THistSvc!"
525  << " Will return an NULL pointer... you have to handle it correctly!" << endmsg;
526  return NULL;
527  }
528  // If we get to here, we actually found the TGraph in the THistSvc.
529  // So let's add it to the local cache map and return its pointer
530  m_graphMap.insert( m_graphMap.end(), std::pair< const hash_t, TGraph* >( graphHash, graphPointer ) );
531  return graphPointer;
532  }
533  // If we get to here, we actually found the TGraph in the THistSvc.
534  // So let's add it to the local cache map and return its pointer
535  m_graphMap.insert( m_graphMap.end(), std::pair< const hash_t, TGraph* >( graphHash, graphPointer ) );
536  return graphPointer;
537  }
538 
539 
540  // Return the pointer to the TGraph that we got from the local cache map
541  return it->second;
542 }

◆ handle()

void AthAnalysisAlgorithm::handle ( const Incident &  inc)
overrideprotectedvirtualinherited

Function receiving incidents from IncidentSvc/TEvent Experts can override but they should ensure they add AthAnalysisAlgorithm::handle(); to the end of their own implementation.

Definition at line 83 of file AthAnalysisAlgorithm.cxx.

83  {
84 
85  // Tell the user what's happening:
86  ATH_MSG_VERBOSE( "Callback received with incident: " << inc.type() );
87 
88  // Call the appropriate member function:
89  if( inc.type() == IncidentType::BeginInputFile ) {
90  m_currentFile=0;
91  if( beginInputFile().isFailure() ) {
92  ATH_MSG_FATAL( "Failed to call beginInputFile()" );
93  throw std::runtime_error( "Couldn't call beginInputFile()" );
94  }
95  } else if(inc.type() == IncidentType::EndInputFile ) {
96  if( endInputFile().isFailure() ) {
97  ATH_MSG_FATAL( "Failed to call endInputFile()" );
98  throw std::runtime_error( "Couldn't call endInputFile()" );
99  }
100  } else if(inc.type() == "MetaDataStop" ) {
101  if( metaDataStop().isFailure() ) {
102  ATH_MSG_FATAL( "Failed to call metaDataStop()" );
103  throw std::runtime_error( "Couldn't call metaDataStop()" );
104  }
105  } else {
106  ATH_MSG_WARNING( "Unknown incident type received: " << inc.type() );
107  }
108 
109  return;
110 }

◆ hash()

AthHistogramming::hash_t AthHistogramming::hash ( const std::string &  histName) const
inlineprivateinherited

Method to calculate a 32-bit hash from a string.

Definition at line 428 of file AthHistogramming.h.

429 {
431  return (hash_t)(hash64 & 0xFFFFFFFF);
432 }

◆ hist()

TH1 * AthHistogramming::hist ( const std::string &  histName,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
protectedinherited

Simplify the retrieval of registered histograms of any type.

Definition at line 198 of file AthHistogramming.cxx.

199 {
200  // Build a 32 bit hash out of the name
201  const hash_t histHash = this->hash(histName);
202 
203  // See if this entry exists in the map
204  HistMap_t::const_iterator it = m_histMap.find( histHash );
205  if ( it == m_histMap.end() ) // It doesn't exist!
206  { // Let's see into the THistSvc if somebody else has registered the histogram...
207 
208  // Need to copy the strings as we will massage them from here on
209  std::string histNameCopy = histName;
210  std::string tDirCopy = tDir;
211  std::string streamCopy = stream;
212 
213  // Massage the final string to book things
214  std::string bookingString("");
215  this->buildBookingString( bookingString, histNameCopy, tDirCopy, streamCopy ,false);
216 
217  TH1* histPointer(NULL);
218  if ( !((histSvc()->getHist(bookingString, histPointer)).isSuccess()) )
219  {
220  // Massage the final string to book things
221  std::string bookingString("");
222  this->buildBookingString( bookingString, histNameCopy, tDirCopy, streamCopy, true );
223 
224  if ( !((histSvc()->getHist(bookingString, histPointer)).isSuccess()) )
225  {
226  m_msg << MSG::WARNING
227  << "Problem retrieving the histogram with name (including pre- and post-fixes) "
228  << m_histNamePrefix + histNameCopy + m_histNamePostfix
229  << " or with name " << histNameCopy
230  << " in " << m_name << "... it doesn't exist, neither in the cached map nor in the THistSvc!"
231  << " Will return an NULL pointer... you have to handle it correctly!" << endmsg;
232  return NULL;
233  }
234  // If we get to here, we actually found the histogram in the THistSvc.
235  // So let's add it to the local cache map and return its pointer
236  m_histMap.insert( m_histMap.end(), std::pair< const hash_t, TH1* >( histHash, histPointer ) );
237  return histPointer;
238  }
239  // If we get to here, we actually found the histogram in the THistSvc.
240  // So let's add it to the local cache map and return its pointer
241  m_histMap.insert( m_histMap.end(), std::pair< const hash_t, TH1* >( histHash, histPointer ) );
242  return histPointer;
243  }
244 
245 
246  // Return the pointer to the histogram that we got from the local cache map
247  return it->second;
248 }

◆ hist2d()

TH2 * AthHistogramming::hist2d ( const std::string &  histName,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the retrieval of registered 2-d histograms.

Definition at line 369 of file AthHistogramming.h.

370 {
371  // Get the TH1 pointer
372  TH1* th1Pointer = this->hist(histName, tDir, stream);
373  if ( !th1Pointer )
374  {
375  m_msg << MSG::ERROR
376  << "Cannot get a 2-d histogram with name " << histName
377  << "... will probably seg-fault!" << endmsg;
378  return NULL;
379  }
380  // If the TH1 pointer is valid, simply return the dynamic_cast
381  return dynamic_cast<TH2*>( th1Pointer );
382 }

◆ hist3d()

TH3 * AthHistogramming::hist3d ( const std::string &  histName,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
inlineprotectedinherited

Simplify the retrieval of registered 3-d histograms.

Definition at line 386 of file AthHistogramming.h.

387 {
388  // Get the TH1 pointer
389  TH1* th1Pointer = this->hist(histName, tDir, stream);
390  if ( !th1Pointer )
391  {
392  m_msg << MSG::ERROR
393  << "Cannot get a 3-d histogram with name " << histName
394  << "... will probably seg-fault!" << endmsg;
395  return NULL;
396  }
397  // If the TH1 pointer is valid, simply return the dynamic_cast
398  return dynamic_cast<TH3*>( th1Pointer );
399 }

◆ histSvc()

const ServiceHandle< ITHistSvc > & AthHistogramAlgorithm::histSvc ( ) const
inlineinherited

The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a pointer to the THistSvc.

Definition at line 113 of file AthHistogramAlgorithm.h.

114 {
115  return m_histSvc;
116 }

◆ initialize()

StatusCode RatesAnalysisAlg::initialize ( )
protectedvirtualinherited

Get the trigger decision tool and set up global groups.

Reimplemented in L1TopoRatesCalculator.

Definition at line 377 of file RatesAnalysisAlg.cxx.

377  {
378  ATH_MSG_INFO ("Initializing " << name() << "...");
379 
380  if (!m_tdt.empty()){
381  ATH_CHECK( m_tdt.retrieve() );
382  }
383 
384  if(!m_configSvc.empty()) {
385  ATH_CHECK( m_configSvc.retrieve() );
386  }
387 
388  ATH_CHECK( m_enhancedBiasRatesTool.retrieve() );
389 
393 
395  ATH_MSG_ERROR("DoUniqueRates=True requires DoGlobalGroups=True");
396  return StatusCode::FAILURE;
397  }
398 
400  return StatusCode::SUCCESS;
401 }

◆ initialize_extra_content()

StatusCode RatesEmulationExample::initialize_extra_content ( )
overrideprivatevirtual

Initialization of additional payload for inherited classes.

Reimplemented from RatesAnalysisAlg.

Definition at line 16 of file RatesEmulationExample.cxx.

16  {
17  // Read Handle Key
20  return StatusCode::SUCCESS;
21 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

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() [1/2]

ServiceHandle< StoreGateSvc >& AthAnalysisAlgorithm::inputMetaStore ( )
inlineinherited

Accessor for the input metadata store.

Definition at line 51 of file AthAnalysisAlgorithm.h.

51 { return m_inputMetaStore; }

◆ inputMetaStore() [2/2]

const ServiceHandle< StoreGateSvc >& AthAnalysisAlgorithm::inputMetaStore ( ) const
inlineinherited

Const accessor for the input metadata store.

Definition at line 49 of file AthAnalysisAlgorithm.h.

49 { return m_inputMetaStore; }

◆ isCPS()

bool RatesAnalysisAlg::isCPS ( const std::string &  group) const
privateinherited

String match coherent prescale groups.

Parameters
groupName of a trigger group
Returns
If name-parsing thinks that the group is a coherent prescale group

Definition at line 856 of file RatesAnalysisAlg.cxx.

856  {
857  return (group.find("CPS") != std::string::npos);
858 }

◆ isRandomSeed()

bool RatesAnalysisAlg::isRandomSeed ( const std::string &  me,
const std::string &  seed 
) const
privateinherited

String match random L1 items.

Parameters
meName of the trigger
seedName of the trigger's seed
Returns
if name-parsing thinks that the trigger seeds from a random L1 trgigger

Definition at line 860 of file RatesAnalysisAlg.cxx.

860  {
861  if (me.find("L1_RD") != std::string::npos) return true;
862  if (me.find("L1RD") != std::string::npos) return true;
863  if (seed.find("L1_RD") != std::string::npos) return true;
864  return false;
865 }

◆ isZero()

bool RatesAnalysisAlg::isZero ( double  v) const
inlineprivateinherited

Helper function for floating point subtraction.

Definition at line 248 of file RatesAnalysisAlg.h.

◆ metaDataStop()

StatusCode AthAnalysisAlgorithm::metaDataStop ( )
protectedvirtualinherited

Function called before finalize user can read output metadata from outputMetaStore()

Dummy implementation that can be overridden by the derived tool.

Definition at line 130 of file AthAnalysisAlgorithm.cxx.

130  {
131 
132  // Return gracefully:
133  return StatusCode::SUCCESS;
134 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ myReplace()

void AthHistogramming::myReplace ( std::string &  str,
const std::string &  oldStr,
const std::string &  newStr 
)
privateinherited

Helper method to replace sub-string.

Definition at line 590 of file AthHistogramming.cxx.

593 {
594  size_t pos = 0;
595  while((pos = str.find(oldStr, pos)) != std::string::npos)
596  {
597  str.replace(pos, oldStr.length(), newStr);
598  pos += newStr.length();
599  }
600 }

◆ newScanTrigger() [1/2]

StatusCode RatesAnalysisAlg::newScanTrigger ( const std::string &  name,
const double  thresholdMin,
const double  thresholdMax,
const uint32_t  thresholdBins = 100,
const RatesScanTrigger::TriggerBehaviour_t  behaviour = RatesScanTrigger::TriggerBehaviour_t::kTriggerBelowThreshold,
const double  prescale = 1.,
const std::string &  seedName = "",
const double  seedPrecale = 1.,
const Method_t  method = kMANUAL,
const ExtrapStrat_t  extrapolation = kLINEAR 
)
inherited

Register a new threshold scan trigger which plots rate as a function of some dependent variable.

Parameters
nameThe name of the emulated scan trigger. Recommend either a "L1_" or "HLT_" prefix.
thresholdMinThe lower threshold of this trigger, rates will not be available below this threshold
thresholdMaxThe upper threshold of this trigger, rates will not be available above this threshold
thresholdBinsGranularity
behaviourIf the trigger should activate above (kTriggerAboveThreshold) or below (kTriggerBelowThreshold) the threshold
prescaleThe prescale value to simulate applying. Default 1
seedNameThe name of any lower seeding e.g. L1 item. This info is required to get group rates correct
seedPrescaleThe prescale of any L1 seed item. Default 1.
methodDetermines who is responsible for evaluating the emulated trigger decision, you (kMANUAL) or the algorithm (kAUTO or kEXISTING).
extrapolationDetermines the triggers luminosity extrapolation behaviour.

Definition at line 40 of file RatesAnalysisAlg.cxx.

49  {
50 
51  if (method != kMANUAL) {
52  ATH_MSG_ERROR("Sorry - ScanTriggers have to be implemented with the kMANUAL method for now.");
53  return StatusCode::FAILURE;
54  }
55 
57  m_scanTriggers.emplace(name, std::make_unique<RatesScanTrigger>(name, msgSvc(), thresholdMin, thresholdMax, thresholdBins, behaviour, prescale, seedName, seedPrecale, e));
59  if (isRandomSeed(name, seedName)) newScanTrigger->setSeedsFromRandom(true);
60  ATH_MSG_DEBUG("newScanTrigger " << name << " added");
61  return StatusCode::SUCCESS;
62 }

◆ newScanTrigger() [2/2]

StatusCode RatesAnalysisAlg::newScanTrigger ( const std::string &  name,
const std::vector< double > &  thresholdBinEdges,
const RatesScanTrigger::TriggerBehaviour_t  behaviour = RatesScanTrigger::TriggerBehaviour_t::kTriggerAboveThreshold,
const double  prescale = 1.,
const std::string &  seedName = "",
const double  seedPrecale = 1.,
const Method_t  method = kMANUAL,
const ExtrapStrat_t  extrapolation = kLINEAR 
)
inherited

Version of newScanTrigger which takes a vector of bin edges.

Parameters
thresholdBinEdgedVector of bin edges to use for quantifying rate as a function of threshold

Definition at line 65 of file RatesAnalysisAlg.cxx.

72  {
73 
74  if (method != kMANUAL) {
75  ATH_MSG_ERROR("Sorry - ScanTriggers have to be implemented with the kMANUAL method for now.");
76  return StatusCode::FAILURE;
77  }
78 
80 
81  m_scanTriggers.emplace(name, std::make_unique<RatesScanTrigger>(name, msgSvc(), thresholdBinEdges, behaviour, prescale, seedName, seedPrecale, e));
83  if (isRandomSeed(name, seedName)) newScanTrigger->setSeedsFromRandom(true);
84  ATH_MSG_DEBUG("newScanTrigger " << name << " added");
85  return StatusCode::SUCCESS;
86 }

◆ newTrigger() [1/2]

StatusCode RatesAnalysisAlg::newTrigger ( const std::string &  name,
const double  prescale = 1.,
const double  expressPrescale = -1.,
const std::string &  seedName = "",
const double  seedPrecale = 1.,
const std::set< std::string > &  groups = std::set<std::string>(),
const Method_t  method = kMANUAL,
const ExtrapStrat_t  extrapolation = kLINEAR 
)
inherited

Register a new trigger for emulation.

Parameters
nameThe name of the emulated trigger. Recommend either a "L1_" or "HLT_" prefix.
prescaleThe prescale value to simulate applying. Default 1
expressPrescaleThe prescale value to simulate applying to the express stream. Default -1
seedNameThe name of any lower seeding e.g. L1 item. This info is required to get group rates correct when multiple chains seed of the same prescaled L1 item.
seedPrescaleThe prescale of any L1 seed item. Default 1.
Commaseparated list of groups to include this trigger in. Any group containing "CPS" will be simulated as a coherent prescale group and implies that all members of that group share a common L1 seed.
methodDetermines who is responsible for evaluating the emulated trigger decision, you (kMANUAL) or the algorithm (kAUTO or kEXISTING).
extrapolationDetermines the triggers luminosity extrapolation behaviour.

Definition at line 109 of file RatesAnalysisAlg.cxx.

116  {
117 
118  if (m_eventCounter > 1) { // All triggers must be defined before we start looping over the sample
119  ATH_MSG_FATAL("Too late to call newTrigger. All emulated triggers must be registered during ratesInitialize().");
120  return StatusCode::FAILURE;
121  }
122  if (method == kEXISTING) ATH_CHECK( checkExistingTrigger(name, seedName) ); // Check this agrees with what is in the AOD
123 
124  // Check if it already exists
125  if (m_triggers.count(name) == 1) {
126  ATH_MSG_WARNING("Trigger " << name << " is already registered.");
127  return StatusCode::SUCCESS;
128  }
129 
130  const ExtrapStrat_t e = (m_enableLumiExtrapolation ? extrapolation : ExtrapStrat_t::kNONE);
131  m_triggers.emplace(name, std::make_unique<RatesTrigger>(name, msgSvc(), prescale, expressPrescale, seedName, seedPrecale, m_doHistograms, e));
132  RatesTrigger* newTriggerPtr = m_triggers.at(name).get();
133 
134  if (isRandomSeed(name, seedName)) newTriggerPtr->setSeedsFromRandom(true);
135 
136  // Only worthwhile doing the remainder if the trigger is not disabled. Otherwise will slow everything down
137  if (newTriggerPtr->getDisabled()) {
138  ATH_MSG_DEBUG("newTrigger " << name << " added (disabled)");
139  return StatusCode::SUCCESS;
140  }
141 
142  if (method == kAUTO) {
143  m_autoTriggers.push_back(name);
144  } else if (method == kEXISTING) {
145  m_existingTriggers[name] = m_tdt->getChainGroup(name);
147  }
148 
149  // Add this trigger to its groups
150  if (m_doTriggerGroups) {
151  for (const std::string& group : groups) {
152  // Ignore BW and PS groups
153  if (group.starts_with("BW") || group.starts_with("PS") || group.starts_with("STREAM:express")) continue;
154 
155  const auto [it, inserted] = m_groups.try_emplace(group, std::make_unique<RatesGroup>(group, msgSvc(), m_doHistograms, m_enableLumiExtrapolation));
156  if (inserted) {
157  // As the group is formed from at least one active trigger - it must be active itself (counter example - CPS group of a PS=-1 trigger)
158  m_activeGroups.insert( it->second.get() );
159  }
160  it->second->addToGroup( newTriggerPtr );
161  // For CPS, we let the trigger know that it is special
162  if (isCPS(group)) {
163  if (newTriggerPtr->getCPSID() != 0) ATH_MSG_WARNING("Trigger " << name << " can only be in one coherent prescale group.");
164  newTriggerPtr->setCPS(group); // This changes the CPSID
165  const size_t CPSID = newTriggerPtr->getCPSID();
166  // Find the lowest prescale of any member in this CPS group
167  m_lowestPrescale.try_emplace(CPSID, FLT_MAX);
168  if (prescale < m_lowestPrescale[CPSID]) m_lowestPrescale[CPSID] = prescale;
169  }
170  }
171  }
172 
173  // Add to total rates
174  const uint32_t level = getLevel(name);
175  if (m_doGlobalGroups) {
176  if (level == 2) m_globalGroups.at(m_l2GroupName)->addToGroup( newTriggerPtr );
177  else if (level == 1) m_globalGroups.at(m_l1GroupName)->addToGroup( newTriggerPtr );
178  }
179  // Add to express group - if express prescale is enabled
180  if (level == 2 && expressPrescale >= 1) {
181  if (m_doGlobalGroups) m_globalGroups.at(m_expressGroupName)->addToGroup( newTriggerPtr );
182  if (m_doExpressRates) m_expressTriggers.insert( newTriggerPtr );
183  }
184 
185  ATH_MSG_DEBUG("newTrigger " << name << " added");
186  return StatusCode::SUCCESS;
187 }

◆ newTrigger() [2/2]

StatusCode RatesAnalysisAlg::newTrigger ( const std::string &  name,
const double  prescale = 1.,
const double  expressPrescale = -1.,
const std::string &  seedName = "",
const double  seedPrecale = 1.,
const std::string &  groups = "",
const Method_t  method = kMANUAL,
const ExtrapStrat_t  extrapolation = kLINEAR 
)
inherited

Version of newTrigger which accepts a set of group names rather than a comma separated string.

Definition at line 89 of file RatesAnalysisAlg.cxx.

96  {
97 
98  std::set<std::string> groupSet;
99  std::istringstream ss(groups);
100  while (ss) {
101  std::string group;
102  if (!std::getline(ss, group, ',')) break;
103  groupSet.insert(group);
104  }
105 
106  return newTrigger(name, prescale, expressPrescale, seedName, seedPrecale, groupSet, method, extrapolation);
107 }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

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() [1/2]

ServiceHandle< StoreGateSvc >& AthAnalysisAlgorithm::outputMetaStore ( )
inlineinherited

Accessor for the output metadata store.

Definition at line 55 of file AthAnalysisAlgorithm.h.

55 { return m_outputMetaStore; }

◆ outputMetaStore() [2/2]

const ServiceHandle< StoreGateSvc >& AthAnalysisAlgorithm::outputMetaStore ( ) const
inlineinherited

Const accessor for the output metadata store.

Definition at line 53 of file AthAnalysisAlgorithm.h.

53 { return m_outputMetaStore; }

◆ pass_HstpFilter()

StatusCode RatesAnalysisAlg::pass_HstpFilter ( bool &  pass)
protectedinherited

Boolean indicating if the event passes the HS-softer-than-PU (HSTP) filter.

Definition at line 613 of file RatesAnalysisAlg.cxx.

613  {
614 
615  if (!m_doMultiSliceDiJet) {
616  return StatusCode::SUCCESS;
617  };
618 
620  ATH_CHECK( truthHS_jets.isValid() );
622  ATH_CHECK( truthPU_jets.isValid() );
623 
624  // Extract the pT of the leading jet that defines the hardness. The jet containers should always be pT sorted
625  const double pT_j1_truthPU = truthPU_jets->size() ? truthPU_jets->front()->pt() : 0; // Hardest PU truth jet
626  const double pT_j1_truthHS = truthHS_jets->size() ? truthHS_jets->front()->pt() : 5000; // In the rare case of no HS truth jets in the event, assume it is close to the 5 GeV threshold
627 
628  // Now see if we pass the filter.
629  pass = pT_j1_truthHS > pT_j1_truthPU;
630  ATH_MSG_DEBUG("Hard Scatter (" << pT_j1_truthHS/1000. << " GeV) Harder Than Pileup (" << pT_j1_truthPU/1000. << " GeV) filter " << (pass ? "PASSES" : "FAILS"));
631  return StatusCode::SUCCESS;
632 }

◆ populateTriggers()

StatusCode RatesAnalysisAlg::populateTriggers ( )
privateinherited

Register all triggers to emulate.

This is actually done at the start of the event loop such that the TDT has access to the configuration.

Definition at line 403 of file RatesAnalysisAlg.cxx.

403  {
404  // Let user add their triggers
405  ATH_MSG_INFO("Initializing User's Triggers (note: we are actually now in the event loop)");
406 
407  if (m_doGlobalGroups) {
408  m_globalGroups.emplace(m_l1GroupName, std::make_unique<RatesGroup>(m_l1GroupName, msgSvc(), m_doHistograms, m_enableLumiExtrapolation));
409  m_globalGroups.emplace(m_l2GroupName, std::make_unique<RatesGroup>(m_l2GroupName, msgSvc(), m_doHistograms, m_enableLumiExtrapolation));
410  m_globalGroups.at(m_l2GroupName)->setDoCachedWeights( m_doUniqueRates ); // This extra sub-weight caching is only utilised by unique-rate groups
411  if (m_doExpressRates) {
413  m_globalGroups.at(m_expressGroupName)->setExpressGroup( true );
414  }
415  }
416 
417  // This runs the derived class's code to add whatever triggers are desired.
418  // Should be calling newTrigger(...), newScanTrigger(...) or addExisting(...), addAllExisting().
420 
421  ATH_MSG_INFO("Computing coherent factors for coherent prescale groups.");
422  // Now we are not going to get any more chains - we can fill in the coherent prescale factors
423  for (const auto& trigger : m_triggers) {
424  const size_t CPSID = trigger.second->getCPSID();
425  if (CPSID != 0) trigger.second->setCoherentFactor( m_lowestPrescale.at(CPSID) );
426  }
427 
429  ATH_MSG_INFO("Creating extra groups to calculate unique rates.");
430  const RatesGroup* l2GroupPtr = m_globalGroups.at(m_l2GroupName).get(); // The finalised list of all HLT chains
431  const RatesGroup* l1GroupPtr = m_globalGroups.at(m_l1GroupName).get(); // The finalised list of all L1 chains
432  for (const auto& trigger : m_triggers) {
433  const uint32_t level = getLevel(trigger.first);
434  m_uniqueGroups.emplace(trigger.first, std::make_unique<RatesGroup>(trigger.first, msgSvc(), false, m_enableLumiExtrapolation)); // Each trigger gets its own unique group. No hist needed
435  RatesTrigger* triggerPtr = m_triggers.at(trigger.first).get();
436  RatesGroup* uniqueGroupPtr = m_uniqueGroups.at(trigger.first).get();
437  triggerPtr->setUniqueGroup( uniqueGroupPtr ); // Create two-way links
438  uniqueGroupPtr->setUniqueTrigger( triggerPtr ); // Create two-way links
439  // Copy in the global rates topology and make note of the unique rates master group
440  if (level == 2) uniqueGroupPtr->duplicateChildren( l2GroupPtr );
441  else if (level == 1) uniqueGroupPtr->duplicateChildren( l1GroupPtr );
442  else continue;
443  // Remove this one chain from the group (a unique rate is the rate of the entire menu minus one chain)
444  uniqueGroupPtr->removeFromGroup( triggerPtr );
445  if (getLevel(trigger.first) == 2) {
446  // For HLT, we can be more computationally efficient by utilising cached info from the hlt group
447  // We remove from the group all other L1 seeds except for the one seeding our chain.
448  // This sub-weight is the only one which can change. The combined weight of all other L1 seeds
449  // can be cached by the master group and fetched from there.
450  uniqueGroupPtr->removeOtherL1( triggerPtr );
451  uniqueGroupPtr->setUseCachedWeights(true);
452  }
453  // Efficiency - if the trigger is disabled, no need to actually calculate anything for it.
454  if (trigger.second->getDisabled() == false) {
455  m_activeGroups.insert( uniqueGroupPtr ); // Add this to the event loop
456  }
457  }
458  }
459 
460  ATH_MSG_INFO("Retrieving HLT chain's ID and Group from HLT menu.");
461 
462  if(!m_configSvc.empty() && m_configSvc.isValid()) {
463  const TrigConf::HLTMenu& hltmenu = m_configSvc->hltMenu( Gaudi::Hive::currentContext() );
464 
465  TrigConf::HLTMenu::const_iterator chain_itr = hltmenu.begin();
466  TrigConf::HLTMenu::const_iterator chain_end = hltmenu.end();
467 
468  m_hltChainIDGroup.resize(hltmenu.size());
469  for (size_t i = 0; i < hltmenu.size(); i++) m_hltChainIDGroup.at(i).resize(3);
470 
471  size_t c = 0;
472  for( ; chain_itr != chain_end; ++chain_itr ) {
473  std::string chainName = ( *chain_itr ).name() ;
474  unsigned int chainID = ( *chain_itr ).counter();
475  std::vector<std::string> chainGroups = ( *chain_itr ).groups();
476  for (std::string& stream : (*chain_itr).streams()){
477  chainGroups.push_back("STREAM:" + stream);
478  }
479  std::string singlechainGroups = "";
480  for (unsigned int j=0; j < chainGroups.size(); ++j){
481  if (j==0) singlechainGroups += chainGroups[j];
482  else singlechainGroups += ", "+chainGroups[j];
483  }
484 
485  m_hltChainIDGroup.at(c).at(0) = chainName;
486  m_hltChainIDGroup.at(c).at(1) = std::to_string(chainID);
487  m_hltChainIDGroup.at(c).at(2) = singlechainGroups;
488  ++c;
489  }
490  }
491 
492  ATH_MSG_INFO("Retrieving L1 item's ID from L1 menu.");
493 
494  if(!m_configSvc.empty() && m_configSvc.isValid()) {
495  const TrigConf::L1Menu& l1menu = m_configSvc->l1Menu( Gaudi::Hive::currentContext() );
496 
497  m_l1ItemID.resize(l1menu.size());
498  for (size_t i = 0; i < l1menu.size(); i++) {
499  // No groups for items
500  m_l1ItemID.at(i).resize(2);
501  }
502 
503  TrigConf::L1Menu::const_iterator item_itr = l1menu.begin();
504  TrigConf::L1Menu::const_iterator item_end = l1menu.end();
505 
506  size_t c = 0;
507  for( ; item_itr != item_end; ++item_itr ) {
508  m_l1ItemID.at(c).at(0) = (*item_itr).name();
509  m_l1ItemID.at(c).at(1) = std::to_string((*item_itr).ctpId());
510  ++c;
511  }
512  }
513 
514  // Print all triggers
515  if (msgLevel(MSG::DEBUG)) {
516  if (m_triggers.size()) {
517  ATH_MSG_DEBUG("################## Configured to estimate rates for the following triggers:");
518  for (const auto& trigger : m_triggers) ATH_MSG_DEBUG(trigger.second->printConfig());
519  }
520  if (m_scanTriggers.size()) {
521  ATH_MSG_DEBUG("################## Configured to estimate rates for the following scan triggers:");
522  for (const auto& trigger : m_scanTriggers) ATH_MSG_DEBUG(trigger.second->printConfig());
523  }
524  if (m_groups.size()) {
525  ATH_MSG_DEBUG("################## Configured to estimate rates for the following groups of triggers:");
526  for (const auto& group : m_groups) ATH_MSG_DEBUG(group.second->printConfig());
527  }
528  if (m_globalGroups.size()) {
529  ATH_MSG_DEBUG("################## Configured to estimate rates for the following global groups of triggers:");
530  for (const auto& group : m_globalGroups) ATH_MSG_DEBUG(group.second->printConfig());
531  }
532  }
533  if (m_doHistograms) {
534  ATH_MSG_DEBUG("################## Registering normalisation histogram:");
535  m_scalingHist = new TH1D(std::format("normalisation{}",m_histogramSuffix.value()).c_str(),";;",3,0.,3.);
536  ATH_CHECK( histSvc()->regHist("/RATESTREAM/normalisation" + m_histogramSuffix, m_scalingHist) );
537  m_bcidHist = new TH1D("bcid",";BCID;Events",3565,-.5,3564.5);
538  ATH_CHECK( histSvc()->regHist("/RATESTREAM/bcid", m_bcidHist) );
539  ATH_MSG_DEBUG("################## Registering metadata tree histogram:");
540  ATH_CHECK( histSvc()->regTree("/RATESTREAM/metadata", std::make_unique<TTree>("metadata", "metadata")) );
541  ATH_CHECK( histSvc()->getTree("/RATESTREAM/metadata", m_metadataTree) );
542  if (m_triggers.size()) {
543  ATH_MSG_DEBUG("################## Registering trigger histograms:");
544  for (const auto& trigger : m_triggers) {
545  if (!trigger.second->doHistograms()) continue; // Not all may be doing histograming
546  std::string lvlSubdir = "";
547  if (trigger.second->getName().find("L1") == 0){
548  lvlSubdir = "Rate_ChainL1_HLT/";
549  } else if (trigger.second->getName().find("HLT") == 0) {
550  lvlSubdir = "Rate_ChainHLT_HLT/";
551  }
552  trigger.second->setDataName("data"+m_histogramSuffix);
553  ATH_CHECK( trigger.second->giveDataHist(histSvc(), std::string("/RATESTREAM/All/" + lvlSubdir + trigger.first + "/data")) );
554  trigger.second->setRateVsMuName("rateVsMu"+m_histogramSuffix);
555  ATH_CHECK( trigger.second->giveMuHist(histSvc(), std::string("/RATESTREAM/All/" + lvlSubdir + trigger.first + "/rateVsMu")) );
557  trigger.second->setRateVsTrainName("rateVsTrain"+m_histogramSuffix);
558  ATH_CHECK( trigger.second->giveTrainHist(histSvc(), std::string("/RATESTREAM/All/" + lvlSubdir + trigger.first + "/rateVsTrain")) );
559  } else trigger.second->clearTrainHist();
560  }
561  }
562  if (m_scanTriggers.size()) {
563  ATH_MSG_DEBUG("################## Registering scan trigger histograms:");
564  for (const auto& trigger : m_scanTriggers) {
565  trigger.second->setHistoName("rateVsThreshold"+m_histogramSuffix);
566  ATH_CHECK( trigger.second->giveThresholdHist(histSvc(), std::string("/RATESTREAM/ScanTriggers/" + trigger.first + "/rateVsThreshold" + m_histogramSuffix)) );
567  }
568  }
569  if (m_groups.size()) {
570  ATH_MSG_DEBUG("################## Registering group histograms:");
571  for (const auto& group : m_groups) {
572  if (!group.second->doHistograms()) continue;
573  std::string groupName = group.first;
574  std::replace( groupName.begin(), groupName.end(), ':', '_');
575  group.second->setDataName("data"+m_histogramSuffix);
576  ATH_CHECK( group.second->giveDataHist(histSvc(), std::string("/RATESTREAM/All/Rate_Group_HLT/" + groupName + "/data")) );
577  group.second->setRateVsMuName("rateVsMu"+m_histogramSuffix);
578  ATH_CHECK( group.second->giveMuHist(histSvc(), std::string("/RATESTREAM/All/Rate_Group_HLT/" + groupName + "/rateVsMu")) );
580  group.second->setRateVsTrainName("rateVsTrain"+m_histogramSuffix);
581  ATH_CHECK( group.second->giveTrainHist(histSvc(), std::string("/RATESTREAM/All/Rate_Group_HLT/" + groupName + "/rateVsTrain")) );
582  } else group.second->clearTrainHist();
583  }
584  }
585  if (m_globalGroups.size()) {
586  ATH_MSG_DEBUG("################## Registering global group histograms:");
587  for (const auto& group : m_globalGroups) {
588  if (!group.second->doHistograms()) continue;
589  group.second->setDataName("data"+m_histogramSuffix);
590  ATH_CHECK( group.second->giveDataHist(histSvc(), std::string("/RATESTREAM/All/Rate_Group_HLT/RATE_GLOBAL_" + group.first + "/data")) );
591  group.second->setRateVsMuName("rateVsMu"+m_histogramSuffix);
592  ATH_CHECK( group.second->giveMuHist(histSvc(), std::string("/RATESTREAM/All/Rate_Group_HLT/RATE_GLOBAL_" + group.first + "/rateVsMu")) );
594  group.second->setRateVsTrainName("rateVsTrain"+m_histogramSuffix);
595  ATH_CHECK( group.second->giveTrainHist(histSvc(), std::string("/RATESTREAM/All/Rate_Group_HLT/RATE_GLOBAL_" + group.first + "/rateVsTrain")) );
596  } else group.second->clearTrainHist();
597  }
598  }
599  }
600 
601  // Has the user set a lumi extrapolation? If not - set a default
603 
604  // We now know the final lumi scaling so we can set the bunch scaling
605  const uint32_t ebPairedBunches = m_enhancedBiasRatesTool->getPairedBunches();
606  ATH_MSG_INFO("Number of paired bunches in input file:" << m_enhancedBiasRatesTool->getPairedBunches());
608 
609  return StatusCode::SUCCESS;
610 }

◆ printInputSummary()

void RatesAnalysisAlg::printInputSummary ( ) const
privateinherited

Print the input data instantaneous luminosity, mu and number of bunches.

Note this is averaged as the data are processed - so should only be printed at the end.

Definition at line 846 of file RatesAnalysisAlg.cxx.

846  {
847  ATH_MSG_INFO("Input " << (m_enhancedBiasRatesTool->isMC() ? "MC" : "EB Data")
848  << " with <L_inst.> = "
849  << m_enhancedBiasRatesTool->getAverageLumi()
850  << " cm-2s-1, <mu> = "
851  << m_enhancedBiasRatesTool->getAverageMu()
852  << ", paired bunches = "
853  << m_enhancedBiasRatesTool->getPairedBunches());
854 }

◆ printStatistics()

void RatesAnalysisAlg::printStatistics ( ) const
privateinherited

Print some extra statistics on events processed.

Definition at line 842 of file RatesAnalysisAlg.cxx.

842  {
843  ATH_MSG_INFO("Processed " << m_eventCounter << " raw events, " << m_weightedEventCounter << " weighted. Total LHC wall-time of " << m_ratesDenominator << " s.");
844 }

◆ printTarget()

void RatesAnalysisAlg::printTarget ( ) const
privateinherited

Print the target instantaneous luminosity, mu and number of bunches.

Definition at line 834 of file RatesAnalysisAlg.cxx.

834  {
836  ATH_MSG_INFO("Calculating rates for a target L_inst. = " << m_targetLumi << " cm-2s-1, mu = " << m_targetMu << ", paired bunches = " << m_targetBunches);
837  } else {
838  ATH_MSG_INFO("Luminosity extrapolation is switched off. Input files will determin the paired bunches, L_inst. and mu profile.");
839  }
840 }

◆ ratesExecute()

StatusCode RatesEmulationExample::ratesExecute ( )
overridevirtual

To be implemented by the user.

Supply pass/fail for all "triggers"

Implements RatesAnalysisAlg.

Definition at line 51 of file RatesEmulationExample.cxx.

51  {
52 
54  ATH_CHECK( electrons.isValid() );
55  std::set<double> electronpTs;
56  for (const auto e : *electrons) electronpTs.insert(e->pt()/1000.);
57  if (electronpTs.size() >= 1 && *electronpTs.rbegin() >= 10.) ATH_CHECK(setTriggerDesicison("OFF_e10", true));
58  if (electronpTs.size() >= 1) ATH_CHECK(setTriggerDesicison("OFF_eX", *electronpTs.rbegin() ));
59 
60 
62  ATH_CHECK( Jets.isValid() );
63 
64  std::set<double> jetpTs;
65  for (const auto j : *Jets) jetpTs.insert(j->pt()/1000.);
66  if (jetpTs.size() >= 1) ATH_CHECK(setTriggerDesicison("OFF_jXa_AntiKt4EMTopo", *jetpTs.rbegin() ));
67 
68  std::set<double> jetcpTs;
69  for (const auto jc : *Jets) {
70  if (std::abs(jc->eta()) < 2.4) jetcpTs.insert(jc->pt()/1000.);
71  }
72  if (jetcpTs.size() >= 1 && *jetcpTs.rbegin() >= 40.) ATH_CHECK(setTriggerDesicison("OFF_j40c_AntiKt4EMTopo", true));
73  if (jetcpTs.size() >= 1) ATH_CHECK(setTriggerDesicison("OFF_jXc_AntiKt4EMTopo", *jetcpTs.rbegin() ));
74  if (jetcpTs.size() >= 3) ATH_CHECK(setTriggerDesicison("OFF_3jXc_AntiKt4EMTopo", *jetcpTs.rbegin()+2 ));
75 
76  return StatusCode::SUCCESS;
77 }

◆ ratesFinalize()

StatusCode RatesEmulationExample::ratesFinalize ( )
overridevirtual

To be implemented by the user.

Implements RatesAnalysisAlg.

Definition at line 79 of file RatesEmulationExample.cxx.

79  {
80  ATH_MSG_DEBUG("In ratesFinalize()");
81  return StatusCode::SUCCESS;
82 }

◆ ratesInitialize()

StatusCode RatesEmulationExample::ratesInitialize ( )
overridevirtual

To be implemented by the user.

Register "triggers" to calculate the rate for

Implements RatesAnalysisAlg.

Definition at line 24 of file RatesEmulationExample.cxx.

24  {
25  ATH_MSG_DEBUG("In ratesInitialize()");
26 
27  // Here we assume a full-ring, other functions are available to change this assumption.
28  // @see setTargetLumiMu(const double lumi, const double mu);
29  // @see setTargetLumiBunches(const double lumi, const int32_t bunches);
30  // @see setTargetMuBunches(const double mu, const int32_t bunches);
32 
33  // Define triggers to emulate
34  // TDT can be used instead by ATH_CHECK(addAllExisting());
35 
36  // name, prescale, expressPrescale, seedName, seedPrescale, groups
37  ATH_CHECK(newTrigger("OFF_e10", 1, -1, "", 1, std::set<std::string>{"RATE_SingleElectron"}));
38  ATH_CHECK(newTrigger("OFF_j40c_AntiKt4EMTopo", 1, -1, "", 1, std::set<std::string>{"RATE_SingleJet"}));
39 
40  // name, thresholdMin, thresholdMax, bins (optional)
41  ATH_CHECK(newScanTrigger("OFF_eX", 20, 40));
42 
43  // name, thresholdMin, thresholdMax
44  ATH_CHECK(newScanTrigger("OFF_jXa_AntiKt4EMTopo", 5, 4000, 799));
45  ATH_CHECK(newScanTrigger("OFF_jXc_AntiKt4EMTopo", 5, 4000, 799));
46  ATH_CHECK(newScanTrigger("OFF_3jXc_AntiKt4EMTopo", 5, 1000, 499));
47 
48  return StatusCode::SUCCESS;
49 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ retrieveMetadata() [1/2]

template<typename T >
StatusCode AthAnalysisAlgorithm::retrieveMetadata ( const std::string &  folder,
const std::string &  key,
T &  out 
)
inlineinherited

Helper function to access IOVMetaDataContainer information helped in the MetaDataStore.

Definition at line 65 of file AthAnalysisAlgorithm.h.

65  {
66  try {
68  } catch(std::exception& e) {
69  ATH_MSG_WARNING(e.what());
70  return StatusCode::FAILURE;
71  }
72  }

◆ retrieveMetadata() [2/2]

template<typename T >
StatusCode AthAnalysisAlgorithm::retrieveMetadata ( const std::string &  folder,
const std::string &  key,
T &  out,
const IOVTime time,
int  channel = -1 
)
inlineinherited

Helper function to access IOVMetaDataContainer information held in InputMetaDataStore, but will check IOVTime.

Also can give a channel (leave as -1 to take first available) IOVTime(runNumber, eventNumber) is a valid constructor for example

Definition at line 76 of file AthAnalysisAlgorithm.h.

76  {
77  try {
79  } catch(std::exception& e) {
80  ATH_MSG_WARNING(e.what());
81  return StatusCode::FAILURE;
82  }
83  }

◆ setExponentialMuScalingFactor()

void RatesAnalysisAlg::setExponentialMuScalingFactor ( const double  f)
inlineinherited

Set the exponential scaling factor for relevant chains.

scaling = exp(f * (targetMu - eventMu))

Parameters
fExponential factor

Definition at line 184 of file RatesAnalysisAlg.h.

184 { m_expoScalingFactor = f; }

◆ setTargetLumi()

void RatesAnalysisAlg::setTargetLumi ( const double  lumi)
inlineinherited

Set the target instantaneous luminosity.

Assumes a full-ring. Mu is derived.

Parameters
lumiThe target lumi in cm-2s-1

Definition at line 172 of file RatesAnalysisAlg.h.

◆ setTargetLumiBunches()

void RatesAnalysisAlg::setTargetLumiBunches ( const double  lumi,
const int32_t  bunches 
)
inherited

Set the target instantaneous luminosity and number of bunches.

Mu is derived.

Parameters
lumiThe target lumi in cm-2s-1
bunchesThe target number of paired bunches

Definition at line 796 of file RatesAnalysisAlg.cxx.

796  {
797  if (m_eventCounter > 1) { // All settings must be defined before we start looping over the sample
798  ATH_MSG_WARNING("Too late to call setTargetLumiBunches. Do this during ratesInitialize().");
799  return;
800  }
801  m_targetLumi = lumi;
802  if (bunches == 0) {
803  ATH_MSG_WARNING("Cannot have bunches = 0. Setting to 1.");
804  m_targetBunches = 1;
805  } else {
806  m_targetBunches = bunches;
807  }
809  printTarget();
810 }

◆ setTargetLumiMu()

void RatesAnalysisAlg::setTargetLumiMu ( const double  lumi,
const double  mu 
)
inherited

Set the target instantaneous luminosity and mu.

Number of bunches in the ring is derived.

Parameters
lumiThe target lumi in cm-2s-1
muThe target pileup

Definition at line 776 of file RatesAnalysisAlg.cxx.

776  {
777  if (m_eventCounter > 1) { // All settings must be defined before we start looping over the sample
778  ATH_MSG_WARNING("Too late to call setTargetLumiMu. Do this during ratesInitialize().");
779  return;
780  }
781  m_targetLumi = lumi;
782  if (isZero(mu)) {
783  ATH_MSG_WARNING("Cannot have <mu> = 0. Setting to 1.");
784  m_targetMu = 1;
785  } else {
786  m_targetMu = mu;
787  }
790  ATH_MSG_WARNING("Un-physical number of bunches " << m_targetBunches << ", should be within 1 < N < " << EnhancedBiasWeighter::FULL_RING+1);
791  if (m_targetBunches == 0) ++m_targetBunches;
792  }
793  printTarget();
794 }

◆ setTargetMu()

void RatesAnalysisAlg::setTargetMu ( const double  mu)
inlineinherited

Set the target pileup.

Assumes a full-ring. Inst. lumi is derived.

Parameters
muThe target pileup

Definition at line 178 of file RatesAnalysisAlg.h.

◆ setTargetMuBunches()

void RatesAnalysisAlg::setTargetMuBunches ( const double  mu,
const int32_t  bunches 
)
inherited

Set the target mu and number of bunches.

The instantaneous luminosity is derived.

Parameters
muThe target pileup
bunchesThe target number of paired bunches

Definition at line 813 of file RatesAnalysisAlg.cxx.

813  {
814  if (m_eventCounter > 1) { // All settings must be defined before we start looping over the sample
815  ATH_MSG_WARNING("Too late to call setTargetMuBunches. Do this during ratesInitialize().");
816  return;
817  }
818  if (bunches == 0) {
819  ATH_MSG_WARNING("Cannot have paired bunches = 0. Setting to 1.");
820  m_targetBunches = 1;
821  } else {
822  m_targetBunches = bunches;
823  }
824  if (isZero(mu)) {
825  ATH_MSG_WARNING("Cannot have mu = 0. Setting to 1.");
826  m_targetMu = 1;
827  } else {
828  m_targetMu = mu;
829  }
831  printTarget();
832 }

◆ setTriggerDesicison() [1/2]

StatusCode RatesAnalysisAlg::setTriggerDesicison ( const std::string &  name,
const bool  triggerIsPassed = true,
const bool  triggerIsActive = true 
)
inherited

Set the pass/fail decision for an item.

Parameters
nameName of the registered trigger
triggerIsPassedTrigger decision.

Definition at line 346 of file RatesAnalysisAlg.cxx.

346  {
347  // Currently - we call execute on setPassed, so the user would be unable to overwrite a decision set e.g. by the TDT.
348  // so for now we only accept positive decisions here.
349  if (triggerIsPassed || triggerIsActive) {
350  const auto iterator = m_triggers.find(name);
351  if (iterator == m_triggers.end()) {
352  ATH_MSG_ERROR("Cannot find trigger " << name << " did you call newTrigger for this in initialize?");
353  return StatusCode::FAILURE;
354  }
355  iterator->second->setPassedAndExecute(triggerIsPassed, triggerIsActive, m_weightingValues); // There is logic in the RatesTrigger to prevent multiple calls per event by accident.
356  m_activatedTriggers.insert( iterator->second.get() );
357  }
358  return StatusCode::SUCCESS;
359 }

◆ setTriggerDesicison() [2/2]

StatusCode RatesAnalysisAlg::setTriggerDesicison ( const std::string &  name,
const double  threshold 
)
inherited

Set the pass threshold for a Scan Trigger item.

Parameters
nameName of the registered scan-trigger
thresholdThe passed threshold in the event

Definition at line 362 of file RatesAnalysisAlg.cxx.

362  {
363  const auto iterator = m_scanTriggers.find(name);
364  if (iterator == m_scanTriggers.end()) {
365  ATH_MSG_ERROR("Cannot find scan-trigger " << name << " did you call newScanTrigger for this in initialize?");
366  return StatusCode::FAILURE;
367  }
368  iterator->second->setPassedAndExecute(threshold, m_weightingValues); // There is logic in the RatesScanTrigger to prevent multiple calls per event by accident.
369  m_activatedTriggers.insert( static_cast<RatesTrigger*>(iterator->second.get()));
370  return StatusCode::SUCCESS;
371 }

◆ sysExecute()

StatusCode AthAnalysisAlgorithm::sysExecute ( const EventContext &  ctx)
overridevirtualinherited

override to do firstEvent method

Definition at line 72 of file AthAnalysisAlgorithm.cxx.

72  {
73  if(!m_doneFirstEvent) {
74  m_doneFirstEvent=true;
75  if( firstExecute().isFailure() ) {
76  ATH_MSG_FATAL("Failure in firstEvent method");
77  return StatusCode::FAILURE;
78  }
79  }
80  return AthHistogramAlgorithm::sysExecute(ctx);
81 }

◆ sysInitialize()

StatusCode AthAnalysisAlgorithm::sysInitialize ( )
overridevirtualinherited

Function initialising the tool in the correct way in Athena.

Reimplemented from AthHistogramAlgorithm.

Definition at line 50 of file AthAnalysisAlgorithm.cxx.

50  {
51 
52  // Connect to the IncidentSvc:
53  ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
54  ATH_CHECK( incSvc.retrieve() );
55 
56  // Set up the right callbacks: //but ensure we don't double-register if sysInitialize called twice (appears to be the case)
57  incSvc->removeListener( this, IncidentType::BeginInputFile );
58  incSvc->addListener( this, IncidentType::BeginInputFile, 0, true );
59  incSvc->removeListener( this, IncidentType::EndInputFile );
60  incSvc->addListener( this, IncidentType::EndInputFile, 0, true );
61  incSvc->removeListener( this, "MetaDataStop" );
62  incSvc->addListener( this, "MetaDataStop", 0, true );
63 
64 
65  // Let the base class do its thing:
67 
68  // Return gracefully:
69  return StatusCode::SUCCESS;
70 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ tree()

TTree * AthHistogramming::tree ( const std::string &  treeName,
const std::string &  tDir = "",
const std::string &  stream = "" 
)
protectedinherited

Simplify the retrieval of registered TTrees.

Definition at line 378 of file AthHistogramming.cxx.

379 {
380  // Build a 32 bit hash out of the name
381  const hash_t treeHash = this->hash(treeName);
382 
383  // See if this entry exists in the map
384  TreeMap_t::const_iterator it = m_treeMap.find( treeHash );
385  if ( it == m_treeMap.end() ) // It doesn't exist!
386  { // Let's see into the THistSvc if somebody else has registered the TTree...
387 
388  // Need to copy the strings as we will massage them from here on
389  std::string treeNameCopy = treeName;
390  std::string tDirCopy = tDir;
391  std::string streamCopy = stream;
392 
393  // Massage the final string to book things
394  std::string bookingString("");
395  this->buildBookingString( bookingString, treeNameCopy, tDirCopy, streamCopy );
396 
397  TTree* treePointer(NULL);
398  if ( !((histSvc()->getTree(bookingString, treePointer)).isSuccess()) )
399  {
400  m_msg << MSG::WARNING
401  << "Problem retrieving the TTree with name " << treeNameCopy
402  << " in " << m_name << "... it doesn't exist, neither in the cached map nor in the THistSvc!"
403  << " Will return an NULL pointer... you have to handle it correctly!" << endmsg;
404  return NULL;
405  }
406  // If we get to here, we actually found the TTree in the THistSvc.
407  // So let's add it to the local cache map and return its pointer
408  m_treeMap.insert( m_treeMap.end(), std::pair< const hash_t, TTree* >( treeHash, treePointer ) );
409  return treePointer;
410  }
411 
412  // Return the pointer to the TTree that we got from the local cache map
413  return it->second;
414 }

◆ updateEvtStore()

void AthAnalysisAlgorithm::updateEvtStore ( Gaudi::Details::PropertyBase &  prop)
protectedinherited

Definition at line 45 of file AthAnalysisAlgorithm.cxx.

45  {
46  evtStore().release().ignore();
47  evtStore().setTypeAndName(prop.toString());
48 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

◆ writeMetadata()

void RatesAnalysisAlg::writeMetadata ( )
privateinherited

Write to outpute tree (if any) the metadata needed downstream.

Definition at line 873 of file RatesAnalysisAlg.cxx.

873  {
874  if (!m_metadataTree) {
875  return;
876  }
877  m_runNumber = m_enhancedBiasRatesTool->getRunNumber();
878  m_metadataTree->Branch("runNumber", &m_runNumber);
879  m_metadataTree->Branch("targetMu", &m_targetMu);
880  m_metadataTree->Branch("targetBunches", &m_targetBunches);
881  m_metadataTree->Branch("targetLumi", &m_targetLumi);
882 
883  std::vector<std::string> triggers;
884  std::vector<std::string> lowers;
885  std::vector<double> prescales;
886  std::vector<double> express;
887  triggers.reserve(m_triggers.size());
888  lowers.reserve(m_triggers.size());
889  prescales.reserve(m_triggers.size());
890  express.reserve(m_triggers.size());
891  for (const auto& trigger : m_triggers) {
892  triggers.push_back(trigger.first);
893  lowers.push_back(trigger.second->getSeedName());
894  prescales.push_back(trigger.second->getPrescale() );
895  express.push_back(trigger.second->getPrescale(true /*includeExpress*/) );
896  }
897  for (const auto& group : m_groups) {
898  triggers.push_back(group.first);
899  lowers.push_back("-");
900  prescales.push_back(-1);
901  express.push_back(-1);
902  }
903  for (const auto& group : m_globalGroups) {
904  triggers.push_back("RATE_GLOBAL_" + group.first);
905  lowers.push_back("-");
906  prescales.push_back(-1);
907  express.push_back(-1);
908  }
909  m_metadataTree->Branch("triggers", &triggers);
910  m_metadataTree->Branch("lowers", &lowers);
911  m_metadataTree->Branch("prescales", &prescales);
912  m_metadataTree->Branch("express", &express);
913  std::vector<int32_t> bunchGroups;
914  bunchGroups.reserve(16);
915 
916  uint32_t masterKey = 0;
917  uint32_t hltPrescaleKey = 0;
918  uint32_t lvl1PrescaleKey = 0;
919 
920  if(!m_enhancedBiasRatesTool->isMC()){
921  bunchGroups = m_enhancedBiasRatesTool->getBunchGroups();
922  }
923  if(!m_configSvc.empty() && m_configSvc.isValid() && ( bunchGroups.size() == 0 || std::all_of(bunchGroups.begin(), bunchGroups.end(), [](int i) { return i==0; }) ) && (!m_enhancedBiasRatesTool->isMC())) {
924  const TrigConf::L1BunchGroupSet& bgs = m_configSvc->l1BunchGroupSet(Gaudi::Hive::currentContext());
925  for (size_t i = 0; i < bgs.maxNBunchGroups(); ++i ) {
926  bunchGroups.push_back(bgs.getBunchGroup(i)->size());
927  }
928  masterKey = m_configSvc->masterKey();
929  hltPrescaleKey = m_configSvc->hltPrescaleKey();
930  lvl1PrescaleKey = m_configSvc->lvl1PrescaleKey();
931  }
932  m_metadataTree->Branch("bunchGroups", &bunchGroups);
933 
934  m_metadataTree->Branch("hltChainIDGroup", &m_hltChainIDGroup);
935  m_metadataTree->Branch("l1ItemID", &m_l1ItemID);
936 
937  m_metadataTree->Branch("masterKey", &masterKey);
938  m_metadataTree->Branch("lvl1PrescaleKey", &lvl1PrescaleKey);
939  m_metadataTree->Branch("hltPrescaleKey", &hltPrescaleKey);
940  std::string atlasProject = std::getenv("AtlasProject");
941  std::string atlasVersion = std::getenv("AtlasVersion");
942  m_metadataTree->Branch("AtlasProject", &atlasProject);
943  m_metadataTree->Branch("AtlasVersion", &atlasVersion);
944  m_metadataTree->Fill();
945 }

Member Data Documentation

◆ m_activatedTriggers

std::unordered_set<RatesTrigger*> RatesAnalysisAlg::m_activatedTriggers
privateinherited

Triggers which were changed & hence need to be reset at the event end.

Definition at line 255 of file RatesAnalysisAlg.h.

◆ m_activeGroups

std::unordered_set<RatesGroup*> RatesAnalysisAlg::m_activeGroups
privateinherited

All groups which are enabled (PS >= 1)

Definition at line 257 of file RatesAnalysisAlg.h.

◆ m_autoTriggers

std::vector<std::string> RatesAnalysisAlg::m_autoTriggers
privateinherited

List of triggers which it is up to us to the algorithm to work out the pass/fail for.

Definition at line 259 of file RatesAnalysisAlg.h.

◆ m_bcidHist

TH1D* RatesAnalysisAlg::m_bcidHist
privateinherited

Histogram of the BCIDs distribution of the processing.

Definition at line 300 of file RatesAnalysisAlg.h.

◆ m_configSvc

ServiceHandle<TrigConf::ITrigConfigSvc> RatesAnalysisAlg::m_configSvc {this, "TrigConfigSvc", "TrigConf::xAODConfigSvc"}
privateinherited

Definition at line 273 of file RatesAnalysisAlg.h.

◆ m_currentEventIsUnbiased

Gaudi::Property<bool> RatesAnalysisAlg::m_currentEventIsUnbiased
privateinherited

If the current event was triggered online by RDx or not.

Random seeded HLT chains must only see these

Definition at line 286 of file RatesAnalysisAlg.h.

◆ m_currentFile

TFile* AthAnalysisAlgorithm::m_currentFile {nullptr}
privateinherited

Definition at line 120 of file AthAnalysisAlgorithm.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doExpressRates

Gaudi::Property<bool> RatesAnalysisAlg::m_doExpressRates {this, "DoExpressRates", false, "Calculate total rates for the express stream."}
privateinherited

Definition at line 284 of file RatesAnalysisAlg.h.

◆ m_doGlobalGroups

Gaudi::Property<bool> RatesAnalysisAlg::m_doGlobalGroups {this, "DoGlobalGroups", false, "Calculate total rates for each trigger level."}
privateinherited

Definition at line 282 of file RatesAnalysisAlg.h.

◆ m_doHistograms

Gaudi::Property<bool> RatesAnalysisAlg::m_doHistograms {this, "DoHistograms", true, "Switch on histogram output of rate vs. mu and position in train."}
protectedinherited

Definition at line 191 of file RatesAnalysisAlg.h.

◆ m_doMultiSliceDiJet

Gaudi::Property<bool> RatesAnalysisAlg::m_doMultiSliceDiJet {this, "DoMultiSliceDiJet", false, "Enable the HS-softer-than-PU (HSTP) filter; reweight the Slices according to Jet/ETMiss procedure; recommended by PMG for di-jet slices."}
protectedinherited

Definition at line 192 of file RatesAnalysisAlg.h.

◆ m_doneFirstEvent

bool AthAnalysisAlgorithm::m_doneFirstEvent {false}
privateinherited

Definition at line 122 of file AthAnalysisAlgorithm.h.

◆ m_doTriggerGroups

Gaudi::Property<bool> RatesAnalysisAlg::m_doTriggerGroups {this, "DoTriggerGroups", false, "Calculate total rates for each group of triggers."}
privateinherited

Definition at line 283 of file RatesAnalysisAlg.h.

◆ m_doUniqueRates

Gaudi::Property<bool> RatesAnalysisAlg::m_doUniqueRates {this, "DoUniqueRates", false, "Calculate unique rates for all chains (slow). Requires DoGlobalGroups=True too."}
privateinherited

Definition at line 281 of file RatesAnalysisAlg.h.

◆ m_effMap

EffMap_t AthHistogramming::m_effMap
privateinherited

The map of histogram names to their pointers.

Definition at line 208 of file AthHistogramming.h.

◆ m_electron_RHKey

SG::ReadHandleKey<xAOD::ElectronContainer> RatesEmulationExample::m_electron_RHKey {this, "ElectronsKey", "Electrons", "Key for the electrons collection"}
private

Definition at line 24 of file RatesEmulationExample.h.

◆ m_enableLumiExtrapolation

Gaudi::Property<bool> RatesAnalysisAlg::m_enableLumiExtrapolation {this, "EnableLumiExtrapolation", true, "If false then no extrapolation in L, N_bunch or <mu> will be performed.."}
privateinherited

Definition at line 287 of file RatesAnalysisAlg.h.

◆ m_enhancedBiasRatesTool

ToolHandle<IEnhancedBiasWeighter> RatesAnalysisAlg::m_enhancedBiasRatesTool {this, "EnhancedBiasRatesTool", "EnhancedBiasWeighter/EnhancedBiasRatesTool"}
privateinherited

Definition at line 271 of file RatesAnalysisAlg.h.

◆ m_eventCounter

uint32_t RatesAnalysisAlg::m_eventCounter
privateinherited

Count how many events processed.

Definition at line 296 of file RatesAnalysisAlg.h.

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> RatesAnalysisAlg::m_eventInfoKey {this, "EventInfo", "EventInfo", "EventInfo name"}
privateinherited

Definition at line 275 of file RatesAnalysisAlg.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_existingTriggers

std::unordered_map<std::string, const Trig::ChainGroup*> RatesAnalysisAlg::m_existingTriggers
privateinherited

Map of triggers which we ask the TDT ChainGroup for the pass/fail.

Definition at line 261 of file RatesAnalysisAlg.h.

◆ m_expoScalingFactor

Gaudi::Property<double> RatesAnalysisAlg::m_expoScalingFactor {this, "ExpoScalingFactor", 0.1, "Optional. Exponential factor if using exponential-mu rates scaling."}
privateinherited

Definition at line 279 of file RatesAnalysisAlg.h.

◆ m_expressGroupName

const std::string RatesAnalysisAlg::m_expressGroupName = "Express"
privateinherited

Definition at line 269 of file RatesAnalysisAlg.h.

◆ m_expressTriggers

std::unordered_set<RatesTrigger*> RatesAnalysisAlg::m_expressTriggers
privateinherited

Triggers with non-zero express PS, used to print them at the end.

Definition at line 256 of file RatesAnalysisAlg.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_globalGroups

std::unordered_map<std::string, std::unique_ptr<RatesGroup> > RatesAnalysisAlg::m_globalGroups
privateinherited

Big (master) groups which do the OR of the whole menu.

Definition at line 252 of file RatesAnalysisAlg.h.

◆ m_graphMap

GraphMap_t AthHistogramming::m_graphMap
privateinherited

The map of TGraph names to their pointers.

Definition at line 222 of file AthHistogramming.h.

◆ m_groups

std::unordered_map<std::string, std::unique_ptr<RatesGroup> > RatesAnalysisAlg::m_groups
privateinherited

All regular and CPS groups.

Definition at line 251 of file RatesAnalysisAlg.h.

◆ m_histMap

HistMap_t AthHistogramming::m_histMap
privateinherited

The map of histogram names to their pointers.

Definition at line 201 of file AthHistogramming.h.

◆ m_histNamePostfix

std::string AthHistogramAlgorithm::m_histNamePostfix
privateinherited

The postfix for the histogram THx name.

Definition at line 97 of file AthHistogramAlgorithm.h.

◆ m_histNamePrefix

std::string AthHistogramAlgorithm::m_histNamePrefix
privateinherited

The prefix for the histogram THx name.

Definition at line 94 of file AthHistogramAlgorithm.h.

◆ m_histogramSuffix

Gaudi::Property<std::string> RatesAnalysisAlg::m_histogramSuffix {this, "histogramSuffix", "", "Optional suffix to add to the name of the rate denominator histogram."}
privateinherited

Definition at line 290 of file RatesAnalysisAlg.h.

◆ m_histSvc

ServiceHandle<ITHistSvc> AthHistogramAlgorithm::m_histSvc
privateinherited

Default constructor: AthHistogramAlgorithm();.

a handle on the Hist/TTree registration service

Definition at line 83 of file AthHistogramAlgorithm.h.

◆ m_histTitlePostfix

std::string AthHistogramAlgorithm::m_histTitlePostfix
privateinherited

The postfix for the histogram THx title.

Definition at line 103 of file AthHistogramAlgorithm.h.

◆ m_histTitlePrefix

std::string AthHistogramAlgorithm::m_histTitlePrefix
privateinherited

The prefix for the histogram THx title.

Definition at line 100 of file AthHistogramAlgorithm.h.

◆ m_hltChainIDGroup

std::vector<std::vector<std::string> > RatesAnalysisAlg::m_hltChainIDGroup
privateinherited

Definition at line 264 of file RatesAnalysisAlg.h.

◆ m_inelasticCrossSection

Gaudi::Property<double> RatesAnalysisAlg::m_inelasticCrossSection {this, "InelasticCrossSection", 8e-26, "Inelastic cross section in units cm^2. Default 80 mb at 13 TeV."}
privateinherited

Definition at line 280 of file RatesAnalysisAlg.h.

◆ m_inputMetaStore

ServiceHandle< StoreGateSvc > AthAnalysisAlgorithm::m_inputMetaStore
privateinherited

Object accessing the input metadata store.

Definition at line 116 of file AthAnalysisAlgorithm.h.

◆ m_jet_RHKey

SG::ReadHandleKey<xAOD::JetContainer> RatesEmulationExample::m_jet_RHKey {this, "JetsKey", "AntiKt4EMTopoJets", "Key for the jet collection"}
private

Definition at line 23 of file RatesEmulationExample.h.

◆ m_l1GroupName

const std::string RatesAnalysisAlg::m_l1GroupName = "L1"
privateinherited

Definition at line 267 of file RatesAnalysisAlg.h.

◆ m_l1ItemID

std::vector<std::vector<std::string> > RatesAnalysisAlg::m_l1ItemID
privateinherited

Definition at line 265 of file RatesAnalysisAlg.h.

◆ m_l2GroupName

const std::string RatesAnalysisAlg::m_l2GroupName = "HLT"
privateinherited

Definition at line 268 of file RatesAnalysisAlg.h.

◆ m_linearLumiFactor

double RatesAnalysisAlg::m_linearLumiFactor
protectedinherited

Definition at line 188 of file RatesAnalysisAlg.h.

◆ m_lowerTrigger

std::unordered_map<std::string, std::string> RatesAnalysisAlg::m_lowerTrigger
privateinherited

Map of triggers lower chain, to tell if a HLT trigger ran or not.

Definition at line 262 of file RatesAnalysisAlg.h.

◆ m_lowestPrescale

std::unordered_map<size_t, double> RatesAnalysisAlg::m_lowestPrescale
privateinherited

Lowest prescale within a CPS group, key is the hash of the CPS group name.

Definition at line 258 of file RatesAnalysisAlg.h.

◆ m_lumi

Gaudi::Property<float> RatesEmulationExample::m_lumi {this, "TargetLuminosity", 2e34, "Targer inst. luminosity, assuming full ring."}
private

Definition at line 21 of file RatesEmulationExample.h.

◆ m_metadataTree

TTree* RatesAnalysisAlg::m_metadataTree
privateinherited

Used to write out some metadata needed by post-processing (e.g.

bunchgroup, lumi)

Definition at line 302 of file RatesAnalysisAlg.h.

◆ m_msg

MsgStream AthHistogramming::m_msg
privateinherited

Cached Message Stream.

Definition at line 248 of file AthHistogramming.h.

◆ m_name

std::string AthHistogramming::m_name
privateinherited

Instance name.

Definition at line 245 of file AthHistogramming.h.

◆ m_outputMetaStore

ServiceHandle< StoreGateSvc > AthAnalysisAlgorithm::m_outputMetaStore
privateinherited

Object accessing the output metadata store.

Definition at line 118 of file AthAnalysisAlgorithm.h.

◆ m_prefix

std::string AthHistogramAlgorithm::m_prefix
privateinherited

Name of the ROOT output stream (file)

Definition at line 88 of file AthHistogramAlgorithm.h.

◆ m_prescalesJSON

Gaudi::Property<std::map<std::string, std::map<std::string, double> > > RatesAnalysisAlg::m_prescalesJSON {this, "PrescalesJSON", {}, "Optional JSON of prescales from the TrigMenuRuleBook to apply."}
privateinherited

Definition at line 289 of file RatesAnalysisAlg.h.

◆ m_ratesDenominator

double RatesAnalysisAlg::m_ratesDenominator
protectedinherited

How much walltime is seen by the algorithm.

This is what we need to normalise to.

Definition at line 190 of file RatesAnalysisAlg.h.

◆ m_rootDir

std::string AthHistogramAlgorithm::m_rootDir
privateinherited

Name of the ROOT directory.

Definition at line 91 of file AthHistogramAlgorithm.h.

◆ m_runNumber

uint32_t RatesAnalysisAlg::m_runNumber
privateinherited

What is the RunNumber.

Definition at line 295 of file RatesAnalysisAlg.h.

◆ m_scalingHist

TH1D* RatesAnalysisAlg::m_scalingHist
privateinherited

One-bin histogram to store the normalisation of the sample, for use in later combinations.

Definition at line 299 of file RatesAnalysisAlg.h.

◆ m_scanTriggers

std::unordered_map<std::string, std::unique_ptr<RatesScanTrigger> > RatesAnalysisAlg::m_scanTriggers
privateinherited

All individual rates-scan triggers (L1 or HLT)

Definition at line 250 of file RatesAnalysisAlg.h.

◆ m_streamName

std::string AthHistogramming::m_streamName
privateinherited

Name of the ROOT output stream (file)

Definition at line 226 of file AthHistogramming.h.

◆ m_targetBunches

double RatesAnalysisAlg::m_targetBunches
privateinherited

How many bunches the prediction is targeting.

Definition at line 293 of file RatesAnalysisAlg.h.

◆ m_targetLumi

double RatesAnalysisAlg::m_targetLumi
privateinherited

What instantaneous luminosity the prediction is targeting.

Definition at line 294 of file RatesAnalysisAlg.h.

◆ m_targetMu

double RatesAnalysisAlg::m_targetMu
privateinherited

What pileup level the prediction is targeting.

Definition at line 292 of file RatesAnalysisAlg.h.

◆ m_tdt

ToolHandle<Trig::TrigDecisionTool> RatesAnalysisAlg::m_tdt {this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool"}
privateinherited

Definition at line 272 of file RatesAnalysisAlg.h.

◆ m_treeMap

TreeMap_t AthHistogramming::m_treeMap
privateinherited

The map of TTree names to their pointers.

Definition at line 215 of file AthHistogramming.h.

◆ m_triggers

std::unordered_map<std::string, std::unique_ptr<RatesTrigger> > RatesAnalysisAlg::m_triggers
protectedinherited

All individual triggers (L1 or HLT)

Definition at line 195 of file RatesAnalysisAlg.h.

◆ m_truthHS_jets_RHKey

SG::ReadHandleKey<xAOD::JetContainer> RatesAnalysisAlg::m_truthHS_jets_RHKey {this, "TruthHSJetsKey", "AntiKt4TruthJets", "Key for the hard scatter truth jet collection"}
privateinherited

Definition at line 276 of file RatesAnalysisAlg.h.

◆ m_truthPU_jets_RHKey

SG::ReadHandleKey<xAOD::JetContainer> RatesAnalysisAlg::m_truthPU_jets_RHKey {this, "truthPUJetsKey", "InTimeAntiKt4TruthJets", "Key for the pileup jet collection"}
privateinherited

Definition at line 277 of file RatesAnalysisAlg.h.

◆ m_uniqueGroups

std::unordered_map<std::string, std::unique_ptr<RatesGroup> > RatesAnalysisAlg::m_uniqueGroups
privateinherited

Groups used to obtain unique rates for chains.

Definition at line 253 of file RatesAnalysisAlg.h.

◆ m_useBunchCrossingData

Gaudi::Property<bool> RatesAnalysisAlg::m_useBunchCrossingData {this, "UseBunchCrossingData", true, "BunchCrossing data requires CONDBR2 access. Can be disabled here if this is a problem."}
privateinherited

Definition at line 285 of file RatesAnalysisAlg.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vetoStartOfTrain

Gaudi::Property<uint32_t> RatesAnalysisAlg::m_vetoStartOfTrain {this, "VetoStartOfTrain", 0, "How many BCID to veto at the start of a bunch train."}
privateinherited

Definition at line 288 of file RatesAnalysisAlg.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_weightedEventCounter

double RatesAnalysisAlg::m_weightedEventCounter
privateinherited

Count how many weighted events were processed.

Definition at line 297 of file RatesAnalysisAlg.h.

◆ m_weightingValues

WeightingValuesSummary_t RatesAnalysisAlg::m_weightingValues
protectedinherited

Possible weighting & lumi extrapolation values for the current event.

Definition at line 189 of file RatesAnalysisAlg.h.


The documentation for this class was generated from the following files:
RunTileTBRec.method
method
Definition: RunTileTBRec.py:73
AthHistogramming::m_rootDir
std::string m_rootDir
Name of the ROOT directory.
Definition: AthHistogramming.h:229
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TrigConf::DataStructure::data
const ptree & data() const
Access to the underlying data, if needed.
Definition: DataStructure.h:83
TrigConf::HLTPrescalesSet::HLTPrescale::prescale
double prescale
Definition: HLTPrescalesSet.h:24
RatesAnalysisAlg::printStatistics
void printStatistics() const
Print some extra statistics on events processed.
Definition: RatesAnalysisAlg.cxx:842
AthHistogramming::histSvc
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
Definition: AthHistogramming.h:421
AthHistogramAlgorithm::histSvc
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
Definition: AthHistogramAlgorithm.h:113
mergePhysValFiles.pattern
pattern
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:25
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
RatesAnalysisAlg::m_expressGroupName
const std::string m_expressGroupName
Definition: RatesAnalysisAlg.h:269
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
AthAnalysisAlgorithm::m_currentFile
TFile * m_currentFile
Definition: AthAnalysisAlgorithm.h:120
ChainDefInMenu.groups
groups
Definition: ChainDefInMenu.py:43
RatesAnalysisAlg::populateTriggers
StatusCode populateTriggers()
Register all triggers to emulate.
Definition: RatesAnalysisAlg.cxx:403
RatesAnalysisAlg::m_runNumber
uint32_t m_runNumber
What is the RunNumber.
Definition: RatesAnalysisAlg.h:295
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
AthHistogramming::myReplace
void myReplace(std::string &str, const std::string &oldStr, const std::string &newStr)
Helper method to replace sub-string.
Definition: AthHistogramming.cxx:590
WeightingValuesSummary_t::m_eventLiveTime
double m_eventLiveTime
How much wall-time at P1 did this event represent.
Definition: RatesHistoBase.h:62
RatesScanTrigger
Used to calculate a rate scan as a function of some threshold value.
Definition: RatesScanTrigger.h:14
AthHistogramming::m_msg
MsgStream m_msg
Cached Message Stream.
Definition: AthHistogramming.h:248
RatesAnalysisAlg::m_tdt
ToolHandle< Trig::TrigDecisionTool > m_tdt
Definition: RatesAnalysisAlg.h:272
AthHistogramming::m_histMap
HistMap_t m_histMap
The map of histogram names to their pointers.
Definition: AthHistogramming.h:201
AthAnalysisAlgorithm::endInputFile
virtual StatusCode endInputFile()
Function called as an input file is being closed.
Definition: AthAnalysisAlgorithm.cxx:122
RatesAnalysisAlg::newTrigger
StatusCode newTrigger(const std::string &name, const double prescale=1., const double expressPrescale=-1., const std::string &seedName="", const double seedPrecale=1., const std::string &groups="", const Method_t method=kMANUAL, const ExtrapStrat_t extrapolation=kLINEAR)
Version of newTrigger which accepts a set of group names rather than a comma separated string.
Definition: RatesAnalysisAlg.cxx:89
RatesGroup::removeFromGroup
void removeFromGroup(const RatesTrigger *toRemove)
Remove a trigger from this group.
Definition: RatesGroup.cxx:67
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
RatesAnalysisAlg::m_enableLumiExtrapolation
Gaudi::Property< bool > m_enableLumiExtrapolation
Definition: RatesAnalysisAlg.h:287
RatesAnalysisAlg::m_lowerTrigger
std::unordered_map< std::string, std::string > m_lowerTrigger
Map of triggers lower chain, to tell if a HLT trigger ran or not.
Definition: RatesAnalysisAlg.h:262
RatesAnalysisAlg::ratesExecute
virtual StatusCode ratesExecute()=0
To be implemented by the user.
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
AthAnalysisAlgorithm::firstExecute
virtual StatusCode firstExecute()
Function called when first execute is encountered user can read event information with evtStore()
Definition: AthAnalysisAlgorithm.cxx:139
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
vtune_athena.format
format
Definition: vtune_athena.py:14
AthHistogramAlgorithm::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Default constructor: AthHistogramAlgorithm();.
Definition: AthHistogramAlgorithm.h:83
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
RatesAnalysisAlg::m_truthHS_jets_RHKey
SG::ReadHandleKey< xAOD::JetContainer > m_truthHS_jets_RHKey
Definition: RatesAnalysisAlg.h:276
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TrigConf::HLTMenu
HLT menu configuration.
Definition: HLTMenu.h:21
python.RatesAnalysisFullMenu.prescales
prescales
Definition: RatesAnalysisFullMenu.py:121
AthHistogramming::book
StatusCode book(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
Definition: AthHistogramming.h:303
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
RatesAnalysisAlg::m_scanTriggers
std::unordered_map< std::string, std::unique_ptr< RatesScanTrigger > > m_scanTriggers
All individual rates-scan triggers (L1 or HLT)
Definition: RatesAnalysisAlg.h:250
RatesAnalysisAlg::checkGotTDT
StatusCode checkGotTDT()
Internal check that the TDT is fetched.
Definition: RatesAnalysisAlg.cxx:314
RatesAnalysisAlg::newScanTrigger
StatusCode newScanTrigger(const std::string &name, const double thresholdMin, const double thresholdMax, const uint32_t thresholdBins=100, const RatesScanTrigger::TriggerBehaviour_t behaviour=RatesScanTrigger::TriggerBehaviour_t::kTriggerBelowThreshold, const double prescale=1., const std::string &seedName="", const double seedPrecale=1., const Method_t method=kMANUAL, const ExtrapStrat_t extrapolation=kLINEAR)
Register a new threshold scan trigger which plots rate as a function of some dependent variable.
Definition: RatesAnalysisAlg.cxx:40
WeightingValuesSummary_t::m_isUnbiased
bool m_isUnbiased
If the event was taken online with a RD trigger.
Definition: RatesHistoBase.h:60
RatesAnalysisAlg::m_l2GroupName
const std::string m_l2GroupName
Definition: RatesAnalysisAlg.h:268
RatesGroup::setUseCachedWeights
void setUseCachedWeights(const bool i)
Set to use cached weights from the Master group (need ptr to m_masterGroup)
Definition: RatesGroup.cxx:188
Jets
Definition: Jets.py:1
RatesAnalysisAlg::initialize_extra_content
virtual StatusCode initialize_extra_content()
Initialization of additional payload for inherited classes.
Definition: RatesAnalysisAlg.cxx:373
RunTileMonitoring.groupName
groupName
Definition: RunTileMonitoring.py:158
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
AthAnalysisAlgorithm::m_inputMetaStore
ServiceHandle< StoreGateSvc > m_inputMetaStore
Object accessing the input metadata store.
Definition: AthAnalysisAlgorithm.h:116
RatesAnalysisAlg::m_bcidHist
TH1D * m_bcidHist
Histogram of the BCIDs distribution of the processing.
Definition: RatesAnalysisAlg.h:300
WeightingValuesSummary_t::m_eventLumi
double m_eventLumi
The instantaneous lumi in cm-2s-1.
Definition: RatesHistoBase.h:59
skel.it
it
Definition: skel.GENtoEVGEN.py:407
RatesAnalysisAlg::m_enhancedBiasRatesTool
ToolHandle< IEnhancedBiasWeighter > m_enhancedBiasRatesTool
Definition: RatesAnalysisAlg.h:271
RatesAnalysisAlg::ratesInitialize
virtual StatusCode ratesInitialize()=0
To be implemented by the user.
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:70
WeightingValuesSummary_t::print
const std::string print()
Definition: RatesHistoBase.h:69
RatesAnalysisAlg::m_expoScalingFactor
Gaudi::Property< double > m_expoScalingFactor
Definition: RatesAnalysisAlg.h:279
TrigConf::HLTPrescalesSet::prescale_express
const HLTPrescale & prescale_express(const std::string &chainName) const
HLT prescales by chain names.
Definition: HLTPrescalesSet.cxx:96
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
RatesAnalysisAlg::m_groups
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_groups
All regular and CPS groups.
Definition: RatesAnalysisAlg.h:251
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
RatesAnalysisAlg::m_ratesDenominator
double m_ratesDenominator
How much walltime is seen by the algorithm.
Definition: RatesAnalysisAlg.h:190
WeightingValuesSummary_t::m_linearLumiFactor
double m_linearLumiFactor
What weight needs to be applied to extrapolate rates linear in mu and bunches.
Definition: RatesHistoBase.h:66
WeightingValuesSummary_t::m_distanceInTrain
uint32_t m_distanceInTrain
How far into the bunch train the event was, in bunch crossings.
Definition: RatesHistoBase.h:61
AthCommonMsg< Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
RatesAnalysisAlg::m_doUniqueRates
Gaudi::Property< bool > m_doUniqueRates
Definition: RatesAnalysisAlg.h:281
RatesAnalysisAlg::m_globalGroups
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_globalGroups
Big (master) groups which do the OR of the whole menu.
Definition: RatesAnalysisAlg.h:252
RatesAnalysisAlg::m_targetMu
double m_targetMu
What pileup level the prediction is targeting.
Definition: RatesAnalysisAlg.h:292
TrigConf::L1Menu
L1 menu configuration.
Definition: L1Menu.h:28
RatesEmulationExample::m_electron_RHKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_electron_RHKey
Definition: RatesEmulationExample.h:24
AthAnalysisAlgorithm::inputMetaStore
const ServiceHandle< StoreGateSvc > & inputMetaStore() const
Const accessor for the input metadata store.
Definition: AthAnalysisAlgorithm.h:49
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
RatesAnalysisAlg::m_autoTriggers
std::vector< std::string > m_autoTriggers
List of triggers which it is up to us to the algorithm to work out the pass/fail for.
Definition: RatesAnalysisAlg.h:259
python.TrigTLAMonitorAlgorithm.triggers
triggers
Definition: TrigTLAMonitorAlgorithm.py:196
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
beamspotman.tokens
tokens
Definition: beamspotman.py:1282
TrigConf::L1BunchGroupSet::getBunchGroup
const std::shared_ptr< L1BunchGroup > & getBunchGroup(const std::string &name) const
Accessor to the bunchgroup by name.
Definition: L1BunchGroupSet.cxx:118
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
RatesEmulationExample::m_lumi
Gaudi::Property< float > m_lumi
Definition: RatesEmulationExample.h:21
AthHistogramming::m_histNamePostfix
std::string m_histNamePostfix
The postfix for the histogram THx name.
Definition: AthHistogramming.h:235
RatesAnalysisAlg::kEXISTING
@ kEXISTING
The pass/fail decision is taken from the Trigger Decision Tool for an existing trigger.
Definition: RatesAnalysisAlg.h:46
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
H5Utils::getTree
std::string getTree(const std::string &file_name)
Definition: getTree.cxx:36
RatesTrigger::setUniqueGroup
void setUniqueGroup(const RatesGroup *unique)
If I have a group which is calculating my unique rate.
Definition: RatesTrigger.cxx:167
ExtrapStrat_t
ExtrapStrat_t
Extrapolation strategy to apply to each emulated trigger.
Definition: RatesHistoBase.h:30
RatesAnalysisAlg::setTargetMuBunches
void setTargetMuBunches(const double mu, const int32_t bunches)
Set the target mu and number of bunches.
Definition: RatesAnalysisAlg.cxx:813
RatesAnalysisAlg::m_prescalesJSON
Gaudi::Property< std::map< std::string, std::map< std::string, double > > > m_prescalesJSON
Definition: RatesAnalysisAlg.h:289
RatesAnalysisAlg::kAUTO
@ kAUTO
The pass/fail decision is automatically emulated per event based on decoding the trigger name.
Definition: RatesAnalysisAlg.h:45
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
AthAnalysisAlgorithm::m_doneFirstEvent
bool m_doneFirstEvent
Definition: AthAnalysisAlgorithm.h:122
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
RatesAnalysisAlg::m_weightedEventCounter
double m_weightedEventCounter
Count how many weighted events were processed.
Definition: RatesAnalysisAlg.h:297
RatesAnalysisAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: RatesAnalysisAlg.h:275
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
RatesTrigger
Used to calculate the rate for a single trigger at L1 or the HLT.
Definition: RatesTrigger.h:15
RatesGroup
Used to calculate the rate for a group of RatesTrigger objects at L1 or the HLT.
Definition: RatesGroup.h:29
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
WeightingValuesSummary_t::m_enhancedBiasWeight
double m_enhancedBiasWeight
A property of the event derived from online enhanced bias prescales.
Definition: RatesHistoBase.h:57
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
RatesAnalysisAlg::executeTriggerEmulation
StatusCode executeTriggerEmulation()
Internal call to get the pass/fail for all automatically emulated triggers.
Definition: RatesAnalysisAlg.cxx:730
AthCommonDataStore
Definition: AthCommonDataStore.h:52
Generate_dsid_ranseed.seed
seed
Definition: Generate_dsid_ranseed.py:10
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
RatesTrigger::setSeedsFromRandom
void setSeedsFromRandom(const bool i)
Set if this trigger is to behave as if it seeds from a random L1 item.
Definition: RatesTrigger.cxx:149
Trk::active
@ active
Definition: Layer.h:47
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigConf::HLTPrescalesSet::prescale
const HLTPrescale & prescale(const std::string &chainName) const
HLT prescales by chain names.
Definition: HLTPrescalesSet.cxx:85
RatesTrigger::setCPS
void setCPS(const std::string &group)
If I'm in a CPS group, set the group name (I'll keep a copy of the hash)
Definition: RatesTrigger.cxx:171
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
RatesAnalysisAlg::m_metadataTree
TTree * m_metadataTree
Used to write out some metadata needed by post-processing (e.g.
Definition: RatesAnalysisAlg.h:302
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
RatesAnalysisAlg::m_targetBunches
double m_targetBunches
How many bunches the prediction is targeting.
Definition: RatesAnalysisAlg.h:293
RatesAnalysisAlg::m_doMultiSliceDiJet
Gaudi::Property< bool > m_doMultiSliceDiJet
Definition: RatesAnalysisAlg.h:192
RatesAnalysisAlg::setTargetLumiBunches
void setTargetLumiBunches(const double lumi, const int32_t bunches)
Set the target instantaneous luminosity and number of bunches.
Definition: RatesAnalysisAlg.cxx:796
calibdata.exception
exception
Definition: calibdata.py:495
RatesAnalysisAlg::RatesAnalysisAlg
RatesAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: RatesAnalysisAlg.cxx:22
python.RatesAnalysisFullMenu.e34
e34
Definition: RatesAnalysisFullMenu.py:29
RatesAnalysisAlg::isCPS
bool isCPS(const std::string &group) const
String match coherent prescale groups.
Definition: RatesAnalysisAlg.cxx:856
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
RatesAnalysisAlg::m_uniqueGroups
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_uniqueGroups
Groups used to obtain unique rates for chains.
Definition: RatesAnalysisAlg.h:253
dumpFileToPlots.treeName
string treeName
Definition: dumpFileToPlots.py:19
RatesAnalysisAlg::m_weightingValues
WeightingValuesSummary_t m_weightingValues
Possible weighting & lumi extrapolation values for the current event.
Definition: RatesAnalysisAlg.h:189
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
RatesAnalysisAlg::addExisting
StatusCode addExisting(const std::string &pattern)
Register some existing triggers based on wild-card match, e.g.
Definition: RatesAnalysisAlg.cxx:198
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
WeightingValuesSummary_t::m_expoMuFactor
double m_expoMuFactor
What weight needs to be applied to extrapolate rates linear in bunches and exponential in mu.
Definition: RatesHistoBase.h:67
hist_file_dump.f
f
Definition: hist_file_dump.py:140
TrigConf::L1BunchGroupSet::maxNBunchGroups
constexpr std::size_t maxNBunchGroups() const
Maximum number of bunchgroups.
Definition: L1BunchGroupSet.h:107
RatesTrigger::getCPSID
size_t getCPSID() const
Get the hash of my CPS group name.
Definition: RatesTrigger.cxx:173
RatesAnalysisAlg::kMANUAL
@ kMANUAL
The pass/fail decision is evaluated by the user and supplied per event using setTriggerDesicison.
Definition: RatesAnalysisAlg.h:44
RatesAnalysisAlg::m_doHistograms
Gaudi::Property< bool > m_doHistograms
Definition: RatesAnalysisAlg.h:191
AthAnalysisAlgorithm::metaDataStop
virtual StatusCode metaDataStop()
Function called before finalize user can read output metadata from outputMetaStore()
Definition: AthAnalysisAlgorithm.cxx:130
AthHistogramming::m_graphMap
GraphMap_t m_graphMap
The map of TGraph names to their pointers.
Definition: AthHistogramming.h:222
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
AthHistogramming::m_streamName
std::string m_streamName
Name of the ROOT output stream (file)
Definition: AthHistogramming.h:226
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
TrigConf::L1BunchGroupSet
L1 board configuration.
Definition: L1BunchGroupSet.h:71
RatesGroup::removeOtherL1
void removeOtherL1(const RatesTrigger *toKeep)
Remove from the groups mapping all triggers which have a dissimilar seed to the supplied trigger.
Definition: RatesGroup.cxx:72
RatesAnalysisAlg::m_activeGroups
std::unordered_set< RatesGroup * > m_activeGroups
All groups which are enabled (PS >= 1)
Definition: RatesAnalysisAlg.h:257
AthHistogramming::hash_t
uint32_t hash_t
typedef for the internal hash
Definition: AthHistogramming.h:169
CxxUtils::crc64
uint64_t crc64(const CRCTable &table, const char *data, size_t data_len)
Find the CRC-64 of a string,.
Definition: crc64.cxx:696
RatesAnalysisAlg::printTarget
void printTarget() const
Print the target instantaneous luminosity, mu and number of bunches.
Definition: RatesAnalysisAlg.cxx:834
TrigConf::HLTMenu::begin
const_iterator begin() const
Begin of the HLT chains list.
Definition: HLTMenu.cxx:51
RatesAnalysisAlg::isRandomSeed
bool isRandomSeed(const std::string &me, const std::string &seed) const
String match random L1 items.
Definition: RatesAnalysisAlg.cxx:860
EnhancedBiasWeighter::FULL_RING
constexpr static uint32_t FULL_RING
Number of bunches in a full ring.
Definition: EnhancedBiasWeighter.h:56
AthHistogramming::m_histTitlePostfix
std::string m_histTitlePostfix
The postfix for the histogram THx title.
Definition: AthHistogramming.h:241
RatesTrigger::getDisabled
bool getDisabled() const
If I or my seed were prescaled out.
Definition: RatesTrigger.cxx:165
TrigConf::L1PrescalesSet
L1 menu configuration.
Definition: L1PrescalesSet.h:19
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
WeightingValuesSummary_t::m_bunchFactor
double m_bunchFactor
What weight needs to be applied to extrapolate rates linear in number of bunches.
Definition: RatesHistoBase.h:64
TrigConf::HLTMenu::size
std::size_t size() const
Accessor to the number of HLT chains.
Definition: HLTMenu.cxx:35
TrigConf::ConstIter
Forward iterator over an iterable of type V returning an object of type T.
Definition: ConstIter.h:32
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
RatesAnalysisAlg::pass_HstpFilter
StatusCode pass_HstpFilter(bool &pass)
Boolean indicating if the event passes the HS-softer-than-PU (HSTP) filter.
Definition: RatesAnalysisAlg.cxx:613
RatesAnalysisAlg::m_activatedTriggers
std::unordered_set< RatesTrigger * > m_activatedTriggers
Triggers which were changed & hence need to be reset at the event end.
Definition: RatesAnalysisAlg.h:255
RatesAnalysisAlg::m_doExpressRates
Gaudi::Property< bool > m_doExpressRates
Definition: RatesAnalysisAlg.h:284
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
RatesHistoBase::isZero
static bool isZero(double v)
Definition: RatesHistoBase.h:103
EnhancedBiasWeighter::LHC_FREQUENCY
constexpr static double LHC_FREQUENCY
Definition: EnhancedBiasWeighter.h:55
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
RatesAnalysisAlg::m_histogramSuffix
Gaudi::Property< std::string > m_histogramSuffix
Definition: RatesAnalysisAlg.h:290
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
threshold
Definition: chainparser.cxx:74
RatesAnalysisAlg::m_scalingHist
TH1D * m_scalingHist
One-bin histogram to store the normalisation of the sample, for use in later combinations.
Definition: RatesAnalysisAlg.h:299
AthHistogramming::hash
hash_t hash(const std::string &histName) const
Method to calculate a 32-bit hash from a string.
Definition: AthHistogramming.h:428
RatesAnalysisAlg::setTargetLumi
void setTargetLumi(const double lumi)
Set the target instantaneous luminosity.
Definition: RatesAnalysisAlg.h:172
RatesAnalysisAlg::executeTrigDecisionToolTriggers
StatusCode executeTrigDecisionToolTriggers()
Internal call to get the pass/fail for all TDT triggers.
Definition: RatesAnalysisAlg.cxx:717
module_driven_slicing.getHist
def getHist(name, makehist)
Definition: module_driven_slicing.py:120
AthHistogramAlgorithm::sysInitialize
virtual StatusCode sysInitialize()
Initialization method invoked by the framework.
Definition: AthHistogramAlgorithm.cxx:75
RatesGroup::setUniqueTrigger
void setUniqueTrigger(RatesTrigger *trigger)
Set trigger I am doing unique rates for.
Definition: RatesGroup.cxx:196
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
RatesAnalysisAlg::checkExistingTrigger
StatusCode checkExistingTrigger(const std::string &name, const std::string &seedName)
Internal function to check if a supplied HLT trigger and L1 seed match what is stored in the AOD conf...
Definition: RatesAnalysisAlg.cxx:329
RatesAnalysisAlg::writeMetadata
void writeMetadata()
Write to outpute tree (if any) the metadata needed downstream.
Definition: RatesAnalysisAlg.cxx:873
xxh3::hash64
std::uint64_t hash64(const void *data, std::size_t size)
Passthrough to XXH3_64bits.
Definition: XXH.cxx:9
RatesAnalysisAlg::m_triggers
std::unordered_map< std::string, std::unique_ptr< RatesTrigger > > m_triggers
All individual triggers (L1 or HLT)
Definition: RatesAnalysisAlg.h:195
RatesAnalysisAlg::getLevel
uint32_t getLevel(const std::string &name) const
String match to a trigger level.
Definition: RatesAnalysisAlg.cxx:867
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
AthAnalysisAlgorithm::beginInputFile
virtual StatusCode beginInputFile()
Function called when a new input file is opened user can read input metadata from inputMetaStore()
Definition: AthAnalysisAlgorithm.cxx:114
RatesAnalysisAlg::m_configSvc
ServiceHandle< TrigConf::ITrigConfigSvc > m_configSvc
Definition: RatesAnalysisAlg.h:273
lumiFormat.lumi
lumi
Definition: lumiFormat.py:106
RatesEmulationExample::m_jet_RHKey
SG::ReadHandleKey< xAOD::JetContainer > m_jet_RHKey
Definition: RatesEmulationExample.h:23
RatesAnalysisAlg::printInputSummary
void printInputSummary() const
Print the input data instantaneous luminosity, mu and number of bunches.
Definition: RatesAnalysisAlg.cxx:846
a
TList * a
Definition: liststreamerinfos.cxx:10
AthHistogramming::m_effMap
EffMap_t m_effMap
The map of histogram names to their pointers.
Definition: AthHistogramming.h:208
CaloLCW_tf.group
group
Definition: CaloLCW_tf.py:28
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
h
AthHistogramming::m_histTitlePrefix
std::string m_histTitlePrefix
The prefix for the histogram THx title.
Definition: AthHistogramming.h:238
RatesAnalysisAlg::m_l1GroupName
const std::string m_l1GroupName
Definition: RatesAnalysisAlg.h:267
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
RatesAnalysisAlg::m_lowestPrescale
std::unordered_map< size_t, double > m_lowestPrescale
Lowest prescale within a CPS group, key is the hash of the CPS group name.
Definition: RatesAnalysisAlg.h:258
DEBUG
#define DEBUG
Definition: page_access.h:11
RatesAnalysisAlg::m_l1ItemID
std::vector< std::vector< std::string > > m_l1ItemID
Definition: RatesAnalysisAlg.h:265
AthHistogramming::m_treeMap
TreeMap_t m_treeMap
The map of TTree names to their pointers.
Definition: AthHistogramming.h:215
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:426
AthHistogramming::m_histNamePrefix
std::string m_histNamePrefix
The prefix for the histogram THx name.
Definition: AthHistogramming.h:232
TrigConf::L1PrescalesSet::prescales
const std::map< std::string, L1Prescale > & prescales() const
Definition: L1PrescalesSet.cxx:58
python.XMLReader.l1menu
l1menu
Definition: XMLReader.py:73
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
RatesAnalysisAlg::ratesFinalize
virtual StatusCode ratesFinalize()=0
To be implemented by the user.
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
EventInfoRead.isMC
isMC
Definition: EventInfoRead.py:11
CaloCondBlobAlgs_fillNoiseFromASCII.folder
folder
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:55
AthHistogramming::hist
TH1 * hist(const std::string &histName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered histograms of any type.
Definition: AthHistogramming.cxx:198
TrigConf::HLTPrescalesSet::HLTPrescale::enabled
bool enabled
Definition: HLTPrescalesSet.h:23
RatesAnalysisAlg::m_existingTriggers
std::unordered_map< std::string, const Trig::ChainGroup * > m_existingTriggers
Map of triggers which we ask the TDT ChainGroup for the pass/fail.
Definition: RatesAnalysisAlg.h:261
AthHistogramming::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Pointer to the THistSvc (event store by default)
Definition: AthHistogramming.h:194
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
str
Definition: BTagTrackIpAccessor.cxx:11
ValidateEBMenu.seedName
seedName
Definition: ValidateEBMenu.py:100
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
RatesAnalysisAlg::m_vetoStartOfTrain
Gaudi::Property< uint32_t > m_vetoStartOfTrain
Definition: RatesAnalysisAlg.h:288
WeightingValuesSummary_t::m_muFactor
double m_muFactor
What weight needs to be applied to extrapolate rates linear in mu.
Definition: RatesHistoBase.h:65
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
AthAnalysisAlgorithm::m_outputMetaStore
ServiceHandle< StoreGateSvc > m_outputMetaStore
Object accessing the output metadata store.
Definition: AthAnalysisAlgorithm.h:118
RatesAnalysisAlg::m_doTriggerGroups
Gaudi::Property< bool > m_doTriggerGroups
Definition: RatesAnalysisAlg.h:283
TrigConf::Chain
HLT chain configuration.
Definition: TrigConfData/TrigConfData/HLTChain.h:18
RatesAnalysisAlg::m_useBunchCrossingData
Gaudi::Property< bool > m_useBunchCrossingData
Definition: RatesAnalysisAlg.h:285
AthHistogramming::m_name
std::string m_name
Instance name.
Definition: AthHistogramming.h:245
RatesAnalysisAlg::m_targetLumi
double m_targetLumi
What instantaneous luminosity the prediction is targeting.
Definition: RatesAnalysisAlg.h:294
TrigConf::HLTPrescalesSet
HLT menu configuration.
Definition: HLTPrescalesSet.h:19
RatesAnalysisAlg::m_eventCounter
uint32_t m_eventCounter
Count how many events processed.
Definition: RatesAnalysisAlg.h:296
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:51
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
python.compressB64.c
def c
Definition: compressB64.py:93
RatesAnalysisAlg::setTriggerDesicison
StatusCode setTriggerDesicison(const std::string &name, const bool triggerIsPassed=true, const bool triggerIsActive=true)
Set the pass/fail decision for an item.
Definition: RatesAnalysisAlg.cxx:346
TrigConf::HLTMenu::end
const_iterator end() const
End of the HLT chains list.
Definition: HLTMenu.cxx:57
RatesAnalysisAlg::m_inelasticCrossSection
Gaudi::Property< double > m_inelasticCrossSection
Definition: RatesAnalysisAlg.h:280
RatesAnalysisAlg::m_doGlobalGroups
Gaudi::Property< bool > m_doGlobalGroups
Definition: RatesAnalysisAlg.h:282
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
RatesAnalysisAlg::m_hltChainIDGroup
std::vector< std::vector< std::string > > m_hltChainIDGroup
Definition: RatesAnalysisAlg.h:264
fitman.k
k
Definition: fitman.py:528
RatesAnalysisAlg::isZero
bool isZero(double v) const
Helper function for floating point subtraction.
Definition: RatesAnalysisAlg.h:248
AthAnalysisHelper::retrieveMetadata
static std::string retrieveMetadata(const std::string &folder, const std::string &key, const ServiceHandle< StoreGateSvc > &inputMetaStore)
method that always returns as a string you can use from, e.g, pyROOT with evt = ROOT....
Definition: AthAnalysisHelper.h:254
AthHistogramming::buildBookingString
void buildBookingString(std::string &bookingString, std::string &histName, std::string &tDir, std::string &stream, bool usePrefixPostfix=false)
Method to build individual booking string.
Definition: AthHistogramming.cxx:560
ServiceHandle< IIncidentSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
RatesGroup::duplicateChildren
void duplicateChildren(const RatesGroup *toDuplicate)
Copy in triggers from another group.
Definition: RatesGroup.cxx:190
AthHistogramming::bookGetPointer
TH1 * bookGetPointer(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
Definition: AthHistogramming.h:260
kNONE
@ kNONE
Do not scale this trigger for changes in luminosity.
Definition: RatesHistoBase.h:35
RatesAnalysisAlg::m_truthPU_jets_RHKey
SG::ReadHandleKey< xAOD::JetContainer > m_truthPU_jets_RHKey
Definition: RatesAnalysisAlg.h:277
RatesAnalysisAlg::m_expressTriggers
std::unordered_set< RatesTrigger * > m_expressTriggers
Triggers with non-zero express PS, used to print them at the end.
Definition: RatesAnalysisAlg.h:256
WeightingValuesSummary_t::m_eventMu
double m_eventMu
The actual number of interactions in the event.
Definition: RatesHistoBase.h:58