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 | Static Public Member Functions | Private Member Functions | Private Attributes
l1t::L1TGlobalUtil Class Reference

#include <L1TGlobalUtil.h>

Public Member Functions

const std::vector< std::pair
< std::string, bool > > & 
decisionsFinal ()
 
const std::vector< std::pair
< std::string, bool > > & 
decisionsInitial ()
 
const std::vector< std::pair
< std::string, bool > > & 
decisionsInterm ()
 
const bool getAlgBitFromName (const std::string &AlgName, int &bit) const
 
const bool getAlgNameFromBit (int &bit, std::string &AlgName) const
 
const bool getFinalDecisionByBit (int &bit, bool &decision) const
 
const bool getFinalDecisionByName (const std::string &algName, bool &decision) const
 
bool getFinalOR () const
 
const bool getInitialDecisionByBit (int &bit, bool &decision) const
 
const bool getInitialDecisionByName (const std::string &algName, bool &decision) const
 
const bool getIntermDecisionByBit (int &bit, bool &decision) const
 
const bool getIntermDecisionByName (const std::string &algName, bool &decision) const
 
const bool getMaskByBit (int &bit, bool &mask) const
 
const bool getMaskByName (const std::string &algName, bool &mask) const
 
const bool getPrescaleByBit (int &bit, int &prescale) const
 
const bool getPrescaleByName (const std::string &algName, int &prescale) const
 
const bool getVetoMaskByBit (int &bit, bool &veto) const
 
const bool getVetoMaskByName (const std::string &algName, bool &veto) const
 
const std::string & gtTriggerMenuComment () const
 
const std::string & gtTriggerMenuName () const
 
const std::string & gtTriggerMenuVersion () const
 
 L1TGlobalUtil (edm::ParameterSet const &pset, edm::ConsumesCollector &&iC)
 
 L1TGlobalUtil (edm::ParameterSet const &pset, edm::ConsumesCollector &iC)
 
template<typename T >
 L1TGlobalUtil (edm::ParameterSet const &pset, edm::ConsumesCollector &&iC, T &module)
 
template<typename T >
 L1TGlobalUtil (edm::ParameterSet const &pset, edm::ConsumesCollector &iC, T &module)
 
template<typename T >
 L1TGlobalUtil (edm::ParameterSet const &pset, edm::ConsumesCollector &&iC, T &module, edm::InputTag const &l1tAlgBlkInputTag, edm::InputTag const &l1tExtBlkInputTag)
 
template<typename T >
 L1TGlobalUtil (edm::ParameterSet const &pset, edm::ConsumesCollector &iC, T &module, edm::InputTag const &l1tAlgBlkInputTag, edm::InputTag const &l1tExtBlkInputTag)
 
const std::vector< std::pair
< std::string, bool > > & 
masks ()
 
void OverridePrescalesAndMasks (std::string filename, unsigned int psColumn=1)
 
unsigned int prescaleColumn () const
 
const std::vector< std::pair
< std::string, int > > & 
prescales ()
 
void retrieveL1 (const edm::Event &iEvent, const edm::EventSetup &evSetup)
 initialize the class (mainly reserve) More...
 
void retrieveL1 (const edm::Event &iEvent, const edm::EventSetup &evSetup, edm::EDGetToken gtAlgToken)
 
void retrieveL1Event (const edm::Event &iEvent, const edm::EventSetup &evSetup)
 
void retrieveL1Event (const edm::Event &iEvent, const edm::EventSetup &evSetup, edm::EDGetToken gtAlgToken)
 
void retrieveL1Setup (const edm::EventSetup &evSetup)
 
void setUnprescaledUnmasked (const bool unprescale, const bool unmask)
 
void setVerbosity (const int verbosity)
 
const std::vector< std::pair
< std::string, bool > > & 
vetoMasks ()
 
virtual ~L1TGlobalUtil ()
 destructor More...
 

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &desc)
 

Private Member Functions

 L1TGlobalUtil ()
 
void loadPrescalesAndMasks ()
 
void resetDecisionVectors ()
 clear decision vectors on a menu change More...
 
void resetMaskVectors ()
 
void resetPrescaleVectors ()
 

Private Attributes

const std::map< std::string,
L1TUtmAlgorithm > * 
m_algorithmMap
 
bool m_algorithmTriggersUnmasked
 
bool m_algorithmTriggersUnprescaled
 
std::vector< std::pair
< std::string, bool > > 
m_decisionsFinal
 
std::vector< std::pair
< std::string, bool > > 
m_decisionsInitial
 
std::vector< std::pair
< std::string, bool > > 
m_decisionsInterm
 
bool m_filledPrescales
 
bool m_finalOR
 
std::vector< std::vector< int > > m_initialPrescaleFactorsAlgoTrig
 
std::vector< unsigned int > m_initialTriggerMaskAlgoTrig
 
std::vector< int > m_initialTriggerMaskVetoAlgoTrig
 
const L1TUtmTriggerMenum_l1GtMenu
 
unsigned long long m_l1GtMenuCacheID
 
unsigned long long m_l1GtPfAlgoCacheID
 
const l1t::PrescalesVetosHelperm_l1GtPrescalesVetoes
 
std::unique_ptr
< L1TGlobalUtilHelper
m_l1tGlobalUtilHelper
 
std::vector< std::pair
< std::string, bool > > 
m_masks
 
unsigned int m_numberPhysTriggers
 
unsigned int m_PreScaleColumn
 
const std::vector< std::vector
< int > > * 
m_prescaleFactorsAlgoTrig
 
std::string m_preScaleFileName
 
std::vector< std::pair
< std::string, int > > 
m_prescales
 
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
 
const std::vector< int > * m_triggerMaskVetoAlgoTrig
 
edm::Handle< BXVector
< GlobalAlgBlk > > 
m_uGtAlgBlk
 
int m_verbosity
 verbosity level More...
 
std::vector< std::pair
< std::string, bool > > 
m_vetoMasks
 

Detailed Description

Definition at line 31 of file L1TGlobalUtil.h.

Constructor & Destructor Documentation

l1t::L1TGlobalUtil::L1TGlobalUtil ( edm::ParameterSet const &  pset,
edm::ConsumesCollector &&  iC 
)

Definition at line 45 of file L1TGlobalUtil.cc.

l1t::L1TGlobalUtil::L1TGlobalUtil ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC 
)

Definition at line 49 of file L1TGlobalUtil.cc.

References m_l1tGlobalUtilHelper.

50  :
51  L1TGlobalUtil() {
53 }
std::unique_ptr< L1TGlobalUtilHelper > m_l1tGlobalUtilHelper
template<typename T >
l1t::L1TGlobalUtil::L1TGlobalUtil ( edm::ParameterSet const &  pset,
edm::ConsumesCollector &&  iC,
T module 
)

Definition at line 232 of file L1TGlobalUtil.h.

template<typename T >
l1t::L1TGlobalUtil::L1TGlobalUtil ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module 
)

Definition at line 238 of file L1TGlobalUtil.h.

References m_l1tGlobalUtilHelper.

240  :
241  L1TGlobalUtil() {
243  iC,
244  module));
245  }
std::unique_ptr< L1TGlobalUtilHelper > m_l1tGlobalUtilHelper
Definition: vlib.h:208
template<typename T >
l1t::L1TGlobalUtil::L1TGlobalUtil ( edm::ParameterSet const &  pset,
edm::ConsumesCollector &&  iC,
T module,
edm::InputTag const &  l1tAlgBlkInputTag,
edm::InputTag const &  l1tExtBlkInputTag 
)

Definition at line 248 of file L1TGlobalUtil.h.

252  :
253  L1TGlobalUtil(pset, iC, module, l1tAlgBlkInputTag, l1tExtBlkInputTag) { }
Definition: vlib.h:208
template<typename T >
l1t::L1TGlobalUtil::L1TGlobalUtil ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module,
edm::InputTag const &  l1tAlgBlkInputTag,
edm::InputTag const &  l1tExtBlkInputTag 
)

Definition at line 256 of file L1TGlobalUtil.h.

References m_l1tGlobalUtilHelper.

260  :
261  L1TGlobalUtil() {
263  iC,
264  module,
265  l1tAlgBlkInputTag,
266  l1tExtBlkInputTag));
267  }
std::unique_ptr< L1TGlobalUtilHelper > m_l1tGlobalUtilHelper
Definition: vlib.h:208
l1t::L1TGlobalUtil::~L1TGlobalUtil ( )
virtual

destructor

Definition at line 56 of file L1TGlobalUtil.cc.

56  {
57 
58  // empty
59 
60 }
l1t::L1TGlobalUtil::L1TGlobalUtil ( )
private

Definition at line 30 of file L1TGlobalUtil.cc.

References validate-o2o-wbm::f1, edm::FileInPath::fullPath(), m_algorithmTriggersUnmasked, m_algorithmTriggersUnprescaled, m_filledPrescales, m_l1GtMenuCacheID, m_l1GtPfAlgoCacheID, m_numberPhysTriggers, m_PreScaleColumn, and m_preScaleFileName.

30  {
31  // initialize cached IDs
32  m_l1GtMenuCacheID = 0ULL;
33  m_l1GtPfAlgoCacheID = 0ULL;
34  m_filledPrescales = false;
37 
38  edm::FileInPath f1("L1Trigger/L1TGlobal/data/Luminosity/startup/prescale_L1TGlobal.csv");
39  m_preScaleFileName = f1.fullPath();
40  m_numberPhysTriggers = 512; //need to get this out of the EventSetup
41  m_PreScaleColumn = 1;
42 
43 }
std::string m_preScaleFileName
bool m_algorithmTriggersUnmasked
unsigned long long m_l1GtPfAlgoCacheID
unsigned int m_PreScaleColumn
unsigned long long m_l1GtMenuCacheID
bool m_algorithmTriggersUnprescaled
unsigned int m_numberPhysTriggers

Member Function Documentation

const std::vector<std::pair<std::string, bool> >& l1t::L1TGlobalUtil::decisionsFinal ( )
inline

Definition at line 149 of file L1TGlobalUtil.h.

References m_decisionsFinal.

149 { return m_decisionsFinal; }
std::vector< std::pair< std::string, bool > > m_decisionsFinal
const std::vector<std::pair<std::string, bool> >& l1t::L1TGlobalUtil::decisionsInitial ( )
inline

Definition at line 147 of file L1TGlobalUtil.h.

References m_decisionsInitial.

147 { return m_decisionsInitial; }
std::vector< std::pair< std::string, bool > > m_decisionsInitial
const std::vector<std::pair<std::string, bool> >& l1t::L1TGlobalUtil::decisionsInterm ( )
inline

Definition at line 148 of file L1TGlobalUtil.h.

References m_decisionsInterm.

148 { return m_decisionsInterm; }
std::vector< std::pair< std::string, bool > > m_decisionsInterm
static void l1t::L1TGlobalUtil::fillDescription ( edm::ParameterSetDescription desc)
inlinestatic

Definition at line 80 of file L1TGlobalUtil.h.

References l1t::L1TGlobalUtilHelper::fillDescription().

80  {
82  }
static void fillDescription(edm::ParameterSetDescription &desc)
const bool l1t::L1TGlobalUtil::getAlgBitFromName ( const std::string &  AlgName,
int &  bit 
) const

Definition at line 447 of file L1TGlobalUtil.cc.

447  {
448 
449  std::map<std::string, L1TUtmAlgorithm>::const_iterator itAlgo = m_algorithmMap->find(algName);
450  if(itAlgo != m_algorithmMap->end()) {
451  bit = (itAlgo->second).getIndex(); //algoBitNumber();
452  return true;
453  }
454 
455  return false; //did not find anything by that name
456 }
const std::map< std::string, L1TUtmAlgorithm > * m_algorithmMap
const bool l1t::L1TGlobalUtil::getAlgNameFromBit ( int &  bit,
std::string &  AlgName 
) const

Definition at line 458 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first.

458  {
459 
460  // since we are just looking up the name, doesn't matter which vector we get it from
461  if((m_decisionsInitial[bit]).first != "NULL") {
462  algName = (m_decisionsInitial[bit]).first;
463  return true;
464  }
465  return false; //No name associated with this bit
466 
467 }
std::vector< std::pair< std::string, bool > > m_decisionsInitial
const bool l1t::L1TGlobalUtil::getFinalDecisionByBit ( int &  bit,
bool &  decision 
) const

Definition at line 494 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, and edm::second().

494  {
495 
496  // Need some check that this is a valid bit
497  if((m_decisionsFinal[bit]).first != "NULL") {
498  decision = (m_decisionsFinal[bit]).second;
499  return true;
500  }
501 
502  return false; //couldn't get the information requested.
503 }
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, bool > > m_decisionsFinal
const bool l1t::L1TGlobalUtil::getFinalDecisionByName ( const std::string &  algName,
bool &  decision 
) const

Definition at line 558 of file L1TGlobalUtil.cc.

References edm::second().

558  {
559 
560  int bit = -1;
561  if(getAlgBitFromName(algName,bit)) {
562  decision = (m_decisionsFinal[bit]).second;
563  return true;
564  }
565 
566  return false; //trigger name was not the menu.
567 }
const bool getAlgBitFromName(const std::string &AlgName, int &bit) const
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, bool > > m_decisionsFinal
bool l1t::L1TGlobalUtil::getFinalOR ( ) const
inline

Definition at line 107 of file L1TGlobalUtil.h.

References m_finalOR.

107 {return m_finalOR;}
const bool l1t::L1TGlobalUtil::getInitialDecisionByBit ( int &  bit,
bool &  decision 
) const

Definition at line 469 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, and edm::second().

469  {
470 
471  /*
472  for(std::vector<GlobalAlgBlk>::const_iterator algBlk = m_uGtAlgBlk->begin(0); algBlk != m_uGtAlgBlk->end(0); ++algBlk) {
473  decision = algBlk->getAlgoDecisionFinal(bit);
474  }
475  */
476  // Need some check that this is a valid bit
477  if((m_decisionsInitial[bit]).first != "NULL") {
478  decision = (m_decisionsInitial[bit]).second;
479  return true;
480  }
481 
482  return false; //couldn't get the information requested.
483 }
std::vector< std::pair< std::string, bool > > m_decisionsInitial
U second(std::pair< T, U > const &p)
const bool l1t::L1TGlobalUtil::getInitialDecisionByName ( const std::string &  algName,
bool &  decision 
) const

Definition at line 536 of file L1TGlobalUtil.cc.

References edm::second().

536  {
537 
538  int bit = -1;
539  if(getAlgBitFromName(algName,bit)) {
540  decision = (m_decisionsInitial[bit]).second;
541  return true;
542  }
543 
544  return false; //trigger name was not the menu.
545 }
const bool getAlgBitFromName(const std::string &AlgName, int &bit) const
std::vector< std::pair< std::string, bool > > m_decisionsInitial
U second(std::pair< T, U > const &p)
const bool l1t::L1TGlobalUtil::getIntermDecisionByBit ( int &  bit,
bool &  decision 
) const

Definition at line 484 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, and edm::second().

484  {
485 
486  // Need some check that this is a valid bit
487  if((m_decisionsInterm[bit]).first != "NULL") {
488  decision = (m_decisionsInterm[bit]).second;
489  return true;
490  }
491 
492  return false; //couldn't get the information requested.
493 }
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, bool > > m_decisionsInterm
const bool l1t::L1TGlobalUtil::getIntermDecisionByName ( const std::string &  algName,
bool &  decision 
) const

Definition at line 547 of file L1TGlobalUtil.cc.

References edm::second().

547  {
548 
549  int bit = -1;
550  if(getAlgBitFromName(algName,bit)) {
551  decision = (m_decisionsInterm[bit]).second;
552  return true;
553  }
554 
555  return false; //trigger name was not the menu.
556 }
const bool getAlgBitFromName(const std::string &AlgName, int &bit) const
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, bool > > m_decisionsInterm
const bool l1t::L1TGlobalUtil::getMaskByBit ( int &  bit,
bool &  mask 
) const

Definition at line 514 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, and edm::second().

514  {
515 
516  // Need some check that this is a valid bit
517  if((m_masks[bit]).first != "NULL") {
518  mask = (m_masks[bit]).second;
519  return true;
520  }
521 
522  return false; //couldn't get the information requested.
523 }
std::vector< std::pair< std::string, bool > > m_masks
U second(std::pair< T, U > const &p)
const bool l1t::L1TGlobalUtil::getMaskByName ( const std::string &  algName,
bool &  mask 
) const

Definition at line 578 of file L1TGlobalUtil.cc.

References edm::second().

578  {
579 
580  int bit = -1;
581  if(getAlgBitFromName(algName,bit)) {
582  mask = (m_masks[bit]).second;
583  return true;
584  }
585 
586  return false; //trigger name was not the menu.
587 }
const bool getAlgBitFromName(const std::string &AlgName, int &bit) const
std::vector< std::pair< std::string, bool > > m_masks
U second(std::pair< T, U > const &p)
const bool l1t::L1TGlobalUtil::getPrescaleByBit ( int &  bit,
int &  prescale 
) const

Definition at line 504 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, and edm::second().

504  {
505 
506  // Need some check that this is a valid bit
507  if((m_prescales[bit]).first != "NULL") {
508  prescale = (m_prescales[bit]).second;
509  return true;
510  }
511 
512  return false; //couldn't get the information requested.
513 }
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, int > > m_prescales
const bool l1t::L1TGlobalUtil::getPrescaleByName ( const std::string &  algName,
int &  prescale 
) const

Definition at line 568 of file L1TGlobalUtil.cc.

References edm::second().

Referenced by HLTPrescaleProvider::prescaleValues(), and HLTPrescaleProvider::prescaleValuesInDetail().

568  {
569 
570  int bit = -1;
571  if(getAlgBitFromName(algName,bit)) {
572  prescale = (m_prescales[bit]).second;
573  return true;
574  }
575 
576  return false; //trigger name was not the menu.
577 }
const bool getAlgBitFromName(const std::string &AlgName, int &bit) const
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, int > > m_prescales
const bool l1t::L1TGlobalUtil::getVetoMaskByBit ( int &  bit,
bool &  veto 
) const

Definition at line 525 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, and edm::second().

525  {
526 
527  // Need some check that this is a valid bit
528  if((m_vetoMasks[bit]).first != "NULL") {
529  veto = (m_vetoMasks[bit]).second;
530  return true;
531  }
532 
533  return false; //couldn't get the information requested.
534 }
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, bool > > m_vetoMasks
const bool l1t::L1TGlobalUtil::getVetoMaskByName ( const std::string &  algName,
bool &  veto 
) const

Definition at line 588 of file L1TGlobalUtil.cc.

References edm::second().

588  {
589 
590  int bit = -1;
591  if(getAlgBitFromName(algName,bit)) {
592  veto = (m_vetoMasks[bit]).second;
593  return true;
594  }
595 
596  return false; //trigger name was not the menu.
597 }
const bool getAlgBitFromName(const std::string &AlgName, int &bit) const
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, bool > > m_vetoMasks
const std::string& l1t::L1TGlobalUtil::gtTriggerMenuComment ( ) const
inline

Definition at line 161 of file L1TGlobalUtil.h.

References L1TUtmTriggerMenu::getComment(), and m_l1GtMenu.

161 {return m_l1GtMenu->getComment();}
const L1TUtmTriggerMenu * m_l1GtMenu
const std::string & getComment() const
const std::string& l1t::L1TGlobalUtil::gtTriggerMenuName ( ) const
inline

Definition at line 159 of file L1TGlobalUtil.h.

References L1TUtmTriggerMenu::getName(), and m_l1GtMenu.

159 {return m_l1GtMenu->getName();}
const L1TUtmTriggerMenu * m_l1GtMenu
const std::string & getName() const
const std::string& l1t::L1TGlobalUtil::gtTriggerMenuVersion ( ) const
inline

Definition at line 160 of file L1TGlobalUtil.h.

References L1TUtmTriggerMenu::getVersion(), and m_l1GtMenu.

160 {return m_l1GtMenu->getVersion();}
const L1TUtmTriggerMenu * m_l1GtMenu
const std::string & getVersion() const
void l1t::L1TGlobalUtil::loadPrescalesAndMasks ( )
private

Definition at line 228 of file L1TGlobalUtil.cc.

References cuy::col, plotBeamSpotDB::first, geometryCSVtoXML::line, LogTrace, cmsHarvester::sep, findQualityFiles::size, split, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

228  {
229 
230  std::ifstream inputPrescaleFile;
231  inputPrescaleFile.open(m_preScaleFileName);
232 
233  std::vector<std::vector<int> > vec;
234  std::vector<std::vector<int> > prescale_vec;
235 
236  std::vector<unsigned int> temp_triggerMask;
237  std::vector<int> temp_triggerVetoMask;
238 
239  if( inputPrescaleFile ){
240  std::string prefix1("#");
241  std::string prefix2("-1");
242 
243  std::string line;
244 
245  bool first = true;
246 
247  while( getline(inputPrescaleFile,line) ){
248 
249  if( !line.compare(0, prefix1.size(), prefix1) ) continue;
250  //if( !line.compare(0, prefix2.size(), prefix2) ) continue;
251 
252  istringstream split(line);
253  int value;
254  int col = 0;
255  char sep;
256 
257  while( split >> value ){
258  if( first ){
259  // Each new value read on line 1 should create a new inner vector
260  vec.push_back(std::vector<int>());
261  }
262 
263  vec[col].push_back(value);
264  ++col;
265 
266  // read past the separator
267  split>>sep;
268  }
269 
270  // Finished reading line 1 and creating as many inner
271  // vectors as required
272  first = false;
273  }
274 
275 
276  int NumPrescaleSets = 0;
277 
278  int maskColumn = -1;
279  int maskVetoColumn = -1;
280  for( int iCol=0; iCol<int(vec.size()); iCol++ ){
281  if( vec[iCol].size() > 0 ){
282  int firstRow = vec[iCol][0];
283 
284  if( firstRow > 0 ) NumPrescaleSets++;
285  else if( firstRow==-2 ) maskColumn = iCol;
286  else if( firstRow==-3 ) maskVetoColumn = iCol;
287  }
288  }
289 
290  // Fill default values for mask and veto mask
291  for( unsigned int iBit = 0; iBit < m_numberPhysTriggers; ++iBit ){
292  unsigned int inputDefaultMask = 1;
293  unsigned int inputDefaultVetoMask = 0;
294  temp_triggerMask.push_back(inputDefaultMask);
295  temp_triggerVetoMask.push_back(inputDefaultVetoMask);
296  }
297 
298 // cout << " Mask Column " << maskColumn << " VetoColumn " << maskVetoColumn << endl;
299 
300  // Fill non-trivial mask and veto mask
301  if( maskColumn>=0 || maskVetoColumn>=0 ){
302  for( int iBit=1; iBit<int(vec[0].size()); iBit++ ){
303  unsigned int algoBit = vec[0][iBit];
304  // algoBit must be less than the number of triggers
305  if( algoBit < m_numberPhysTriggers ){
306  if( maskColumn>=0 ){
307  unsigned int triggerMask = vec[maskColumn][iBit];
308  temp_triggerMask[algoBit] = triggerMask;
309 // cout << "Settting Mask for bit " << algoBit << " to " << triggerMask << endl;
310  }
311  if( maskVetoColumn>=0 ){
312  int triggerVetoMask = vec[maskVetoColumn][iBit];
313  temp_triggerVetoMask[algoBit] = triggerVetoMask;
314  }
315  }
316  }
317  }
318 
319 
320  if( NumPrescaleSets > 0 ){
321  // Fill default prescale set
322  for( int iSet=0; iSet<NumPrescaleSets; iSet++ ){
323  prescale_vec.push_back(std::vector<int>());
324  for( unsigned int iBit = 0; iBit < m_numberPhysTriggers; ++iBit ){
325  int inputDefaultPrescale = 1;
326  prescale_vec[iSet].push_back(inputDefaultPrescale);
327  }
328  }
329 
330  // Fill non-trivial prescale set
331  for( int iBit=1; iBit<int(vec[0].size()); iBit++ ){
332  unsigned int algoBit = vec[0][iBit];
333  // algoBit must be less than the number of triggers
334  if( algoBit < m_numberPhysTriggers ){
335  for( int iSet=0; iSet<int(vec.size()); iSet++ ){
336  int useSet = -1;
337  if( vec[iSet].size() > 0 ){
338  useSet = vec[iSet][0];
339  }
340  useSet -= 1;
341 
342  if( useSet<0 ) continue;
343 
344  int prescale = vec[iSet][iBit];
345  prescale_vec[useSet][algoBit] = prescale;
346  }
347  }
348  else{
349  LogTrace("l1t|Global")
350  << "\nPrescale file has algo bit: " << algoBit
351  << "\nThis is larger than the number of triggers: " << m_numberPhysTriggers
352  << "\nSomething is wrong. Ignoring."
353  << std::endl;
354  }
355  }
356  }
357 
358  }
359  else {
360  LogTrace("l1t|Global")
361  << "\nCould not find file: " << m_preScaleFileName
362  << "\nFilling the prescale vectors with prescale 1"
363  << "\nSetting prescale set to 1"
364  << std::endl;
365 
366  m_PreScaleColumn = 1;
367 
368  for( int col=0; col < 1; col++ ){
369  prescale_vec.push_back(std::vector<int>());
370  for( unsigned int iBit = 0; iBit < m_numberPhysTriggers; ++iBit ){
371  int inputDefaultPrescale = 1;
372  prescale_vec[col].push_back(inputDefaultPrescale);
373  }
374  }
375  }
376 
377  inputPrescaleFile.close();
378 
379  m_initialPrescaleFactorsAlgoTrig = prescale_vec;
380  m_initialTriggerMaskAlgoTrig = temp_triggerMask;
381  m_initialTriggerMaskVetoAlgoTrig = temp_triggerVetoMask;
382 
383 }
std::string m_preScaleFileName
unsigned int m_PreScaleColumn
std::vector< int > m_initialTriggerMaskVetoAlgoTrig
std::vector< std::vector< int > > m_initialPrescaleFactorsAlgoTrig
std::vector< unsigned int > m_initialTriggerMaskAlgoTrig
#define LogTrace(id)
int col
Definition: cuy.py:1008
double split
Definition: MVATrainer.cc:139
tuple size
Write out results.
unsigned int m_numberPhysTriggers
const std::vector<std::pair<std::string, bool> >& l1t::L1TGlobalUtil::masks ( )
inline

Definition at line 155 of file L1TGlobalUtil.h.

References m_masks.

155 { return m_masks; }
std::vector< std::pair< std::string, bool > > m_masks
void l1t::L1TGlobalUtil::OverridePrescalesAndMasks ( std::string  filename,
unsigned int  psColumn = 1 
)

Definition at line 62 of file L1TGlobalUtil.cc.

References validate-o2o-wbm::f1, and edm::FileInPath::fullPath().

62  {
63  edm::FileInPath f1("L1Trigger/L1TGlobal/data/Luminosity/startup/" + filename);
64  m_preScaleFileName = f1.fullPath();
65  m_PreScaleColumn = psColumn;
66 }
std::string m_preScaleFileName
unsigned int m_PreScaleColumn
tuple filename
Definition: lut2db_cfg.py:20
unsigned int l1t::L1TGlobalUtil::prescaleColumn ( ) const
inline

Definition at line 164 of file L1TGlobalUtil.h.

References m_PreScaleColumn.

Referenced by HLTPrescaleProvider::prescaleSet().

164 {return m_PreScaleColumn;}
unsigned int m_PreScaleColumn
const std::vector<std::pair<std::string, int> >& l1t::L1TGlobalUtil::prescales ( )
inline

Definition at line 152 of file L1TGlobalUtil.h.

References m_prescales.

152 { return m_prescales; }
std::vector< std::pair< std::string, int > > m_prescales
void l1t::L1TGlobalUtil::resetDecisionVectors ( )
private

clear decision vectors on a menu change

Definition at line 385 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, and edm::second().

385  {
386 
387  // Reset all the vector contents with null information
388  m_decisionsInitial.clear();
390  m_decisionsInterm.clear();
392  m_decisionsFinal.clear();
394 
395 
396  for(unsigned int algBit = 0; algBit< m_numberPhysTriggers; algBit++) {
397 
398  (m_decisionsInitial[algBit]).first = "NULL";
399  (m_decisionsInitial[algBit]).second = false;
400 
401  (m_decisionsInterm[algBit]).first = "NULL";
402  (m_decisionsInterm[algBit]).second = false;
403 
404  (m_decisionsFinal[algBit]).first = "NULL";
405  (m_decisionsFinal[algBit]).second = false;
406 
407  }
408 
409 
410 }
std::vector< std::pair< std::string, bool > > m_decisionsInitial
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, bool > > m_decisionsInterm
std::vector< std::pair< std::string, bool > > m_decisionsFinal
unsigned int m_numberPhysTriggers
void l1t::L1TGlobalUtil::resetMaskVectors ( )
private

Definition at line 427 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, and edm::second().

427  {
428 
429  // Reset all the vector contents with null information
430  m_masks.clear();
432  m_vetoMasks.clear();
434 
435  for(unsigned int algBit = 0; algBit< m_numberPhysTriggers; algBit++) {
436 
437  (m_masks[algBit]).first = "NULL";
438  (m_masks[algBit]).second = true;
439 
440  (m_vetoMasks[algBit]).first = "NULL";
441  (m_vetoMasks[algBit]).second = false;
442 
443  }
444 
445 }
std::vector< std::pair< std::string, bool > > m_masks
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, bool > > m_vetoMasks
unsigned int m_numberPhysTriggers
void l1t::L1TGlobalUtil::resetPrescaleVectors ( )
private

Definition at line 412 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, and edm::second().

412  {
413 
414  // Reset all the vector contents with null information
415  m_prescales.clear();
417 
418  for(unsigned int algBit = 0; algBit< m_numberPhysTriggers; algBit++) {
419 
420  (m_prescales[algBit]).first = "NULL";
421  (m_prescales[algBit]).second = 1;
422 
423  }
424 
425 }
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, int > > m_prescales
unsigned int m_numberPhysTriggers
void l1t::L1TGlobalUtil::retrieveL1 ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)

initialize the class (mainly reserve)

Definition at line 68 of file L1TGlobalUtil.cc.

68  {
69  // typically, the L1T menu and prescale table (may change only between Runs)
70  retrieveL1Setup(evSetup);
71  // typically the prescale set index used and the event by event accept/reject info (changes between Events)
72  retrieveL1Event(iEvent,evSetup);
73 }
void retrieveL1Event(const edm::Event &iEvent, const edm::EventSetup &evSetup)
void retrieveL1Setup(const edm::EventSetup &evSetup)
void l1t::L1TGlobalUtil::retrieveL1 ( const edm::Event iEvent,
const edm::EventSetup evSetup,
edm::EDGetToken  gtAlgToken 
)

Definition at line 75 of file L1TGlobalUtil.cc.

76  {
77  // typically, the L1T menu and prescale table (may change only between Runs)
78  retrieveL1Setup(evSetup);
79  // typically the prescale set index used and the event by event accept/reject info (changes between Events)
80  retrieveL1Event(iEvent,evSetup,gtAlgToken);
81 }
void retrieveL1Event(const edm::Event &iEvent, const edm::EventSetup &evSetup)
void retrieveL1Setup(const edm::EventSetup &evSetup)
void l1t::L1TGlobalUtil::retrieveL1Event ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)

Definition at line 180 of file L1TGlobalUtil.cc.

Referenced by HLTPrescaleProvider::prescaleSet(), HLTPrescaleProvider::prescaleValues(), and HLTPrescaleProvider::prescaleValuesInDetail().

180  {
181  retrieveL1Event(iEvent, evSetup, m_l1tGlobalUtilHelper->l1tAlgBlkToken());
182 }
void retrieveL1Event(const edm::Event &iEvent, const edm::EventSetup &evSetup)
std::unique_ptr< L1TGlobalUtilHelper > m_l1tGlobalUtilHelper
void l1t::L1TGlobalUtil::retrieveL1Event ( const edm::Event iEvent,
const edm::EventSetup evSetup,
edm::EDGetToken  gtAlgToken 
)

Definition at line 184 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, edm::Event::getByToken(), edm::second(), and AlCaHLTBitMon_QueryRunRegistry::string.

185  {
186 
187 // Get the Global Trigger Output Algorithm block
188  iEvent.getByToken(gtAlgToken,m_uGtAlgBlk);
189  m_finalOR = false;
190 
191  //Make sure we have a valid AlgBlk
192  if(m_uGtAlgBlk.isValid()) {
193  // get the GlabalAlgBlk (Stupid find better way) of BX=0
194  std::vector<GlobalAlgBlk>::const_iterator algBlk = m_uGtAlgBlk->begin(0);
195  if (algBlk != m_uGtAlgBlk->end(0)){
196  m_PreScaleColumn = static_cast<unsigned int>(algBlk->getPreScColumn());
197  // Grab the final OR from the AlgBlk,
198  m_finalOR = algBlk->getFinalOR();
199 
200  // Make a map of the trigger name and whether it passed various stages (initial,prescale,final)
201  // Note: might be able to improve performance by not full remaking map with names each time
202  for (std::map<std::string, L1TUtmAlgorithm>::const_iterator itAlgo = m_algorithmMap->begin(); itAlgo != m_algorithmMap->end(); itAlgo++) {
203 
204  // Get the algorithm name
205  std::string algName = itAlgo->first;
206  int algBit = (itAlgo->second).getIndex(); //algoBitNumber();
207 
208  bool decisionInitial = algBlk->getAlgoDecisionInitial(algBit);
209  (m_decisionsInitial[algBit]).first = algName;
210  (m_decisionsInitial[algBit]).second = decisionInitial;
211 
212  bool decisionInterm = algBlk->getAlgoDecisionInterm(algBit);
213  (m_decisionsInterm[algBit]).first = algName;
214  (m_decisionsInterm[algBit]).second = decisionInterm;
215 
216  bool decisionFinal = algBlk->getAlgoDecisionFinal(algBit);
217  (m_decisionsFinal[algBit]).first = algName;
218  (m_decisionsFinal[algBit]).second = decisionFinal;
219  }
220  } else {
221  //cout << "Error empty AlgBlk recovered.\n";
222  }
223  } else {
224  //cout<< "Error no valid uGT Algorithm Data with Token provided " << endl;
225  }
226 }
const_iterator end(int bx) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
unsigned int m_PreScaleColumn
std::vector< std::pair< std::string, bool > > m_decisionsInitial
const std::map< std::string, L1TUtmAlgorithm > * m_algorithmMap
U second(std::pair< T, U > const &p)
bool isValid() const
Definition: HandleBase.h:75
std::vector< std::pair< std::string, bool > > m_decisionsInterm
std::vector< std::pair< std::string, bool > > m_decisionsFinal
edm::Handle< BXVector< GlobalAlgBlk > > m_uGtAlgBlk
const_iterator begin(int bx) const
void l1t::L1TGlobalUtil::retrieveL1Setup ( const edm::EventSetup evSetup)

Definition at line 83 of file L1TGlobalUtil.cc.

References plotBeamSpotDB::first, edm::EventSetup::get(), LogDebug, LogTrace, edm::ESHandle< class >::product(), l1t::PrescalesVetosHelper::readFromEventSetup(), edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by HLTPrescaleProvider::init().

83  {
84 
85  // get / update the trigger menu from the EventSetup
86  // local cache & check on cacheIdentifier
87  unsigned long long l1GtMenuCacheID = evSetup.get<L1TUtmTriggerMenuRcd>().cacheIdentifier();
88 
89  if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
90 
92  evSetup.get< L1TUtmTriggerMenuRcd>().get(l1GtMenu) ;
93  m_l1GtMenu = l1GtMenu.product();
94 
95  //std::cout << "Attempting to fill the map " << std::endl;
97 
98  //reset vectors since we have new menu
100 
101  m_l1GtMenuCacheID = l1GtMenuCacheID;
102  }
103 
104  // Fill the mask and prescales (dummy for now)
105  if(!m_filledPrescales) {
106 
107  // clear and dimension
110 
111  // Only get event record if not unprescaled and not unmasked
113  unsigned long long l1GtPfAlgoCacheID = evSetup.get<L1TGlobalPrescalesVetosRcd>().cacheIdentifier();
114 
115  if (m_l1GtPfAlgoCacheID != l1GtPfAlgoCacheID) {
116  edm::ESHandle< L1TGlobalPrescalesVetos > l1GtPrescalesVetoes;
117  evSetup.get< L1TGlobalPrescalesVetosRcd >().get( l1GtPrescalesVetoes );
118  const L1TGlobalPrescalesVetos * es = l1GtPrescalesVetoes.product();
120 
123 
124  m_l1GtPfAlgoCacheID = l1GtPfAlgoCacheID;
125  }
126  } else {
127  //Load the full prescale set for use
129 
130  // Set Prescale factors to initial
134  }
135 
136  //Pick which set we are using
138  LogTrace("l1t|Global")
139  << "\nNo Prescale Set: " << m_PreScaleColumn
140  << "\nMax Prescale Set value : " << m_prescaleFactorsAlgoTrig->size()
141  << "\nSetting prescale column to 1"
142  << std::endl;
143  m_PreScaleColumn = 1;
144  }
145  LogDebug("l1t|Global") << "Grabing prescale column "<< m_PreScaleColumn << endl;
146  const std::vector<int>& prescaleSet = (*m_prescaleFactorsAlgoTrig)[m_PreScaleColumn-1];
147 
148  // If masks or prescales enabled, get mask decision from prescale column
150  // For now, set masks according to prescale value of 0
152  for( unsigned int iAlgo=0; iAlgo < prescaleSet.size(); iAlgo++ ){
153  unsigned int value = prescaleSet[iAlgo];
154  value = ( value==0 ) ? 0 : 1;
155  m_initialTriggerMaskAlgoTrig.push_back(value);
156  }
158  }
159 
160  for (std::map<std::string, L1TUtmAlgorithm>::const_iterator itAlgo = m_algorithmMap->begin(); itAlgo != m_algorithmMap->end(); itAlgo++) {
161 
162  // Get the algorithm name
163  std::string algName = itAlgo->first;
164  int algBit = (itAlgo->second).getIndex(); //algoBitNumber();
165 
166  (m_prescales[algBit]).first = algName;
167  (m_prescales[algBit]).second = prescaleSet[algBit];
168 
169  (m_masks[algBit]).first = algName;
170  (m_masks[algBit]).second = (*m_triggerMaskAlgoTrig)[algBit];
171 
172  (m_vetoMasks[algBit]).first = algName;
173  (m_vetoMasks[algBit]).second = (*m_triggerMaskVetoAlgoTrig)[algBit];
174  }
175 
176  m_filledPrescales = true;
177  }
178 }
#define LogDebug(id)
const L1TUtmTriggerMenu * m_l1GtMenu
const std::vector< std::vector< int > > & prescaleTable() const
bool m_algorithmTriggersUnmasked
unsigned long long m_l1GtPfAlgoCacheID
unsigned int m_PreScaleColumn
std::vector< int > m_initialTriggerMaskVetoAlgoTrig
std::vector< std::vector< int > > m_initialPrescaleFactorsAlgoTrig
void resetDecisionVectors()
clear decision vectors on a menu change
std::vector< std::pair< std::string, bool > > m_masks
std::vector< unsigned int > m_initialTriggerMaskAlgoTrig
const std::map< std::string, L1TUtmAlgorithm > * m_algorithmMap
U second(std::pair< T, U > const &p)
static const PrescalesVetosHelper * readFromEventSetup(const L1TGlobalPrescalesVetos *es)
const std::vector< int > * m_triggerMaskVetoAlgoTrig
const std::vector< int > & triggerMaskVeto() const
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
std::vector< std::pair< std::string, bool > > m_vetoMasks
#define LogTrace(id)
unsigned long long m_l1GtMenuCacheID
const T & get() const
Definition: EventSetup.h:56
const l1t::PrescalesVetosHelper * m_l1GtPrescalesVetoes
T const * product() const
Definition: ESHandle.h:86
const std::map< std::string, L1TUtmAlgorithm > & getAlgorithmMap() const
bool m_algorithmTriggersUnprescaled
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
std::vector< std::pair< std::string, int > > m_prescales
void l1t::L1TGlobalUtil::setUnprescaledUnmasked ( const bool  unprescale,
const bool  unmask 
)
inline

Definition at line 98 of file L1TGlobalUtil.h.

References m_algorithmTriggersUnmasked, and m_algorithmTriggersUnprescaled.

98  {
99  m_algorithmTriggersUnprescaled = unprescale;
101  }
bool m_algorithmTriggersUnmasked
bool m_algorithmTriggersUnprescaled
void l1t::L1TGlobalUtil::setVerbosity ( const int  verbosity)
inline

Definition at line 103 of file L1TGlobalUtil.h.

References m_verbosity, and HLT_25ns10e33_v2_cff::verbosity.

103  {
105  }
int m_verbosity
verbosity level
const std::vector<std::pair<std::string, bool> >& l1t::L1TGlobalUtil::vetoMasks ( )
inline

Definition at line 156 of file L1TGlobalUtil.h.

References m_vetoMasks.

156 { return m_vetoMasks; }
std::vector< std::pair< std::string, bool > > m_vetoMasks

Member Data Documentation

const std::map<std::string, L1TUtmAlgorithm>* l1t::L1TGlobalUtil::m_algorithmMap
private

Definition at line 194 of file L1TGlobalUtil.h.

bool l1t::L1TGlobalUtil::m_algorithmTriggersUnmasked
private

Definition at line 187 of file L1TGlobalUtil.h.

Referenced by L1TGlobalUtil(), and setUnprescaledUnmasked().

bool l1t::L1TGlobalUtil::m_algorithmTriggersUnprescaled
private

Definition at line 186 of file L1TGlobalUtil.h.

Referenced by L1TGlobalUtil(), and setUnprescaledUnmasked().

std::vector<std::pair<std::string, bool> > l1t::L1TGlobalUtil::m_decisionsFinal
private

Definition at line 219 of file L1TGlobalUtil.h.

Referenced by decisionsFinal().

std::vector<std::pair<std::string, bool> > l1t::L1TGlobalUtil::m_decisionsInitial
private

Definition at line 217 of file L1TGlobalUtil.h.

Referenced by decisionsInitial().

std::vector<std::pair<std::string, bool> > l1t::L1TGlobalUtil::m_decisionsInterm
private

Definition at line 218 of file L1TGlobalUtil.h.

Referenced by decisionsInterm().

bool l1t::L1TGlobalUtil::m_filledPrescales
private

Definition at line 190 of file L1TGlobalUtil.h.

Referenced by L1TGlobalUtil().

bool l1t::L1TGlobalUtil::m_finalOR
private

Definition at line 214 of file L1TGlobalUtil.h.

Referenced by getFinalOR().

std::vector<std::vector<int> > l1t::L1TGlobalUtil::m_initialPrescaleFactorsAlgoTrig
private

Definition at line 203 of file L1TGlobalUtil.h.

std::vector<unsigned int> l1t::L1TGlobalUtil::m_initialTriggerMaskAlgoTrig
private

Definition at line 205 of file L1TGlobalUtil.h.

std::vector<int> l1t::L1TGlobalUtil::m_initialTriggerMaskVetoAlgoTrig
private

Definition at line 207 of file L1TGlobalUtil.h.

const L1TUtmTriggerMenu* l1t::L1TGlobalUtil::m_l1GtMenu
private

Definition at line 177 of file L1TGlobalUtil.h.

Referenced by gtTriggerMenuComment(), gtTriggerMenuName(), and gtTriggerMenuVersion().

unsigned long long l1t::L1TGlobalUtil::m_l1GtMenuCacheID
private

Definition at line 178 of file L1TGlobalUtil.h.

Referenced by L1TGlobalUtil().

unsigned long long l1t::L1TGlobalUtil::m_l1GtPfAlgoCacheID
private

Definition at line 183 of file L1TGlobalUtil.h.

Referenced by L1TGlobalUtil().

const l1t::PrescalesVetosHelper* l1t::L1TGlobalUtil::m_l1GtPrescalesVetoes
private

Definition at line 182 of file L1TGlobalUtil.h.

std::unique_ptr<L1TGlobalUtilHelper> l1t::L1TGlobalUtil::m_l1tGlobalUtilHelper
private

Definition at line 227 of file L1TGlobalUtil.h.

Referenced by L1TGlobalUtil().

std::vector<std::pair<std::string, bool> > l1t::L1TGlobalUtil::m_masks
private

Definition at line 221 of file L1TGlobalUtil.h.

Referenced by masks().

unsigned int l1t::L1TGlobalUtil::m_numberPhysTriggers
private

Definition at line 197 of file L1TGlobalUtil.h.

Referenced by L1TGlobalUtil().

unsigned int l1t::L1TGlobalUtil::m_PreScaleColumn
private

Definition at line 201 of file L1TGlobalUtil.h.

Referenced by L1TGlobalUtil(), and prescaleColumn().

const std::vector<std::vector<int> >* l1t::L1TGlobalUtil::m_prescaleFactorsAlgoTrig
private

Definition at line 204 of file L1TGlobalUtil.h.

std::string l1t::L1TGlobalUtil::m_preScaleFileName
private

Definition at line 200 of file L1TGlobalUtil.h.

Referenced by L1TGlobalUtil().

std::vector<std::pair<std::string, int> > l1t::L1TGlobalUtil::m_prescales
private

Definition at line 220 of file L1TGlobalUtil.h.

Referenced by prescales().

const std::vector<unsigned int>* l1t::L1TGlobalUtil::m_triggerMaskAlgoTrig
private

Definition at line 206 of file L1TGlobalUtil.h.

const std::vector<int>* l1t::L1TGlobalUtil::m_triggerMaskVetoAlgoTrig
private

Definition at line 208 of file L1TGlobalUtil.h.

edm::Handle<BXVector<GlobalAlgBlk> > l1t::L1TGlobalUtil::m_uGtAlgBlk
private

Definition at line 211 of file L1TGlobalUtil.h.

int l1t::L1TGlobalUtil::m_verbosity
private

verbosity level

Definition at line 225 of file L1TGlobalUtil.h.

Referenced by setVerbosity().

std::vector<std::pair<std::string, bool> > l1t::L1TGlobalUtil::m_vetoMasks
private

Definition at line 222 of file L1TGlobalUtil.h.

Referenced by vetoMasks().