16#include "GaudiKernel/ITHistSvc.h"
41 const double thresholdMin,
42 const double thresholdMax,
43 const uint32_t thresholdBins,
45 const double prescale,
46 const std::string& seedName,
47 const double seedPrecale,
52 ATH_MSG_ERROR(
"Sorry - ScanTriggers have to be implemented with the kMANUAL method for now.");
53 return StatusCode::FAILURE;
57 m_scanTriggers.emplace(name, std::make_unique<RatesScanTrigger>(name, msgSvc(), thresholdMin, thresholdMax, thresholdBins, behaviour, prescale, seedName, seedPrecale, e));
61 return StatusCode::SUCCESS;
66 const std::vector<double>& thresholdBinEdges,
68 const double prescale,
69 const std::string& seedName,
70 const double seedPrecale,
75 ATH_MSG_ERROR(
"Sorry - ScanTriggers have to be implemented with the kMANUAL method for now.");
76 return StatusCode::FAILURE;
81 m_scanTriggers.emplace(name, std::make_unique<RatesScanTrigger>(name, msgSvc(), thresholdBinEdges, behaviour, prescale, seedName, seedPrecale, e));
85 return StatusCode::SUCCESS;
90 const double prescale,
91 const double expressPrescale,
92 const std::string& seedName,
93 const double seedPrecale,
94 const std::string& groups,
98 std::set<std::string> groupSet;
99 std::istringstream
ss(groups);
102 if (!std::getline(
ss, group,
','))
break;
103 groupSet.insert(group);
106 return newTrigger(name, prescale, expressPrescale, seedName, seedPrecale, groupSet, method, extrapolation);
110 const double prescale,
111 const double expressPrescale,
112 const std::string& seedName,
113 const double seedPrecale,
114 const std::set<std::string>& groups,
119 ATH_MSG_FATAL(
"Too late to call newTrigger. All emulated triggers must be registered during ratesInitialize().");
120 return StatusCode::FAILURE;
127 return StatusCode::SUCCESS;
131 m_triggers.emplace(name, std::make_unique<RatesTrigger>(name, msgSvc(), prescale, expressPrescale, seedName, seedPrecale,
m_doHistograms, e));
139 return StatusCode::SUCCESS;
142 if (method ==
kAUTO) {
151 for (
const std::string& group : groups) {
153 if (group.starts_with(
"BW") || group.starts_with(
"PS") || group.starts_with(
"STREAM:express"))
continue;
160 it->second->addToGroup( newTriggerPtr );
163 if (newTriggerPtr->
getCPSID() != 0)
ATH_MSG_WARNING(
"Trigger " << name <<
" can only be in one coherent prescale group.");
164 newTriggerPtr->
setCPS(group);
165 const size_t CPSID = newTriggerPtr->
getCPSID();
174 const uint32_t level =
getLevel(name);
180 if (level == 2 && expressPrescale >= 1) {
186 return StatusCode::SUCCESS;
202 const auto& triggers =
m_tdt->getListOfTriggers(pattern);
203 ATH_MSG_INFO(
"Read " << triggers.size() <<
" triggers from AOD.");
208 for(
auto & p : hltPrescalesSet.
data().get_child(
"prescales") ) {
213 ATH_MSG_WARNING(
"Trigger " << p.first <<
" disabled in supplied AOD file. DISABLING");
219 for(
auto & p : l1PrescalesSet.
prescales() ) {
220 if ((!
m_prescalesJSON.value().count(p.first) && !runWithPrescaleJSON) || p.second.prescale < 0){
223 if (p.second.prescale < 0){
224 ATH_MSG_WARNING(
"Trigger " << p.first <<
" disabled in supplied AOD file. DISABLING");
230 for (
const auto& trigger : triggers) {
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.");
238 const std::string lowerName = (isHLT ? trigConf->lower_chain_name() :
"");
239 std::set<std::string> groups = std::set<std::string>();
243 if (lowerName.find(
",") != std::string::npos) {
244 ATH_MSG_WARNING(
"Can not add " << trigger <<
" due to multiple L1 seeds." );
248 if (lowerName.empty()) {
249 ATH_MSG_WARNING(
"Can not add " << trigger <<
" due to multiple L1 seeds: L1All" );
254 if (trigConf->prescale() < 1.) {
255 ATH_MSG_DEBUG(
"Will not add " << trigger <<
", it was disabled in the reprocessing.");
263 if (chain == hltMenu.
end()){
268 std::vector<std::string> chainGroups = (*chain).groups();
269 std::vector<std::string> chainStreams = (*chain).streams();
271 ATH_MSG_DEBUG(
" chain " << trigger <<
" has " << chainGroups.size() <<
" groups and " << chainStreams.size() <<
" streams");
273 groups.insert(chainGroups.begin(), chainGroups.end());
274 for (
const std::string& stream : chainStreams){
275 groups.insert(
"STREAM:" + stream );
280 double prescale = 1., expressPrescale = -1., lowerPrescale = 1.;
283 ATH_MSG_WARNING(
"Unable to find " << trigger <<
" in supplied JSON. DISABLING." );
291 ATH_MSG_WARNING(
"Unable to find " << trigger <<
"'s seed, " << lowerName <<
", in supplied JSON. DISABLING." );
301 ATH_MSG_DEBUG(
"Registering existing trigger " << trigger <<
" for automatic TDT based rates prediction." );
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.");
311 return StatusCode::SUCCESS;
317 return StatusCode::FAILURE;
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.");
325 return StatusCode::SUCCESS;
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;
336 if (
getLevel(name) == 1)
return StatusCode::SUCCESS;
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;
343 return StatusCode::SUCCESS;
349 if (triggerIsPassed || triggerIsActive) {
352 ATH_MSG_ERROR(
"Cannot find trigger " << name <<
" did you call newTrigger for this in initialize?");
353 return StatusCode::FAILURE;
358 return StatusCode::SUCCESS;
365 ATH_MSG_ERROR(
"Cannot find scan-trigger " << name <<
" did you call newScanTrigger for this in initialize?");
366 return StatusCode::FAILURE;
370 return StatusCode::SUCCESS;
374 return StatusCode::SUCCESS;
396 ATH_MSG_ERROR(
"DoUniqueRates=True requires DoGlobalGroups=True");
397 return StatusCode::FAILURE;
401 return StatusCode::SUCCESS;
406 ATH_MSG_INFO(
"Initializing User's Triggers (note: we are actually now in the event loop)");
422 ATH_MSG_INFO(
"Computing coherent factors for coherent prescale groups.");
425 const size_t CPSID = trigger.second->getCPSID();
426 if (CPSID != 0) trigger.second->setCoherentFactor(
m_lowestPrescale.at(CPSID) );
430 ATH_MSG_INFO(
"Creating extra groups to calculate unique rates.");
434 const uint32_t level =
getLevel(trigger.first);
455 if (trigger.second->getDisabled() ==
false) {
461 ATH_MSG_INFO(
"Retrieving HLT chain's ID and Group from HLT menu.");
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);
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];
499 for (
size_t i = 0; i < l1menu.size(); i++) {
508 for( ; item_itr != item_end; ++item_itr ) {
510 m_l1ItemID.at(c).at(1) = std::to_string((*item_itr).ctpId());
516 if (msgLevel(MSG::DEBUG)) {
518 ATH_MSG_DEBUG(
"################## Configured to estimate rates for the following triggers:");
522 ATH_MSG_DEBUG(
"################## Configured to estimate rates for the following scan triggers:");
526 ATH_MSG_DEBUG(
"################## Configured to estimate rates for the following groups of triggers:");
530 ATH_MSG_DEBUG(
"################## Configured to estimate rates for the following global groups of triggers:");
535 ATH_MSG_DEBUG(
"################## Registering normalisation histogram:");
538 m_bcidHist =
new TH1D(
"bcid",
";BCID;Events",3565,-.5,3564.5);
540 ATH_MSG_DEBUG(
"################## Registering metadata tree histogram:");
541 ATH_CHECK(
histSvc()->regTree(
"/RATESTREAM/metadata", std::make_unique<TTree>(
"metadata",
"metadata")) );
544 ATH_MSG_DEBUG(
"################## Registering trigger histograms:");
546 if (!trigger.second->doHistograms())
continue;
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/";
554 ATH_CHECK( trigger.second->giveDataHist(
histSvc(), std::string(
"/RATESTREAM/All/" + lvlSubdir + trigger.first +
"/data")) );
556 ATH_CHECK( trigger.second->giveMuHist(
histSvc(), std::string(
"/RATESTREAM/All/" + lvlSubdir + trigger.first +
"/rateVsMu")) );
559 ATH_CHECK( trigger.second->giveTrainHist(
histSvc(), std::string(
"/RATESTREAM/All/" + lvlSubdir + trigger.first +
"/rateVsTrain")) );
560 }
else trigger.second->clearTrainHist();
564 ATH_MSG_DEBUG(
"################## Registering scan trigger histograms:");
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(),
':',
'_');
577 ATH_CHECK( group.second->giveDataHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/" + groupName +
"/data")) );
579 ATH_CHECK( group.second->giveMuHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/" + groupName +
"/rateVsMu")) );
582 ATH_CHECK( group.second->giveTrainHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/" + groupName +
"/rateVsTrain")) );
583 }
else group.second->clearTrainHist();
587 ATH_MSG_DEBUG(
"################## Registering global group histograms:");
589 if (!group.second->doHistograms())
continue;
591 ATH_CHECK( group.second->giveDataHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/RATE_GLOBAL_" + group.first +
"/data")) );
593 ATH_CHECK( group.second->giveMuHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/RATE_GLOBAL_" + group.first +
"/rateVsMu")) );
596 ATH_CHECK( group.second->giveTrainHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/RATE_GLOBAL_" + group.first +
"/rateVsTrain")) );
597 }
else group.second->clearTrainHist();
610 return StatusCode::SUCCESS;
617 return StatusCode::SUCCESS;
626 const double pT_j1_truthPU = truthPU_jets->size() ? truthPU_jets->front()->pt() : 0;
627 const double pT_j1_truthHS = truthHS_jets->size() ? truthHS_jets->front()->pt() : 5000;
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;
654 uint32_t distance = 0;
660 m_weightingValues.m_eventMu = std::ceil(eventInfo->actualInteractionsPerCrossing());
674 return StatusCode::SUCCESS;
682 ATH_MSG_DEBUG(
"Additional weight from [" << addWeight->name() <<
"], value = " << wt);
689 double ratesDenominator = 0.0;
706 bool filterPass =
true;
708 if (!filterPass) {
return StatusCode::SUCCESS;}
734 return StatusCode::SUCCESS;
739 const bool passed = trigger.second->isPassed();
743 const std::unordered_map<std::string, const Trig::ChainGroup*>::const_iterator it =
m_existingTriggers.find(lower);
747 return StatusCode::SUCCESS;
753 ATH_MSG_WARNING(
"Cannot do rates for " << trigger <<
". Automatic trigger emulation is not yet included, sorry :(");
755 return StatusCode::SUCCESS;
764 ATH_MSG_INFO(
"################## Computed Rate Scans for Threshold-Scan Items:");
768 ATH_MSG_INFO(
"################## Computed Rate Estimations for Single Items:");
769 std::set<std::string> keys;
770 for (
const auto& trigger :
m_triggers) keys.insert(trigger.first);
774 ATH_MSG_INFO(
"################## Computed Express Rate Estimations for Single Items:");
778 ATH_MSG_INFO(
"################## Computed Rate Estimations for Groups:");
782 ATH_MSG_INFO(
"################## Computed Rate Estimations for Global Groups:");
786 ATH_MSG_INFO(
"################## LHC Conditions and weighting information:");
793 return StatusCode::SUCCESS;
798 ATH_MSG_WARNING(
"Too late to call setTargetLumiMu. Do this during ratesInitialize().");
818 ATH_MSG_WARNING(
"Too late to call setTargetLumiBunches. Do this during ratesInitialize().");
835 ATH_MSG_WARNING(
"Too late to call setTargetMuBunches. Do this during ratesInitialize().");
858 ATH_MSG_INFO(
"Luminosity extrapolation is switched off. Input files will determin the paired bunches, L_inst. and mu profile.");
868 <<
" with <L_inst.> = "
870 <<
" cm-2s-1, <mu> = "
872 <<
", paired bunches = "
877 return (group.find(
"CPS") != std::string::npos);
881 if (me.find(
"L1_RD") != std::string::npos)
return true;
882 if (me.find(
"L1RD") != std::string::npos)
return true;
883 if (seed.find(
"L1_RD") != std::string::npos)
return true;
888 if (name.find(
"HLT_") != std::string::npos)
return 2;
889 if (name.find(
"L1_") != std::string::npos)
return 1;
908 std::vector<std::string> triggers;
909 std::vector<std::string> lowers;
910 std::vector<double> prescales;
911 std::vector<double> express;
917 triggers.push_back(trigger.first);
918 lowers.push_back(trigger.second->getSeedName());
919 prescales.push_back(trigger.second->getPrescale() );
920 express.push_back(trigger.second->getPrescale(
true ) );
922 for (
const auto& group :
m_groups) {
923 triggers.push_back(group.first);
924 lowers.push_back(
"-");
925 prescales.push_back(-1);
926 express.push_back(-1);
929 triggers.push_back(
"RATE_GLOBAL_" + group.first);
930 lowers.push_back(
"-");
931 prescales.push_back(-1);
932 express.push_back(-1);
938 std::vector<int32_t> bunchGroups;
939 bunchGroups.reserve(16);
941 uint32_t masterKey = 0;
942 uint32_t hltPrescaleKey = 0;
943 uint32_t lvl1PrescaleKey = 0;
956 if ((bunchGroups.size() == 0 || std::all_of(bunchGroups.begin(), bunchGroups.end(), [](
int i) { return i==0; }) ) && (!
m_enhancedBiasRatesTool->isMC())) {
978 std::string atlasProject = std::getenv(
"AtlasProject");
979 std::string atlasVersion = std::getenv(
"AtlasVersion");
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
ExtrapStrat_t
Extrapolation strategy to apply to each emulated trigger.
@ kNONE
Do not scale this trigger for changes in luminosity.
void setFilterPassed(bool state) const
AthAnalysisAlgorithm(const std::string &name)
Constructor taking just a name.
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
static constexpr uint32_t FULL_RING
Number of bunches in a full ring.
static constexpr double LHC_FREQUENCY
TH1D * m_bcidHist
Histogram of the BCIDs distribution of the processing.
Method_t
Method by which the trigger pass/fail decision is calculated.
@ 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.
StatusCode executeTrigDecisionToolTriggers()
Internal call to get the pass/fail for all TDT triggers.
void setTargetLumiBunches(const double lumi, const int32_t bunches)
Set the target instantaneous luminosity and number of bunches.
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_uniqueGroups
Groups used to obtain unique rates for chains.
const std::string m_l2GroupName
double m_targetBunches
How many bunches the prediction is targeting.
RatesAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
void printInputSummary() const
Print the input data instantaneous luminosity, mu and number of bunches.
virtual StatusCode ratesInitialize()=0
To be implemented by the user.
uint32_t m_runNumber
What is the RunNumber.
std::unordered_set< RatesTrigger * > m_activatedTriggers
Triggers which were changed & hence need to be reset at the event end.
ServiceHandle< TrigConf::ITrigConfigSvc > m_configSvc
void printStatistics() const
Print some extra statistics on events processed.
SG::ReadHandleKey< xAOD::JetContainer > m_truthHS_jets_RHKey
Gaudi::Property< bool > m_doHistograms
Gaudi::Property< bool > m_doUniqueRates
uint32_t getLevel(const std::string &name) const
String match to a trigger level.
Gaudi::Property< double > m_expoScalingFactor
uint32_t m_metadataHLTPSK
<smk read patched
SG::ReadHandleKey< xAOD::JetContainer > m_truthPU_jets_RHKey
StatusCode setTriggerDesicison(const std::string &name, const bool triggerIsPassed=true, const bool triggerIsActive=true)
Set the pass/fail decision for an item.
std::unordered_set< RatesTrigger * > m_expressTriggers
Triggers with non-zero express PS, used to print them at the end.
double m_ratesDenominator
How much walltime is seen by the algorithm.
double m_targetLumi
What instantaneous luminosity the prediction is targeting.
virtual StatusCode finalize()
Print rates.
Gaudi::Property< bool > m_doMultiSliceDiJet
double m_weightedEventCounter
Count how many weighted events were processed.
Gaudi::Property< bool > m_doExpressRates
ToolHandleArray< IAdditionalWeight > m_additionalWeights
std::unordered_map< size_t, double > m_lowestPrescale
Lowest prescale within a CPS group, key is the hash of the CPS group name.
TTree * m_metadataTree
Used to write out some metadata needed by post-processing (e.g.
uint32_t m_metadataMasterKey
void setTargetLumiMu(const double lumi, const double mu)
Set the target instantaneous luminosity and mu.
bool isRandomSeed(const std::string &me, const std::string &seed) const
String match random L1 items.
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_globalGroups
Big (master) groups which do the OR of the whole menu.
std::vector< std::vector< std::string > > m_hltChainIDGroup
std::unordered_map< std::string, std::unique_ptr< RatesGroup > > m_groups
All regular and CPS groups.
std::unordered_map< std::string, const Trig::ChainGroup * > m_existingTriggers
Map of triggers which we ask the TDT ChainGroup for the pass/fail.
virtual StatusCode ratesFinalize()=0
To be implemented by the user.
Gaudi::Property< bool > m_useBunchCrossingData
Gaudi::Property< std::string > m_histogramSuffix
const std::unordered_map< std::string, std::unique_ptr< RatesTrigger > > & getTriggerMap() const
virtual StatusCode execute(const EventContext &ctx)
In first call - register all triggers.
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.
const std::string m_expressGroupName
WeightingValuesSummary_t m_weightingValues
Possible weighting & lumi extrapolation values for the current event.
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 setTargetMuBunches(const double mu, const int32_t bunches)
Set the target mu and number of bunches.
StatusCode checkGotTDT()
Internal check that the TDT is fetched.
virtual StatusCode ratesExecute()=0
To be implemented by the user.
Gaudi::Property< bool > m_doTriggerGroups
virtual StatusCode initialize()
Get the trigger decision tool and set up global groups.
virtual StatusCode initialize_extra_content()
Initialization of additional payload for inherited classes.
std::vector< std::vector< std::string > > m_l1ItemID
std::unordered_map< std::string, std::string > m_lowerTrigger
Map of triggers lower chain, to tell if a HLT trigger ran or not.
std::unordered_set< RatesGroup * > m_activeGroups
All groups which are enabled (PS >= 1).
bool isCPS(const std::string &group) const
String match coherent prescale groups.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
void setTargetLumi(const double lumi)
Set the target instantaneous luminosity.
Gaudi::Property< uint32_t > m_vetoStartOfTrain
ToolHandle< Trig::TrigDecisionTool > m_tdt
Gaudi::Property< double > m_inelasticCrossSection
StatusCode addExisting(const std::string &pattern)
Register some existing triggers based on wild-card match, e.g.
std::unordered_map< std::string, std::unique_ptr< RatesTrigger > > m_triggers
All individual triggers (L1 or HLT).
bool isZero(double v) const
Helper function for floating point subtraction.
bool m_metadataKeysCached
< l1psk read patched
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.
double m_targetMu
What pileup level the prediction is targeting.
StatusCode addAllExisting()
Register all existing triggers in the AOD into the rates algorithm.
void writeMetadata()
Write to outpute tree (if any) the metadata needed downstream.
double m_linearLumiFactor
const std::string m_l1GroupName
TH1D * m_scalingHist
< patched key read
void printTarget() const
Print the target instantaneous luminosity, mu and number of bunches.
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.
ToolHandle< IEnhancedBiasWeighter > m_enhancedBiasRatesTool
Gaudi::Property< bool > m_enableLumiExtrapolation
uint32_t m_eventCounter
Count how many events processed.
Gaudi::Property< bool > m_doGlobalGroups
Gaudi::Property< std::map< std::string, std::map< std::string, double > > > m_prescalesJSON
virtual ~RatesAnalysisAlg()
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 executeTriggerEmulation()
Internal call to get the pass/fail for all automatically emulated triggers.
std::unordered_map< std::string, std::unique_ptr< RatesScanTrigger > > m_scanTriggers
All individual rates-scan triggers (L1 or HLT).
Used to calculate the rate for a group of RatesTrigger objects at L1 or the HLT.
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.
static bool isZero(double v)
Used to calculate a rate scan as a function of some threshold value.
TriggerBehaviour_t
enum to describe if a trigger should activate for values >= or <= than the thresold
Used to calculate the rate for a single trigger at L1 or the HLT.
void setUniqueGroup(const RatesGroup *unique)
If I have a group which is calculating my unique rate.
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.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
const ptree & data() const
Access to the underlying data, if needed.
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.
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.
const std::map< std::string, L1Prescale > & prescales() const