CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | 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
 
int prescaleSet (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
unsigned int prescaleValue (const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
 combining the two methods above More...
 
std::pair< int, int > 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...
 
std::pair< std::vector
< std::pair< std::string, int >
>, int > 
prescaleValuesInDetail (const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
 

Private Attributes

HLTConfigProvider hltConfigProvider_
 
L1GtUtils l1GtUtils_
 

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

Constructor & Destructor Documentation

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

Definition at line 84 of file HLTPrescaleProvider.h.

86  :
87  HLTPrescaleProvider(pset, iC, module) { }
HLTPrescaleProvider(edm::ParameterSet const &pset, edm::ConsumesCollector &&iC, T &module)
Definition: vlib.h:208
template<typename T >
HLTPrescaleProvider::HLTPrescaleProvider ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module 
)

Definition at line 90 of file HLTPrescaleProvider.h.

92  :
93  l1GtUtils_(pset, iC, false, module) { }
Definition: vlib.h:208

Member Function Documentation

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

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

Definition at line 19 of file HLTPrescaleProvider.cc.

References L1GtUtils::getL1GtRunCache(), hltConfigProvider_, HLTConfigProvider::init(), l1GtUtils_, useL1EventSetup(), and useL1GtTriggerMenuLite().

Referenced by CandidateTriggerObjectProducer::beginRun(), HLTEventAnalyzerAOD::beginRun(), pat::PATTriggerProducer::beginRun(), IsoTrig::beginRun(), IsoTrackCalib::beginRun(), TriggerJSONMonitoring::beginRun(), GammaJetAnalysis::beginRun(), EwkElecDQM::dqmBeginRun(), and EwkMuDQM::dqmBeginRun().

22  {
23 
26 
27  return hltConfigProvider_.init(iRun, iSetup, processName, changed);
28 }
HLTConfigProvider hltConfigProvider_
static const bool useL1GtTriggerMenuLite(false)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool)
get all the run-constant quantities for L1 trigger and cache them
Definition: L1GtUtils.cc:319
static const bool useL1EventSetup(true)
L1GtUtils const& HLTPrescaleProvider::l1GtUtils ( ) const
inline

Definition at line 54 of file HLTPrescaleProvider.h.

References l1GtUtils_.

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

54 { return l1GtUtils_; }
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 30 of file HLTPrescaleProvider.cc.

References L1GtUtils::AlgorithmTrigger, assert(), L1GtUtils::getL1GtRunCache(), l1GtUtils_, L1GtUtils::prescaleFactorSetIndex(), L1GtUtils::TechnicalTrigger, useL1EventSetup(), and useL1GtTriggerMenuLite().

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

30  {
31  // return hltPrescaleTable_.set();
33  int errorTech(0);
34  const int psfsiTech(l1GtUtils_.prescaleFactorSetIndex(iEvent,L1GtUtils::TechnicalTrigger,errorTech));
35  int errorPhys(0);
36  const int psfsiPhys(l1GtUtils_.prescaleFactorSetIndex(iEvent,L1GtUtils::AlgorithmTrigger,errorPhys));
37  assert(psfsiTech==psfsiPhys);
38  if ( (errorTech==0) && (errorPhys==0) &&
39  (psfsiTech>=0) && (psfsiPhys>=0) && (psfsiTech==psfsiPhys) ) {
40  return psfsiPhys;
41  } else {
43  edm::LogError("HLTConfigData")
44  << " Error in determining HLT prescale set index from L1 data using L1GtUtils: "
45  << " Tech/Phys error = " << errorTech << "/" << errorPhys
46  << " Tech/Phys psfsi = " << psfsiTech << "/" << psfsiPhys;
47  return -1;
48  }
49 }
const int prescaleFactorSetIndex(const edm::Event &iEvent, const TriggerCategory &trigCategory, int &errorCode) const
Definition: L1GtUtils.cc:1458
assert(m_qm.get())
static const bool useL1GtTriggerMenuLite(false)
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool)
get all the run-constant quantities for L1 trigger and cache them
Definition: L1GtUtils.cc:319
static const bool useL1EventSetup(true)
unsigned int HLTPrescaleProvider::prescaleValue ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  trigger 
)

combining the two methods above

Definition at line 51 of file HLTPrescaleProvider.cc.

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

53  {
54  const int set(prescaleSet(iEvent,iSetup));
55  if (set<0) {
56  return 1;
57  } else {
58  return hltConfigProvider_.prescaleValue(static_cast<unsigned int>(set),trigger);
59  }
60 }
HLTConfigProvider hltConfigProvider_
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::pair< int, int > HLTPrescaleProvider::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.

error - can't handle properly multiple L1GTSeed modules

Definition at line 63 of file HLTPrescaleProvider.cc.

References hcal_timing_source_file_cfg::dump, L1GtUtils::getL1GtRunCache(), hltConfigProvider_, HLTConfigProvider::hltL1GTSeeds(), i, l1GtUtils_, L1GtUtils::prescaleFactor(), prescaleSet(), HLTConfigProvider::prescaleValue(), query::result, AlCaHLTBitMon_QueryRunRegistry::string, useL1EventSetup(), and useL1GtTriggerMenuLite().

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

65  {
66 
67  // start with setting both L1T and HLT prescale values to 0
68  std::pair<int,int> result(std::pair<int,int>(0,0));
69 
70  // get HLT prescale (possible if HLT prescale set index is correctly found)
71  const int set(prescaleSet(iEvent,iSetup));
72  if (set<0) {
73  result.second = -1;
74  } else {
75  result.second = static_cast<int>(hltConfigProvider_.prescaleValue(static_cast<unsigned int>(set),trigger));
76  }
77 
78  // get L1T prescale - works only for those hlt trigger paths with
79  // exactly one L1GT seed module which has exactly one L1T name as seed
80  const unsigned int nL1GTSeedModules(hltConfigProvider_.hltL1GTSeeds(trigger).size());
81  if (nL1GTSeedModules==0) {
82  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
83  result.first=1;
84  } else if (nL1GTSeedModules==1) {
86  const std::string l1tname(hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second);
87  int l1error(0);
88  result.first = l1GtUtils_.prescaleFactor(iEvent,l1tname,l1error);
89  if (l1error!=0) {
90  edm::LogError("HLTConfigData")
91  << " Error in determining L1T prescale for HLT path: '" << trigger
92  << "' with L1T seed: '" << l1tname
93  << "' using L1GtUtils: error code = " << l1error << "." << std::endl
94  << " Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number) is allowed as seed!"
95  << std::endl
96  << " For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'."<< std::endl;
97  result.first = -1;
98  }
99  } else {
101  std::string dump("'"+hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second+"'");
102  for (unsigned int i=1; i!=nL1GTSeedModules; ++i) {
103  dump += " * '"+hltConfigProvider_.hltL1GTSeeds(trigger).at(i).second+"'";
104  }
105  edm::LogError("HLTConfigData")
106  << " Error in determining L1T prescale for HLT path: '" << trigger
107  << "' has multiple L1GTSeed modules, " << nL1GTSeedModules
108  << ", with L1 seeds: " << dump
109  << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
110  result.first = -1;
111  }
112 
113  return result;
114 }
HLTConfigProvider hltConfigProvider_
int i
Definition: DBlmapReader.cc:9
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
static const bool useL1GtTriggerMenuLite(false)
tuple result
Definition: query.py:137
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool)
get all the run-constant quantities for L1 trigger and cache them
Definition: L1GtUtils.cc:319
static const bool useL1EventSetup(true)
const int prescaleFactor(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return prescale factor for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1223
std::pair< std::vector< std::pair< std::string, int > >, int > HLTPrescaleProvider::prescaleValuesInDetail ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  trigger 
)

error - can't handle properly multiple L1GTSeed modules

Definition at line 117 of file HLTPrescaleProvider.cc.

References funct::abs(), hcal_timing_source_file_cfg::dump, L1GtUtils::getL1GtRunCache(), edm::Event::getRun(), hltConfigProvider_, HLTConfigProvider::hltL1GTSeeds(), i, l1GtUtils_, python.rootplot.argparse::message, prescaleSet(), HLTConfigProvider::prescaleValue(), query::result, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, useL1EventSetup(), and useL1GtTriggerMenuLite().

Referenced by HLTEventAnalyzerAOD::analyzeTrigger(), and pat::PATTriggerProducer::produce().

119  {
120 
121  std::pair<std::vector<std::pair<std::string,int> >,int> result;
122  result.first.clear();
123 
124  // get HLT prescale (possible if HLT prescale set index is correctly found)
125  const int set(prescaleSet(iEvent,iSetup));
126  if (set<0) {
127  result.second = -1;
128  } else {
129  result.second = static_cast<int>(hltConfigProvider_.prescaleValue(static_cast<unsigned int>(set),trigger));
130  }
131 
132  // get L1T prescale - works only for those hlt trigger paths with
133  // exactly one L1GT seed module which has exactly one L1T name as seed
134  const unsigned int nL1GTSeedModules(hltConfigProvider_.hltL1GTSeeds(trigger).size());
135  if (nL1GTSeedModules==0) {
136  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
137  result.first.clear();
138  } else if (nL1GTSeedModules==1) {
140  const std::string l1tname(hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second);
142  l1Logical.logicalExpressionRunUpdate(iEvent.getRun(),iSetup,l1tname);
143  const std::vector<std::pair<std::string, int> >& errorCodes(l1Logical.errorCodes(iEvent));
144  result.first = l1Logical.prescaleFactors();
145  int l1error(l1Logical.isValid() ? 0 : 1);
146  for (unsigned int i=0; i<errorCodes.size(); ++i) {
147  l1error += std::abs(errorCodes[i].second);
148  }
149  if (l1error!=0) {
150  std::ostringstream message;
151  message
152  << " Error in determining L1T prescales for HLT path: '" << trigger
153  << "' with complex L1T seed: '" << l1tname
154  << "' using L1GtUtils: " << std::endl
155  << " isValid=" << l1Logical.isValid()
156  << " l1tname/error/prescale " << errorCodes.size()
157  << std::endl;
158  for (unsigned int i=0; i< errorCodes.size(); ++i) {
159  message << " " << i << ":" << errorCodes[i].first << "/" << errorCodes[i].second << "/"
160  << result.first[i].second;
161  }
162  message << ".";
163  edm::LogError("HLTConfigData") << message.str();
164  result.first.clear();
165  }
166  } else {
168  std::string dump("'"+hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second+"'");
169  for (unsigned int i=1; i!=nL1GTSeedModules; ++i) {
170  dump += " * '"+hltConfigProvider_.hltL1GTSeeds(trigger).at(i).second+"'";
171  }
172  edm::LogError("HLTConfigData")
173  << " Error in determining L1T prescale for HLT path: '" << trigger
174  << "' has multiple L1GTSeed modules, " << nL1GTSeedModules
175  << ", with L1 seeds: " << dump
176  << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
177  result.first.clear();
178  }
179 
180  return result;
181 }
HLTConfigProvider hltConfigProvider_
int i
Definition: DBlmapReader.cc:9
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
Run const & getRun() const
Definition: Event.cc:63
U second(std::pair< T, U > const &p)
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
static const bool useL1GtTriggerMenuLite(false)
tuple result
Definition: query.py:137
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool)
get all the run-constant quantities for L1 trigger and cache them
Definition: L1GtUtils.cc:319
static const bool useL1EventSetup(true)

Member Data Documentation

HLTConfigProvider HLTPrescaleProvider::hltConfigProvider_
private
L1GtUtils HLTPrescaleProvider::l1GtUtils_
private