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"}
ToolHandleArray< IAdditionalWeightm_additionalWeights {this, "AdditionalWeights", {}, "Any additional reweightings to be applied directly on EB weight"}
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.
uint32_t m_metadataMasterKey = 0
uint32_t m_metadataHLTPSK = 0
 <smk read patched
uint32_t m_metadataL1PSK = 0
 <hltpsk read patched
bool m_metadataKeysCached = false
 < l1psk read patched
TH1D * m_scalingHist
 < patched key read
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 207 of file AthHistogramming.h.

◆ GraphMap_t

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

Typedef for convenience.

Definition at line 221 of file AthHistogramming.h.

◆ hash_t

typedef uint32_t AthHistogramming::hash_t
privateinherited

typedef for the internal hash

Definition at line 171 of file AthHistogramming.h.

◆ HistMap_t

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

Typedef for convenience.

Definition at line 200 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 214 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 44 of file RatesAnalysisAlg.h.

44 {
45 kMANUAL,
46 kAUTO,
48 };
@ 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 337 of file AthHistogramming.h.

338{
339 // We need to create a non-const clone
340 TEfficiency* effClone = dynamic_cast< TEfficiency* >( eff.Clone() );
341 if ( !effClone ) {
342 m_msg << MSG::ERROR << "Couldn't create a TEfficiency clone" << endmsg;
343 return StatusCode::FAILURE;
344 }
345 return this->book( *effClone, tDir, stream );
346}
#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 305 of file AthHistogramming.h.

306{
307 // We need to create a non-const clone
308 TH1* histClone = dynamic_cast< TH1* >( hist.Clone() );
309 if ( !histClone ) {
310 m_msg << MSG::ERROR << "Couldn't create a TH1 clone" << endmsg;
311 return StatusCode::FAILURE;
312 }
313 return this->book( *histClone, tDir, stream );
314}
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 405 of file AthHistogramming.h.

406{
407 // Call the other Book method and see if it returns a valid pointer
408 TTree* treePointer = this->bookGetPointer( treeRef, tDir, stream );
409 if ( treePointer )
410 {
411 return StatusCode::SUCCESS;
412 }
413 else
414 {
415 return StatusCode::FAILURE;
416 }
417}
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 358 of file AthHistogramming.h.

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

◆ 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 348 of file AthHistogramming.h.

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

◆ 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 326 of file AthHistogramming.h.

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

◆ 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 316 of file AthHistogramming.h.

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

◆ 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 283 of file AthHistogramming.h.

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

◆ 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 412 of file AthHistogramming.cxx.

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

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

◆ 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 297 of file AthHistogramming.cxx.

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

132{
133 // Modify the name and title according to the prefixes of this classes instance
134 std::string effName(effRef.GetName());
135 const std::string effTitle(effRef.GetTitle());
136 std::string bookingString("");
137
138 this->buildBookingString( bookingString, effName, tDir, stream );
139 effRef.SetTitle((m_histTitlePrefix+effTitle+m_histTitlePostfix).c_str() );
140 effRef.SetName(effName.c_str());
141
142 // Check if the hash for this effName already exists, i.e., if we have a hash collision
143 const hash_t effHash = this->hash(effName);
144 EffMap_t::const_iterator it = m_effMap.find( effHash );
145 if ( it != m_effMap.end() ) // It does exist!
146 {
147 m_msg << MSG::WARNING
148 << "Detected a hash collision. The hash for the TEfficiency with name=" << effName
149 << " already exists and points to a TEfficiency with name=" << it->second->GetName()
150 << " NOT going to book the new TEfficiency and returning a NULL pointer!" << endmsg;
151 return NULL;
152 }
153
154 // Set the new name and title for the TEfficiency, based on the prefixes that the user set for this class instance
155 // Create a clone that has the new name
156
157 // Massage the final string to book things
158
159 // Register the TEfficiency into the THistSvc
160 if ( !((histSvc()->regEfficiency(bookingString, &effRef)).isSuccess()) )
161 {
162 m_msg << MSG::WARNING
163 << "Problem registering TEfficiency with name " << effName
164 << ", name prefix " << m_histNamePrefix
165 << ", title " << effTitle
166 << ", tile prefix " << m_histTitlePrefix
167 << ", and tile postfix " << m_histTitlePostfix
168 << " in " << m_name << "!" << endmsg;
169 return NULL;
170 }
171
172 // Also register it in the local map of string to pointer
173 m_effMap.insert( m_effMap.end(), std::pair< const hash_t, TEfficiency* >( effHash, &effRef ) );
174
175 return &effRef;
176}
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 295 of file AthHistogramming.h.

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

◆ 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 83 of file AthHistogramming.cxx.

84{
85 // Modify the name and title according to the prefixes of this classes instance
86 std::string histName(histRef.GetName());
87 const std::string histTitle(histRef.GetTitle());
88 std::string bookingString("");
89
90 this->buildBookingString( bookingString, histName, tDir, stream );
91 histRef.SetTitle((m_histTitlePrefix+histTitle+m_histTitlePostfix).c_str() );
92 histRef.SetName(histName.c_str());
93
94 // Check if the hash for this histName already exists, i.e., if we have a hash collision
95 const hash_t histHash = this->hash(histName);
96 HistMap_t::const_iterator it = m_histMap.find( histHash );
97 if ( it != m_histMap.end() ) // It does exist!
98 {
99 m_msg << MSG::WARNING
100 << "Detected a hash collision. The hash for the histogram with name=" << histName
101 << " already exists and points to a histogram with name=" << it->second->GetName()
102 << " NOT going to book the new histogram and returning a NULL pointer!" << endmsg;
103 return NULL;
104 }
105
106 // Set the new name and title for the histogram, based on the prefixes that the user set for this class instance
107 // Create a clone that has the new name
108
109 // Massage the final string to book things
110
111 // Register the histogram into the THistSvc
112 if ( !((histSvc()->regHist(bookingString, &histRef)).isSuccess()) )
113 {
114 m_msg << MSG::WARNING
115 << "Problem registering histogram with name " << histName
116 << ", name prefix " << m_histNamePrefix
117 << ", title " << histTitle
118 << ", tile prefix " << m_histTitlePrefix
119 << ", and tile postfix " << m_histTitlePostfix
120 << " in " << m_name << "!" << endmsg;
121 return NULL;
122 }
123
124 // Also register it in the local map of string to pointer
125 m_histMap.insert( m_histMap.end(), std::pair< const hash_t, TH1* >( histHash, &histRef ) );
126
127 return &histRef;
128}
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 274 of file AthHistogramming.h.

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

◆ 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 545 of file AthHistogramming.cxx.

550{
551 // Massage the final string to book things
552 if(tDir.empty()) tDir = m_rootDir;
553 size_t pos = histName.rfind('/');
554 if(pos != std::string::npos){
555 tDir+='/';
556 tDir.append(histName, 0,pos);
557 histName.erase(0,pos+1);
558 };
559 if(stream.empty()) stream = m_streamName;
560
561 if(usePrefixPostfix){
562 bookingString = "/"+stream+"/"+tDir+"/"+m_histNamePrefix+histName+m_histNamePostfix;
563 } else {
564 bookingString = "/"+stream+"/"+tDir+"/"+histName;
565 }
566 while(bookingString.find("//") != std::string::npos){
567 this->myReplace(bookingString,"//","/");
568 }
569
570 return;
571}
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 51 of file AthHistogramming.cxx.

55{
58 m_rootDir = rootDir;
59 m_histNamePrefix = histNamePrefix;
60 m_histNamePostfix = histNamePostfix;
61 m_histTitlePrefix = histTitlePrefix;
62 m_histTitlePostfix = histTitlePostfix;
63
64 return StatusCode::SUCCESS;
65}
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)
size_t size() const
Number of registered mappings.
bool msgLvl(const MSG::Level lvl) const
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ 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 235 of file AthHistogramming.cxx.

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

◆ 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 635 of file RatesAnalysisAlg.cxx.

635 {
636 ATH_MSG_VERBOSE("Executing " << name() << " on event " << m_eventCounter << "...");
637 if (m_eventCounter++ == 0) { // First time in execute loop - cannot access TDT before this.
639 if (!m_configSvc.empty() && m_configSvc.isValid()) {
640 m_metadataMasterKey = m_configSvc->masterKey();
641 m_metadataHLTPSK = m_configSvc->hltPrescaleKey();
642 m_metadataL1PSK = m_configSvc->lvl1PrescaleKey();
643
644 ATH_MSG_INFO("Cached metadata trigger keys: SMK="
646 << " L1PSK=" << m_metadataL1PSK
647 << " HLTPSK=" << m_metadataHLTPSK);
649 }
650 }
651 const EventContext& ctx = Gaudi::Hive::currentContext();
652 // Get event characteristics
653 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey, ctx);
654 ATH_CHECK( eventInfo.isValid() );
655 uint32_t distance = 0;
656 ATH_CHECK( m_enhancedBiasRatesTool->getDistanceIntoTrain(eventInfo.get(), distance, ctx) );
657 const bool isMC = m_enhancedBiasRatesTool->isMC();
658
659 // Get the weighting & scaling characteristics
660 m_weightingValues.m_enhancedBiasWeight = m_enhancedBiasRatesTool->getEBWeight(eventInfo.get());
661 m_weightingValues.m_eventMu = std::ceil(eventInfo->actualInteractionsPerCrossing()); // This always seems to be a half integer
662 m_weightingValues.m_eventLumi = m_enhancedBiasRatesTool->getLBLumi(eventInfo.get());
663 m_weightingValues.m_isUnbiased = m_enhancedBiasRatesTool->isUnbiasedEvent(eventInfo.get());
664 m_weightingValues.m_distanceInTrain = distance;
665 m_weightingValues.m_eventLiveTime = m_enhancedBiasRatesTool->getEBLiveTime(eventInfo.get());
666 if (m_useBunchCrossingData && m_vetoStartOfTrain > 0 && m_weightingValues.m_distanceInTrain < m_vetoStartOfTrain) return StatusCode::SUCCESS;
667
668 // Bunch factor doesn't change as a fn. of the run. Reminder: m_bunchFactor = m_targetBunches / (double)ebPairedBunches;
669 m_weightingValues.m_muFactor = (m_weightingValues.m_eventMu ? m_targetMu / m_weightingValues.m_eventMu : 0.0);
670 m_weightingValues.m_linearLumiFactor = m_targetLumi / m_weightingValues.m_eventLumi;
671 m_weightingValues.m_expoMuFactor = m_weightingValues.m_bunchFactor * exp( m_expoScalingFactor * (m_targetMu - m_weightingValues.m_eventMu) );
672
673 // Ignore zero weighted events. Typically these come from bad LB
674 if (RatesHistoBase::isZero(m_weightingValues.m_enhancedBiasWeight)) {
675 return StatusCode::SUCCESS;
676 }
677
678 // Apply any additional weights multiplicatively if required
679 if (!m_additionalWeights.empty()) {
680 for (const auto& addWeight : m_additionalWeights) {
681 double wt = 1.0;
682 ATH_CHECK(addWeight->getValue(wt));
683 ATH_MSG_DEBUG("Additional weight from [" << addWeight->name() << "], value = " << wt);
684 m_weightingValues.m_enhancedBiasWeight *= wt;
685 }
686 }
687
688 m_weightedEventCounter += m_weightingValues.m_enhancedBiasWeight;
689
690 double ratesDenominator = 0.0;
692 ratesDenominator = m_weightingValues.m_enhancedBiasWeight; // In multi-slice mode we only normalize to the weighted number of events
693 } else {
694 ratesDenominator = m_weightingValues.m_eventLiveTime; // Otherwise, we need to keep track of elapsed walltime as well
695 }
696 m_ratesDenominator += ratesDenominator;
697
698 if (m_doHistograms) {
699 m_bcidHist->Fill(eventInfo->bcid(), m_weightingValues.m_enhancedBiasWeight);
700 m_scalingHist->Fill(0.5, ratesDenominator); // Walltime
701 m_scalingHist->Fill(1.5, 1.); // Total events
702 m_scalingHist->Fill(2.5, m_weightingValues.m_enhancedBiasWeight ); // Total weighted events
703 }
704
705 // HSTP filter check
706 if (isMC) {
707 bool filterPass = true;
708 ATH_CHECK( pass_HstpFilter(filterPass) );
709 if (!filterPass) {return StatusCode::SUCCESS;}
710 }
711
712 // Do automated triggers
714
715 // Do TDT-controlled triggers
717
718 // Run user's code. Do manual triggers
720
721 // Execute groups
722 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.
723 for (const auto& group : m_activeGroups) group->execute(m_weightingValues); // Individual groups, CPS groups and active unique groups. Set.
724
725 // Reset triggers
726 for (const auto& trigger : m_activatedTriggers) trigger->reset();
727 m_activatedTriggers.clear();
728
729 // Some debug info
730 if (m_eventCounter % 1000 == 0) {
731 ATH_MSG_INFO( "Event " << m_eventCounter << " " << m_weightingValues.print() << " currentWallTime:" << m_ratesDenominator );
732 }
733
734 setFilterPassed(true); //if got here, assume that means algorithm passed
735 return StatusCode::SUCCESS;
736}
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
uint32_t m_metadataHLTPSK
<smk read patched
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.
ToolHandleArray< IAdditionalWeight > m_additionalWeights
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.
uint32_t m_metadataL1PSK
<hltpsk read patched
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
bool m_metadataKeysCached
< l1psk read patched
double m_targetMu
What pileup level the prediction is targeting.
TH1D * m_scalingHist
< patched key read
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 738 of file RatesAnalysisAlg.cxx.

738 {
739 for (const auto& trigger : m_existingTriggers) {
740 const bool passed = trigger.second->isPassed();
741 // L1 chains are always active, HLT chains are active if their L1 passed.
742 const std::string& lower = m_lowerTrigger[trigger.first];
743 // Expect this find operation to fail for L1 chains (lower = "")
744 const std::unordered_map<std::string, const Trig::ChainGroup*>::const_iterator it = m_existingTriggers.find(lower);
745 const bool active = (it == m_existingTriggers.end() ? true : it->second->isPassed());
746 ATH_CHECK( setTriggerDesicison(trigger.first, passed, active) );
747 }
748 return StatusCode::SUCCESS;
749}
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 751 of file RatesAnalysisAlg.cxx.

751 {
752 // TODO emulation code here
753 for (const auto& trigger : m_autoTriggers) {
754 ATH_MSG_WARNING("Cannot do rates for " << trigger << ". Automatic trigger emulation is not yet included, sorry :(");
755 }
756 return StatusCode::SUCCESS;
757}
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 759 of file RatesAnalysisAlg.cxx.

759 {
760 ATH_MSG_INFO ("Finalizing " << name() << "...");
761
763 if (!m_doMultiSliceDiJet) { // Cannot estimate multi-slice rates before the merging stage
764 if (m_scanTriggers.size()) {
765 ATH_MSG_INFO("################## Computed Rate Scans for Threshold-Scan Items:");
766 for (const auto& trigger : m_scanTriggers) ATH_MSG_INFO(trigger.second->printRate(m_ratesDenominator));
767 }
768 if (m_triggers.size()) {
769 ATH_MSG_INFO("################## Computed Rate Estimations for Single Items:");
770 std::set<std::string> keys; // Used an unordered map for speed, but now we'd like the items in order
771 for (const auto& trigger : m_triggers) keys.insert(trigger.first);
772 for (const std::string& key : keys) ATH_MSG_INFO(m_triggers.at(key)->printRate(m_ratesDenominator));
773 }
774 if (m_expressTriggers.size()) {
775 ATH_MSG_INFO("################## Computed Express Rate Estimations for Single Items:");
776 for (const auto& trigger : m_expressTriggers) ATH_MSG_INFO(trigger->printExpressRate(m_ratesDenominator));
777 }
778 if (m_groups.size()) {
779 ATH_MSG_INFO("################## Computed Rate Estimations for Groups:");
780 for (const auto& group : m_groups) ATH_MSG_INFO(group.second->printRate(m_ratesDenominator));
781 }
782 if (m_globalGroups.size()) {
783 ATH_MSG_INFO("################## Computed Rate Estimations for Global Groups:");
784 for (const auto& group : m_globalGroups) ATH_MSG_INFO(group.second->printRate(m_ratesDenominator));
785 }
786 }
787 ATH_MSG_INFO("################## LHC Conditions and weighting information:");
789 printTarget();
791 ATH_MSG_INFO("##################");
793
794 return StatusCode::SUCCESS;
795}
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 888 of file RatesAnalysisAlg.cxx.

888 {
889 if (name.find("HLT_") != std::string::npos) return 2;
890 if (name.find("L1_") != std::string::npos) return 1;
891 return 2;
892}

◆ 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 477 of file AthHistogramming.cxx.

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

◆ 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 430 of file AthHistogramming.h.

431{
432 const uint64_t hash64 = CxxUtils::crc64( histName );
433 return (hash_t)(hash64 & 0xFFFFFFFF);
434}
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 183 of file AthHistogramming.cxx.

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

◆ 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 371 of file AthHistogramming.h.

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

◆ 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 388 of file AthHistogramming.h.

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

◆ 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:359
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 877 of file RatesAnalysisAlg.cxx.

877 {
878 return (group.find("CPS") != std::string::npos);
879}

◆ 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 881 of file RatesAnalysisAlg.cxx.

881 {
882 if (me.find("L1_RD") != std::string::npos) return true;
883 if (me.find("L1RD") != std::string::npos) return true;
884 if (seed.find("L1_RD") != std::string::npos) return true;
885 return false;
886}

◆ isZero()

bool RatesAnalysisAlg::isZero ( double v) const
inlineprivateinherited

Helper function for floating point subtraction.

Definition at line 249 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 575 of file AthHistogramming.cxx.

578{
579 size_t pos = 0;
580 while((pos = str.find(oldStr, pos)) != std::string::npos)
581 {
582 str.replace(pos, oldStr.length(), newStr);
583 pos += newStr.length();
584 }
585}

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

◆ 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 614 of file RatesAnalysisAlg.cxx.

614 {
615
616 if (!m_doMultiSliceDiJet) {
617 return StatusCode::SUCCESS;
618 };
619
620 SG::ReadHandle<xAOD::JetContainer> truthHS_jets(m_truthHS_jets_RHKey);
621 ATH_CHECK( truthHS_jets.isValid() );
622 SG::ReadHandle<xAOD::JetContainer> truthPU_jets(m_truthPU_jets_RHKey);
623 ATH_CHECK( truthPU_jets.isValid() );
624
625 // Extract the pT of the leading jet that defines the hardness. The jet containers should always be pT sorted
626 const double pT_j1_truthPU = truthPU_jets->size() ? truthPU_jets->front()->pt() : 0; // Hardest PU truth jet
627 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
628
629 // Now see if we pass the filter.
630 pass = pT_j1_truthHS > pT_j1_truthPU;
631 ATH_MSG_DEBUG("Hard Scatter (" << pT_j1_truthHS/1000. << " GeV) Harder Than Pileup (" << pT_j1_truthPU/1000. << " GeV) filter " << (pass ? "PASSES" : "FAILS"));
632 return StatusCode::SUCCESS;
633}
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 404 of file RatesAnalysisAlg.cxx.

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

◆ 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 867 of file RatesAnalysisAlg.cxx.

867 {
868 ATH_MSG_INFO("Input " << (m_enhancedBiasRatesTool->isMC() ? "MC" : "EB Data")
869 << " with <L_inst.> = "
870 << m_enhancedBiasRatesTool->getAverageLumi()
871 << " cm-2s-1, <mu> = "
872 << m_enhancedBiasRatesTool->getAverageMu()
873 << ", paired bunches = "
874 << m_enhancedBiasRatesTool->getPairedBunches());
875}

◆ printStatistics()

void RatesAnalysisAlg::printStatistics ( ) const
privateinherited

Print some extra statistics on events processed.

Definition at line 863 of file RatesAnalysisAlg.cxx.

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

◆ printTarget()

void RatesAnalysisAlg::printTarget ( ) const
privateinherited

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

Definition at line 855 of file RatesAnalysisAlg.cxx.

855 {
857 ATH_MSG_INFO("Calculating rates for a target L_inst. = " << m_targetLumi << " cm-2s-1, mu = " << m_targetMu << ", paired bunches = " << m_targetBunches);
858 } else {
859 ATH_MSG_INFO("Luminosity extrapolation is switched off. Input files will determin the paired bunches, L_inst. and mu profile.");
860 }
861}

◆ 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:148
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) {
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}
std::vector< std::string > m_RCM_nameOrder
std::vector< std::vector< double > > m_L1TopoScore_matrix
std::vector< std::vector< double > > m_L1TopoScore_errors
constexpr int pow(int x)
Definition conifer.h:27

◆ 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 185 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
Luminosity FunctionsThe target lumi in cm-2s-1

Definition at line 173 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
Luminosity FunctionsThe target lumi in cm-2s-1
bunchesThe target number of paired bunches

Definition at line 817 of file RatesAnalysisAlg.cxx.

817 {
818 if (m_eventCounter > 1) { // All settings must be defined before we start looping over the sample
819 ATH_MSG_WARNING("Too late to call setTargetLumiBunches. Do this during ratesInitialize().");
820 return;
821 }
823 if (bunches == 0) {
824 ATH_MSG_WARNING("Cannot have bunches = 0. Setting to 1.");
825 m_targetBunches = 1;
826 } else {
827 m_targetBunches = bunches;
828 }
830 printTarget();
831}
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
Luminosity FunctionsThe target lumi in cm-2s-1
muThe target pileup

Definition at line 797 of file RatesAnalysisAlg.cxx.

797 {
798 if (m_eventCounter > 1) { // All settings must be defined before we start looping over the sample
799 ATH_MSG_WARNING("Too late to call setTargetLumiMu. Do this during ratesInitialize().");
800 return;
801 }
803 if (isZero(mu)) {
804 ATH_MSG_WARNING("Cannot have <mu> = 0. Setting to 1.");
805 m_targetMu = 1;
806 } else {
807 m_targetMu = mu;
808 }
811 ATH_MSG_WARNING("Un-physical number of bunches " << m_targetBunches << ", should be within 1 < N < " << EnhancedBiasWeighter::FULL_RING+1);
813 }
814 printTarget();
815}
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 179 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 834 of file RatesAnalysisAlg.cxx.

834 {
835 if (m_eventCounter > 1) { // All settings must be defined before we start looping over the sample
836 ATH_MSG_WARNING("Too late to call setTargetMuBunches. Do this during ratesInitialize().");
837 return;
838 }
839 if (bunches == 0) {
840 ATH_MSG_WARNING("Cannot have paired bunches = 0. Setting to 1.");
841 m_targetBunches = 1;
842 } else {
843 m_targetBunches = bunches;
844 }
845 if (isZero(mu)) {
846 ATH_MSG_WARNING("Cannot have mu = 0. Setting to 1.");
847 m_targetMu = 1;
848 } else {
849 m_targetMu = mu;
850 }
852 printTarget();
853}

◆ 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}
void 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 363 of file AthHistogramming.cxx.

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

◆ 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 894 of file RatesAnalysisAlg.cxx.

894 {
895 if (!m_metadataTree) {
896 return;
897 }
898 m_runNumber = m_enhancedBiasRatesTool->getRunNumber();
899 m_metadataTree->Branch("runNumber", &m_runNumber);
900 m_metadataTree->Branch("targetMu", &m_targetMu);
901 m_metadataTree->Branch("targetBunches", &m_targetBunches);
902 m_metadataTree->Branch("targetLumi", &m_targetLumi);
903
904 double bunchCrossingRate = m_enhancedBiasRatesTool->getBunchCrossingRate();
905 m_metadataTree->Branch("bunchCrossingRate", &bunchCrossingRate);
906 int doMultiSliceDiJet = m_doMultiSliceDiJet;
907 m_metadataTree->Branch("multiSliceDiJet", &doMultiSliceDiJet);
908
909 std::vector<std::string> triggers;
910 std::vector<std::string> lowers;
911 std::vector<double> prescales;
912 std::vector<double> express;
913 triggers.reserve(m_triggers.size());
914 lowers.reserve(m_triggers.size());
915 prescales.reserve(m_triggers.size());
916 express.reserve(m_triggers.size());
917 for (const auto& trigger : m_triggers) {
918 triggers.push_back(trigger.first);
919 lowers.push_back(trigger.second->getSeedName());
920 prescales.push_back(trigger.second->getPrescale() );
921 express.push_back(trigger.second->getPrescale(true /*includeExpress*/) );
922 }
923 for (const auto& group : m_groups) {
924 triggers.push_back(group.first);
925 lowers.push_back("-");
926 prescales.push_back(-1);
927 express.push_back(-1);
928 }
929 for (const auto& group : m_globalGroups) {
930 triggers.push_back("RATE_GLOBAL_" + group.first);
931 lowers.push_back("-");
932 prescales.push_back(-1);
933 express.push_back(-1);
934 }
935 m_metadataTree->Branch("triggers", &triggers);
936 m_metadataTree->Branch("lowers", &lowers);
937 m_metadataTree->Branch("prescales", &prescales);
938 m_metadataTree->Branch("express", &express);
939 std::vector<int32_t> bunchGroups;
940 bunchGroups.reserve(16);
941
942 uint32_t masterKey = 0;
943 uint32_t hltPrescaleKey = 0;
944 uint32_t lvl1PrescaleKey = 0;
945
946 if(!m_enhancedBiasRatesTool->isMC()){
947 bunchGroups = m_enhancedBiasRatesTool->getBunchGroups();
948 }
949
951 masterKey = m_metadataMasterKey;
952 hltPrescaleKey = m_metadataHLTPSK;
953 lvl1PrescaleKey = m_metadataL1PSK;
954 }
955
956 if(!m_configSvc.empty() && m_configSvc.isValid() ){
957 if ((bunchGroups.size() == 0 || std::all_of(bunchGroups.begin(), bunchGroups.end(), [](int i) { return i==0; }) ) && (!m_enhancedBiasRatesTool->isMC())) {
958 const TrigConf::L1BunchGroupSet& bgs = m_configSvc->l1BunchGroupSet(Gaudi::Hive::currentContext());
959 for (size_t i = 0; i < bgs.maxNBunchGroups(); ++i ) {
960 bunchGroups.push_back(bgs.getBunchGroup(i)->size());
961 }
962 }
964 masterKey = m_configSvc->masterKey();
965 hltPrescaleKey = m_configSvc->hltPrescaleKey();
966 lvl1PrescaleKey = m_configSvc->lvl1PrescaleKey();
967 }
968 }
969
970
971 m_metadataTree->Branch("bunchGroups", &bunchGroups);
972
973 m_metadataTree->Branch("hltChainIDGroup", &m_hltChainIDGroup);
974 m_metadataTree->Branch("l1ItemID", &m_l1ItemID);
975
976 m_metadataTree->Branch("masterKey", &masterKey);
977 m_metadataTree->Branch("lvl1PrescaleKey", &lvl1PrescaleKey);
978 m_metadataTree->Branch("hltPrescaleKey", &hltPrescaleKey);
979 std::string atlasProject = std::getenv("AtlasProject");
980 std::string atlasVersion = std::getenv("AtlasVersion");
981 m_metadataTree->Branch("AtlasProject", &atlasProject);
982 m_metadataTree->Branch("AtlasVersion", &atlasVersion);
983 m_metadataTree->Fill();
984}
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 256 of file RatesAnalysisAlg.h.

◆ m_activeGroups

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

All groups which are enabled (PS >= 1).

Definition at line 258 of file RatesAnalysisAlg.h.

◆ m_additionalWeights

ToolHandleArray<IAdditionalWeight> RatesAnalysisAlg::m_additionalWeights {this, "AdditionalWeights", {}, "Any additional reweightings to be applied directly on EB weight"}
privateinherited

Definition at line 275 of file RatesAnalysisAlg.h.

275{this, "AdditionalWeights", {}, "Any additional reweightings to be applied directly on EB weight"};

◆ 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 260 of file RatesAnalysisAlg.h.

◆ m_bcidHist

TH1D* RatesAnalysisAlg::m_bcidHist
privateinherited

Histogram of the BCIDs distribution of the processing.

Definition at line 307 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 274 of file RatesAnalysisAlg.h.

274{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 288 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 286 of file RatesAnalysisAlg.h.

286{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 284 of file RatesAnalysisAlg.h.

284{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 192 of file RatesAnalysisAlg.h.

192{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 193 of file RatesAnalysisAlg.h.

193{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 285 of file RatesAnalysisAlg.h.

285{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 283 of file RatesAnalysisAlg.h.

283{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 210 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 289 of file RatesAnalysisAlg.h.

289{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 272 of file RatesAnalysisAlg.h.

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

◆ m_eventCounter

uint32_t RatesAnalysisAlg::m_eventCounter
privateinherited

Count how many events processed.

Definition at line 298 of file RatesAnalysisAlg.h.

◆ m_eventInfoKey

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

Definition at line 277 of file RatesAnalysisAlg.h.

277{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 262 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 281 of file RatesAnalysisAlg.h.

281{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 270 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 257 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 253 of file RatesAnalysisAlg.h.

◆ m_graphMap

GraphMap_t AthHistogramming::m_graphMap
privateinherited

The map of TGraph names to their pointers.

Definition at line 224 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 252 of file RatesAnalysisAlg.h.

◆ m_histMap

HistMap_t AthHistogramming::m_histMap
privateinherited

The map of histogram names to their pointers.

Definition at line 203 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 292 of file RatesAnalysisAlg.h.

292{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 265 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 282 of file RatesAnalysisAlg.h.

282{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 268 of file RatesAnalysisAlg.h.

◆ m_l1ItemID

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

Definition at line 266 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 269 of file RatesAnalysisAlg.h.

◆ m_linearLumiFactor

double RatesAnalysisAlg::m_linearLumiFactor
protectedinherited

Definition at line 189 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 263 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 259 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_metadataHLTPSK

uint32_t RatesAnalysisAlg::m_metadataHLTPSK = 0
privateinherited

<smk read patched

Definition at line 302 of file RatesAnalysisAlg.h.

◆ m_metadataKeysCached

bool RatesAnalysisAlg::m_metadataKeysCached = false
privateinherited

< l1psk read patched

Definition at line 304 of file RatesAnalysisAlg.h.

◆ m_metadataL1PSK

uint32_t RatesAnalysisAlg::m_metadataL1PSK = 0
privateinherited

<hltpsk read patched

Definition at line 303 of file RatesAnalysisAlg.h.

◆ m_metadataMasterKey

uint32_t RatesAnalysisAlg::m_metadataMasterKey = 0
privateinherited

Definition at line 301 of file RatesAnalysisAlg.h.

◆ m_metadataTree

TTree* RatesAnalysisAlg::m_metadataTree
privateinherited

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

bunchgroup, lumi)

Definition at line 309 of file RatesAnalysisAlg.h.

◆ m_msg

MsgStream AthHistogramming::m_msg
privateinherited

Cached Message Stream.

Definition at line 250 of file AthHistogramming.h.

◆ m_name

std::string AthHistogramming::m_name
privateinherited

Instance name.

Definition at line 247 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 291 of file RatesAnalysisAlg.h.

291{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 191 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 297 of file RatesAnalysisAlg.h.

◆ m_scalingHist

TH1D* RatesAnalysisAlg::m_scalingHist
privateinherited

< patched key read

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

Definition at line 306 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 251 of file RatesAnalysisAlg.h.

◆ m_streamName

std::string AthHistogramming::m_streamName
privateinherited

Name of the ROOT output stream (file).

Definition at line 228 of file AthHistogramming.h.

◆ m_targetBunches

double RatesAnalysisAlg::m_targetBunches
privateinherited

How many bunches the prediction is targeting.

Definition at line 295 of file RatesAnalysisAlg.h.

◆ m_targetLumi

double RatesAnalysisAlg::m_targetLumi
privateinherited

What instantaneous luminosity the prediction is targeting.

Definition at line 296 of file RatesAnalysisAlg.h.

◆ m_targetMu

double RatesAnalysisAlg::m_targetMu
privateinherited

What pileup level the prediction is targeting.

Definition at line 294 of file RatesAnalysisAlg.h.

◆ m_tdt

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

Definition at line 273 of file RatesAnalysisAlg.h.

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

◆ m_treeMap

TreeMap_t AthHistogramming::m_treeMap
privateinherited

The map of TTree names to their pointers.

Definition at line 217 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 196 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 278 of file RatesAnalysisAlg.h.

278{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 279 of file RatesAnalysisAlg.h.

279{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 254 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 287 of file RatesAnalysisAlg.h.

287{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 290 of file RatesAnalysisAlg.h.

290{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 299 of file RatesAnalysisAlg.h.

◆ m_weightingValues

WeightingValuesSummary_t RatesAnalysisAlg::m_weightingValues
protectedinherited

Possible weighting & lumi extrapolation values for the current event.

Definition at line 190 of file RatesAnalysisAlg.h.


The documentation for this class was generated from the following files: