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

unsigned char count_ [5] = {0,0,0,0,0}
 
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 86 of file HLTPrescaleProvider.h.

88  :
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 92 of file HLTPrescaleProvider.h.

94  :
95  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 count_, L1GtUtils::getL1GtRunCache(), hltConfigProvider_, HLTConfigProvider::init(), l1GtUtils_, useL1EventSetup(), and useL1GtTriggerMenuLite().

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

22  {
23 
24  count_[0]=0;
25  count_[1]=0;
26  count_[2]=0;
27  count_[3]=0;
28  count_[4]=0;
29 
32 
33  return hltConfigProvider_.init(iRun, iSetup, processName, changed);
34 }
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
unsigned char count_[5]
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 36 of file HLTPrescaleProvider.cc.

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

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

36  {
37  // return hltPrescaleTable_.set();
39  int errorTech(0);
40  const int psfsiTech(l1GtUtils_.prescaleFactorSetIndex(iEvent,L1GtUtils::TechnicalTrigger,errorTech));
41  int errorPhys(0);
42  const int psfsiPhys(l1GtUtils_.prescaleFactorSetIndex(iEvent,L1GtUtils::AlgorithmTrigger,errorPhys));
43  assert(psfsiTech==psfsiPhys);
44  if ( (errorTech==0) && (errorPhys==0) &&
45  (psfsiTech>=0) && (psfsiPhys>=0) && (psfsiTech==psfsiPhys) ) {
46  return psfsiPhys;
47  } else {
49  if (count_[0]<2) {
50  count_[0] += 1;
51  edm::LogError("HLTConfigData")
52  << " Error in determining HLT prescale set index from L1 data using L1GtUtils: "
53  << " Tech/Phys error = " << errorTech << "/" << errorPhys
54  << " Tech/Phys psfsi = " << psfsiTech << "/" << psfsiPhys;
55  }
56  return -1;
57  }
58 }
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
unsigned char count_[5]
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 60 of file HLTPrescaleProvider.cc.

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

62  {
63  const int set(prescaleSet(iEvent,iSetup));
64  if (set<0) {
65  return 1;
66  } else {
67  return hltConfigProvider_.prescaleValue(static_cast<unsigned int>(set),trigger);
68  }
69 }
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 72 of file HLTPrescaleProvider.cc.

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

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

74  {
75 
76  // start with setting both L1T and HLT prescale values to 0
77  std::pair<int,int> result(std::pair<int,int>(0,0));
78 
79  // get HLT prescale (possible if HLT prescale set index is correctly found)
80  const int set(prescaleSet(iEvent,iSetup));
81  if (set<0) {
82  result.second = -1;
83  } else {
84  result.second = static_cast<int>(hltConfigProvider_.prescaleValue(static_cast<unsigned int>(set),trigger));
85  }
86 
87  // get L1T prescale - works only for those hlt trigger paths with
88  // exactly one L1GT seed module which has exactly one L1T name as seed
89  const unsigned int nL1GTSeedModules(hltConfigProvider_.hltL1GTSeeds(trigger).size());
90  if (nL1GTSeedModules==0) {
91  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
92  result.first=1;
93  } else if (nL1GTSeedModules==1) {
95  const std::string l1tname(hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second);
96  int l1error(0);
97  result.first = l1GtUtils_.prescaleFactor(iEvent,l1tname,l1error);
98  if (l1error!=0) {
99  if (count_[1]<2) {
100  count_[1] += 1;
101  edm::LogError("HLTConfigData")
102  << " Error in determining L1T prescale for HLT path: '" << trigger
103  << "' with L1T seed: '" << l1tname
104  << "' using L1GtUtils: error code = " << l1error << "." << std::endl
105  << " Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number) is allowed as seed!"
106  << std::endl
107  << " For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'."<< std::endl;
108  }
109  result.first = -1;
110  }
111  } else {
113  if (count_[2]<2) {
114  count_[2] += 1;
115  std::string dump("'"+hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second+"'");
116  for (unsigned int i=1; i!=nL1GTSeedModules; ++i) {
117  dump += " * '"+hltConfigProvider_.hltL1GTSeeds(trigger).at(i).second+"'";
118  }
119  edm::LogError("HLTConfigData")
120  << " Error in determining L1T prescale for HLT path: '" << trigger
121  << "' has multiple L1GTSeed modules, " << nL1GTSeedModules
122  << ", with L1 seeds: " << dump
123  << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
124  }
125  result.first = -1;
126  }
127 
128  return result;
129 }
HLTConfigProvider hltConfigProvider_
int i
Definition: DBlmapReader.cc:9
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
tuple result
Definition: mps_fire.py:95
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)
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
unsigned char count_[5]
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 132 of file HLTPrescaleProvider.cc.

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

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

134  {
135 
136  std::pair<std::vector<std::pair<std::string,int> >,int> result;
137  result.first.clear();
138 
139  // get HLT prescale (possible if HLT prescale set index is correctly found)
140  const int set(prescaleSet(iEvent,iSetup));
141  if (set<0) {
142  result.second = -1;
143  } else {
144  result.second = static_cast<int>(hltConfigProvider_.prescaleValue(static_cast<unsigned int>(set),trigger));
145  }
146 
147  // get L1T prescale - works only for those hlt trigger paths with
148  // exactly one L1GT seed module which has exactly one L1T name as seed
149  const unsigned int nL1GTSeedModules(hltConfigProvider_.hltL1GTSeeds(trigger).size());
150  if (nL1GTSeedModules==0) {
151  // no L1 seed module on path hence no L1 seed hence formally no L1 prescale
152  result.first.clear();
153  } else if (nL1GTSeedModules==1) {
155  const std::string l1tname(hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second);
157  l1Logical.logicalExpressionRunUpdate(iEvent.getRun(),iSetup,l1tname);
158  const std::vector<std::pair<std::string, int> >& errorCodes(l1Logical.errorCodes(iEvent));
159  result.first = l1Logical.prescaleFactors();
160  int l1error(l1Logical.isValid() ? 0 : 1);
161  for (unsigned int i=0; i<errorCodes.size(); ++i) {
162  l1error += std::abs(errorCodes[i].second);
163  }
164  if (l1error!=0) {
165  if (count_[3]<2) {
166  count_[3] += 1;
167  std::ostringstream message;
168  message
169  << " Error in determining L1T prescales for HLT path: '" << trigger
170  << "' with complex L1T seed: '" << l1tname
171  << "' using L1GtUtils: " << std::endl
172  << " isValid=" << l1Logical.isValid()
173  << " l1tname/error/prescale " << errorCodes.size()
174  << std::endl;
175  for (unsigned int i=0; i< errorCodes.size(); ++i) {
176  message << " " << i << ":" << errorCodes[i].first << "/" << errorCodes[i].second << "/"
177  << result.first[i].second;
178  }
179  message << ".";
180  edm::LogError("HLTConfigData") << message.str();
181  }
182  result.first.clear();
183  }
184  } else {
186  if (count_[4]<2) {
187  count_[4] += 1;
188  std::string dump("'"+hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second+"'");
189  for (unsigned int i=1; i!=nL1GTSeedModules; ++i) {
190  dump += " * '"+hltConfigProvider_.hltL1GTSeeds(trigger).at(i).second+"'";
191  }
192  edm::LogError("HLTConfigData")
193  << " Error in determining L1T prescale for HLT path: '" << trigger
194  << "' has multiple L1GTSeed modules, " << nL1GTSeedModules
195  << ", with L1 seeds: " << dump
196  << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
197  }
198  result.first.clear();
199  }
200 
201  return result;
202 }
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:65
tuple result
Definition: mps_fire.py:95
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)
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
unsigned char count_[5]
static const bool useL1EventSetup(true)

Member Data Documentation

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

Definition at line 81 of file HLTPrescaleProvider.h.

Referenced by init(), prescaleSet(), prescaleValues(), and prescaleValuesInDetail().

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