CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
GenericTriggerEventFlag Class Reference

Provides a code based selection for trigger and DCS information in order to have no failing filters in the CMSSW path. More...

#include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"

Public Member Functions

bool accept (const edm::Event &event, const edm::EventSetup &setup)
 To be called from analyze/filter() methods. More...
 
bool allHLTPathsAreValid () const
 
std::vector< std::string > expressionsFromDB (const std::string &key, const edm::EventSetup &setup)
 Reads and returns logical expressions from DB. More...
 
 GenericTriggerEventFlag (const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
 
 GenericTriggerEventFlag (const edm::ParameterSet &config, edm::ConsumesCollector &iC)
 
template<typename T >
 GenericTriggerEventFlag (const edm::ParameterSet &config, edm::ConsumesCollector &&iC, T &module)
 
template<typename T >
 GenericTriggerEventFlag (const edm::ParameterSet &config, edm::ConsumesCollector &iC, T &module)
 
std::string gtDBKey ()
 
std::string hltDBKey ()
 
void initRun (const edm::Run &run, const edm::EventSetup &setup)
 To be called from beginRun() methods. More...
 
std::string l1DBKey ()
 
bool off ()
 
bool on ()
 

Private Member Functions

bool acceptDcs (const edm::Event &event)
 
bool acceptDcsPartition (const edm::Handle< DcsStatusCollection > &dcsStatus, int dcsPartition) const
 
bool acceptGt (const edm::Event &event)
 Does this event fulfill the configured GT status logical expression combination? More...
 
bool acceptGtLogicalExpression (const edm::Event &event, std::string gtLogicalExpression)
 Does this event fulfill this particular GT status bits' logical expression? More...
 
bool acceptHlt (const edm::Event &event)
 Was this event accepted by the configured HLT logical expression combination? More...
 
bool acceptHltLogicalExpression (const edm::Handle< edm::TriggerResults > &hltTriggerResults, std::string hltLogicalExpression) const
 Was this event accepted by this particular HLT paths' logical expression? More...
 
bool acceptL1 (const edm::Event &event, const edm::EventSetup &setup)
 Was this event accepted by the configured L1 logical expression combination? More...
 
bool acceptL1LogicalExpression (const edm::Event &event, const edm::EventSetup &setup, std::string l1LogicalExpression)
 Was this event accepted by this particular L1 algorithms' logical expression? More...
 
std::string expandLogicalExpression (const std::vector< std::string > &target, const std::string &expr, bool useAnd=false) const
 Expand wild-carded logical expressions, giving version postfixes priority. More...
 
 GenericTriggerEventFlag (const edm::ParameterSet &config, edm::ConsumesCollector &iC, bool stage1Valid)
 To be called from the ED module's c'tor. More...
 
bool negate (std::string &word) const
 Checks for negated words. More...
 

Private Attributes

bool andOr_
 
bool andOrDcs_
 
bool andOrGt_
 
bool andOrHlt_
 
bool andOrL1_
 
const std::string configError_
 
std::string dbLabel_
 
edm::InputTag dcsInputTag_
 
edm::EDGetTokenT< DcsStatusCollectiondcsInputToken_
 
std::vector< int > dcsPartitions_
 
const std::string emptyKeyError_
 
bool errorReplyDcs_
 
bool errorReplyGt_
 
bool errorReplyHlt_
 
bool errorReplyL1_
 
std::string gtDBKey_
 
edm::InputTag gtEvmInputTag_
 
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecordgtEvmInputToken_
 
edm::InputTag gtInputTag_
 
edm::EDGetTokenT< L1GlobalTriggerReadoutRecordgtInputToken_
 
std::vector< std::string > gtLogicalExpressions_
 
HLTConfigProvider hltConfig_
 
bool hltConfigInit_
 
std::string hltDBKey_
 
edm::InputTag hltInputTag_
 
edm::EDGetTokenT< edm::TriggerResultshltInputToken_
 
std::vector< std::string > hltLogicalExpressions_
 
std::vector< std::string > hltLogicalExpressionsCache_
 
bool l1BeforeMask_
 
std::string l1DBKey_
 
std::unique_ptr< L1GtUtilsl1Gt_
 
std::vector< std::string > l1LogicalExpressions_
 
std::vector< std::string > l1LogicalExpressionsCache_
 
std::unique_ptr< l1t::L1TGlobalUtill1uGt_
 
bool on_
 
bool onDcs_
 
bool onGt_
 
bool onHlt_
 
bool onL1_
 
bool stage2_
 
unsigned verbose_
 
std::unique_ptr< edm::ESWatcher< AlCaRecoTriggerBitsRcd > > watchDB_
 

Detailed Description

Provides a code based selection for trigger and DCS information in order to have no failing filters in the CMSSW path.

[...]

Author
Volker Adler
Version
Id
GenericTriggerEventFlag.h,v 1.5 2012/01/19 20:17:34 vadler Exp

Definition at line 38 of file GenericTriggerEventFlag.h.

Constructor & Destructor Documentation

GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 94 of file GenericTriggerEventFlag.h.

Referenced by off().

95  : GenericTriggerEventFlag(config, iC) {}
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector iC 
)

Definition at line 21 of file GenericTriggerEventFlag.cc.

References edm::ParameterSet::exists(), l1uGt_, and stage2_.

22  : GenericTriggerEventFlag(config, iC, false) {
23  if (config.exists("andOrL1")) {
24  if (stage2_) {
25  l1uGt_.reset(new l1t::L1TGlobalUtil(config, iC));
26  }
27  }
28 }
bool exists(std::string const &parameterName) const
checks if a parameter exists
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
std::unique_ptr< l1t::L1TGlobalUtil > l1uGt_
template<typename T >
GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector &&  iC,
T module 
)

Definition at line 153 of file GenericTriggerEventFlag.h.

156  : GenericTriggerEventFlag(config, iC, module) {}
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
Definition: vlib.h:198
template<typename T >
GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector iC,
T module 
)

Definition at line 159 of file GenericTriggerEventFlag.h.

References looper::config, edm::ParameterSet::exists(), l1Gt_, l1uGt_, and stage2_.

160  : GenericTriggerEventFlag(config, iC, true) {
161  if (config.exists("andOrL1")) {
162  if (stage2_) {
163  l1uGt_ = std::make_unique<l1t::L1TGlobalUtil>(config, iC);
164  } else {
165  l1Gt_ = std::make_unique<L1GtUtils>(config, iC, false, module);
166  }
167  }
168  //these pointers are already null so no need to reset them to a nullptr
169  //if andOrL1 doesnt exist
170 }
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::unique_ptr< L1GtUtils > l1Gt_
config
Definition: looper.py:291
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
Definition: vlib.h:198
std::unique_ptr< l1t::L1TGlobalUtil > l1uGt_
GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector iC,
bool  stage1Valid 
)
private

To be called from the ED module's c'tor.

Definition at line 31 of file GenericTriggerEventFlag.cc.

References andOr_, andOrDcs_, andOrGt_, andOrHlt_, andOrL1_, dbLabel_, dcsInputTag_, dcsInputToken_, dcsPartitions_, errorReplyDcs_, errorReplyGt_, errorReplyHlt_, errorReplyL1_, Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), gtDBKey_, gtEvmInputTag_, gtEvmInputToken_, gtInputTag_, gtInputToken_, gtLogicalExpressions_, hltDBKey_, hltInputTag_, hltInputToken_, hltLogicalExpressionsCache_, l1BeforeMask_, l1DBKey_, l1LogicalExpressionsCache_, edm::ConsumesCollector::mayConsume(), on_, onDcs_, onGt_, onHlt_, onL1_, stage2_, AlCaHLTBitMon_QueryRunRegistry::string, verbose_, and watchDB_.

34  : watchDB_(),
35  hltConfigInit_(false),
36  andOr_(false),
37  dbLabel_(""),
38  verbose_(0),
39  andOrDcs_(false),
40  errorReplyDcs_(false),
41  andOrGt_(false),
42  gtInputTag_(""),
43  gtEvmInputTag_(""),
44  gtDBKey_(""),
45  errorReplyGt_(false),
46  andOrL1_(false),
47  stage2_(false),
48  l1BeforeMask_(true),
49  l1DBKey_(""),
50  errorReplyL1_(false),
51  andOrHlt_(false),
52  hltDBKey_(""),
53  errorReplyHlt_(false),
54  on_(true),
55  onDcs_(true),
56  onGt_(true),
57  onL1_(true),
58  onHlt_(true),
59  configError_("CONFIG_ERROR"),
60  emptyKeyError_("EMPTY_KEY_ERROR") {
61  // General switch(es)
62  if (config.exists("andOr")) {
63  andOr_ = config.getParameter<bool>("andOr");
64  if (config.exists("verbosityLevel"))
65  verbose_ = config.getParameter<unsigned>("verbosityLevel");
66  } else {
67  on_ = false;
68  onDcs_ = false;
69  onGt_ = false;
70  onL1_ = false;
71  onHlt_ = false;
72  }
73 
74  if (on_) {
75  if (config.exists("andOrDcs")) {
76  andOrDcs_ = config.getParameter<bool>("andOrDcs");
77  dcsInputTag_ = config.getParameter<edm::InputTag>("dcsInputTag");
79  dcsPartitions_ = config.getParameter<std::vector<int> >("dcsPartitions");
80  errorReplyDcs_ = config.getParameter<bool>("errorReplyDcs");
81  } else {
82  onDcs_ = false;
83  }
84  if (config.exists("andOrGt")) {
85  andOrGt_ = config.getParameter<bool>("andOrGt");
86  gtInputTag_ = config.getParameter<edm::InputTag>("gtInputTag");
88  gtLogicalExpressions_ = config.getParameter<std::vector<std::string> >("gtStatusBits");
89  errorReplyGt_ = config.getParameter<bool>("errorReplyGt");
90  if (config.exists("gtEvmInputTag")) {
91  gtEvmInputTag_ = config.getParameter<edm::InputTag>("gtEvmInputTag");
93  }
94  if (config.exists("gtDBKey"))
95  gtDBKey_ = config.getParameter<std::string>("gtDBKey");
96  } else {
97  onGt_ = false;
98  }
99  if (config.exists("andOrL1")) {
100  andOrL1_ = config.getParameter<bool>("andOrL1");
101  if (config.exists("stage2"))
102  stage2_ = config.getParameter<bool>("stage2");
103  else
104  stage2_ = false;
105  l1LogicalExpressionsCache_ = config.getParameter<std::vector<std::string> >("l1Algorithms");
106  errorReplyL1_ = config.getParameter<bool>("errorReplyL1");
107  if (config.exists("l1DBKey"))
108  l1DBKey_ = config.getParameter<std::string>("l1DBKey");
109  if (config.exists("l1BeforeMask"))
110  l1BeforeMask_ = config.getParameter<bool>("l1BeforeMask");
111  } else {
112  onL1_ = false;
113  }
114  if (config.exists("andOrHlt")) {
115  andOrHlt_ = config.getParameter<bool>("andOrHlt");
116  hltInputTag_ = config.getParameter<edm::InputTag>("hltInputTag");
118  hltLogicalExpressionsCache_ = config.getParameter<std::vector<std::string> >("hltPaths");
119  errorReplyHlt_ = config.getParameter<bool>("errorReplyHlt");
120  if (config.exists("hltDBKey"))
121  hltDBKey_ = config.getParameter<std::string>("hltDBKey");
122  } else {
123  onHlt_ = false;
124  }
125  if (!onDcs_ && !onGt_ && !onL1_ && !onHlt_)
126  on_ = false;
127  else {
128  if (config.exists("dbLabel"))
129  dbLabel_ = config.getParameter<std::string>("dbLabel");
130  watchDB_ = std::make_unique<edm::ESWatcher<AlCaRecoTriggerBitsRcd> >();
131  }
132  }
133  //check to see we arent trying to setup legacy / stage-1 from a constructor call
134  //that does not support it
135  if (config.exists("andOrL1") && stage2_ == false) { //stage-1 setup
136  if (stage1Valid == false)
137  throw cms::Exception("ConfigError") << " Error when constructing GenericTriggerEventFlag, legacy/stage-1 is "
138  "requested but the constructor called is stage2 only";
139  }
140 }
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtInputToken_
T getParameter(std::string const &) const
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
std::vector< std::string > gtLogicalExpressions_
edm::EDGetTokenT< DcsStatusCollection > dcsInputToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::TriggerResults > hltInputToken_
std::vector< std::string > l1LogicalExpressionsCache_
std::vector< DcsStatus > DcsStatusCollection
Definition: DcsStatus.h:110
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > gtEvmInputToken_
std::vector< std::string > hltLogicalExpressionsCache_
std::vector< int > dcsPartitions_
std::unique_ptr< edm::ESWatcher< AlCaRecoTriggerBitsRcd > > watchDB_

Member Function Documentation

bool GenericTriggerEventFlag::accept ( const edm::Event event,
const edm::EventSetup setup 
)

To be called from analyze/filter() methods.

Definition at line 257 of file GenericTriggerEventFlag.cc.

References acceptDcs(), acceptGt(), acceptHlt(), acceptL1(), andOr_, and on_.

Referenced by dEdxAnalyzer::analyze(), dEdxHitAnalyzer::analyze(), SiStripMonitorCluster::analyze(), MonitorTrackResidualsBase< pixel_or_strip >::analyze(), TagAndProbeBtagTriggerMonitor::analyze(), LogMessageMonitor::analyze(), V0Monitor::analyze(), TrackingMonitor::analyze(), SiStripMonitorTrack::analyze(), BPHMonitor::analyze(), Vispa.Gui.BoxContentDialog.BoxContentDialog::apply(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog::apply(), HLTDQMTagAndProbeEff< TagType, TagCollType, ProbeType, ProbeCollType >::fill(), esMonitoring.FDJsonServer::handle_accept(), and off().

257  {
258  if (!on_)
259  return true;
260 
261  // Determine decision
262  if (andOr_)
263  return (acceptDcs(event) || acceptGt(event) || acceptL1(event, setup) || acceptHlt(event));
264  return (acceptDcs(event) && acceptGt(event) && acceptL1(event, setup) && acceptHlt(event));
265 }
bool acceptHlt(const edm::Event &event)
Was this event accepted by the configured HLT logical expression combination?
bool acceptDcs(const edm::Event &event)
bool acceptL1(const edm::Event &event, const edm::EventSetup &setup)
Was this event accepted by the configured L1 logical expression combination?
bool acceptGt(const edm::Event &event)
Does this event fulfill the configured GT status logical expression combination?
bool GenericTriggerEventFlag::acceptDcs ( const edm::Event event)
private

Definition at line 267 of file GenericTriggerEventFlag.cc.

References acceptDcsPartition(), andOr_, andOrDcs_, dcsInputTag_, dcsInputToken_, dcsPartitions_, edm::InputTag::encode(), errorReplyDcs_, edm::HandleBase::isValid(), onDcs_, and verbose_.

Referenced by accept(), and off().

267  {
268  // An empty DCS partitions list acts as switch.
269  if (!onDcs_ || dcsPartitions_.empty())
270  return (!andOr_); // logically neutral, depending on base logical connective
271 
272  // Accessing the DcsStatusCollection
274  event.getByToken(dcsInputToken_, dcsStatus);
275  if (!dcsStatus.isValid()) {
276  if (verbose_ > 1)
277  edm::LogWarning("GenericTriggerEventFlag")
278  << "DcsStatusCollection product with InputTag \"" << dcsInputTag_.encode()
279  << "\" not in event ==> decision: " << errorReplyDcs_;
280  return errorReplyDcs_;
281  }
282  if ((*dcsStatus).empty()) {
283  if (verbose_ > 1)
284  edm::LogWarning("GenericTriggerEventFlag")
285  << "DcsStatusCollection product with InputTag \"" << dcsInputTag_.encode()
286  << "\" empty ==> decision: " << errorReplyDcs_;
287  return errorReplyDcs_;
288  }
289 
290  // Determine decision of DCS partition combination and return
291  if (andOrDcs_) { // OR combination
292  for (std::vector<int>::const_iterator partitionNumber = dcsPartitions_.begin();
293  partitionNumber != dcsPartitions_.end();
294  ++partitionNumber) {
295  if (acceptDcsPartition(dcsStatus, *partitionNumber))
296  return true;
297  }
298  return false;
299  }
300  for (std::vector<int>::const_iterator partitionNumber = dcsPartitions_.begin();
301  partitionNumber != dcsPartitions_.end();
302  ++partitionNumber) {
303  if (!acceptDcsPartition(dcsStatus, *partitionNumber))
304  return false;
305  }
306  return true;
307 }
edm::EDGetTokenT< DcsStatusCollection > dcsInputToken_
std::string encode() const
Definition: InputTag.cc:159
bool acceptDcsPartition(const edm::Handle< DcsStatusCollection > &dcsStatus, int dcsPartition) const
bool isValid() const
Definition: HandleBase.h:70
std::vector< int > dcsPartitions_
bool GenericTriggerEventFlag::acceptDcsPartition ( const edm::Handle< DcsStatusCollection > &  dcsStatus,
int  dcsPartition 
) const
private

Definition at line 309 of file GenericTriggerEventFlag.cc.

References DcsStatus::BPIX, DcsStatus::CASTOR, DcsStatus::CSCm, DcsStatus::CSCp, DcsStatus::DT0, DcsStatus::DTm, DcsStatus::DTp, DcsStatus::EBm, DcsStatus::EBp, DcsStatus::EEm, DcsStatus::EEp, errorReplyDcs_, DcsStatus::ESm, DcsStatus::ESp, DcsStatus::FPIX, DcsStatus::HBHEa, DcsStatus::HBHEb, DcsStatus::HBHEc, DcsStatus::HF, DcsStatus::HO, DcsStatus::RPC, DcsStatus::TECm, DcsStatus::TECp, DcsStatus::TIBTID, DcsStatus::TOB, and verbose_.

Referenced by acceptDcs(), and off().

310  {
311  // Error checks
312  switch (dcsPartition) {
313  case DcsStatus::EBp:
314  case DcsStatus::EBm:
315  case DcsStatus::EEp:
316  case DcsStatus::EEm:
317  case DcsStatus::HBHEa:
318  case DcsStatus::HBHEb:
319  case DcsStatus::HBHEc:
320  case DcsStatus::HF:
321  case DcsStatus::HO:
322  case DcsStatus::RPC:
323  case DcsStatus::DT0:
324  case DcsStatus::DTp:
325  case DcsStatus::DTm:
326  case DcsStatus::CSCp:
327  case DcsStatus::CSCm:
328  case DcsStatus::CASTOR:
329  case DcsStatus::TIBTID:
330  case DcsStatus::TOB:
331  case DcsStatus::TECp:
332  case DcsStatus::TECm:
333  case DcsStatus::BPIX:
334  case DcsStatus::FPIX:
335  case DcsStatus::ESp:
336  case DcsStatus::ESm:
337  break;
338  default:
339  if (verbose_ > 1)
340  edm::LogWarning("GenericTriggerEventFlag")
341  << "DCS partition number \"" << dcsPartition << "\" does not exist ==> decision: " << errorReplyDcs_;
342  return errorReplyDcs_;
343  }
344 
345  // Determine decision
346  return dcsStatus->at(0).ready(dcsPartition);
347 }
bool GenericTriggerEventFlag::acceptGt ( const edm::Event event)
private

Does this event fulfill the configured GT status logical expression combination?

Definition at line 350 of file GenericTriggerEventFlag.cc.

References acceptGtLogicalExpression(), andOr_, andOrGt_, gtLogicalExpressions_, and onGt_.

Referenced by accept(), and off().

350  {
351  // An empty GT status bits logical expressions list acts as switch.
352  if (!onGt_ || gtLogicalExpressions_.empty())
353  return (!andOr_); // logically neutral, depending on base logical connective
354 
355  // Determine decision of GT status bits logical expression combination and return
356  if (andOrGt_) { // OR combination
357  for (std::vector<std::string>::const_iterator gtLogicalExpression = gtLogicalExpressions_.begin();
358  gtLogicalExpression != gtLogicalExpressions_.end();
359  ++gtLogicalExpression) {
360  if (acceptGtLogicalExpression(event, *gtLogicalExpression))
361  return true;
362  }
363  return false;
364  }
365  for (std::vector<std::string>::const_iterator gtLogicalExpression = gtLogicalExpressions_.begin();
366  gtLogicalExpression != gtLogicalExpressions_.end();
367  ++gtLogicalExpression) {
368  if (!acceptGtLogicalExpression(event, *gtLogicalExpression))
369  return false;
370  }
371  return true;
372 }
std::vector< std::string > gtLogicalExpressions_
bool acceptGtLogicalExpression(const edm::Event &event, std::string gtLogicalExpression)
Does this event fulfill this particular GT status bits&#39; logical expression?
bool GenericTriggerEventFlag::acceptGtLogicalExpression ( const edm::Event event,
std::string  gtLogicalExpression 
)
private

Does this event fulfill this particular GT status bits' logical expression?

Definition at line 375 of file GenericTriggerEventFlag.cc.

References L1GtfeExtWord::beamMode(), L1GtfeExtWord::beamMomentum(), edm::InputTag::encode(), errorReplyDcs_, errorReplyGt_, L1GtLogicParser::expressionResult(), gtEvmInputTag_, gtEvmInputToken_, L1GlobalTriggerReadoutRecord::gtFdlWord(), L1GlobalTriggerEvmReadoutRecord::gtfeWord(), gtInputTag_, gtInputToken_, edm::HandleBase::isValid(), negate(), L1GtLogicParser::operandTokenVector(), L1GtFdlWord::physicsDeclared(), AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

Referenced by acceptGt(), and off().

375  {
376  // Check empty std::strings
377  if (gtLogicalExpression.empty()) {
378  if (verbose_ > 1)
379  edm::LogWarning("GenericTriggerEventFlag") << "Empty logical expression ==> decision: " << errorReplyGt_;
380  return errorReplyGt_;
381  }
382 
383  // Negated paths
384  bool negExpr(negate(gtLogicalExpression));
385  if (negExpr && gtLogicalExpression.empty()) {
386  if (verbose_ > 1)
387  edm::LogWarning("GenericTriggerEventFlag")
388  << "Empty (negated) logical expression ==> decision: " << errorReplyGt_;
389  return errorReplyGt_;
390  }
391 
392  // Parse logical expression and determine GT status bit decision
393  L1GtLogicParser gtAlgoLogicParser(gtLogicalExpression);
394  // Loop over status bits
395  for (size_t iStatusBit = 0; iStatusBit < gtAlgoLogicParser.operandTokenVector().size(); ++iStatusBit) {
396  const std::string gtStatusBit(gtAlgoLogicParser.operandTokenVector().at(iStatusBit).tokenName);
397  // Manipulate status bit decision as stored in the parser
398  bool decision(errorReplyDcs_);
399  // Hard-coded status bits!!!
400  if (gtStatusBit == "PhysDecl" || gtStatusBit == "PhysicsDeclared") {
402  event.getByToken(gtInputToken_, gtReadoutRecord);
403  if (!gtReadoutRecord.isValid()) {
404  if (verbose_ > 1)
405  edm::LogWarning("GenericTriggerEventFlag")
406  << "L1GlobalTriggerReadoutRecord product with InputTag \"" << gtInputTag_.encode()
407  << "\" not in event ==> decision: " << errorReplyGt_;
408  gtAlgoLogicParser.operandTokenVector().at(iStatusBit).tokenResult = errorReplyDcs_;
409  continue;
410  }
411  decision = (gtReadoutRecord->gtFdlWord().physicsDeclared() == 1);
412  } else if (gtStatusBit == "Stable" || gtStatusBit == "StableBeam" || gtStatusBit == "Adjust" ||
413  gtStatusBit == "Sqeeze" || gtStatusBit == "Flat" || gtStatusBit == "FlatTop" || gtStatusBit == "7TeV" ||
414  gtStatusBit == "8TeV" || gtStatusBit == "13TeV" || gtStatusBit == "2360GeV" || gtStatusBit == "900GeV") {
416  event.getByToken(gtEvmInputToken_, gtEvmReadoutRecord);
417  if (!gtEvmReadoutRecord.isValid()) {
418  if (verbose_ > 1)
419  edm::LogWarning("GenericTriggerEventFlag")
420  << "L1GlobalTriggerEvmReadoutRecord product with InputTag \"" << gtEvmInputTag_.encode()
421  << "\" not in event ==> decision: " << errorReplyGt_;
422  gtAlgoLogicParser.operandTokenVector().at(iStatusBit).tokenResult = errorReplyDcs_;
423  continue;
424  }
425  if (gtStatusBit == "Stable" || gtStatusBit == "StableBeam") {
426  decision = (gtEvmReadoutRecord->gtfeWord().beamMode() == 11);
427  } else if (gtStatusBit == "Adjust") {
428  decision = (10 <= gtEvmReadoutRecord->gtfeWord().beamMode() && gtEvmReadoutRecord->gtfeWord().beamMode() <= 11);
429  } else if (gtStatusBit == "Sqeeze") {
430  decision = (9 <= gtEvmReadoutRecord->gtfeWord().beamMode() && gtEvmReadoutRecord->gtfeWord().beamMode() <= 11);
431  } else if (gtStatusBit == "Flat" || gtStatusBit == "FlatTop") {
432  decision = (8 <= gtEvmReadoutRecord->gtfeWord().beamMode() && gtEvmReadoutRecord->gtfeWord().beamMode() <= 11);
433  } else if (gtStatusBit == "7TeV") {
434  decision = (gtEvmReadoutRecord->gtfeWord().beamMomentum() == 3500);
435  } else if (gtStatusBit == "8TeV") {
436  decision = (gtEvmReadoutRecord->gtfeWord().beamMomentum() == 4000);
437  } else if (gtStatusBit == "13TeV") {
438  decision = (gtEvmReadoutRecord->gtfeWord().beamMomentum() == 6500);
439  } else if (gtStatusBit == "2360GeV") {
440  decision = (gtEvmReadoutRecord->gtfeWord().beamMomentum() == 1180);
441  } else if (gtStatusBit == "900GeV") {
442  decision = (gtEvmReadoutRecord->gtfeWord().beamMomentum() == 450);
443  }
444  } else {
445  if (verbose_ > 1)
446  edm::LogWarning("GenericTriggerEventFlag")
447  << "GT status bit \"" << gtStatusBit << "\" is not defined ==> decision: " << errorReplyGt_;
448  }
449  gtAlgoLogicParser.operandTokenVector().at(iStatusBit).tokenResult = decision;
450  }
451 
452  // Determine decision
453  const bool gtDecision(gtAlgoLogicParser.expressionResult());
454  return negExpr ? (!gtDecision) : gtDecision;
455 }
bool negate(std::string &word) const
Checks for negated words.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtInputToken_
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
std::string encode() const
Definition: InputTag.cc:159
const cms_uint16_t beamMomentum() const
bool isValid() const
Definition: HandleBase.h:70
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
const cms_uint16_t physicsDeclared() const
get/set "physics declared" bit
Definition: L1GtFdlWord.h:169
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > gtEvmInputToken_
const cms_uint16_t beamMode() const
bool GenericTriggerEventFlag::acceptHlt ( const edm::Event event)
private

Was this event accepted by the configured HLT logical expression combination?

Definition at line 552 of file GenericTriggerEventFlag.cc.

References acceptHltLogicalExpression(), andOr_, andOrHlt_, edm::InputTag::encode(), errorReplyDcs_, errorReplyHlt_, hltConfigInit_, hltInputTag_, hltInputToken_, hltLogicalExpressions_, edm::HandleBase::isValid(), onHlt_, and verbose_.

Referenced by accept(), and off().

552  {
553  // An empty HLT logical expressions list acts as switch.
554  if (!onHlt_ || hltLogicalExpressions_.empty())
555  return (!andOr_); // logically neutral, depending on base logical connective
556 
557  // Checking the HLT configuration,
558  if (!hltConfigInit_) {
559  if (verbose_ > 1)
560  edm::LogWarning("GenericTriggerEventFlag") << "HLT config error ==> decision: " << errorReplyHlt_;
561  return errorReplyHlt_;
562  }
563 
564  // Accessing the TriggerResults
565  edm::Handle<edm::TriggerResults> hltTriggerResults;
566  event.getByToken(hltInputToken_, hltTriggerResults);
567  if (!hltTriggerResults.isValid()) {
568  if (verbose_ > 1)
569  edm::LogWarning("GenericTriggerEventFlag") << "TriggerResults product with InputTag \"" << hltInputTag_.encode()
570  << "\" not in event ==> decision: " << errorReplyHlt_;
571  return errorReplyHlt_;
572  }
573  if ((*hltTriggerResults).size() == 0) {
574  if (verbose_ > 1)
575  edm::LogWarning("GenericTriggerEventFlag") << "TriggerResults product with InputTag \"" << hltInputTag_.encode()
576  << "\" empty ==> decision: " << errorReplyHlt_;
577  return errorReplyDcs_;
578  }
579 
580  // Determine decision of HLT logical expression combination and return
581  if (andOrHlt_) { // OR combination
582  for (std::vector<std::string>::const_iterator hltLogicalExpression = hltLogicalExpressions_.begin();
583  hltLogicalExpression != hltLogicalExpressions_.end();
584  ++hltLogicalExpression) {
585  if (acceptHltLogicalExpression(hltTriggerResults, *hltLogicalExpression))
586  return true;
587  }
588  return false;
589  }
590  for (std::vector<std::string>::const_iterator hltLogicalExpression = hltLogicalExpressions_.begin();
591  hltLogicalExpression != hltLogicalExpressions_.end();
592  ++hltLogicalExpression) {
593  if (!acceptHltLogicalExpression(hltTriggerResults, *hltLogicalExpression))
594  return false;
595  }
596  return true;
597 }
std::vector< std::string > hltLogicalExpressions_
std::string encode() const
Definition: InputTag.cc:159
edm::EDGetTokenT< edm::TriggerResults > hltInputToken_
bool isValid() const
Definition: HandleBase.h:70
bool acceptHltLogicalExpression(const edm::Handle< edm::TriggerResults > &hltTriggerResults, std::string hltLogicalExpression) const
Was this event accepted by this particular HLT paths&#39; logical expression?
bool GenericTriggerEventFlag::acceptHltLogicalExpression ( const edm::Handle< edm::TriggerResults > &  hltTriggerResults,
std::string  hltLogicalExpression 
) const
private

Was this event accepted by this particular HLT paths' logical expression?

Definition at line 600 of file GenericTriggerEventFlag.cc.

References edm::HLTGlobalStatus::accept(), edm::HLTGlobalStatus::error(), errorReplyHlt_, L1GtLogicParser::expressionResult(), hltConfig_, hltInputTag_, negate(), L1GtLogicParser::operandTokenVector(), edm::InputTag::process(), HLTConfigProvider::size(), AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::triggerIndex(), and verbose_.

Referenced by acceptHlt(), and off().

601  {
602  // Check empty std::strings
603  if (hltLogicalExpression.empty()) {
604  if (verbose_ > 1)
605  edm::LogWarning("GenericTriggerEventFlag") << "Empty logical expression ==> decision: " << errorReplyHlt_;
606  return errorReplyHlt_;
607  }
608 
609  // Negated paths
610  bool negExpr(negate(hltLogicalExpression));
611  if (negExpr && hltLogicalExpression.empty()) {
612  if (verbose_ > 1)
613  edm::LogWarning("GenericTriggerEventFlag")
614  << "Empty (negated) logical expression ==> decision: " << errorReplyHlt_;
615  return errorReplyHlt_;
616  }
617 
618  // Parse logical expression and determine HLT decision
619  L1GtLogicParser hltAlgoLogicParser(hltLogicalExpression);
620  // Loop over paths
621  for (size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath) {
622  const std::string hltPathName(hltAlgoLogicParser.operandTokenVector().at(iPath).tokenName);
623  const unsigned indexPath(hltConfig_.triggerIndex(hltPathName));
624  // Further error checks
625  if (indexPath == hltConfig_.size()) {
626  if (verbose_ > 1)
627  edm::LogWarning("GenericTriggerEventFlag") << "HLT path \"" << hltPathName << "\" is not found in process "
628  << hltInputTag_.process() << " ==> decision: " << errorReplyHlt_;
629  hltAlgoLogicParser.operandTokenVector().at(iPath).tokenResult = errorReplyHlt_;
630  continue;
631  }
632  if (hltTriggerResults->error(indexPath)) {
633  if (verbose_ > 1)
634  edm::LogWarning("GenericTriggerEventFlag")
635  << "HLT path \"" << hltPathName << "\" in error ==> decision: " << errorReplyHlt_;
636  hltAlgoLogicParser.operandTokenVector().at(iPath).tokenResult = errorReplyHlt_;
637  continue;
638  }
639  // Manipulate algo decision as stored in the parser
640  const bool decision(hltTriggerResults->accept(indexPath));
641  hltAlgoLogicParser.operandTokenVector().at(iPath).tokenResult = decision;
642  }
643 
644  // Determine decision
645  const bool hltDecision(hltAlgoLogicParser.expressionResult());
646  return negExpr ? (!hltDecision) : hltDecision;
647 }
unsigned int size() const
number of trigger paths in trigger table
bool negate(std::string &word) const
Checks for negated words.
bool accept() const
Has at least one path accepted the event?
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
bool error() const
Has any path encountered an error (exception)
std::string const & process() const
Definition: InputTag.h:40
bool GenericTriggerEventFlag::acceptL1 ( const edm::Event event,
const edm::EventSetup setup 
)
private

Was this event accepted by the configured L1 logical expression combination?

Definition at line 458 of file GenericTriggerEventFlag.cc.

References acceptL1LogicalExpression(), andOr_, andOrL1_, l1LogicalExpressions_, and onL1_.

Referenced by accept(), and off().

458  {
459  // An empty L1 logical expressions list acts as switch.
460  if (!onL1_ || l1LogicalExpressions_.empty())
461  return (!andOr_); // logically neutral, depending on base logical connective
462 
463  // Determine decision of L1 logical expression combination and return
464  if (andOrL1_) { // OR combination
465  for (std::vector<std::string>::const_iterator l1LogicalExpression = l1LogicalExpressions_.begin();
466  l1LogicalExpression != l1LogicalExpressions_.end();
467  ++l1LogicalExpression) {
468  if (acceptL1LogicalExpression(event, setup, *l1LogicalExpression))
469  return true;
470  }
471  return false;
472  }
473  for (std::vector<std::string>::const_iterator l1LogicalExpression = l1LogicalExpressions_.begin();
474  l1LogicalExpression != l1LogicalExpressions_.end();
475  ++l1LogicalExpression) {
476  if (!acceptL1LogicalExpression(event, setup, *l1LogicalExpression))
477  return false;
478  }
479  return true;
480 }
bool acceptL1LogicalExpression(const edm::Event &event, const edm::EventSetup &setup, std::string l1LogicalExpression)
Was this event accepted by this particular L1 algorithms&#39; logical expression?
std::vector< std::string > l1LogicalExpressions_
bool GenericTriggerEventFlag::acceptL1LogicalExpression ( const edm::Event event,
const edm::EventSetup setup,
std::string  l1LogicalExpression 
)
private

Was this event accepted by this particular L1 algorithms' logical expression?

Definition at line 483 of file GenericTriggerEventFlag.cc.

References relativeConstraints::error, errorReplyL1_, L1GtLogicParser::expressionResult(), l1BeforeMask_, l1Gt_, l1uGt_, negate(), L1GtLogicParser::operandTokenVector(), stage2_, AlCaHLTBitMon_QueryRunRegistry::string, useL1EventSetup(), useL1GtTriggerMenuLite(), and verbose_.

Referenced by acceptL1(), and off().

485  {
486  // Getting the L1 event setup
487  if (stage2_)
488  l1uGt_->retrieveL1(event, setup);
489  else
490  // FIXME This can possibly go to initRun()
491  l1Gt_->getL1GtRunCache(event, setup, useL1EventSetup, useL1GtTriggerMenuLite);
492 
493  // Check empty std::strings
494  if (l1LogicalExpression.empty()) {
495  if (verbose_ > 1)
496  edm::LogWarning("GenericTriggerEventFlag") << "Empty logical expression ==> decision: " << errorReplyL1_;
497  return errorReplyL1_;
498  }
499 
500  // Negated logical expression
501  bool negExpr(negate(l1LogicalExpression));
502  if (negExpr && l1LogicalExpression.empty()) {
503  if (verbose_ > 1)
504  edm::LogWarning("GenericTriggerEventFlag")
505  << "Empty (negated) logical expression ==> decision: " << errorReplyL1_;
506  return errorReplyL1_;
507  }
508 
509  // Parse logical expression and determine L1 decision
510  L1GtLogicParser l1AlgoLogicParser(l1LogicalExpression);
511  // Loop over algorithms
512  for (size_t iAlgorithm = 0; iAlgorithm < l1AlgoLogicParser.operandTokenVector().size(); ++iAlgorithm) {
513  const std::string l1AlgoName(l1AlgoLogicParser.operandTokenVector().at(iAlgorithm).tokenName);
514 
515  bool decision = false;
516  bool error = false;
517  if (stage2_) {
518  bool errorBOOL = (l1BeforeMask_ ? l1uGt_->getInitialDecisionByName(l1AlgoName, decision)
519  : l1uGt_->getFinalDecisionByName(l1AlgoName, decision));
520  error = !errorBOOL;
521  } else {
522  int errorINT(-1);
523  // const bool decision( l1BeforeMask_ ? l1Gt_->decisionBeforeMask( event, l1AlgoName, errorINT ) : l1Gt_->decisionAfterMask( event, l1AlgoName, errorINT ) );
524  decision = (l1BeforeMask_ ? l1Gt_->decisionBeforeMask(event, l1AlgoName, errorINT)
525  : l1Gt_->decisionAfterMask(event, l1AlgoName, errorINT));
526  error = (errorINT != 0);
527  if (errorINT > 1)
528  if (verbose_ > 1)
529  edm::LogWarning("GenericTriggerEventFlag")
530  << "L1 algorithm \"" << l1AlgoName << "\" received error code " << error
531  << " from L1GtUtils::decisionBeforeMask ==> decision: " << errorReplyL1_;
532  }
533 
534  // Error checks
535  if (error) {
536  if (verbose_ > 1)
537  edm::LogWarning("GenericTriggerEventFlag")
538  << "L1 algorithm \"" << l1AlgoName << "\" does not exist in the L1 menu ==> decision: " << errorReplyL1_;
539  l1AlgoLogicParser.operandTokenVector().at(iAlgorithm).tokenResult = errorReplyL1_;
540  continue;
541  }
542  // Manipulate algo decision as stored in the parser
543  l1AlgoLogicParser.operandTokenVector().at(iAlgorithm).tokenResult = decision;
544  }
545 
546  // Return decision
547  const bool l1Decision(l1AlgoLogicParser.expressionResult());
548  return negExpr ? (!l1Decision) : l1Decision;
549 }
bool negate(std::string &word) const
Checks for negated words.
static const bool useL1GtTriggerMenuLite(false)
std::unique_ptr< L1GtUtils > l1Gt_
static const bool useL1EventSetup(true)
std::unique_ptr< l1t::L1TGlobalUtil > l1uGt_
bool GenericTriggerEventFlag::allHLTPathsAreValid ( ) const

Definition at line 724 of file GenericTriggerEventFlag.cc.

References hltConfig_, hltConfigInit_, hltInputTag_, hltLogicalExpressions_, onHlt_, L1GtLogicParser::operandTokenVector(), edm::InputTag::process(), HLTConfigProvider::size(), AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::triggerIndex(), and verbose_.

Referenced by off().

724  {
725  if (not onHlt_) {
726  return true;
727  }
728 
729  if (not hltConfigInit_) {
730  if (verbose_ > 0) {
731  edm::LogWarning("GenericTriggerEventFlag::allHLTPathsAreValid()")
732  << "HLTConfigProvider is not initialized, method will return \"false\"";
733  }
734 
735  return false;
736  }
737 
738  for (unsigned iExpr = 0; iExpr < hltLogicalExpressions_.size(); ++iExpr) {
739  std::string hltLogicalExpression = hltLogicalExpressions_.at(iExpr);
740 
741  L1GtLogicParser hltAlgoLogicParser(hltLogicalExpression);
742 
743  if (hltAlgoLogicParser.operandTokenVector().empty()) {
744  return false;
745  }
746 
747  for (size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath) {
748  const std::string hltPathName(hltAlgoLogicParser.operandTokenVector().at(iPath).tokenName);
749 
750  const unsigned indexPath(hltConfig_.triggerIndex(hltPathName));
751 
752  if (indexPath == hltConfig_.size()) {
753  if (verbose_ > 1) {
754  edm::LogWarning("GenericTriggerEventFlag::allHLTPathsAreValid()")
755  << "HLT path \"" << hltPathName << "\" is not found in process " << hltInputTag_.process();
756  }
757 
758  return false;
759  }
760  }
761  }
762 
763  return true;
764 }
unsigned int size() const
number of trigger paths in trigger table
std::vector< std::string > hltLogicalExpressions_
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
std::string const & process() const
Definition: InputTag.h:40
std::string GenericTriggerEventFlag::expandLogicalExpression ( const std::vector< std::string > &  target,
const std::string &  expr,
bool  useAnd = false 
) const
private

Expand wild-carded logical expressions, giving version postfixes priority.

Definition at line 650 of file GenericTriggerEventFlag.cc.

References jets_cff::expr, hltConfig_, muonTagProbeFilters_cff::matched, HLTConfigProvider::matched(), HLTConfigProvider::restoreVersion(), AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

Referenced by initRun(), and off().

652  {
653  // Find matching entries in the menu
654  std::vector<std::string> matched;
655  const std::string versionWildcard("_v*");
656  if (expr.substr(expr.size() - versionWildcard.size()) == versionWildcard) {
657  const std::string exprBase(expr.substr(0, expr.size() - versionWildcard.size()));
658  matched = hltConfig_.restoreVersion(targets, exprBase);
659  } else {
660  matched = hltConfig_.matched(targets, expr);
661  }
662 
663  // Return input, if no match is found
664  if (matched.empty()) {
665  if (verbose_ > 1)
666  edm::LogWarning("GenericTriggerEventFlag") << "Logical expression: \"" << expr << "\" could not be resolved";
667  return expr;
668  }
669 
670  // Compose logical expression
671  std::string expanded("(");
672  for (unsigned iVers = 0; iVers < matched.size(); ++iVers) {
673  if (iVers > 0)
674  expanded.append(useAnd ? " AND " : " OR ");
675  expanded.append(matched.at(iVers));
676  }
677  expanded.append(")");
678  if (verbose_ > 1)
679  edm::LogInfo("GenericTriggerEventFlag") << "Logical expression: \"" << expr << "\"\n"
680  << " --> expanded to \"" << expanded << "\"";
681 
682  return expanded;
683 }
static const std::vector< std::string > matched(const std::vector< std::string > &inputs, const std::string &pattern)
regexp processing
static const std::vector< std::string > restoreVersion(const std::vector< std::string > &inputs, const std::string &trigger)
std::vector< std::string > GenericTriggerEventFlag::expressionsFromDB ( const std::string &  key,
const edm::EventSetup setup 
)

Reads and returns logical expressions from DB.

Definition at line 696 of file GenericTriggerEventFlag.cc.

References configError_, dbLabel_, AlCaRecoTriggerBits::decompose(), emptyKeyError_, edm::EventSetup::get(), SummaryClient_cfi::labels, AlCaRecoTriggerBits::m_alcarecoToTrig, and verbose_.

Referenced by hltDBKey(), and initRun().

697  {
698  if (key.empty())
699  return std::vector<std::string>(1, emptyKeyError_);
700  edm::ESHandle<AlCaRecoTriggerBits> logicalExpressions;
701  std::vector<edm::eventsetup::DataKey> labels;
702  setup.get<AlCaRecoTriggerBitsRcd>().fillRegisteredDataKeys(labels);
703  std::vector<edm::eventsetup::DataKey>::const_iterator iKey = labels.begin();
704  while (iKey != labels.end() && iKey->name().value() != dbLabel_)
705  ++iKey;
706  if (iKey == labels.end()) {
707  if (verbose_ > 0)
708  edm::LogWarning("GenericTriggerEventFlag")
709  << "Label " << dbLabel_ << " not found in DB for 'AlCaRecoTriggerBitsRcd'";
710  return std::vector<std::string>(1, configError_);
711  }
712  setup.get<AlCaRecoTriggerBitsRcd>().get(dbLabel_, logicalExpressions);
713  const std::map<std::string, std::string>& expressionMap = logicalExpressions->m_alcarecoToTrig;
714  std::map<std::string, std::string>::const_iterator listIter = expressionMap.find(key);
715  if (listIter == expressionMap.end()) {
716  if (verbose_ > 0)
717  edm::LogWarning("GenericTriggerEventFlag")
718  << "No logical expressions found under key " << key << " in 'AlCaRecoTriggerBitsRcd'";
719  return std::vector<std::string>(1, configError_);
720  }
721  return logicalExpressions->decompose(listIter->second);
722 }
std::map< std::string, std::string > m_alcarecoToTrig
std::vector< std::string > decompose(const std::string &concatPaths) const
Decompose one value of map from concatenated string.
T get() const
Definition: EventSetup.h:73
std::string GenericTriggerEventFlag::gtDBKey ( )
inline

Definition at line 145 of file GenericTriggerEventFlag.h.

References gtDBKey_.

145 { return gtDBKey_; } // can be empty
std::string GenericTriggerEventFlag::hltDBKey ( )
inline

Definition at line 147 of file GenericTriggerEventFlag.h.

References expressionsFromDB(), hltDBKey_, crabWrapper::key, and AlCaHLTBitMon_QueryRunRegistry::string.

147 { return hltDBKey_; } // can be empty
void GenericTriggerEventFlag::initRun ( const edm::Run run,
const edm::EventSetup setup 
)

To be called from beginRun() methods.

Definition at line 143 of file GenericTriggerEventFlag.cc.

References configError_, edm::InputTag::encode(), expandLogicalExpression(), expressionsFromDB(), spr::find(), edm::EventSetup::get(), L1GtTriggerMenu::gtAlgorithmMap(), gtDBKey_, gtLogicalExpressions_, L1GtTriggerMenu::gtTechnicalTriggerMap(), hltConfig_, hltConfigInit_, hltDBKey_, hltInputTag_, hltLogicalExpressions_, hltLogicalExpressionsCache_, HLTConfigProvider::init(), l1DBKey_, l1Gt_, l1LogicalExpressions_, l1LogicalExpressionsCache_, l1uGt_, onGt_, onHlt_, onL1_, hltrates_dqm_sourceclient-live_cfg::prescales, edm::InputTag::process(), HLTConfigProvider::size(), stage2_, AlCaHLTBitMon_QueryRunRegistry::string, createJobs::tmp, HLTConfigProvider::triggerNames(), useL1EventSetup(), useL1GtTriggerMenuLite(), verbose_, and watchDB_.

Referenced by HLTDQMTagAndProbeEff< TagType, TagCollType, ProbeType, ProbeCollType >::beginRun(), dEdxAnalyzer::bookHistograms(), V0Monitor::bookHistograms(), TagAndProbeBtagTriggerMonitor::bookHistograms(), LogMessageMonitor::bookHistograms(), TrackingMonitor::bookHistograms(), BPHMonitor::bookHistograms(), MonitorTrackResidualsBase< pixel_or_strip >::dqmBeginRun(), dEdxHitAnalyzer::dqmBeginRun(), SiStripMonitorCluster::dqmBeginRun(), SiStripMonitorTrack::dqmBeginRun(), TauTagValidation::dqmBeginRun(), and off().

143  {
144  if (watchDB_->check(setup)) {
145  if (onGt_ && !gtDBKey_.empty()) {
146  const std::vector<std::string> exprs(expressionsFromDB(gtDBKey_, setup));
147  if (exprs.empty() || exprs.at(0) != configError_)
148  gtLogicalExpressions_ = exprs;
149  }
150  if (onL1_ && !l1DBKey_.empty()) {
151  const std::vector<std::string> exprs(expressionsFromDB(l1DBKey_, setup));
152  if (exprs.empty() || exprs.at(0) != configError_)
154  }
155  if (onHlt_ && !hltDBKey_.empty()) {
156  const std::vector<std::string> exprs(expressionsFromDB(hltDBKey_, setup));
157  if (exprs.empty() || exprs.at(0) != configError_)
159  }
160  }
161 
162  // Re-initialise starting valuse before wild-card expansion
165 
166  hltConfigInit_ = false;
167  if (onHlt_) {
168  if (hltInputTag_.process().empty()) {
169  if (verbose_ > 0)
170  edm::LogError("GenericTriggerEventFlag")
171  << "HLT TriggerResults InputTag \"" << hltInputTag_.encode() << "\" specifies no process";
172  } else {
173  bool hltChanged(false);
174  if (!hltConfig_.init(run, setup, hltInputTag_.process(), hltChanged)) {
175  if (verbose_ > 0)
176  edm::LogError("GenericTriggerEventFlag")
177  << "HLT config initialization error with process name \"" << hltInputTag_.process() << "\"";
178  } else if (hltConfig_.size() <= 0) {
179  if (verbose_ > 0)
180  edm::LogError("GenericTriggerEventFlag") << "HLT config size error";
181  } else
182  hltConfigInit_ = true;
183  }
184  }
185 
186  // Expand version wild-cards in HLT logical expressions
187  // L1
188  if (onL1_) {
189  // build vector of algo names
190 
191  std::vector<std::string> algoNames;
192 
193  if (stage2_) {
194  l1uGt_->retrieveL1Setup(setup);
195 
196  const std::vector<std::pair<std::string, int> > prescales = l1uGt_->prescales();
197  for (auto ip : prescales)
198  algoNames.push_back(ip.first);
199  } else {
200  l1Gt_->getL1GtRunCache(run, setup, useL1EventSetup, useL1GtTriggerMenuLite);
201  edm::ESHandle<L1GtTriggerMenu> handleL1GtTriggerMenu;
202  setup.get<L1GtTriggerMenuRcd>().get(handleL1GtTriggerMenu);
203 
204  const AlgorithmMap l1GtPhys(handleL1GtTriggerMenu->gtAlgorithmMap());
205  for (CItAlgo iAlgo = l1GtPhys.begin(); iAlgo != l1GtPhys.end(); ++iAlgo) {
206  algoNames.push_back(iAlgo->second.algoName());
207  }
208  const AlgorithmMap l1GtTech(handleL1GtTriggerMenu->gtTechnicalTriggerMap());
209  for (CItAlgo iAlgo = l1GtTech.begin(); iAlgo != l1GtTech.end(); ++iAlgo) {
210  algoNames.push_back(iAlgo->second.algoName());
211  }
212  }
213 
214  for (unsigned iExpr = 0; iExpr < l1LogicalExpressions_.size(); ++iExpr) {
215  std::string l1LogicalExpression(l1LogicalExpressions_.at(iExpr));
216  L1GtLogicParser l1AlgoLogicParser(l1LogicalExpression);
217  // Loop over algorithms
218  for (size_t iAlgo = 0; iAlgo < l1AlgoLogicParser.operandTokenVector().size(); ++iAlgo) {
219  const std::string l1AlgoName(l1AlgoLogicParser.operandTokenVector().at(iAlgo).tokenName);
220  if (l1AlgoName.find('*') != std::string::npos) {
221  l1LogicalExpression.replace(
222  l1LogicalExpression.find(l1AlgoName), l1AlgoName.size(), expandLogicalExpression(algoNames, l1AlgoName));
223  }
224  }
225  l1LogicalExpressions_[iExpr] = l1LogicalExpression;
226  }
227  std::vector<std::string> tmp = l1LogicalExpressions_;
228  for (unsigned iExpr = 0; iExpr < tmp.size(); ++iExpr)
229  if (std::find(algoNames.begin(), algoNames.end(), tmp[iExpr]) == algoNames.end()) {
230  l1LogicalExpressions_.erase(l1LogicalExpressions_.begin() + iExpr);
231  if (verbose_ > 1)
232  edm::LogWarning("GenericTriggerEventFlag")
233  << "L1 algorithm \"" << tmp[iExpr]
234  << "\" does not exist in the L1 menu ==> drop it from the list of l1LogicalExpressions";
235  }
236  }
237  // HLT
238  if (hltConfigInit_) {
239  for (unsigned iExpr = 0; iExpr < hltLogicalExpressions_.size(); ++iExpr) {
240  std::string hltLogicalExpression(hltLogicalExpressions_.at(iExpr));
241  L1GtLogicParser hltAlgoLogicParser(hltLogicalExpression);
242  // Loop over paths
243  for (size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath) {
244  const std::string hltPathName(hltAlgoLogicParser.operandTokenVector().at(iPath).tokenName);
245  if (hltPathName.find('*') != std::string::npos) {
246  hltLogicalExpression.replace(hltLogicalExpression.find(hltPathName),
247  hltPathName.size(),
249  }
250  }
251  hltLogicalExpressions_[iExpr] = hltLogicalExpression;
252  }
253  }
254 }
unsigned int size() const
number of trigger paths in trigger table
static const bool useL1GtTriggerMenuLite(false)
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
std::vector< std::string > hltLogicalExpressions_
std::vector< std::string > gtLogicalExpressions_
const std::vector< std::string > & triggerNames() const
names of trigger paths
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::string encode() const
Definition: InputTag.cc:159
std::unique_ptr< L1GtUtils > l1Gt_
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
std::vector< std::string > expressionsFromDB(const std::string &key, const edm::EventSetup &setup)
Reads and returns logical expressions from DB.
std::vector< std::string > l1LogicalExpressionsCache_
static const bool useL1EventSetup(true)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::vector< std::string > hltLogicalExpressionsCache_
std::string const & process() const
Definition: InputTag.h:40
T get() const
Definition: EventSetup.h:73
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
std::string expandLogicalExpression(const std::vector< std::string > &target, const std::string &expr, bool useAnd=false) const
Expand wild-carded logical expressions, giving version postfixes priority.
std::unique_ptr< edm::ESWatcher< AlCaRecoTriggerBitsRcd > > watchDB_
tmp
align.sh
Definition: createJobs.py:716
std::unique_ptr< l1t::L1TGlobalUtil > l1uGt_
std::vector< std::string > l1LogicalExpressions_
std::string GenericTriggerEventFlag::l1DBKey ( )
inline

Definition at line 146 of file GenericTriggerEventFlag.h.

References l1DBKey_.

146 { return l1DBKey_; } // can be empty
bool GenericTriggerEventFlag::negate ( std::string &  word) const
private

Checks for negated words.

Definition at line 686 of file GenericTriggerEventFlag.cc.

Referenced by acceptGtLogicalExpression(), acceptHltLogicalExpression(), acceptL1LogicalExpression(), and off().

686  {
687  bool negate(false);
688  if (word.at(0) == '~') {
689  negate = true;
690  word.erase(0, 1);
691  }
692  return negate;
693 }
bool negate(std::string &word) const
Checks for negated words.
uint64_t word
bool GenericTriggerEventFlag::off ( )
inline
bool GenericTriggerEventFlag::on ( )
inline

Member Data Documentation

bool GenericTriggerEventFlag::andOr_
private
bool GenericTriggerEventFlag::andOrDcs_
private

Definition at line 49 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::andOrGt_
private

Definition at line 54 of file GenericTriggerEventFlag.h.

Referenced by acceptGt(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::andOrHlt_
private

Definition at line 69 of file GenericTriggerEventFlag.h.

Referenced by acceptHlt(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::andOrL1_
private

Definition at line 62 of file GenericTriggerEventFlag.h.

Referenced by acceptL1(), and GenericTriggerEventFlag().

const std::string GenericTriggerEventFlag::configError_
private

Definition at line 83 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB(), and initRun().

std::string GenericTriggerEventFlag::dbLabel_
private

Definition at line 47 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB(), and GenericTriggerEventFlag().

edm::InputTag GenericTriggerEventFlag::dcsInputTag_
private

Definition at line 50 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

edm::EDGetTokenT<DcsStatusCollection> GenericTriggerEventFlag::dcsInputToken_
private

Definition at line 51 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

std::vector<int> GenericTriggerEventFlag::dcsPartitions_
private

Definition at line 52 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

const std::string GenericTriggerEventFlag::emptyKeyError_
private

Definition at line 84 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB().

bool GenericTriggerEventFlag::errorReplyDcs_
private
bool GenericTriggerEventFlag::errorReplyGt_
private

Definition at line 61 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::errorReplyHlt_
private
bool GenericTriggerEventFlag::errorReplyL1_
private

Definition at line 68 of file GenericTriggerEventFlag.h.

Referenced by acceptL1LogicalExpression(), and GenericTriggerEventFlag().

std::string GenericTriggerEventFlag::gtDBKey_
private

Definition at line 59 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), gtDBKey(), and initRun().

edm::InputTag GenericTriggerEventFlag::gtEvmInputTag_
private

Definition at line 57 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> GenericTriggerEventFlag::gtEvmInputToken_
private

Definition at line 58 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

edm::InputTag GenericTriggerEventFlag::gtInputTag_
private

Definition at line 55 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> GenericTriggerEventFlag::gtInputToken_
private

Definition at line 56 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

std::vector<std::string> GenericTriggerEventFlag::gtLogicalExpressions_
private

Definition at line 60 of file GenericTriggerEventFlag.h.

Referenced by acceptGt(), GenericTriggerEventFlag(), and initRun().

HLTConfigProvider GenericTriggerEventFlag::hltConfig_
private
bool GenericTriggerEventFlag::hltConfigInit_
private

Definition at line 44 of file GenericTriggerEventFlag.h.

Referenced by acceptHlt(), allHLTPathsAreValid(), and initRun().

std::string GenericTriggerEventFlag::hltDBKey_
private

Definition at line 72 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), hltDBKey(), and initRun().

edm::InputTag GenericTriggerEventFlag::hltInputTag_
private
edm::EDGetTokenT<edm::TriggerResults> GenericTriggerEventFlag::hltInputToken_
private

Definition at line 71 of file GenericTriggerEventFlag.h.

Referenced by acceptHlt(), and GenericTriggerEventFlag().

std::vector<std::string> GenericTriggerEventFlag::hltLogicalExpressions_
private

Definition at line 74 of file GenericTriggerEventFlag.h.

Referenced by acceptHlt(), allHLTPathsAreValid(), and initRun().

std::vector<std::string> GenericTriggerEventFlag::hltLogicalExpressionsCache_
private

Definition at line 73 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), and initRun().

bool GenericTriggerEventFlag::l1BeforeMask_
private

Definition at line 64 of file GenericTriggerEventFlag.h.

Referenced by acceptL1LogicalExpression(), and GenericTriggerEventFlag().

std::string GenericTriggerEventFlag::l1DBKey_
private

Definition at line 65 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), initRun(), and l1DBKey().

std::unique_ptr<L1GtUtils> GenericTriggerEventFlag::l1Gt_
private
std::vector<std::string> GenericTriggerEventFlag::l1LogicalExpressions_
private

Definition at line 67 of file GenericTriggerEventFlag.h.

Referenced by acceptL1(), and initRun().

std::vector<std::string> GenericTriggerEventFlag::l1LogicalExpressionsCache_
private

Definition at line 66 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), and initRun().

std::unique_ptr<l1t::L1TGlobalUtil> GenericTriggerEventFlag::l1uGt_
private
bool GenericTriggerEventFlag::on_
private

Definition at line 77 of file GenericTriggerEventFlag.h.

Referenced by accept(), GenericTriggerEventFlag(), and on().

bool GenericTriggerEventFlag::onDcs_
private

Definition at line 78 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::onGt_
private

Definition at line 79 of file GenericTriggerEventFlag.h.

Referenced by acceptGt(), GenericTriggerEventFlag(), and initRun().

bool GenericTriggerEventFlag::onHlt_
private
bool GenericTriggerEventFlag::onL1_
private

Definition at line 80 of file GenericTriggerEventFlag.h.

Referenced by acceptL1(), GenericTriggerEventFlag(), and initRun().

bool GenericTriggerEventFlag::stage2_
private
unsigned GenericTriggerEventFlag::verbose_
private
std::unique_ptr<edm::ESWatcher<AlCaRecoTriggerBitsRcd> > GenericTriggerEventFlag::watchDB_
private

Definition at line 40 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), and initRun().