CMS 3D CMS Logo

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

template<>
FractionalPrescale convertL1PS (double val) const
 
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<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 void fillPSetDescription (edm::ParameterSetDescription &desc, unsigned int stageL1Trigger, edm::InputTag const &l1tAlgBlkInputTag, edm::InputTag const &l1tExtBlkInputTag, bool readPrescalesFromFile)
 
static int l1PrescaleDenominator ()
 

Private Member Functions

void checkL1GtUtils () const
 
void checkL1TGlobalUtil () const
 
template<typename T >
T 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::L1TGlobalUtill1tGlobalUtil_
 

Static Private Attributes

static constexpr int kL1PrescaleDenominator_ = 100
 
static constexpr const char * l1tGlobalDecisionKeyword_ = "L1GlobalDecision"
 

Detailed Description

This class provides access routines to get hold of the HLT Configuration, as well as the prescales of Level-1 and High-Level triggers.

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 39 of file HLTPrescaleProvider.h.

Constructor & Destructor Documentation

◆ HLTPrescaleProvider() [1/2]

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

Definition at line 139 of file HLTPrescaleProvider.h.

140  : HLTPrescaleProvider(pset, iC, module) {}
HLTPrescaleProvider(edm::ParameterSet const &pset, edm::ConsumesCollector &&iC, T &module)

◆ HLTPrescaleProvider() [2/2]

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

Definition at line 143 of file HLTPrescaleProvider.h.

References l1GtUtils_, l1tGlobalUtil_, callgraph::module, muonDTDigis_cfi::pset, l1t::Run, L1GtUtils::Run, and gammaJetAnalysis_cfi::stageL1Trigger.

143  {
144  unsigned int stageL1Trigger = pset.getParameter<unsigned int>("stageL1Trigger");
145  if (stageL1Trigger <= 1) {
146  l1GtUtils_ = std::make_unique<L1GtUtils>(pset, iC, false, module, L1GtUtils::UseEventSetupIn::Run);
147  } else {
148  l1tGlobalUtil_ = std::make_unique<l1t::L1TGlobalUtil>(pset, iC, module, l1t::UseEventSetupIn::Run);
149  }
150 }
std::unique_ptr< L1GtUtils > l1GtUtils_
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_

Member Function Documentation

◆ checkL1GtUtils()

void HLTPrescaleProvider::checkL1GtUtils ( ) const
private

Definition at line 370 of file HLTPrescaleProvider.cc.

References Exception, and l1GtUtils_.

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

370  {
371  if (!l1GtUtils_) {
372  throw cms::Exception("Configuration") << "HLTPrescaleProvider::checkL1GtUtils(),\n"
373  "Attempt to use L1GtUtils object when none was constructed.\n"
374  "Possibly the proper era is not configured or\n"
375  "the module configuration does not use the era properly\n"
376  "or input is from mixed eras";
377  }
378 }
std::unique_ptr< L1GtUtils > l1GtUtils_

◆ checkL1TGlobalUtil()

void HLTPrescaleProvider::checkL1TGlobalUtil ( ) const
private

Definition at line 380 of file HLTPrescaleProvider.cc.

References Exception, and l1tGlobalUtil_.

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

380  {
381  if (!l1tGlobalUtil_) {
382  throw cms::Exception("Configuration") << "HLTPrescaleProvider:::checkL1TGlobalUtil(),\n"
383  "Attempt to use L1TGlobalUtil object when none was constructed.\n"
384  "Possibly the proper era is not configured or\n"
385  "the module configuration does not use the era properly\n"
386  "or input is from mixed eras";
387  }
388 }
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_

◆ convertL1PS() [1/2]

template<typename T >
T HLTPrescaleProvider::convertL1PS ( double  val) const
inlineprivate

Definition at line 110 of file HLTPrescaleProvider.h.

References or, and heppy_batch::val.

110  {
111  static_assert(std::is_same_v<T, double> or std::is_same_v<T, FractionalPrescale>,
112  "\n\n\tPlease use convertL1PS<double> or convertL1PS<FractionalPrescale>"
113  " (other types for L1T prescales are not supported anymore by HLTPrescaleProvider)"
114  "\n\tconvertL1PS is used inside prescaleValues and prescaleValuesInDetail,"
115  " so it might be necessary to specify template arguments for those calls,"
116  "\n\te.g. prescaleValues<double, FractionalPrescale>"
117  " (the 1st argument applies to L1T prescales, the 2nd to HLT prescales)\n");
118  return T(val);
119  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
long double T

◆ convertL1PS() [2/2]

FractionalPrescale HLTPrescaleProvider::convertL1PS ( double  val) const

Definition at line 107 of file HLTPrescaleProvider.cc.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), kL1PrescaleDenominator_, and heppy_batch::val.

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

◆ fillPSetDescription()

void HLTPrescaleProvider::fillPSetDescription ( edm::ParameterSetDescription desc,
unsigned int  stageL1Trigger,
edm::InputTag const &  l1tAlgBlkInputTag,
edm::InputTag const &  l1tExtBlkInputTag,
bool  readPrescalesFromFile 
)
static

Definition at line 390 of file HLTPrescaleProvider.cc.

References submitPVResolutionJobs::desc, l1t::L1TGlobalUtil::fillDescription(), L1GtUtils::fillDescription(), WElectronSkim_cff::l1tAlgBlkInputTag, WElectronSkim_cff::l1tExtBlkInputTag, and gammaJetAnalysis_cfi::stageL1Trigger.

Referenced by BPHMonitor::fillDescriptions().

394  {
395  desc.add<unsigned int>("stageL1Trigger", stageL1Trigger);
398 }
static void fillDescription(edm::ParameterSetDescription &desc, edm::InputTag const &iAlg, edm::InputTag const &iExt, bool readPrescalesFromFile)
static void fillDescription(edm::ParameterSetDescription &desc)
Definition: L1GtUtils.h:137

◆ getL1PrescaleValue()

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 119 of file HLTPrescaleProvider.cc.

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

Referenced by prescaleValues().

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

◆ getL1PrescaleValueInDetail()

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 228 of file HLTPrescaleProvider.cc.

References funct::abs(), checkL1GtUtils(), checkL1TGlobalUtil(), GlobalLogicParser::checkLogicalExpression(), count_, countMax(), GCP_Ntuples_cfg::dump, mps_splice::entry, L1GtUtils::LogicalExpressionL1Results::errorCodes(), GlobalLogicParser::expressionSeedsOperandList(), hltConfigProvider_, HLTConfigProvider::hltL1GTSeeds(), HLTConfigProvider::hltL1TSeeds(), mps_fire::i, iEvent, L1GtUtils::LogicalExpressionL1Results::isValid(), l1GtUtils_, l1tGlobalDecisionKeyword_, l1tGlobalUtil_, HLTConfigProvider::l1tType(), LogDebug, L1GtUtils::LogicalExpressionL1Results::logicalExpressionRunUpdate(), L1GtUtils::LogicalExpressionL1Results::prescaleFactors(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, useL1EventSetup(), and useL1GtTriggerMenuLite().

Referenced by prescaleValuesInDetail().

229  {
230  std::vector<std::pair<std::string, double>> result;
231 
232  const unsigned int l1tType(hltConfigProvider_.l1tType());
233  if (l1tType == 1) {
234  checkL1GtUtils();
235 
236  const unsigned int nL1GTSeedModules(hltConfigProvider_.hltL1GTSeeds(trigger).size());
237  if (nL1GTSeedModules == 0) {
238  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
239  result.clear();
240  } else if (nL1GTSeedModules == 1) {
241  l1GtUtils_->getL1GtRunCache(iEvent, iSetup, useL1EventSetup, useL1GtTriggerMenuLite);
242  const std::string l1tname(hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second);
243  if (l1tname == l1tGlobalDecisionKeyword_) {
244  LogDebug("HLTPrescaleProvider") << "Undefined L1T prescales for HLT path: '" << trigger << "' with L1T seed '"
245  << l1tGlobalDecisionKeyword_ << "' (keyword for global decision of L1T)";
246  result.clear();
247  } else {
249  l1Logical.logicalExpressionRunUpdate(iEvent.getRun(), iSetup, l1tname);
250  const std::vector<std::pair<std::string, int>>& errorCodes(l1Logical.errorCodes(iEvent));
251  auto resultInt = l1Logical.prescaleFactors();
252  result.clear();
253  result.reserve(resultInt.size());
254  for (const auto& entry : resultInt) {
255  result.push_back(entry);
256  }
257  int l1error(l1Logical.isValid() ? 0 : 1);
258  for (auto const& errorCode : errorCodes) {
259  l1error += std::abs(errorCode.second);
260  }
261  if (l1error != 0) {
262  if (count_[3] < countMax) {
263  count_[3] += 1;
264  std::ostringstream message;
265  message << " Error in determining L1T prescales for HLT path: '" << trigger << "' with complex L1T seed: '"
266  << l1tname << "' using L1GtUtils: " << std::endl
267  << " isValid=" << l1Logical.isValid() << " l1tname/error/prescale " << errorCodes.size()
268  << std::endl;
269  for (unsigned int i = 0; i < errorCodes.size(); ++i) {
270  message << " " << i << ":" << errorCodes[i].first << "/" << errorCodes[i].second << "/"
271  << result[i].second;
272  }
273  message << ".";
274  edm::LogError("HLTPrescaleProvider") << message.str();
275  }
276  result.clear();
277  }
278  }
279  } else {
281  if (count_[4] < countMax) {
282  count_[4] += 1;
283  std::string dump("'" + hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second + "'");
284  for (unsigned int i = 1; i != nL1GTSeedModules; ++i) {
285  dump += " * '" + hltConfigProvider_.hltL1GTSeeds(trigger).at(i).second + "'";
286  }
287  edm::LogError("HLTPrescaleProvider")
288  << " Error in determining L1T prescale for HLT path: '" << trigger << "' has multiple L1GTSeed modules, "
289  << nL1GTSeedModules << ", with L1 seeds: " << dump
290  << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
291  }
292  result.clear();
293  }
294  } else if (l1tType == 2) {
296  const unsigned int nL1TSeedModules(hltConfigProvider_.hltL1TSeeds(trigger).size());
297  if (nL1TSeedModules == 0) {
298  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
299  result.clear();
300  } else if (nL1TSeedModules == 1) {
302  if (l1tname == l1tGlobalDecisionKeyword_) {
303  LogDebug("HLTPrescaleProvider") << "Undefined L1T prescales for HLT path: '" << trigger << "' with L1T seed '"
304  << l1tGlobalDecisionKeyword_ << "' (keyword for global decision of L1T)";
305  result.clear();
306  } else {
307  GlobalLogicParser l1tGlobalLogicParser = GlobalLogicParser(l1tname);
308  const std::vector<GlobalLogicParser::OperandToken> l1tSeeds = l1tGlobalLogicParser.expressionSeedsOperandList();
309  int l1error(0);
310  double l1tPrescale(-1);
311  result.clear();
312  result.reserve(l1tSeeds.size());
313  for (auto const& i : l1tSeeds) {
314  const string& l1tSeed = i.tokenName;
315  if (!l1tGlobalUtil_->getPrescaleByName(l1tSeed, l1tPrescale)) {
316  l1error += 1;
317  }
318  result.push_back(std::pair<std::string, double>(l1tSeed, l1tPrescale));
319  }
320  if (l1error != 0) {
321  if (count_[3] < countMax) {
322  count_[3] += 1;
323  string l1name = l1tname;
324  std::ostringstream message;
325  message << " Error in determining L1T prescales for HLT path: '" << trigger << "' with complex L1T seed: '"
326  << l1tname << "' using L1TGlobalUtil: " << std::endl
327  << " isValid=" << l1tGlobalLogicParser.checkLogicalExpression(l1name) << " l1tname/error/prescale "
328  << l1tSeeds.size() << std::endl;
329  for (unsigned int i = 0; i < l1tSeeds.size(); ++i) {
330  const string& l1tSeed = l1tSeeds[i].tokenName;
331  message << " " << i << ":" << l1tSeed << "/" << l1tGlobalUtil_->getPrescaleByName(l1tSeed, l1tPrescale)
332  << "/" << result[i].second;
333  }
334  message << ".";
335  edm::LogError("HLTPrescaleProvider") << message.str();
336  }
337  result.clear();
338  }
339  }
340  } else {
342  if (count_[4] < countMax) {
343  count_[4] += 1;
345  for (unsigned int i = 1; i != nL1TSeedModules; ++i) {
346  dump += " * '" + hltConfigProvider_.hltL1TSeeds(trigger).at(i) + "'";
347  }
348  edm::LogError("HLTPrescaleProvider")
349  << " Error in determining L1T prescale for HLT path: '" << trigger << "' has multiple L1TSeed modules, "
350  << nL1TSeedModules << ", with L1T seeds: " << dump
351  << ". (Note: at most one L1TSeed module is allowed for a proper determination of the L1T prescale!)";
352  }
353  result.clear();
354  }
355  } else {
356  if (count_[3] < countMax) {
357  count_[3] += 1;
358  edm::LogError("HLTPrescaleProvider") << " Unknown L1T Type " << l1tType << " - can not determine L1T prescale! ";
359  }
360  result.clear();
361  }
362 
363  return result;
364 }
HLTConfigProvider hltConfigProvider_
std::unique_ptr< L1GtUtils > l1GtUtils_
const std::vector< std::vector< std::string > > & hltL1TSeeds() const
Log< level::Error, false > LogError
std::vector< GlobalLogicParser::OperandToken > expressionSeedsOperandList()
static const unsigned char countMax(2)
unsigned int l1tType() const
L1T type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
int iEvent
Definition: GenABIO.cc:224
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
static const bool useL1GtTriggerMenuLite(false)
static constexpr const char * l1tGlobalDecisionKeyword_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool checkLogicalExpression(std::string &)
check a logical expression for correctness - add/remove spaces if needed
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_
unsigned char count_[5]
static const bool useL1EventSetup(true)
#define LogDebug(id)

◆ hltConfigProvider()

HLTConfigProvider const& HLTPrescaleProvider::hltConfigProvider ( ) const
inline

◆ init()

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 22 of file HLTPrescaleProvider.cc.

References checkL1GtUtils(), checkL1TGlobalUtil(), count_, hltConfigProvider_, HLTConfigProvider::init(), inited_, l1GtUtils_, l1tGlobalUtil_, HLTConfigProvider::l1tType(), SimL1EmulatorRepack_CalouGT_cff::processName, 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().

25  {
26  inited_ = true;
27 
28  count_[0] = 0;
29  count_[1] = 0;
30  count_[2] = 0;
31  count_[3] = 0;
32  count_[4] = 0;
33 
34  const bool result(hltConfigProvider_.init(iRun, iSetup, processName, changed));
35 
36  const unsigned int l1tType(hltConfigProvider_.l1tType());
37  if (l1tType == 1) {
40  l1GtUtils_->getL1GtRunCache(iRun, iSetup, useL1EventSetup, useL1GtTriggerMenuLite);
41  } else if (l1tType == 2) {
43  l1tGlobalUtil_->retrieveL1Setup(iSetup);
44  } else {
45  edm::LogError("HLTPrescaleProvider") << " Unknown L1T Type " << l1tType << " - prescales will not be avaiable!";
46  }
47 
48  return result;
49 }
HLTConfigProvider hltConfigProvider_
std::unique_ptr< L1GtUtils > l1GtUtils_
Log< level::Error, false > LogError
unsigned int l1tType() const
L1T type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
static const bool useL1GtTriggerMenuLite(false)
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()

L1GtUtils const & HLTPrescaleProvider::l1GtUtils ( ) const

Definition at line 51 of file HLTPrescaleProvider.cc.

References checkL1GtUtils(), and l1GtUtils_.

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

51  {
53  return *l1GtUtils_;
54 }
std::unique_ptr< L1GtUtils > l1GtUtils_

◆ l1PrescaleDenominator()

static int HLTPrescaleProvider::l1PrescaleDenominator ( )
inlinestatic

Definition at line 95 of file HLTPrescaleProvider.h.

References kL1PrescaleDenominator_.

95 { return kL1PrescaleDenominator_; }
static constexpr int kL1PrescaleDenominator_

◆ l1tGlobalUtil()

l1t::L1TGlobalUtil const & HLTPrescaleProvider::l1tGlobalUtil ( ) const

Definition at line 56 of file HLTPrescaleProvider.cc.

References checkL1TGlobalUtil(), and l1tGlobalUtil_.

56  {
58  return *l1tGlobalUtil_;
59 }
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_

◆ prescaleSet()

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 61 of file HLTPrescaleProvider.cc.

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

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

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

◆ prescaleValue()

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 64 of file HLTPrescaleProvider.h.

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

Referenced by HLTPrescaleExample::analyze().

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

◆ prescaleValues()

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 73 of file HLTPrescaleProvider.h.

References getL1PrescaleValue(), and iEvent.

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

75  {
76  return {convertL1PS<TL1>(getL1PrescaleValue(iEvent, iSetup, trigger)),
77  prescaleValue<THLT>(iEvent, iSetup, trigger)};
78  }
double getL1PrescaleValue(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
int iEvent
Definition: GenABIO.cc:224

◆ prescaleValuesInDetail()

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 83 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().

85  {
86  std::pair<std::vector<std::pair<std::string, TL1>>, THLT> retval;
87  for (auto& entry : getL1PrescaleValueInDetail(iEvent, iSetup, trigger)) {
88  retval.first.emplace_back(std::move(entry.first), convertL1PS<TL1>(entry.second));
89  }
90  retval.second = prescaleValue<THLT>(iEvent, iSetup, trigger);
91  return retval;
92  }
int iEvent
Definition: GenABIO.cc:224
std::vector< std::pair< std::string, double > > getL1PrescaleValueInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
def move(src, dest)
Definition: eostools.py:511

◆ rejectedByHLTPrescaler()

bool HLTPrescaleProvider::rejectedByHLTPrescaler ( const edm::TriggerResults triggerResults,
unsigned int  i 
) const

Definition at line 366 of file HLTPrescaleProvider.cc.

References hltConfigProvider_, mps_fire::i, HLTConfigProvider::moduleLabel(), HLTConfigProvider::moduleType(), and triggerResults.

366  {
367  return hltConfigProvider_.moduleType(hltConfigProvider_.moduleLabel(i, triggerResults.index(i))) == "HLTPrescaler";
368 }
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
static std::string const triggerResults
Definition: EdmProvDump.cc:47

Member Data Documentation

◆ count_

unsigned char HLTPrescaleProvider::count_[5] = {0, 0, 0, 0, 0}
private

◆ hltConfigProvider_

HLTConfigProvider HLTPrescaleProvider::hltConfigProvider_
private

◆ inited_

bool HLTPrescaleProvider::inited_ = false
private

Definition at line 135 of file HLTPrescaleProvider.h.

Referenced by init(), and prescaleSet().

◆ kL1PrescaleDenominator_

constexpr int HLTPrescaleProvider::kL1PrescaleDenominator_ = 100
staticprivate

Definition at line 127 of file HLTPrescaleProvider.h.

Referenced by convertL1PS(), and l1PrescaleDenominator().

◆ l1GtUtils_

std::unique_ptr<L1GtUtils> HLTPrescaleProvider::l1GtUtils_
private

◆ l1tGlobalDecisionKeyword_

constexpr const char* HLTPrescaleProvider::l1tGlobalDecisionKeyword_ = "L1GlobalDecision"
staticprivate

Definition at line 104 of file HLTPrescaleProvider.h.

Referenced by getL1PrescaleValue(), and getL1PrescaleValueInDetail().

◆ l1tGlobalUtil_

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