CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
HLTriggerJSONMonitoring Class Reference
Inheritance diagram for HLTriggerJSONMonitoring:
edm::global::EDAnalyzer<  edm::StreamCache< HLTriggerJSONMonitoringData::stream >, edm::RunCache< HLTriggerJSONMonitoringData::run >, edm::LuminosityBlockSummaryCache< HLTriggerJSONMonitoringData::lumisection > > edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
 
std::unique_ptr< HLTriggerJSONMonitoringData::streambeginStream (edm::StreamID) const override
 
std::shared_ptr< HLTriggerJSONMonitoringData::lumisectionglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &) const override
 
std::shared_ptr< HLTriggerJSONMonitoringData::runglobalBeginRun (edm::Run const &, edm::EventSetup const &) const override
 
void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, HLTriggerJSONMonitoringData::lumisection *) const override
 
void globalEndRun (edm::Run const &, edm::EventSetup const &) const override
 
 HLTriggerJSONMonitoring (const edm::ParameterSet &)
 
void streamBeginLuminosityBlock (edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &) const override
 
void streamEndLuminosityBlockSummary (edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &, HLTriggerJSONMonitoringData::lumisection *) const override
 
 ~HLTriggerJSONMonitoring () override=default
 
- Public Member Functions inherited from edm::global::EDAnalyzer< edm::StreamCache< HLTriggerJSONMonitoringData::stream >, edm::RunCache< HLTriggerJSONMonitoringData::run >, edm::LuminosityBlockSummaryCache< HLTriggerJSONMonitoringData::lumisection > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Static Private Member Functions

static void writeIniFile (HLTriggerJSONMonitoringData::run const &, unsigned int)
 
static void writeJsdFile (HLTriggerJSONMonitoringData::run const &)
 

Private Attributes

const edm::InputTag triggerResults_
 
const edm::EDGetTokenT< edm::TriggerResultstriggerResultsToken_
 

Static Private Attributes

static const char * streamName_ = "streamHLTRates"
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 outputs JSON files with HLT monitoring information.

Definition at line 75 of file HLTriggerJSONMonitoring.cc.

Constructor & Destructor Documentation

HLTriggerJSONMonitoring::HLTriggerJSONMonitoring ( const edm::ParameterSet )
explicit

Definition at line 139 of file HLTriggerJSONMonitoring.cc.

139  :
140  triggerResults_(config.getParameter<edm::InputTag>("triggerResults")),
141  triggerResultsToken_(consumes<edm::TriggerResults>(triggerResults_))
142 {
143 }
Definition: config.py:1
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
const edm::InputTag triggerResults_
HLTriggerJSONMonitoring::~HLTriggerJSONMonitoring ( )
overridedefault

Member Function Documentation

void HLTriggerJSONMonitoring::analyze ( edm::StreamID  sid,
edm::Event const &  event,
edm::EventSetup const &   
) const
overridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 240 of file HLTriggerJSONMonitoring.cc.

References edm::HLTGlobalStatus::accept(), edm::HLTGlobalStatus::at(), edm::InputTag::encode(), edm::Event::getByToken(), edm::Event::getRun(), cmsBatch::handle, mps_fire::i, edm::Run::index(), diffTreeTool::index, createfilelist::int, edm::HandleBase::isValid(), or, callgraph::path, mps_update::results, lumiPlot::rundata, edm::HLTGlobalStatus::size(), mps_update::status, triggerResults_, and triggerResultsToken_.

241 {
242  auto & stream = * streamCache(sid);
243  auto const& rundata = * runCache(event.getRun().index());
244 
245  ++stream.processed;
246 
247  // check that the HLTConfigProvider for the current run has been successfully initialised
248  if (not rundata.hltConfig.inited())
249  return;
250 
251  // get hold of TriggerResults
253  if (not event.getByToken(triggerResultsToken_, handle) or not handle.isValid()){
254  edm::LogError("HLTriggerJSONMonitoring") << "TriggerResults with label [" + triggerResults_.encode() + "] not present or invalid";
255  return;
256  }
258  assert(results.size() == stream.hltWasRun.size());
259 
260  // check the results for each HLT path
261  for (unsigned int i = 0; i < results.size(); ++i) {
262  auto const& status = results.at(i);
263  if (status.wasrun()) {
264  ++stream.hltWasRun[i];
265  if (status.accept()) {
266  ++stream.hltL1s[i];
267  ++stream.hltPre[i];
268  ++stream.hltAccept[i];
269  } else {
270  int index = (int) status.index();
271  if (index > rundata.posL1s[i]) ++stream.hltL1s[i];
272  if (index > rundata.posPre[i]) ++stream.hltPre[i];
273  if (status.error())
274  ++stream.hltErrors[i];
275  else
276  ++stream.hltReject[i];
277  }
278  }
279  }
280 
281  // check the decision for each dataset
282  // FIXME this ignores the prescales, "smart" prescales, and event selection applied in the OutputModule itself
283  for (unsigned int i = 0; i < rundata.datasets.size(); ++i)
284  if (std::any_of(rundata.datasets[i].begin(), rundata.datasets[i].end(), [&](unsigned int path) { return results.accept(path); }))
285  ++stream.datasets[i];
286 
287 }
bool accept() const
Has at least one path accepted the event?
std::string encode() const
Definition: InputTag.cc:165
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
unsigned int size() const
Get number of paths stored.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool isValid() const
Definition: HandleBase.h:74
const HLTPathStatus & at(const unsigned int i) const
const edm::InputTag triggerResults_
Definition: event.py:1
std::unique_ptr< HLTriggerJSONMonitoringData::stream > HLTriggerJSONMonitoring::beginStream ( edm::StreamID  ) const
override

Definition at line 156 of file HLTriggerJSONMonitoring.cc.

157 {
158  return std::make_unique<HLTriggerJSONMonitoringData::stream>();
159 }
void HLTriggerJSONMonitoring::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 147 of file HLTriggerJSONMonitoring.cc.

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

148 {
150  desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "HLT"));
151  descriptions.add("HLTriggerJSONMonitoring", desc);
152 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::shared_ptr< HLTriggerJSONMonitoringData::lumisection > HLTriggerJSONMonitoring::globalBeginLuminosityBlockSummary ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &   
) const
override

Definition at line 292 of file HLTriggerJSONMonitoring.cc.

References edmIntegrityCheck::datasets, edm::LuminosityBlock::getRun(), mps_fire::i, edm::Run::index(), tablePrinter::lumidata, and lumiPlot::rundata.

293 {
294  unsigned int triggers = 0;
295  unsigned int datasets = 0;
296  auto const& rundata = * runCache(lumi.getRun().index());
297  if (rundata.hltConfig.inited()) {
298  triggers = rundata.hltConfig.triggerNames().size();
299  datasets = rundata.hltConfig.datasetNames().size();
300  };
301 
302  // the API of jsoncollector::HistoJ does not really match our use case,
303  // but it is the only vector-like object available in JsonMonitorable.h
304  auto lumidata = std::make_shared<HLTriggerJSONMonitoringData::lumisection>(HLTriggerJSONMonitoringData::lumisection{
305  jsoncollector::HistoJ<unsigned int>(1), // processed
306  jsoncollector::HistoJ<unsigned int>(triggers), // hltWasRun
307  jsoncollector::HistoJ<unsigned int>(triggers), // hltL1s
308  jsoncollector::HistoJ<unsigned int>(triggers), // hltPre
309  jsoncollector::HistoJ<unsigned int>(triggers), // hltAccept
310  jsoncollector::HistoJ<unsigned int>(triggers), // hltReject
311  jsoncollector::HistoJ<unsigned int>(triggers), // hltErrors
312  jsoncollector::HistoJ<unsigned int>(datasets) // datasets
313  });
314  // repeated calls to `update` necessary to set the internal element counter
315  lumidata->processed.update(0);
316  for (unsigned int i = 0; i < triggers; ++i) lumidata->hltWasRun.update(0);
317  for (unsigned int i = 0; i < triggers; ++i) lumidata->hltL1s.update(0);
318  for (unsigned int i = 0; i < triggers; ++i) lumidata->hltPre.update(0);
319  for (unsigned int i = 0; i < triggers; ++i) lumidata->hltAccept.update(0);
320  for (unsigned int i = 0; i < triggers; ++i) lumidata->hltReject.update(0);
321  for (unsigned int i = 0; i < triggers; ++i) lumidata->hltErrors.update(0);
322  for (unsigned int i = 0; i < datasets; ++i) lumidata->datasets.update(0);
323 
324  return lumidata;
325 }
std::shared_ptr< HLTriggerJSONMonitoringData::run > HLTriggerJSONMonitoring::globalBeginRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
) const
override

Definition at line 163 of file HLTriggerJSONMonitoring.cc.

References makeLayoutFileForGui::datasetNames, edmIntegrityCheck::datasets, cmsPerfStripChart::format, mps_fire::i, diffTreeTool::index, edm::Service< T >::isAvailable(), diffTwoXMLs::label, evf::MergeTypeJSNDATA, AlCaHLTBitMon_ParallelJobs::p, edm::InputTag::process(), edm::RunBase::run(), lumiPlot::rundata, harvestTrackValidationPlots::str, AlCaHLTBitMon_QueryRunRegistry::string, triggerResults_, writeIniFile(), and writeJsdFile().

164 {
165  auto rundata = std::make_shared<HLTriggerJSONMonitoringData::run>();
166 
167  // set the DAQ parameters
169  rundata->streamDestination = edm::Service<evf::EvFDaqDirector>()->getStreamDestinations("streamHLTRates");
170  rundata->streamMergeType = edm::Service<evf::EvFDaqDirector>()->getStreamMergeType("streamHLTRates", evf::MergeTypeJSNDATA);
171  rundata->baseRunDir = edm::Service<evf::EvFDaqDirector>()->baseRunDir();
172  } else {
173  rundata->streamDestination = "";
174  rundata->streamMergeType = "";
175  rundata->baseRunDir = ".";
176  }
177 
178  // initialize HLTConfigProvider
179  bool changed = true;
180  if (not rundata->hltConfig.init(run, setup, triggerResults_.process(), changed)) {
181  edm::LogError("HLTriggerJSONMonitoring") << "HLTConfigProvider initialization failed!" << std::endl;
182  } else if (changed){
183  // update the trigger and dataset names
184  auto const & triggerNames = rundata->hltConfig.triggerNames();
185  auto const & datasetNames = rundata->hltConfig.datasetNames();
186  auto const & datasets = rundata->hltConfig.datasetContents();
187 
188  const unsigned int triggersSize = triggerNames.size();
189  const unsigned int datasetsSize = datasetNames.size();
190 
191  // extract the definition of the datasets
192  rundata->datasets.resize(datasetsSize);
193  for (unsigned int ds = 0; ds < datasetsSize; ++ds) {
194  auto & dataset = rundata->datasets[ds];
195  unsigned int paths = datasets[ds].size();
196  dataset.reserve(paths);
197  for (unsigned int p = 0; p < paths; p++) {
198  unsigned int index = rundata->hltConfig.triggerIndex(datasets[ds][p]);
199  if (index < triggersSize)
200  dataset.push_back(index);
201  }
202  }
203 
204  // find the positions of the L1 seed and prescale filters
205  rundata->posL1s.resize(triggersSize);
206  rundata->posPre.resize(triggersSize);
207  for (unsigned int i = 0; i < triggersSize; ++i) {
208  rundata->posL1s[i] = -1;
209  rundata->posPre[i] = -1;
210  std::vector<std::string> const& moduleLabels = rundata->hltConfig.moduleLabels(i);
211  for (unsigned int j = 0; j < moduleLabels.size(); ++j) {
212  std::string const& label = rundata->hltConfig.moduleType(moduleLabels[j]);
213  if (label == "HLTL1TSeed")
214  rundata->posL1s[i] = j;
215  else if (label == "HLTPrescaler")
216  rundata->posPre[i] = j;
217  }
218  }
219  }
220 
221  // write the per-run .jsd file
222  rundata->jsdFileName = (boost::format("run%06d_ls0000_streamHLTRates_pid%05d.jsd") % run.run() % getpid()).str();
224 
225  // write the per-run .ini file
226  // iniFileName = (boost::format("run%06d_ls0000_streamHLTRates_pid%05d.ini") % run.run() % getpid()).str();
227  writeIniFile(*rundata, run.run());
228 
229  return rundata;
230 }
static void writeIniFile(HLTriggerJSONMonitoringData::run const &, unsigned int)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
bool isAvailable() const
Definition: Service.h:46
format
Some error handling for the usage.
static void writeJsdFile(HLTriggerJSONMonitoringData::run const &)
std::string const & process() const
Definition: InputTag.h:40
const edm::InputTag triggerResults_
void HLTriggerJSONMonitoring::globalEndLuminosityBlockSummary ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  ,
HLTriggerJSONMonitoringData::lumisection lumidata 
) const
override

Definition at line 380 of file HLTriggerJSONMonitoring.cc.

References cms::Adler32(), Json::Value::append(), jsoncollector::DataPoint::DATA, HLTriggerJSONMonitoringData::lumisection::datasets, jsoncollector::DataPoint::DEFINITION, cmsPerfStripChart::format, edm::LuminosityBlock::getRun(), HLTriggerJSONMonitoringData::lumisection::hltAccept, HLTriggerJSONMonitoringData::lumisection::hltErrors, HLTriggerJSONMonitoringData::lumisection::hltL1s, HLTriggerJSONMonitoringData::lumisection::hltPre, HLTriggerJSONMonitoringData::lumisection::hltReject, HLTriggerJSONMonitoringData::lumisection::hltWasRun, edm::Run::index(), eostools::ls(), edm::LuminosityBlockBase::luminosityBlock(), HLTriggerJSONMonitoringData::lumisection::processed, mps_fire::result, edm::LuminosityBlockBase::run(), findQualityFiles::run, lumiPlot::rundata, evf::FastMonitoringService::shouldWriteFiles(), jsoncollector::DataPoint::SOURCE, AlCaHLTBitMon_QueryRunRegistry::string, jsoncollector::HistoJ< T >::toJsonValue(), jsoncollector::HistoJ< T >::value(), and cscNeutronWriter_cfi::writer.

381 {
382  unsigned int ls = lumi.luminosityBlock();
383  unsigned int run = lumi.run();
384 
385  bool writeFiles = true;
386  if (edm::Service<evf::MicroStateService>().isAvailable()) {
388  if (fms)
389  writeFiles = fms->shouldWriteFiles(ls);
390  }
391  if (not writeFiles)
392  return;
393 
394  unsigned int processed = lumidata->processed.value().at(0);
395  auto const& rundata = * runCache(lumi.getRun().index());
397 
398  // [SIC]
399  char hostname[33];
400  gethostname(hostname, 32);
401  std::string sourceHost(hostname);
402 
403  // [SIC]
404  std::stringstream sOutDef;
405  sOutDef << rundata.baseRunDir << "/" << "output_" << getpid() << ".jsd";
406 
407  std::string jsndataFileList = "";
408  unsigned int jsndataSize = 0;
409  unsigned int jsndataAdler32 = 1; // adler32 checksum for an empty file
410 
411  if (processed) {
412  // write the .jsndata files which contain the actual rates
413  Json::Value jsndata;
414  jsndata[jsoncollector::DataPoint::SOURCE] = sourceHost;
415  jsndata[jsoncollector::DataPoint::DEFINITION] = rundata.jsdFileName;
424 
425  auto jsndataFileName = boost::format("run%06d_ls%04d_streamHLTRates_pid%05d.jsndata") % run % ls % getpid();
426 
427  std::string result = writer.write(jsndata);
428  std::ofstream jsndataFile(rundata.baseRunDir + "/" + jsndataFileName.str());
429  jsndataFile << result;
430  jsndataFile.close();
431 
432  jsndataFileList = jsndataFileName.str();
433  jsndataSize = result.size();
434  jsndataAdler32 = cms::Adler32(result.c_str(), result.size());
435  }
436 
437  // create a metadata json file for the "HLT rates" pseudo-stream
438  unsigned int jsnProcessed = processed;
439  unsigned int jsnAccepted = processed;
440  unsigned int jsnErrorEvents = 0;
441  unsigned int jsnRetCodeMask = 0;
442  std::string jsnInputFiles = "";
443  unsigned int jsnHLTErrorEvents = 0;
444 
445  Json::Value jsn;
446  jsn[jsoncollector::DataPoint::SOURCE] = sourceHost;
447  jsn[jsoncollector::DataPoint::DEFINITION] = sOutDef.str();
448  jsn[jsoncollector::DataPoint::DATA].append(jsnProcessed);
449  jsn[jsoncollector::DataPoint::DATA].append(jsnAccepted);
450  jsn[jsoncollector::DataPoint::DATA].append(jsnErrorEvents);
451  jsn[jsoncollector::DataPoint::DATA].append(jsnRetCodeMask);
452  jsn[jsoncollector::DataPoint::DATA].append(jsndataFileList);
453  jsn[jsoncollector::DataPoint::DATA].append(jsndataSize);
454  jsn[jsoncollector::DataPoint::DATA].append(jsnInputFiles);
455  jsn[jsoncollector::DataPoint::DATA].append(jsndataAdler32);
456  jsn[jsoncollector::DataPoint::DATA].append(rundata.streamDestination);
457  jsn[jsoncollector::DataPoint::DATA].append(rundata.streamMergeType);
458  jsn[jsoncollector::DataPoint::DATA].append(jsnHLTErrorEvents);
459 
460  auto jsnFileName = boost::format("run%06d_ls%04d_streamHLTRates_pid%05d.jsn") % run % ls % getpid();
461  std::ofstream jsnFile( rundata.baseRunDir + "/" + jsnFileName.str() );
462  jsnFile << writer.write(jsn);
463  jsnFile.close();
464 }
static const std::string SOURCE
Definition: DataPoint.h:121
bool shouldWriteFiles(unsigned int lumi, unsigned int *proc=0)
Value & append(const Value &value)
Append value to array at the end.
jsoncollector::HistoJ< unsigned int > hltReject
Represents a JSON value.
Definition: value.h:111
virtual Json::Value toJsonValue() const
jsoncollector::HistoJ< unsigned int > hltErrors
std::vector< T > & value()
static const std::string DATA
Definition: DataPoint.h:123
jsoncollector::HistoJ< unsigned int > hltPre
format
Some error handling for the usage.
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
def ls(path, rec=False)
Definition: eostools.py:348
jsoncollector::HistoJ< unsigned int > hltWasRun
jsoncollector::HistoJ< unsigned int > hltL1s
jsoncollector::HistoJ< unsigned int > processed
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:65
static const std::string DEFINITION
Definition: DataPoint.h:122
jsoncollector::HistoJ< unsigned int > datasets
jsoncollector::HistoJ< unsigned int > hltAccept
void HLTriggerJSONMonitoring::globalEndRun ( edm::Run const &  ,
edm::EventSetup const &   
) const
override

Definition at line 234 of file HLTriggerJSONMonitoring.cc.

235 {
236 }
void HLTriggerJSONMonitoring::streamBeginLuminosityBlock ( edm::StreamID  sid,
edm::LuminosityBlock const &  lumi,
edm::EventSetup const &   
) const
override

Definition at line 329 of file HLTriggerJSONMonitoring.cc.

References edmIntegrityCheck::datasets, edm::LuminosityBlock::getRun(), edm::Run::index(), and lumiPlot::rundata.

330 {
331  auto & stream = * streamCache(sid);
332 
333  unsigned int triggers = 0;
334  unsigned int datasets = 0;
335  auto const& rundata = * runCache(lumi.getRun().index());
336  if (rundata.hltConfig.inited()) {
337  triggers = rundata.hltConfig.triggerNames().size();
338  datasets = rundata.hltConfig.datasetNames().size();
339  };
340 
341  // reset the stream counters
342  stream.processed = 0;
343  stream.hltWasRun.assign(triggers, 0);
344  stream.hltL1s.assign(triggers, 0);
345  stream.hltPre.assign(triggers, 0);
346  stream.hltAccept.assign(triggers, 0);
347  stream.hltReject.assign(triggers, 0);
348  stream.hltErrors.assign(triggers, 0);
349  stream.datasets.assign(datasets, 0);
350 }
void HLTriggerJSONMonitoring::streamEndLuminosityBlockSummary ( edm::StreamID  sid,
edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  ,
HLTriggerJSONMonitoringData::lumisection lumidata 
) const
override

Definition at line 354 of file HLTriggerJSONMonitoring.cc.

References edmIntegrityCheck::datasets, HLTriggerJSONMonitoringData::lumisection::datasets, edm::LuminosityBlock::getRun(), HLTriggerJSONMonitoringData::lumisection::hltAccept, HLTriggerJSONMonitoringData::lumisection::hltErrors, HLTriggerJSONMonitoringData::lumisection::hltL1s, HLTriggerJSONMonitoringData::lumisection::hltPre, HLTriggerJSONMonitoringData::lumisection::hltReject, HLTriggerJSONMonitoringData::lumisection::hltWasRun, mps_fire::i, edm::Run::index(), HLTriggerJSONMonitoringData::lumisection::processed, lumiPlot::rundata, and jsoncollector::HistoJ< T >::value().

355 {
356  auto const& stream = * streamCache(sid);
357  auto const& rundata = * runCache(lumi.getRun().index());
358  lumidata->processed.value()[0] += stream.processed;
359 
360  // check that the HLTConfigProvider for the current run has been successfully initialised
361  if (not rundata.hltConfig.inited())
362  return;
363 
364  unsigned int triggers = rundata.hltConfig.triggerNames().size();
365  for (unsigned int i = 0; i < triggers; ++i) {
366  lumidata->hltWasRun.value()[i] += stream.hltWasRun[i];
367  lumidata->hltL1s.value()[i] += stream.hltL1s[i];
368  lumidata->hltPre.value()[i] += stream.hltPre[i];
369  lumidata->hltAccept.value()[i] += stream.hltAccept[i];
370  lumidata->hltReject.value()[i] += stream.hltReject[i];
371  lumidata->hltErrors.value()[i] += stream.hltErrors[i];
372  }
373  unsigned int datasets = rundata.hltConfig.datasetNames().size();
374  for (unsigned int i = 0; i < datasets; ++i)
375  lumidata->datasets.value()[i] += stream.datasets[i];
376 }
jsoncollector::HistoJ< unsigned int > hltReject
jsoncollector::HistoJ< unsigned int > hltErrors
std::vector< T > & value()
jsoncollector::HistoJ< unsigned int > hltPre
jsoncollector::HistoJ< unsigned int > hltWasRun
jsoncollector::HistoJ< unsigned int > hltL1s
jsoncollector::HistoJ< unsigned int > processed
jsoncollector::HistoJ< unsigned int > datasets
jsoncollector::HistoJ< unsigned int > hltAccept
void HLTriggerJSONMonitoring::writeIniFile ( HLTriggerJSONMonitoringData::run const &  rundata,
unsigned int  run 
)
staticprivate

Definition at line 488 of file HLTriggerJSONMonitoring.cc.

References Json::Value::append(), Json::arrayValue, HLTriggerJSONMonitoringData::run::baseRunDir, ws_sso_content_reader::content, makeLayoutFileForGui::datasetNames, HLTConfigProvider::datasetNames(), DEFINE_FWK_MODULE, FrontierConditions_GlobalTag_cff::file, cmsPerfStripChart::format, HLTriggerJSONMonitoringData::run::hltConfig, dataset::name, harvestTrackValidationPlots::str, AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::triggerNames(), Json::StyledWriter::write(), and cscNeutronWriter_cfi::writer.

Referenced by globalBeginRun().

489 {
491 
492  Json::Value triggerNames(Json::arrayValue);
493  for (auto const& name: rundata.hltConfig.triggerNames())
494  triggerNames.append(name);
495  content["Path-Names"] = triggerNames;
496 
498  for (auto const& name : rundata.hltConfig.datasetNames())
499  datasetNames.append(name);
500  content["Dataset-Names"] = datasetNames;
501 
502  std::string iniFileName = (boost::format("run%06d_ls0000_streamHLTRates_pid%05d.ini") % run % getpid()).str();
503  std::ofstream file(rundata.baseRunDir + "/" + iniFileName);
505  file << writer.write(content);
506  file.close();
507 }
Represents a JSON value.
Definition: value.h:111
format
Some error handling for the usage.
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:65
array value (ordered list)
Definition: value.h:31
void HLTriggerJSONMonitoring::writeJsdFile ( HLTriggerJSONMonitoringData::run const &  rundata)
staticprivate

Definition at line 468 of file HLTriggerJSONMonitoring.cc.

References HLTriggerJSONMonitoringData::run::baseRunDir, FrontierConditions_GlobalTag_cff::file, and HLTriggerJSONMonitoringData::run::jsdFileName.

Referenced by globalBeginRun().

469 {
470  std::ofstream file(rundata.baseRunDir + "/" + rundata.jsdFileName);
471  file << R"""({
472  "data" : [
473  { "name" : "Processed", "type" : "integer", "operation" : "histo"},
474  { "name" : "Path-WasRun", "type" : "integer", "operation" : "histo"},
475  { "name" : "Path-AfterL1Seed", "type" : "integer", "operation" : "histo"},
476  { "name" : "Path-AfterPrescale", "type" : "integer", "operation" : "histo"},
477  { "name" : "Path-Accepted", "type" : "integer", "operation" : "histo"},
478  { "name" : "Path-Rejected", "type" : "integer", "operation" : "histo"},
479  { "name" : "Path-Errors", "type" : "integer", "operation" : "histo"},
480  { "name" : "Dataset-Accepted", "type" : "integer", "operation" : "histo"}
481  ]
482 }
483 )""";
484  file.close();
485 }

Member Data Documentation

const char* HLTriggerJSONMonitoring::streamName_ = "streamHLTRates"
staticprivate

Definition at line 126 of file HLTriggerJSONMonitoring.cc.

const edm::InputTag HLTriggerJSONMonitoring::triggerResults_
private

Definition at line 132 of file HLTriggerJSONMonitoring.cc.

Referenced by analyze(), and globalBeginRun().

const edm::EDGetTokenT<edm::TriggerResults> HLTriggerJSONMonitoring::triggerResultsToken_
private

Definition at line 133 of file HLTriggerJSONMonitoring.cc.

Referenced by analyze().