CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HLTSeedL1LogicScalers Class Reference

#include <HLTSeedL1LogicScalers.h>

Inheritance diagram for HLTSeedL1LogicScalers:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

 HLTSeedL1LogicScalers (const edm::ParameterSet &)
 
 ~HLTSeedL1LogicScalers () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
bool analyzeL1GtUtils (const edm::Event &, const edm::EventSetup &, const std::string &)
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &run, const edm::EventSetup &c) override
 

Private Attributes

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
 

Detailed Description

DQM/HLTSeedL1LogicScalers/src/HLTSeedL1LogicScalers.cc

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 46 of file HLTSeedL1LogicScalers.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file HLTSeedL1LogicScalers.cc.

References fDQMFolder, fL1BeforeMask, fMonitorPaths, fProcessname, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, and AlCaHLTBitMon_QueryRunRegistry::string.

17  :
18  fL1GtDaqReadoutRecordInputTag(iConfig.getParameter<edm::InputTag>("L1GtDaqReadoutRecordInputTag")),
19  fL1GtRecordInputTag(iConfig.getParameter<edm::InputTag>("L1GtRecordInputTag")),
20  m_l1GtUtils(iConfig, consumesCollector(), false, *this, fL1GtRecordInputTag, fL1GtDaqReadoutRecordInputTag, edm::InputTag()) {
21  // now do what ever initialization is needed
22  LogDebug("HLTSeedL1LogicScalers") << "constructor";
23 
24  // get untracked parameters
26  fL1BeforeMask = iConfig.getParameter<bool>("l1BeforeMask");
27  fProcessname = iConfig.getParameter<std::string>("processname");
28 
29  // get untracked parameters
31  "DQMFolder", string("HLT/HLTSeedL1LogicScalers/HLT_LogicL1"));
33  iConfig.getUntrackedParameter<std::vector<std::string> >("monitorPaths");
34 }
#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
HLTSeedL1LogicScalers::~HLTSeedL1LogicScalers ( )
override

Definition at line 36 of file HLTSeedL1LogicScalers.cc.

36 {}

Member Function Documentation

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

Definition at line 143 of file HLTSeedL1LogicScalers.cc.

References analyzeL1GtUtils(), MonitorElement::Fill(), fMapMEL1Algos, MonitorElement::getName(), mps_fire::i, LogDebug, LogTrace, m_l1GtUtils, and L1GtUtils::retrieveL1EventSetup().

144  {
145  LogDebug("HLTSeedL1LogicScalers") << "HLTSeedL1LogicScalers::analyze event ";
146 
147  // before accessing any result from L1GtUtils, one must retrieve and cache
148  // the L1 trigger event setup
149  // add this call in the analyze / produce / filter method of your
150  // analyzer / producer / filter
151 
153 
154  // loop over maps of ME-L1Algos
155  for (unsigned int i = 0; i < fMapMEL1Algos.size(); i++) {
156  MonitorElement* me = fMapMEL1Algos[i].first;
157  LogTrace("HLTSeedL1LogicScalers") << "ME = " << me->getName() << endl;
158 
159  const vector<string>& l1Algos = fMapMEL1Algos[i].second;
160 
161  // word to bit-pack decisions of l1Algos
162  unsigned int myL1Word = 0;
163 
164  // loop over l1Algos
165  for (unsigned int j = 0; j < l1Algos.size(); j++) {
166  // check if this l1Algo passed
167  bool l1Pass = analyzeL1GtUtils(iEvent, iSetup, l1Algos[j]);
168  LogTrace("HLTSeedL1LogicScalers") << "l1Algo = " << l1Algos[j]
169  << " l1Pass = " << l1Pass << endl;
170  if (l1Pass) {
171  // bit-wise pack
172  myL1Word |= (1 << j);
173  }
174  }
175  me->Fill(myL1Word);
176  } // end for i maps
177 }
#define LogDebug(id)
bool analyzeL1GtUtils(const edm::Event &, const edm::EventSetup &, const std::string &)
std::vector< std::pair< MonitorElement *, std::vector< std::string > > > fMapMEL1Algos
const std::string & getName() const
get name of ME
void Fill(long long x)
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:121
#define LogTrace(id)
bool HLTSeedL1LogicScalers::analyzeL1GtUtils ( const edm::Event ,
const edm::EventSetup ,
const std::string &   
)
private

Definition at line 179 of file HLTSeedL1LogicScalers.cc.

References L1GtUtils::decisionAfterMask(), L1GtUtils::decisionBeforeMask(), fL1BeforeMask, LogTrace, and m_l1GtUtils.

Referenced by analyze().

181  {
182  LogTrace("HLTSeedL1LogicScalers") << "analyzeL1GtUtils..." << endl;
183 
184  // access L1 trigger results using public methods from L1GtUtils
185  // always check on error code returned by that method
186 
187  int iErrorCode = -1;
188 
189  LogTrace("HLTSeedL1LogicScalers") << "l1AlgoName = " << l1AlgoName << endl;
190 
191  bool decisionAlgTechTrig = false;
192 
193  // check flag L1BeforeMask
194  if (fL1BeforeMask) {
195  decisionAlgTechTrig = m_l1GtUtils.decisionBeforeMask(
196  iEvent, l1AlgoName,
197  iErrorCode);
198  } else {
199  decisionAlgTechTrig = m_l1GtUtils.decisionAfterMask(
200  iEvent, l1AlgoName,
201  iErrorCode);
202  }
203 
204  LogTrace("HLTSeedL1LogicScalers")
205  << "bool L1BeforeMask = " << fL1BeforeMask
206  << " decisionAlgTechTrig = " << decisionAlgTechTrig << endl;
207 
208  if (iErrorCode == 0) {
209  return decisionAlgTechTrig;
210  } else if (iErrorCode == 1) {
211  // algorithm / technical trigger does not exist in the L1 menu
212  LogWarning("HLTSeedL1LogicScalers")
213  << "L1 algorithm " << l1AlgoName
214  << " not in L1 menu, but HLTConfigProvider found it in "
215  "L1SeedsLogicalExpression of at least one HLT path of the HLT menu."
216  << endl;
217  return false;
218  } else {
219  // error - see error code
220  // do whatever needed
221  return false;
222  }
223  return false;
224 }
int iEvent
Definition: GenABIO.cc:224
#define LogTrace(id)
const bool decisionBeforeMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision before trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1178
const bool decisionAfterMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision after trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1193
void HLTSeedL1LogicScalers::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivate

Definition at line 55 of file HLTSeedL1LogicScalers.cc.

References DQMStore::IBooker::book1D(), fDQMFolder, fHLTConfig, plotBeamSpotDB::first, fMapMEL1Algos, fMonitorPaths, fMonitorPathsME, HLTConfigProvider::hltL1GTSeeds(), gen::k, LogTrace, dataset::name, edm::second(), MonitorElement::setAxisTitle(), DQMStore::IBooker::setCurrentFolder(), HLTConfigProvider::size(), runGCPTkAlMap::title, and HLTConfigProvider::triggerIndex().

57  {
58  // book histos for L1 logic of specificified HLT paths
59  LogTrace("HLTSeedL1LogicScalers")
60  << "size of vector of paths to monitor = " << fMonitorPaths.size()
61  << endl;
62  for (unsigned int iPath = 0; iPath < fMonitorPaths.size(); iPath++) {
63  string monPath = fMonitorPaths[iPath];
64  LogTrace("HLTSeedL1LogicScalers") << "monPath = " << monPath << endl;
65 
66  string folderName = fDQMFolder + "/" + monPath;
67  iBooker.setCurrentFolder(folderName);
68 
69  // do nothing if monPath is not in the HLT menu
70  if (fHLTConfig.triggerIndex(monPath) == fHLTConfig.size()) continue;
71  // get L1SeedLogicalExpression of this path
72  vector<pair<bool, string> > hltL1GTSeed = fHLTConfig.hltL1GTSeeds(monPath);
73  LogTrace("HLTSeedL1LogicScalers")
74  << endl << "size of vector of GTSeedL1LogicalExpression = "
75  << hltL1GTSeed.size() << endl;
76 
77  // each GT Seed of each path contains l1Algos
78  for (unsigned int iSeed = 0; iSeed < hltL1GTSeed.size(); iSeed++) {
79  LogTrace("HLTSeedL1LogicScalers")
80  << " TechBit_flag = " << hltL1GTSeed[iSeed].first
81  << " GTSeedL1LogicalExpression = " << hltL1GTSeed[iSeed].second
82  << endl;
83 
84  istringstream totalSString(hltL1GTSeed[iSeed].second);
85  string temp_string;
86 
87  vector<string> l1Algos;
88 
89  // only if not TechBit flag
90  while (!hltL1GTSeed[iSeed].first) {
91  totalSString >> temp_string;
92 
93  if (!l1Algos.empty()) {
94  if (temp_string == l1Algos.back()) break;
95  }
96  if (temp_string != "OR" && temp_string != "AND" &&
97  temp_string != "NOT" && temp_string != "(" && temp_string != ")" &&
98  !temp_string.empty()) {
99  l1Algos.push_back(temp_string);
100  }
101  }
102 
103  int nL1Algo = l1Algos.size();
104 
105  // put an upper limit on the size of l1Algos
106  if (nL1Algo > 32) {
107  LogWarning("HLTSeedL1LogicScalers")
108  << " number of l1 Algos grater than 32. Using only the first 32."
109  << endl;
110  l1Algos.resize(32);
111  }
112  int nBins = 1 << nL1Algo;
113 
114  for (unsigned int k = 0; k < l1Algos.size(); k++) {
115  LogTrace("HLTSeedL1LogicScalers") << " l1 Algo = " << l1Algos[k]
116  << endl;
117  } // end for k
118 
119  std::stringstream title;
120  std::stringstream name;
121 
122  name << monPath << "_Seed_" << iSeed << "_L1BitLogic";
123  title << monPath << " BitPacked L1Algos of GTSeed " << iSeed << ": '"
124  << hltL1GTSeed[iSeed].second << "'";
125 
126  LogTrace("HLTSeedL1LogicScalers") << " MonitorElement name = " << name.str()
127  << endl;
128  LogTrace("HLTSeedL1LogicScalers") << " MonitorElement title = " << title.str()
129  << endl;
130  LogTrace("HLTSeedL1LogicScalers") << " MonitorElement nBins = " << nBins
131  << endl << endl;
132 
133  MonitorElement* me = iBooker.book1D(name.str().c_str(), title.str().c_str(),
134  nBins, 0, nBins);
135  me->setAxisTitle("bit-packed word L1 Algorithms");
136  fMonitorPathsME.push_back(me);
137 
138  fMapMEL1Algos.push_back(make_pair(me, l1Algos));
139  } // end for Seeds
140  } // end for monitoring paths
141 }
unsigned int size() const
number of trigger paths in trigger table
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)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
#define LogTrace(id)
int k[5][pyjets_maxn]
HLTConfigProvider fHLTConfig
std::vector< std::string > fMonitorPaths
std::vector< MonitorElement * > fMonitorPathsME
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void HLTSeedL1LogicScalers::dqmBeginRun ( const edm::Run run,
const edm::EventSetup c 
)
overrideprivate

Definition at line 38 of file HLTSeedL1LogicScalers.cc.

References fHLTConfig, fProcessname, HLTConfigProvider::init(), LogDebug, LogTrace, gen::n, HLTConfigProvider::size(), and HLTConfigProvider::triggerName().

39  {
40  // HLT config does not change within runs!
41  bool changed = false;
42  if (!fHLTConfig.init(run, iSetup, fProcessname, changed)) {
43  LogDebug("HLTSeedL1LogicScalers")
44  << "HLTConfigProvider failed to initialize.";
45  return;
46  }
47 
48  const unsigned int n(fHLTConfig.size());
49  for (unsigned int j = 0; j != n; ++j) {
50  LogTrace("HLTSeedL1LogicScalers") << "HLTConfig path "
51  << fHLTConfig.triggerName(j) << endl;
52  }
53 }
#define LogDebug(id)
unsigned int size() const
number of trigger paths in trigger table
const std::string & triggerName(unsigned int triggerIndex) const
#define LogTrace(id)
HLTConfigProvider fHLTConfig
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor

Member Data Documentation

std::string HLTSeedL1LogicScalers::fDQMFolder
private

Definition at line 62 of file HLTSeedL1LogicScalers.h.

Referenced by bookHistograms(), and HLTSeedL1LogicScalers().

HLTConfigProvider HLTSeedL1LogicScalers::fHLTConfig
private

Definition at line 66 of file HLTSeedL1LogicScalers.h.

Referenced by bookHistograms(), and dqmBeginRun().

bool HLTSeedL1LogicScalers::fL1BeforeMask
private

Definition at line 61 of file HLTSeedL1LogicScalers.h.

Referenced by analyzeL1GtUtils(), and HLTSeedL1LogicScalers().

edm::InputTag HLTSeedL1LogicScalers::fL1GtDaqReadoutRecordInputTag
private

Definition at line 67 of file HLTSeedL1LogicScalers.h.

edm::InputTag HLTSeedL1LogicScalers::fL1GtRecordInputTag
private

Definition at line 68 of file HLTSeedL1LogicScalers.h.

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

Definition at line 74 of file HLTSeedL1LogicScalers.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 71 of file HLTSeedL1LogicScalers.h.

Referenced by bookHistograms(), and HLTSeedL1LogicScalers().

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

Definition at line 72 of file HLTSeedL1LogicScalers.h.

Referenced by bookHistograms().

std::string HLTSeedL1LogicScalers::fProcessname
private

Definition at line 63 of file HLTSeedL1LogicScalers.h.

Referenced by dqmBeginRun(), and HLTSeedL1LogicScalers().

L1GtUtils HLTSeedL1LogicScalers::m_l1GtUtils
private

Definition at line 69 of file HLTSeedL1LogicScalers.h.

Referenced by analyze(), and analyzeL1GtUtils().