ATLAS Offline Software
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 
8 {}
9 
12 {
13  load();
14 }
15 
16 void
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 
60 void
62 {
63  m_psk = 0;
64  m_prescales.clear();
65  m_prescalesByHash.clear();
66 }
67 
68 std::size_t
70 {
71  return m_prescales.size();
72 }
73 
74 unsigned int
76  return m_psk;
77 }
78 
79 void
81  m_psk = psk;
82 }
83 
85 TrigConf::HLTPrescalesSet::prescale(const std::string & chainName) const {
86  return m_prescales.at(chainName);
87 }
88 
91  return m_prescalesByHash.at(chainHash);
92 }
93 
94 
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 
115 void
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 
TrigConf::HLTPrescalesSet::HLTPrescale::prescale
double prescale
Definition: HLTPrescalesSet.h:24
TrigConf::HLTPrescalesSet::HLTPrescale
Definition: HLTPrescalesSet.h:22
HLTPrescalesSet.h
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TrigConf::HLTPrescalesSet::setPSK
void setPSK(unsigned int psk)
Definition: HLTPrescalesSet.cxx:80
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConf::HLTPrescalesSet::HLTPrescalesSet
HLTPrescalesSet()
Constructors.
Definition: HLTPrescalesSet.cxx:7
TrigConf::HLTPrescalesSet::load
void load()
Definition: HLTPrescalesSet.cxx:17
TrigConf::HLTPrescalesSet::prescale_express
const HLTPrescale & prescale_express(const std::string &chainName) const
HLT prescales by chain names.
Definition: HLTPrescalesSet.cxx:96
search
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:738
RatesAnalysisFullMenu.prescales
prescales
Definition: RatesAnalysisFullMenu.py:119
TrigConf::HLTPrescalesSet::size
std::size_t size() const
number of HLT prescales
Definition: HLTPrescalesSet.cxx:69
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TrigConf::HLTPrescalesSet::prescale
const HLTPrescale & prescale(const std::string &chainName) const
HLT prescales by chain names.
Definition: HLTPrescalesSet.cxx:85
TrigConf::HLTPrescalesSet::printPrescaleSet
void printPrescaleSet(bool full) const
Definition: HLTPrescalesSet.cxx:116
ptree
boost::property_tree::ptree ptree
Definition: JsonFileLoader.cxx:16
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigConf::DataStructure
Base class for Trigger configuration data and wrapper around underlying representation.
Definition: DataStructure.h:37
find_data.full
full
Definition: find_data.py:27
TrigConf::HLTPrescalesSet::clear
virtual void clear() override
Clearing the configuration data.
Definition: HLTPrescalesSet.cxx:61
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:353
TrigConf::HLTPrescalesSet::HLTPrescale::enabled
bool enabled
Definition: HLTPrescalesSet.h:23
TrigConf::HLTPrescalesSet::psk
unsigned int psk() const
setter and getter for the HLT prescale key
Definition: HLTPrescalesSet.cxx:75
python.compressB64.c
def c
Definition: compressB64.py:93