test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private 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...
 
std::vector< std::string > expressionsFromDB (const std::string &key, const edm::EventSetup &setup)
 Reads and returns logical expressions from DB. More...
 
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 ()
 
 ~GenericTriggerEventFlag ()
 To be called from d'tors by 'delete'. More...
 

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)
 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
< 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_
 
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_
 
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 41 of file GenericTriggerEventFlag.h.

Constructor & Destructor Documentation

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

Definition at line 146 of file GenericTriggerEventFlag.h.

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

Definition at line 151 of file GenericTriggerEventFlag.h.

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

151  :
152  GenericTriggerEventFlag(config, iC) {
153  if ( config.exists( "andOrL1" ) )
154  if (stage2_)
155  l1uGt_.reset(new l1t::L1TGlobalUtil(config, iC));
156  else
157  l1Gt_.reset(new L1GtUtils(config, iC, false, module));
158  else {
159  l1uGt_.reset(NULL);
160  l1Gt_.reset(NULL);
161  }
162 }
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC, T &module)
bool exists(std::string const &parameterName) const
checks if a parameter exists
#define NULL
Definition: scimark2.h:8
std::unique_ptr< L1GtUtils > l1Gt_
Definition: vlib.h:208
std::unique_ptr< l1t::L1TGlobalUtil > l1uGt_
GenericTriggerEventFlag::~GenericTriggerEventFlag ( )

To be called from d'tors by 'delete'.

Definition at line 125 of file GenericTriggerEventFlag.cc.

References on_, and watchDB_.

126 {
127 
128  if ( on_ ) delete watchDB_;
129 
130 }
edm::ESWatcher< AlCaRecoTriggerBitsRcd > * watchDB_
GenericTriggerEventFlag::GenericTriggerEventFlag ( const edm::ParameterSet config,
edm::ConsumesCollector iC 
)
private

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

Definition at line 25 of file GenericTriggerEventFlag.cc.

References andOr_, andOrDcs_, andOrGt_, andOrHlt_, andOrL1_, dbLabel_, dcsInputTag_, dcsInputToken_, dcsPartitions_, errorReplyDcs_, errorReplyGt_, errorReplyHlt_, errorReplyL1_, 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_.

26  : watchDB_( 0 )
27  , hltConfigInit_( false )
28  , andOr_( false )
29  , dbLabel_( "" )
30  , verbose_( 0 )
31  , andOrDcs_( false )
32  , errorReplyDcs_( false )
33  , andOrGt_( false )
34  , gtInputTag_( "" )
35  , gtEvmInputTag_( "" )
36  , gtDBKey_( "" )
37  , errorReplyGt_( false )
38  , andOrL1_( false )
39  , stage2_( false )
40  , l1BeforeMask_( true )
41  , l1DBKey_( "" )
42  , errorReplyL1_( false )
43  , andOrHlt_( false )
44  , hltDBKey_( "" )
45  , errorReplyHlt_( false )
46  , on_( true )
47  , onDcs_( true )
48  , onGt_( true )
49  , onL1_( true )
50  , onHlt_( true )
51  , configError_( "CONFIG_ERROR" )
52  , emptyKeyError_( "EMPTY_KEY_ERROR" )
53 {
54 
55  // General switch(es)
56  if ( config.exists( "andOr" ) ) {
57  andOr_ = config.getParameter< bool >( "andOr" );
58  if ( config.exists( "verbosityLevel" ) ) verbose_ = config.getParameter< unsigned >( "verbosityLevel" );
59  } else {
60  on_ = false;
61  onDcs_ = false;
62  onGt_ = false;
63  onL1_ = false;
64  onHlt_ = false;
65  }
66 
67  if ( on_ ) {
68  if ( config.exists( "andOrDcs" ) ) {
69  andOrDcs_ = config.getParameter< bool >( "andOrDcs" );
70  dcsInputTag_ = config.getParameter< edm::InputTag >( "dcsInputTag" );
72  dcsPartitions_ = config.getParameter< std::vector< int > >( "dcsPartitions" );
73  errorReplyDcs_ = config.getParameter< bool >( "errorReplyDcs" );
74  } else {
75  onDcs_ = false;
76  }
77  if ( config.exists( "andOrGt" ) ) {
78  andOrGt_ = config.getParameter< bool >( "andOrGt" );
79  gtInputTag_ = config.getParameter< edm::InputTag >( "gtInputTag" );
81  gtLogicalExpressions_ = config.getParameter< std::vector< std::string > >( "gtStatusBits" );
82  errorReplyGt_ = config.getParameter< bool >( "errorReplyGt" );
83  if ( config.exists( "gtEvmInputTag" ) ) {
84  gtEvmInputTag_ = config.getParameter< edm::InputTag >( "gtEvmInputTag" );
86  }
87  if ( config.exists( "gtDBKey" ) ) gtDBKey_ = config.getParameter< std::string >( "gtDBKey" );
88  } else {
89  onGt_ = false;
90  }
91  if ( config.exists( "andOrL1" ) ) {
92  andOrL1_ = config.getParameter< bool >( "andOrL1" );
93  if ( config.exists( "stage2" ) )
94  stage2_ = config.getParameter< bool> ( "stage2" );
95  else
96  stage2_ = false;
97  l1LogicalExpressionsCache_ = config.getParameter< std::vector< std::string > >( "l1Algorithms" );
98  errorReplyL1_ = config.getParameter< bool >( "errorReplyL1" );
99  if ( config.exists( "l1DBKey" ) ) l1DBKey_ = config.getParameter< std::string >( "l1DBKey" );
100  if ( config.exists( "l1BeforeMask" ) ) l1BeforeMask_ = config.getParameter< bool >( "l1BeforeMask" );
101  } else {
102  onL1_ = false;
103  }
104  if ( config.exists( "andOrHlt" ) ) {
105  andOrHlt_ = config.getParameter< bool >( "andOrHlt" );
106  hltInputTag_ = config.getParameter< edm::InputTag >( "hltInputTag" );
108  hltLogicalExpressionsCache_ = config.getParameter< std::vector< std::string > >( "hltPaths" );
109  errorReplyHlt_ = config.getParameter< bool >( "errorReplyHlt" );
110  if ( config.exists( "hltDBKey" ) ) hltDBKey_ = config.getParameter< std::string >( "hltDBKey" );
111  } else {
112  onHlt_ = false;
113  }
114  if ( ! onDcs_ && ! onGt_ && ! onL1_ && ! onHlt_ ) on_ = false;
115  else {
116  if ( config.exists( "dbLabel" ) ) dbLabel_ = config.getParameter< std::string >( "dbLabel" );
118  }
119  }
120 
121 }
T getParameter(std::string const &) const
std::vector< int > dcsPartitions_
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtInputToken_
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
std::vector< std::string > gtLogicalExpressions_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::TriggerResults > hltInputToken_
std::vector< std::string > l1LogicalExpressionsCache_
edm::EDGetTokenT< DcsStatusCollection > dcsInputToken_
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > gtEvmInputToken_
std::vector< DcsStatus > DcsStatusCollection
Definition: DcsStatus.h:116
edm::ESWatcher< AlCaRecoTriggerBitsRcd > * watchDB_
std::vector< std::string > hltLogicalExpressionsCache_

Member Function Documentation

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

To be called from analyze/filter() methods.

Definition at line 239 of file GenericTriggerEventFlag.cc.

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

Referenced by dEdxHitAnalyzer::analyze(), SiStripMonitorCluster::analyze(), dEdxAnalyzer::analyze(), V0Monitor::analyze(), TrackingMonitor::analyze(), LogMessageMonitor::analyze(), SiStripMonitorTrack::analyze(), Vispa.Gui.BoxContentDialog.BoxContentDialog::apply(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog::apply(), and esMonitoring.FDJsonServer::handle_accept().

240 {
241 
242  if ( ! on_ ) return true;
243 
244  // Determine decision
245  if ( andOr_ ) return ( acceptDcs( event ) || acceptGt( event ) || acceptL1( event, setup ) || acceptHlt( event ) );
246  return ( acceptDcs( event ) && acceptGt( event ) && acceptL1( event, setup ) && acceptHlt( event ) );
247 
248 }
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 251 of file GenericTriggerEventFlag.cc.

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

Referenced by accept().

252 {
253 
254  // An empty DCS partitions list acts as switch.
255  if ( ! onDcs_ || dcsPartitions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective
256 
257  // Accessing the DcsStatusCollection
259  event.getByToken( dcsInputToken_, dcsStatus );
260  if ( ! dcsStatus.isValid() ) {
261  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "DcsStatusCollection product with InputTag \"" << dcsInputTag_.encode() << "\" not in event ==> decision: " << errorReplyDcs_;
262  return errorReplyDcs_;
263  }
264  if ( ( *dcsStatus ).size() == 0 ) {
265  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "DcsStatusCollection product with InputTag \"" << dcsInputTag_.encode() << "\" empty ==> decision: " << errorReplyDcs_;
266  return errorReplyDcs_;
267  }
268 
269  // Determine decision of DCS partition combination and return
270  if ( andOrDcs_ ) { // OR combination
271  for ( std::vector< int >::const_iterator partitionNumber = dcsPartitions_.begin(); partitionNumber != dcsPartitions_.end(); ++partitionNumber ) {
272  if ( acceptDcsPartition( dcsStatus, *partitionNumber ) ) return true;
273  }
274  return false;
275  }
276  for ( std::vector< int >::const_iterator partitionNumber = dcsPartitions_.begin(); partitionNumber != dcsPartitions_.end(); ++partitionNumber ) {
277  if ( ! acceptDcsPartition( dcsStatus, *partitionNumber ) ) return false;
278  }
279  return true;
280 
281 }
std::vector< int > dcsPartitions_
std::string encode() const
Definition: InputTag.cc:164
bool acceptDcsPartition(const edm::Handle< DcsStatusCollection > &dcsStatus, int dcsPartition) const
edm::EDGetTokenT< DcsStatusCollection > dcsInputToken_
bool isValid() const
Definition: HandleBase.h:75
bool GenericTriggerEventFlag::acceptDcsPartition ( const edm::Handle< DcsStatusCollection > &  dcsStatus,
int  dcsPartition 
) const
private

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

285 {
286 
287  // Error checks
288  switch( dcsPartition ) {
289  case DcsStatus::EBp :
290  case DcsStatus::EBm :
291  case DcsStatus::EEp :
292  case DcsStatus::EEm :
293  case DcsStatus::HBHEa :
294  case DcsStatus::HBHEb :
295  case DcsStatus::HBHEc :
296  case DcsStatus::HF :
297  case DcsStatus::HO :
298  case DcsStatus::RPC :
299  case DcsStatus::DT0 :
300  case DcsStatus::DTp :
301  case DcsStatus::DTm :
302  case DcsStatus::CSCp :
303  case DcsStatus::CSCm :
304  case DcsStatus::CASTOR:
305  case DcsStatus::TIBTID:
306  case DcsStatus::TOB :
307  case DcsStatus::TECp :
308  case DcsStatus::TECm :
309  case DcsStatus::BPIX :
310  case DcsStatus::FPIX :
311  case DcsStatus::ESp :
312  case DcsStatus::ESm :
313  break;
314  default:
315  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "DCS partition number \"" << dcsPartition << "\" does not exist ==> decision: " << errorReplyDcs_;
316  return errorReplyDcs_;
317  }
318 
319  // Determine decision
320  return dcsStatus->at( 0 ).ready( dcsPartition );
321 
322 }
bool GenericTriggerEventFlag::acceptGt ( const edm::Event event)
private

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

Definition at line 326 of file GenericTriggerEventFlag.cc.

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

Referenced by accept().

327 {
328 
329  // An empty GT status bits logical expressions list acts as switch.
330  if ( ! onGt_ || gtLogicalExpressions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective
331 
332  // Determine decision of GT status bits logical expression combination and return
333  if ( andOrGt_ ) { // OR combination
334  for ( std::vector< std::string >::const_iterator gtLogicalExpression = gtLogicalExpressions_.begin(); gtLogicalExpression != gtLogicalExpressions_.end(); ++gtLogicalExpression ) {
335  if ( acceptGtLogicalExpression( event, *gtLogicalExpression ) ) return true;
336  }
337  return false;
338  }
339  for ( std::vector< std::string >::const_iterator gtLogicalExpression = gtLogicalExpressions_.begin(); gtLogicalExpression != gtLogicalExpressions_.end(); ++gtLogicalExpression ) {
340  if ( ! acceptGtLogicalExpression( event, *gtLogicalExpression ) ) return false;
341  }
342  return true;
343 
344 }
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 348 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().

349 {
350 
351  // Check empty std::strings
352  if ( gtLogicalExpression.empty() ) {
353  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "Empty logical expression ==> decision: " << errorReplyGt_;
354  return errorReplyGt_;
355  }
356 
357  // Negated paths
358  bool negExpr( negate( gtLogicalExpression ) );
359  if ( negExpr && gtLogicalExpression.empty() ) {
360  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "Empty (negated) logical expression ==> decision: " << errorReplyGt_;
361  return errorReplyGt_;
362  }
363 
364  // Parse logical expression and determine GT status bit decision
365  L1GtLogicParser gtAlgoLogicParser( gtLogicalExpression );
366  // Loop over status bits
367  for ( size_t iStatusBit = 0; iStatusBit < gtAlgoLogicParser.operandTokenVector().size(); ++iStatusBit ) {
368  const std::string gtStatusBit( gtAlgoLogicParser.operandTokenVector().at( iStatusBit ).tokenName );
369  // Manipulate status bit decision as stored in the parser
370  bool decision( errorReplyDcs_ );
371  // Hard-coded status bits!!!
372  if ( gtStatusBit == "PhysDecl" || gtStatusBit == "PhysicsDeclared" ) {
374  event.getByToken( gtInputToken_, gtReadoutRecord );
375  if ( ! gtReadoutRecord.isValid() ) {
376  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "L1GlobalTriggerReadoutRecord product with InputTag \"" << gtInputTag_.encode() << "\" not in event ==> decision: " << errorReplyGt_;
377  gtAlgoLogicParser.operandTokenVector().at( iStatusBit ).tokenResult = errorReplyDcs_;
378  continue;
379  }
380  decision = ( gtReadoutRecord->gtFdlWord().physicsDeclared() == 1 );
381  } else if ( gtStatusBit == "Stable" || gtStatusBit == "StableBeam" || gtStatusBit == "Adjust" || gtStatusBit == "Sqeeze" || gtStatusBit == "Flat" || gtStatusBit == "FlatTop" ||
382  gtStatusBit == "7TeV" || gtStatusBit == "8TeV" || gtStatusBit == "13TeV" || gtStatusBit == "2360GeV" || gtStatusBit == "900GeV" ) {
384  event.getByToken( gtEvmInputToken_, gtEvmReadoutRecord );
385  if ( ! gtEvmReadoutRecord.isValid() ) {
386  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "L1GlobalTriggerEvmReadoutRecord product with InputTag \"" << gtEvmInputTag_.encode() << "\" not in event ==> decision: " << errorReplyGt_;
387  gtAlgoLogicParser.operandTokenVector().at( iStatusBit ).tokenResult = errorReplyDcs_;
388  continue;
389  }
390  if ( gtStatusBit == "Stable" || gtStatusBit == "StableBeam" ) {
391  decision = ( gtEvmReadoutRecord->gtfeWord().beamMode() == 11 );
392  } else if ( gtStatusBit == "Adjust" ) {
393  decision = ( 10 <= gtEvmReadoutRecord->gtfeWord().beamMode() && gtEvmReadoutRecord->gtfeWord().beamMode() <= 11 );
394  } else if ( gtStatusBit == "Sqeeze" ) {
395  decision = ( 9 <= gtEvmReadoutRecord->gtfeWord().beamMode() && gtEvmReadoutRecord->gtfeWord().beamMode() <= 11 );
396  } else if ( gtStatusBit == "Flat" || gtStatusBit == "FlatTop" ) {
397  decision = ( 8 <= gtEvmReadoutRecord->gtfeWord().beamMode() && gtEvmReadoutRecord->gtfeWord().beamMode() <= 11 );
398  } else if ( gtStatusBit == "7TeV" ) {
399  decision = ( gtEvmReadoutRecord->gtfeWord().beamMomentum() == 3500 );
400  } else if ( gtStatusBit == "8TeV" ) {
401  decision = ( gtEvmReadoutRecord->gtfeWord().beamMomentum() == 4000 );
402  } else if ( gtStatusBit == "13TeV" ) {
403  decision = ( gtEvmReadoutRecord->gtfeWord().beamMomentum() == 6500 );
404  } else if ( gtStatusBit == "2360GeV" ) {
405  decision = ( gtEvmReadoutRecord->gtfeWord().beamMomentum() == 1180 );
406  } else if ( gtStatusBit == "900GeV" ) {
407  decision = ( gtEvmReadoutRecord->gtfeWord().beamMomentum() == 450 );
408  }
409  } else {
410  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "GT status bit \"" << gtStatusBit << "\" is not defined ==> decision: " << errorReplyGt_;
411  }
412  gtAlgoLogicParser.operandTokenVector().at( iStatusBit ).tokenResult = decision;
413  }
414 
415  // Determine decision
416  const bool gtDecision( gtAlgoLogicParser.expressionResult() );
417  return negExpr ? ( ! gtDecision ) : gtDecision;
418 
419 }
bool negate(std::string &word) const
Checks for negated words.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtInputToken_
std::string encode() const
Definition: InputTag.cc:164
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > gtEvmInputToken_
bool isValid() const
Definition: HandleBase.h:75
bool GenericTriggerEventFlag::acceptHlt ( const edm::Event event)
private

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

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

510 {
511 
512  // An empty HLT logical expressions list acts as switch.
513  if ( ! onHlt_ || hltLogicalExpressions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective
514 
515  // Checking the HLT configuration,
516  if ( ! hltConfigInit_ ) {
517  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "HLT config error ==> decision: " << errorReplyHlt_;
518  return errorReplyHlt_;
519  }
520 
521  // Accessing the TriggerResults
522  edm::Handle< edm::TriggerResults > hltTriggerResults;
523  event.getByToken( hltInputToken_, hltTriggerResults );
524  if ( ! hltTriggerResults.isValid() ) {
525  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "TriggerResults product with InputTag \"" << hltInputTag_.encode() << "\" not in event ==> decision: " << errorReplyHlt_;
526  return errorReplyHlt_;
527  }
528  if ( ( *hltTriggerResults ).size() == 0 ) {
529  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "TriggerResults product with InputTag \"" << hltInputTag_.encode() << "\" empty ==> decision: " << errorReplyHlt_;
530  return errorReplyDcs_;
531  }
532 
533  // Determine decision of HLT logical expression combination and return
534  if ( andOrHlt_ ) { // OR combination
535  for ( std::vector< std::string >::const_iterator hltLogicalExpression = hltLogicalExpressions_.begin(); hltLogicalExpression != hltLogicalExpressions_.end(); ++hltLogicalExpression ) {
536  if ( acceptHltLogicalExpression( hltTriggerResults, *hltLogicalExpression ) ) return true;
537  }
538  return false;
539  }
540  for ( std::vector< std::string >::const_iterator hltLogicalExpression = hltLogicalExpressions_.begin(); hltLogicalExpression != hltLogicalExpressions_.end(); ++hltLogicalExpression ) {
541  if ( ! acceptHltLogicalExpression( hltTriggerResults, *hltLogicalExpression ) ) return false;
542  }
543  return true;
544 
545 }
std::vector< std::string > hltLogicalExpressions_
edm::EDGetTokenT< edm::TriggerResults > hltInputToken_
std::string encode() const
Definition: InputTag.cc:164
bool isValid() const
Definition: HandleBase.h:75
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 549 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().

550 {
551 
552  // Check empty std::strings
553  if ( hltLogicalExpression.empty() ) {
554  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "Empty logical expression ==> decision: " << errorReplyHlt_;
555  return errorReplyHlt_;
556  }
557 
558  // Negated paths
559  bool negExpr( negate( hltLogicalExpression ) );
560  if ( negExpr && hltLogicalExpression.empty() ) {
561  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "Empty (negated) logical expression ==> decision: " << errorReplyHlt_;
562  return errorReplyHlt_;
563  }
564 
565  // Parse logical expression and determine HLT decision
566  L1GtLogicParser hltAlgoLogicParser( hltLogicalExpression );
567  // Loop over paths
568  for ( size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath ) {
569  const std::string hltPathName( hltAlgoLogicParser.operandTokenVector().at( iPath ).tokenName );
570  const unsigned indexPath( hltConfig_.triggerIndex( hltPathName ) );
571  // Further error checks
572  if ( indexPath == hltConfig_.size() ) {
573  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "HLT path \"" << hltPathName << "\" is not found in process " << hltInputTag_.process() << " ==> decision: " << errorReplyHlt_;
574  hltAlgoLogicParser.operandTokenVector().at( iPath ).tokenResult = errorReplyHlt_;
575  continue;
576  }
577  if ( hltTriggerResults->error( indexPath ) ) {
578  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "HLT path \"" << hltPathName << "\" in error ==> decision: " << errorReplyHlt_;
579  hltAlgoLogicParser.operandTokenVector().at( iPath ).tokenResult = errorReplyHlt_;
580  continue;
581  }
582  // Manipulate algo decision as stored in the parser
583  const bool decision( hltTriggerResults->accept( indexPath ) );
584  hltAlgoLogicParser.operandTokenVector().at( iPath ).tokenResult = decision;
585  }
586 
587  // Determine decision
588  const bool hltDecision( hltAlgoLogicParser.expressionResult() );
589  return negExpr ? ( ! hltDecision ) : hltDecision;
590 
591 }
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
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 423 of file GenericTriggerEventFlag.cc.

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

Referenced by accept().

424 {
425 
426  // An empty L1 logical expressions list acts as switch.
427  if ( ! onL1_ || l1LogicalExpressions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective
428 
429  // Determine decision of L1 logical expression combination and return
430  if ( andOrL1_ ) { // OR combination
431  for ( std::vector< std::string >::const_iterator l1LogicalExpression = l1LogicalExpressions_.begin(); l1LogicalExpression != l1LogicalExpressions_.end(); ++l1LogicalExpression ) {
432  if ( acceptL1LogicalExpression( event, setup, *l1LogicalExpression ) ) return true;
433  }
434  return false;
435  }
436  for ( std::vector< std::string >::const_iterator l1LogicalExpression = l1LogicalExpressions_.begin(); l1LogicalExpression != l1LogicalExpressions_.end(); ++l1LogicalExpression ) {
437  if ( ! acceptL1LogicalExpression( event, setup, *l1LogicalExpression ) ) return false;
438  }
439  return true;
440 
441 }
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 445 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().

446 {
447 
448  // Getting the L1 event setup
449  if ( stage2_ )
450  l1uGt_->retrieveL1(event,setup);
451  else
452  l1Gt_->getL1GtRunCache( event, setup, useL1EventSetup, useL1GtTriggerMenuLite ); // FIXME This can possibly go to initRun()
453 
454 
455  // Check empty std::strings
456  if ( l1LogicalExpression.empty() ) {
457  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "Empty logical expression ==> decision: " << errorReplyL1_;
458  return errorReplyL1_;
459  }
460 
461  // Negated logical expression
462  bool negExpr( negate( l1LogicalExpression ) );
463  if ( negExpr && l1LogicalExpression.empty() ) {
464  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "Empty (negated) logical expression ==> decision: " << errorReplyL1_;
465  return errorReplyL1_;
466  }
467 
468  // Parse logical expression and determine L1 decision
469  L1GtLogicParser l1AlgoLogicParser( l1LogicalExpression );
470  // Loop over algorithms
471  for ( size_t iAlgorithm = 0; iAlgorithm < l1AlgoLogicParser.operandTokenVector().size(); ++iAlgorithm ) {
472  const std::string l1AlgoName( l1AlgoLogicParser.operandTokenVector().at( iAlgorithm ).tokenName );
473 
474 
475  bool decision = false;
476  bool error = false;
477  if ( stage2_ ) {
478  bool errorBOOL = (l1BeforeMask_ ? l1uGt_->getInitialDecisionByName(l1AlgoName,decision) : l1uGt_->getFinalDecisionByName(l1AlgoName,decision) );
479  error = !errorBOOL;
480  } else {
481  int errorINT( -1 );
482  // const bool decision( l1BeforeMask_ ? l1Gt_->decisionBeforeMask( event, l1AlgoName, errorINT ) : l1Gt_->decisionAfterMask( event, l1AlgoName, errorINT ) );
483  decision = ( l1BeforeMask_ ? l1Gt_->decisionBeforeMask( event, l1AlgoName, errorINT ) : l1Gt_->decisionAfterMask( event, l1AlgoName, errorINT ) );
484  error = ( errorINT != 0 );
485  if ( errorINT > 1 )
486  if ( verbose_ > 1 )
487  edm::LogWarning( "GenericTriggerEventFlag" ) << "L1 algorithm \"" << l1AlgoName << "\" received error code " << error << " from L1GtUtils::decisionBeforeMask ==> decision: " << errorReplyL1_;
488  }
489 
490  // Error checks
491  if ( error ) {
492  if ( verbose_ > 1 )
493  edm::LogWarning( "GenericTriggerEventFlag" ) << "L1 algorithm \"" << l1AlgoName << "\" does not exist in the L1 menu ==> decision: " << errorReplyL1_;
494  l1AlgoLogicParser.operandTokenVector().at( iAlgorithm ).tokenResult = errorReplyL1_;
495  continue;
496  }
497  // Manipulate algo decision as stored in the parser
498  l1AlgoLogicParser.operandTokenVector().at( iAlgorithm ).tokenResult = decision;
499  }
500 
501  // Return decision
502  const bool l1Decision( l1AlgoLogicParser.expressionResult() );
503  return negExpr ? ( ! l1Decision ) : l1Decision;
504 
505 }
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_
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 596 of file GenericTriggerEventFlag.cc.

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

Referenced by initRun().

597 {
598 
599  // Find matching entries in the menu
600  std::vector< std::string > matched;
601  const std::string versionWildcard( "_v*" );
602  if ( expr.substr( expr.size() - versionWildcard.size() ) == versionWildcard ) {
603  const std::string exprBase( expr.substr( 0, expr.size() - versionWildcard.size() ) );
604  matched = hltConfig_.restoreVersion( targets, exprBase );
605  } else {
606  matched = hltConfig_.matched( targets, expr );
607  }
608 
609  // Return input, if no match is found
610  if ( matched.empty() ) {
611  if ( verbose_ > 1 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "Logical expression: \"" << expr << "\" could not be resolved";
612  return expr;
613  }
614 
615  // Compose logical expression
616  std::string expanded( "(" );
617  for ( unsigned iVers = 0; iVers < matched.size(); ++iVers ) {
618  if ( iVers > 0 ) expanded.append( useAnd ? " AND " : " OR " );
619  expanded.append( matched.at( iVers ) );
620  }
621  expanded.append( ")" );
622  if ( verbose_ > 1 ) edm::LogInfo( "GenericTriggerEventFlag" ) << "Logical expression: \"" << expr << "\"\n"
623  << " --> expanded to \"" << expanded << "\"";
624 
625  return expanded;
626 
627 }
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 647 of file GenericTriggerEventFlag.cc.

References configError_, dbLabel_, emptyKeyError_, edm::EventSetup::get(), HLT_25ns10e33_v2_cff::labels, and verbose_.

Referenced by initRun().

648 {
649  if ( key.size() == 0 ) return std::vector< std::string >( 1, emptyKeyError_ );
650  edm::ESHandle< AlCaRecoTriggerBits > logicalExpressions;
651  std::vector< edm::eventsetup::DataKey > labels;
652  setup.get< AlCaRecoTriggerBitsRcd >().fillRegisteredDataKeys( labels );
653  std::vector< edm::eventsetup::DataKey >::const_iterator iKey = labels.begin();
654  while ( iKey != labels.end() && iKey->name().value() != dbLabel_ ) ++iKey;
655  if ( iKey == labels.end() ) {
656  if ( verbose_ > 0 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "Label " << dbLabel_ << " not found in DB for 'AlCaRecoTriggerBitsRcd'";
657  return std::vector< std::string >( 1, configError_ );
658  }
659  setup.get< AlCaRecoTriggerBitsRcd >().get( dbLabel_, logicalExpressions );
660  const std::map< std::string, std::string > & expressionMap = logicalExpressions->m_alcarecoToTrig;
661  std::map< std::string, std::string >::const_iterator listIter = expressionMap.find( key );
662  if ( listIter == expressionMap.end() ) {
663  if ( verbose_ > 0 ) edm::LogWarning( "GenericTriggerEventFlag" ) << "No logical expressions found under key " << key << " in 'AlCaRecoTriggerBitsRcd'";
664  return std::vector< std::string >( 1, configError_ );
665  }
666  return logicalExpressions->decompose( listIter->second );
667 
668 }
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
const T & get() const
Definition: EventSetup.h:56
std::string GenericTriggerEventFlag::gtDBKey ( )
inline

Definition at line 137 of file GenericTriggerEventFlag.h.

References gtDBKey_.

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

Definition at line 139 of file GenericTriggerEventFlag.h.

References hltDBKey_.

139 { 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 134 of file GenericTriggerEventFlag.cc.

References edm::ESWatcher< T >::check(), configError_, edm::InputTag::encode(), expandLogicalExpression(), expressionsFromDB(), spr::find(), edm::EventSetup::get(), gtDBKey_, gtLogicalExpressions_, hltConfig_, hltConfigInit_, hltDBKey_, hltInputTag_, hltLogicalExpressions_, hltLogicalExpressionsCache_, HLTConfigProvider::init(), l1DBKey_, l1Gt_, l1LogicalExpressions_, l1LogicalExpressionsCache_, l1uGt_, onGt_, onHlt_, onL1_, makeHLTPrescaleTable::prescales, edm::InputTag::process(), HLTConfigProvider::size(), stage2_, AlCaHLTBitMon_QueryRunRegistry::string, tmp, HLTConfigProvider::triggerNames(), useL1EventSetup(), useL1GtTriggerMenuLite(), verbose_, and watchDB_.

Referenced by V0Monitor::bookHistograms(), dEdxAnalyzer::bookHistograms(), TrackingMonitor::bookHistograms(), LogMessageMonitor::bookHistograms(), dEdxHitAnalyzer::dqmBeginRun(), SiStripMonitorCluster::dqmBeginRun(), SiStripMonitorTrack::dqmBeginRun(), and TauTagValidation::dqmBeginRun().

135 {
136 
137  if ( watchDB_->check( setup ) ) {
138  if ( onGt_ && gtDBKey_.size() > 0 ) {
139  const std::vector< std::string > exprs( expressionsFromDB( gtDBKey_, setup ) );
140  if ( exprs.empty() || exprs.at( 0 ) != configError_ ) gtLogicalExpressions_ = exprs;
141  }
142  if ( onL1_ && l1DBKey_.size() > 0 ) {
143  const std::vector< std::string > exprs( expressionsFromDB( l1DBKey_, setup ) );
144  if ( exprs.empty() || exprs.at( 0 ) != configError_ ) l1LogicalExpressionsCache_ = exprs;
145  }
146  if ( onHlt_ && hltDBKey_.size() > 0 ) {
147  const std::vector< std::string > exprs( expressionsFromDB( hltDBKey_, setup ) );
148  if ( exprs.empty() || exprs.at( 0 ) != configError_ ) hltLogicalExpressionsCache_ = exprs;
149  }
150  }
151 
152  // Re-initialise starting valuse before wild-card expansion
155 
156  hltConfigInit_ = false;
157  if ( onHlt_ ) {
158  if ( hltInputTag_.process().size() == 0 ) {
159  if ( verbose_ > 0 ) edm::LogError( "GenericTriggerEventFlag" ) << "HLT TriggerResults InputTag \"" << hltInputTag_.encode() << "\" specifies no process";
160  } else {
161  bool hltChanged( false );
162  if ( ! hltConfig_.init( run, setup, hltInputTag_.process(), hltChanged ) ) {
163  if ( verbose_ > 0 ) edm::LogError( "GenericTriggerEventFlag" ) << "HLT config initialization error with process name \"" << hltInputTag_.process() << "\"";
164  } else if ( hltConfig_.size() <= 0 ) {
165  if ( verbose_ > 0 ) edm::LogError( "GenericTriggerEventFlag" ) << "HLT config size error";
166  } else hltConfigInit_ = true;
167  }
168  }
169 
170  // Expand version wild-cards in HLT logical expressions
171  // L1
172  if ( onL1_ ) {
173  // build vector of algo names
174 
175  std::vector< std::string > algoNames;
176 
177  if (stage2_) {
178  l1uGt_->retrieveL1Setup(setup);
179 
180  const std::vector<std::pair<std::string, int> > prescales = l1uGt_->prescales();
181  for(auto ip : prescales)
182  algoNames.push_back(ip.first);
183  } else {
184  l1Gt_->getL1GtRunCache( run, setup, useL1EventSetup, useL1GtTriggerMenuLite );
185  edm::ESHandle< L1GtTriggerMenu > handleL1GtTriggerMenu;
186  setup.get< L1GtTriggerMenuRcd >().get( handleL1GtTriggerMenu );
187 
188  const AlgorithmMap l1GtPhys( handleL1GtTriggerMenu->gtAlgorithmMap() );
189  for ( CItAlgo iAlgo = l1GtPhys.begin(); iAlgo != l1GtPhys.end(); ++iAlgo ) {
190  algoNames.push_back( iAlgo->second.algoName() );
191  }
192  const AlgorithmMap l1GtTech( handleL1GtTriggerMenu->gtTechnicalTriggerMap() );
193  for ( CItAlgo iAlgo = l1GtTech.begin(); iAlgo != l1GtTech.end(); ++iAlgo ) {
194  algoNames.push_back( iAlgo->second.algoName() );
195  }
196  }
197 
198 
199  for ( unsigned iExpr = 0; iExpr < l1LogicalExpressions_.size(); ++iExpr ) {
200  std::string l1LogicalExpression( l1LogicalExpressions_.at( iExpr ) );
201  L1GtLogicParser l1AlgoLogicParser( l1LogicalExpression );
202  // Loop over algorithms
203  for ( size_t iAlgo = 0; iAlgo < l1AlgoLogicParser.operandTokenVector().size(); ++iAlgo ) {
204  const std::string l1AlgoName( l1AlgoLogicParser.operandTokenVector().at( iAlgo ).tokenName );
205  if ( l1AlgoName.find( '*' ) != std::string::npos ) {
206  l1LogicalExpression.replace( l1LogicalExpression.find( l1AlgoName ), l1AlgoName.size(), expandLogicalExpression( algoNames, l1AlgoName ) );
207  }
208  }
209  l1LogicalExpressions_[ iExpr ] = l1LogicalExpression;
210  }
211  std::vector<std::string> tmp = l1LogicalExpressions_;
212  for ( unsigned iExpr = 0; iExpr < tmp.size(); ++iExpr )
213  if ( std::find(algoNames.begin(),algoNames.end(),tmp[ iExpr ]) == algoNames.end() ) {
214  l1LogicalExpressions_.erase(l1LogicalExpressions_.begin()+iExpr);
215  if ( verbose_ > 1 )
216  edm::LogWarning( "GenericTriggerEventFlag" ) << "L1 algorithm \"" << tmp[ iExpr ] << "\" does not exist in the L1 menu ==> drop it from the list of l1LogicalExpressions";
217  }
218  }
219  // HLT
220  if ( hltConfigInit_ ) {
221  for ( unsigned iExpr = 0; iExpr < hltLogicalExpressions_.size(); ++iExpr ) {
222  std::string hltLogicalExpression( hltLogicalExpressions_.at( iExpr ) );
223  L1GtLogicParser hltAlgoLogicParser( hltLogicalExpression );
224  // Loop over paths
225  for ( size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath ) {
226  const std::string hltPathName( hltAlgoLogicParser.operandTokenVector().at( iPath ).tokenName );
227  if ( hltPathName.find( '*' ) != std::string::npos ) {
228  hltLogicalExpression.replace( hltLogicalExpression.find( hltPathName ), hltPathName.size(), expandLogicalExpression( hltConfig_.triggerNames(), hltPathName ) );
229  }
230  }
231  hltLogicalExpressions_[ iExpr ] = hltLogicalExpression;
232  }
233  }
234 
235 }
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 > gtLogicalExpressions_
std::vector< std::string > hltLogicalExpressions_
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:7
std::string encode() const
Definition: InputTag.cc:164
std::unique_ptr< L1GtUtils > l1Gt_
std::vector< std::string > l1LogicalExpressionsCache_
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.
static const bool useL1EventSetup(true)
edm::ESWatcher< AlCaRecoTriggerBitsRcd > * watchDB_
std::vector< std::string > hltLogicalExpressionsCache_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const T & get() const
Definition: EventSetup.h:56
std::vector< std::string > l1LogicalExpressions_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
std::string const & process() const
Definition: InputTag.h:40
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
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< l1t::L1TGlobalUtil > l1uGt_
std::string GenericTriggerEventFlag::l1DBKey ( )
inline

Definition at line 138 of file GenericTriggerEventFlag.h.

References l1DBKey_.

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

Checks for negated words.

Definition at line 632 of file GenericTriggerEventFlag.cc.

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

633 {
634 
635  bool negate( false );
636  if ( word.at( 0 ) == '~' ) {
637  negate = true;
638  word.erase( 0, 1 );
639  }
640  return negate;
641 
642 }
bool negate(std::string &word) const
Checks for negated words.
bool GenericTriggerEventFlag::off ( )
inline

Definition at line 103 of file GenericTriggerEventFlag.h.

References on_.

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

Member Data Documentation

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

Definition at line 53 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::andOrGt_
private

Definition at line 58 of file GenericTriggerEventFlag.h.

Referenced by acceptGt(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::andOrHlt_
private

Definition at line 73 of file GenericTriggerEventFlag.h.

Referenced by acceptHlt(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::andOrL1_
private

Definition at line 66 of file GenericTriggerEventFlag.h.

Referenced by acceptL1(), and GenericTriggerEventFlag().

const std::string GenericTriggerEventFlag::configError_
private

Definition at line 87 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB(), and initRun().

std::string GenericTriggerEventFlag::dbLabel_
private

Definition at line 51 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB(), and GenericTriggerEventFlag().

edm::InputTag GenericTriggerEventFlag::dcsInputTag_
private

Definition at line 54 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

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

Definition at line 55 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

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

Definition at line 56 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

const std::string GenericTriggerEventFlag::emptyKeyError_
private

Definition at line 88 of file GenericTriggerEventFlag.h.

Referenced by expressionsFromDB().

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

Definition at line 65 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

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

Definition at line 72 of file GenericTriggerEventFlag.h.

Referenced by acceptL1LogicalExpression(), and GenericTriggerEventFlag().

std::string GenericTriggerEventFlag::gtDBKey_
private

Definition at line 63 of file GenericTriggerEventFlag.h.

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

edm::InputTag GenericTriggerEventFlag::gtEvmInputTag_
private

Definition at line 61 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

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

Definition at line 62 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

edm::InputTag GenericTriggerEventFlag::gtInputTag_
private

Definition at line 59 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

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

Definition at line 60 of file GenericTriggerEventFlag.h.

Referenced by acceptGtLogicalExpression(), and GenericTriggerEventFlag().

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

Definition at line 64 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(), and initRun().

std::string GenericTriggerEventFlag::hltDBKey_
private

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

Referenced by acceptHlt(), and GenericTriggerEventFlag().

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

Definition at line 78 of file GenericTriggerEventFlag.h.

Referenced by acceptHlt(), and initRun().

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

Definition at line 77 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), and initRun().

bool GenericTriggerEventFlag::l1BeforeMask_
private

Definition at line 68 of file GenericTriggerEventFlag.h.

Referenced by acceptL1LogicalExpression(), and GenericTriggerEventFlag().

std::string GenericTriggerEventFlag::l1DBKey_
private

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

Referenced by acceptL1(), and initRun().

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

Definition at line 70 of file GenericTriggerEventFlag.h.

Referenced by GenericTriggerEventFlag(), and initRun().

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

Definition at line 82 of file GenericTriggerEventFlag.h.

Referenced by acceptDcs(), and GenericTriggerEventFlag().

bool GenericTriggerEventFlag::onGt_
private

Definition at line 83 of file GenericTriggerEventFlag.h.

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

bool GenericTriggerEventFlag::onHlt_
private

Definition at line 85 of file GenericTriggerEventFlag.h.

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

bool GenericTriggerEventFlag::onL1_
private

Definition at line 84 of file GenericTriggerEventFlag.h.

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

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