CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | 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, l1t::UseEventSetupIn use=l1t::UseEventSetupIn::RunAndEvent)
 
 GenericTriggerEventFlag (const edm::ParameterSet &config, edm::ConsumesCollector &iC, l1t::UseEventSetupIn use=l1t::UseEventSetupIn::RunAndEvent)
 
template<typename T >
 GenericTriggerEventFlag (const edm::ParameterSet &config, edm::ConsumesCollector &&iC, T &module, l1t::UseEventSetupIn use=l1t::UseEventSetupIn::RunAndEvent)
 
template<typename T >
 GenericTriggerEventFlag (const edm::ParameterSet &config, edm::ConsumesCollector &iC, T &module, l1t::UseEventSetupIn use=l1t::UseEventSetupIn::RunAndEvent)
 
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

edm::ESGetToken
< AlCaRecoTriggerBits,
AlCaRecoTriggerBitsRcd
alCaRecoTriggerBitsToken_
 
bool andOr_
 
bool andOrDcs_
 
bool andOrGt_
 
bool andOrHlt_
 
bool andOrL1_
 
const std::string configError_
 
std::string dbLabel_
 
edm::InputTag dcsInputTag_
 
edm::EDGetTokenT
< DcsStatusCollection
dcsInputToken_
 
std::vector< int > dcsPartitions_
 
const std::string emptyKeyError_
 
bool errorReplyDcs_
 
bool errorReplyGt_
 
bool errorReplyHlt_
 
bool errorReplyL1_
 
std::string gtDBKey_
 
edm::InputTag gtEvmInputTag_
 
edm::EDGetTokenT
< L1GlobalTriggerEvmReadoutRecord
gtEvmInputToken_
 
edm::InputTag gtInputTag_
 
edm::EDGetTokenT
< L1GlobalTriggerReadoutRecord
gtInputToken_
 
std::vector< std::string > gtLogicalExpressions_
 
HLTConfigProvider hltConfig_
 
bool hltConfigInit_
 
std::string hltDBKey_
 
edm::InputTag hltInputTag_
 
edm::EDGetTokenT
< edm::TriggerResults
hltInputToken_
 
std::vector< std::string > hltLogicalExpressions_
 
std::vector< std::string > hltLogicalExpressionsCache_
 
bool l1BeforeMask_
 
std::string l1DBKey_
 
std::unique_ptr< L1GtUtilsl1Gt_
 
edm::ESGetToken
< L1GtTriggerMenu,
L1GtTriggerMenuRcd
l1GtTriggerMenuToken_
 
std::vector< std::string > l1LogicalExpressions_
 
std::vector< std::string > l1LogicalExpressionsCache_
 
std::unique_ptr
< l1t::L1TGlobalUtil
l1uGt_
 
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 42 of file GenericTriggerEventFlag.h.

Constructor & Destructor Documentation

GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector &&  iC,
l1t::UseEventSetupIn  use = l1t::UseEventSetupIn::RunAndEvent 
)
inline

Definition at line 113 of file GenericTriggerEventFlag.h.

116  : GenericTriggerEventFlag(config, iC, use) {}
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC, l1t::UseEventSetupIn use=l1t::UseEventSetupIn::RunAndEvent)
GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector iC,
l1t::UseEventSetupIn  use = l1t::UseEventSetupIn::RunAndEvent 
)

Definition at line 20 of file GenericTriggerEventFlag.cc.

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

23  : GenericTriggerEventFlag(config, iC, false) {
24  if (config.exists("andOrL1")) {
25  if (stage2_) {
26  l1uGt_ = std::make_unique<l1t::L1TGlobalUtil>(config, iC, use);
27  }
28  }
29 }
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC, l1t::UseEventSetupIn use=l1t::UseEventSetupIn::RunAndEvent)
bool exists(std::string const &parameterName) const
checks if a parameter exists
tuple config
parse the configuration file
std::unique_ptr< l1t::L1TGlobalUtil > l1uGt_
template<typename T >
GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector &&  iC,
T module,
l1t::UseEventSetupIn  use = l1t::UseEventSetupIn::RunAndEvent 
)

Definition at line 183 of file GenericTriggerEventFlag.h.

187  : GenericTriggerEventFlag(config, iC, module, use) {}
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC, l1t::UseEventSetupIn use=l1t::UseEventSetupIn::RunAndEvent)
tuple module
Definition: callgraph.py:69
template<typename T >
GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector iC,
T module,
l1t::UseEventSetupIn  use = l1t::UseEventSetupIn::RunAndEvent 
)

Definition at line 190 of file GenericTriggerEventFlag.h.

References submitPVResolutionJobs::config, l1t::Event, L1GtUtils::Event, edm::ParameterSet::exists(), l1Gt_, l1uGt_, callgraph::module, on_, L1GtUtils::Run, l1t::RunAndEvent, L1GtUtils::RunAndEvent, and stage2_.

194  : GenericTriggerEventFlag(config, iC, true) {
195  if (on_ && config.exists("andOrL1")) {
196  if (stage2_) {
197  l1uGt_ = std::make_unique<l1t::L1TGlobalUtil>(config, iC, use);
198  } else {
202  } else if (use == l1t::UseEventSetupIn::Event) {
203  useL1GtUtilsIn = L1GtUtils::UseEventSetupIn::Event;
204  }
205  l1Gt_ = std::make_unique<L1GtUtils>(config, iC, false, module, useL1GtUtilsIn);
206  }
207  }
208  //these pointers are already null so no need to reset them to a nullptr
209  //if andOrL1 doesnt exist
210 }
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC, l1t::UseEventSetupIn use=l1t::UseEventSetupIn::RunAndEvent)
bool exists(std::string const &parameterName) const
checks if a parameter exists
UseEventSetupIn
Definition: L1GtUtils.h:76
std::unique_ptr< L1GtUtils > l1Gt_
tuple config
parse the configuration file
std::unique_ptr< l1t::L1TGlobalUtil > l1uGt_
tuple module
Definition: callgraph.py:69
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 32 of file GenericTriggerEventFlag.cc.

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

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

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

Referenced by dEdxAnalyzer::analyze(), dEdxHitAnalyzer::analyze(), MonitorTrackResidualsBase< pixel_or_strip >::analyze(), SiStripMonitorCluster::analyze(), LogMessageMonitor::analyze(), V0Monitor::analyze(), SiStripMonitorTrack::analyze(), TrackingMonitor::analyze(), and esMonitoring.FDJsonServer::handle_accept().

266  {
267  if (!on_)
268  return true;
269 
270  // Determine decision
271  if (andOr_)
272  return (acceptDcs(event) || acceptGt(event) || acceptL1(event, setup) || acceptHlt(event));
273  return (acceptDcs(event) && acceptGt(event) && acceptL1(event, setup) && acceptHlt(event));
274 }
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 276 of file GenericTriggerEventFlag.cc.

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

Referenced by accept().

276  {
277  // An empty DCS partitions list acts as switch.
278  if (!onDcs_ || dcsPartitions_.empty())
279  return (!andOr_); // logically neutral, depending on base logical connective
280 
281  // Accessing the DcsStatusCollection
283  event.getByToken(dcsInputToken_, dcsStatus);
284  if (!dcsStatus.isValid()) {
285  if (verbose_ > 1)
286  edm::LogWarning("GenericTriggerEventFlag")
287  << "DcsStatusCollection product with InputTag \"" << dcsInputTag_.encode()
288  << "\" not in event ==> decision: " << errorReplyDcs_;
289  return errorReplyDcs_;
290  }
291  if ((*dcsStatus).empty()) {
292  if (verbose_ > 1)
293  edm::LogWarning("GenericTriggerEventFlag")
294  << "DcsStatusCollection product with InputTag \"" << dcsInputTag_.encode()
295  << "\" empty ==> decision: " << errorReplyDcs_;
296  return errorReplyDcs_;
297  }
298 
299  // Determine decision of DCS partition combination and return
300  if (andOrDcs_) { // OR combination
301  for (std::vector<int>::const_iterator partitionNumber = dcsPartitions_.begin();
302  partitionNumber != dcsPartitions_.end();
303  ++partitionNumber) {
304  if (acceptDcsPartition(dcsStatus, *partitionNumber))
305  return true;
306  }
307  return false;
308  }
309  for (std::vector<int>::const_iterator partitionNumber = dcsPartitions_.begin();
310  partitionNumber != dcsPartitions_.end();
311  ++partitionNumber) {
312  if (!acceptDcsPartition(dcsStatus, *partitionNumber))
313  return false;
314  }
315  return true;
316 }
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_
Log< level::Warning, false > LogWarning
bool GenericTriggerEventFlag::acceptDcsPartition ( const edm::Handle< DcsStatusCollection > &  dcsStatus,
int  dcsPartition 
) const
private

Definition at line 318 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().

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

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

Definition at line 359 of file GenericTriggerEventFlag.cc.

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

Referenced by accept().

359  {
360  // An empty GT status bits logical expressions list acts as switch.
361  if (!onGt_ || gtLogicalExpressions_.empty())
362  return (!andOr_); // logically neutral, depending on base logical connective
363 
364  // Determine decision of GT status bits logical expression combination and return
365  if (andOrGt_) { // OR combination
366  for (std::vector<std::string>::const_iterator gtLogicalExpression = gtLogicalExpressions_.begin();
367  gtLogicalExpression != gtLogicalExpressions_.end();
368  ++gtLogicalExpression) {
369  if (acceptGtLogicalExpression(event, *gtLogicalExpression))
370  return true;
371  }
372  return false;
373  }
374  for (std::vector<std::string>::const_iterator gtLogicalExpression = gtLogicalExpressions_.begin();
375  gtLogicalExpression != gtLogicalExpressions_.end();
376  ++gtLogicalExpression) {
377  if (!acceptGtLogicalExpression(event, *gtLogicalExpression))
378  return false;
379  }
380  return true;
381 }
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 384 of file GenericTriggerEventFlag.cc.

References edm::InputTag::encode(), errorReplyDcs_, errorReplyGt_, L1GtLogicParser::expressionResult(), gtEvmInputTag_, gtEvmInputToken_, gtInputTag_, gtInputToken_, edm::HandleBase::isValid(), negate(), L1GtLogicParser::operandTokenVector(), AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

Referenced by acceptGt().

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

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

Definition at line 561 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().

561  {
562  // An empty HLT logical expressions list acts as switch.
563  if (!onHlt_ || hltLogicalExpressions_.empty())
564  return (!andOr_); // logically neutral, depending on base logical connective
565 
566  // Checking the HLT configuration,
567  if (!hltConfigInit_) {
568  if (verbose_ > 1)
569  edm::LogWarning("GenericTriggerEventFlag") << "HLT config error ==> decision: " << errorReplyHlt_;
570  return errorReplyHlt_;
571  }
572 
573  // Accessing the TriggerResults
574  edm::Handle<edm::TriggerResults> hltTriggerResults;
575  event.getByToken(hltInputToken_, hltTriggerResults);
576  if (!hltTriggerResults.isValid()) {
577  if (verbose_ > 1)
578  edm::LogWarning("GenericTriggerEventFlag") << "TriggerResults product with InputTag \"" << hltInputTag_.encode()
579  << "\" not in event ==> decision: " << errorReplyHlt_;
580  return errorReplyHlt_;
581  }
582  if ((*hltTriggerResults).size() == 0) {
583  if (verbose_ > 1)
584  edm::LogWarning("GenericTriggerEventFlag") << "TriggerResults product with InputTag \"" << hltInputTag_.encode()
585  << "\" empty ==> decision: " << errorReplyHlt_;
586  return errorReplyDcs_;
587  }
588 
589  // Determine decision of HLT logical expression combination and return
590  if (andOrHlt_) { // OR combination
591  for (std::vector<std::string>::const_iterator hltLogicalExpression = hltLogicalExpressions_.begin();
592  hltLogicalExpression != hltLogicalExpressions_.end();
593  ++hltLogicalExpression) {
594  if (acceptHltLogicalExpression(hltTriggerResults, *hltLogicalExpression))
595  return true;
596  }
597  return false;
598  }
599  for (std::vector<std::string>::const_iterator hltLogicalExpression = hltLogicalExpressions_.begin();
600  hltLogicalExpression != hltLogicalExpressions_.end();
601  ++hltLogicalExpression) {
602  if (!acceptHltLogicalExpression(hltTriggerResults, *hltLogicalExpression))
603  return false;
604  }
605  return true;
606 }
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
Log< level::Warning, false > LogWarning
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 609 of file GenericTriggerEventFlag.cc.

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

Referenced by acceptHlt().

610  {
611  // Check empty std::strings
612  if (hltLogicalExpression.empty()) {
613  if (verbose_ > 1)
614  edm::LogWarning("GenericTriggerEventFlag") << "Empty logical expression ==> decision: " << errorReplyHlt_;
615  return errorReplyHlt_;
616  }
617 
618  // Negated paths
619  bool negExpr(negate(hltLogicalExpression));
620  if (negExpr && hltLogicalExpression.empty()) {
621  if (verbose_ > 1)
622  edm::LogWarning("GenericTriggerEventFlag")
623  << "Empty (negated) logical expression ==> decision: " << errorReplyHlt_;
624  return errorReplyHlt_;
625  }
626 
627  // Parse logical expression and determine HLT decision
628  L1GtLogicParser hltAlgoLogicParser(hltLogicalExpression);
629  // Loop over paths
630  for (size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath) {
631  const std::string hltPathName(hltAlgoLogicParser.operandTokenVector().at(iPath).tokenName);
632  const unsigned indexPath(hltConfig_.triggerIndex(hltPathName));
633  // Further error checks
634  if (indexPath == hltConfig_.size()) {
635  if (verbose_ > 1)
636  edm::LogWarning("GenericTriggerEventFlag") << "HLT path \"" << hltPathName << "\" is not found in process "
637  << hltInputTag_.process() << " ==> decision: " << errorReplyHlt_;
638  hltAlgoLogicParser.operandTokenVector().at(iPath).tokenResult = errorReplyHlt_;
639  continue;
640  }
641  if (hltTriggerResults->error(indexPath)) {
642  if (verbose_ > 1)
643  edm::LogWarning("GenericTriggerEventFlag")
644  << "HLT path \"" << hltPathName << "\" in error ==> decision: " << errorReplyHlt_;
645  hltAlgoLogicParser.operandTokenVector().at(iPath).tokenResult = errorReplyHlt_;
646  continue;
647  }
648  // Manipulate algo decision as stored in the parser
649  const bool decision(hltTriggerResults->accept(indexPath));
650  hltAlgoLogicParser.operandTokenVector().at(iPath).tokenResult = decision;
651  }
652 
653  // Determine decision
654  const bool hltDecision(hltAlgoLogicParser.expressionResult());
655  return negExpr ? (!hltDecision) : hltDecision;
656 }
unsigned int size() const
number of trigger paths in trigger table
bool negate(std::string &word) const
Checks for negated words.
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
Log< level::Warning, false > LogWarning
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 467 of file GenericTriggerEventFlag.cc.

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

Referenced by accept().

467  {
468  // An empty L1 logical expressions list acts as switch.
469  if (!onL1_ || l1LogicalExpressions_.empty())
470  return (!andOr_); // logically neutral, depending on base logical connective
471 
472  // Determine decision of L1 logical expression combination and return
473  if (andOrL1_) { // OR combination
474  for (std::vector<std::string>::const_iterator l1LogicalExpression = l1LogicalExpressions_.begin();
475  l1LogicalExpression != l1LogicalExpressions_.end();
476  ++l1LogicalExpression) {
477  if (acceptL1LogicalExpression(event, setup, *l1LogicalExpression))
478  return true;
479  }
480  return false;
481  }
482  for (std::vector<std::string>::const_iterator l1LogicalExpression = l1LogicalExpressions_.begin();
483  l1LogicalExpression != l1LogicalExpressions_.end();
484  ++l1LogicalExpression) {
485  if (!acceptL1LogicalExpression(event, setup, *l1LogicalExpression))
486  return false;
487  }
488  return true;
489 }
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 492 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().

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

Definition at line 732 of file GenericTriggerEventFlag.cc.

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

732  {
733  if (not onHlt_) {
734  return true;
735  }
736 
737  if (not hltConfigInit_) {
738  if (verbose_ > 0) {
739  edm::LogWarning("GenericTriggerEventFlag::allHLTPathsAreValid()")
740  << "HLTConfigProvider is not initialized, method will return \"false\"";
741  }
742 
743  return false;
744  }
745 
746  for (unsigned iExpr = 0; iExpr < hltLogicalExpressions_.size(); ++iExpr) {
747  std::string hltLogicalExpression = hltLogicalExpressions_.at(iExpr);
748 
749  L1GtLogicParser hltAlgoLogicParser(hltLogicalExpression);
750 
751  if (hltAlgoLogicParser.operandTokenVector().empty()) {
752  return false;
753  }
754 
755  for (size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath) {
756  const std::string hltPathName(hltAlgoLogicParser.operandTokenVector().at(iPath).tokenName);
757 
758  const unsigned indexPath(hltConfig_.triggerIndex(hltPathName));
759 
760  if (indexPath == hltConfig_.size()) {
761  if (verbose_ > 1) {
762  edm::LogWarning("GenericTriggerEventFlag::allHLTPathsAreValid()")
763  << "HLT path \"" << hltPathName << "\" is not found in process " << hltInputTag_.process();
764  }
765 
766  return false;
767  }
768  }
769  }
770 
771  return true;
772 }
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
Log< level::Warning, false > LogWarning
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 659 of file GenericTriggerEventFlag.cc.

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

Referenced by initRun().

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

Reads and returns logical expressions from DB.

Definition at line 705 of file GenericTriggerEventFlag.cc.

References alCaRecoTriggerBitsToken_, configError_, dbLabel_, emptyKeyError_, edm::EventSetup::get(), edm::EventSetup::getData(), HLT_FULL_cff::labels, and verbose_.

Referenced by initRun().

706  {
707  if (key.empty())
708  return std::vector<std::string>(1, emptyKeyError_);
709  std::vector<edm::eventsetup::DataKey> labels;
710  setup.get<AlCaRecoTriggerBitsRcd>().fillRegisteredDataKeys(labels);
711  std::vector<edm::eventsetup::DataKey>::const_iterator iKey = labels.begin();
712  while (iKey != labels.end() && iKey->name().value() != dbLabel_)
713  ++iKey;
714  if (iKey == labels.end()) {
715  if (verbose_ > 0)
716  edm::LogWarning("GenericTriggerEventFlag")
717  << "Label " << dbLabel_ << " not found in DB for 'AlCaRecoTriggerBitsRcd'";
718  return std::vector<std::string>(1, configError_);
719  }
720  auto const& alCaRecoTriggerBits = setup.getData(alCaRecoTriggerBitsToken_);
721  const std::map<std::string, std::string>& expressionMap = alCaRecoTriggerBits.m_alcarecoToTrig;
722  std::map<std::string, std::string>::const_iterator listIter = expressionMap.find(key);
723  if (listIter == expressionMap.end()) {
724  if (verbose_ > 0)
725  edm::LogWarning("GenericTriggerEventFlag")
726  << "No logical expressions found under key " << key << " in 'AlCaRecoTriggerBitsRcd'";
727  return std::vector<std::string>(1, configError_);
728  }
729  return alCaRecoTriggerBits.decompose(listIter->second);
730 }
bool getData(T &iHolder) const
Definition: EventSetup.h:128
tuple key
prepare the HTCondor submission files and eventually submit them
edm::ESGetToken< AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd > alCaRecoTriggerBitsToken_
T get() const
Definition: EventSetup.h:88
Log< level::Warning, false > LogWarning
std::string GenericTriggerEventFlag::gtDBKey ( )
inline

Definition at line 174 of file GenericTriggerEventFlag.h.

References gtDBKey_.

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

Definition at line 176 of file GenericTriggerEventFlag.h.

References hltDBKey_.

176 { 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 153 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_, l1GtTriggerMenuToken_, l1LogicalExpressions_, l1LogicalExpressionsCache_, l1uGt_, onGt_, onHlt_, onL1_, makeHLTPrescaleTable::prescales, edm::InputTag::process(), HLTConfigProvider::size(), stage2_, AlCaHLTBitMon_QueryRunRegistry::string, createJobs::tmp, HLTConfigProvider::triggerNames(), useL1EventSetup(), useL1GtTriggerMenuLite(), verbose_, and watchDB_.

Referenced by dEdxAnalyzer::bookHistograms(), V0Monitor::bookHistograms(), LogMessageMonitor::bookHistograms(), TrackingMonitor::bookHistograms(), dEdxHitAnalyzer::dqmBeginRun(), MonitorTrackResidualsBase< pixel_or_strip >::dqmBeginRun(), SiStripMonitorCluster::dqmBeginRun(), and SiStripMonitorTrack::dqmBeginRun().

153  {
154  if (watchDB_->check(setup)) {
155  if (onGt_ && !gtDBKey_.empty()) {
156  const std::vector<std::string> exprs(expressionsFromDB(gtDBKey_, setup));
157  if (exprs.empty() || exprs.at(0) != configError_)
158  gtLogicalExpressions_ = exprs;
159  }
160  if (onL1_ && !l1DBKey_.empty()) {
161  const std::vector<std::string> exprs(expressionsFromDB(l1DBKey_, setup));
162  if (exprs.empty() || exprs.at(0) != configError_)
164  }
165  if (onHlt_ && !hltDBKey_.empty()) {
166  const std::vector<std::string> exprs(expressionsFromDB(hltDBKey_, setup));
167  if (exprs.empty() || exprs.at(0) != configError_)
169  }
170  }
171 
172  // Re-initialise starting valuse before wild-card expansion
175 
176  hltConfigInit_ = false;
177  if (onHlt_) {
178  if (hltInputTag_.process().empty()) {
179  if (verbose_ > 0)
180  edm::LogError("GenericTriggerEventFlag")
181  << "HLT TriggerResults InputTag \"" << hltInputTag_.encode() << "\" specifies no process";
182  } else {
183  bool hltChanged(false);
184  if (!hltConfig_.init(run, setup, hltInputTag_.process(), hltChanged)) {
185  if (verbose_ > 0)
186  edm::LogError("GenericTriggerEventFlag")
187  << "HLT config initialization error with process name \"" << hltInputTag_.process() << "\"";
188  } else if (hltConfig_.size() <= 0) {
189  if (verbose_ > 0)
190  edm::LogError("GenericTriggerEventFlag") << "HLT config size error";
191  } else
192  hltConfigInit_ = true;
193  }
194  }
195 
196  // Expand version wild-cards in HLT logical expressions
197  // L1
198  if (onL1_) {
199  // build vector of algo names
200 
201  std::vector<std::string> algoNames;
202 
203  if (stage2_) {
204  l1uGt_->retrieveL1Setup(setup);
205 
206  const std::vector<std::pair<std::string, double> > prescales = l1uGt_->prescales();
207  for (const auto& ip : prescales)
208  algoNames.push_back(ip.first);
209  } else {
210  l1Gt_->getL1GtRunCache(run, setup, useL1EventSetup, useL1GtTriggerMenuLite);
211  L1GtTriggerMenu const& l1GtTriggerMenu = setup.get<L1GtTriggerMenuRcd>().get(l1GtTriggerMenuToken_);
212 
213  const AlgorithmMap& l1GtPhys(l1GtTriggerMenu.gtAlgorithmMap());
214  for (CItAlgo iAlgo = l1GtPhys.begin(); iAlgo != l1GtPhys.end(); ++iAlgo) {
215  algoNames.push_back(iAlgo->second.algoName());
216  }
217  const AlgorithmMap& l1GtTech(l1GtTriggerMenu.gtTechnicalTriggerMap());
218  for (CItAlgo iAlgo = l1GtTech.begin(); iAlgo != l1GtTech.end(); ++iAlgo) {
219  algoNames.push_back(iAlgo->second.algoName());
220  }
221  }
222 
223  for (unsigned iExpr = 0; iExpr < l1LogicalExpressions_.size(); ++iExpr) {
224  std::string l1LogicalExpression(l1LogicalExpressions_.at(iExpr));
225  L1GtLogicParser l1AlgoLogicParser(l1LogicalExpression);
226  // Loop over algorithms
227  for (size_t iAlgo = 0; iAlgo < l1AlgoLogicParser.operandTokenVector().size(); ++iAlgo) {
228  const std::string l1AlgoName(l1AlgoLogicParser.operandTokenVector().at(iAlgo).tokenName);
229  if (l1AlgoName.find('*') != std::string::npos) {
230  l1LogicalExpression.replace(
231  l1LogicalExpression.find(l1AlgoName), l1AlgoName.size(), expandLogicalExpression(algoNames, l1AlgoName));
232  }
233  }
234  l1LogicalExpressions_[iExpr] = l1LogicalExpression;
235  }
236  std::vector<std::string> tmp = l1LogicalExpressions_;
237  for (unsigned iExpr = 0; iExpr < tmp.size(); ++iExpr)
238  if (std::find(algoNames.begin(), algoNames.end(), tmp[iExpr]) == algoNames.end()) {
239  l1LogicalExpressions_.erase(l1LogicalExpressions_.begin() + iExpr);
240  if (verbose_ > 1)
241  edm::LogWarning("GenericTriggerEventFlag")
242  << "L1 algorithm \"" << tmp[iExpr]
243  << "\" does not exist in the L1 menu ==> drop it from the list of l1LogicalExpressions";
244  }
245  }
246  // HLT
247  if (hltConfigInit_) {
248  for (unsigned iExpr = 0; iExpr < hltLogicalExpressions_.size(); ++iExpr) {
249  std::string hltLogicalExpression(hltLogicalExpressions_.at(iExpr));
250  L1GtLogicParser hltAlgoLogicParser(hltLogicalExpression);
251  // Loop over paths
252  for (size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath) {
253  const std::string hltPathName(hltAlgoLogicParser.operandTokenVector().at(iPath).tokenName);
254  if (hltPathName.find('*') != std::string::npos) {
255  hltLogicalExpression.replace(hltLogicalExpression.find(hltPathName),
256  hltPathName.size(),
258  }
259  }
260  hltLogicalExpressions_[iExpr] = hltLogicalExpression;
261  }
262  }
263 }
unsigned int size() const
number of trigger paths in trigger table
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > l1GtTriggerMenuToken_
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
Log< level::Error, false > LogError
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:88
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
Log< level::Warning, false > LogWarning
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 175 of file GenericTriggerEventFlag.h.

References l1DBKey_.

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

Checks for negated words.

Definition at line 695 of file GenericTriggerEventFlag.cc.

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

695  {
696  bool negate(false);
697  if (word.at(0) == '~') {
698  negate = true;
699  word.erase(0, 1);
700  }
701  return negate;
702 }
bool negate(std::string &word) const
Checks for negated words.
uint64_t word
bool GenericTriggerEventFlag::off ( )
inline

Definition at line 136 of file GenericTriggerEventFlag.h.

References on_.

136 { return (!on_); }
bool GenericTriggerEventFlag::on ( )
inline

Member Data Documentation

edm::ESGetToken<AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd> GenericTriggerEventFlag::alCaRecoTriggerBitsToken_
private

Definition at line 50 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB(), and GenericTriggerEventFlag().

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

Definition at line 55 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::andOrGt_
private

Definition at line 60 of file GenericTriggerEventFlag.h.

Referenced by acceptGt(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::andOrHlt_
private

Definition at line 75 of file GenericTriggerEventFlag.h.

Referenced by acceptHlt(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::andOrL1_
private

Definition at line 68 of file GenericTriggerEventFlag.h.

Referenced by acceptL1(), and GenericTriggerEventFlag().

const std::string GenericTriggerEventFlag::configError_
private

Definition at line 89 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB(), and initRun().

std::string GenericTriggerEventFlag::dbLabel_
private

Definition at line 53 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB(), and GenericTriggerEventFlag().

edm::InputTag GenericTriggerEventFlag::dcsInputTag_
private

Definition at line 56 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

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

Definition at line 57 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

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

Definition at line 58 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

const std::string GenericTriggerEventFlag::emptyKeyError_
private

Definition at line 90 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB().

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

Definition at line 67 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

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

Definition at line 74 of file GenericTriggerEventFlag.h.

Referenced by acceptL1LogicalExpression(), and GenericTriggerEventFlag().

std::string GenericTriggerEventFlag::gtDBKey_
private

Definition at line 65 of file GenericTriggerEventFlag.h.

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

edm::InputTag GenericTriggerEventFlag::gtEvmInputTag_
private

Definition at line 63 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

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

Definition at line 64 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

edm::InputTag GenericTriggerEventFlag::gtInputTag_
private

Definition at line 61 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

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

Definition at line 62 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

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

Definition at line 66 of file GenericTriggerEventFlag.h.

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

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

Definition at line 48 of file GenericTriggerEventFlag.h.

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

std::string GenericTriggerEventFlag::hltDBKey_
private

Definition at line 78 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 77 of file GenericTriggerEventFlag.h.

Referenced by acceptHlt(), and GenericTriggerEventFlag().

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

Definition at line 80 of file GenericTriggerEventFlag.h.

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

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

Definition at line 79 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), and initRun().

bool GenericTriggerEventFlag::l1BeforeMask_
private

Definition at line 70 of file GenericTriggerEventFlag.h.

Referenced by acceptL1LogicalExpression(), and GenericTriggerEventFlag().

std::string GenericTriggerEventFlag::l1DBKey_
private

Definition at line 71 of file GenericTriggerEventFlag.h.

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

std::unique_ptr<L1GtUtils> GenericTriggerEventFlag::l1Gt_
private
edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> GenericTriggerEventFlag::l1GtTriggerMenuToken_
private

Definition at line 49 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), and initRun().

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

Definition at line 73 of file GenericTriggerEventFlag.h.

Referenced by acceptL1(), and initRun().

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

Definition at line 72 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), and initRun().

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

Definition at line 83 of file GenericTriggerEventFlag.h.

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

bool GenericTriggerEventFlag::onDcs_
private

Definition at line 84 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::onGt_
private

Definition at line 85 of file GenericTriggerEventFlag.h.

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

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

Definition at line 86 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 44 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), and initRun().