9 const std::string& seedName,
const double seedPrescale,
const bool doHistograms,
27 m_seedHash(std::hash<std::string>{}(
seedName)),
28 m_prescale(prescale < 1. ? -1 : prescale),
29 m_expressPrescale(expressPrescale < 1. ? -1 : expressPrescale),
30 m_seedPrescale(seedPrescale < 1. ? -1 : seedPrescale),
31 m_totalPrescaleWeight(1. / (m_prescale * m_seedPrescale)),
32 m_totalPrescaleWeightExpress(1. / (m_prescale * m_seedPrescale * m_expressPrescale)),
33 m_extrapolationStrategy(extrapolation)
40 if (
m_active && !
m_pass)
throw std::runtime_error(
"Cannot pass if not active");
48 if (
m_active && !
m_pass)
throw std::runtime_error(
"Cannot pass if not active");
105 std::stringstream
ss;
106 ss << std::setfill(
' ')
107 <<
"Prescale:" << std::setw(11) << std::left <<
m_prescale
109 <<
" CPSID:" << std::setw(11) << std::left <<
m_CPSID
116 std::stringstream
ss;
117 ss << std::setfill(
' ');
119 <<
" +- " << std::setw(11) << std::left << sqrt(
m_rateAccumulator2)/ratesDenominator <<
" Hz";
125 ss <<
", Unique Rate: " << std::setw(11) << std::right << unique
126 <<
" +- " << std::setw(11) << std::left << uniqueErr <<
" Hz";
136 std::stringstream
ss;
137 ss << std::setfill(
' ');
@ kPASS_RAW_BIN
Bin used to store the raw total events in which the trigger passed.
@ kEXPRESS_BIN
Bin used to store the express rate.
@ kPASS_WEIGHTED_OR_BIN
Bin used to store the total rate (OR)
@ kACTIVE_RAW_BIN
Bin used to store the raw total events in which the trigger was active.
@ kACTIVE_WEIGHTED_BIN
Bin used to store the weighted events in which the trigger was active.
ExtrapStrat_t
Extrapolation strategy to apply to each emulated trigger.
Used to calculate the rate for a group of RatesTrigger objects at L1 or the HLT.
const std::string & getExtrapolationFactorString(ExtrapStrat_t strat) const
double getExtrapolationFactor(const WeightingValuesSummary_t &weights, const ExtrapStrat_t strat) const
bool doHistograms() const
If histogramming was enabled in this rates object.
TH1 * m_rateVsTrainCachedPtr
Cached, non-owning pointer.
RatesHistoBase(const std::string &name, IMessageSvc *msgSvc, const bool doHistograms=true)
TH1 * m_rateVsMuCachedPtr
Cached, non-owning pointer.
static bool isNotPositive(double v)
static bool isZero(double v)
TH1 * m_dataCachedPtr
Cached, non-owning pointer.
bool m_seedsFromRandom
Does this trigger seed from a random trigger?
const std::string & getSeedName() const
Get the name of the seed of this trigger.
bool m_active
Was the trigger active?
void setUniqueGroup(const RatesGroup *unique)
If I have a group which is calculating my unique rate.
bool getPassed() const
If the trigger passed in the event.
const double m_expressPrescale
My express stream prescale factor, gets applied on top of the regular prescale.
const std::string m_seed
My seed, "" if no seed.
double m_rateAccumulator
Weighted events passed.
size_t m_CPSID
If I'm in a coherent prescale group, my group's ID (hash of the group name)
bool getActive() const
If the trigger passed in the event.
const ExtrapStrat_t m_extrapolationStrategy
How this trigger is to scale with luminosity.
void setPassed(const bool passed=true, const bool active=true, const bool unbiasedEvent=false)
Set the pass/fail bool.
const std::string m_name
My name.
double getCoherentFactor() const
Get the lowest common prescale factor of all triggers in my CPS group.
const std::string printConfig() const
Prints the RatesTrigger's configuration.
double getSeedPrescale() const
Get the prescale of the seed of this trigger.
void setSeedsFromRandom(const bool i)
Set if this trigger is to behave as if it seeds from a random L1 item.
const RatesGroup * m_uniqueGroup
Pointer to the group which is calculating my unique rate.
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)
size_t getHash() const
Get the hash of the name of this trigger.
size_t getSeedHash() const
double m_rateExpressAccumulator2
Weighted express stream events squared.
const size_t m_nameHash
Hash of my name.
virtual const std::string printRate(const double ratesDenominator) const
Prints the RatesTrigger's rate.
void setCoherentFactor(const double lowestCommonPrescale)
If i'm in a CPS group, set the lowest commons PS factor of the group.
bool getDisabled() const
If I or my seed were prescaled out.
const std::string printExpressRate(const double ratesDenominator) const
Prints the RatesTrigger's express rate.
const double m_totalPrescaleWeightExpress
Equal to 1/m_seedPrescale*m_prescale*m_expressPrescale.
virtual void reset()
If I was used in an event, reset me.
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...
double m_coherentFactor
If I'm in a coherent prescale group, the prescale of the lowest non-disabled chain in the group.
const double m_totalPrescaleWeight
Equal to 1/m_seedPrescale*m_prescale.
virtual void execute(const WeightingValuesSummary_t &weights)
Execute trigger rate emulation.
double getPrescale(const bool includeExpress=false) const
Gets the triggers prescale.
bool m_pass
Did the trigger pass or not?
void setPassedAndExecute(const bool passed, const bool active, const WeightingValuesSummary_t &weights)
Set the pass/fail bool and immediately call execute.
double m_rateExpressAccumulator
Weighted express stream events.
double m_rateAccumulator2
Weighted events passed squared.
const double m_seedPrescale
const size_t m_seedHash
Has of my seed name.
size_t getCPSID() const
Get the hash of my CPS group name.
const double m_prescale
My prescale factor.
double getTotalPrescaleWeight() const
const std::string & getName() const
Get the name of this trigger.
Structure to hold per-event weights for distribution.