7#include "GaudiKernel/ITHistSvc.h"
12 const double thresholdMin,
const double thresholdMax,
const uint32_t thresholdBins,
14 const double prescale,
15 const std::string& seedName,
const double seedPrescale,
17 RatesTrigger(name, msgSvc, prescale, -1, seedName, seedPrescale, false, extrapolation),
18 m_rateScanHist(
std::make_unique<TH1D>(
"", TString(name +
";Threshold;Rate [Hz]"), thresholdBins, thresholdMin, thresholdMax)),
26 const std::vector<double>& thresholdBinEdged,
28 const double prescale,
29 const std::string& seedName,
const double seedPrescale,
31 RatesTrigger(name, msgSvc, prescale, -1, seedName, seedPrescale, false, extrapolation),
34 if (thresholdBinEdged.size() < 2) {
35 ATH_MSG_ERROR(
"Need more than one entry in thresholdBinEdged to define histogram binning.");
38 size_t nBins = thresholdBinEdged.size() - 1;
39 m_rateScanHist = std::make_unique<TH1D>(
"", TString(name +
";Threshold;Rate [Hz]"), nBins, thresholdBinEdged.data());
63 return StatusCode::SUCCESS;
100 ss << std::setfill(
' ');
107 ss <<
" Threshold <= " << std::setw(11) << std::left << std::as_const(*m_rateScanHistCachedPtr).GetXaxis()->GetXmin();
109 ss <<
" +- " << std::setw(11) << std::left <<
m_rateScanHistCachedPtr->GetBinError(0)/ratesDenominator <<
" Hz" << std::endl;
112 ss <<
" Threshold <= ";
119 ss <<
" Threshold > " << std::setw(11) << std::left << std::as_const(*m_rateScanHistCachedPtr).GetXaxis()->GetXmax();
125 ss <<
" Threshold < " << std::setw(11) << std::left << std::as_const(*m_rateScanHistCachedPtr).GetXaxis()->GetXmin();
127 ss <<
" +- " << std::setw(11) << std::left <<
m_rateScanHistCachedPtr->GetBinError(0)/ratesDenominator <<
" Hz" << std::endl;
130 ss <<
" Threshold >= ";
137 ss <<
" Threshold >= " << std::setw(11) << std::left << std::as_const(*m_rateScanHistCachedPtr).GetXaxis()->GetXmax();
#define ATH_CHECK
Evaluate an expression and check for errors.
ExtrapStrat_t
Extrapolation strategy to apply to each emulated trigger.
const std::string & getExtrapolationFactorString(ExtrapStrat_t strat) const
double getExtrapolationFactor(const WeightingValuesSummary_t &weights, const ExtrapStrat_t strat) const
void setPassedAndExecute(const double t, const WeightingValuesSummary_t &weights)
Set the pass threshold and immediately call execute.
TriggerBehaviour_t
enum to describe if a trigger should activate for values >= or <= than the thresold
@ kTriggerBelowThreshold
Trigger for <= threshold.
@ kTriggerAboveThreshold
Trigger for >= threshold.
TriggerBehaviour_t m_behaviour
If we need to be above or below the threshold to cause the trigger to fire.
RatesScanTrigger(const std::string &name, IMessageSvc *msgSvc, const double thresholdMin, const double thresholdMax, const uint32_t thresholdBins=100, const TriggerBehaviour_t behaviour=kTriggerBelowThreshold, const double prescale=1., const std::string &seedName="", const double seedPrecale=1., const ExtrapStrat_t extrapolation=ExtrapStrat_t::kLINEAR)
Construct new RatesScanTrigger to enumerate the rate for a single L1 or HLT trigger as a function of ...
double m_thresholdPassed
Analogous to m_pass.
const std::string printRate(const double ratesDenominator) const override
Prints the RatesScanTrigger's rate (different output to a regular trigger)
StatusCode giveThresholdHist(const ServiceHandle< ITHistSvc > &svc, const std::string &name)
void passThreshold(const double t, const bool unbiasedEvent=false)
Sets the threshold the event.
void setHistoName(const std::string &newName)
virtual ~RatesScanTrigger()
TH1 * m_rateScanHistCachedPtr
std::unique_ptr< TH1 > m_rateScanHist
Even if we are not exporting it - we still need this histo.
void execute(const WeightingValuesSummary_t &weights) override
Execute trigger rate emulation.
bool m_seedsFromRandom
Does this trigger seed from a random trigger?
const std::string m_seed
My seed, "" if no seed.
const ExtrapStrat_t m_extrapolationStrategy
How this trigger is to scale with luminosity.
const std::string m_name
My name.
RatesTrigger(const std::string &name, IMessageSvc *log, const double prescale=1., const double expressPrescale=-1, const std::string &seedName="", const double seedPrecale=1., const bool doHistograms=true, const ExtrapStrat_t extrapolation=ExtrapStrat_t::kLINEAR)
Construct new RatesTrigger to enumerate the rate for a single L1 or HLT trigger Provide pass/fail inf...
const double m_totalPrescaleWeight
Equal to 1/m_seedPrescale*m_prescale.
const double m_seedPrescale
const double m_prescale
My prescale factor.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Structure to hold per-event weights for distribution.