|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef RATESANALYSIS_RATESANALYSISALG_H
6 #define RATESANALYSIS_RATESANALYSISALG_H 1
15 #include "Gaudi/Parsers/Factory.h"
23 #include <unordered_set>
61 const double prescale = 1.,
62 const double expressPrescale = -1.,
64 const double seedPrecale = 1.,
65 const std::string&
groups =
"",
81 const double prescale = 1.,
82 const double expressPrescale = -1.,
84 const double seedPrecale = 1.,
85 const std::set<std::string>&
groups = std::set<std::string>(),
103 const double thresholdMin,
104 const double thresholdMax,
107 const double prescale = 1.,
109 const double seedPrecale = 1.,
118 const std::vector<double>& thresholdBinEdges,
120 const double prescale = 1.,
122 const double seedPrecale = 1.,
231 bool isRandomSeed(
const std::string& me,
const std::string& seed)
const;
241 std::unordered_map<std::string, std::unique_ptr<RatesTrigger>>
m_triggers;
242 std::unordered_map<std::string, std::unique_ptr<RatesScanTrigger>>
m_scanTriggers;
243 std::unordered_map<std::string, std::unique_ptr<RatesGroup>>
m_groups;
263 ToolHandle<IEnhancedBiasWeighter>
m_enhancedBiasRatesTool{
this,
"EnhancedBiasRatesTool",
"EnhancedBiasWeighter/EnhancedBiasRatesTool"};
264 ToolHandle<Trig::TrigDecisionTool>
m_tdt{
this,
"TrigDecisionTool",
"Trig::TrigDecisionTool/TrigDecisionTool"};
267 Gaudi::Property<double>
m_expoScalingFactor{
this,
"ExpoScalingFactor", 0.1,
"Optional. Exponential factor if using exponential-mu rates scaling."};
268 Gaudi::Property<double>
m_inelasticCrossSection{
this,
"InelasticCrossSection", 8
e-26,
"Inelastic cross section in units cm^2. Default 80 mb at 13 TeV."};
269 Gaudi::Property<bool>
m_doUniqueRates{
this,
"DoUniqueRates",
false,
"Calculate unique rates for all chains (slow). Requires DoGlobalGroups=True too."};
270 Gaudi::Property<bool>
m_doGlobalGroups{
this,
"DoGlobalGroups",
false,
"Calculate total rates for each trigger level."};
271 Gaudi::Property<bool>
m_doTriggerGroups{
this,
"DoTriggerGroups",
false,
"Calculate total rates for each group of triggers."};
272 Gaudi::Property<bool>
m_doExpressRates{
this,
"DoExpressRates",
false,
"Calculate total rates for the express stream."};
273 Gaudi::Property<bool>
m_useBunchCrossingData{
this,
"UseBunchCrossingData",
true,
"BunchCrossing data requires CONDBR2 access. Can be disabled here if this is a problem."};
275 Gaudi::Property<bool>
m_doHistograms{
this,
"DoHistograms",
true,
"Switch on histogram output of rate vs. mu and position in train."};
276 Gaudi::Property<bool>
m_enableLumiExtrapolation{
this,
"EnableLumiExtrapolation",
true,
"If false then no extrapolation in L, N_bunch or <mu> will be performed.."};
277 Gaudi::Property<uint32_t>
m_vetoStartOfTrain{
this,
"VetoStartOfTrain", 0,
"How many BCID to veto at the start of a bunch train."};
279 Gaudi::Property<std::map<std::string, std::map<std::string, double>>>
m_prescalesJSON{
this,
"PrescalesJSON", {},
"Optional JSON of prescales from the TrigMenuRuleBook to apply."};
298 #endif //> !RATESANALYSIS_RATESANALYSISALG_H
void printStatistics() const
Print some extra statistics on events processed.
const std::string m_expressGroupName
StatusCode populateTriggers()
Register all triggers to emulate.
uint32_t m_runNumber
What is the RunNumber.
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< bool > m_enableLumiExtrapolation
std::unordered_map< std::string, std::string > m_lowerTrigger
Map of triggers lower chain, to tell if a HLT trigger ran or not.
virtual StatusCode ratesExecute()=0
To be implemented by the user.
Structure to hold per-event weights for distribution.
std::unordered_map< std::string, std::unique_ptr< RatesScanTrigger > > m_scanTriggers
All individual rates-scan triggers (L1 or HLT)
virtual ~RatesAnalysisAlg()
StatusCode checkGotTDT()
Internal check that the TDT is fetched.
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.
const std::string m_l2GroupName
TH1D * m_bcidHist
Histogram of the BCIDs distribution of the processing.
ToolHandle< IEnhancedBiasWeighter > m_enhancedBiasRatesTool
virtual StatusCode ratesInitialize()=0
To be implemented by the user.
Gaudi::Property< double > m_expoScalingFactor
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_groups
All regular and CPS groups.
double m_ratesDenominator
How much walltime is seen by the algorithm.
Gaudi::Property< bool > m_doUniqueRates
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_globalGroups
Big (master) groups which do the OR of the whole menu.
double m_targetMu
What pileup level the prediction is targeting.
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.
void setTargetMu(const double mu)
Set the target pileup.
TriggerBehaviour_t
enum to describe if a trigger should activate for values >= or <= than the thresold
@ kEXISTING
The pass/fail decision is taken from the Trigger Decision Tool for an existing trigger.
ExtrapStrat_t
Extrapolation strategy to apply to each emulated trigger.
void setTargetMuBunches(const double mu, const int32_t bunches)
Set the target mu and number of bunches.
Gaudi::Property< std::map< std::string, std::map< std::string, double > > > m_prescalesJSON
void setTargetLumiMu(const double lumi, const double mu)
Set the target instantaneous luminosity and mu.
@ kAUTO
The pass/fail decision is automatically emulated per event based on decoding the trigger name.
double m_weightedEventCounter
Count how many weighted events were processed.
virtual StatusCode initialize()
Get the trigger decision tool and set up global groups.
Forward iterator to traverse the main components of the trigger configuration.
Method_t
Method by which the trigger pass/fail decision is calculated.
StatusCode executeTriggerEmulation()
Internal call to get the pass/fail for all automatically emulated triggers.
void setExponentialMuScalingFactor(const double f)
Set the exponential scaling factor for relevant chains.
@ kLINEAR
Scale trigger linearly with luminosity.
::StatusCode StatusCode
StatusCode definition for legacy code.
TTree * m_metadataTree
Used to write out some metadata needed by post-processing (e.g.
double m_targetBunches
How many bunches the prediction is targeting.
void setTargetLumiBunches(const double lumi, const int32_t bunches)
Set the target instantaneous luminosity and number of bunches.
RatesAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
bool isCPS(const std::string &group) const
String match coherent prescale groups.
Gaudi::Property< bool > m_currentEventIsUnbiased
If the current event was triggered online by RDx or not.
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_uniqueGroups
Groups used to obtain unique rates for chains.
WeightingValuesSummary_t m_weightingValues
Possible weighting & lumi extrapolation values for the current event.
StatusCode addExisting(const std::string &pattern)
Register some existing triggers based on wild-card match, e.g.
@ kMANUAL
The pass/fail decision is evaluated by the user and supplied per event using setTriggerDesicison.
Gaudi::Property< bool > m_doHistograms
virtual StatusCode execute()
In first call - register all triggers.
std::unordered_set< RatesGroup * > m_activeGroups
All groups which are enabled (PS >= 1)
void printTarget() const
Print the target instantaneous luminosity, mu and number of bunches.
bool isRandomSeed(const std::string &me, const std::string &seed) const
String match random L1 items.
constexpr static uint32_t FULL_RING
Number of bunches in a full ring.
std::unordered_set< RatesTrigger * > m_activatedTriggers
Triggers which were changed & hence need to be reset at the event end.
Gaudi::Property< bool > m_doExpressRates
TH1D * m_scalingHist
One-bin histogram to store the normalisation of the sample, for use in later combinations.
void setTargetLumi(const double lumi)
Set the target instantaneous luminosity.
StatusCode executeTrigDecisionToolTriggers()
Internal call to get the pass/fail for all TDT 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 conf...
void writeMetadata()
Write to outpute tree (if any) the metadata needed downstream.
std::unordered_map< std::string, std::unique_ptr< RatesTrigger > > m_triggers
All individual triggers (L1 or HLT)
uint32_t getLevel(const std::string &name) const
String match to a trigger level.
ServiceHandle< TrigConf::ITrigConfigSvc > m_configSvc
void printInputSummary() const
Print the input data instantaneous luminosity, mu and number of bunches.
const std::string m_l1GroupName
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::vector< std::string > > m_l1ItemID
virtual StatusCode ratesFinalize()=0
To be implemented by the user.
std::unordered_map< std::string, const Trig::ChainGroup * > m_existingTriggers
Map of triggers which we ask the TDT ChainGroup for the pass/fail.
Gaudi::Property< uint32_t > m_vetoStartOfTrain
StatusCode addAllExisting()
Register all existing triggers in the AOD into the rates algorithm.
virtual StatusCode finalize()
Print rates.
Gaudi::Property< bool > m_doTriggerGroups
Gaudi::Property< bool > m_useBunchCrossingData
double m_targetLumi
What instantaneous luminosity the prediction is targeting.
uint32_t m_eventCounter
Count how many events processed.
StatusCode setTriggerDesicison(const std::string &name, const bool triggerIsPassed=true, const bool triggerIsActive=true)
Set the pass/fail decision for an item.
Gaudi::Property< bool > m_doGlobalGroups
Gaudi::Property< double > m_inelasticCrossSection
virtual analysis class for performing rates studies on AOD Pure virtual base class for trigger rate s...
std::vector< std::vector< std::string > > m_hltChainIDGroup
bool isZero(double v) const
Helper function for floating point subtraction.
std::unordered_set< RatesTrigger * > m_expressTriggers
Triggers with non-zero express PS, used to print them at the end.