CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HLTSeedL1LogicScalers Class Reference

#include <DQM/HLTSeedL1LogicScalers/src/HLTSeedL1LogicScalers.cc>

Inheritance diagram for HLTSeedL1LogicScalers:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HLTSeedL1LogicScalers (const edm::ParameterSet &)
 
 ~HLTSeedL1LogicScalers ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
bool analyzeL1GtRecord (const edm::Event &, const edm::EventSetup &, std::string)
 
bool analyzeL1GtUtils (const edm::Event &, const edm::EventSetup &, const std::string &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &run, const edm::EventSetup &c)
 
virtual void endJob ()
 

Private Attributes

DQMStorefDbe
 
std::string fDQMFolder
 
HLTConfigProvider fHLTConfig
 
bool fL1BeforeMask
 
edm::InputTag fL1GtDaqReadoutRecordInputTag
 
edm::InputTag fL1GtRecordInputTag
 
std::vector< std::pair
< MonitorElement
*, std::vector< std::string > > > 
fMapMEL1Algos
 
std::vector< std::string > fMonitorPaths
 
std::vector< MonitorElement * > fMonitorPathsME
 
std::string fProcessname
 
L1GtUtils m_l1GtUtils
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 49 of file HLTSeedL1LogicScalers.h.

Constructor & Destructor Documentation

HLTSeedL1LogicScalers::HLTSeedL1LogicScalers ( const edm::ParameterSet iConfig)
explicit

Definition at line 30 of file HLTSeedL1LogicScalers.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, cppFunctionSkipper::operator, and AlCaHLTBitMon_QueryRunRegistry::string.

32 {
33  //now do what ever initialization is needed
34  LogDebug("HLTSeedL1LogicScalers") << "constructor" ;
35 
36  // get untracked parameters
38  fL1BeforeMask = iConfig.getParameter<bool>("l1BeforeMask");
39  fProcessname = iConfig.getParameter<std::string>("processname");
40 
41  // input tag for GT DAQ product
42  fL1GtDaqReadoutRecordInputTag = iConfig.getParameter<edm::InputTag>("L1GtDaqReadoutRecordInputTag");
43 
44  // input tag for GT lite product
45  fL1GtRecordInputTag = iConfig.getParameter<edm::InputTag>("L1GtRecordInputTag");
46 
47  // get untracked parameters
49  fDQMFolder = iConfig.getUntrackedParameter("DQMFolder", string("HLT/HLTSeedL1LogicScalers/HLT_LogicL1"));
50  fMonitorPaths = iConfig.getUntrackedParameter<std::vector<std::string > >("monitorPaths");
51 
53 
54  if ( ! fDbe ) {
55  LogInfo("HLTSeedL1LogicScalers") << "unable to get DQMStore service?";
56  }
57  else {
58  fDbe->setCurrentFolder(fDQMFolder);
59  }
60 
61 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag fL1GtDaqReadoutRecordInputTag
std::vector< std::string > fMonitorPaths
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
HLTSeedL1LogicScalers::~HLTSeedL1LogicScalers ( )

Definition at line 64 of file HLTSeedL1LogicScalers.cc.

65 {
66 }

Member Function Documentation

void HLTSeedL1LogicScalers::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 69 of file HLTSeedL1LogicScalers.cc.

References MonitorElement::Fill(), MonitorElement::getName(), i, j, LogDebug, and LogTrace.

70 {
71 
72  LogDebug("HLTSeedL1LogicScalers") << "HLTSeedL1LogicScalers::analyze event " ;
73 
74  // before accessing any result from L1GtUtils, one must retrieve and cache
75  // the L1 trigger event setup
76  // add this call in the analyze / produce / filter method of your
77  // analyzer / producer / filter
78 
80 
81  // loop over maps of ME-L1Algos
82  for (unsigned int i=0;i<fMapMEL1Algos.size();i++) {
83 
84  MonitorElement* me = fMapMEL1Algos[i].first;
85  LogTrace("HLTSeedL1LogicScalers") << "ME = " << me->getName() << endl;
86 
87  const vector<string>& l1Algos = fMapMEL1Algos[i].second;
88 
89  // word to bit-pack decisions of l1Algos
90  unsigned int myL1Word = 0;
91 
92  // loop over l1Algos
93  for (unsigned int j=0;j<l1Algos.size();j++) {
94 
95  // check if this l1Algo passed
96  bool l1Pass = analyzeL1GtUtils(iEvent, iSetup, l1Algos[j]);
97  LogTrace("HLTSeedL1LogicScalers") << "l1Algo = " << l1Algos[j] << " l1Pass = " << l1Pass << endl;
98  if(l1Pass) {
99 
100  // bit-wise pack
101  myL1Word |= (1<<j);
102 
103  }
104 /*
105 */
106 
107  }
108 
109  me->Fill(myL1Word);
110 
111  } // end for i maps
112 
113 }
#define LogDebug(id)
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
bool analyzeL1GtUtils(const edm::Event &, const edm::EventSetup &, const std::string &)
std::vector< std::pair< MonitorElement *, std::vector< std::string > > > fMapMEL1Algos
void Fill(long long x)
int j
Definition: DBlmapReader.cc:9
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:111
#define LogTrace(id)
bool HLTSeedL1LogicScalers::analyzeL1GtRecord ( const edm::Event ,
const edm::EventSetup ,
std::string   
)
private

Definition at line 305 of file HLTSeedL1LogicScalers.cc.

References LogTrace.

306 {
307  LogTrace("HLTSeedL1LogicScalers") << "analyzeL1GtRecord.. " << endl;
308 /*
309  edm::Handle<L1GtTriggerMenu> menuRcd;
310  evSetup.get<L1GtTriggerMenuRcd>().get(menuRcd) ;
311  const L1GtTriggerMenu* menu = menuRcd.product();
312 
313  edm::Handle< L1GlobalTriggerReadoutRecord > gtReadoutRecord;
314  iEvent.getByLabel( edm::InputTag("gtDigis"), gtReadoutRecord);
315  const DecisionWord& gtDecisionWordBeforeMask = = gtReadoutRecord->decisionWord();
316 
317  // test if the algorithm name is in the menu
318 
319  const AlgorithmMap& algorithmMap = menu->gtAlgorithmMap();
320  CItAlgo itAlgo = algorithmMap.find(l1AlgoName);
321  if (itAlgo != algorithmAliasMap.end()) {
322  bool l1Result = menu->gtAlgorithmResult( l1AlgoName, gtDecisionWordBeforeMask);
323  return l1Result;
324  } else {
325  // algorithm not in the L1 menu - do whatever needed
326  return false;
327  }
328 */
329  return false;
330 
331 }
#define LogTrace(id)
bool HLTSeedL1LogicScalers::analyzeL1GtUtils ( const edm::Event ,
const edm::EventSetup ,
const std::string &   
)
private

Definition at line 254 of file HLTSeedL1LogicScalers.cc.

References LogTrace.

255 {
256 
257  LogTrace("HLTSeedL1LogicScalers") << "analyzeL1GtUtils..." << endl;
258 
259  // access L1 trigger results using public methods from L1GtUtils
260  // always check on error code returned by that method
261 
262  int iErrorCode = -1;
263 
264 
265  LogTrace("HLTSeedL1LogicScalers") << "l1AlgoName = " << l1AlgoName << endl;
266 
267  bool decisionAlgTechTrig = false;
268 
269  // check flag L1BeforeMask
270  if (fL1BeforeMask) {
271 
272  decisionAlgTechTrig = m_l1GtUtils.decisionBeforeMask(iEvent, fL1GtRecordInputTag, fL1GtDaqReadoutRecordInputTag, l1AlgoName, iErrorCode);
273 
274  }
275  else {
276 
277  decisionAlgTechTrig = m_l1GtUtils.decisionAfterMask(iEvent, fL1GtRecordInputTag, fL1GtDaqReadoutRecordInputTag, l1AlgoName, iErrorCode);
278 
279  }
280 
281  LogTrace("HLTSeedL1LogicScalers") << "bool L1BeforeMask = " << fL1BeforeMask << " decisionAlgTechTrig = " << decisionAlgTechTrig << endl;
282 
283  if (iErrorCode == 0) {
284 
285  return decisionAlgTechTrig;
286 
287  } else if (iErrorCode == 1) {
288 
289  // algorithm / technical trigger does not exist in the L1 menu
290  LogWarning("HLTSeedL1LogicScalers") << "L1 algorithm " << l1AlgoName << " not in L1 menu, but HLTConfigProvider found it in L1SeedsLogicalExpression of at least one HLT path of the HLT menu." << endl;
291  return false;
292 
293  } else {
294 
295  // error - see error code
296  // do whatever needed
297  return false;
298 
299  }
300 
301  return false;
302 
303 }
const bool decisionAfterMask(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision after trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1411
const bool decisionBeforeMask(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision before trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1374
int iEvent
Definition: GenABIO.cc:243
#define LogTrace(id)
edm::InputTag fL1GtDaqReadoutRecordInputTag
void HLTSeedL1LogicScalers::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 245 of file HLTSeedL1LogicScalers.cc.

246 {
247 }
void HLTSeedL1LogicScalers::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file HLTSeedL1LogicScalers.cc.

References edm::first(), edm::RunBase::id(), j, gen::k, LogDebug, LogTrace, n, mergeVDriftHistosByStation::name, edm::second(), MonitorElement::setAxisTitle(), and indexGen::title.

119 {
120 
121  // Get configuration of HLT menu used in this run
122  LogTrace("HLTSeedL1LogicScalers") << "beginRun, run " << run.id();
124 
125  // HLT config does not change within runs!
126 
127  bool changed = false;
128 
129  if (!fHLTConfig.init(run, iSetup, fProcessname, changed)) {
130 
131  LogDebug("HLTSeedL1LogicScalers") << "HLTConfigProvider failed to initialize.";
132  return;
133 
134  // check if trigger name in (new) config
135  // cout << "Available TriggerNames are: " << endl;
136  // fHLTConfig.dump("Triggers");
137 
138  }
139 
140  const unsigned int n(fHLTConfig.size());
141 
142  for (unsigned int j=0; j!=n; ++j) {
143 
144  LogTrace("HLTSeedL1LogicScalers") << "HLTConfig path " << fHLTConfig.triggerName(j) << endl;
145 
146  }
147 
148  // book histos for L1 logic of specificified HLT paths
149  LogTrace("HLTSeedL1LogicScalers") << "size of vector of paths to monitor = " << fMonitorPaths.size() << endl;
150  for (unsigned int iPath=0;iPath<fMonitorPaths.size();iPath++) {
151 
152  string monPath = fMonitorPaths[iPath];
153  LogTrace("HLTSeedL1LogicScalers") << "monPath = " << monPath << endl;
154 
155  string folderName = fDQMFolder + "/" + monPath;
156  fDbe->setCurrentFolder(folderName);
157 
158  // do nothing if monPath is not in the HLT menu
159  if(fHLTConfig.triggerIndex(monPath) == fHLTConfig.size()) continue;
160  // get L1SeedLogicalExpression of this path
161  vector<pair<bool,string> > hltL1GTSeed = fHLTConfig.hltL1GTSeeds(monPath);
162  LogTrace("HLTSeedL1LogicScalers") << endl << "size of vector of GTSeedL1LogicalExpression = " << hltL1GTSeed.size() << endl;
163 
164  // each GT Seed of each path contains l1Algos
165  for (unsigned int iSeed=0;iSeed<hltL1GTSeed.size();iSeed++) {
166 
167  LogTrace("HLTSeedL1LogicScalers") << " TechBit_flag = " << hltL1GTSeed[iSeed].first << " GTSeedL1LogicalExpression = " << hltL1GTSeed[iSeed].second << endl;;
168 
169  istringstream totalSString( hltL1GTSeed[iSeed].second );
170  string temp_string;
171 
172  vector<string> l1Algos;
173 
174  // only if not TechBit flag
175  while(! hltL1GTSeed[iSeed].first) {
176 
177  totalSString >> temp_string;
178 
179  if(! l1Algos.empty()) {
180 
181  if(temp_string.compare(l1Algos.back()) == 0) break;
182 
183  }
184  if(temp_string != "OR" && temp_string != "AND" && temp_string != "NOT" && temp_string != "(" && temp_string != ")" && temp_string != ""){
185 
186  l1Algos.push_back(temp_string);
187 
188  }
189  }
190 
191  int nL1Algo = l1Algos.size();
192 
193  // put an upper limit on the size of l1Algos
194  if(nL1Algo > 32) {
195 
196  LogWarning("HLTSeedL1LogicScalers") << " number of l1 Algos grater than 32. Using only the first 32." << endl ;
197  l1Algos.resize(32);
198 
199  }
200  int nBins = 1 << nL1Algo;
201 
202  for (unsigned int k=0;k< l1Algos.size();k++) {
203 
204  LogTrace("HLTSeedL1LogicScalers") << " l1 Algo = " << l1Algos[k] << endl;
205 
206 
207  } // end for k
208 
209  //char title[100];
210  //char name[100];
211 
212  std::stringstream title;
213  std::stringstream name;
214 
215  name << monPath << "_Seed_" << iSeed << "_L1BitLogic";
216  title << monPath << " BitPacked L1Algos of GTSeed " << iSeed << ": '" << hltL1GTSeed[iSeed].second << "'";
217 
218  //sprintf(name,"%s_Seed_%d_L1BitLogic",monPath.c_str(),iSeed);
219  //sprintf(title,"%s BitPacked L1Algos of GTSeed %d: '%s'",monPath.c_str(), iSeed, hltL1GTSeed[iSeed].second.c_str());
220 
221  LogTrace("HLTSeedL1LogicScalers") << " MonitorElement name = " << name << endl;
222  LogTrace("HLTSeedL1LogicScalers") << " MonitorElement title = " << title << endl;
223  LogTrace("HLTSeedL1LogicScalers") << " MonitorElement nBins = " << nBins << endl << endl;
224 
225  MonitorElement* me = fDbe->book1D(name.str().c_str(), title.str().c_str(), nBins,0,nBins);
226  me->setAxisTitle("bit-packed word L1 Algorithms");
227  fMonitorPathsME.push_back(me);
228 
229  // pair of 1D hisotgram and vector of l1Algos
230  //pair<MonitorElement*, vector<string> > pairMEL1Algo;
231  //pairMEL1Algo.first = me;
232  //pairMEL1Algo.second = l1Algos;
233  //fMapMEL1Algos.push_back(pairMEL1Algo);
234  fMapMEL1Algos.push_back(make_pair(me, l1Algos));
235 
236  } // end for Seeds
237 
238 
239 
240  } // end for monitoring paths
241 
242 }
#define LogDebug(id)
unsigned int size() const
number of trigger paths in trigger table
RunID const & id() const
Definition: RunBase.h:41
const std::string & triggerName(unsigned int triggerIndex) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
std::vector< std::pair< MonitorElement *, std::vector< std::string > > > fMapMEL1Algos
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
U second(std::pair< T, U > const &p)
int j
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:79
#define LogTrace(id)
int k[5][pyjets_maxn]
HLTConfigProvider fHLTConfig
std::vector< std::string > fMonitorPaths
std::vector< MonitorElement * > fMonitorPathsME
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void HLTSeedL1LogicScalers::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 251 of file HLTSeedL1LogicScalers.cc.

251  {
252 }

Member Data Documentation

DQMStore* HLTSeedL1LogicScalers::fDbe
private

Definition at line 71 of file HLTSeedL1LogicScalers.h.

std::string HLTSeedL1LogicScalers::fDQMFolder
private

Definition at line 68 of file HLTSeedL1LogicScalers.h.

HLTConfigProvider HLTSeedL1LogicScalers::fHLTConfig
private

Definition at line 75 of file HLTSeedL1LogicScalers.h.

bool HLTSeedL1LogicScalers::fL1BeforeMask
private

Definition at line 67 of file HLTSeedL1LogicScalers.h.

edm::InputTag HLTSeedL1LogicScalers::fL1GtDaqReadoutRecordInputTag
private

Definition at line 82 of file HLTSeedL1LogicScalers.h.

edm::InputTag HLTSeedL1LogicScalers::fL1GtRecordInputTag
private

Definition at line 83 of file HLTSeedL1LogicScalers.h.

std::vector<std::pair<MonitorElement*, std::vector<std::string> > > HLTSeedL1LogicScalers::fMapMEL1Algos
private

Definition at line 88 of file HLTSeedL1LogicScalers.h.

std::vector<std::string> HLTSeedL1LogicScalers::fMonitorPaths
private

Definition at line 86 of file HLTSeedL1LogicScalers.h.

std::vector<MonitorElement*> HLTSeedL1LogicScalers::fMonitorPathsME
private

Definition at line 87 of file HLTSeedL1LogicScalers.h.

std::string HLTSeedL1LogicScalers::fProcessname
private

Definition at line 69 of file HLTSeedL1LogicScalers.h.

L1GtUtils HLTSeedL1LogicScalers::m_l1GtUtils
private

Definition at line 73 of file HLTSeedL1LogicScalers.h.