CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1GtUtils::LogicalExpressionL1Results Class Reference

#include <L1GtUtils.h>

Public Member Functions

const std::vector< std::pair< std::string, bool > > & decisionsAfterMask ()
 
const std::vector< std::pair< std::string, bool > > & decisionsBeforeMask ()
 
const std::vector< std::pair< std::string, int > > & errorCodes (const edm::Event &)
 
const std::vector< L1GtLogicParser::OperandToken > & expL1Triggers ()
 list of triggers in the logical expression, trigger decisions, prescale factors and masks, error codes More...
 
bool isValid ()
 return true if the logical expression is syntactically correct More...
 
 LogicalExpressionL1Results (const std::string &, L1GtUtils &)
 constructor(s) More...
 
const int logicalExpressionRunUpdate (const edm::Run &, const edm::EventSetup &, const std::string &)
 
const int logicalExpressionRunUpdate (const edm::Run &, const edm::EventSetup &)
 keep the logical expression given in the previous run More...
 
const std::vector< std::pair< std::string, int > > & prescaleFactors ()
 
const std::vector< std::pair< std::string, int > > & triggerMasks ()
 
 ~LogicalExpressionL1Results ()
 destructor More...
 

Private Member Functions

bool initialize ()
 
void l1Results (const edm::Event &iEvent)
 
void reset (const std::vector< std::pair< std::string, bool > > &) const
 reset for each L1 trigger the value from pair.second More...
 
void reset (const std::vector< std::pair< std::string, int > > &) const
 

Private Attributes

std::vector< std::pair< std::string, bool > > m_decisionsAfterMask
 
std::vector< std::pair< std::string, bool > > m_decisionsBeforeMask
 
std::vector< std::pair< std::string, int > > m_errorCodes
 
bool m_expBitsTechTrigger
 flag true, if the logical expression is built from technical trigger bits More...
 
std::vector< L1GtLogicParser::OperandTokenm_expL1Triggers
 
size_t m_expL1TriggersSize
 
std::vector< L1GtUtils::TriggerCategorym_expTriggerCategory
 trigger category for each L1 trigger in the logical expression More...
 
std::vector< bool > m_expTriggerInMenu
 
int m_l1ConfCode
 code for L1 trigger configuration More...
 
L1GtUtilsm_l1GtUtils
 
bool m_l1ResultsAlreadyCalled
 set to true if the method l1Results was called once More...
 
std::string m_logicalExpression
 private members as input parameters More...
 
std::vector< std::pair< std::string, int > > m_prescaleFactors
 
std::vector< std::pair< std::string, int > > m_triggerMasks
 
bool m_validL1Configuration
 true if valid L1 configuration - if not, reset all quantities and return More...
 
bool m_validLogicalExpression
 true if the logical expression uses accepted L1GtLogicParser operators More...
 

Detailed Description

Definition at line 130 of file L1GtUtils.h.

Constructor & Destructor Documentation

L1GtUtils::LogicalExpressionL1Results::LogicalExpressionL1Results ( const std::string &  expression,
L1GtUtils l1GtUtils 
)
explicit

constructor(s)

trigger decisions, prescale factors and masks from GT record(s)

Definition at line 2075 of file L1GtUtils.cc.

References initialize().

2076  :
2077 
2078  m_logicalExpression(expression),
2079 
2080  m_l1GtUtils(l1GtUtils),
2081 
2082  m_l1ConfCode(-1),
2083 
2084  m_validL1Configuration(false),
2085 
2086  m_validLogicalExpression(false),
2087 
2088  m_l1ResultsAlreadyCalled(false),
2089 
2091 
2092  m_expBitsTechTrigger(false) {
2093 
2094  initialize();
2095 }
bool m_validLogicalExpression
true if the logical expression uses accepted L1GtLogicParser operators
Definition: L1GtUtils.h:202
int m_l1ConfCode
code for L1 trigger configuration
Definition: L1GtUtils.h:196
std::string m_logicalExpression
private members as input parameters
Definition: L1GtUtils.h:187
bool m_l1ResultsAlreadyCalled
set to true if the method l1Results was called once
Definition: L1GtUtils.h:205
bool m_expBitsTechTrigger
flag true, if the logical expression is built from technical trigger bits
Definition: L1GtUtils.h:214
bool m_validL1Configuration
true if valid L1 configuration - if not, reset all quantities and return
Definition: L1GtUtils.h:199
L1GtUtils::LogicalExpressionL1Results::~LogicalExpressionL1Results ( )

destructor

Definition at line 2098 of file L1GtUtils.cc.

2098  {
2099 
2100  // empty
2101 
2102 }

Member Function Documentation

const std::vector< std::pair< std::string, bool > > & L1GtUtils::LogicalExpressionL1Results::decisionsAfterMask ( )

Definition at line 2327 of file L1GtUtils.cc.

References Exception, m_decisionsAfterMask, and m_l1ResultsAlreadyCalled.

Referenced by L1GtAnalyzer::analyzeL1GtUtilsCore(), and expL1Triggers().

2327  {
2328 
2329  // throw an exception if the result is not computed once per event - user usage error
2330  if (!m_l1ResultsAlreadyCalled) {
2331  throw cms::Exception("FailModule") << "\nUsage error: "
2332  << "\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2333  << std::endl;
2334  }
2335 
2336  return m_decisionsAfterMask;
2337 
2338 }
bool m_l1ResultsAlreadyCalled
set to true if the method l1Results was called once
Definition: L1GtUtils.h:205
std::vector< std::pair< std::string, bool > > m_decisionsAfterMask
Definition: L1GtUtils.h:222
const std::vector< std::pair< std::string, bool > > & L1GtUtils::LogicalExpressionL1Results::decisionsBeforeMask ( )

Definition at line 2314 of file L1GtUtils.cc.

References Exception, m_decisionsBeforeMask, and m_l1ResultsAlreadyCalled.

Referenced by L1GtAnalyzer::analyzeL1GtUtilsCore(), and expL1Triggers().

2314  {
2315 
2316  // throw an exception if the result is not computed once per event - user usage error
2317  if (!m_l1ResultsAlreadyCalled) {
2318  throw cms::Exception("FailModule") << "\nUsage error: "
2319  << "\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2320  << std::endl;
2321  }
2322 
2323  return m_decisionsBeforeMask;
2324 
2325 }
std::vector< std::pair< std::string, bool > > m_decisionsBeforeMask
Definition: L1GtUtils.h:221
bool m_l1ResultsAlreadyCalled
set to true if the method l1Results was called once
Definition: L1GtUtils.h:205
const std::vector< std::pair< std::string, int > > & L1GtUtils::LogicalExpressionL1Results::errorCodes ( const edm::Event iEvent)

Definition at line 2366 of file L1GtUtils.cc.

References l1Results(), m_decisionsAfterMask, m_decisionsBeforeMask, m_errorCodes, m_l1ResultsAlreadyCalled, m_prescaleFactors, m_triggerMasks, m_validL1Configuration, and reset().

Referenced by L1GtAnalyzer::analyzeL1GtUtilsCore(), and expL1Triggers().

2367  {
2368 
2369  m_l1ResultsAlreadyCalled = false;
2370 
2371  // if not a valid L1 configuration, reset all quantities and return
2372  if (!m_validL1Configuration) {
2378 
2379  m_l1ResultsAlreadyCalled = true;
2380  return m_errorCodes;
2381 
2382  }
2383 
2384  l1Results(iEvent);
2385 
2386  m_l1ResultsAlreadyCalled = true;
2387 
2388  return m_errorCodes;
2389 
2390 }
void l1Results(const edm::Event &iEvent)
Definition: L1GtUtils.cc:2408
std::vector< std::pair< std::string, bool > > m_decisionsBeforeMask
Definition: L1GtUtils.h:221
std::vector< std::pair< std::string, int > > m_errorCodes
Definition: L1GtUtils.h:225
std::vector< std::pair< std::string, int > > m_triggerMasks
Definition: L1GtUtils.h:224
std::vector< std::pair< std::string, int > > m_prescaleFactors
Definition: L1GtUtils.h:223
bool m_l1ResultsAlreadyCalled
set to true if the method l1Results was called once
Definition: L1GtUtils.h:205
void reset(const std::vector< std::pair< std::string, bool > > &) const
reset for each L1 trigger the value from pair.second
Definition: L1GtUtils.cc:2392
bool m_validL1Configuration
true if valid L1 configuration - if not, reset all quantities and return
Definition: L1GtUtils.h:199
std::vector< std::pair< std::string, bool > > m_decisionsAfterMask
Definition: L1GtUtils.h:222
const std::vector<L1GtLogicParser::OperandToken>& L1GtUtils::LogicalExpressionL1Results::expL1Triggers ( )
inline

list of triggers in the logical expression, trigger decisions, prescale factors and masks, error codes

Definition at line 159 of file L1GtUtils.h.

References decisionsAfterMask(), decisionsBeforeMask(), errorCodes(), iEvent, initialize(), l1Results(), m_expL1Triggers, prescaleFactors(), reset(), and triggerMasks().

Referenced by L1GtAnalyzer::analyzeL1GtUtilsCore().

159  {
160  return m_expL1Triggers;
161  }
std::vector< L1GtLogicParser::OperandToken > m_expL1Triggers
Definition: L1GtUtils.h:207
bool L1GtUtils::LogicalExpressionL1Results::initialize ( void  )
private

parse the logical expression, initialize the private members to required size such that one can just reset them

Definition at line 2104 of file L1GtUtils.cc.

References L1GtUtils::AlgorithmTrigger, cms::Exception::explainSelf(), cmsPerfPublish::fail(), plotBeamSpotDB::first, LogDebug, LogTrace, m_decisionsAfterMask, m_decisionsBeforeMask, m_errorCodes, m_expBitsTechTrigger, m_expL1Triggers, m_expL1TriggersSize, m_expTriggerCategory, m_expTriggerInMenu, m_logicalExpression, m_prescaleFactors, m_triggerMasks, m_validLogicalExpression, L1GtLogicParser::operandTokenVector(), edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::Exception::what().

Referenced by expL1Triggers(), LogicalExpressionL1Results(), and logicalExpressionRunUpdate().

2104  {
2105 
2106  // get the vector of triggers corresponding to the logical expression
2107  // check also the logical expression - add/remove spaces if needed
2108 
2109  try {
2110 
2111  L1GtLogicParser m_l1AlgoLogicParser = L1GtLogicParser(
2113 
2114  // list of L1 triggers from the logical expression
2115  m_expL1Triggers = m_l1AlgoLogicParser.operandTokenVector();
2117 
2118  m_validLogicalExpression = true;
2119 
2120  } catch (cms::Exception & ex) {
2121  m_validLogicalExpression = false;
2122 
2123  edm::LogWarning("L1GtUtils") << ex;
2124  edm::LogWarning("L1GtUtils") << ex.what();
2125  edm::LogWarning("L1GtUtils") << ex.explainSelf();
2126  }
2127 
2128  // try to convert the string representing each L1 trigger to bit number,
2129  // to check if the logical expression is constructed from bit numbers
2130  // trade-off: cache it here, irrespective of the expression
2131  // when the conversion fails (normally for the first seed,
2132  // if not expression of technical trigger bits), stop and
2133  // set m_expBitsTechTrigger to false
2134 
2135  m_expBitsTechTrigger = true;
2136 
2137  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2138  const std::string& bitString = (m_expL1Triggers[iTrig]).tokenName;
2139  std::istringstream bitStream(bitString);
2140  int bitInt;
2141 
2142  if ((bitStream >> bitInt).fail()) {
2143 
2144  m_expBitsTechTrigger = false;
2145 
2146  break;
2147  }
2148 
2149  (m_expL1Triggers[iTrig]).tokenNumber = bitInt;
2150 
2151  }
2152 
2153  // resize and fill
2154  m_decisionsBeforeMask.resize(m_expL1TriggersSize);
2155  m_decisionsAfterMask.resize(m_expL1TriggersSize);
2156  m_prescaleFactors.resize(m_expL1TriggersSize);
2157  m_triggerMasks.resize(m_expL1TriggersSize);
2158  m_errorCodes.resize(m_expL1TriggersSize);
2159  m_expTriggerCategory.resize(m_expL1TriggersSize);
2160  m_expTriggerInMenu.resize(m_expL1TriggersSize);
2161 
2162  LogDebug("L1GtUtils") << std::endl;
2163  LogTrace("L1GtUtils") << "\nLogical expression\n " << m_logicalExpression
2164  << "\n has " << m_expL1TriggersSize << " L1 triggers" << std::endl;
2165  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2166 
2167  const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2168  LogTrace("L1GtUtils") << " " << trigNameOrAlias << std::endl;
2169 
2170  (m_decisionsBeforeMask[iTrig]).first = trigNameOrAlias;
2171  (m_decisionsBeforeMask[iTrig]).second = false;
2172 
2173  (m_decisionsAfterMask[iTrig]).first = trigNameOrAlias;
2174  (m_decisionsAfterMask[iTrig]).second = false;
2175 
2176  (m_prescaleFactors[iTrig]).first = trigNameOrAlias;
2177  (m_prescaleFactors[iTrig]).second = -1;
2178 
2179  (m_triggerMasks[iTrig]).first = trigNameOrAlias;
2180  (m_triggerMasks[iTrig]).second = -1;
2181 
2182  (m_errorCodes[iTrig]).first = trigNameOrAlias;
2183  (m_errorCodes[iTrig]).second = -1;
2184 
2186 
2187  m_expTriggerInMenu[iTrig] = false;
2188 
2189  }
2190  LogTrace("L1GtUtils") << std::endl;
2191 
2192  return true;
2193 
2194 }
#define LogDebug(id)
bool m_validLogicalExpression
true if the logical expression uses accepted L1GtLogicParser operators
Definition: L1GtUtils.h:202
std::vector< std::pair< std::string, bool > > m_decisionsBeforeMask
Definition: L1GtUtils.h:221
std::vector< L1GtLogicParser::OperandToken > m_expL1Triggers
Definition: L1GtUtils.h:207
virtual std::string explainSelf() const
Definition: Exception.cc:108
char const * what() const override
Definition: Exception.cc:103
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, int > > m_errorCodes
Definition: L1GtUtils.h:225
std::vector< std::pair< std::string, int > > m_triggerMasks
Definition: L1GtUtils.h:224
std::vector< std::pair< std::string, int > > m_prescaleFactors
Definition: L1GtUtils.h:223
std::vector< OperandToken > & operandTokenVector()
return the vector of operand tokens
std::string m_logicalExpression
private members as input parameters
Definition: L1GtUtils.h:187
std::vector< bool > m_expTriggerInMenu
Definition: L1GtUtils.h:218
#define LogTrace(id)
bool m_expBitsTechTrigger
flag true, if the logical expression is built from technical trigger bits
Definition: L1GtUtils.h:214
std::vector< L1GtUtils::TriggerCategory > m_expTriggerCategory
trigger category for each L1 trigger in the logical expression
Definition: L1GtUtils.h:211
std::vector< std::pair< std::string, bool > > m_decisionsAfterMask
Definition: L1GtUtils.h:222
def fail(errstr="")
bool L1GtUtils::LogicalExpressionL1Results::isValid ( void  )
inline

return true if the logical expression is syntactically correct

Definition at line 144 of file L1GtUtils.h.

References logicalExpressionRunUpdate(), m_validLogicalExpression, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ntupleDataFormat._Object::_checkIsValid(), L1GtAnalyzer::beginRun(), and core.AutoHandle.AutoHandle::ReallyLoad().

144  {
146  }
bool m_validLogicalExpression
true if the logical expression uses accepted L1GtLogicParser operators
Definition: L1GtUtils.h:202
void L1GtUtils::LogicalExpressionL1Results::l1Results ( const edm::Event iEvent)
private

Definition at line 2408 of file L1GtUtils.cc.

References L1GtUtils::EmptyString, L1GtUtils::L1GtNotValidError, L1GtUtils::l1Results(), LogDebug, LogTrace, m_decisionsAfterMask, m_decisionsBeforeMask, m_errorCodes, m_expL1Triggers, m_expL1TriggersSize, m_expTriggerInMenu, m_l1ConfCode, m_l1GtUtils, m_logicalExpression, m_prescaleFactors, m_triggerMasks, reset(), edm::second(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by errorCodes(), and expL1Triggers().

2408  {
2409 
2410  // reset the vectors before filling them
2416 
2417  // initialization of actual values for each trigger
2418  bool decisionBeforeMaskValue = false;
2419  bool decisionAfterMaskValue = false;
2420  int prescaleFactorValue = -1;
2421  int triggerMaskValue = -1;
2422  int errorCode = -1;
2423 
2424  LogDebug("L1GtUtils") << std::endl;
2425  LogTrace("L1GtUtils") << "\nLogical expression\n " << m_logicalExpression
2426  << std::endl;
2427 
2428  // for each trigger, if it is in the L1 menu, get the prescale factor and trigger mask
2429 
2430  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2431 
2432  const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2433 
2434  if (m_expTriggerInMenu[iTrig]) {
2435  errorCode = m_l1GtUtils.l1Results(iEvent, trigNameOrAlias,
2436  decisionBeforeMaskValue, decisionAfterMaskValue,
2437  prescaleFactorValue, triggerMaskValue);
2438 
2439  if (errorCode != 0) {
2440 
2441  // error while retrieving the results
2442  // for this trigger: set prescale factor to -1, trigger mask to -1
2443 
2444  decisionBeforeMaskValue = false;
2445  decisionAfterMaskValue = false;
2446  prescaleFactorValue = -1;
2447  triggerMaskValue = -1;
2448 
2449  }
2450 
2451  } else {
2452  // no trigger name or trigger alias in the menu, no bits:
2453  // for this trigger: set prescale factor to -1, set the error code
2454 
2455  decisionBeforeMaskValue = false;
2456  decisionAfterMaskValue = false;
2457  prescaleFactorValue = -1;
2458  triggerMaskValue = -1;
2459  errorCode = m_l1ConfCode + 1;
2460 
2461  }
2462 
2463  LogTrace("L1GtUtils") << "\n" << trigNameOrAlias << ":" << std::endl;
2464 
2465  (m_decisionsBeforeMask[iTrig]).second = decisionBeforeMaskValue;
2466  LogTrace("L1GtUtils") << " decision before mask = "
2467  << decisionBeforeMaskValue << std::endl;
2468 
2469  (m_decisionsAfterMask[iTrig]).second = decisionAfterMaskValue;
2470  LogTrace("L1GtUtils") << " decision after mask = "
2471  << decisionAfterMaskValue << std::endl;
2472 
2473  (m_prescaleFactors[iTrig]).second = prescaleFactorValue;
2474  LogTrace("L1GtUtils") << " prescale factor = "
2475  << prescaleFactorValue << std::endl;
2476 
2477  (m_triggerMasks[iTrig]).second = triggerMaskValue;
2478  LogTrace("L1GtUtils") << " trigger mask = "
2479  << triggerMaskValue << std::endl;
2480 
2481  (m_errorCodes[iTrig]).second = errorCode;
2482  LogTrace("L1GtUtils") << " error code = " << errorCode
2483  << std::endl;
2484 
2485  }
2486 
2487  LogDebug("L1GtUtils") << std::endl;
2488 
2489 }
#define LogDebug(id)
std::vector< std::pair< std::string, bool > > m_decisionsBeforeMask
Definition: L1GtUtils.h:221
std::vector< L1GtLogicParser::OperandToken > m_expL1Triggers
Definition: L1GtUtils.h:207
int m_l1ConfCode
code for L1 trigger configuration
Definition: L1GtUtils.h:196
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, int > > m_errorCodes
Definition: L1GtUtils.h:225
std::vector< std::pair< std::string, int > > m_triggerMasks
Definition: L1GtUtils.h:224
std::vector< std::pair< std::string, int > > m_prescaleFactors
Definition: L1GtUtils.h:223
std::string m_logicalExpression
private members as input parameters
Definition: L1GtUtils.h:187
std::vector< bool > m_expTriggerInMenu
Definition: L1GtUtils.h:218
const int l1Results(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, bool &decisionBeforeMask, bool &decisionAfterMask, int &prescaleFactor, int &triggerMask) const
Definition: L1GtUtils.cc:713
#define LogTrace(id)
void reset(const std::vector< std::pair< std::string, bool > > &) const
reset for each L1 trigger the value from pair.second
Definition: L1GtUtils.cc:2392
std::vector< std::pair< std::string, bool > > m_decisionsAfterMask
Definition: L1GtUtils.h:222
const int L1GtUtils::LogicalExpressionL1Results::logicalExpressionRunUpdate ( const edm::Run iRun,
const edm::EventSetup evSetup,
const std::string &  logicExpression 
)

update quantities related to the logical expression at the beginning of the run new logical expression, replacing the logical expression given the in previous run

Definition at line 2197 of file L1GtUtils.cc.

References initialize(), m_decisionsAfterMask, m_decisionsBeforeMask, m_errorCodes, m_expBitsTechTrigger, m_expL1TriggersSize, m_expTriggerCategory, m_expTriggerInMenu, m_l1ResultsAlreadyCalled, m_logicalExpression, m_prescaleFactors, m_triggerMasks, and m_validLogicalExpression.

Referenced by L1GtAnalyzer::beginRun(), and isValid().

2199  {
2200 
2201  // initialize error code
2202  int errorCode = 0;
2203 
2204  // logical expression has changed - one must re-initialize all quantities related to the logical expression
2205  // and clear the vectors
2206 
2207  m_logicalExpression = logicExpression;
2208  m_validLogicalExpression = false;
2209 
2210  m_l1ResultsAlreadyCalled = false;
2211 
2212  m_expL1TriggersSize = 0;
2213  m_expBitsTechTrigger = false;
2214 
2215  //
2216  m_decisionsBeforeMask.clear();
2217  m_decisionsAfterMask.clear();
2218  m_prescaleFactors.clear();
2219  m_triggerMasks.clear();
2220  m_errorCodes.clear();
2221  m_expTriggerCategory.clear();
2222  m_expTriggerInMenu.clear();
2223 
2224 
2225  initialize();
2226 
2227  //
2228  errorCode = logicalExpressionRunUpdate(iRun, evSetup);
2229 
2230  return errorCode;
2231 
2232 }
bool m_validLogicalExpression
true if the logical expression uses accepted L1GtLogicParser operators
Definition: L1GtUtils.h:202
std::vector< std::pair< std::string, bool > > m_decisionsBeforeMask
Definition: L1GtUtils.h:221
const int logicalExpressionRunUpdate(const edm::Run &, const edm::EventSetup &, const std::string &)
Definition: L1GtUtils.cc:2197
std::vector< std::pair< std::string, int > > m_errorCodes
Definition: L1GtUtils.h:225
std::vector< std::pair< std::string, int > > m_triggerMasks
Definition: L1GtUtils.h:224
std::vector< std::pair< std::string, int > > m_prescaleFactors
Definition: L1GtUtils.h:223
std::string m_logicalExpression
private members as input parameters
Definition: L1GtUtils.h:187
std::vector< bool > m_expTriggerInMenu
Definition: L1GtUtils.h:218
bool m_l1ResultsAlreadyCalled
set to true if the method l1Results was called once
Definition: L1GtUtils.h:205
bool m_expBitsTechTrigger
flag true, if the logical expression is built from technical trigger bits
Definition: L1GtUtils.h:214
std::vector< L1GtUtils::TriggerCategory > m_expTriggerCategory
trigger category for each L1 trigger in the logical expression
Definition: L1GtUtils.h:211
std::vector< std::pair< std::string, bool > > m_decisionsAfterMask
Definition: L1GtUtils.h:222
const int L1GtUtils::LogicalExpressionL1Results::logicalExpressionRunUpdate ( const edm::Run iRun,
const edm::EventSetup evSetup 
)

keep the logical expression given in the previous run

Definition at line 2235 of file L1GtUtils.cc.

References L1GtUtils::AlgorithmTrigger, L1GtUtils::availableL1Configuration(), plotBeamSpotDB::first, L1GtUtils::l1AlgoTechTrigBitNumber(), L1GtUtils::l1TriggerNameFromBit(), m_decisionsAfterMask, m_decisionsBeforeMask, m_errorCodes, m_expBitsTechTrigger, m_expL1Triggers, m_expL1TriggersSize, m_expTriggerCategory, m_expTriggerInMenu, m_l1ConfCode, m_l1GtUtils, m_prescaleFactors, m_triggerMasks, m_validL1Configuration, AlCaHLTBitMon_QueryRunRegistry::string, and L1GtUtils::TechnicalTrigger.

2236  {
2237 
2238  // check first that a valid L1 configuration was retrieved,
2239  // to prevent also calls before the L1 configuration retrieval
2240 
2241  // initialize error code and L1 configuration code
2242  int errorCode = 0;
2243  int l1ConfCode = 0;
2244 
2245  if (!(m_l1GtUtils.availableL1Configuration(errorCode, l1ConfCode))) {
2246 
2247  m_validL1Configuration = false;
2248  return errorCode;
2249  } else {
2250 
2251  m_validL1Configuration = true;
2252  m_l1ConfCode = l1ConfCode;
2253  }
2254 
2255  // check if the trigger (name of alias) from the logical expression are in the menu,
2256  // if names are used, set tokenNumber to the corresponding bit number
2257  // if technical trigger bits, set tokenName to the corresponding technical trigger name, if
2258  // a technical trigger exists on that bit
2259  // for each trigger, set also the trigger category
2260 
2261  // initialization
2263  int bitNumber = -1;
2264 
2265  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2266 
2267  trigCategory = L1GtUtils::AlgorithmTrigger;
2268  bitNumber = -1;
2269  const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2270 
2271  if (!m_expBitsTechTrigger) {
2272  const bool triggerInMenu = m_l1GtUtils.l1AlgoTechTrigBitNumber(
2273  trigNameOrAlias, trigCategory, bitNumber);
2274 
2275  (m_expL1Triggers[iTrig]).tokenNumber = bitNumber;
2276  m_expTriggerCategory[iTrig] = trigCategory;
2277  m_expTriggerInMenu[iTrig] = triggerInMenu;
2278 
2279  } else {
2280 
2281  std::string aliasL1Trigger;
2282  std::string nameL1Trigger;
2283 
2284  trigCategory = L1GtUtils::TechnicalTrigger;
2285  bitNumber = (m_expL1Triggers[iTrig]).tokenNumber;
2286 
2287  const bool triggerInMenu = m_l1GtUtils.l1TriggerNameFromBit(
2288  bitNumber, trigCategory, aliasL1Trigger, nameL1Trigger);
2289 
2290  if (!triggerInMenu) {
2291  aliasL1Trigger = "Technical_trigger_bit_"
2292  + (m_expL1Triggers[iTrig]).tokenName + "_empty";
2293  }
2294 
2295  (m_expL1Triggers[iTrig]).tokenName = aliasL1Trigger;
2296  m_expTriggerCategory[iTrig] = trigCategory;
2297  m_expTriggerInMenu[iTrig] = triggerInMenu;
2298 
2299  // put the names of the technical triggers in the returned quantities
2300 
2301  (m_decisionsBeforeMask[iTrig]).first = aliasL1Trigger;
2302  (m_decisionsAfterMask[iTrig]).first = aliasL1Trigger;
2303  (m_prescaleFactors[iTrig]).first = aliasL1Trigger;
2304  (m_triggerMasks[iTrig]).first = aliasL1Trigger;
2305  (m_errorCodes[iTrig]).first = aliasL1Trigger;
2306 
2307  }
2308  }
2309 
2310  return errorCode;
2311 
2312 }
const bool l1TriggerNameFromBit(const int &bitNumber, const TriggerCategory &trigCategory, std::string &aliasL1Trigger, std::string &nameL1Trigger) const
Definition: L1GtUtils.cc:503
std::vector< std::pair< std::string, bool > > m_decisionsBeforeMask
Definition: L1GtUtils.h:221
std::vector< L1GtLogicParser::OperandToken > m_expL1Triggers
Definition: L1GtUtils.h:207
int m_l1ConfCode
code for L1 trigger configuration
Definition: L1GtUtils.h:196
const bool l1AlgoTechTrigBitNumber(const std::string &nameAlgoTechTrig, TriggerCategory &trigCategory, int &bitNumber) const
Definition: L1GtUtils.cc:376
const bool availableL1Configuration(int &errorCode, int &l1ConfCode) const
Definition: L1GtUtils.cc:1948
std::vector< std::pair< std::string, int > > m_errorCodes
Definition: L1GtUtils.h:225
std::vector< std::pair< std::string, int > > m_triggerMasks
Definition: L1GtUtils.h:224
std::vector< std::pair< std::string, int > > m_prescaleFactors
Definition: L1GtUtils.h:223
std::vector< bool > m_expTriggerInMenu
Definition: L1GtUtils.h:218
bool m_expBitsTechTrigger
flag true, if the logical expression is built from technical trigger bits
Definition: L1GtUtils.h:214
std::vector< L1GtUtils::TriggerCategory > m_expTriggerCategory
trigger category for each L1 trigger in the logical expression
Definition: L1GtUtils.h:211
bool m_validL1Configuration
true if valid L1 configuration - if not, reset all quantities and return
Definition: L1GtUtils.h:199
std::vector< std::pair< std::string, bool > > m_decisionsAfterMask
Definition: L1GtUtils.h:222
const std::vector< std::pair< std::string, int > > & L1GtUtils::LogicalExpressionL1Results::prescaleFactors ( )

Definition at line 2340 of file L1GtUtils.cc.

References Exception, m_l1ResultsAlreadyCalled, and m_prescaleFactors.

Referenced by L1GtAnalyzer::analyzeL1GtUtilsCore(), and expL1Triggers().

2340  {
2341 
2342  // throw an exception if the result is not computed once per event - user usage error
2343  if (!m_l1ResultsAlreadyCalled) {
2344  throw cms::Exception("FailModule") << "\nUsage error: "
2345  << "\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2346  << std::endl;
2347  }
2348 
2349  return m_prescaleFactors;
2350 
2351 }
std::vector< std::pair< std::string, int > > m_prescaleFactors
Definition: L1GtUtils.h:223
bool m_l1ResultsAlreadyCalled
set to true if the method l1Results was called once
Definition: L1GtUtils.h:205
void L1GtUtils::LogicalExpressionL1Results::reset ( const std::vector< std::pair< std::string, bool > > &  _pairVector) const
private

reset for each L1 trigger the value from pair.second

Definition at line 2392 of file L1GtUtils.cc.

References m_expL1TriggersSize, and edm::second().

Referenced by errorCodes(), expL1Triggers(), and l1Results().

2393  {
2394  std::vector<std::pair<std::string, bool> > pairVector = _pairVector;
2395  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2396  (pairVector[iTrig]).second = false;
2397  }
2398 }
U second(std::pair< T, U > const &p)
void L1GtUtils::LogicalExpressionL1Results::reset ( const std::vector< std::pair< std::string, int > > &  _pairVector) const
private

Definition at line 2400 of file L1GtUtils.cc.

References m_expL1TriggersSize, and edm::second().

2401  {
2402  std::vector<std::pair<std::string, int> > pairVector = _pairVector;
2403  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2404  (pairVector[iTrig]).second = -1;
2405  }
2406 }
U second(std::pair< T, U > const &p)
const std::vector< std::pair< std::string, int > > & L1GtUtils::LogicalExpressionL1Results::triggerMasks ( )

Definition at line 2353 of file L1GtUtils.cc.

References Exception, m_l1ResultsAlreadyCalled, and m_triggerMasks.

Referenced by L1GtAnalyzer::analyzeL1GtUtilsCore(), and expL1Triggers().

2353  {
2354 
2355  // throw an exception if the result is not computed once per event - user usage error
2356  if (!m_l1ResultsAlreadyCalled) {
2357  throw cms::Exception("FailModule") << "\nUsage error: "
2358  << "\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2359  << std::endl;
2360  }
2361 
2362  return m_triggerMasks;
2363 
2364 }
std::vector< std::pair< std::string, int > > m_triggerMasks
Definition: L1GtUtils.h:224
bool m_l1ResultsAlreadyCalled
set to true if the method l1Results was called once
Definition: L1GtUtils.h:205

Member Data Documentation

std::vector<std::pair<std::string, bool> > L1GtUtils::LogicalExpressionL1Results::m_decisionsAfterMask
private
std::vector<std::pair<std::string, bool> > L1GtUtils::LogicalExpressionL1Results::m_decisionsBeforeMask
private
std::vector<std::pair<std::string, int> > L1GtUtils::LogicalExpressionL1Results::m_errorCodes
private

Definition at line 225 of file L1GtUtils.h.

Referenced by errorCodes(), initialize(), l1Results(), and logicalExpressionRunUpdate().

bool L1GtUtils::LogicalExpressionL1Results::m_expBitsTechTrigger
private

flag true, if the logical expression is built from technical trigger bits

Definition at line 214 of file L1GtUtils.h.

Referenced by initialize(), and logicalExpressionRunUpdate().

std::vector<L1GtLogicParser::OperandToken> L1GtUtils::LogicalExpressionL1Results::m_expL1Triggers
private

Definition at line 207 of file L1GtUtils.h.

Referenced by expL1Triggers(), initialize(), l1Results(), and logicalExpressionRunUpdate().

size_t L1GtUtils::LogicalExpressionL1Results::m_expL1TriggersSize
private

Definition at line 208 of file L1GtUtils.h.

Referenced by initialize(), l1Results(), logicalExpressionRunUpdate(), and reset().

std::vector<L1GtUtils::TriggerCategory> L1GtUtils::LogicalExpressionL1Results::m_expTriggerCategory
private

trigger category for each L1 trigger in the logical expression

Definition at line 211 of file L1GtUtils.h.

Referenced by initialize(), and logicalExpressionRunUpdate().

std::vector<bool> L1GtUtils::LogicalExpressionL1Results::m_expTriggerInMenu
private

for each L1 trigger in the logical expression, true if the trigger is found in the current L1 menu

Definition at line 218 of file L1GtUtils.h.

Referenced by initialize(), l1Results(), and logicalExpressionRunUpdate().

int L1GtUtils::LogicalExpressionL1Results::m_l1ConfCode
private

code for L1 trigger configuration

Definition at line 196 of file L1GtUtils.h.

Referenced by l1Results(), and logicalExpressionRunUpdate().

L1GtUtils& L1GtUtils::LogicalExpressionL1Results::m_l1GtUtils
private

Definition at line 189 of file L1GtUtils.h.

Referenced by l1Results(), and logicalExpressionRunUpdate().

bool L1GtUtils::LogicalExpressionL1Results::m_l1ResultsAlreadyCalled
private

set to true if the method l1Results was called once

Definition at line 205 of file L1GtUtils.h.

Referenced by decisionsAfterMask(), decisionsBeforeMask(), errorCodes(), logicalExpressionRunUpdate(), prescaleFactors(), and triggerMasks().

std::string L1GtUtils::LogicalExpressionL1Results::m_logicalExpression
private

private members as input parameters

logical expression

Definition at line 187 of file L1GtUtils.h.

Referenced by initialize(), l1Results(), and logicalExpressionRunUpdate().

std::vector<std::pair<std::string, int> > L1GtUtils::LogicalExpressionL1Results::m_prescaleFactors
private
std::vector<std::pair<std::string, int> > L1GtUtils::LogicalExpressionL1Results::m_triggerMasks
private
bool L1GtUtils::LogicalExpressionL1Results::m_validL1Configuration
private

true if valid L1 configuration - if not, reset all quantities and return

Definition at line 199 of file L1GtUtils.h.

Referenced by errorCodes(), and logicalExpressionRunUpdate().

bool L1GtUtils::LogicalExpressionL1Results::m_validLogicalExpression
private

true if the logical expression uses accepted L1GtLogicParser operators

Definition at line 202 of file L1GtUtils.h.

Referenced by initialize(), isValid(), and logicalExpressionRunUpdate().