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 | Public Attributes
TriggerJSONMonitoring Class Reference

#include <TriggerJSONMonitoring.h>

Inheritance diagram for TriggerJSONMonitoring:
edm::stream::EDAnalyzer< edm::LuminosityBlockSummaryCache< hltJson::lumiVars > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
void beginRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, hltJson::lumiVars *) const
 
void resetLumi ()
 
void resetRun (bool changed)
 
 TriggerJSONMonitoring (const edm::ParameterSet &)
 
void writeDefJson (std::string path)
 
void writeDefLegJson (std::string path)
 
 ~TriggerJSONMonitoring ()
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::LuminosityBlockSummaryCache< hltJson::lumiVars > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static std::shared_ptr
< hltJson::lumiVars
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, hltJson::lumiVars *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Public Attributes

std::string baseRunDir_
 
std::vector< std::vector
< std::string > > 
datasetContents_
 
std::vector< std::string > datasetNames_
 
std::vector< unsigned int > hltAccept_
 
HLTConfigProvider hltConfig_
 
std::vector< unsigned int > hltDatasets_
 
std::vector< unsigned int > hltErrors_
 
std::vector< std::vector
< unsigned int > > 
hltIndex_
 
std::vector< unsigned int > hltL1s_
 
std::vector< std::string > hltNames_
 
std::vector< unsigned int > hltPre_
 
std::vector< unsigned int > hltReject_
 
std::vector< unsigned int > hltWasRun_
 
std::string jsonLegendDefFile_
 
std::string jsonRateDefFile_
 
std::vector< int > posL1s_
 
std::vector< int > posPre_
 
unsigned int processed_
 
edm::InputTag triggerResults_
 
edm::EDGetTokenT
< edm::TriggerResults
triggerResultsToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::LuminosityBlockSummaryCache< hltJson::lumiVars > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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: This class prints JSON files with trigger info.

Created: Wed, 09 Jul 2014

Author
Aram Avetisyan
Daniel Salerno

See header file for documentation

Author
Aram Avetisyan
Daniel Salerno

Definition at line 61 of file TriggerJSONMonitoring.h.

Constructor & Destructor Documentation

TriggerJSONMonitoring::TriggerJSONMonitoring ( const edm::ParameterSet ps)
explicit

Definition at line 22 of file TriggerJSONMonitoring.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), triggerResults_, and triggerResultsToken_.

23 {
24  if (ps.exists("triggerResults")) triggerResults_ = ps.getParameter<edm::InputTag> ("triggerResults");
25  else triggerResults_ = edm::InputTag("TriggerResults","","HLT");
26 
27  triggerResultsToken_ = consumes<edm::TriggerResults>(triggerResults_);
28 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
TriggerJSONMonitoring::~TriggerJSONMonitoring ( )

Definition at line 30 of file TriggerJSONMonitoring.cc.

31 {
32 }

Member Function Documentation

void TriggerJSONMonitoring::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
virtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 42 of file TriggerJSONMonitoring.cc.

References edm::InputTag::encode(), edm::Event::getByToken(), hltAccept_, hltDatasets_, hltErrors_, hltIndex_, hltL1s_, hltNames_, hltPre_, hltReject_, hltWasRun_, i, cmsHarvester::index, LogDebug, n, AlCaHLTBitMon_ParallelJobs::p, posL1s_, posPre_, processed_, triggerResults_, and triggerResultsToken_.

43 {
44 
45  using namespace std;
46  using namespace edm;
47 
48  processed_++;
49 
50  //Get hold of TriggerResults
52  iEvent.getByToken(triggerResultsToken_, HLTR);
53  if (!HLTR.isValid()) {
54  LogDebug("TriggerJSONMonitoring") << "HLT TriggerResults with label ["+triggerResults_.encode()+"] not found!" << std::endl;
55  return;
56  }
57 
58  //Decision for each HLT path
59  const unsigned int n(hltNames_.size());
60  for (unsigned int i=0; i<n; i++) {
61  if (HLTR->wasrun(i)) hltWasRun_[i]++;
62  if (HLTR->accept(i)) hltAccept_[i]++;
63  if (HLTR->wasrun(i) && !HLTR->accept(i)) hltReject_[i]++;
64  if (HLTR->error(i)) hltErrors_[i]++;
65  //Count L1 seeds and Prescales
66  const int index(static_cast<int>(HLTR->index(i)));
67  if (HLTR->accept(i)) {
68  if (index >= posL1s_[i]) hltL1s_[i]++;
69  if (index >= posPre_[i]) hltPre_[i]++;
70  } else {
71  if (index > posL1s_[i]) hltL1s_[i]++;
72  if (index > posPre_[i]) hltPre_[i]++;
73  }
74  }
75 
76  //Decision for each HLT dataset
77  std::vector<bool> acceptedByDS(hltIndex_.size(), false);
78  for (unsigned int ds=0; ds < hltIndex_.size(); ds++) { // ds = index of dataset
79  for (unsigned int p=0; p<hltIndex_[ds].size(); p++) { // p = index of path with dataset ds
80  if (acceptedByDS[ds]>0 || HLTR->accept(hltIndex_[ds][p]) ) {
81  acceptedByDS[ds] = true;
82  }
83  }
84  if (acceptedByDS[ds]) hltDatasets_[ds]++;
85  }
86 }//End analyze function
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned int > hltDatasets_
std::vector< unsigned int > hltErrors_
std::vector< unsigned int > hltL1s_
std::string encode() const
Definition: InputTag.cc:164
std::vector< std::vector< unsigned int > > hltIndex_
std::vector< unsigned int > hltAccept_
int iEvent
Definition: GenABIO.cc:230
std::vector< std::string > hltNames_
std::vector< unsigned int > hltReject_
std::vector< int > posL1s_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
std::vector< unsigned int > hltWasRun_
std::vector< int > posPre_
std::vector< unsigned int > hltPre_
void TriggerJSONMonitoring::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &  iSetup 
)
virtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 202 of file TriggerJSONMonitoring.cc.

References resetLumi().

void TriggerJSONMonitoring::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
virtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 164 of file TriggerJSONMonitoring.cc.

References baseRunDir_, hltConfig_, HLTConfigProvider::init(), jsonLegendDefFile_, jsonRateDefFile_, LogDebug, cmsHarvester::path, edm::InputTag::process(), resetRun(), edm::RunBase::run(), triggerResults_, writeDefJson(), and writeDefLegJson().

165 {
166  //Get the run directory from the EvFDaqDirector
168  else baseRunDir_ = ".";
169 
170  //Create mon directory if it doesn't exist
171  boost::filesystem::path monPath = baseRunDir_ + "/mon";
172  if (not boost::filesystem::is_directory(monPath)) boost::filesystem::create_directories(monPath);
173 
174  //Initialize hltConfig_
175  bool changed = true;
176  if (hltConfig_.init(iRun, iSetup, triggerResults_.process(), changed)) resetRun(changed);
177  else{
178  LogDebug("TriggerJSONMonitoring") << "HLTConfigProvider initialization failed!" << std::endl;
179  return;
180  }
181 
182  unsigned int nRun = iRun.run();
183 
184  //Create definition file for Rates
185  std::stringstream sjsdr;
186  sjsdr << baseRunDir_ + "/mon/run" << nRun << "_ls0000";
187  sjsdr << "_HLTRates_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsd";
188  jsonRateDefFile_ = sjsdr.str();
189 
191 
192  //Create definition file for Legend
193  std::stringstream sjsdl;
194  sjsdl << baseRunDir_ << "/mon/run" << nRun << "_ls0000";
195  sjsdl << "_HLTRatesLegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsd";
196  jsonLegendDefFile_ = sjsdl.str();
197 
199 
200 }//End beginRun function
#define LogDebug(id)
void resetRun(bool changed)
tuple path
else: Piece not in the list, fine.
HLTConfigProvider hltConfig_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void writeDefJson(std::string path)
std::string const & process() const
Definition: InputTag.h:46
void writeDefLegJson(std::string path)
void TriggerJSONMonitoring::endLuminosityBlockSummary ( edm::LuminosityBlock const &  iLumi,
edm::EventSetup const &  iEventSetup,
hltJson::lumiVars iSummary 
) const

Definition at line 229 of file TriggerJSONMonitoring.cc.

References asciidump::at, hltJson::lumiVars::baseRunDir, baseRunDir_, hltJson::lumiVars::datasetNames, datasetNames_, hltJson::lumiVars::hltAccept, hltAccept_, hltJson::lumiVars::hltDatasets, hltDatasets_, hltJson::lumiVars::hltErrors, hltErrors_, hltJson::lumiVars::hltL1s, hltL1s_, hltJson::lumiVars::hltNames, hltNames_, hltJson::lumiVars::hltPre, hltPre_, hltJson::lumiVars::hltReject, hltReject_, hltJson::lumiVars::hltWasRun, hltWasRun_, hltJson::lumiVars::jsonLegendDefFile, jsonLegendDefFile_, hltJson::lumiVars::jsonRateDefFile, jsonRateDefFile_, hltJson::lumiVars::processed, processed_, interactiveExample::ui, jsoncollector::HistoJ< T >::update(), and jsoncollector::HistoJ< T >::value().

229  {
230 
231  //Whichever stream gets there first does the initialiazation
232  if (iSummary->hltNames->value().size() == 0){
233  iSummary->processed->update(processed_);
234 
235  for (unsigned int ui = 0; ui < hltNames_.size(); ui++){
236  iSummary->hltWasRun->update(hltWasRun_.at(ui));
237  iSummary->hltL1s ->update(hltL1s_ .at(ui));
238  iSummary->hltPre ->update(hltPre_ .at(ui));
239  iSummary->hltAccept->update(hltAccept_.at(ui));
240  iSummary->hltReject->update(hltReject_.at(ui));
241  iSummary->hltErrors->update(hltErrors_.at(ui));
242 
243  iSummary->hltNames->update(hltNames_.at(ui));
244  }
245 
246  for (unsigned int ui = 0; ui < datasetNames_.size(); ui++){
247  iSummary->hltDatasets->update(hltDatasets_.at(ui));
248 
249  iSummary->datasetNames->update(datasetNames_.at(ui));
250  }
251  iSummary->jsonRateDefFile = jsonRateDefFile_;
253  iSummary->baseRunDir = baseRunDir_;
254  }
255  else{
256  iSummary->processed->value().at(0) += processed_;
257 
258  for (unsigned int ui = 0; ui < hltNames_.size(); ui++){
259  iSummary->hltWasRun->value().at(ui) += hltWasRun_.at(ui);
260  iSummary->hltL1s ->value().at(ui) += hltL1s_ .at(ui);
261  iSummary->hltPre ->value().at(ui) += hltPre_ .at(ui);
262  iSummary->hltAccept->value().at(ui) += hltAccept_.at(ui);
263  iSummary->hltReject->value().at(ui) += hltReject_.at(ui);
264  iSummary->hltErrors->value().at(ui) += hltErrors_.at(ui);
265  }
266  for (unsigned int ui = 0; ui < datasetNames_.size(); ui++){
267  iSummary->hltDatasets->value().at(ui) += hltDatasets_.at(ui);
268  }
269  }
270 }//End endLuminosityBlockSummary function
HistoJ< std::string > * datasetNames
HistoJ< unsigned int > * hltReject
std::vector< unsigned int > hltDatasets_
HistoJ< unsigned int > * hltErrors
std::vector< unsigned int > hltErrors_
HistoJ< unsigned int > * processed
std::vector< unsigned int > hltL1s_
std::vector< T > & value()
HistoJ< unsigned int > * hltAccept
std::vector< unsigned int > hltAccept_
std::vector< std::string > hltNames_
std::vector< std::string > datasetNames_
std::vector< unsigned int > hltReject_
HistoJ< unsigned int > * hltPre
HistoJ< unsigned int > * hltDatasets
HistoJ< std::string > * hltNames
std::vector< unsigned int > hltWasRun_
HistoJ< unsigned int > * hltL1s
HistoJ< unsigned int > * hltWasRun
std::vector< unsigned int > hltPre_
list at
Definition: asciidump.py:428
void TriggerJSONMonitoring::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 35 of file TriggerJSONMonitoring.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

35  {
37  desc.add<edm::InputTag>("triggerResults",edm::InputTag("TriggerResults","","HLT"));
38  descriptions.add("triggerJSONMonitoring", desc);
39 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::shared_ptr< hltJson::lumiVars > TriggerJSONMonitoring::globalBeginLuminosityBlockSummary ( edm::LuminosityBlock const &  iLumi,
edm::EventSetup const &  iSetup,
LuminosityBlockContext const *  iContext 
)
static

Definition at line 205 of file TriggerJSONMonitoring.cc.

206 {
207  std::shared_ptr<hltJson::lumiVars> iSummary(new hltJson::lumiVars);
208 
209  unsigned int MAXPATHS = 500;
210 
211  iSummary->processed = new HistoJ<unsigned int>(1, 1);
212 
213  iSummary->hltWasRun = new HistoJ<unsigned int>(1, MAXPATHS);
214  iSummary->hltL1s = new HistoJ<unsigned int>(1, MAXPATHS);
215  iSummary->hltPre = new HistoJ<unsigned int>(1, MAXPATHS);
216  iSummary->hltAccept = new HistoJ<unsigned int>(1, MAXPATHS);
217  iSummary->hltReject = new HistoJ<unsigned int>(1, MAXPATHS);
218  iSummary->hltErrors = new HistoJ<unsigned int>(1, MAXPATHS);
219 
220  iSummary->hltDatasets = new HistoJ<unsigned int>(1, MAXPATHS);
221 
222  iSummary->hltNames = new HistoJ<std::string>(1, MAXPATHS);
223  iSummary->datasetNames = new HistoJ<std::string>(1, MAXPATHS);
224 
225  return iSummary;
226 }//End globalBeginLuminosityBlockSummary function
void TriggerJSONMonitoring::globalEndLuminosityBlockSummary ( edm::LuminosityBlock const &  iLumi,
edm::EventSetup const &  iSetup,
LuminosityBlockContext const *  iContext,
hltJson::lumiVars iSummary 
)
static

Definition at line 274 of file TriggerJSONMonitoring.cc.

References Json::Value::append(), hltJson::lumiVars::baseRunDir, cscdqm::DATA, hltJson::lumiVars::datasetNames, hltJson::lumiVars::hltAccept, hltJson::lumiVars::hltDatasets, hltJson::lumiVars::hltErrors, hltJson::lumiVars::hltL1s, hltJson::lumiVars::hltNames, hltJson::lumiVars::hltPre, hltJson::lumiVars::hltReject, hltJson::lumiVars::hltWasRun, hltJson::lumiVars::jsonLegendDefFile, hltJson::lumiVars::jsonRateDefFile, edm::LuminosityBlockBase::luminosityBlock(), hltJson::lumiVars::processed, query::result, edm::LuminosityBlockBase::run(), runonSM::SOURCE, AlCaHLTBitMon_QueryRunRegistry::string, jsoncollector::HistoJ< T >::toString(), and Json::StyledWriter::write().

275 {
276  Json::StyledWriter writer;
277 
278  char hostname[33];
279  gethostname(hostname,32);
280  std::string sourceHost(hostname);
281 
282  //Get the mon directory
283  std::string monPath = iSummary->baseRunDir + "/mon";
284 
285  unsigned int iLs = iLumi.luminosityBlock();
286  unsigned int iRun = iLumi.run();
287 
288  Json::Value hltRates;
289  hltRates[DataPoint::SOURCE] = sourceHost;
290  hltRates[DataPoint::DEFINITION] = iSummary->jsonRateDefFile;
291 
292  hltRates[DataPoint::DATA].append(iSummary->processed->toString());
293  hltRates[DataPoint::DATA].append(iSummary->hltWasRun->toString());
294  hltRates[DataPoint::DATA].append(iSummary->hltL1s ->toString());
295  hltRates[DataPoint::DATA].append(iSummary->hltPre ->toString());
296  hltRates[DataPoint::DATA].append(iSummary->hltAccept->toString());
297  hltRates[DataPoint::DATA].append(iSummary->hltReject->toString());
298  hltRates[DataPoint::DATA].append(iSummary->hltErrors->toString());
299 
300  hltRates[DataPoint::DATA].append(iSummary->hltDatasets->toString());
301 
302  std::string && result = writer.write(hltRates);
303 
304  std::stringstream sjsnr;
305  sjsnr << monPath << "/run" << iRun << "_ls" << std::setfill('0') << std::setw(4) << iLs;
306  sjsnr << "_HLTRates_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsn";
307 
308  std::ofstream outJsnFileR( sjsnr.str() );
309  outJsnFileR<<result;
310  outJsnFileR.close();
311 
312  Json::Value hltNames;
313  hltNames[DataPoint::SOURCE] = sourceHost;
314  hltNames[DataPoint::DEFINITION] = iSummary->jsonLegendDefFile;
315 
316  hltNames[DataPoint::DATA].append(iSummary->hltNames->toString());
317  hltNames[DataPoint::DATA].append(iSummary->datasetNames->toString());
318 
319  result = writer.write(hltNames);
320 
321  std::stringstream sjsnl;
322  sjsnl << monPath << "/run" << iRun << "_ls" << std::setfill('0') << std::setw(4) << iLs;
323  sjsnl << "_HLTRatesLegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsn";
324 
325  std::ofstream outJsnFileL( sjsnl.str() );
326  outJsnFileL<<result;
327  outJsnFileL.close();
328 
329  //Delete the individual HistoJ pointers
330  delete iSummary->processed;
331 
332  delete iSummary->hltWasRun;
333  delete iSummary->hltL1s ;
334  delete iSummary->hltPre ;
335  delete iSummary->hltAccept;
336  delete iSummary->hltReject;
337  delete iSummary->hltErrors;
338 
339  delete iSummary->hltDatasets;
340 
341  delete iSummary->hltNames;
342  delete iSummary->datasetNames;
343 
344  //Note: Do not delete the iSummary pointer. The framework does something with it later on
345  // and deleting it results in a segmentation fault.
346 
347 }//End globalEndLuminosityBlockSummary function
HistoJ< std::string > * datasetNames
HistoJ< unsigned int > * hltReject
HistoJ< unsigned int > * hltErrors
Value & append(const Value &value)
Append value to array at the end.
Represents a JSON value.
Definition: value.h:111
HistoJ< unsigned int > * processed
HistoJ< unsigned int > * hltAccept
tuple result
Definition: query.py:137
HistoJ< unsigned int > * hltPre
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
HistoJ< unsigned int > * hltDatasets
virtual std::string toString() const
HistoJ< std::string > * hltNames
HistoJ< unsigned int > * hltL1s
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:65
HistoJ< unsigned int > * hltWasRun
string SOURCE
Definition: runonSM.py:23
void TriggerJSONMonitoring::resetLumi ( )

Definition at line 144 of file TriggerJSONMonitoring.cc.

References hltAccept_, hltDatasets_, hltErrors_, hltL1s_, hltPre_, hltReject_, hltWasRun_, i, and processed_.

Referenced by beginLuminosityBlock(), and resetRun().

144  {
145  //Reset total number of events
146  processed_ = 0;
147 
148  //Reset per-path counters
149  for (unsigned int i = 0; i < hltWasRun_.size(); i++) {
150  hltWasRun_[i] = 0;
151  hltL1s_[i] = 0;
152  hltPre_[i] = 0;
153  hltAccept_[i] = 0;
154  hltReject_[i] = 0;
155  hltErrors_[i] = 0;
156  }
157  //Reset per-dataset counter
158  for (unsigned int i = 0; i < hltDatasets_.size(); i++) {
159  hltDatasets_[i] = 0;
160  }
161 }//End resetLumi function
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned int > hltDatasets_
std::vector< unsigned int > hltErrors_
std::vector< unsigned int > hltL1s_
std::vector< unsigned int > hltAccept_
std::vector< unsigned int > hltReject_
std::vector< unsigned int > hltWasRun_
std::vector< unsigned int > hltPre_
void TriggerJSONMonitoring::resetRun ( bool  changed)

Definition at line 89 of file TriggerJSONMonitoring.cc.

References HLTConfigProvider::datasetContents(), datasetContents_, HLTConfigProvider::datasetNames(), datasetNames_, hltAccept_, hltConfig_, hltDatasets_, hltErrors_, hltIndex_, hltL1s_, hltNames_, hltPre_, hltReject_, hltWasRun_, i, j, diffTwoXMLs::label, HLTConfigProvider::moduleLabels(), HLTConfigProvider::moduleType(), n, AlCaHLTBitMon_ParallelJobs::p, posL1s_, posPre_, resetLumi(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::triggerIndex(), and HLTConfigProvider::triggerNames().

Referenced by beginRun().

89  {
90 
91  //Update trigger and dataset names
92  if (changed){
96  }
97 
98  const unsigned int n = hltNames_.size();
99  const unsigned int d = datasetNames_.size();
100 
101  if (changed) {
102  //Resize per-path counters
103  hltWasRun_.resize(n);
104  hltL1s_.resize(n);
105  hltPre_.resize(n);
106  hltAccept_.resize(n);
107  hltReject_.resize(n);
108  hltErrors_.resize(n);
109  //Resize per-dataset counter
110  hltDatasets_.resize(d);
111  //Resize htlIndex
112  hltIndex_.resize(d);
113  //Set-up hltIndex
114  for (unsigned int ds = 0; ds < d; ds++) {
115  unsigned int size = datasetContents_[ds].size();
116  hltIndex_[ds].reserve(size);
117  for (unsigned int p = 0; p < size; p++) {
118  unsigned int i = hltConfig_.triggerIndex(datasetContents_[ds][p]);
119  if (i<n) {
120  hltIndex_[ds].push_back(i);
121  }
122  }
123  }
124  //Find the positions of seeding and prescaler modules
125  posL1s_.resize(n);
126  posPre_.resize(n);
127  for (unsigned int i = 0; i < n; ++i) {
128  posL1s_[i] = -1;
129  posPre_[i] = -1;
130  const std::vector<std::string> & moduleLabels(hltConfig_.moduleLabels(i));
131  for (unsigned int j = 0; j < moduleLabels.size(); ++j) {
132  const std::string & label = hltConfig_.moduleType(moduleLabels[j]);
133  if (label == "HLTLevel1GTSeed")
134  posL1s_[i] = j;
135  else if (label == "HLTPrescaler")
136  posPre_[i] = j;
137  }
138  }
139  }
140  resetLumi();
141 }//End resetRun function
int i
Definition: DBlmapReader.cc:9
const std::string moduleType(const std::string &module) const
C++ class name of module.
std::vector< unsigned int > hltDatasets_
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< unsigned int > hltErrors_
std::vector< unsigned int > hltL1s_
std::vector< std::vector< unsigned int > > hltIndex_
std::vector< unsigned int > hltAccept_
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
std::vector< std::string > hltNames_
HLTConfigProvider hltConfig_
std::vector< std::string > datasetNames_
int j
Definition: DBlmapReader.cc:9
std::vector< unsigned int > hltReject_
std::vector< int > posL1s_
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
const std::vector< std::vector< std::string > > & datasetContents() const
names of trigger paths for all datasets
std::vector< unsigned int > hltWasRun_
std::vector< std::vector< std::string > > datasetContents_
std::vector< int > posPre_
tuple size
Write out results.
const std::vector< std::string > & datasetNames() const
std::vector< unsigned int > hltPre_
void TriggerJSONMonitoring::writeDefJson ( std::string  path)

Definition at line 351 of file TriggerJSONMonitoring.cc.

References getDQMSummary::outfile.

Referenced by beginRun().

351  {
352 
353  std::ofstream outfile( path );
354  outfile << "{" << std::endl;
355  outfile << " \"data\" : [" << std::endl;
356  outfile << " {" ;
357  outfile << " \"name\" : \"Processed\"," ; //***
358  outfile << " type = \"integer\"," ;
359  outfile << " \"operation\" : \"sum\"}," << std::endl;
360 
361  outfile << " {" ;
362  outfile << " \"name\" : \"Path-WasRun\"," ;
363  outfile << " type = \"integer\"," ;
364  outfile << " \"operation\" : \"sum\"}," << std::endl;
365 
366  outfile << " {" ;
367  outfile << " \"name\" : \"Path-AfterL1Seed\"," ;
368  outfile << " type = \"integer\"," ;
369  outfile << " \"operation\" : \"sum\"}," << std::endl;
370 
371  outfile << " {" ;
372  outfile << " \"name\" : \"Path-AfterPrescale\"," ;
373  outfile << " type = \"integer\"," ;
374  outfile << " \"operation\" : \"sum\"}," << std::endl;
375 
376  outfile << " {" ;
377  outfile << " \"name\" : \"Path-Accepted\"," ;
378  outfile << " type = \"integer\"," ;
379  outfile << " \"operation\" : \"sum\"}," << std::endl;
380 
381  outfile << " {" ;
382  outfile << " \"name\" : \"Path-Rejected\"," ;
383  outfile << " type = \"integer\"," ;
384  outfile << " \"operation\" : \"sum\"}," << std::endl;
385 
386  outfile << " {" ;
387  outfile << " \"name\" : \"Path-Errors\"," ;
388  outfile << " type = \"integer\"," ;
389  outfile << " \"operation\" : \"sum\"}," << std::endl;
390 
391  outfile << " {" ;
392  outfile << " \"name\" : \"Dataset-Accepted\"," ;
393  outfile << " type = \"integer\"," ;
394  outfile << " \"operation\" : \"sum\"}" << std::endl;
395 
396  outfile << " ]" << std::endl;
397  outfile << "}" << std::endl;
398 
399  outfile.close();
400 }//End writeDefJson function
tuple path
else: Piece not in the list, fine.
void TriggerJSONMonitoring::writeDefLegJson ( std::string  path)

Definition at line 403 of file TriggerJSONMonitoring.cc.

Referenced by beginRun().

403  {
404 
405  std::ofstream legfile(path);
406  legfile << "{" << std::endl;
407  legfile << " \"data\" : [" << std::endl;
408  legfile << " {" ;
409  legfile << " \"name\" : \"Path-Names\"," ;
410  legfile << " type = \"string\"," ;
411  legfile << " \"operation\" : \"cat\"}," << std::endl;
412 
413  legfile << " {" ;
414  legfile << " \"name\" : \"Dataset-Names\"," ;
415  legfile << " type = \"string\"," ;
416  legfile << " \"operation\" : \"cat\"}" << std::endl;
417  legfile << " ]" << std::endl;
418  legfile << "}" << std::endl;
419  legfile.close();
420 }//End writeDefLegJson function
tuple path
else: Piece not in the list, fine.

Member Data Documentation

std::string TriggerJSONMonitoring::baseRunDir_

Definition at line 103 of file TriggerJSONMonitoring.h.

Referenced by beginRun(), and endLuminosityBlockSummary().

std::vector<std::vector<std::string> > TriggerJSONMonitoring::datasetContents_

Definition at line 109 of file TriggerJSONMonitoring.h.

Referenced by resetRun().

std::vector<std::string> TriggerJSONMonitoring::datasetNames_

Definition at line 108 of file TriggerJSONMonitoring.h.

Referenced by endLuminosityBlockSummary(), and resetRun().

std::vector<unsigned int> TriggerJSONMonitoring::hltAccept_

Definition at line 123 of file TriggerJSONMonitoring.h.

Referenced by analyze(), endLuminosityBlockSummary(), resetLumi(), and resetRun().

HLTConfigProvider TriggerJSONMonitoring::hltConfig_

Definition at line 101 of file TriggerJSONMonitoring.h.

Referenced by beginRun(), and resetRun().

std::vector<unsigned int> TriggerJSONMonitoring::hltDatasets_

Definition at line 127 of file TriggerJSONMonitoring.h.

Referenced by analyze(), endLuminosityBlockSummary(), resetLumi(), and resetRun().

std::vector<unsigned int> TriggerJSONMonitoring::hltErrors_

Definition at line 125 of file TriggerJSONMonitoring.h.

Referenced by analyze(), endLuminosityBlockSummary(), resetLumi(), and resetRun().

std::vector<std::vector<unsigned int> > TriggerJSONMonitoring::hltIndex_

Definition at line 106 of file TriggerJSONMonitoring.h.

Referenced by analyze(), and resetRun().

std::vector<unsigned int> TriggerJSONMonitoring::hltL1s_

Definition at line 121 of file TriggerJSONMonitoring.h.

Referenced by analyze(), endLuminosityBlockSummary(), resetLumi(), and resetRun().

std::vector<std::string> TriggerJSONMonitoring::hltNames_

Definition at line 107 of file TriggerJSONMonitoring.h.

Referenced by analyze(), endLuminosityBlockSummary(), and resetRun().

std::vector<unsigned int> TriggerJSONMonitoring::hltPre_

Definition at line 122 of file TriggerJSONMonitoring.h.

Referenced by analyze(), endLuminosityBlockSummary(), resetLumi(), and resetRun().

std::vector<unsigned int> TriggerJSONMonitoring::hltReject_

Definition at line 124 of file TriggerJSONMonitoring.h.

Referenced by analyze(), endLuminosityBlockSummary(), resetLumi(), and resetRun().

std::vector<unsigned int> TriggerJSONMonitoring::hltWasRun_

Definition at line 120 of file TriggerJSONMonitoring.h.

Referenced by analyze(), endLuminosityBlockSummary(), resetLumi(), and resetRun().

std::string TriggerJSONMonitoring::jsonLegendDefFile_

Definition at line 115 of file TriggerJSONMonitoring.h.

Referenced by beginRun(), and endLuminosityBlockSummary().

std::string TriggerJSONMonitoring::jsonRateDefFile_

Definition at line 114 of file TriggerJSONMonitoring.h.

Referenced by beginRun(), and endLuminosityBlockSummary().

std::vector<int> TriggerJSONMonitoring::posL1s_

Definition at line 111 of file TriggerJSONMonitoring.h.

Referenced by analyze(), and resetRun().

std::vector<int> TriggerJSONMonitoring::posPre_

Definition at line 112 of file TriggerJSONMonitoring.h.

Referenced by analyze(), and resetRun().

unsigned int TriggerJSONMonitoring::processed_

Definition at line 118 of file TriggerJSONMonitoring.h.

Referenced by analyze(), endLuminosityBlockSummary(), and resetLumi().

edm::InputTag TriggerJSONMonitoring::triggerResults_

Definition at line 97 of file TriggerJSONMonitoring.h.

Referenced by analyze(), beginRun(), and TriggerJSONMonitoring().

edm::EDGetTokenT<edm::TriggerResults> TriggerJSONMonitoring::triggerResultsToken_

Definition at line 98 of file TriggerJSONMonitoring.h.

Referenced by analyze(), and TriggerJSONMonitoring().