ATLAS Offline Software
Loading...
Searching...
No Matches
EnhancedBiasWeightCompAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIG_ENHANCEDBIASWEIGHTCOMPALG_H
6#define TRIG_ENHANCEDBIASWEIGHTCOMPALG_H
7
15
16#include <vector>
17#include <string>
18
19#include <tbb/concurrent_hash_map.h>
20#include <tbb/concurrent_unordered_map.h>
21#include <tbb/concurrent_vector.h>
22
27
29 public:
30
31 EnhancedBiasWeightCompAlg(const std::string& name, ISvcLocator* svcLoc);
32
33 virtual StatusCode initialize() override;
34 virtual StatusCode start() override;
35 virtual StatusCode execute(const EventContext& context) const override;
36 virtual StatusCode stop() override;
37
38 private:
43
45 public:
47
48 std::string getName() const {return m_id.name();}
50 double getTotalPrescale() const {return m_totalPrescale;}
51 bool getIsRandom() const {return (getName().find("HLT_noalg_L1RD") != std::string::npos);}
52 bool getIsNoPS() const {return (getName().find("noPS") != std::string::npos);}
53 bool getIsDisabled() const {return (m_totalPrescale <= 0);}
54
55 void setTotalPrescale(const double& prescale) {m_totalPrescale = prescale;}
56
57 private:
60
63 };
64
69 struct EBResult {
70 double weight {1.0};
71 uint8_t isUnbiased {};
72 };
73
74 SG::ReadHandleKey<TrigConf::HLTMenu> m_HLTMenuKey{this, "HLTTriggerMenu", "DetectorStore+HLTTriggerMenu", "HLT Menu"};
75 PublicToolHandle<Trig::TrigDecisionTool> m_tdt{this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool", "TrigDecisionTool"};
76 SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_finalDecisionKey{ this, "FinalDecisionKey", "", "Final stage of all decisions" };
77
78 SG::ReadCondHandleKey<TrigConf::HLTPrescalesSet> m_HLTPrescaleSetInputKey {this, "HLTPrescales", "HLTPrescales", "HLT prescales set"};
79 SG::ReadCondHandleKey<TrigConf::L1PrescalesSet> m_L1PrescaleSetInputKey {this, "L1Prescales", "L1Prescales", "L1 prescales set"};
80
81 Gaudi::Property<std::map<std::string, std::vector<std::string>>> m_chainToHLTSeed {this, "ChainToItemMap", {}, "Map for HLT seeded chains" };
82
84 EBResult calculateEBWeight(const std::vector<EBChainInfo>& EBChains) const;
85
87 StatusCode fillTotalPrescaleForChains(const EventContext& context, std::vector<EBChainInfo>& EBChains) const;
88
90 std::vector<EBChainInfo> getPassedEBChains() const;
91
93 bool checkIfTriggeredByRandomChain(const std::vector<EBChainInfo>& EBChain) const;
94
96 std::vector<std::string> parseItems(const std::string& itemStr);
97
99 std::vector<HLT::Identifier> m_EBChainIds;
100
102 std::map<HLT::Identifier, std::vector<std::string>> m_EBChainIdToItem;
103
105 mutable std::string m_outputFilename ATLAS_THREAD_SAFE;
106
108 mutable tbb::concurrent_vector<std::pair<double, bool>> m_ebWeights ATLAS_THREAD_SAFE;
109
111 mutable tbb::concurrent_unordered_map<int, double> m_eventToWeight ATLAS_THREAD_SAFE;
112
113};
114
115#endif //TRIG_ENHANCEDBIASWEIGHTCOMPALG_H
An algorithm that can be simultaneously executed in multiple threads.
double m_totalPrescale
Value of total prescale L1 * HLT.
TrigCompositeUtils::DecisionID getId() const
HLT::Identifier m_id
HLTID of the chain.
SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > m_finalDecisionKey
virtual StatusCode start() override
std::vector< HLT::Identifier > m_EBChainIds
Available EB chains' IDs from HLT Menu.
std::string m_outputFilename ATLAS_THREAD_SAFE
Name of xml output file.
std::map< HLT::Identifier, std::vector< std::string > > m_EBChainIdToItem
L1 items for EB chains from HLT Menu.
Gaudi::Property< std::map< std::string, std::vector< std::string > > > m_chainToHLTSeed
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &context) const override
StatusCode fillTotalPrescaleForChains(const EventContext &context, std::vector< EBChainInfo > &EBChains) const
Retrieve total prescales (L1 * HLT) for chains into map.
EBResult calculateEBWeight(const std::vector< EBChainInfo > &EBChains) const
Calculate EB result based on total prescales of chains.
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
SG::ReadCondHandleKey< TrigConf::L1PrescalesSet > m_L1PrescaleSetInputKey
PublicToolHandle< Trig::TrigDecisionTool > m_tdt
std::vector< std::string > parseItems(const std::string &itemStr)
Parse list of l1 items.
virtual StatusCode stop() override
EnhancedBiasWeightCompAlg(const std::string &name, ISvcLocator *svcLoc)
std::vector< EBChainInfo > getPassedEBChains() const
Get list of Enhanced Bias chains that cound have passed.
bool checkIfTriggeredByRandomChain(const std::vector< EBChainInfo > &EBChain) const
Check if any of random chains passed.
SG::ReadCondHandleKey< TrigConf::HLTPrescalesSet > m_HLTPrescaleSetInputKey
Property holding a SG store/key/clid from which a ReadHandle is made.
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
unsigned int DecisionID
Store result of EB weight calculation.