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;
395 ATH_MSG_ERROR(
"DoUniqueRates=True requires DoGlobalGroups=True");
396 return StatusCode::FAILURE;
400 return StatusCode::SUCCESS;
405 ATH_MSG_INFO(
"Initializing User's Triggers (note: we are actually now in the event loop)");
421 ATH_MSG_INFO(
"Computing coherent factors for coherent prescale groups.");
424 const size_t CPSID = trigger.second->getCPSID();
425 if (CPSID != 0) trigger.second->setCoherentFactor(
m_lowestPrescale.at(CPSID) );
429 ATH_MSG_INFO(
"Creating extra groups to calculate unique rates.");
433 const uint32_t level =
getLevel(trigger.first);
454 if (trigger.second->getDisabled() ==
false) {
460 ATH_MSG_INFO(
"Retrieving HLT chain's ID and Group from HLT menu.");
472 for( ; chain_itr != chain_end; ++chain_itr ) {
473 std::string chainName = ( *chain_itr ).name() ;
474 unsigned int chainID = ( *chain_itr ).counter();
475 std::vector<std::string> chainGroups = ( *chain_itr ).groups();
476 for (std::string& stream : (*chain_itr).streams()){
477 chainGroups.push_back(
"STREAM:" + stream);
479 std::string singlechainGroups =
"";
480 for (
unsigned int j=0; j < chainGroups.size(); ++j){
481 if (j==0) singlechainGroups += chainGroups[j];
482 else singlechainGroups +=
", "+chainGroups[j];
498 for (
size_t i = 0; i < l1menu.size(); i++) {
507 for( ; item_itr != item_end; ++item_itr ) {
509 m_l1ItemID.at(c).at(1) = std::to_string((*item_itr).ctpId());
515 if (msgLevel(MSG::DEBUG)) {
517 ATH_MSG_DEBUG(
"################## Configured to estimate rates for the following triggers:");
521 ATH_MSG_DEBUG(
"################## Configured to estimate rates for the following scan triggers:");
525 ATH_MSG_DEBUG(
"################## Configured to estimate rates for the following groups of triggers:");
529 ATH_MSG_DEBUG(
"################## Configured to estimate rates for the following global groups of triggers:");
534 ATH_MSG_DEBUG(
"################## Registering normalisation histogram:");
537 m_bcidHist =
new TH1D(
"bcid",
";BCID;Events",3565,-.5,3564.5);
539 ATH_MSG_DEBUG(
"################## Registering metadata tree histogram:");
540 ATH_CHECK(
histSvc()->regTree(
"/RATESTREAM/metadata", std::make_unique<TTree>(
"metadata",
"metadata")) );
543 ATH_MSG_DEBUG(
"################## Registering trigger histograms:");
545 if (!trigger.second->doHistograms())
continue;
546 std::string lvlSubdir =
"";
547 if (trigger.second->getName().find(
"L1") == 0){
548 lvlSubdir =
"Rate_ChainL1_HLT/";
549 }
else if (trigger.second->getName().find(
"HLT") == 0) {
550 lvlSubdir =
"Rate_ChainHLT_HLT/";
553 ATH_CHECK( trigger.second->giveDataHist(
histSvc(), std::string(
"/RATESTREAM/All/" + lvlSubdir + trigger.first +
"/data")) );
555 ATH_CHECK( trigger.second->giveMuHist(
histSvc(), std::string(
"/RATESTREAM/All/" + lvlSubdir + trigger.first +
"/rateVsMu")) );
558 ATH_CHECK( trigger.second->giveTrainHist(
histSvc(), std::string(
"/RATESTREAM/All/" + lvlSubdir + trigger.first +
"/rateVsTrain")) );
559 }
else trigger.second->clearTrainHist();
563 ATH_MSG_DEBUG(
"################## Registering scan trigger histograms:");
570 ATH_MSG_DEBUG(
"################## Registering group histograms:");
571 for (
const auto& group :
m_groups) {
572 if (!group.second->doHistograms())
continue;
573 std::string groupName = group.first;
574 std::replace( groupName.begin(), groupName.end(),
':',
'_');
576 ATH_CHECK( group.second->giveDataHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/" + groupName +
"/data")) );
578 ATH_CHECK( group.second->giveMuHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/" + groupName +
"/rateVsMu")) );
581 ATH_CHECK( group.second->giveTrainHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/" + groupName +
"/rateVsTrain")) );
582 }
else group.second->clearTrainHist();
586 ATH_MSG_DEBUG(
"################## Registering global group histograms:");
588 if (!group.second->doHistograms())
continue;
590 ATH_CHECK( group.second->giveDataHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/RATE_GLOBAL_" + group.first +
"/data")) );
592 ATH_CHECK( group.second->giveMuHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/RATE_GLOBAL_" + group.first +
"/rateVsMu")) );
595 ATH_CHECK( group.second->giveTrainHist(
histSvc(), std::string(
"/RATESTREAM/All/Rate_Group_HLT/RATE_GLOBAL_" + group.first +
"/rateVsTrain")) );
596 }
else group.second->clearTrainHist();
609 return StatusCode::SUCCESS;
616 return StatusCode::SUCCESS;
625 const double pT_j1_truthPU = truthPU_jets->size() ? truthPU_jets->front()->pt() : 0;
626 const double pT_j1_truthHS = truthHS_jets->size() ? truthHS_jets->front()->pt() : 5000;
629 pass = pT_j1_truthHS > pT_j1_truthPU;
630 ATH_MSG_DEBUG(
"Hard Scatter (" << pT_j1_truthHS/1000. <<
" GeV) Harder Than Pileup (" << pT_j1_truthPU/1000. <<
" GeV) filter " << (pass ?
"PASSES" :
"FAILS"));
631 return StatusCode::SUCCESS;
639 const EventContext& ctx = Gaudi::Hive::currentContext();
643 uint32_t distance = 0;
649 m_weightingValues.m_eventMu = std::ceil(eventInfo->actualInteractionsPerCrossing());
663 return StatusCode::SUCCESS;
666 const double weightedEvents = (isMC ? eventInfo->mcEventWeight() :
m_weightingValues.m_enhancedBiasWeight);
669 double ratesDenominator = 0.0;
671 ratesDenominator = eventInfo->mcEventWeight();
673 ratesDenominator =
m_weightingValues.m_eventLiveTime * (isMC ? eventInfo->mcEventWeight() : 1.0);
686 bool filterPass =
true;
688 if (!filterPass) {
return StatusCode::SUCCESS;}
713 setFilterPassed(
true);
714 return StatusCode::SUCCESS;
719 const bool passed = trigger.second->isPassed();
723 const std::unordered_map<std::string, const Trig::ChainGroup*>::const_iterator it =
m_existingTriggers.find(lower);
727 return StatusCode::SUCCESS;
733 ATH_MSG_WARNING(
"Cannot do rates for " << trigger <<
". Automatic trigger emulation is not yet included, sorry :(");
735 return StatusCode::SUCCESS;
744 ATH_MSG_INFO(
"################## Computed Rate Scans for Threshold-Scan Items:");
748 ATH_MSG_INFO(
"################## Computed Rate Estimations for Single Items:");
749 std::set<std::string> keys;
750 for (
const auto& trigger :
m_triggers) keys.insert(trigger.first);
754 ATH_MSG_INFO(
"################## Computed Express Rate Estimations for Single Items:");
758 ATH_MSG_INFO(
"################## Computed Rate Estimations for Groups:");
762 ATH_MSG_INFO(
"################## Computed Rate Estimations for Global Groups:");
766 ATH_MSG_INFO(
"################## LHC Conditions and weighting information:");
773 return StatusCode::SUCCESS;
778 ATH_MSG_WARNING(
"Too late to call setTargetLumiMu. Do this during ratesInitialize().");
798 ATH_MSG_WARNING(
"Too late to call setTargetLumiBunches. Do this during ratesInitialize().");
815 ATH_MSG_WARNING(
"Too late to call setTargetMuBunches. Do this during ratesInitialize().");
838 ATH_MSG_INFO(
"Luminosity extrapolation is switched off. Input files will determin the paired bunches, L_inst. and mu profile.");
848 <<
" with <L_inst.> = "
850 <<
" cm-2s-1, <mu> = "
852 <<
", paired bunches = "
857 return (group.find(
"CPS") != std::string::npos);
861 if (me.find(
"L1_RD") != std::string::npos)
return true;
862 if (me.find(
"L1RD") != std::string::npos)
return true;
863 if (seed.find(
"L1_RD") != std::string::npos)
return true;
868 if (name.find(
"HLT_") != std::string::npos)
return 2;
869 if (name.find(
"L1_") != std::string::npos)
return 1;
888 std::vector<std::string> triggers;
889 std::vector<std::string> lowers;
890 std::vector<double> prescales;
891 std::vector<double> express;
897 triggers.push_back(trigger.first);
898 lowers.push_back(trigger.second->getSeedName());
899 prescales.push_back(trigger.second->getPrescale() );
900 express.push_back(trigger.second->getPrescale(
true ) );
902 for (
const auto& group :
m_groups) {
903 triggers.push_back(group.first);
904 lowers.push_back(
"-");
905 prescales.push_back(-1);
906 express.push_back(-1);
909 triggers.push_back(
"RATE_GLOBAL_" + group.first);
910 lowers.push_back(
"-");
911 prescales.push_back(-1);
912 express.push_back(-1);
918 std::vector<int32_t> bunchGroups;
919 bunchGroups.reserve(16);
921 uint32_t masterKey = 0;
922 uint32_t hltPrescaleKey = 0;
923 uint32_t lvl1PrescaleKey = 0;
929 if ((bunchGroups.size() == 0 || std::all_of(bunchGroups.begin(), bunchGroups.end(), [](
int i) { return i==0; }) ) && (!
m_enhancedBiasRatesTool->isMC())) {
949 std::string atlasProject = std::getenv(
"AtlasProject");
950 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.
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
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
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.
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()
In first call - register all triggers.
StatusCode populateTriggers()
Register all triggers to emulate.
StatusCode pass_HstpFilter(bool &pass)
Boolean indicating if the event passes the HS-softer-than-PU (HSTP) filter.
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.
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
One-bin histogram to store the normalisation of the sample, for use in later combinations.
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