ATLAS Offline Software
RatesGroup.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef RATESANALYSIS_RATESTGROUP_H
6 #define RATESANALYSIS_RATESTGROUP_H 1
7 
8 #include "RatesTrigger.h"
9 
14 class RatesCPS {
15  public:
17  void setCoherentFactor(const double coherentFactor) { m_coherentFactor = coherentFactor; }
18  void execute(const double prescale);
19  double getWeight() const;
20 
21  private:
22  double m_weight;
24 };
25 
29 class RatesGroup : public RatesHistoBase {
30  public:
31 
40  RatesGroup(const std::string& name, IMessageSvc* msgSvc, const bool doHistograms = true, const bool doExtrapolation = true);
41 
42  virtual ~RatesGroup();
43 
44  RatesGroup(const RatesGroup&) = delete;
45 
46  RatesGroup& operator=(const RatesGroup&) = delete;
47 
53  void addToGroup(const RatesTrigger* toAdd);
54 
61 
68  void removeOtherL1(const RatesTrigger* toKeep);
69 
80  void execute(const WeightingValuesSummary_t& weights);
81 
82  void setExpressGroup(const bool i);
83  void setDoCachedWeights(const bool i);
84  void setUseCachedWeights(const bool i);
85  void duplicateChildren(const RatesGroup* toDuplicate);
86  double getCachedWeight(const size_t l1Hash) const;
89 
96  double getUniqueWeight(const double ratesDenominator) const;
97 
98  const std::unordered_map<size_t, std::set<const RatesTrigger*>>& getChildren() const; //<! Return all triggers in the group, ordered by common L1
99 
100  const std::string printConfig() const;
101 
106  const std::string printRate(const double ratesDenominator) const;
107 
108  private:
109 
110  const std::string m_name;
111  const size_t m_nameHash;
112  public: //TODO remove this
117 
119  std::unordered_map<size_t, double> m_cachedWeights;
124 
126 
127  std::unordered_map<size_t, std::set<const RatesTrigger*>> m_children; // Sets of triggers in this group, separated by their L1 seeds
128 };
129 
130 #endif //> !RATESANALYSIS_RATESGROUP_H
131 
RatesGroup::RatesGroup
RatesGroup(const RatesGroup &)=delete
RatesGroup::getUniqueWeight
double getUniqueWeight(const double ratesDenominator) const
Get the unique rate of a unique-rate group For a group being used to get a unique rate,...
Definition: RatesGroup.cxx:178
RatesGroup::removeFromGroup
void removeFromGroup(const RatesTrigger *toRemove)
Remove a trigger from this group.
Definition: RatesGroup.cxx:67
RatesGroup::m_uniqueTrigger
RatesTrigger * m_uniqueTrigger
If not nullptr, then a trigger this group is calculating the unique rate for.
Definition: RatesGroup.h:123
WeightingValuesSummary_t
Structure to hold per-event weights for distribution.
Definition: RatesHistoBase.h:55
RatesTrigger.h
RatesGroup::m_isExpressGroup
bool m_isExpressGroup
If this group is calculating for the express stream - also include express prescales.
Definition: RatesGroup.h:125
RatesGroup::m_name
const std::string m_name
Name of the group.
Definition: RatesGroup.h:110
RatesGroup::setUseCachedWeights
void setUseCachedWeights(const bool i)
Set to use cached weights from the Master group (need ptr to m_masterGroup)
Definition: RatesGroup.cxx:188
RatesGroup::RatesGroup
RatesGroup(const std::string &name, IMessageSvc *msgSvc, const bool doHistograms=true, const bool doExtrapolation=true)
Construct new RatesGroup to enumerate the combined union (OR) and intersection (AND) rate of a set of...
Definition: RatesGroup.cxx:16
RatesGroup::m_rateAccumulatorAND2
double m_rateAccumulatorAND2
For stat error.
Definition: RatesGroup.h:116
RatesGroup::m_extrapolationStrategy
const ExtrapStrat_t m_extrapolationStrategy
How this group is to scale with luminosity.
Definition: RatesGroup.h:121
RatesGroup::setExpressGroup
void setExpressGroup(const bool i)
Flag this group as the express group (modifies group trigger's prescales)
Definition: RatesGroup.cxx:184
RatesGroup::getCachedWeight
double getCachedWeight(const size_t l1Hash) const
Get cached weight from triggers seeding from a given L1 item.
Definition: RatesGroup.cxx:194
RatesGroup::m_nameHash
const size_t m_nameHash
Hash of the group's name.
Definition: RatesGroup.h:111
ExtrapStrat_t
ExtrapStrat_t
Extrapolation strategy to apply to each emulated trigger.
Definition: RatesHistoBase.h:30
RatesGroup::operator=
RatesGroup & operator=(const RatesGroup &)=delete
RatesGroup::m_masterGroup
const RatesGroup * m_masterGroup
If not nullptr, then use the cached weights info in this master group object.
Definition: RatesGroup.h:122
RatesGroup::m_children
std::unordered_map< size_t, std::set< const RatesTrigger * > > m_children
Definition: RatesGroup.h:127
RatesTrigger
Used to calculate the rate for a single trigger at L1 or the HLT.
Definition: RatesTrigger.h:15
RatesGroup
Used to calculate the rate for a group of RatesTrigger objects at L1 or the HLT.
Definition: RatesGroup.h:29
RatesCPS::setCoherentFactor
void setCoherentFactor(const double coherentFactor)
Set a common prescale factor for this group.
Definition: RatesGroup.h:17
python.UpdateManyBadChannelIOVs.toRemove
tuple toRemove
Definition: UpdateManyBadChannelIOVs.py:87
RatesCPS::m_coherentFactor
double m_coherentFactor
Definition: RatesGroup.h:23
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
RatesGroup::printRate
const std::string printRate(const double ratesDenominator) const
Prints the RatesGroup's rate.
Definition: RatesGroup.cxx:48
RatesGroup::setDoCachedWeights
void setDoCachedWeights(const bool i)
Flag group to cache weights.
Definition: RatesGroup.cxx:186
RatesGroup::printConfig
const std::string printConfig() const
Prints the RatesGroup's configuration.
Definition: RatesGroup.cxx:36
RatesGroup::removeOtherL1
void removeOtherL1(const RatesTrigger *toKeep)
Remove from the groups mapping all triggers which have a dissimilar seed to the supplied trigger.
Definition: RatesGroup.cxx:72
RatesGroup::m_doCachedWeights
bool m_doCachedWeights
Used in the global rates group.
Definition: RatesGroup.h:118
DeMoUpdate.toAdd
bool toAdd
Definition: DeMoUpdate.py:1304
RatesGroup::m_rateAccumulatorOR2
double m_rateAccumulatorOR2
For stat error.
Definition: RatesGroup.h:115
RatesHistoBase
Basic base class for any common functionality between RatesTrigger and RatesGroup This means that eve...
Definition: RatesHistoBase.h:84
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
RatesCPS::execute
void execute(const double prescale)
Keep track of a union product (OR of many chains) excluding the coherent part.
Definition: RatesGroup.cxx:8
RatesGroup::execute
void execute(const WeightingValuesSummary_t &weights)
Perform group rates evaluation.
Definition: RatesGroup.cxx:82
RatesGroup::setUniqueTrigger
void setUniqueTrigger(RatesTrigger *trigger)
Set trigger I am doing unique rates for.
Definition: RatesGroup.cxx:196
RatesGroup::~RatesGroup
virtual ~RatesGroup()
Definition: RatesGroup.cxx:34
RatesHistoBase::doHistograms
bool doHistograms() const
If histogramming was enabled in this rates object.
Definition: RatesHistoBase.h:99
RatesGroup::getChildren
const std::unordered_map< size_t, std::set< const RatesTrigger * > > & getChildren() const
Definition: RatesGroup.cxx:200
RatesCPS::RatesCPS
RatesCPS()
Definition: RatesGroup.h:16
RatesCPS::m_weight
double m_weight
Definition: RatesGroup.h:22
RatesGroup::addToGroup
void addToGroup(const RatesTrigger *toAdd)
Add a trigger to this group.
Definition: RatesGroup.cxx:59
RatesGroup::m_rateAccumulatorOR
double m_rateAccumulatorOR
Numerator for the rate of the OR of all triggers.
Definition: RatesGroup.h:113
RatesGroup::m_rateAccumulatorAND
double m_rateAccumulatorAND
Numerator for the rate of the AND of all triggers.
Definition: RatesGroup.h:114
RatesGroup::getUniqueTrigger
RatesTrigger * getUniqueTrigger()
Get the trigger I am doing unique rates for.
Definition: RatesGroup.cxx:198
RatesGroup::m_cachedWeights
std::unordered_map< size_t, double > m_cachedWeights
Cached weight of the OR of all triggers except for the L1 seed-hash of the key here.
Definition: RatesGroup.h:119
RatesCPS::getWeight
double getWeight() const
Return the union product (OR of many chains) coherently weighted by the coherent factor.
Definition: RatesGroup.cxx:12
RatesCPS
Helper class to keep track of coherent prescales between chains in a group This class knows about its...
Definition: RatesGroup.h:14
RatesGroup::m_useCachedWeights
bool m_useCachedWeights
Efficiency.
Definition: RatesGroup.h:120
PhysDESDM_Quirks.trigger
trigger
Definition: PhysDESDM_Quirks.py:27
RatesGroup::duplicateChildren
void duplicateChildren(const RatesGroup *toDuplicate)
Copy in triggers from another group.
Definition: RatesGroup.cxx:190