CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
HLTPrescaleProvider Class Reference

#include <HLTPrescaleProvider.h>

Public Member Functions

HLTConfigProvider const & hltConfigProvider () const
 
template<typename T >
 HLTPrescaleProvider (edm::ParameterSet const &pset, edm::ConsumesCollector &&iC, T &module)
 
template<typename T >
 HLTPrescaleProvider (edm::ParameterSet const &pset, edm::ConsumesCollector &iC, T &module)
 
bool init (const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
 
L1GtUtils const & l1GtUtils () const
 
l1t::L1TGlobalUtil const & l1tGlobalUtil () const
 
int prescaleSet (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
template<typename T = unsigned int>
T prescaleValue (const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
 combining the two methods above More...
 
template<>
unsigned int prescaleValue (const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
 
template<>
unsigned int prescaleValue (const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
 
template<typename TL1 = int, typename THLT = TL1>
std::pair< TL1, THLT > prescaleValues (const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
 Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path. More...
 
template<typename TL1 = int, typename THLT = TL1>
std::pair< std::vector
< std::pair< std::string, TL1 >
>, THLT > 
prescaleValuesInDetail (const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
 
bool rejectedByHLTPrescaler (const edm::TriggerResults &triggerResults, unsigned int i) const
 

Static Public Member Functions

static int l1PrescaleDenominator ()
 

Private Member Functions

void checkL1GtUtils () const
 
void checkL1TGlobalUtil () const
 
template<typename T >
T convertL1PS (double val) const
 
template<>
FractionalPrescale convertL1PS (double val) const
 
template<>
FractionalPrescale convertL1PS (double val) const
 
double getL1PrescaleValue (const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
 
std::vector< std::pair
< std::string, double > > 
getL1PrescaleValueInDetail (const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
 

Private Attributes

unsigned char count_ [5] = {0, 0, 0, 0, 0}
 
HLTConfigProvider hltConfigProvider_
 
bool inited_ = false
 
std::unique_ptr< L1GtUtilsl1GtUtils_
 
std::unique_ptr
< l1t::L1TGlobalUtil
l1tGlobalUtil_
 

Static Private Attributes

static constexpr int kL1PrescaleDenominator_ = 100
 

Detailed Description

This class provides access routines to get hold of the HLT Configuration

Author
Martin Grunewald

Originally the functions in here were in HLTConfigProvider. The functions that use L1GtUtils and get products from the Event were moved into this class in 2015 when the consumes function calls were added. W. David Dagenhart

See header file for documentation

Author
Martin Grunewald

Definition at line 38 of file HLTPrescaleProvider.h.

Constructor & Destructor Documentation

template<typename T >
HLTPrescaleProvider::HLTPrescaleProvider ( edm::ParameterSet const &  pset,
edm::ConsumesCollector &&  iC,
T module 
)

Definition at line 117 of file HLTPrescaleProvider.h.

118  : HLTPrescaleProvider(pset, iC, module) {}
HLTPrescaleProvider(edm::ParameterSet const &pset, edm::ConsumesCollector &&iC, T &module)
tuple module
Definition: callgraph.py:69
template<typename T >
HLTPrescaleProvider::HLTPrescaleProvider ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module 
)

Definition at line 121 of file HLTPrescaleProvider.h.

References edm::ParameterSet::getParameter(), l1GtUtils_, l1tGlobalUtil_, callgraph::module, TrackValidation_cff::pset, l1t::Run, L1GtUtils::Run, and gammaJetAnalysis_cfi::stageL1Trigger.

121  {
122  unsigned int stageL1Trigger = pset.getParameter<unsigned int>("stageL1Trigger");
123  if (stageL1Trigger <= 1) {
124  l1GtUtils_ = std::make_unique<L1GtUtils>(pset, iC, false, module, L1GtUtils::UseEventSetupIn::Run);
125  } else {
126  l1tGlobalUtil_ = std::make_unique<l1t::L1TGlobalUtil>(pset, iC, module, l1t::UseEventSetupIn::Run);
127  }
128 }
std::unique_ptr< L1GtUtils > l1GtUtils_
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_
tuple module
Definition: callgraph.py:69

Member Function Documentation

void HLTPrescaleProvider::checkL1GtUtils ( ) const
private

Definition at line 344 of file HLTPrescaleProvider.cc.

References Exception, and l1GtUtils_.

Referenced by getL1PrescaleValue(), getL1PrescaleValueInDetail(), init(), l1GtUtils(), and prescaleSet().

344  {
345  if (!l1GtUtils_) {
346  throw cms::Exception("Configuration") << "HLTPrescaleProvider::checkL1GtUtils(),\n"
347  "Attempt to use L1GtUtils object when none was constructed.\n"
348  "Possibly the proper era is not configured or\n"
349  "the module configuration does not use the era properly\n"
350  "or input is from mixed eras";
351  }
352 }
std::unique_ptr< L1GtUtils > l1GtUtils_
void HLTPrescaleProvider::checkL1TGlobalUtil ( ) const
private

Definition at line 354 of file HLTPrescaleProvider.cc.

References Exception, and l1tGlobalUtil_.

Referenced by getL1PrescaleValue(), getL1PrescaleValueInDetail(), init(), l1tGlobalUtil(), and prescaleSet().

354  {
355  if (!l1tGlobalUtil_) {
356  throw cms::Exception("Configuration") << "HLTPrescaleProvider:::checkL1TGlobalUtil(),\n"
357  "Attempt to use L1TGlobalUtil object when none was constructed.\n"
358  "Possibly the proper era is not configured or\n"
359  "the module configuration does not use the era properly\n"
360  "or input is from mixed eras";
361  }
362 }
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_
template<typename T >
T HLTPrescaleProvider::convertL1PS ( double  val) const
inlineprivate

Definition at line 100 of file HLTPrescaleProvider.h.

100  {
101  return T(val);
102  }
long double T
template<>
FractionalPrescale HLTPrescaleProvider::convertL1PS ( double  val) const
private

Definition at line 106 of file HLTPrescaleProvider.cc.

References funct::abs(), and hgcalPerformanceValidation::val.

106  {
107  int numer = static_cast<int>(val * kL1PrescaleDenominator_ + 0.5);
108  static constexpr double kL1RoundingEpsilon = 0.001;
109  if (std::abs(numer - val * kL1PrescaleDenominator_) > kL1RoundingEpsilon) {
110  edm::LogWarning("ValueError") << " Error, L1 prescale val " << val
111  << "does not appear to precisely expressable as int / " << kL1PrescaleDenominator_
112  << ", using a FractionalPrescale is a loss of precision";
113  }
114 
115  return {numer, kL1PrescaleDenominator_};
116 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Log< level::Warning, false > LogWarning
static constexpr int kL1PrescaleDenominator_
template<>
FractionalPrescale HLTPrescaleProvider::convertL1PS ( double  val) const
private
double HLTPrescaleProvider::getL1PrescaleValue ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  trigger 
)
private

error - can't handle properly multiple L1GTSeed modules

error - can't handle properly multiple L1TSeed modules

Definition at line 118 of file HLTPrescaleProvider.cc.

References checkL1GtUtils(), checkL1TGlobalUtil(), count_, countMax(), remoteMonitoring_LASER_era2018_cfg::dump, hltConfigProvider_, HLTConfigProvider::hltL1GTSeeds(), HLTConfigProvider::hltL1TSeeds(), mps_fire::i, l1GtUtils_, l1tGlobalUtil_, HLTConfigProvider::l1tType(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, useL1EventSetup(), and useL1GtTriggerMenuLite().

Referenced by prescaleValues().

120  {
121  // get L1T prescale - works only for those hlt trigger paths with
122  // exactly one L1GT seed module which has exactly one L1T name as seed
123 
124  double result = -1;
125 
126  const unsigned int l1tType(hltConfigProvider_.l1tType());
127  if (l1tType == 1) {
128  checkL1GtUtils();
129  const unsigned int nL1GTSeedModules(hltConfigProvider_.hltL1GTSeeds(trigger).size());
130  if (nL1GTSeedModules == 0) {
131  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
132  result = 1;
133  } else if (nL1GTSeedModules == 1) {
134  l1GtUtils_->getL1GtRunCache(iEvent, iSetup, useL1EventSetup, useL1GtTriggerMenuLite);
135  const std::string l1tname(hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second);
136  int l1error(0);
137  result = l1GtUtils_->prescaleFactor(iEvent, l1tname, l1error);
138  if (l1error != 0) {
139  if (count_[1] < countMax) {
140  count_[1] += 1;
141  edm::LogError("HLTPrescaleProvider")
142  << " Error in determining L1T prescale for HLT path: '" << trigger << "' with L1T seed: '" << l1tname
143  << "' using L1GtUtils: error code = " << l1error << "." << std::endl
144  << " Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number) is allowed "
145  "as seed!"
146  << std::endl
147  << " For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'."
148  << std::endl;
149  }
150  result = -1;
151  }
152  } else {
154  if (count_[2] < countMax) {
155  count_[2] += 1;
156  std::string dump("'" + hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second + "'");
157  for (unsigned int i = 1; i != nL1GTSeedModules; ++i) {
158  dump += " * '" + hltConfigProvider_.hltL1GTSeeds(trigger).at(i).second + "'";
159  }
160  edm::LogError("HLTPrescaleProvider")
161  << " Error in determining L1T prescale for HLT path: '" << trigger << "' has multiple L1GTSeed modules, "
162  << nL1GTSeedModules << ", with L1 seeds: " << dump
163  << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
164  }
165  result = -1;
166  }
167  } else if (l1tType == 2) {
169  const unsigned int nL1TSeedModules(hltConfigProvider_.hltL1TSeeds(trigger).size());
170  if (nL1TSeedModules == 0) {
171  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
172  result = 1;
173  } else if (nL1TSeedModules == 1) {
174  // l1tGlobalUtil_->retrieveL1Event(iEvent,iSetup);
175  const std::string l1tname(hltConfigProvider_.hltL1TSeeds(trigger).at(0));
176  bool l1error(!l1tGlobalUtil_->getPrescaleByName(l1tname, result));
177  if (l1error) {
178  if (count_[1] < countMax) {
179  count_[1] += 1;
180  edm::LogError("HLTPrescaleProvider")
181  << " Error in determining L1T prescale for HLT path: '" << trigger << "' with L1T seed: '" << l1tname
182  << "' using L1TGlobalUtil: error cond = " << l1error << "." << std::endl
183  << " Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number) is allowed "
184  "as seed!"
185  << std::endl
186  << " For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'."
187  << std::endl;
188  }
189  result = -1;
190  }
191  } else {
193  if (count_[2] < countMax) {
194  count_[2] += 1;
195  std::string dump("'" + hltConfigProvider_.hltL1TSeeds(trigger).at(0) + "'");
196  for (unsigned int i = 1; i != nL1TSeedModules; ++i) {
197  dump += " * '" + hltConfigProvider_.hltL1TSeeds(trigger).at(i) + "'";
198  }
199  edm::LogError("HLTPrescaleProvider")
200  << " Error in determining L1T prescale for HLT path: '" << trigger << "' has multiple L1TSeed modules, "
201  << nL1TSeedModules << ", with L1T seeds: " << dump
202  << ". (Note: at most one L1TSeed module is allowed for a proper determination of the L1T prescale!)";
203  }
204  result = -1;
205  }
206  } else {
207  if (count_[1] < countMax) {
208  count_[1] += 1;
209  edm::LogError("HLTPrescaleProvider") << " Unknown L1T Type " << l1tType << " - can not determine L1T prescale! ";
210  }
211  result = -1;
212  }
213 
214  return result;
215 }
HLTConfigProvider hltConfigProvider_
unsigned int l1tType() const
L1T type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
const std::vector< std::vector< std::string > > & hltL1TSeeds() const
std::unique_ptr< L1GtUtils > l1GtUtils_
Log< level::Error, false > LogError
tuple result
Definition: mps_fire.py:311
static const unsigned char countMax(2)
static const bool useL1GtTriggerMenuLite(false)
void checkL1TGlobalUtil() const
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_
unsigned char count_[5]
static const bool useL1EventSetup(true)
tuple dump
OutputFilePath = cms.string(&#39;/tmp/zhokin/&#39;), OutputFileExt = cms.string(&#39;&#39;),.
std::vector< std::pair< std::string, double > > HLTPrescaleProvider::getL1PrescaleValueInDetail ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  trigger 
)
private

error - can't handle properly multiple L1GTSeed modules

error - can't handle properly multiple L1TSeed modules

Definition at line 217 of file HLTPrescaleProvider.cc.

References funct::abs(), checkL1GtUtils(), checkL1TGlobalUtil(), count_, countMax(), remoteMonitoring_LASER_era2018_cfg::dump, mps_splice::entry, edm::Event::getRun(), hltConfigProvider_, HLTConfigProvider::hltL1GTSeeds(), HLTConfigProvider::hltL1TSeeds(), mps_fire::i, l1GtUtils_, l1tGlobalUtil_, HLTConfigProvider::l1tType(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, useL1EventSetup(), and useL1GtTriggerMenuLite().

Referenced by prescaleValuesInDetail().

218  {
219  std::vector<std::pair<std::string, double> > result;
220 
221  const unsigned int l1tType(hltConfigProvider_.l1tType());
222  if (l1tType == 1) {
223  checkL1GtUtils();
224 
225  const unsigned int nL1GTSeedModules(hltConfigProvider_.hltL1GTSeeds(trigger).size());
226  if (nL1GTSeedModules == 0) {
227  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
228  result.clear();
229  } else if (nL1GTSeedModules == 1) {
230  l1GtUtils_->getL1GtRunCache(iEvent, iSetup, useL1EventSetup, useL1GtTriggerMenuLite);
231  const std::string l1tname(hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second);
233  l1Logical.logicalExpressionRunUpdate(iEvent.getRun(), iSetup, l1tname);
234  const std::vector<std::pair<std::string, int> >& errorCodes(l1Logical.errorCodes(iEvent));
235  auto resultInt = l1Logical.prescaleFactors();
236  result.clear();
237  for (const auto& entry : resultInt) {
238  result.push_back(entry);
239  }
240 
241  int l1error(l1Logical.isValid() ? 0 : 1);
242  for (auto const& errorCode : errorCodes) {
243  l1error += std::abs(errorCode.second);
244  }
245  if (l1error != 0) {
246  if (count_[3] < countMax) {
247  count_[3] += 1;
248  std::ostringstream message;
249  message << " Error in determining L1T prescales for HLT path: '" << trigger << "' with complex L1T seed: '"
250  << l1tname << "' using L1GtUtils: " << std::endl
251  << " isValid=" << l1Logical.isValid() << " l1tname/error/prescale " << errorCodes.size() << std::endl;
252  for (unsigned int i = 0; i < errorCodes.size(); ++i) {
253  message << " " << i << ":" << errorCodes[i].first << "/" << errorCodes[i].second << "/" << result[i].second;
254  }
255  message << ".";
256  edm::LogError("HLTPrescaleProvider") << message.str();
257  }
258  result.clear();
259  }
260  } else {
262  if (count_[4] < countMax) {
263  count_[4] += 1;
264  std::string dump("'" + hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second + "'");
265  for (unsigned int i = 1; i != nL1GTSeedModules; ++i) {
266  dump += " * '" + hltConfigProvider_.hltL1GTSeeds(trigger).at(i).second + "'";
267  }
268  edm::LogError("HLTPrescaleProvider")
269  << " Error in determining L1T prescale for HLT path: '" << trigger << "' has multiple L1GTSeed modules, "
270  << nL1GTSeedModules << ", with L1 seeds: " << dump
271  << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
272  }
273  result.clear();
274  }
275  } else if (l1tType == 2) {
277  const unsigned int nL1TSeedModules(hltConfigProvider_.hltL1TSeeds(trigger).size());
278  if (nL1TSeedModules == 0) {
279  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
280  result.clear();
281  } else if (nL1TSeedModules == 1) {
282  // l1tGlobalUtil_->retrieveL1Event(iEvent,iSetup);
283  std::string l1tname(hltConfigProvider_.hltL1TSeeds(trigger).at(0));
284  GlobalLogicParser l1tGlobalLogicParser = GlobalLogicParser(l1tname);
285  const std::vector<GlobalLogicParser::OperandToken> l1tSeeds = l1tGlobalLogicParser.expressionSeedsOperandList();
286  int l1error(0);
287  double l1tPrescale(-1);
288  for (auto const& i : l1tSeeds) {
289  const string& l1tSeed = i.tokenName;
290  if (!l1tGlobalUtil_->getPrescaleByName(l1tSeed, l1tPrescale)) {
291  l1error += 1;
292  }
293  result.push_back(std::pair<std::string, double>(l1tSeed, l1tPrescale));
294  }
295  if (l1error != 0) {
296  if (count_[3] < countMax) {
297  count_[3] += 1;
298  string l1name = l1tname;
299  std::ostringstream message;
300  message << " Error in determining L1T prescales for HLT path: '" << trigger << "' with complex L1T seed: '"
301  << l1tname << "' using L1TGlobalUtil: " << std::endl
302  << " isValid=" << l1tGlobalLogicParser.checkLogicalExpression(l1name) << " l1tname/error/prescale "
303  << l1tSeeds.size() << std::endl;
304  for (unsigned int i = 0; i < l1tSeeds.size(); ++i) {
305  const string& l1tSeed = l1tSeeds[i].tokenName;
306  message << " " << i << ":" << l1tSeed << "/" << l1tGlobalUtil_->getPrescaleByName(l1tSeed, l1tPrescale)
307  << "/" << result[i].second;
308  }
309  message << ".";
310  edm::LogError("HLTPrescaleProvider") << message.str();
311  }
312  result.clear();
313  }
314  } else {
316  if (count_[4] < countMax) {
317  count_[4] += 1;
318  std::string dump("'" + hltConfigProvider_.hltL1TSeeds(trigger).at(0) + "'");
319  for (unsigned int i = 1; i != nL1TSeedModules; ++i) {
320  dump += " * '" + hltConfigProvider_.hltL1TSeeds(trigger).at(i) + "'";
321  }
322  edm::LogError("HLTPrescaleProvider")
323  << " Error in determining L1T prescale for HLT path: '" << trigger << "' has multiple L1TSeed modules, "
324  << nL1TSeedModules << ", with L1T seeds: " << dump
325  << ". (Note: at most one L1TSeed module is allowed for a proper determination of the L1T prescale!)";
326  }
327  result.clear();
328  }
329  } else {
330  if (count_[3] < countMax) {
331  count_[3] += 1;
332  edm::LogError("HLTPrescaleProvider") << " Unknown L1T Type " << l1tType << " - can not determine L1T prescale! ";
333  }
334  result.clear();
335  }
336 
337  return result;
338 }
HLTConfigProvider hltConfigProvider_
unsigned int l1tType() const
L1T type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
const std::vector< std::vector< std::string > > & hltL1TSeeds() const
std::unique_ptr< L1GtUtils > l1GtUtils_
Run const & getRun() const
Definition: Event.cc:112
Log< level::Error, false > LogError
tuple result
Definition: mps_fire.py:311
static const unsigned char countMax(2)
static const bool useL1GtTriggerMenuLite(false)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void checkL1TGlobalUtil() const
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_
unsigned char count_[5]
list entry
Definition: mps_splice.py:68
static const bool useL1EventSetup(true)
tuple dump
OutputFilePath = cms.string(&#39;/tmp/zhokin/&#39;), OutputFileExt = cms.string(&#39;&#39;),.
HLTConfigProvider const& HLTPrescaleProvider::hltConfigProvider ( ) const
inline
bool HLTPrescaleProvider::init ( const edm::Run iRun,
const edm::EventSetup iSetup,
const std::string &  processName,
bool &  changed 
)

Run-dependent initialisation (non-const method) "init" return value indicates whether intitialisation has succeeded "changed" parameter indicates whether the config has actually changed This must be called at beginRun for most of the other functions in this class to succeed

L1 GTA V3: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideL1TriggerL1GtUtils#Version_3

Definition at line 21 of file HLTPrescaleProvider.cc.

References checkL1GtUtils(), checkL1TGlobalUtil(), count_, hltConfigProvider_, HLTConfigProvider::init(), inited_, l1GtUtils_, l1tGlobalUtil_, HLTConfigProvider::l1tType(), mps_fire::result, useL1EventSetup(), and useL1GtTriggerMenuLite().

Referenced by HLTPrescaleExample::beginRun(), CandidateTriggerObjectProducer::beginRun(), HLTEventAnalyzerAOD::beginRun(), pat::PATTriggerProducer::beginRun(), IsoTrig::beginRun(), BPHMonitor::bookHistograms(), EwkElecDQM::dqmBeginRun(), and EwkMuDQM::dqmBeginRun().

24  {
25  inited_ = true;
26 
27  count_[0] = 0;
28  count_[1] = 0;
29  count_[2] = 0;
30  count_[3] = 0;
31  count_[4] = 0;
32 
33  const bool result(hltConfigProvider_.init(iRun, iSetup, processName, changed));
34 
35  const unsigned int l1tType(hltConfigProvider_.l1tType());
36  if (l1tType == 1) {
39  l1GtUtils_->getL1GtRunCache(iRun, iSetup, useL1EventSetup, useL1GtTriggerMenuLite);
40  } else if (l1tType == 2) {
42  l1tGlobalUtil_->retrieveL1Setup(iSetup);
43  } else {
44  edm::LogError("HLTPrescaleProvider") << " Unknown L1T Type " << l1tType << " - prescales will not be avaiable!";
45  }
46 
47  return result;
48 }
HLTConfigProvider hltConfigProvider_
unsigned int l1tType() const
L1T type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
std::unique_ptr< L1GtUtils > l1GtUtils_
Log< level::Error, false > LogError
tuple result
Definition: mps_fire.py:311
static const bool useL1GtTriggerMenuLite(false)
void checkL1TGlobalUtil() const
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_
unsigned char count_[5]
static const bool useL1EventSetup(true)
L1GtUtils const & HLTPrescaleProvider::l1GtUtils ( ) const

Definition at line 50 of file HLTPrescaleProvider.cc.

References checkL1GtUtils(), and l1GtUtils_.

Referenced by pat::PATTriggerProducer::produce().

50  {
52  return *l1GtUtils_;
53 }
std::unique_ptr< L1GtUtils > l1GtUtils_
static int HLTPrescaleProvider::l1PrescaleDenominator ( )
inlinestatic

Definition at line 94 of file HLTPrescaleProvider.h.

References kL1PrescaleDenominator_.

94 { return kL1PrescaleDenominator_; }
static constexpr int kL1PrescaleDenominator_
l1t::L1TGlobalUtil const & HLTPrescaleProvider::l1tGlobalUtil ( ) const

Definition at line 55 of file HLTPrescaleProvider.cc.

References checkL1TGlobalUtil(), and l1tGlobalUtil_.

55  {
57  return *l1tGlobalUtil_;
58 }
void checkL1TGlobalUtil() const
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_
int HLTPrescaleProvider::prescaleSet ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)

HLT prescale values via (L1) EventSetup current (default) prescale set index - to be taken from L1GtUtil via Event

error - notify user!

Definition at line 60 of file HLTPrescaleProvider.cc.

References L1GtUtils::AlgorithmTrigger, cms::cuda::assert(), checkL1GtUtils(), checkL1TGlobalUtil(), count_, countMax(), Exception, hltConfigProvider_, inited_, l1GtUtils_, l1tGlobalUtil_, HLTConfigProvider::l1tType(), HLTConfigProvider::processName(), L1GtUtils::TechnicalTrigger, useL1EventSetup(), and useL1GtTriggerMenuLite().

Referenced by EwkMuDQM::analyze(), EwkElecDQM::analyze(), prescaleValue(), and pat::PATTriggerProducer::produce().

60  {
61  if (!inited_) {
62  throw cms::Exception("LogicError") << "HLTPrescaleProvider::prescaleSet,\n"
63  "HLTPrescaleProvider::init was not called at beginRun\n";
64  }
65  const unsigned int l1tType(hltConfigProvider_.l1tType());
66  if (l1tType == 1) {
68 
69  // return hltPrescaleTable_.set();
70  l1GtUtils_->getL1GtRunCache(iEvent, iSetup, useL1EventSetup, useL1GtTriggerMenuLite);
71  int errorTech(0);
72  const int psfsiTech(l1GtUtils_->prescaleFactorSetIndex(iEvent, L1GtUtils::TechnicalTrigger, errorTech));
73  int errorPhys(0);
74  const int psfsiPhys(l1GtUtils_->prescaleFactorSetIndex(iEvent, L1GtUtils::AlgorithmTrigger, errorPhys));
75  assert(psfsiTech == psfsiPhys);
76  if ((errorTech == 0) && (errorPhys == 0) && (psfsiTech >= 0) && (psfsiPhys >= 0) && (psfsiTech == psfsiPhys)) {
77  return psfsiPhys;
78  } else {
80  if (count_[0] < countMax) {
81  count_[0] += 1;
82  edm::LogError("HLTPrescaleProvider")
83  << " Using processName '" << hltConfigProvider_.processName() << "':"
84  << " Error in determining HLT prescale set index from L1 data using L1GtUtils:"
85  << " Tech/Phys error = " << errorTech << "/" << errorPhys << " Tech/Phys psfsi = " << psfsiTech << "/"
86  << psfsiPhys;
87  }
88  return -1;
89  }
90  } else if (l1tType == 2) {
92  l1tGlobalUtil_->retrieveL1Event(iEvent, iSetup);
93  return static_cast<int>(l1tGlobalUtil_->prescaleColumn());
94  } else {
95  if (count_[0] < countMax) {
96  count_[0] += 1;
97  edm::LogError("HLTPrescaleProvider")
98  << " Using processName '" << hltConfigProvider_.processName() << "':"
99  << " Unknown L1T Type " << l1tType << " - can not determine prescale set index!";
100  }
101  return -1;
102  }
103 }
HLTConfigProvider hltConfigProvider_
unsigned int l1tType() const
L1T type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
std::unique_ptr< L1GtUtils > l1GtUtils_
Log< level::Error, false > LogError
assert(be >=bs)
static const unsigned char countMax(2)
static const bool useL1GtTriggerMenuLite(false)
void checkL1TGlobalUtil() const
const std::string & processName() const
process name
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_
unsigned char count_[5]
static const bool useL1EventSetup(true)
template<typename T = unsigned int>
T HLTPrescaleProvider::prescaleValue ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  trigger 
)
inline

combining the two methods above

Definition at line 63 of file HLTPrescaleProvider.h.

References hltConfigProvider_, prescaleSet(), and HLTConfigProvider::prescaleValue().

Referenced by HLTPrescaleExample::analyze().

63  {
64  const int set(prescaleSet(iEvent, iSetup));
65  //there is a template specialisation for unsigned in which returns +1 which
66  //emulates old behaviour
67  return set < 0 ? -1 : hltConfigProvider_.prescaleValue<T>(static_cast<unsigned int>(set), trigger);
68  }
HLTConfigProvider hltConfigProvider_
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
T prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
long double T
template<>
unsigned int HLTPrescaleProvider::prescaleValue ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  trigger 
)
template<>
unsigned int HLTPrescaleProvider::prescaleValue ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  trigger 
)

Definition at line 365 of file HLTPrescaleProvider.cc.

References iEvent.

367  {
368  const int set(prescaleSet(iEvent, iSetup));
369  return set < 0 ? 1 : hltConfigProvider_.prescaleValue<unsigned int>(static_cast<unsigned int>(set), trigger);
370 }
HLTConfigProvider hltConfigProvider_
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
T prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
template<typename TL1 = int, typename THLT = TL1>
std::pair<TL1, THLT> HLTPrescaleProvider::prescaleValues ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  trigger 
)
inline

Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path.

Definition at line 72 of file HLTPrescaleProvider.h.

References getL1PrescaleValue().

Referenced by HLTPrescaleExample::analyze(), IsoTrig::analyze(), HLTEventAnalyzerAOD::analyzeTrigger(), and CandidateTriggerObjectProducer::produce().

74  {
75  return {convertL1PS<TL1>(getL1PrescaleValue(iEvent, iSetup, trigger)),
76  prescaleValue<THLT>(iEvent, iSetup, trigger)};
77  }
double getL1PrescaleValue(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
template<typename TL1 = int, typename THLT = TL1>
std::pair<std::vector<std::pair<std::string, TL1> >, THLT> HLTPrescaleProvider::prescaleValuesInDetail ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  trigger 
)
inline

Definition at line 82 of file HLTPrescaleProvider.h.

References mps_splice::entry, getL1PrescaleValueInDetail(), iEvent, and eostools::move().

Referenced by HLTPrescaleExample::analyze(), HLTEventAnalyzerAOD::analyzeTrigger(), BPHMonitor::Prescale(), and pat::PATTriggerProducer::produce().

84  {
85  std::pair<std::vector<std::pair<std::string, TL1> >, THLT> retval;
86  for (auto& entry : getL1PrescaleValueInDetail(iEvent, iSetup, trigger)) {
87  retval.first.emplace_back(std::move(entry.first), convertL1PS<TL1>(entry.second));
88  }
89  retval.second = prescaleValue<THLT>(iEvent, iSetup, trigger);
90  return retval;
91  }
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
std::vector< std::pair< std::string, double > > getL1PrescaleValueInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
list entry
Definition: mps_splice.py:68
bool HLTPrescaleProvider::rejectedByHLTPrescaler ( const edm::TriggerResults triggerResults,
unsigned int  i 
) const

Definition at line 340 of file HLTPrescaleProvider.cc.

References hltConfigProvider_, edm::HLTGlobalStatus::index(), HLTConfigProvider::moduleLabel(), and HLTConfigProvider::moduleType().

340  {
341  return hltConfigProvider_.moduleType(hltConfigProvider_.moduleLabel(i, triggerResults.index(i))) == "HLTPrescaler";
342 }
HLTConfigProvider hltConfigProvider_
const std::string moduleType(const std::string &module) const
C++ class name of module.
const std::string & moduleLabel(unsigned int trigger, unsigned int module) const
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.

Member Data Documentation

unsigned char HLTPrescaleProvider::count_[5] = {0, 0, 0, 0, 0}
private
HLTConfigProvider HLTPrescaleProvider::hltConfigProvider_
private
bool HLTPrescaleProvider::inited_ = false
private

Definition at line 113 of file HLTPrescaleProvider.h.

Referenced by init(), and prescaleSet().

constexpr int HLTPrescaleProvider::kL1PrescaleDenominator_ = 100
staticprivate

Definition at line 108 of file HLTPrescaleProvider.h.

Referenced by l1PrescaleDenominator().

std::unique_ptr<L1GtUtils> HLTPrescaleProvider::l1GtUtils_
private
std::unique_ptr<l1t::L1TGlobalUtil> HLTPrescaleProvider::l1tGlobalUtil_
private