CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWL1TriggerTableView.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWL1TriggerTableView
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author:
10 // Created: Tue Jan 25 16:02:11 CET 2011
11 // $Id: FWL1TriggerTableView.cc,v 1.16 2011/01/26 11:47:07 amraktad Exp $
12 //
13 
14 #include <boost/regex.hpp>
17 
23 
26 
27 
29  : FWTriggerTableView(iParent, FWViewType::kTableL1)
30 {
31  m_columns[0].title = "Algorithm Name";
32  m_columns.push_back( Column( "Result" ) );
33  m_columns.push_back( Column( "Bit Number" ) );
34  m_columns.push_back( Column( "Prescale" ) );
35 
36  dataChanged();
37 }
38 
39 
40 
42 {
45 
46  try
47  {
48  // FIXME: Replace magic strings with configurable ones
49  triggerMenuLite.getByLabel( event->getRun(), "l1GtTriggerMenuLite", "", "" );
50  triggerRecord.getByLabel( *event, "gtDigis", "", "" );
51  }
52  catch( cms::Exception& )
53  {
54  fwLog( fwlog::kWarning ) << "FWL1TriggerTableView: no L1Trigger menu is available." << std::endl;
55  return;
56  }
57 
58  if( triggerMenuLite.isValid() && triggerRecord.isValid() )
59  {
60  const L1GtTriggerMenuLite::L1TriggerMap& algorithmMap = triggerMenuLite->gtAlgorithmMap();
61 
62  int pfIndexTechTrig = -1;
63  int pfIndexAlgoTrig = -1;
64 
65  boost::regex filter(m_regex.value());
66 
68  std::vector<std::vector<int> > prescaleFactorsAlgoTrig = triggerMenuLite->gtPrescaleFactorsAlgoTrig();
69  std::vector<std::vector<int> > prescaleFactorsTechTrig = triggerMenuLite->gtPrescaleFactorsTechTrig();
70  pfIndexAlgoTrig = ( triggerRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo();
71  pfIndexTechTrig = ( triggerRecord->gtFdlWord()).gtPrescaleFactorIndexTech();
72 
73  int pfIndexTechTrigValidSize = static_cast<int>(prescaleFactorsAlgoTrig.size());
74  if (pfIndexTechTrigValidSize <= pfIndexTechTrig)
75  fwLog( fwlog::kError) << Form("FWL1TriggerTableView: Can't get pre-scale factors. Index [%d] larger that table size [%d]\n", pfIndexTechTrig, (int)prescaleFactorsAlgoTrig.size());
76 
77  const DecisionWord dWord = triggerRecord->decisionWord();
78  for( L1GtTriggerMenuLite::CItL1Trig itTrig = algorithmMap.begin(), itTrigEnd = algorithmMap.end();
79  itTrig != itTrigEnd; ++itTrig )
80  {
81  const unsigned int bitNumber = itTrig->first;
82  const std::string& aName = itTrig->second;
83  int errorCode = 0;
84  const bool result = triggerMenuLite->gtTriggerResult( aName, dWord, errorCode );
85 
86  if ( !boost::regex_search(aName, filter) ) continue;
87 
88  m_columns.at(0).values.push_back( aName );
89  m_columns.at(1).values.push_back( Form( "%d", result ));
90  m_columns.at(2).values.push_back( Form( "%d", bitNumber ));
91 
92  if ( pfIndexTechTrig < pfIndexTechTrigValidSize && static_cast<unsigned int>(prescaleFactorsTechTrig.at(pfIndexTechTrig).size()) >bitNumber )
93  {
94  m_columns.at(3).values.push_back( Form( "%d", prescaleFactorsTechTrig.at( pfIndexTechTrig ).at( bitNumber )));
95  }
96  else
97  m_columns.at(3).values.push_back( "invalid");
98  }
99 
100  const static std::string kTechTriggerName = "TechTrigger";
101  const TechnicalTriggerWord ttWord = triggerRecord->technicalTriggerWord();
102 
103  int tBitNumber = 0;
104  int tBitResult = 0;
105  if(boost::regex_search(kTechTriggerName, filter))
106  {
107  for( TechnicalTriggerWord::const_iterator tBitIt = ttWord.begin(), tBitEnd = ttWord.end();
108  tBitIt != tBitEnd; ++tBitIt, ++tBitNumber )
109  {
110  if( *tBitIt )
111  tBitResult = 1;
112  else
113  tBitResult = 0;
114 
115  m_columns.at(0).values.push_back( kTechTriggerName );
116  m_columns.at(1).values.push_back( Form( "%d", tBitResult ));
117  m_columns.at(2).values.push_back( Form( "%d", tBitNumber ));
118 
119  if ( pfIndexTechTrig < pfIndexTechTrigValidSize && static_cast<int>(prescaleFactorsTechTrig.at(pfIndexTechTrig).size()) > tBitNumber)
120  m_columns.at(3).values.push_back( Form( "%d", prescaleFactorsTechTrig.at( pfIndexTechTrig ).at( tBitNumber )));
121  else
122  m_columns.at(3).values.push_back( Form( "invalid" ));
123  }
124  }
125  } // trigger valid
126  else
127  {
128  m_columns.at(0).values.push_back( "No L1Trigger menu available." );
129  m_columns.at(1).values.push_back( " " );
130  m_columns.at(2).values.push_back( " " );
131  m_columns.at(3).values.push_back( " " );
132  }
133 }
std::vector< Column > m_columns
const TechnicalTriggerWord & technicalTriggerWord(int bxInEventValue) const
bool isValid() const
Definition: Handle.h:58
FWStringParameter m_regex
const std::vector< std::vector< int > > & gtPrescaleFactorsAlgoTrig() const
get the prescale factors by reference / set the prescale factors
fwlite::Run const & getRun() const
Definition: Event.cc:495
std::map< unsigned int, std::string > L1TriggerMap
map containing the physics algorithms or the technical triggers
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
Definition: Handle.h:88
std::vector< bool > DecisionWord
typedefs
tuple result
Definition: query.py:137
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
const bool gtTriggerResult(const std::string &trigName, const std::vector< bool > &decWord, int &errorCode) const
const std::vector< std::vector< int > > & gtPrescaleFactorsTechTrig() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const DecisionWord & decisionWord(int bxInEventValue) const
L1TriggerMap::const_iterator CItL1Trig
iterators through map containing the physics algorithms or the technical triggers ...
tuple filter
USE THIS FOR SKIMMED TRACKS process.p = cms.Path(process.hltLevel1GTSeed*process.skimming*process.offlineBeamSpot*process.TrackRefitter2) OTHERWISE USE THIS.
Definition: align_tpl.py:86
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
#define fwLog(_level_)
Definition: fwLog.h:51
FWL1TriggerTableView(TEveWindowSlot *)
const L1TriggerMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
virtual void fillTable(fwlite::Event *event)