CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TriggerHelper 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 <DQM/TrackerCommon/interface/TriggerHelper.h>

List of all members.

Public Member Functions

bool accept (const edm::Event &event, const edm::EventSetup &setup)
 To be called from analyze/filter() methods.
void initRun (const edm::Run &run, const edm::EventSetup &setup)
 To be called from beginedm::Run() methods.
bool off ()
bool on ()
 TriggerHelper (const edm::ParameterSet &config)
 To be called from the ED module's c'tor.
 ~TriggerHelper ()
 To be called from d'tors by 'delete'.

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?
bool acceptGtLogicalExpression (const edm::Handle< L1GlobalTriggerReadoutRecord > &gtReadoutRecord, std::string gtLogicalExpression)
 Does this event fulfill this particular GT status bits' logical expression?
bool acceptHlt (const edm::Event &event)
 Was this event accepted by the configured HLT logical expression combination?
bool acceptHltLogicalExpression (const edm::Handle< edm::TriggerResults > &hltTriggerResults, std::string hltLogicalExpression) const
 Was this event accepted by this particular HLT paths' logical expression?
bool acceptL1 (const edm::Event &event, const edm::EventSetup &setup)
 Was this event accepted by the configured L1 logical expression combination?
bool acceptL1LogicalExpression (const edm::Event &event, std::string l1LogicalExpression)
 Was this event accepted by this particular L1 algorithms' logical expression?
std::vector< std::string > expressionsFromDB (const std::string &key, const edm::EventSetup &setup)
 Reads and returns logical expressions from DB.
bool negate (std::string &word) const
 Checks for negated words.

Private Attributes

bool andOr_
bool andOrDcs_
bool andOrGt_
bool andOrHlt_
bool andOrL1_
const std::string configError_
edm::InputTag dcsInputTag_
std::vector< int > dcsPartitions_
bool errorReplyDcs_
bool errorReplyGt_
bool errorReplyHlt_
bool errorReplyL1_
std::string gtDBKey_
edm::InputTag gtInputTag_
std::vector< std::string > gtLogicalExpressions_
HLTConfigProvider hltConfig_
bool hltConfigInit_
std::string hltDBKey_
edm::InputTag hltInputTag_
std::vector< std::string > hltLogicalExpressions_
std::string l1DBKey_
L1GtUtils l1Gt_
std::vector< std::string > l1LogicalExpressions_
bool on_
bool onDcs_
bool onGt_
bool onHlt_
bool onL1_
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:
TriggerHelper.h,v 1.8 2010/03/27 12:09:10 dutta Exp

Definition at line 35 of file TriggerHelper.h.


Constructor & Destructor Documentation

TriggerHelper::TriggerHelper ( const edm::ParameterSet config)

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

Definition at line 19 of file TriggerHelper.cc.

References andOr_, andOrDcs_, andOrGt_, andOrHlt_, andOrL1_, dcsInputTag_, dcsPartitions_, errorReplyDcs_, errorReplyGt_, errorReplyHlt_, errorReplyL1_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), gtDBKey_, gtInputTag_, gtLogicalExpressions_, hltDBKey_, hltInputTag_, hltLogicalExpressions_, l1DBKey_, l1LogicalExpressions_, on_, onDcs_, onGt_, onHlt_, onL1_, and watchDB_.

  : watchDB_( 0 )
  , gtDBKey_( "" )
  , l1DBKey_( "" )
  , hltDBKey_( "" )
  , on_( true )
  , onDcs_( true )
  , onGt_( true )
  , onL1_( true )
  , onHlt_( true )
  , configError_( "CONFIG_ERROR" )
{

  // General switch(es)
  if ( config.exists( "andOr" ) ) {
    andOr_ = config.getParameter< bool >( "andOr" );
  } else {
    on_    = false;
    onDcs_ = false;
    onGt_  = false;
    onL1_  = false;
    onHlt_ = false;
  }

  if ( on_ ) {
    if ( config.exists( "andOrDcs" ) ) {
      andOrDcs_      = config.getParameter< bool >( "andOrDcs" );
      dcsInputTag_   = config.getParameter< edm::InputTag >( "dcsInputTag" );
      dcsPartitions_ = config.getParameter< std::vector< int > >( "dcsPartitions" );
      errorReplyDcs_ = config.getParameter< bool >( "errorReplyDcs" );
    } else {
      onDcs_ = false;
    }
    if ( config.exists( "andOrGt" ) ) {
      andOrGt_              = config.getParameter< bool >( "andOrGt" );
      gtInputTag_           = config.getParameter< edm::InputTag >( "gtInputTag" );
      gtLogicalExpressions_ = config.getParameter< std::vector< std::string > >( "gtStatusBits" );
      errorReplyGt_         = config.getParameter< bool >( "errorReplyGt" );
      if ( config.exists( "gtDBKey" ) ) gtDBKey_ = config.getParameter< std::string >( "gtDBKey" );
    } else {
      onGt_ = false;
    }
    if ( config.exists( "andOrL1" ) ) {
      andOrL1_              = config.getParameter< bool >( "andOrL1" );
      l1LogicalExpressions_ = config.getParameter< std::vector< std::string > >( "l1Algorithms" );
      errorReplyL1_         = config.getParameter< bool >( "errorReplyL1" );
      if ( config.exists( "l1DBKey" ) ) l1DBKey_ = config.getParameter< std::string >( "l1DBKey" );
    } else {
      onL1_ = false;
    }
    if ( config.exists( "andOrHlt" ) ) {
      andOrHlt_              = config.getParameter< bool >( "andOrHlt" );
      hltInputTag_           = config.getParameter< edm::InputTag >( "hltInputTag" );
      hltLogicalExpressions_ = config.getParameter< std::vector< std::string > >( "hltPaths" );
      errorReplyHlt_         = config.getParameter< bool >( "errorReplyHlt" );
      if ( config.exists( "hltDBKey" ) ) hltDBKey_ = config.getParameter< std::string >( "hltDBKey" );
    } else {
      onHlt_ = false;
    }
    if ( ! onDcs_ && ! onGt_ && ! onL1_ && ! onHlt_ ) on_      = false;
    else                                              watchDB_ = new edm::ESWatcher< AlCaRecoTriggerBitsRcd> ;
  }

}
TriggerHelper::~TriggerHelper ( )

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

Definition at line 86 of file TriggerHelper.cc.

References on_, and watchDB_.

{

  if ( on_ ) delete watchDB_;

}

Member Function Documentation

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

To be called from analyze/filter() methods.

Definition at line 133 of file TriggerHelper.cc.

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

{

  if ( ! on_ ) return true;

  // Determine decision
  if ( andOr_ ) return ( acceptDcs( event ) || acceptGt( event ) || acceptL1( event, setup ) || acceptHlt( event ) );
  return ( acceptDcs( event ) && acceptGt( event ) && acceptL1( event, setup ) && acceptHlt( event ) );

}
bool TriggerHelper::acceptDcs ( const edm::Event event) [private]

Definition at line 145 of file TriggerHelper.cc.

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

Referenced by accept().

{

  // An empty DCS partitions list acts as switch.
  if ( ! onDcs_ || dcsPartitions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective

  // Accessing the DcsStatusCollection
  edm::Handle< DcsStatusCollection > dcsStatus;
  event.getByLabel( dcsInputTag_, dcsStatus );
  if ( ! dcsStatus.isValid() ) {
    edm::LogError( "TriggerHelper" ) << "DcsStatusCollection product with InputTag \"" << dcsInputTag_.encode() << "\" not in event ==> decision: " << errorReplyDcs_;
    return errorReplyDcs_;
  }

  // Determine decision of DCS partition combination and return
  if ( andOrDcs_ ) { // OR combination
    for ( std::vector< int >::const_iterator partitionNumber = dcsPartitions_.begin(); partitionNumber != dcsPartitions_.end(); ++partitionNumber ) {
      if ( acceptDcsPartition( dcsStatus, *partitionNumber ) ) return true;
    }
    return false;
  }
  for ( std::vector< int >::const_iterator partitionNumber = dcsPartitions_.begin(); partitionNumber != dcsPartitions_.end(); ++partitionNumber ) {
    if ( ! acceptDcsPartition( dcsStatus, *partitionNumber ) ) return false;
  }
  return true;

}
bool TriggerHelper::acceptDcsPartition ( const edm::Handle< DcsStatusCollection > &  dcsStatus,
int  dcsPartition 
) const [private]

Definition at line 174 of file TriggerHelper.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, and DcsStatus::TOB.

Referenced by acceptDcs().

{

  // Error checks
  switch( dcsPartition ) {
    case DcsStatus::EBp   :
    case DcsStatus::EBm   :
    case DcsStatus::EEp   :
    case DcsStatus::EEm   :
    case DcsStatus::HBHEa :
    case DcsStatus::HBHEb :
    case DcsStatus::HBHEc :
    case DcsStatus::HF    :
    case DcsStatus::HO    :
    case DcsStatus::RPC   :
    case DcsStatus::DT0   :
    case DcsStatus::DTp   :
    case DcsStatus::DTm   :
    case DcsStatus::CSCp  :
    case DcsStatus::CSCm  :
    case DcsStatus::CASTOR:
    case DcsStatus::TIBTID:
    case DcsStatus::TOB   :
    case DcsStatus::TECp  :
    case DcsStatus::TECm  :
    case DcsStatus::BPIX  :
    case DcsStatus::FPIX  :
    case DcsStatus::ESp   :
    case DcsStatus::ESm   :
      break;
    default:
      edm::LogError( "TriggerHelper" ) << "DCS partition number \"" << dcsPartition << "\" does not exist ==> decision: " << errorReplyDcs_;
      return errorReplyDcs_;
  }

  // Determine decision
  return dcsStatus->at( 0 ).ready( dcsPartition );

}
bool TriggerHelper::acceptGt ( const edm::Event event) [private]

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

Definition at line 216 of file TriggerHelper.cc.

References acceptGtLogicalExpression(), andOr_, andOrGt_, edm::InputTag::encode(), errorReplyGt_, gtInputTag_, gtLogicalExpressions_, edm::HandleBase::isValid(), and onGt_.

Referenced by accept().

{

  // An empty GT status bits logical expressions list acts as switch.
  if ( ! onGt_ || gtLogicalExpressions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective

  // Accessing the L1GlobalTriggerReadoutRecord
  edm::Handle< L1GlobalTriggerReadoutRecord > gtReadoutRecord;
  event.getByLabel( gtInputTag_, gtReadoutRecord );
  if ( ! gtReadoutRecord.isValid() ) {
    edm::LogError( "TriggerHelper" ) << "L1GlobalTriggerReadoutRecord product with InputTag \"" << gtInputTag_.encode() << "\" not in event ==> decision: " << errorReplyGt_;
    return errorReplyGt_;
  }

  // Determine decision of GT status bits logical expression combination and return
  if ( andOrGt_ ) { // OR combination
    for ( std::vector< std::string >::const_iterator gtLogicalExpression = gtLogicalExpressions_.begin(); gtLogicalExpression != gtLogicalExpressions_.end(); ++gtLogicalExpression ) {
      if ( acceptGtLogicalExpression( gtReadoutRecord, *gtLogicalExpression ) ) return true;
    }
    return false;
  }
  for ( std::vector< std::string >::const_iterator gtLogicalExpression = gtLogicalExpressions_.begin(); gtLogicalExpression != gtLogicalExpressions_.end(); ++gtLogicalExpression ) {
    if ( ! acceptGtLogicalExpression( gtReadoutRecord, *gtLogicalExpression ) ) return false;
  }
  return true;

}
bool TriggerHelper::acceptGtLogicalExpression ( const edm::Handle< L1GlobalTriggerReadoutRecord > &  gtReadoutRecord,
std::string  gtLogicalExpression 
) [private]

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

Definition at line 246 of file TriggerHelper.cc.

References errorReplyDcs_, errorReplyGt_, L1GtLogicParser::expressionResult(), negate(), and L1GtLogicParser::operandTokenVector().

Referenced by acceptGt().

{

  // Check empty std::strings
  if ( gtLogicalExpression.empty() ) {
    edm::LogError( "TriggerHelper" ) << "Empty logical expression ==> decision: " << errorReplyGt_;
    return errorReplyGt_;
  }

  // Negated paths
  bool negExpr( negate( gtLogicalExpression ) );
  if ( negExpr && gtLogicalExpression.empty() ) {
    edm::LogError( "TriggerHelper" ) << "Empty (negated) logical expression ==> decision: " << errorReplyGt_;
    return errorReplyGt_;
  }

  // Parse logical expression and determine GT status bit decision
  L1GtLogicParser gtAlgoLogicParser( gtLogicalExpression );
  // Loop over status bits
  for ( size_t iStatusBit = 0; iStatusBit < gtAlgoLogicParser.operandTokenVector().size(); ++iStatusBit ) {
    const std::string gtStatusBit( gtAlgoLogicParser.operandTokenVector().at( iStatusBit ).tokenName );
    // Manipulate status bit decision as stored in the parser
    bool decision;
    // Hard-coded status bits!!!
    if ( gtStatusBit == "PhysDecl" || gtStatusBit == "PhysicsDeclared" ) {
      decision = ( gtReadoutRecord->gtFdlWord().physicsDeclared() == 1 );
    } else {
      edm::LogError( "TriggerHelper" ) << "GT status bit \"" << gtStatusBit << "\" is not defined ==> decision: " << errorReplyGt_;
      decision = errorReplyDcs_;
    }
    gtAlgoLogicParser.operandTokenVector().at( iStatusBit ).tokenResult = decision;
  }

  // Determine decision
  const bool gtDecision( gtAlgoLogicParser.expressionResult() );
  return negExpr ? ( ! gtDecision ) : gtDecision;

}
bool TriggerHelper::acceptHlt ( const edm::Event event) [private]

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

Definition at line 354 of file TriggerHelper.cc.

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

Referenced by accept().

{

  // An empty HLT logical expressions list acts as switch.
  if ( ! onHlt_ || hltLogicalExpressions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective

  // Checking the HLT configuration,
  if ( ! hltConfigInit_ ) {
    edm::LogError( "TriggerHelper" ) << "HLT config error ==> decision: " << errorReplyHlt_;
    return errorReplyHlt_;
  }

  // Accessing the TriggerResults
  edm::Handle< edm::TriggerResults > hltTriggerResults;
  event.getByLabel( hltInputTag_, hltTriggerResults );
  if ( ! hltTriggerResults.isValid() ) {
    edm::LogError( "TriggerHelper" ) << "TriggerResults product with InputTag \"" << hltInputTag_.encode() << "\" not in event ==> decision: " << errorReplyHlt_;
    return errorReplyHlt_;
  }

  // Determine decision of HLT logical expression combination and return
  if ( andOrHlt_ ) { // OR combination
    for ( std::vector< std::string >::const_iterator hltLogicalExpression = hltLogicalExpressions_.begin(); hltLogicalExpression != hltLogicalExpressions_.end(); ++hltLogicalExpression ) {
      if ( acceptHltLogicalExpression( hltTriggerResults, *hltLogicalExpression ) ) return true;
    }
    return false;
  }
  for ( std::vector< std::string >::const_iterator hltLogicalExpression = hltLogicalExpressions_.begin(); hltLogicalExpression != hltLogicalExpressions_.end(); ++hltLogicalExpression ) {
    if ( ! acceptHltLogicalExpression( hltTriggerResults, *hltLogicalExpression ) ) return false;
  }
  return true;

}
bool TriggerHelper::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 390 of file TriggerHelper.cc.

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

Referenced by acceptHlt().

{

  // Check empty std::strings
  if ( hltLogicalExpression.empty() ) {
    edm::LogError( "TriggerHelper" ) << "Empty logical expression ==> decision: " << errorReplyHlt_;
    return errorReplyHlt_;
  }

  // Negated paths
  bool negExpr( negate( hltLogicalExpression ) );
  if ( negExpr && hltLogicalExpression.empty() ) {
    edm::LogError( "TriggerHelper" ) << "Empty (negated) logical expression ==> decision: " << errorReplyHlt_;
    return errorReplyHlt_;
  }

  // Parse logical expression and determine HLT decision
  L1GtLogicParser hltAlgoLogicParser( hltLogicalExpression );
  // Loop over paths
  for ( size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath ) {
    const std::string hltPathName( hltAlgoLogicParser.operandTokenVector().at( iPath ).tokenName );
    const unsigned indexPath( hltConfig_.triggerIndex( hltPathName ) );
    // Further error checks
    if ( indexPath == hltConfig_.size() ) {
      edm::LogError( "TriggerHelper" ) << "HLT path \"" << hltPathName << "\" is not found in process " << hltInputTag_.process() << " ==> decision: " << errorReplyHlt_;
      hltAlgoLogicParser.operandTokenVector().at( iPath ).tokenResult = errorReplyHlt_;
      continue;
    }
    if ( hltTriggerResults->error( indexPath ) ) {
      edm::LogError( "TriggerHelper" ) << "HLT path \"" << hltPathName << "\" in error ==> decision: " << errorReplyHlt_;
      hltAlgoLogicParser.operandTokenVector().at( iPath ).tokenResult = errorReplyHlt_;
      continue;
    }
    // Manipulate algo decision as stored in the parser
    const bool decision( hltTriggerResults->accept( indexPath ) );
    hltAlgoLogicParser.operandTokenVector().at( iPath ).tokenResult = decision;
  }

  // Determine decision
  const bool hltDecision( hltAlgoLogicParser.expressionResult() );
  return negExpr ? ( ! hltDecision ) : hltDecision;

}
bool TriggerHelper::acceptL1 ( const edm::Event event,
const edm::EventSetup setup 
) [private]

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

Definition at line 287 of file TriggerHelper.cc.

References acceptL1LogicalExpression(), andOr_, andOrL1_, l1Gt_, l1LogicalExpressions_, onL1_, and L1GtUtils::retrieveL1EventSetup().

Referenced by accept().

{

  // An empty L1 logical expressions list acts as switch.
  if ( ! onL1_ || l1LogicalExpressions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective

  // Getting the L1 event setup
  l1Gt_.retrieveL1EventSetup( setup ); // FIXME This can possibly go to initRun()

  // Determine decision of L1 logical expression combination and return
  if ( andOrL1_ ) { // OR combination
    for ( std::vector< std::string >::const_iterator l1LogicalExpression = l1LogicalExpressions_.begin(); l1LogicalExpression != l1LogicalExpressions_.end(); ++l1LogicalExpression ) {
      if ( acceptL1LogicalExpression( event, *l1LogicalExpression ) ) return true;
    }
    return false;
  }
  for ( std::vector< std::string >::const_iterator l1LogicalExpression = l1LogicalExpressions_.begin(); l1LogicalExpression != l1LogicalExpressions_.end(); ++l1LogicalExpression ) {
    if ( ! acceptL1LogicalExpression( event, *l1LogicalExpression ) ) return false;
  }
  return true;

}
bool TriggerHelper::acceptL1LogicalExpression ( const edm::Event event,
std::string  l1LogicalExpression 
) [private]

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

Definition at line 312 of file TriggerHelper.cc.

References L1GtUtils::decision(), error, errorReplyL1_, L1GtLogicParser::expressionResult(), l1Gt_, negate(), and L1GtLogicParser::operandTokenVector().

Referenced by acceptL1().

{

  // Check empty std::strings
  if ( l1LogicalExpression.empty() ) {
    edm::LogError( "TriggerHelper" ) << "Empty logical expression ==> decision: " << errorReplyL1_;
    return errorReplyL1_;
  }

  // Negated logical expression
  bool negExpr( negate( l1LogicalExpression ) );
  if ( negExpr && l1LogicalExpression.empty() ) {
    edm::LogError( "TriggerHelper" ) << "Empty (negated) logical expression ==> decision: " << errorReplyL1_;
    return errorReplyL1_;
  }

  // Parse logical expression and determine L1 decision
  L1GtLogicParser l1AlgoLogicParser( l1LogicalExpression );
  // Loop over algorithms
  for ( size_t iAlgorithm = 0; iAlgorithm < l1AlgoLogicParser.operandTokenVector().size(); ++iAlgorithm ) {
    const std::string l1AlgoName( l1AlgoLogicParser.operandTokenVector().at( iAlgorithm ).tokenName );
    int error( -1 );
    const bool decision( l1Gt_.decision( event, l1AlgoName, error ) );
    // Error checks
    if ( error != 0 ) {
      if ( error == 1 ) edm::LogError( "TriggerHelper" ) << "L1 algorithm \"" << l1AlgoName << "\" does not exist in the L1 menu ==> decision: "                                          << errorReplyL1_;
      else              edm::LogError( "TriggerHelper" )  << "L1 algorithm \"" << l1AlgoName << "\" received error code " << error << " from L1GtUtils::decisionBeforeMask ==> decision: " << errorReplyL1_;
      l1AlgoLogicParser.operandTokenVector().at( iAlgorithm ).tokenResult = errorReplyL1_;
      continue;
    }
    // Manipulate algo decision as stored in the parser
    l1AlgoLogicParser.operandTokenVector().at( iAlgorithm ).tokenResult = decision;
  }

  // Return decision
  const bool l1Decision( l1AlgoLogicParser.expressionResult() );
  return negExpr ? ( ! l1Decision ) : l1Decision;

}
std::vector< std::string > TriggerHelper::expressionsFromDB ( const std::string &  key,
const edm::EventSetup setup 
) [private]

Reads and returns logical expressions from DB.

Definition at line 437 of file TriggerHelper.cc.

References configError_, and edm::EventSetup::get().

Referenced by initRun().

{

  edm::ESHandle< AlCaRecoTriggerBits > logicalExpressions;
  setup.get< AlCaRecoTriggerBitsRcd >().get( logicalExpressions );
  const std::map< std::string, std::string > & expressionMap = logicalExpressions->m_alcarecoToTrig;
  std::map< std::string, std::string >::const_iterator listIter = expressionMap.find( key );
  if ( listIter == expressionMap.end() ) {
    edm::LogError( "TriggerHelper" ) << "No logical expressions found under key " << key << " in 'AlCaRecoTriggerBitsRcd'";
    return std::vector< std::string >( 1, configError_ );
  }
  return logicalExpressions->decompose( listIter->second );

}
void TriggerHelper::initRun ( const edm::Run run,
const edm::EventSetup setup 
)

To be called from beginedm::Run() methods.

Definition at line 95 of file TriggerHelper.cc.

References edm::ESWatcher< T >::check(), configError_, edm::InputTag::encode(), expressionsFromDB(), gtDBKey_, gtLogicalExpressions_, hltConfig_, hltConfigInit_, hltDBKey_, hltInputTag_, hltLogicalExpressions_, HLTConfigProvider::init(), l1DBKey_, l1LogicalExpressions_, onGt_, onHlt_, onL1_, edm::InputTag::process(), HLTConfigProvider::size(), and watchDB_.

{

  // FIXME Can this stay safely in the run loop, or does it need to go to the event loop?
  // Means: Are the event setups identical?
  if ( watchDB_->check( setup ) ) {
    if ( onGt_ && gtDBKey_.size() > 0 ) {
      const std::vector< std::string > exprs( expressionsFromDB( gtDBKey_, setup ) );
      if ( exprs.empty() || exprs.at( 0 ) != configError_ ) gtLogicalExpressions_ = exprs;
    }
    if ( onL1_ && l1DBKey_.size() > 0 ) {
      const std::vector< std::string > exprs( expressionsFromDB( l1DBKey_, setup ) );
      if ( exprs.empty() || exprs.at( 0 ) != configError_ ) l1LogicalExpressions_ = exprs;
    }
    if ( onHlt_ && hltDBKey_.size() > 0 ) {
      const std::vector< std::string > exprs( expressionsFromDB( hltDBKey_, setup ) );
      if ( exprs.empty() || exprs.at( 0 ) != configError_ ) hltLogicalExpressions_ = exprs;
    }
  }

  hltConfigInit_ = false;
  if ( onHlt_ ) {
    if ( hltInputTag_.process().size() == 0 ) {
      edm::LogError( "TriggerHelper" ) << "HLT TriggerResults InputTag \"" << hltInputTag_.encode() << "\" specifies no process";
    } else {
      bool hltChanged( false );
      if ( ! hltConfig_.init( run, setup, hltInputTag_.process(), hltChanged ) ) {
        edm::LogError( "TriggerHelper" ) << "HLT config initialization error with process name \"" << hltInputTag_.process() << "\"";
      } else if ( hltConfig_.size() <= 0 ) {
        edm::LogError( "TriggerHelper" ) << "HLT config size error";
      } else hltConfigInit_ = true;
    }
  }

}
bool TriggerHelper::negate ( std::string &  word) const [private]

Checks for negated words.

Definition at line 455 of file TriggerHelper.cc.

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

{

  bool negate( false );
  if ( word.at( 0 ) == '~' ) {
    negate = true;
    word.erase( 0, 1 );
  }
  return negate;

}
bool TriggerHelper::off ( ) [inline]

Definition at line 79 of file TriggerHelper.h.

References on_.

{ return ( ! on_ ); }
bool TriggerHelper::on ( ) [inline]

Definition at line 78 of file TriggerHelper.h.

References on_.

{ return     on_  ; }

Member Data Documentation

bool TriggerHelper::andOr_ [private]

Definition at line 43 of file TriggerHelper.h.

Referenced by accept(), acceptDcs(), acceptGt(), acceptHlt(), acceptL1(), and TriggerHelper().

bool TriggerHelper::andOrDcs_ [private]

Definition at line 44 of file TriggerHelper.h.

Referenced by acceptDcs(), and TriggerHelper().

bool TriggerHelper::andOrGt_ [private]

Definition at line 48 of file TriggerHelper.h.

Referenced by acceptGt(), and TriggerHelper().

bool TriggerHelper::andOrHlt_ [private]

Definition at line 57 of file TriggerHelper.h.

Referenced by acceptHlt(), and TriggerHelper().

bool TriggerHelper::andOrL1_ [private]

Definition at line 53 of file TriggerHelper.h.

Referenced by acceptL1(), and TriggerHelper().

const std::string TriggerHelper::configError_ [private]

Definition at line 69 of file TriggerHelper.h.

Referenced by expressionsFromDB(), and initRun().

Definition at line 45 of file TriggerHelper.h.

Referenced by acceptDcs(), and TriggerHelper().

std::vector< int > TriggerHelper::dcsPartitions_ [private]

Definition at line 46 of file TriggerHelper.h.

Referenced by acceptDcs(), and TriggerHelper().

Definition at line 52 of file TriggerHelper.h.

Referenced by acceptGt(), acceptGtLogicalExpression(), and TriggerHelper().

Definition at line 61 of file TriggerHelper.h.

Referenced by acceptHlt(), acceptHltLogicalExpression(), and TriggerHelper().

Definition at line 56 of file TriggerHelper.h.

Referenced by acceptL1LogicalExpression(), and TriggerHelper().

std::string TriggerHelper::gtDBKey_ [private]

Definition at line 50 of file TriggerHelper.h.

Referenced by initRun(), and TriggerHelper().

Definition at line 49 of file TriggerHelper.h.

Referenced by acceptGt(), and TriggerHelper().

std::vector< std::string > TriggerHelper::gtLogicalExpressions_ [private]

Definition at line 51 of file TriggerHelper.h.

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

Definition at line 40 of file TriggerHelper.h.

Referenced by acceptHltLogicalExpression(), and initRun().

Definition at line 41 of file TriggerHelper.h.

Referenced by acceptHlt(), and initRun().

std::string TriggerHelper::hltDBKey_ [private]

Definition at line 59 of file TriggerHelper.h.

Referenced by initRun(), and TriggerHelper().

Definition at line 58 of file TriggerHelper.h.

Referenced by acceptHlt(), acceptHltLogicalExpression(), initRun(), and TriggerHelper().

std::vector< std::string > TriggerHelper::hltLogicalExpressions_ [private]

Definition at line 60 of file TriggerHelper.h.

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

std::string TriggerHelper::l1DBKey_ [private]

Definition at line 54 of file TriggerHelper.h.

Referenced by initRun(), and TriggerHelper().

Definition at line 39 of file TriggerHelper.h.

Referenced by acceptL1(), and acceptL1LogicalExpression().

std::vector< std::string > TriggerHelper::l1LogicalExpressions_ [private]

Definition at line 55 of file TriggerHelper.h.

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

bool TriggerHelper::on_ [private]

Definition at line 63 of file TriggerHelper.h.

Referenced by accept(), off(), on(), TriggerHelper(), and ~TriggerHelper().

bool TriggerHelper::onDcs_ [private]

Definition at line 64 of file TriggerHelper.h.

Referenced by acceptDcs(), and TriggerHelper().

bool TriggerHelper::onGt_ [private]

Definition at line 65 of file TriggerHelper.h.

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

bool TriggerHelper::onHlt_ [private]

Definition at line 67 of file TriggerHelper.h.

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

bool TriggerHelper::onL1_ [private]

Definition at line 66 of file TriggerHelper.h.

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

Definition at line 38 of file TriggerHelper.h.

Referenced by initRun(), TriggerHelper(), and ~TriggerHelper().