ATLAS Offline Software
HLTPrescaleSet.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <iomanip>
6 #include <iostream>
7 
12 
13 using namespace std;
14 using namespace TrigConf;
15 
17  m_iovstart(0),
18  m_iovend(0)
19 {}
20 
22 TrigConf::HLTPrescaleSet::setPrescale(const HLTPrescale& sc, unsigned int chain_counter, HLTLevel level) {
23  ScalingMap_t& map = m_scalers[static_cast<unsigned int>(level)];
24  ScalingMap_t::iterator s = map.find(chain_counter);
25  if(s==map.end()) {
26  s = map.insert(ScalingMap_t::value_type(chain_counter, sc)).first;
27  } else {
28  s->second = sc;
29  }
30  return s->second;
31 }
32 
33 
34 bool
36  const ScalingMap_t& map_for_level = m_scalers[static_cast<unsigned int>(level)];
37  return !map_for_level.empty() && map_for_level.count(counter)>0;
38 }
39 
40 
42 TrigConf::HLTPrescaleSet::getPrescale(unsigned int chain_counter, HLTLevel level) const {
43  const ScalingMap_t& map = m_scalers[static_cast<unsigned int>(level)];
44  ScalingMap_t::const_iterator s = map.find(chain_counter);
45  if(s==map.end()) {
46  cerr << "HLTPrescaleSet::getPrescale: chain counter " << chain_counter << " in level " << level << " has no prescales" << endl;
47  throw std::runtime_error("HLTPrescaleSet::getPrescale: chain has no prescales defined");
48  }
49  return s->second;
50 }
51 
54  ScalingMap_t& map = m_scalers[static_cast<unsigned int>(level)];
55  ScalingMap_t::iterator s = map.find(chain_counter);
56  if(s==map.end())
57  s = map.insert(ScalingMap_t::value_type(chain_counter, HLTPrescale())).first;
58 
59  return s->second;
60 }
61 
62 
63 //________________________________________________________________________________
64 void
65 TrigConf::HLTPrescaleSet::setIOV(uint32_t start_run, uint32_t start_lb, uint32_t end_run, uint32_t end_lb ) {
66  m_iovstart = start_run; m_iovstart <<= 32; m_iovstart += start_lb;
67  m_iovend = end_run; m_iovend <<= 32; m_iovend += end_lb;
68 }
69 
70 //________________________________________________________________________________
71 void
73  m_iovstart = start;
74  m_iovend = end;
75 }
76 
77 //________________________________________________________________________________
78 // note that end_run/end_lb specifies the first lb for which the HLT PSS is not valid anymore (COOL design)
79 void
80 TrigConf::HLTPrescaleSet::getIOV(uint32_t& start_run, uint32_t& start_lb, uint32_t& end_run, uint32_t& end_lb ) const {
81  start_lb = m_iovstart & 0xFFFFFFFF;
82  start_run = m_iovstart>>32;
83  end_lb = m_iovend & 0xFFFFFFFF;
84  end_run = m_iovend>>32;
85 }
86 
87 //________________________________________________________________________________
88 bool
90  unsigned long long iovtime = run;
91  iovtime <<= 32;
92  iovtime += lb;
93 
94  return iovtime >= m_iovstart && iovtime<m_iovend; // m_iovend is not part of the IOV
95 }
96 
97 //________________________________________________________________________________
98 void
100  for(unsigned int i = 0; i<3; ++i )
101  m_scalers[i].clear();
102 }
103 
104 //________________________________________________________________________________
105 void TrigConf::HLTPrescaleSet::print(const std::string& indent, unsigned int detail) const {
106  if(detail>=1) {
107  cout << indent << "HLTPrescaleSet "; printNameIdV();
108  cout << indent << " L2 scalers " << size(L2) << endl
109  << indent << " EF scalers " << size(EF) << endl
110  << indent << " HLT scalers " << size(HLT) << endl;
111  if(detail>=3) {
112  cout.unsetf(ios_base::floatfield);
113  for(unsigned int i=L2; i<=HLT; i++) {
115  if(size(level)==0) continue;
116  if(level!=HLT)
117  cout << indent << " " << (level==L2?"L2":"EF") << " prescales:" << endl;
118 
119  const ScalingMap_t& map = m_scalers[static_cast<unsigned int>(level)];
120 
121  for(uint cc=0; cc<8192;cc++) {
122  auto s_iter = map.find(cc);
123  if(s_iter==map.end()) continue;
124  const HLTPrescale& s = s_iter->second;
125  cout << indent << " Chain counter: " << setw(4) << cc
126  << ", prescale: " << setw(4) << s.prescale()
127  << ", pass-through: " << setw(4) << s.pass_through();
128  if( s.getRerunPrescales().size()>0 ) {
129  cout << ", rerun prescales: ";
130  for( HLTPrescale::PrescaleMap_t::value_type ps: s.getRerunPrescales())
131  cout << ps.first << ": " << ps.second << ", ";
132  }
133  if( s.getStreamPrescales().size()>0 ) {
134  cout << ", stream prescales: ";
135  for( HLTPrescale::PrescaleMap_t::value_type str_ps: s.getStreamPrescales())
136  cout << str_ps.first << ": " << str_ps.second << ", ";
137  }
138  cout << endl;
139  }
140  }
141  }
142  }
143 }
144 
145 
146 //________________________________________________________________________________
147 std::ostream&
148 TrigConf::operator<<(std::ostream & o, const TrigConf::HLTPrescaleSet & c) {
149  o << "HLTPrescaleSet " << c.name();
150  if(c.id()>0 || c.version()>0) o << " (id=" << c.id() << "/v=" << c.version() << ")";
151  o << endl;
152  if(c.comment()!="") o << "Comment : " << c.comment() << endl;
153 
154  for(unsigned int i = TrigConf::L2; i <= TrigConf::HLT; i++) {
156  if(c.size(level)==0) continue;
157  o << (level==TrigConf::L2?"L2":"EF") << " prescales:" << endl;
158  for(const TrigConf::HLTPrescaleSet::ScalingMap_t::value_type& sc: c.getPrescales(level)) {
159  o << "Chain counter: " << setw(4) << sc.first
160  << ", prescale: " << setw(4) << sc.second.prescale()
161  << ", pass-through: " << setw(4) << sc.second.pass_through()
162  << endl;
163  }
164  }
165  o << "---------------------------------------------------------- " << endl;
166  return o;
167 }
168 
169 string HLTPrescaleSet::__str__() const {
170  stringstream s;
171  s << *this;
172  return s.str();
173 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TrigConf::HLTPrescale
Definition: HLTPrescale.h:26
TrigConf::operator<<
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
Definition: L1ThresholdBase.cxx:339
HLTChainList.h
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TrigConf::L2
@ L2
Definition: HLTLevel.h:12
TrigConf::HLTPrescaleSet::hasPrescale
bool hasPrescale(unsigned int counter, TrigConf::HLTLevel level=HLT) const
Definition: HLTPrescaleSet.cxx:35
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConf::HLTPrescaleSet::HLTPrescaleSet
HLTPrescaleSet()
default constructor
Definition: HLTPrescaleSet.cxx:16
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
TrigConf::HLTPrescaleSet::print
void print(const std::string &indent="", unsigned int detail=1) const override
print the prescale set
Definition: HLTPrescaleSet.cxx:105
HLTChain.h
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
detail
Definition: extract_histogram_tag.cxx:14
TrigConf::HLTPrescaleSet::setPrescale
HLTPrescale & setPrescale(const HLTPrescale &sc, unsigned int chain_counter, HLTLevel level=HLT)
Definition: HLTPrescaleSet.cxx:22
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigConf::HLT
@ HLT
Definition: HLTLevel.h:12
TrigConf::HLTPrescaleSet::thePrescale
HLTPrescale & thePrescale(unsigned int chain_counter, HLTLevel level)
Definition: HLTPrescaleSet.cxx:53
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
TrigConf::HLTPrescaleSet::getIOV
void getIOV(uint32_t &start_run, uint32_t &start_lb, uint32_t &end_run, uint32_t &end_lb) const
gets the IOV of the prescale set
Definition: HLTPrescaleSet.cxx:80
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
geometry_dat_to_json.indent
indent
Definition: geometry_dat_to_json.py:36
python.BunchSpacingUtils.lb
lb
Definition: BunchSpacingUtils.py:88
TrigConf::EF
@ EF
Definition: HLTLevel.h:12
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigConf::HLTPrescaleSet::getPrescale
const HLTPrescale & getPrescale(unsigned int chain_counter, HLTLevel level=HLT) const
Definition: HLTPrescaleSet.cxx:42
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
run
Definition: run.py:1
TrigConf::HLTPrescaleSet::reset
void reset()
Definition: HLTPrescaleSet.cxx:99
TrigConf::HLTLevel
HLTLevel
Definition: HLTLevel.h:12
TrigConf::HLTPrescaleSet
HLT chain configuration information.
Definition: HLTPrescaleSet.h:31
TrigConf::HLTPrescaleSet::isValid
bool isValid(uint32_t run, uint32_t lb) const
checks if run/lb are in the current IOV
Definition: HLTPrescaleSet.cxx:89
TrigConf::HLTPrescaleSet::ScalingMap_t
std::unordered_map< unsigned int, HLTPrescale > ScalingMap_t
Definition: HLTPrescaleSet.h:34
TrigConf::counter
Definition: HLTChainList.h:37
HLTFrame.h
HLTPrescaleSet.h
VKalVrtAthena::varHolder_detail::clear
void clear(T &var)
Definition: NtupleVars.h:48
TrigConf::HLTPrescaleSet::__str__
std::string __str__() const override
Definition: HLTPrescaleSet.cxx:169
DeMoScan.first
bool first
Definition: DeMoScan.py:536
python.compressB64.c
def c
Definition: compressB64.py:93
TrigConf::HLTPrescaleSet::setIOV
void setIOV(uint32_t start_run, uint32_t start_lb, uint32_t end_run, uint32_t end_lb)
sets the IOV of the prescale set
Definition: HLTPrescaleSet.cxx:65
python.handimod.cc
int cc
Definition: handimod.py:523