ATLAS Offline Software
Loading...
Searching...
No Matches
L1TopoRatesCalculator Class Reference

#include <L1TopoRatesCalculator.h>

Inheritance diagram for L1TopoRatesCalculator:
Collaboration diagram for L1TopoRatesCalculator:

Classes

struct  ResultDefinition
struct  TriggerInfo

Public Types

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

Public Member Functions

 L1TopoRatesCalculator (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize () override
 Get the trigger decision tool and set up global groups.
virtual StatusCode ratesInitialize () override
 To be implemented by the user.
virtual StatusCode ratesExecute () override
 To be implemented by the user.
virtual StatusCode ratesFinalize () override
 To be implemented by the user.
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.
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.
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.
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.
StatusCode addAllExisting ()
 Register all existing triggers in the AOD into the rates algorithm.
StatusCode addExisting (const std::string &pattern)
 Register some existing triggers based on wild-card match, e.g.
StatusCode setTriggerDesicison (const std::string &name, const bool triggerIsPassed=true, const bool triggerIsActive=true)
 Set the pass/fail decision for an item.
StatusCode setTriggerDesicison (const std::string &name, const double threshold)
 Set the pass threshold for a Scan Trigger item.
void setTargetLumiMu (const double lumi, const double mu)
 Set the target instantaneous luminosity and mu.
void setTargetLumiBunches (const double lumi, const int32_t bunches)
 Set the target instantaneous luminosity and number of bunches.
void setTargetMuBunches (const double mu, const int32_t bunches)
 Set the target mu and number of bunches.
void setTargetLumi (const double lumi)
 Set the target instantaneous luminosity.
void setTargetMu (const double mu)
 Set the target pileup.
void setExponentialMuScalingFactor (const double f)
 Set the exponential scaling factor for relevant chains.
virtual StatusCode sysInitialize () override
 Function initialising the tool in the correct way in Athena.
virtual StatusCode sysExecute (const EventContext &) override
 override to do firstEvent method
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.
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.
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.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Functions providing access to the input/output metadata
const ServiceHandle< StoreGateSvc > & inputMetaStore () const
 Const accessor for the input metadata store.
ServiceHandle< StoreGateSvc > & inputMetaStore ()
 Accessor for the input metadata store.
const ServiceHandle< StoreGateSvc > & outputMetaStore () const
 Const accessor for the output metadata store.
ServiceHandle< StoreGateSvc > & outputMetaStore ()
 Accessor for the output metadata store.

Public Attributes

SG::ReadHandleKey< xAOD::TrigDecisionm_trigDecisionKey {this, "TrigDecisionKey", "xTrigDecision"}
SG::ReadHandleKey< xAOD::L1TopoSimResultsContainerm_l1topoKey {this, "L1_TopoKey", "L1_TopoSimResults", "l1topo EDM"}

Protected Member Functions

StatusCode pass_HstpFilter (bool &pass)
 Boolean indicating if the event passes the HS-softer-than-PU (HSTP) filter.
virtual StatusCode initialize_extra_content ()
 Initialization of additional payload for inherited classes.
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.
virtual StatusCode beginInputFile ()
 Function called when a new input file is opened user can read input metadata from inputMetaStore()
virtual StatusCode endInputFile ()
 Function called as an input file is being closed.
virtual StatusCode metaDataStop ()
 Function called before finalize user can read output metadata from outputMetaStore()
virtual StatusCode firstExecute ()
 Function called when first execute is encountered user can read event information with evtStore()
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")
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.
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.
TH1 * bookGetPointer (const TH1 &hist, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
TH1 * bookGetPointer (TH1 *hist, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
TH1 * bookGetPointer (TH1 &histRef, std::string tDir="", std::string stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
TTree * bookGetPointer (const TTree &treeRef, std::string tDir="", std::string stream="")
 Simplify the booking and registering (into THistSvc) of TTrees.
TGraph * bookGetPointer (const TGraph &graphRef, std::string tDir="", std::string stream="")
 Simplify the booking and registering (into THistSvc) of TGraphs.
TEfficiency * bookGetPointer (const TEfficiency &eff, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
TEfficiency * bookGetPointer (TEfficiency *eff, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
TEfficiency * bookGetPointer (TEfficiency &effRef, std::string tDir="", std::string stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
StatusCode book (const TH1 &hist, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
StatusCode book (TH1 *hist, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
StatusCode book (TH1 &histRef, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
StatusCode book (const TTree &treeRef, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TTrees.
StatusCode book (const TGraph &graphRef, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TGraphs.
StatusCode book (const TEfficiency &eff, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
StatusCode book (TEfficiency *eff, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
StatusCode book (TEfficiency &effRef, const std::string &tDir="", const std::string &stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
TH1 * hist (const std::string &histName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered histograms of any type.
TH2 * hist2d (const std::string &histName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered 2-d histograms.
TH3 * hist3d (const std::string &histName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered 3-d histograms.
TTree * tree (const std::string &treeName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered TTrees.
TGraph * graph (const std::string &graphName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered TGraphs.
TEfficiency * efficiency (const std::string &effName, const std::string &tDir="", const std::string &stream="")
 Simplify the retrieval of registered TEfficiency.

Protected Attributes

std::vector< double > m_EB_weight
std::vector< std::string > m_RCM_nameOrder
double m_linearLumiFactor
WeightingValuesSummary_t m_weightingValues
 Possible weighting & lumi extrapolation values for the current event.
double m_ratesDenominator
 How much walltime is seen by the algorithm.
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)

Private Types

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

Private Member Functions

uint32_t extractResult (const std::vector< uint32_t > &connectorContents, const L1TopoRatesCalculator::ResultDefinition &definition, unsigned int startOffset)
uint32_t getHWvalue (const L1TopoRatesCalculator::ResultDefinition &definition)
bool getTOBblockFromProcessor (const std::vector< uint32_t > &allDataBlock, std::vector< uint32_t > &tobBlock, uint32_t fpgaPattern)
uint32_t L1TopoSimResultsContainer_decoder (const L1TopoRatesCalculator::ResultDefinition &definition, SG::ReadHandle< xAOD::L1TopoSimResultsContainer > &cont)
virtual StatusCode execute ()
 In first call - register all triggers.
virtual StatusCode finalize ()
 Print rates.
StatusCode populateTriggers ()
 Register all triggers to emulate.
StatusCode executeTrigDecisionToolTriggers ()
 Internal call to get the pass/fail for all TDT triggers.
StatusCode executeTriggerEmulation ()
 Internal call to get the pass/fail for all automatically emulated triggers.
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.
StatusCode checkGotTDT ()
 Internal check that the TDT is fetched.
void printInputSummary () const
 Print the input data instantaneous luminosity, mu and number of bunches.
void printStatistics () const
 Print some extra statistics on events processed.
void printTarget () const
 Print the target instantaneous luminosity, mu and number of bunches.
void writeMetadata ()
 Write to outpute tree (if any) the metadata needed downstream.
bool isCPS (const std::string &group) const
 String match coherent prescale groups.
bool isRandomSeed (const std::string &me, const std::string &seed) const
 String match random L1 items.
uint32_t getLevel (const std::string &name) const
 String match to a trigger level.
bool isZero (double v) const
 Helper function for floating point subtraction.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>
void buildBookingString (std::string &bookingString, std::string &histName, std::string &tDir, std::string &stream, bool usePrefixPostfix=false)
 Method to build individual booking string.
void myReplace (std::string &str, const std::string &oldStr, const std::string &newStr)
 Helper method to replace sub-string.
hash_t hash (const std::string &histName) const
 Method to calculate a 32-bit hash from a string.

Private Attributes

TH2D * m_ratesMatrixHist {}
TH2D * m_countsMatrixHist {}
TH2D * m_L1TopoScoreMatrixHist {}
Gaudi::Property< std::vector< std::string > > m_L1_items_json {this, "m_L1_items_json", {}, "L1 trigger items"}
Gaudi::Property< std::vector< std::string > > m_userDefinedNames {this, "m_userDefinedNames", {}, "user Defined Names"}
Gaudi::Property< std::vector< std::string > > m_userDefinedDefinitions {this, "m_userDefinedDefinitions", {}, "user Defined definitions"}
std::unordered_map< std::string, std::string > m_userDefinedMap
std::vector< std::string > m_L1_items
std::vector< std::string > m_L1_item_definitions
std::vector< std::string > m_beforeCTP_triggers
std::vector< std::string > m_beforeCTP_triggers_mult
std::vector< ResultDefinitionm_definitions
std::vector< std::vector< double > > m_rates_matrix
std::vector< std::vector< double > > m_rates_matrix2
std::vector< std::vector< double > > m_rates_matrix_TDT
std::vector< std::vector< double > > m_rates_matrix2_TDT
std::vector< std::vector< double > > m_counts_matrix_TDT
std::vector< std::vector< double > > m_count_matrix
std::vector< std::vector< double > > m_L1TopoScore_matrix
std::vector< std::vector< double > > m_L1TopoScore_errors
std::vector< double > m_denominator
double m_weighted_sum {}
std::map< std::string, TriggerInfom_triggerMap
Gaudi::Property< float > m_lumi {this, "TargetLuminosity", 2e34, "Targer inst. luminosity, assuming full ring."}
std::unordered_map< std::string, std::unique_ptr< RatesScanTrigger > > m_scanTriggers
 All individual rates-scan triggers (L1 or HLT)
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_groups
 All regular and CPS groups.
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_globalGroups
 Big (master) groups which do the OR of the whole menu.
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_uniqueGroups
 Groups used to obtain unique rates for chains.
std::unordered_set< RatesTrigger * > m_activatedTriggers
 Triggers which were changed & hence need to be reset at the event end.
std::unordered_set< RatesTrigger * > m_expressTriggers
 Triggers with non-zero express PS, used to print them at the end.
std::unordered_set< RatesGroup * > m_activeGroups
 All groups which are enabled (PS >= 1)
std::unordered_map< size_t, double > m_lowestPrescale
 Lowest prescale within a CPS group, key is the hash of the CPS group name.
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.
std::unordered_map< std::string, const Trig::ChainGroup * > m_existingTriggers
 Map of triggers which we ask the TDT ChainGroup for the pass/fail.
std::unordered_map< std::string, std::string > m_lowerTrigger
 Map of triggers lower chain, to tell if a HLT trigger ran or not.
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.
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.
double m_targetBunches
 How many bunches the prediction is targeting.
double m_targetLumi
 What instantaneous luminosity the prediction is targeting.
uint32_t m_runNumber
 What is the RunNumber.
uint32_t m_eventCounter
 Count how many events processed.
double m_weightedEventCounter
 Count how many weighted events were processed.
TH1D * m_scalingHist
 One-bin histogram to store the normalisation of the sample, for use in later combinations.
TH1D * m_bcidHist
 Histogram of the BCIDs distribution of the processing.
TTree * m_metadataTree
 Used to write out some metadata needed by post-processing (e.g.
ServiceHandle< StoreGateSvcm_inputMetaStore
 Object accessing the input metadata store.
ServiceHandle< StoreGateSvcm_outputMetaStore
 Object accessing the output metadata store.
TFile * m_currentFile {nullptr}
bool m_doneFirstEvent {false}
ServiceHandle< ITHistSvc > m_histSvc
 Default constructor: AthHistogramAlgorithm();.
std::string m_prefix
 Name of the ROOT output stream (file)
std::string m_rootDir
 Name of the ROOT directory.
std::string m_histNamePrefix
 The prefix for the histogram THx name.
std::string m_histNamePostfix
 The postfix for the histogram THx name.
std::string m_histTitlePrefix
 The prefix for the histogram THx title.
std::string m_histTitlePostfix
 The postfix for the histogram THx title.
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared
HistMap_t m_histMap
 The map of histogram names to their pointers.
EffMap_t m_effMap
 The map of histogram names to their pointers.
TreeMap_t m_treeMap
 The map of TTree names to their pointers.
GraphMap_t m_graphMap
 The map of TGraph names to their pointers.
std::string m_streamName
 Name of the ROOT output stream (file)
std::string m_name
 Instance name.
MsgStream m_msg
 Cached Message Stream.

Detailed Description

Definition at line 31 of file L1TopoRatesCalculator.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,
47 };
@ 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.

Constructor & Destructor Documentation

◆ L1TopoRatesCalculator()

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

Definition at line 13 of file L1TopoRatesCalculator.cxx.

13 : RatesAnalysisAlg(name, pSvcLocator) {
14}
RatesAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)

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}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode checkGotTDT()
Internal check that the TDT is fetched.
StatusCode addExisting(const std::string &pattern)
Register some existing triggers based on wild-card match, e.g.

◆ 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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
ServiceHandle< TrigConf::ITrigConfigSvc > m_configSvc
uint32_t getLevel(const std::string &name) const
String match to a trigger level.
ToolHandle< Trig::TrigDecisionTool > m_tdt
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.
Gaudi::Property< std::map< std::string, std::map< std::string, double > > > m_prescalesJSON
const ptree & data() const
Access to the underlying data, if needed.
const_iterator end() const
End of the HLT chains list.
Definition HLTMenu.cxx:57
const_iterator begin() const
Begin of the HLT chains list.
Definition HLTMenu.cxx:51
ConstIter< ptree, Chain > const_iterator
Iterator over the HLT chains.
Definition HLTMenu.h:50
const HLTPrescale & prescale_express(const std::string &chainName) const
HLT prescales by chain names.
const HLTPrescale & prescale(const std::string &chainName) const
HLT prescales by chain names.
const std::map< std::string, L1Prescale > & prescales() const

◆ 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}
#define endmsg
StatusCode book(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
MsgStream m_msg
Cached Message Stream.

◆ 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}
TH1 * hist(const std::string &histName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered histograms of any type.

◆ 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}
TH1 * bookGetPointer(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.

◆ 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}
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
std::string m_histNamePostfix
The postfix for the histogram THx name.
hash_t hash(const std::string &histName) const
Method to calculate a 32-bit hash from a string.
uint32_t hash_t
typedef for the internal hash
std::string m_histTitlePostfix
The postfix for the histogram THx title.
std::string m_histTitlePrefix
The prefix for the histogram THx title.
std::string m_name
Instance name.
void buildBookingString(std::string &bookingString, std::string &histName, std::string &tDir, std::string &stream, bool usePrefixPostfix=false)
Method to build individual booking string.
std::string m_histNamePrefix
The prefix for the histogram THx name.
GraphMap_t m_graphMap
The map of TGraph names to their pointers.

◆ 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}
TreeMap_t m_treeMap
The map of TTree names to their pointers.

◆ 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}
EffMap_t m_effMap
The map of histogram names to their pointers.

◆ 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}
HistMap_t m_histMap
The map of histogram names to their pointers.

◆ 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}
std::string m_rootDir
Name of the ROOT directory.
std::string m_streamName
Name of the ROOT output stream (file)
void myReplace(std::string &str, const std::string &oldStr, const std::string &newStr)
Helper method to replace sub-string.

◆ 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}
#define ATH_MSG_FATAL(x)

◆ 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}
ServiceHandle< ITHistSvc > m_histSvc
Pointer to the THistSvc (event store by default)

◆ 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]);
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]);
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}
#define ATH_MSG_VERBOSE(x)
bool msgLvl(const MSG::Level lvl) const

◆ declareGaudiProperty()

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 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

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 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ 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.

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

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.

◆ 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 const EventContext& ctx = Gaudi::Hive::currentContext();
640 // Get event characteristics
641 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey, ctx);
642 ATH_CHECK( eventInfo.isValid() );
643 uint32_t distance = 0;
644 ATH_CHECK( m_enhancedBiasRatesTool->getDistanceIntoTrain(eventInfo.get(), distance, ctx) );
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());
652 m_weightingValues.m_distanceInTrain = distance;
653 m_weightingValues.m_eventLiveTime = m_enhancedBiasRatesTool->getEBLiveTime(eventInfo.get());
654 if (m_useBunchCrossingData && m_vetoStartOfTrain > 0 && m_weightingValues.m_distanceInTrain < m_vetoStartOfTrain) return StatusCode::SUCCESS;
655
656 // Bunch factor doesn't change as a fn. of the run. Reminder: m_bunchFactor = m_targetBunches / (double)ebPairedBunches;
657 m_weightingValues.m_muFactor = (m_weightingValues.m_eventMu ? m_targetMu / m_weightingValues.m_eventMu : 0.0);
658 m_weightingValues.m_linearLumiFactor = m_targetLumi / m_weightingValues.m_eventLumi;
659 m_weightingValues.m_expoMuFactor = m_weightingValues.m_bunchFactor * exp( m_expoScalingFactor * (m_targetMu - m_weightingValues.m_eventMu) );
660
661 // Ignore zero weighted events. Typically these come from bad LB
662 if (RatesHistoBase::isZero(m_weightingValues.m_enhancedBiasWeight)) {
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;
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
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}
TH1D * m_bcidHist
Histogram of the BCIDs distribution of the processing.
StatusCode executeTrigDecisionToolTriggers()
Internal call to get the pass/fail for all TDT triggers.
std::unordered_set< RatesTrigger * > m_activatedTriggers
Triggers which were changed & hence need to be reset at the event end.
Gaudi::Property< bool > m_doHistograms
Gaudi::Property< double > m_expoScalingFactor
double m_ratesDenominator
How much walltime is seen by the algorithm.
double m_targetLumi
What instantaneous luminosity the prediction is targeting.
Gaudi::Property< bool > m_doMultiSliceDiJet
double m_weightedEventCounter
Count how many weighted events were processed.
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_globalGroups
Big (master) groups which do the OR of the whole menu.
Gaudi::Property< bool > m_useBunchCrossingData
StatusCode populateTriggers()
Register all triggers to emulate.
StatusCode pass_HstpFilter(bool &pass)
Boolean indicating if the event passes the HS-softer-than-PU (HSTP) filter.
WeightingValuesSummary_t m_weightingValues
Possible weighting & lumi extrapolation values for the current event.
virtual StatusCode ratesExecute()=0
To be implemented by the user.
std::unordered_set< RatesGroup * > m_activeGroups
All groups which are enabled (PS >= 1)
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Gaudi::Property< uint32_t > m_vetoStartOfTrain
double m_targetMu
What pileup level the prediction is targeting.
TH1D * m_scalingHist
One-bin histogram to store the normalisation of the sample, for use in later combinations.
ToolHandle< IEnhancedBiasWeighter > m_enhancedBiasRatesTool
uint32_t m_eventCounter
Count how many events processed.
StatusCode executeTriggerEmulation()
Internal call to get the pass/fail for all automatically emulated triggers.
static bool isZero(double v)
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
setEventNumber uint32_t

◆ 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}
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
StatusCode setTriggerDesicison(const std::string &name, const bool triggerIsPassed=true, const bool triggerIsActive=true)
Set the pass/fail decision for an item.
std::unordered_map< std::string, const Trig::ChainGroup * > m_existingTriggers
Map of triggers which we ask the TDT ChainGroup for the pass/fail.
std::unordered_map< std::string, std::string > m_lowerTrigger
Map of triggers lower chain, to tell if a HLT trigger ran or not.
@ active
Definition Layer.h:47

◆ 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}
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.

◆ extractResult()

uint32_t L1TopoRatesCalculator::extractResult ( const std::vector< uint32_t > & connectorContents,
const L1TopoRatesCalculator::ResultDefinition & definition,
unsigned int startOffset )
private

Definition at line 341 of file L1TopoRatesCalculator.cxx.

341 {
342
343 uint32_t result = 0;
344 unsigned int startindex = definition.flatindex + startOffset; //for optical clock is 0, for electrical account for structure of argument
345 unsigned int endindex = startindex + definition.nBit - 1;
346 unsigned int firstWord = startindex / 32; //integer division on purpose
347 unsigned int lastWord = endindex / 32; //integer division on purpose
348 unsigned int nBitAdded = 0;
349 uint32_t word = 0; //buffer
350
351 if ((firstWord>1) | (lastWord>1)){
352 firstWord = firstWord%3;
353 lastWord = lastWord%3;
354 }
355
356 std::vector<uint32_t>result_vec(lastWord,0);
357 uint32_t mask = 0;
358
359 for (unsigned int wordIndex=firstWord; wordIndex <= lastWord; wordIndex++) {
360 unsigned int startPosInWord = (wordIndex == firstWord) ? (startindex % 32) : 0 ;
361 unsigned int endPosInWord = (wordIndex == lastWord) ? (endindex % 32) : 31;
362 // might be %3 (3words/fiber)
363 mask = ( ( 1u<< (endPosInWord+1) ) - 1 );
364 word = connectorContents[wordIndex] & mask;
365 word >>= startPosInWord;
366 result |= word << nBitAdded; //account for bits already accumulated from previous word(s)
367 nBitAdded += endPosInWord - startPosInWord + 1;
368 result_vec.push_back(result);
369 }
370 if (result_vec.size()>1){
371 result = result_vec[0] || result_vec[1];
372 }
373 return result;
374
375}

◆ 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}
DataObjIDColl m_extendedExtraObjects

◆ 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();
770 ATH_MSG_INFO("##################");
772
773 return StatusCode::SUCCESS;
774}
void printInputSummary() const
Print the input data instantaneous luminosity, mu and number of bunches.
void printStatistics() const
Print some extra statistics on events processed.
std::unordered_set< RatesTrigger * > m_expressTriggers
Triggers with non-zero express PS, used to print them at the end.
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_groups
All regular and CPS groups.
virtual StatusCode ratesFinalize()=0
To be implemented by the user.
std::unordered_map< std::string, std::unique_ptr< RatesTrigger > > m_triggers
All individual triggers (L1 or HLT)
void writeMetadata()
Write to outpute tree (if any) the metadata needed downstream.
void printTarget() const
Print the target instantaneous luminosity, mu and number of bunches.
std::unordered_map< std::string, std::unique_ptr< RatesScanTrigger > > m_scanTriggers
All individual rates-scan triggers (L1 or HLT)

◆ 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}

◆ getHWvalue()

uint32_t L1TopoRatesCalculator::getHWvalue ( const L1TopoRatesCalculator::ResultDefinition & definition)
private

◆ 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}

◆ getTOBblockFromProcessor()

bool L1TopoRatesCalculator::getTOBblockFromProcessor ( const std::vector< uint32_t > & allDataBlock,
std::vector< uint32_t > & tobBlock,
uint32_t fpgaPattern )
private

◆ 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 ) {
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}
virtual StatusCode beginInputFile()
Function called when a new input file is opened user can read input metadata from inputMetaStore()
virtual StatusCode endInputFile()
Function called as an input file is being closed.
virtual StatusCode metaDataStop()
Function called before finalize user can read output metadata from outputMetaStore()

◆ 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{
430 const uint64_t hash64 = CxxUtils::crc64( histName );
431 return (hash_t)(hash64 & 0xFFFFFFFF);
432}
uint64_t crc64(const CRCTable &table, const char *data, size_t data_len)
Find the CRC-64 of a string,.
Definition crc64.cxx:696
std::uint64_t hash64(const void *data, std::size_t size)
Passthrough to XXH3_64bits.
Definition XXH.cxx:9

◆ 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}
ServiceHandle< ITHistSvc > m_histSvc
Default constructor: AthHistogramAlgorithm();.

◆ initialize()

StatusCode L1TopoRatesCalculator::initialize ( )
overridevirtual

Get the trigger decision tool and set up global groups.

Reimplemented from RatesAnalysisAlg.

Definition at line 16 of file L1TopoRatesCalculator.cxx.

16 {
17
18 ATH_MSG_ALWAYS("Initializing L1TopoRatesCalculator");
19
20 ATH_CHECK( RatesAnalysisAlg::initialize() ); // Initialise my parent class first
21
22 ATH_CHECK( m_trigDecisionKey.initialize() ); // Then initialise my fields afterwards
23
24 ATH_CHECK(m_l1topoKey.initialize()); //L1Topo
25
26 //Accessing L1Menu----------------------------------------------
27
28 const TrigConf::L1Menu * l1menu = nullptr;
29 ATH_CHECK( detStore()->retrieve(l1menu)); //detStore() returns m_detStore. detStore() from AthCommonDataStore.h
30
31 for (size_t i = 0; i < m_userDefinedNames.value().size(); ++i) {
33 }
34 for (const std::string& L1_item : m_L1_items_json) {
35 bool found = false;
36 for (const TrigConf::L1Item& L1item : *l1menu) {
37 const std::string& L1name = L1item.name();
38 if (L1name == L1_item){
39 const std::string& L1definition = L1item.definition();
40 m_L1_item_definitions.push_back(L1definition);
41 m_L1_items.push_back(L1_item);
42 found = true;
43 break;
44 }
45 }
46 if (!found) {
47 ATH_MSG_DEBUG("Warning: L1 item '" << L1_item << "' not found in the L1 menu!");
48 }
49 }
50
51 for (const auto& pair : m_userDefinedMap) {
52 m_L1_items.push_back(pair.first);
53 m_L1_item_definitions.push_back(pair.second);
54 }
55 // Filling trigger map --------------
56
57 std::map<std::string, TriggerInfo> triggerMap;
58 for (size_t i = 0; i < m_L1_items.size(); ++i){
60
61 // Regular expression to capture the name of the trigger and the number in square brackets
62 std::regex re(R"(([\w\d_-]+)\[x(\d+)\])");
63 std::sregex_iterator iter((m_L1_item_definitions[i]).begin(), (m_L1_item_definitions[i]).end(), re);
64 std::sregex_iterator end;
65 std::vector<size_t> triggerPositions;
66
67 // Extract all triggers and their positions
68 while (iter != end) {
69 std::smatch match = *iter;
70 std::string triggerName = match.str(1);
71 std::string triggerCount = match.str(2);
72 info.triggers.push_back(triggerCount + triggerName);
73
74 // Store the position of the end of the trigger in the original chain to identify the operations between them
75 triggerPositions.push_back(match.position(0) + match.length(0));
76 ++iter;
77 }
78 // Capturing operations using the positions between triggers
79 size_t prevPos = 0;
80 for (size_t j = 0; j < triggerPositions.size(); ++j) {
81 size_t pos = triggerPositions[j];
82 std::string part = (m_L1_item_definitions[i]).substr(prevPos, pos - prevPos);
83
84 // Eliminate unnecessary spaces
85 part.erase(std::remove_if(part.begin(), part.end(),
86 [](unsigned char c) { return std::isspace(c); }),
87 part.end());
88
89 // Si la parte contiene un operador &, |, guardamos esa operación
90 if (part.find("&") != std::string::npos) {
91 info.operations.push_back("&");
92 } else if (part.find("|") != std::string::npos) {
93 info.operations.push_back("|");
94 }
95
96 prevPos = pos;
97 }
98 // Handling of final operation if there is only one trigger
99 std::string lastPart = (m_L1_item_definitions[i]).substr(prevPos);
100 lastPart.erase(std::remove_if(lastPart.begin(), lastPart.end(),
101 [](unsigned char c) { return std::isspace(c); }),
102 lastPart.end());
103 triggerMap[m_L1_items[i]] = info;
104 }
105
106 m_triggerMap = triggerMap;
107 //--------------------------------
108 for (const auto& pair : triggerMap) {
109 ATH_MSG_DEBUG("Key: " << pair.first);
110 for (size_t i = 0; i < pair.second.triggers.size(); ++i) {
111 ATH_MSG_DEBUG("Trigger " << i + 1 << ": " << pair.second.triggers[i]);
112 if (i < pair.second.operations.size()) {
113 ATH_MSG_DEBUG("Operation: " << pair.second.operations[i]);
114 }
115 }
116 }
117
118 // Listing the triggers needed for the L1 items (w/o the multiplicities)-----------
119
120 std::vector<std::string> beforeCTP_triggers;
121 std::vector<std::string> beforeCTP_triggers_mult;
122
123 for (const auto& pair : triggerMap) {
124 for (size_t i = 0; i < pair.second.triggers.size(); ++i) {
125 beforeCTP_triggers_mult.push_back(pair.second.triggers[i]);
126 size_t pos_number = 0;
127 while (pos_number < (pair.second.triggers[i]).size() && std::isdigit((pair.second.triggers[i])[pos_number])) {
128 ++pos_number;
129 }
130 beforeCTP_triggers.push_back((pair.second.triggers[i]).substr(pos_number));
131 }
132 }
133
134 std::unordered_set<std::string> seen_mult;
135 std::vector<std::string> beforeCTP_triggers_mult_unique;
136
137 for (const auto& str_mult : beforeCTP_triggers_mult) {
138 auto [it, inserted] = seen_mult.insert(str_mult);
139 if (inserted) {
140 beforeCTP_triggers_mult_unique.push_back(str_mult);
141 }
142 }
143
144 std::sort(beforeCTP_triggers.begin(), beforeCTP_triggers.end());
145 auto beforeCTP_triggers_unique = std::unique(beforeCTP_triggers.begin(), beforeCTP_triggers.end());
146 beforeCTP_triggers.erase(beforeCTP_triggers_unique, beforeCTP_triggers.end());
147
148 m_beforeCTP_triggers = beforeCTP_triggers;
149 m_beforeCTP_triggers_mult = beforeCTP_triggers_mult_unique;
150
151 // --------------------------------
152
153 for (size_t i = 0; i < beforeCTP_triggers.size(); ++i){
154 ATH_MSG_DEBUG("Filling L1menu parameters from item: " << beforeCTP_triggers[i]);
155 ResultDefinition definition;
156 definition.flatindex = 0;
157 definition.clock = 0;
158 definition.nBit = 0;
159 definition.fromSim = true;
160 definition.overflow = true;
161 ATH_MSG_DEBUG("Item being analyzed: " << beforeCTP_triggers[i]);
162 for( const auto & connName : l1menu->connectorNames() ) {
163 auto & conn = l1menu->connector(connName);
164 for( auto & tl : conn.triggerLines() ) {
165 //For electrical connectors from the L1Topo boards a triggerline vector holds up to 16 signals
166 if ((connName == "Topo2El") || (connName == "Topo3El")){
167 for (size_t fpga = 0; fpga < 2; ++fpga){ //run over fpgas
168 for (size_t clock = 0; clock < 2; ++clock){ //run over clocks
169 for (auto & tl : conn.triggerLines(fpga,clock)){
170 if (tl.name() == beforeCTP_triggers[i]){
171 definition.flatindex = tl.flatindex();
172 definition.nBit = tl.nbits();
173 definition.clock = tl.clock();
174 if (connName == "Topo2El") definition.conID = 2;
175 if (connName == "Topo3El") definition.conID = 3;
176 }
177 else{
178 continue;
179 }
180 }
181 }
182 }
183 }else{
184 if (tl.name() == beforeCTP_triggers[i]){
185 definition.flatindex = tl.flatindex();
186 definition.nBit = tl.nbits();
187 definition.clock = 0;
188 if (connName == "Topo1Opt0") definition.conID = 4;
189 if (connName == "Topo1Opt1") definition.conID = 5;
190 if (connName == "Topo1Opt2") definition.conID = 6;
191 if (connName == "Topo1Opt3") definition.conID = 7;
192 }else{
193 continue;
194 }
195 }
196 }
197 }
198 m_definitions.push_back(definition);
199 }
200
201 //-----------------------------------------------------
202 return StatusCode::SUCCESS;
203}
const boost::regex re(r_e)
#define ATH_MSG_ALWAYS(x)
const ServiceHandle< StoreGateSvc > & detStore() const
std::vector< std::string > m_L1_items
SG::ReadHandleKey< xAOD::TrigDecision > m_trigDecisionKey
Gaudi::Property< std::vector< std::string > > m_userDefinedDefinitions
SG::ReadHandleKey< xAOD::L1TopoSimResultsContainer > m_l1topoKey
std::map< std::string, TriggerInfo > m_triggerMap
std::vector< ResultDefinition > m_definitions
std::vector< std::string > m_L1_item_definitions
Gaudi::Property< std::vector< std::string > > m_userDefinedNames
Gaudi::Property< std::vector< std::string > > m_L1_items_json
std::vector< std::string > m_beforeCTP_triggers
std::vector< std::string > m_beforeCTP_triggers_mult
std::unordered_map< std::string, std::string > m_userDefinedMap
virtual StatusCode initialize()
Get the trigger decision tool and set up global groups.
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:357
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
DataModel_detail::iterator< DVL > unique(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of unique for DataVector/List.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.

◆ initialize_extra_content()

StatusCode RatesAnalysisAlg::initialize_extra_content ( )
protectedvirtualinherited

Initialization of additional payload for inherited classes.

Reimplemented in RatesEmulationExample.

Definition at line 373 of file RatesAnalysisAlg.cxx.

373 {
374 return StatusCode::SUCCESS;
375}

◆ 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; }
ServiceHandle< StoreGateSvc > m_inputMetaStore
Object accessing the input metadata store.

◆ 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.

◆ L1TopoSimResultsContainer_decoder()

uint32_t L1TopoRatesCalculator::L1TopoSimResultsContainer_decoder ( const L1TopoRatesCalculator::ResultDefinition & definition,
SG::ReadHandle< xAOD::L1TopoSimResultsContainer > & cont )
private

Definition at line 266 of file L1TopoRatesCalculator.cxx.

266 {
267// Decoding L1TopoSimResults
268
269 uint32_t resultValue = 999;
270
271 if (definition.fromSim) {
272 std::vector<uint32_t>result_vector(2,0);
273 xAOD::L1TopoSimResultsContainer const* resultCont = cont.cptr();
274 for (const xAOD::L1TopoSimResults* result : *resultCont) {
275 long long topoWordPrint = result->topoWord64();
276 std::bitset<64> wordPrint(topoWordPrint);
277 if (result->connectionId() != definition.conID) continue;
278
279 std::vector<uint32_t> connectorWords(4); //4 x 32 = 128 bits should be enough
280 unsigned int bitWidth = result->bitWidth();
281 long long topoWord64 = result->topoWord64();
282 std::bitset<64> word(topoWord64);
283 if (bitWidth==32) {
284 ATH_MSG_DEBUG("Electrical connector ");
285
286 long long topoWord = result->topoWord();
287 std::bitset<32> word(topoWord);
288 if (definition.overflow == 1){
289 long long topoWordOverflow = result->topoWordOverflow();
290
291 std::bitset<32> wordRes(topoWord);
292 std::bitset<32> wordOver(topoWordOverflow);
293 word = wordRes | wordOver;
294 }
295 connectorWords[result->clock()] = static_cast<uint32_t>(word.to_ullong());
296 } else {
297 ATH_MSG_DEBUG("Optical connector ");
298
299 if (definition.overflow == 1){
300 long long topoWord64Overflow = result->topoWord64Overflow();
301
302 std::bitset<64> wordRes(topoWord64);
303 std::bitset<64> wordOver(topoWord64Overflow);
304 word = wordRes | wordOver;
305 }
306 // May be used to have enough space for the 96 bits on optical connectors
307 connectorWords[2*result->clock() + 0] = static_cast<uint32_t>(word.to_ullong()); //first 32 bits
308 connectorWords[2*result->clock() + 1] = static_cast<uint32_t>(word.to_ullong() >> 32); //second 32 bits
309 }
310
311 //startOffset: for extraction of HW results to account for two fibers worth of data in one readout "TOB" block
312
313 unsigned int startOffset = 0;
314
315 if (result->connectionId() == 5 || result->connectionId() == 7){ // if Topo1Opt1 or Topo1Opt3
316 startOffset = 96;
317 }else{ // All other connectors
318 startOffset = 0;
319 }
320 resultValue = extractResult(connectorWords, definition, startOffset);
321 result_vector[result->clock()] = resultValue; //Saving the result from the loop over result->clock
322 }
323
324 if ((result_vector[0]>1)||(result_vector[1]>1)){
325 if (result_vector[0]>1) resultValue = result_vector[0];
326 if (result_vector[1]>1) resultValue = result_vector[1];
327 }else{
328 resultValue = result_vector[0] || result_vector[1]; //OR between the results from the two result->clock iterations
329 }
330
331 return resultValue;
332
333 }else{
334 ATH_MSG_ERROR("definition.fromSim set to false");
335 return 999;
336 }
337}
uint32_t extractResult(const std::vector< uint32_t > &connectorContents, const L1TopoRatesCalculator::ResultDefinition &definition, unsigned int startOffset)
const_pointer_type cptr()
Dereference the pointer.
L1TopoSimResultsContainer_v1 L1TopoSimResultsContainer
setTopoWord setTopoWord64 unsigned bitWidth
setTopoWord topoWord64
L1TopoSimResults_v1 L1TopoSimResults
Define the latest version of the L1TopoSimResults class.

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

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ 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));
58 RatesScanTrigger* newScanTrigger = m_scanTriggers.at(name).get();
59 if (isRandomSeed(name, seedName)) newScanTrigger->setSeedsFromRandom(true);
60 ATH_MSG_DEBUG("newScanTrigger " << name << " added");
61 return StatusCode::SUCCESS;
62}
ExtrapStrat_t
Extrapolation strategy to apply to each emulated trigger.
@ kNONE
Do not scale this trigger for changes in luminosity.
bool isRandomSeed(const std::string &me, const std::string &seed) const
String match random L1 items.
Gaudi::Property< bool > m_enableLumiExtrapolation
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.
msgSvc
Provide convenience handles for various services.
Definition StdJOSetup.py:36

◆ 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));
82 RatesScanTrigger* newScanTrigger = m_scanTriggers.at(name).get();
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
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}
const std::string m_l2GroupName
Gaudi::Property< bool > m_doExpressRates
std::unordered_map< size_t, double > m_lowestPrescale
Lowest prescale within a CPS group, key is the hash of the CPS group name.
const std::string m_expressGroupName
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...
Gaudi::Property< bool > m_doTriggerGroups
bool isCPS(const std::string &group) const
String match coherent prescale groups.
const std::string m_l1GroupName
Gaudi::Property< bool > m_doGlobalGroups
void setSeedsFromRandom(const bool i)
Set if this trigger is to behave as if it seeds from a random L1 item.
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)
bool getDisabled() const
If I or my seed were prescaled out.
size_t getCPSID() const
Get the hash of my CPS group name.

◆ 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}
static Double_t ss

◆ 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; }
ServiceHandle< StoreGateSvc > m_outputMetaStore
Object accessing the output metadata store.

◆ 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
619 SG::ReadHandle<xAOD::JetContainer> truthHS_jets(m_truthHS_jets_RHKey);
620 ATH_CHECK( truthHS_jets.isValid() );
621 SG::ReadHandle<xAOD::JetContainer> truthPU_jets(m_truthPU_jets_RHKey);
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}
SG::ReadHandleKey< xAOD::JetContainer > m_truthHS_jets_RHKey
SG::ReadHandleKey< xAOD::JetContainer > m_truthPU_jets_RHKey

◆ 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) {
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();
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());
607 m_weightingValues.m_bunchFactor = m_targetBunches / (double)ebPairedBunches;
608
609 return StatusCode::SUCCESS;
610}
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_uniqueGroups
Groups used to obtain unique rates for chains.
double m_targetBunches
How many bunches the prediction is targeting.
virtual StatusCode ratesInitialize()=0
To be implemented by the user.
Gaudi::Property< bool > m_doUniqueRates
TTree * m_metadataTree
Used to write out some metadata needed by post-processing (e.g.
std::vector< std::vector< std::string > > m_hltChainIDGroup
Gaudi::Property< std::string > m_histogramSuffix
std::vector< std::vector< std::string > > m_l1ItemID
void setTargetLumi(const double lumi)
Set the target instantaneous luminosity.
void setUseCachedWeights(const bool i)
Set to use cached weights from the Master group (need ptr to m_masterGroup)
void removeFromGroup(const RatesTrigger *toRemove)
Remove a trigger from this group.
void duplicateChildren(const RatesGroup *toDuplicate)
Copy in triggers from another group.
void setUniqueTrigger(RatesTrigger *trigger)
Set trigger I am doing unique rates for.
void removeOtherL1(const RatesTrigger *toKeep)
Remove from the groups mapping all triggers which have a dissimilar seed to the supplied trigger.
void setUniqueGroup(const RatesGroup *unique)
If I have a group which is calculating my unique rate.
std::size_t size() const
Accessor to the number of HLT chains.
Definition HLTMenu.cxx:35
ConstIter< ptree, L1Item > const_iterator
Iterator over the L1 items.
Definition L1Menu.h:64

◆ 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 L1TopoRatesCalculator::ratesExecute ( )
overridevirtual

To be implemented by the user.

Supply pass/fail for all "triggers"

Implements RatesAnalysisAlg.

Definition at line 377 of file L1TopoRatesCalculator.cxx.

377 { //EXECUTE
378
379 ATH_MSG_DEBUG("In ratesExecute");
380
381 SG::ReadHandle<xAOD::TrigDecision> trigDecisionHandle(m_trigDecisionKey);
382
383 const xAOD::TrigDecision* trigDecision = trigDecisionHandle.get();
384 const std::vector<uint32_t> l1Triggers = trigDecision->tbp();
385 SG::ReadHandle<xAOD::L1TopoSimResultsContainer> cont(m_l1topoKey);
386
387 if(!cont.isValid()){
388 ATH_MSG_FATAL("Could not retrieve L1Topo EDM Container from the Simulation.");
389 return StatusCode::FAILURE;
390 }
391
392 std::vector<std::string> l1Items_vector;
393 l1Items_vector = m_beforeCTP_triggers;
394 std::vector<uint32_t> resultValue(l1Items_vector.size(), 0);
395 //---------------------------------------Mult Items
396
397 // Main loop to fill matrix and trigger rates
398 // It loops over m_l1items_mult (mult) and l1Items_vector (no mult) to fill the correct decision in the matrix and in the trigger rate
399 std::map<std::string, bool> beforeCTP_result_Map;
400 for (size_t j = 0; j < m_beforeCTP_triggers_mult.size(); ++j){
401 beforeCTP_result_Map[m_beforeCTP_triggers_mult[j]] = false;
402 }
403 for (size_t i = 0; i < m_beforeCTP_triggers.size(); ++i) {
404
405 resultValue[i] = L1TopoSimResultsContainer_decoder(m_definitions[i],cont);
406 ATH_MSG_DEBUG("Trigger item: " << m_beforeCTP_triggers[i]);
407 ATH_MSG_DEBUG("Decision from the decoder first (L1TopoResultsContainer): " << resultValue[i]);
408
409 //Decision of the trigger item
410
411 ATH_MSG_DEBUG("Trigger item: " << m_beforeCTP_triggers[i]);
412 ATH_MSG_DEBUG("Decision from the decoder (L1TopoResultsContainer): " << resultValue[i]);
413
414 //m_l1items_mult includes the 4 multiplicity items
415 for (size_t j = 0; j < m_beforeCTP_triggers_mult.size(); ++j){
416 ATH_MSG_DEBUG("Loop over multiplicity array, analysing: " << m_beforeCTP_triggers_mult[j]);
417 const auto& mult_item = m_beforeCTP_triggers_mult[j];
418 size_t pos = 0;
419 while (pos < mult_item.size() && std::isdigit(mult_item[pos])) {
420 ++pos;
421 }
422 std::string leading_number = mult_item.substr(0, pos);
423 std::string item_name = mult_item.substr(pos);
424
425 //Compares the name of the trigger item of the l1Items_vector with the multiplicities vector
426 if (item_name == l1Items_vector[i]) {
427 if (leading_number <= std::to_string(resultValue[i])) {
428 if (resultValue[i] >= 1){
429 beforeCTP_result_Map[mult_item] = true;
430 break;
431 }
432
433 }
434 }
435
436 }
437 }
438
439 // Applying L1items operations-------
440
441 std::map<std::string, bool> L1_result_Map;
442 std::vector<bool> isPassed_L1item;
443
444 for (const auto& pair : m_triggerMap) {
445 const std::string& key = pair.first;
446 const TriggerInfo& info = pair.second;
447 if (info.triggers.empty()) continue;
448
449 std::vector<bool> triggerResults;
450 std::vector<std::string> newTriggers;
451
452 std::vector<std::string> muTriggers;
453 std::vector<size_t> muIndices;
454
455 for (size_t i = 0; i < info.triggers.size(); ++i) {
456 if (info.triggers[i].find("MU") != std::string::npos && info.triggers[i].find("TOPO") == std::string::npos) {
457 muTriggers.push_back(info.triggers[i]);
458 muIndices.push_back(i);
459 }
460 }
461
462 std::map<size_t, bool> customResults;
463
464 if (!muTriggers.empty()) {
465 std::string muCombinedName = "L1";
466 for (const auto& trig : muTriggers) {
467 size_t start = 0;
468 while (start < trig.size() && std::isdigit(trig[start])) ++start;
469 std::string mult = trig.substr(0, start);
470 std::string name = trig.substr(start);
471 if (mult.empty() || mult == "1") {
472 muCombinedName += "_" + name;
473 } else {
474 muCombinedName += "_" + mult + name;
475 }
476 }
477
478 auto it = getTriggerMap().find(muCombinedName);
479 if (it != getTriggerMap().end()) {
480 double weight = it->second->getTotalPrescaleWeight();
481 for (size_t idx : muIndices) {
482 customResults[idx] = static_cast<bool>(weight);
483 }
484 } else {
485 std::cerr << " [Warning] Combined MU not found: " << muCombinedName << std::endl;
486 for (size_t idx : muIndices) {
487 customResults[idx] = false;
488 }
489 }
490 }
491
492 for (size_t i = 0; i < info.triggers.size(); ++i) {
493 bool result = false;
494 const std::string& trig = info.triggers[i];
495
496 if (customResults.count(i)) {
497 result = customResults[i];
498 newTriggers.push_back("<<MU>>");
499 } else {
500 auto it = beforeCTP_result_Map.find(trig);
501 if (it != beforeCTP_result_Map.end()) {
502 result = it->second;
503 } else {
504 std::cerr << " [Warning] Trigger not found in beforeCTP_result_Map: " << trig << std::endl;
505 result = false;
506 }
507 newTriggers.push_back(trig);
508 }
509 triggerResults.push_back(result);
510 }
511
512 bool finalResult = triggerResults[0];
513 for (size_t i = 1; i < triggerResults.size(); ++i) {
514 const std::string& op = info.operations[i - 1];
515 if (op == "&") {
516 finalResult &= triggerResults[i];
517 } else if (op == "|") {
518 finalResult |= triggerResults[i];
519 } else {
520 std::cerr << " [Warning] Unknown operation: " << op << std::endl;
521 }
522 }
523
524 L1_result_Map[key] = finalResult;
525 isPassed_L1item.push_back(finalResult);
526 }
527
528 //Rates Matrix-------------------------------------------
529
530 int bin = 1;
531 for (const auto& pair : L1_result_Map) {
532 const std::string& label = pair.first;
533 m_ratesMatrixHist->GetXaxis()->SetBinLabel(bin, label.c_str());
534 m_ratesMatrixHist->GetYaxis()->SetBinLabel(bin, label.c_str());
535 m_countsMatrixHist->GetXaxis()->SetBinLabel(bin, label.c_str());
536 m_countsMatrixHist->GetYaxis()->SetBinLabel(bin, label.c_str());
537 m_L1TopoScoreMatrixHist->GetXaxis()->SetBinLabel(bin, label.c_str());
538 m_L1TopoScoreMatrixHist->GetYaxis()->SetBinLabel(bin, label.c_str());
539 ++bin;
540 }
541
543 double weight=0;
544 double count=0;
545 m_weighted_sum += m_weightingValues.m_enhancedBiasWeight;
546 m_EB_weight.push_back(m_weightingValues.m_enhancedBiasWeight);
547 for (size_t i = 0; i < m_rates_matrix.size(); ++i){
548 for (size_t j = 0; j < m_rates_matrix.size(); ++j){
549 bool flag = (isPassed_L1item[i] && isPassed_L1item[j]);
550 weight=static_cast<double>((isPassed_L1item[i] && isPassed_L1item[j])*(m_weightingValues.m_enhancedBiasWeight)*(m_weightingValues.m_linearLumiFactor));
551 if (flag) {
552 count = 1;
553 }else{
554 count = 0;
555 }
556 (m_count_matrix[i])[j] += count;
557 (m_rates_matrix[i])[j] += weight;
558 (m_rates_matrix2[i])[j] += weight*weight;
559 }
560 }
561 //------------------------------------------------------
562
563 std::vector<std::string> triggerNames;
564 for (const auto& [key, trigger] : getTriggerMap()) {
565 triggerNames.push_back(key);
566 }
567
568 const size_t nTriggers = triggerNames.size();
569
570 for (size_t i = 0; i < nTriggers; ++i) {
571 for (size_t j = 0; j < nTriggers; ++j) {
572 double w_i = getTriggerMap().at(triggerNames[i])->getTotalPrescaleWeight();
573 double w_j = getTriggerMap().at(triggerNames[j])->getTotalPrescaleWeight();
574 double weight_result_tdt = w_i * w_j;
575 double weight_TDT = weight_result_tdt*(m_weightingValues.m_enhancedBiasWeight)*(m_weightingValues.m_linearLumiFactor);
576 m_counts_matrix_TDT[i][j] += weight_result_tdt;
577 m_rates_matrix_TDT[i][j] += weight_TDT;
578 m_rates_matrix2_TDT[i][j] += weight_TDT*weight_TDT;
579 }
580 }
581
582
583 //-------------------------------------------------------
584
585 return StatusCode::SUCCESS;
586}
std::vector< std::vector< double > > m_rates_matrix
std::vector< double > m_EB_weight
std::vector< std::vector< double > > m_count_matrix
std::vector< std::vector< double > > m_counts_matrix_TDT
std::vector< std::vector< double > > m_rates_matrix2_TDT
std::vector< std::vector< double > > m_rates_matrix_TDT
uint32_t L1TopoSimResultsContainer_decoder(const L1TopoRatesCalculator::ResultDefinition &definition, SG::ReadHandle< xAOD::L1TopoSimResultsContainer > &cont)
std::vector< std::vector< double > > m_rates_matrix2
std::vector< double > m_denominator
const std::unordered_map< std::string, std::unique_ptr< RatesTrigger > > & getTriggerMap() const
const std::vector< uint32_t > & tbp() const
Get the Trigger Before Prescale bits.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
std::string label(const std::string &format, int i)
Definition label.h:19
bool flag
Definition master.py:29
TrigDecision_v1 TrigDecision
Define the latest version of the trigger decision class.

◆ ratesFinalize()

StatusCode L1TopoRatesCalculator::ratesFinalize ( )
overridevirtual

To be implemented by the user.

Implements RatesAnalysisAlg.

Definition at line 588 of file L1TopoRatesCalculator.cxx.

588 {
589 ATH_MSG_DEBUG("In ratesFinalize()");
590
591 //Fill rates from TDT-----------------
592
593 std::vector<std::string> triggerNames;
594 for (const auto& [key, trigger] : getTriggerMap()) {
595 triggerNames.push_back(key);
596 }
597
598 const size_t nTriggers = triggerNames.size();
599 for (size_t i = 0; i < m_rates_matrix_TDT.size(); ++i) {
600 for (size_t j = 0; j < m_rates_matrix_TDT.size(); ++j) {
602 m_rates_matrix2_TDT[i][j] = std::sqrt(((m_rates_matrix2_TDT[i])[j]))/(m_ratesDenominator);
603 }
604 }
605
606 ATH_MSG_DEBUG("\nTDT Rates matrix:\n");
607 for (size_t i = 0; i < nTriggers; ++i) {
608 for (size_t j = 0; j < nTriggers; ++j) {
609 ATH_MSG_DEBUG("Triggers (" << triggerNames[i] << ", " << triggerNames[j] << ") -> Value: " << m_rates_matrix_TDT[i][j] <<" +- " << m_rates_matrix2_TDT[i][j]);
610 }
611 }
612
613 for (const auto& pair : m_triggerMap) {
614 const std::string& label = pair.first;
615 m_RCM_nameOrder.push_back(label.c_str());
616 }
617
618 //-----------------
619
620 //Compare the trigger rates btw TDT and Rates Correlation matrix (RCM). The RCM do not include MU multiplicities so for those triggers we'll use the TDT results.
621
622 // m_RCM_nameOrder: names in order of m_rates_matrix
623 // triggerNames: names in order of m_rates_matrix_TDT
624
625 for (size_t i = 0; i < m_rates_matrix.size(); ++i) {
626 for (size_t j = 0; j < m_rates_matrix.size(); ++j) {
628 (m_rates_matrix2[i])[j] = std::sqrt((m_rates_matrix2[i])[j])/(m_ratesDenominator);
629 }
630 }
631
632 for (size_t i = 0; i < m_RCM_nameOrder.size(); ++i) {
633 const std::string& name = m_RCM_nameOrder[i];
634
635 auto it = std::find(triggerNames.begin(), triggerNames.end(), name);
636 if (it == triggerNames.end()) {
637 std::cerr << "Trigger not found in TDT: " << name << std::endl;
638 continue;
639 }
640 size_t idxTDT = std::distance(triggerNames.begin(), it);
641
642 double original = (m_rates_matrix[i][i]);
643 double tdt = m_rates_matrix_TDT[idxTDT][idxTDT];
644 if (original != tdt) {
645
646 for (size_t j = 0; j < m_RCM_nameOrder.size(); ++j) {
647
648 auto jt = std::find(triggerNames.begin(), triggerNames.end(), m_RCM_nameOrder[j]);
649 if (jt == triggerNames.end()) continue;
650 size_t jTDT = std::distance(triggerNames.begin(), jt);
651 m_rates_matrix[i][j] = m_rates_matrix_TDT[idxTDT][jTDT];
652 m_rates_matrix[j][i] = m_rates_matrix_TDT[jTDT][idxTDT];
653 m_count_matrix[i][j] = m_counts_matrix_TDT[idxTDT][jTDT];
654 m_count_matrix[j][i] = m_counts_matrix_TDT[jTDT][idxTDT];
655 m_rates_matrix2[i][j] = m_rates_matrix2_TDT[idxTDT][jTDT];
656 m_rates_matrix2[j][i] = m_rates_matrix2_TDT[jTDT][idxTDT];
657
658 }
659 ATH_MSG_DEBUG("Trigger rates replaced from TDT: " << name << ", TDT rate: " << tdt << ", RCM rate: " << original);
660 }
661 }
662
663 for (size_t i = 0; i < m_L1TopoScore_matrix.size(); ++i) {
664 for (size_t j = 0; j < m_L1TopoScore_matrix.size(); ++j) {
665 if (i == j) {
666 m_L1TopoScore_matrix[i][j] = 1.0;
667 m_L1TopoScore_errors[i][j] = 0.0;
668 } else {
669 double A = m_rates_matrix[i][i];
670 double B = m_rates_matrix[j][j];
671 double AB = m_rates_matrix[i][j];
672 double sigma_A = m_rates_matrix2[i][i];
673 double sigma_B = m_rates_matrix2[j][j];
674 double sigma_AB = m_rates_matrix2[i][j];
675
676 double denom = AB * (A + B - AB);
677 if (AB == 0 || (A + B - AB) == 0 || denom == 0) {
678 m_L1TopoScore_matrix[i][j] = 0.0;
679 m_L1TopoScore_errors[i][j] = 0.0;
680 continue;
681 }
682
683 double topoScore = (A * B) / denom;
684 m_L1TopoScore_matrix[i][j] = topoScore;
685
686 double dfdA = (B * (A + B - AB) - A * B) / (AB * pow(A + B - AB, 2));
687 double dfdB = (A * (A + B - AB) - A * B) / (AB * pow(A + B - AB, 2));
688 double dfdAB = -(A + B - 2 * AB) / (pow(AB, 2) * pow(A + B - AB, 2));
689 double sigma2 = pow(dfdA * sigma_A, 2)
690 + pow(dfdB * sigma_B, 2)
691 + pow(dfdAB * sigma_AB, 2);
692
693 m_L1TopoScore_errors[i][j] = std::sqrt(sigma2);
694
695 }
696 }
697 }
698
699 //Fill rates matrix----------
700
701 for (size_t i = 0; i < m_rates_matrix.size(); ++i) {
702 for (size_t j = 0; j < m_rates_matrix.size(); ++j) {
703 m_ratesMatrixHist->SetBinContent(j+1, i+1, ((m_rates_matrix[i])[j]));
704 m_ratesMatrixHist->SetBinError(j+1, i+1,((m_rates_matrix2[i])[j]));
705 m_countsMatrixHist->SetBinContent(j+1, i+1, ((m_count_matrix[i])[j]));
706 m_L1TopoScoreMatrixHist->SetBinContent(j+1, i+1, ((m_L1TopoScore_matrix[i])[j]));
707 m_L1TopoScoreMatrixHist->SetBinError(j+1, i+1,((m_L1TopoScore_errors[i])[j]));
708 }
709 }
710
711 //--------------------------
712 return StatusCode::SUCCESS;
713}
constexpr int pow(int base, int exp) noexcept
std::vector< std::string > m_RCM_nameOrder
std::vector< std::vector< double > > m_L1TopoScore_matrix
std::vector< std::vector< double > > m_L1TopoScore_errors

◆ ratesInitialize()

StatusCode L1TopoRatesCalculator::ratesInitialize ( )
overridevirtual

To be implemented by the user.

Register "triggers" to calculate the rate for

Implements RatesAnalysisAlg.

Definition at line 205 of file L1TopoRatesCalculator.cxx.

205 {
206 ATH_MSG_DEBUG("In ratesInitialize()");
207
208 if (m_doHistograms){
209 ATH_MSG_DEBUG("################## Registering rates matrix:");
210 m_ratesMatrixHist = new TH2D("rates_matrix","L1item Rates matrix",150,-3,3,150,-3,3);
211 m_countsMatrixHist = new TH2D("counts_matrix","L1item Counts matrix",150,-3,3,150,-3,3);
212 m_L1TopoScoreMatrixHist = new TH2D("L1TopoScore_matrix","L1TopoScore matrix",150,-3,3,150,-3,3);
213 ATH_CHECK( histSvc()->regHist("/RATESTREAM/rates_matrix", m_ratesMatrixHist) );
214 ATH_CHECK( histSvc()->regHist("/RATESTREAM/counts_matrix", m_countsMatrixHist) );
215 ATH_CHECK( histSvc()->regHist("/RATESTREAM/L1TopoScore_matrix", m_L1TopoScoreMatrixHist) );
216 }
217 // Here we assume a full-ring, other functions are available to change this assumption.
218 // @see setTargetLumiMu(const double lumi, const double mu);
219 // @see setTargetLumiBunches(const double lumi, const int32_t bunches);
220 // @see setTargetMuBunches(const double mu, const int32_t bunches);
222
223 //-------------------
224
225 // Define triggers to emulate
226 // TDT can be used instead by ATH_CHECK(addAllExisting());
227
228 // name, prescale, expressPrescale, seedName, seedPrescale, groups
229 std::set<std::string> triggerGroup {"RATE_SingleElectron"};
230
231 // Initialize rates matrix of zeros and right size ----------------------------------------
232
233 std::vector<double> vector_zeros(m_L1_items.size(), 0);
234 for (size_t i = 0; i < m_L1_items.size(); ++i){
235 m_rates_matrix.push_back(vector_zeros);
236 m_rates_matrix2.push_back(vector_zeros);
237 m_rates_matrix_TDT.push_back(vector_zeros);
238 m_rates_matrix2_TDT.push_back(vector_zeros);
239 m_counts_matrix_TDT.push_back(vector_zeros);
240 m_count_matrix.push_back(vector_zeros);
241 m_L1TopoScore_matrix.push_back(vector_zeros);
242 m_L1TopoScore_errors.push_back(vector_zeros);
243
244 }
245 // Set labels of Rates matrix
246
247 for (size_t i = 1; i <= m_L1_items.size(); ++i){
248 int j = i-1;
249 m_ratesMatrixHist ->GetXaxis()->SetBinLabel(i, m_L1_items[j].c_str());
250 m_ratesMatrixHist ->GetYaxis()->SetBinLabel(i, m_L1_items[j].c_str());
251 m_countsMatrixHist ->GetXaxis()->SetBinLabel(i, m_L1_items[j].c_str());
252 m_countsMatrixHist ->GetYaxis()->SetBinLabel(i, m_L1_items[j].c_str());
253 m_L1TopoScoreMatrixHist ->GetXaxis()->SetBinLabel(i, m_L1_items[j].c_str());
254 m_L1TopoScoreMatrixHist ->GetYaxis()->SetBinLabel(i, m_L1_items[j].c_str());
255 }
256 //-----------------------------------------------------------------------------------------
257 ATH_MSG_ALWAYS("Add Existing");
258
259 for (const std::string& L1_item : m_L1_items_json) {
260 ATH_CHECK( addExisting(L1_item));
261 }
262
263 return StatusCode::SUCCESS;
264}
Gaudi::Property< float > m_lumi

◆ 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();
384 }
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)

◆ 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 {
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 }
ServiceHandle< StoreGateSvc > & inputMetaStore()
Accessor for the input metadata store.
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....

◆ 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 {
78 return AthAnalysisHelper::retrieveMetadata(folder,key,out,inputMetaStore(),time,channel);
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.

◆ 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.

static constexpr uint32_t FULL_RING
Number of bunches in a full ring.
void setTargetLumiBunches(const double lumi, const int32_t bunches)
Set the target instantaneous luminosity and number of bunches.

◆ 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 }
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}
static constexpr double LHC_FREQUENCY
Gaudi::Property< double > m_inelasticCrossSection

◆ 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 }
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);
792 }
793 printTarget();
794}
bool isZero(double v) const
Helper function for floating point subtraction.
float round(const float toRound, const unsigned int decimals)
Definition Mdt.cxx:27

◆ 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.

void setTargetMuBunches(const double mu, const int32_t bunches)
Set the target mu and number of bunches.

◆ 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}
JetConstituentVector::iterator iterator

◆ 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) {
75 if( firstExecute().isFailure() ) {
76 ATH_MSG_FATAL("Failure in firstEvent method");
77 return StatusCode::FAILURE;
78 }
79 }
80 return AthHistogramAlgorithm::sysExecute(ctx);
81}
virtual StatusCode firstExecute()
Function called when first execute is encountered user can read event information with evtStore()

◆ 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}
virtual StatusCode sysInitialize()
Initialization method invoked by the framework.

◆ 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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ 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 double bunchCrossingRate = m_enhancedBiasRatesTool->getBunchCrossingRate();
884 m_metadataTree->Branch("bunchCrossingRate", &bunchCrossingRate);
885 int doMultiSliceDiJet = m_doMultiSliceDiJet;
886 m_metadataTree->Branch("multiSliceDiJet", &doMultiSliceDiJet);
887
888 std::vector<std::string> triggers;
889 std::vector<std::string> lowers;
890 std::vector<double> prescales;
891 std::vector<double> express;
892 triggers.reserve(m_triggers.size());
893 lowers.reserve(m_triggers.size());
894 prescales.reserve(m_triggers.size());
895 express.reserve(m_triggers.size());
896 for (const auto& trigger : m_triggers) {
897 triggers.push_back(trigger.first);
898 lowers.push_back(trigger.second->getSeedName());
899 prescales.push_back(trigger.second->getPrescale() );
900 express.push_back(trigger.second->getPrescale(true /*includeExpress*/) );
901 }
902 for (const auto& group : m_groups) {
903 triggers.push_back(group.first);
904 lowers.push_back("-");
905 prescales.push_back(-1);
906 express.push_back(-1);
907 }
908 for (const auto& group : m_globalGroups) {
909 triggers.push_back("RATE_GLOBAL_" + group.first);
910 lowers.push_back("-");
911 prescales.push_back(-1);
912 express.push_back(-1);
913 }
914 m_metadataTree->Branch("triggers", &triggers);
915 m_metadataTree->Branch("lowers", &lowers);
916 m_metadataTree->Branch("prescales", &prescales);
917 m_metadataTree->Branch("express", &express);
918 std::vector<int32_t> bunchGroups;
919 bunchGroups.reserve(16);
920
921 uint32_t masterKey = 0;
922 uint32_t hltPrescaleKey = 0;
923 uint32_t lvl1PrescaleKey = 0;
924
925 if(!m_enhancedBiasRatesTool->isMC()){
926 bunchGroups = m_enhancedBiasRatesTool->getBunchGroups();
927 }
928 if(!m_configSvc.empty() && m_configSvc.isValid() ){
929 if ((bunchGroups.size() == 0 || std::all_of(bunchGroups.begin(), bunchGroups.end(), [](int i) { return i==0; }) ) && (!m_enhancedBiasRatesTool->isMC())) {
930 const TrigConf::L1BunchGroupSet& bgs = m_configSvc->l1BunchGroupSet(Gaudi::Hive::currentContext());
931 for (size_t i = 0; i < bgs.maxNBunchGroups(); ++i ) {
932 bunchGroups.push_back(bgs.getBunchGroup(i)->size());
933 }
934 }
935 masterKey = m_configSvc->masterKey();
936 hltPrescaleKey = m_configSvc->hltPrescaleKey();
937 lvl1PrescaleKey = m_configSvc->lvl1PrescaleKey();
938 }
939
940
941 m_metadataTree->Branch("bunchGroups", &bunchGroups);
942
943 m_metadataTree->Branch("hltChainIDGroup", &m_hltChainIDGroup);
944 m_metadataTree->Branch("l1ItemID", &m_l1ItemID);
945
946 m_metadataTree->Branch("masterKey", &masterKey);
947 m_metadataTree->Branch("lvl1PrescaleKey", &lvl1PrescaleKey);
948 m_metadataTree->Branch("hltPrescaleKey", &hltPrescaleKey);
949 std::string atlasProject = std::getenv("AtlasProject");
950 std::string atlasVersion = std::getenv("AtlasVersion");
951 m_metadataTree->Branch("AtlasProject", &atlasProject);
952 m_metadataTree->Branch("AtlasVersion", &atlasVersion);
953 m_metadataTree->Fill();
954}
uint32_t m_runNumber
What is the RunNumber.
constexpr std::size_t maxNBunchGroups() const
Maximum number of bunchgroups.
const std::shared_ptr< L1BunchGroup > & getBunchGroup(const std::string &name) const
Accessor to the bunchgroup by name.

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_beforeCTP_triggers

std::vector<std::string> L1TopoRatesCalculator::m_beforeCTP_triggers
private

Definition at line 65 of file L1TopoRatesCalculator.h.

◆ m_beforeCTP_triggers_mult

std::vector<std::string> L1TopoRatesCalculator::m_beforeCTP_triggers_mult
private

Definition at line 66 of file L1TopoRatesCalculator.h.

◆ m_configSvc

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

Definition at line 273 of file RatesAnalysisAlg.h.

273{this, "TrigConfigSvc", "TrigConf::xAODConfigSvc"};

◆ m_count_matrix

std::vector<std::vector<double> > L1TopoRatesCalculator::m_count_matrix
private

Definition at line 73 of file L1TopoRatesCalculator.h.

◆ m_counts_matrix_TDT

std::vector<std::vector<double> > L1TopoRatesCalculator::m_counts_matrix_TDT
private

Definition at line 72 of file L1TopoRatesCalculator.h.

◆ m_countsMatrixHist

TH2D* L1TopoRatesCalculator::m_countsMatrixHist {}
private

Definition at line 47 of file L1TopoRatesCalculator.h.

47{}; // Counts Matrix

◆ 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.

120{nullptr}; //used to cache the current file

◆ m_definitions

std::vector<ResultDefinition> L1TopoRatesCalculator::m_definitions
private

Definition at line 67 of file L1TopoRatesCalculator.h.

◆ m_denominator

std::vector<double> L1TopoRatesCalculator::m_denominator
private

Definition at line 76 of file L1TopoRatesCalculator.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.

284{this, "DoExpressRates", false, "Calculate total rates for the express stream."};

◆ 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.

282{this, "DoGlobalGroups", false, "Calculate total rates for each trigger level."};

◆ 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.

191{this, "DoHistograms", true, "Switch on histogram output of rate vs. mu and position in train."};

◆ 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.

192{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."};

◆ m_doneFirstEvent

bool AthAnalysisAlgorithm::m_doneFirstEvent {false}
privateinherited

Definition at line 122 of file AthAnalysisAlgorithm.h.

122{false};

◆ 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.

283{this, "DoTriggerGroups", false, "Calculate total rates for each group of triggers."};

◆ 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.

281{this, "DoUniqueRates", false, "Calculate unique rates for all chains (slow). Requires DoGlobalGroups=True too."};

◆ m_EB_weight

std::vector<double> L1TopoRatesCalculator::m_EB_weight
protected

Definition at line 43 of file L1TopoRatesCalculator.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_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.

287{this, "EnableLumiExtrapolation", true, "If false then no extrapolation in L, N_bunch or <mu> will be performed.."};

◆ m_enhancedBiasRatesTool

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

Definition at line 271 of file RatesAnalysisAlg.h.

271{this, "EnhancedBiasRatesTool", "EnhancedBiasWeighter/EnhancedBiasRatesTool"};

◆ 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.

275{this, "EventInfo", "EventInfo", "EventInfo name"};

◆ 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.

279{this, "ExpoScalingFactor", 0.1, "Optional. Exponential factor if using exponential-mu rates scaling."};

◆ 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.

290{this, "histogramSuffix", "", "Optional suffix to add to the name of the rate denominator histogram."};

◆ 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.

280{this, "InelasticCrossSection", 8e-26, "Inelastic cross section in units cm^2. Default 80 mb at 13 TeV."};

◆ m_inputMetaStore

ServiceHandle< StoreGateSvc > AthAnalysisAlgorithm::m_inputMetaStore
privateinherited

Object accessing the input metadata store.

Definition at line 116 of file AthAnalysisAlgorithm.h.

◆ m_L1_item_definitions

std::vector<std::string> L1TopoRatesCalculator::m_L1_item_definitions
private

Definition at line 64 of file L1TopoRatesCalculator.h.

◆ m_L1_items

std::vector<std::string> L1TopoRatesCalculator::m_L1_items
private

Definition at line 63 of file L1TopoRatesCalculator.h.

◆ m_L1_items_json

Gaudi::Property<std::vector<std::string> > L1TopoRatesCalculator::m_L1_items_json {this, "m_L1_items_json", {}, "L1 trigger items"}
private

Definition at line 58 of file L1TopoRatesCalculator.h.

58{this, "m_L1_items_json", {}, "L1 trigger items"};

◆ 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_l1topoKey

SG::ReadHandleKey<xAOD::L1TopoSimResultsContainer> L1TopoRatesCalculator::m_l1topoKey {this, "L1_TopoKey", "L1_TopoSimResults", "l1topo EDM"}

Definition at line 36 of file L1TopoRatesCalculator.h.

36{this, "L1_TopoKey", "L1_TopoSimResults", "l1topo EDM"};

◆ m_L1TopoScore_errors

std::vector<std::vector<double> > L1TopoRatesCalculator::m_L1TopoScore_errors
private

Definition at line 75 of file L1TopoRatesCalculator.h.

◆ m_L1TopoScore_matrix

std::vector<std::vector<double> > L1TopoRatesCalculator::m_L1TopoScore_matrix
private

Definition at line 74 of file L1TopoRatesCalculator.h.

◆ m_L1TopoScoreMatrixHist

TH2D* L1TopoRatesCalculator::m_L1TopoScoreMatrixHist {}
private

Definition at line 48 of file L1TopoRatesCalculator.h.

48{}; // L1TopoScore Matrix

◆ 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> L1TopoRatesCalculator::m_lumi {this, "TargetLuminosity", 2e34, "Targer inst. luminosity, assuming full ring."}
private

Definition at line 88 of file L1TopoRatesCalculator.h.

88{this, "TargetLuminosity", 2e34, "Targer inst. luminosity, assuming full ring."};

◆ 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.

289{this, "PrescalesJSON", {}, "Optional JSON of prescales from the TrigMenuRuleBook to apply."};

◆ m_rates_matrix

std::vector<std::vector<double> > L1TopoRatesCalculator::m_rates_matrix
private

Definition at line 68 of file L1TopoRatesCalculator.h.

◆ m_rates_matrix2

std::vector<std::vector<double> > L1TopoRatesCalculator::m_rates_matrix2
private

Definition at line 69 of file L1TopoRatesCalculator.h.

◆ m_rates_matrix2_TDT

std::vector<std::vector<double> > L1TopoRatesCalculator::m_rates_matrix2_TDT
private

Definition at line 71 of file L1TopoRatesCalculator.h.

◆ m_rates_matrix_TDT

std::vector<std::vector<double> > L1TopoRatesCalculator::m_rates_matrix_TDT
private

Definition at line 70 of file L1TopoRatesCalculator.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_ratesMatrixHist

TH2D* L1TopoRatesCalculator::m_ratesMatrixHist {}
private

Definition at line 46 of file L1TopoRatesCalculator.h.

46{}; // Rates Matrix

◆ m_RCM_nameOrder

std::vector<std::string> L1TopoRatesCalculator::m_RCM_nameOrder
protected

Definition at line 44 of file L1TopoRatesCalculator.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.

272{this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool"};

◆ 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_trigDecisionKey

SG::ReadHandleKey<xAOD::TrigDecision> L1TopoRatesCalculator::m_trigDecisionKey {this, "TrigDecisionKey", "xTrigDecision"}

Definition at line 35 of file L1TopoRatesCalculator.h.

35{this, "TrigDecisionKey", "xTrigDecision"};

◆ m_triggerMap

std::map<std::string, TriggerInfo> L1TopoRatesCalculator::m_triggerMap
private

Definition at line 83 of file L1TopoRatesCalculator.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.

276{this, "TruthHSJetsKey", "AntiKt4TruthJets", "Key for the hard scatter truth jet collection"};

◆ 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.

277{this, "truthPUJetsKey", "InTimeAntiKt4TruthJets", "Key for the pileup jet collection"};

◆ 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.

285{this, "UseBunchCrossingData", true, "BunchCrossing data requires CONDBR2 access. Can be disabled here if this is a problem."};

◆ m_userDefinedDefinitions

Gaudi::Property<std::vector<std::string> > L1TopoRatesCalculator::m_userDefinedDefinitions {this, "m_userDefinedDefinitions", {}, "user Defined definitions"}
private

Definition at line 60 of file L1TopoRatesCalculator.h.

60{this, "m_userDefinedDefinitions", {}, "user Defined definitions"};

◆ m_userDefinedMap

std::unordered_map<std::string, std::string> L1TopoRatesCalculator::m_userDefinedMap
private

Definition at line 61 of file L1TopoRatesCalculator.h.

◆ m_userDefinedNames

Gaudi::Property<std::vector<std::string> > L1TopoRatesCalculator::m_userDefinedNames {this, "m_userDefinedNames", {}, "user Defined Names"}
private

Definition at line 59 of file L1TopoRatesCalculator.h.

59{this, "m_userDefinedNames", {}, "user Defined Names"};

◆ 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.

288{this, "VetoStartOfTrain", 0, "How many BCID to veto at the start of a bunch train."};

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_weighted_sum

double L1TopoRatesCalculator::m_weighted_sum {}
private

Definition at line 77 of file L1TopoRatesCalculator.h.

77{};

◆ 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: