ATLAS Offline Software
Loading...
Searching...
No Matches
HLTPrescalesSet.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9
10TrigConf::HLTPrescalesSet::HLTPrescalesSet(const boost::property_tree::ptree & data)
12{
13 load();
14}
15
16void
18{
19 m_name = getAttribute("name");
20 const auto & prescales = data().get_child("prescales");
21 for( auto & p : prescales ) {
22
23 double prescaleValue = p.second.get_child("prescale").get_value<double>();
24 HLTPrescale ps;
25 ps.prescale = prescaleValue < 0 ? -prescaleValue : prescaleValue;
26 ps.enabled = (prescaleValue > 0);
27 boost::optional<bool> enabledField = p.second.get_optional<bool>("enabled");
28 if( enabledField ) {
29 ps.enabled = *enabledField;
30 }
31
32 // store in map by name
33 m_prescales[p.first] = ps;
34
35 // store in map by hash
36 uint32_t namehash = p.second.get_child("hash").get_value<uint32_t>();
37 m_prescalesByHash[namehash] = ps;
38
39 // repeat for express stream prescale
40 HLTPrescale ps_express;
41 // checks if contains express prescale in chain from prescale file/DB entry
42 // does not check against menu definition, check to be done when used elsewhere
43 if(p.second.get_optional<double>("prescale_express")){
44 double prescaleValue_express = p.second.get_child("prescale_express").get_value<double>();
45 ps_express.prescale = prescaleValue_express < 0 ? -prescaleValue_express : prescaleValue_express;
46 ps_express.enabled = (prescaleValue_express > 0);
47 boost::optional<bool> enabledField_express = p.second.get_optional<bool>("enabled_express");
48 if( enabledField_express ) {
49 ps_express.enabled = *enabledField_express;
50 }
51 // store in map by name
52 m_prescales_express[p.first] = ps_express;
53
54 // store in maps by hash
55 m_prescalesByHash_express[namehash] = ps_express;
56 }
57 }
58}
59
60void
62{
63 m_psk = 0;
64 m_prescales.clear();
65 m_prescalesByHash.clear();
66}
67
68std::size_t
70{
71 return m_prescales.size();
72}
73
74unsigned int
76 return m_psk;
77}
78
79void
83
85TrigConf::HLTPrescalesSet::prescale(const std::string & chainName) const {
86 return m_prescales.at(chainName);
87}
88
90TrigConf::HLTPrescalesSet::prescale(uint32_t chainHash) const {
91 return m_prescalesByHash.at(chainHash);
92}
93
94
96TrigConf::HLTPrescalesSet::prescale_express(const std::string & chainName) const {
97 auto search = m_prescales_express.find(chainName);
98 if (search != m_prescales_express.end()) {
99 return search->second;
100 } else {
101 return m_notInExpress;
102 }
103}
104
107 auto search = m_prescalesByHash_express.find(chainHash);
108 if (search != m_prescalesByHash_express.end()) {
109 return search->second;
110 } else {
111 return m_notInExpress;
112 }
113}
114
115void
117{
118 std::cout << "Name '" << name() << "'" << std::endl;
119 std::cout << "Prescales: " << size() << std::endl;
120 if(full) {
121 int c(0);
122 for( auto & ps : m_prescales ) {
123 std::cout << " " << c++ << ": " << ps.first << " -> " << ps.second.prescale << (ps.second.enabled ? "" : " (disabled)" ) << std::endl;
124 }
125 }
126}
127
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
virtual const std::string & name() const final
const ptree & data() const
Access to the underlying data, if needed.
DataStructure()
Default constructor, leading to an uninitialized configuration object.
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
std::size_t size() const
number of HLT prescales
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.
std::unordered_map< std::string, HLTPrescale > m_prescales_express
void setPSK(unsigned int psk)
std::unordered_map< uint32_t, HLTPrescale > m_prescalesByHash
std::unordered_map< std::string, HLTPrescale > m_prescales
unsigned int m_psk
the prescale key
unsigned int psk() const
setter and getter for the HLT prescale key
void printPrescaleSet(bool full) const
virtual void clear() override
Clearing the configuration data.
std::unordered_map< uint32_t, HLTPrescale > m_prescalesByHash_express
void search(TDirectory *td, const std::string &s, std::string cwd, node *n)
recursive directory search for TH1 and TH2 and TProfiles
Definition hcg.cxx:739