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
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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 constexpr const char * datasetPathNamePrefix_ = "Dataset_"
 
static constexpr 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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: This class outputs JSON files with HLT monitoring information.

Definition at line 81 of file HLTriggerJSONMonitoring.cc.

Constructor & Destructor Documentation

◆ HLTriggerJSONMonitoring()

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

Definition at line 149 of file HLTriggerJSONMonitoring.cc.

150  : triggerResults_(config.getParameter<edm::InputTag>("triggerResults")),
Definition: config.py:1
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::InputTag triggerResults_

◆ ~HLTriggerJSONMonitoring()

HLTriggerJSONMonitoring::~HLTriggerJSONMonitoring ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::global::EDAnalyzerBase.

Definition at line 265 of file HLTriggerJSONMonitoring.cc.

References cms::cuda::assert(), edm::InputTag::encode(), patZpeak::handle, mps_fire::i, heavyIonCSV_trainingSettings::idx, createfilelist::int, or, castor_dqm_sourceclient_file_cfg::path, bookConverter::results, mps_update::status, cms::cuda::stream, triggerResults_, and triggerResultsToken_.

265  {
266  auto& stream = *streamCache(sid);
267  auto const& rundata = *runCache(event.getRun().index());
268 
269  ++stream.processed;
270 
271  // check that the HLTConfigProvider for the current run has been successfully initialised
272  if (not rundata.hltConfig.inited())
273  return;
274 
275  // get hold of TriggerResults
277  if (not event.getByToken(triggerResultsToken_, handle) or not handle.isValid()) {
278  edm::LogError("HLTriggerJSONMonitoring")
279  << "TriggerResults with label [" + triggerResults_.encode() + "] not present or invalid";
280  return;
281  }
283  assert(results.size() == rundata.hltConfig.triggerNames().size());
284 
285  // check the results for each HLT path
286  for (auto idx = 0u; idx < rundata.indicesOfTriggerPaths.size(); ++idx) {
287  auto const triggerPathIdx = rundata.indicesOfTriggerPaths[idx];
288  auto const& status = results[triggerPathIdx];
289  if (status.wasrun()) {
290  ++stream.hltWasRun[idx];
291  if (status.accept()) {
292  ++stream.hltPrePS[idx];
293  ++stream.hltPostPS[idx];
294  ++stream.hltAccept[idx];
295  } else {
296  int const index = (int)status.index();
297  if (index >= rundata.posPre[idx])
298  ++stream.hltPrePS[idx];
299  if (index > rundata.posPre[idx])
300  ++stream.hltPostPS[idx];
301  if (status.error())
302  ++stream.hltErrors[idx];
303  else
304  ++stream.hltReject[idx];
305  }
306  }
307  }
308 
309  // check the decision for each dataset
310  // FIXME this ignores the prescales, "smart" prescales, and event selection applied in the OutputModule itself
311  for (auto i = 0u; i < rundata.datasets.size(); ++i)
312  if (std::any_of(rundata.datasets[i].begin(), rundata.datasets[i].end(), [&](unsigned int path) {
313  return results.accept(path);
314  }))
315  ++stream.datasets[i];
316 }
std::string encode() const
Definition: InputTag.cc:159
Log< level::Error, false > LogError
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
assert(be >=bs)
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
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
const edm::InputTag triggerResults_
Definition: event.py:1

◆ beginStream()

std::unique_ptr< HLTriggerJSONMonitoringData::stream > HLTriggerJSONMonitoring::beginStream ( edm::StreamID  ) const
override

Definition at line 161 of file HLTriggerJSONMonitoring.cc.

161  {
162  return std::make_unique<HLTriggerJSONMonitoringData::stream>();
163 }

◆ fillDescriptions()

void HLTriggerJSONMonitoring::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 154 of file HLTriggerJSONMonitoring.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_2022v14_cff::InputTag.

154  {
156  desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "@currentProcess"));
157  descriptions.add("HLTriggerJSONMonitoring", desc);
158 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ globalBeginLuminosityBlockSummary()

std::shared_ptr< HLTriggerJSONMonitoringData::lumisection > HLTriggerJSONMonitoring::globalBeginLuminosityBlockSummary ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &   
) const
override

Definition at line 319 of file HLTriggerJSONMonitoring.cc.

References contentValuesFiles::datasets, and mps_fire::i.

320  {
321  unsigned int triggers = 0;
322  unsigned int datasets = 0;
323  auto const& rundata = *runCache(lumi.getRun().index());
324  if (rundata.hltConfig.inited()) {
325  triggers = rundata.indicesOfTriggerPaths.size();
326  datasets = rundata.hltConfig.datasetNames().size();
327  };
328 
329  // the API of jsoncollector::HistoJ does not really match our use case,
330  // but it is the only vector-like object available in JsonMonitorable.h
331  auto lumidata = std::make_shared<HLTriggerJSONMonitoringData::lumisection>(HLTriggerJSONMonitoringData::lumisection{
332  jsoncollector::HistoJ<unsigned int>(1), // processed
333  jsoncollector::HistoJ<unsigned int>(triggers), // hltWasRun
334  jsoncollector::HistoJ<unsigned int>(triggers), // hltPrePS
335  jsoncollector::HistoJ<unsigned int>(triggers), // hltPostPS
336  jsoncollector::HistoJ<unsigned int>(triggers), // hltAccept
337  jsoncollector::HistoJ<unsigned int>(triggers), // hltReject
338  jsoncollector::HistoJ<unsigned int>(triggers), // hltErrors
340  });
341  // repeated calls to `update` necessary to set the internal element counter
342  lumidata->processed.update(0);
343  for (unsigned int i = 0; i < triggers; ++i)
344  lumidata->hltWasRun.update(0);
345  for (unsigned int i = 0; i < triggers; ++i)
346  lumidata->hltPrePS.update(0);
347  for (unsigned int i = 0; i < triggers; ++i)
348  lumidata->hltPostPS.update(0);
349  for (unsigned int i = 0; i < triggers; ++i)
350  lumidata->hltAccept.update(0);
351  for (unsigned int i = 0; i < triggers; ++i)
352  lumidata->hltReject.update(0);
353  for (unsigned int i = 0; i < triggers; ++i)
354  lumidata->hltErrors.update(0);
355  for (unsigned int i = 0; i < datasets; ++i)
356  lumidata->datasets.update(0);
357 
358  return lumidata;
359 }

◆ globalBeginRun()

std::shared_ptr< HLTriggerJSONMonitoringData::run > HLTriggerJSONMonitoring::globalBeginRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
) const
override

Definition at line 166 of file HLTriggerJSONMonitoring.cc.

References makeLayoutFileForGui::datasetNames, datasetPathNamePrefix_, contentValuesFiles::datasets, spr::find(), mps_fire::i, edm::Service< T >::isAvailable(), dqmiolumiharvest::j, evf::MergeTypeJSNDATA, AlCaHLTBitMon_ParallelJobs::p, Skims_PA_cff::paths, edm::InputTag::process(), writedatasetfile::run, singleTopDQM_cfi::setup, streamName_, L1TEGammaOffline_cfi::triggerNames, triggerResults_, writeIniFile(), and writeJsdFile().

167  {
168  auto rundata = std::make_shared<HLTriggerJSONMonitoringData::run>();
169 
170  // set the DAQ parameters
172  rundata->streamDestination = edm::Service<evf::EvFDaqDirector>()->getStreamDestinations(streamName_);
173  rundata->streamMergeType =
175  rundata->baseRunDir = edm::Service<evf::EvFDaqDirector>()->baseRunDir();
176  } else {
177  rundata->streamDestination = "";
178  rundata->streamMergeType = "";
179  rundata->baseRunDir = ".";
180  }
181 
182  // initialize HLTConfigProvider
183  bool changed = true;
184  if (not rundata->hltConfig.init(run, setup, triggerResults_.process(), changed)) {
185  edm::LogError("HLTriggerJSONMonitoring") << "HLTConfigProvider initialization failed!";
186  } else if (changed) {
187  // triggerNames from TriggerResults (includes DatasetPaths)
188  auto const& triggerNames = rundata->hltConfig.triggerNames();
189  auto const triggerNamesSize = triggerNames.size();
190 
191  // update the list of indices of the HLT Paths (without DatasetPaths) in the TriggerNames list
192  rundata->indicesOfTriggerPaths.clear();
193  rundata->indicesOfTriggerPaths.reserve(triggerNamesSize);
194  for (auto triggerNameIdx = 0u; triggerNameIdx < triggerNamesSize; ++triggerNameIdx) {
195  // skip DatasetPaths
196  if (triggerNames[triggerNameIdx].find(datasetPathNamePrefix_) != 0) {
197  rundata->indicesOfTriggerPaths.emplace_back(triggerNameIdx);
198  }
199  }
200  auto const triggersSize = rundata->indicesOfTriggerPaths.size();
201 
202  // update the list of paths in each dataset
203  auto const& datasets = rundata->hltConfig.datasetContents();
204  auto const& datasetNames = rundata->hltConfig.datasetNames();
205  auto const datasetsSize = datasetNames.size();
206  rundata->datasets.resize(datasetsSize);
207  for (auto ds = 0u; ds < datasetsSize; ++ds) {
208  auto& dataset = rundata->datasets[ds];
209  // check if TriggerNames include the DatasetPath corresponding to this Dataset
210  // - DatasetPaths are normal cms.Path objects
211  // - in Run-3 HLT menus, DatasetPaths are used to define PrimaryDatasets
212  auto const datasetPathName = datasetPathNamePrefix_ + datasetNames[ds];
213  auto const datasetPathExists =
214  std::find(triggerNames.begin(), triggerNames.end(), datasetPathName) != triggerNames.end();
215  if (datasetPathExists) {
216  // if a DatasetPath exists, only that Path is assigned to the Dataset
217  // - this way, the counts of the Dataset properly include prescales on the DatasetPath
218  // and smart-Prescales applied by the DatasetPath to its triggers
219  dataset.reserve(1);
220  auto const index = rundata->hltConfig.triggerIndex(datasetPathName);
221  if (index < triggerNamesSize)
222  dataset.push_back(index);
223  } else {
224  auto const paths = datasets[ds].size();
225  dataset.reserve(paths);
226  for (auto p = 0u; p < paths; p++) {
227  auto const index = rundata->hltConfig.triggerIndex(datasets[ds][p]);
228  if (index < triggerNamesSize)
229  dataset.push_back(index);
230  }
231  }
232  }
233 
234  // find the positions of the prescale filters
235  rundata->posPre.resize(triggersSize);
236  for (auto i = 0u; i < triggersSize; ++i) {
237  rundata->posPre[i] = -1;
238  auto const trigNameIndx = rundata->indicesOfTriggerPaths[i];
239  auto const& moduleLabels = rundata->hltConfig.moduleLabels(trigNameIndx);
240  for (auto j = 0u; j < moduleLabels.size(); ++j) {
241  auto const& moduleType = rundata->hltConfig.moduleType(moduleLabels[j]);
242  if (moduleType == "HLTPrescaler") {
243  rundata->posPre[i] = j;
244  break;
245  }
246  }
247  }
248  }
249 
250  // write the per-run .jsd file
251  rundata->jsdFileName = fmt::sprintf("run%06d_ls0000_streamHLTRates_pid%05d.jsd", run.run(), getpid());
252  writeJsdFile(*rundata);
253 
254  // write the per-run .ini file
255  //iniFileName = fmt::sprintf("run%06d_ls0000_streamHLTRates_pid%05d.ini", run.run(), getpid());
256  writeIniFile(*rundata, run.run());
257 
258  return rundata;
259 }
static constexpr const char * streamName_
static constexpr const char * datasetPathNamePrefix_
static void writeIniFile(HLTriggerJSONMonitoringData::run const &, unsigned int)
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static void writeJsdFile(HLTriggerJSONMonitoringData::run const &)
const edm::InputTag triggerResults_
bool isAvailable() const
Definition: Service.h:40
std::string const & process() const
Definition: InputTag.h:40

◆ globalEndLuminosityBlockSummary()

void HLTriggerJSONMonitoring::globalEndLuminosityBlockSummary ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  ,
HLTriggerJSONMonitoringData::lumisection lumidata 
) const
override

Definition at line 414 of file HLTriggerJSONMonitoring.cc.

References cms::Adler32(), Json::Value::append(), jsoncollector::DataPoint::DATA, HLTriggerJSONMonitoringData::lumisection::datasets, jsoncollector::DataPoint::DEFINITION, HLTriggerJSONMonitoringData::lumisection::hltAccept, HLTriggerJSONMonitoringData::lumisection::hltErrors, HLTriggerJSONMonitoringData::lumisection::hltPostPS, HLTriggerJSONMonitoringData::lumisection::hltPrePS, HLTriggerJSONMonitoringData::lumisection::hltReject, HLTriggerJSONMonitoringData::lumisection::hltWasRun, eostools::ls(), HLTriggerJSONMonitoringData::lumisection::processed, mps_fire::result, writedatasetfile::run, evf::FastMonitoringService::shouldWriteFiles(), jsoncollector::DataPoint::SOURCE, AlCaHLTBitMon_QueryRunRegistry::string, jsoncollector::HistoJ< T >::toJsonValue(), jsoncollector::HistoJ< T >::value(), and convertToRaw::writer.

416  {
417  unsigned int ls = lumi.luminosityBlock();
418  unsigned int run = lumi.run();
419 
420  bool writeFiles = true;
421  if (edm::Service<evf::MicroStateService>().isAvailable()) {
424  if (fms)
425  writeFiles = fms->shouldWriteFiles(ls);
426  }
427  if (not writeFiles)
428  return;
429 
430  unsigned int processed = lumidata->processed.value().at(0);
431  auto const& rundata = *runCache(lumi.getRun().index());
433 
434  // [SIC]
435  char hostname[33];
436  gethostname(hostname, 32);
437  std::string sourceHost(hostname);
438 
439  // [SIC]
440  std::stringstream sOutDef;
441  sOutDef << rundata.baseRunDir << "/"
442  << "output_" << getpid() << ".jsd";
443 
444  std::string jsndataFileList = "";
445  unsigned int jsndataSize = 0;
446  unsigned int jsndataAdler32 = 1; // adler32 checksum for an empty file
447 
448  if (processed) {
449  // write the .jsndata files which contain the actual rates
450  Json::Value jsndata;
451  jsndata[jsoncollector::DataPoint::SOURCE] = sourceHost;
452  jsndata[jsoncollector::DataPoint::DEFINITION] = rundata.jsdFileName;
461 
462  auto jsndataFileName = fmt::sprintf("run%06d_ls%04d_streamHLTRates_pid%05d.jsndata", run, ls, getpid());
463 
464  std::string result = writer.write(jsndata);
465  std::ofstream jsndataFile(rundata.baseRunDir + "/" + jsndataFileName);
466  jsndataFile << result;
467  jsndataFile.close();
468 
469  jsndataFileList = jsndataFileName;
470  jsndataSize = result.size();
471  jsndataAdler32 = cms::Adler32(result.c_str(), result.size());
472  }
473 
474  // create a metadata json file for the "HLT rates" pseudo-stream
475  unsigned int jsnProcessed = processed;
476  unsigned int jsnAccepted = processed;
477  unsigned int jsnErrorEvents = 0;
478  unsigned int jsnRetCodeMask = 0;
479  std::string jsnInputFiles = "";
480  unsigned int jsnHLTErrorEvents = 0;
481 
482  Json::Value jsn;
483  jsn[jsoncollector::DataPoint::SOURCE] = sourceHost;
484  jsn[jsoncollector::DataPoint::DEFINITION] = sOutDef.str();
485  jsn[jsoncollector::DataPoint::DATA].append(jsnProcessed);
486  jsn[jsoncollector::DataPoint::DATA].append(jsnAccepted);
487  jsn[jsoncollector::DataPoint::DATA].append(jsnErrorEvents);
488  jsn[jsoncollector::DataPoint::DATA].append(jsnRetCodeMask);
489  jsn[jsoncollector::DataPoint::DATA].append(jsndataFileList);
490  jsn[jsoncollector::DataPoint::DATA].append(jsndataSize);
491  jsn[jsoncollector::DataPoint::DATA].append(jsnInputFiles);
492  jsn[jsoncollector::DataPoint::DATA].append(jsndataAdler32);
493  jsn[jsoncollector::DataPoint::DATA].append(rundata.streamDestination);
494  jsn[jsoncollector::DataPoint::DATA].append(rundata.streamMergeType);
495  jsn[jsoncollector::DataPoint::DATA].append(jsnHLTErrorEvents);
496 
497  auto jsnFileName = fmt::sprintf("run%06d_ls%04d_streamHLTRates_pid%05d.jsn", run, ls, getpid());
498  std::ofstream jsnFile(rundata.baseRunDir + "/" + jsnFileName);
499  jsnFile << writer.write(jsn);
500  jsnFile.close();
501 }
static const std::string SOURCE
Definition: DataPoint.h:116
Value & append(const Value &value)
Append value to array at the end.
jsoncollector::HistoJ< unsigned int > hltReject
Represents a JSON value.
Definition: value.h:99
jsoncollector::HistoJ< unsigned int > hltErrors
std::vector< T > & value()
static const std::string DATA
Definition: DataPoint.h:118
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
def ls(path, rec=False)
Definition: eostools.py:349
virtual Json::Value toJsonValue() const
jsoncollector::HistoJ< unsigned int > hltWasRun
jsoncollector::HistoJ< unsigned int > hltPrePS
jsoncollector::HistoJ< unsigned int > processed
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:63
bool shouldWriteFiles(unsigned int lumi, unsigned int *proc=nullptr)
static const std::string DEFINITION
Definition: DataPoint.h:117
jsoncollector::HistoJ< unsigned int > datasets
jsoncollector::HistoJ< unsigned int > hltAccept
jsoncollector::HistoJ< unsigned int > hltPostPS

◆ globalEndRun()

void HLTriggerJSONMonitoring::globalEndRun ( edm::Run const &  ,
edm::EventSetup const &   
) const
override

Definition at line 262 of file HLTriggerJSONMonitoring.cc.

262 {}

◆ streamBeginLuminosityBlock()

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

Definition at line 362 of file HLTriggerJSONMonitoring.cc.

References contentValuesFiles::datasets, and cms::cuda::stream.

364  {
365  auto& stream = *streamCache(sid);
366 
367  unsigned int triggers = 0;
368  unsigned int datasets = 0;
369  auto const& rundata = *runCache(lumi.getRun().index());
370  if (rundata.hltConfig.inited()) {
371  triggers = rundata.indicesOfTriggerPaths.size();
372  datasets = rundata.hltConfig.datasetNames().size();
373  };
374 
375  // reset the stream counters
376  stream.processed = 0;
377  stream.hltWasRun.assign(triggers, 0);
378  stream.hltPrePS.assign(triggers, 0);
379  stream.hltPostPS.assign(triggers, 0);
380  stream.hltAccept.assign(triggers, 0);
381  stream.hltReject.assign(triggers, 0);
382  stream.hltErrors.assign(triggers, 0);
383  stream.datasets.assign(datasets, 0);
384 }
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream

◆ streamEndLuminosityBlockSummary()

void HLTriggerJSONMonitoring::streamEndLuminosityBlockSummary ( edm::StreamID  sid,
edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  ,
HLTriggerJSONMonitoringData::lumisection lumidata 
) const
override

Definition at line 387 of file HLTriggerJSONMonitoring.cc.

References contentValuesFiles::datasets, HLTriggerJSONMonitoringData::lumisection::datasets, HLTriggerJSONMonitoringData::lumisection::hltAccept, HLTriggerJSONMonitoringData::lumisection::hltErrors, HLTriggerJSONMonitoringData::lumisection::hltPostPS, HLTriggerJSONMonitoringData::lumisection::hltPrePS, HLTriggerJSONMonitoringData::lumisection::hltReject, HLTriggerJSONMonitoringData::lumisection::hltWasRun, mps_fire::i, HLTriggerJSONMonitoringData::lumisection::processed, cms::cuda::stream, and jsoncollector::HistoJ< T >::value().

390  {
391  auto const& stream = *streamCache(sid);
392  auto const& rundata = *runCache(lumi.getRun().index());
393  lumidata->processed.value()[0] += stream.processed;
394 
395  // check that the HLTConfigProvider for the current run has been successfully initialised
396  if (not rundata.hltConfig.inited())
397  return;
398 
399  auto const triggers = rundata.indicesOfTriggerPaths.size();
400  for (auto i = 0u; i < triggers; ++i) {
401  lumidata->hltWasRun.value()[i] += stream.hltWasRun[i];
402  lumidata->hltPrePS.value()[i] += stream.hltPrePS[i];
403  lumidata->hltPostPS.value()[i] += stream.hltPostPS[i];
404  lumidata->hltAccept.value()[i] += stream.hltAccept[i];
405  lumidata->hltReject.value()[i] += stream.hltReject[i];
406  lumidata->hltErrors.value()[i] += stream.hltErrors[i];
407  }
408  auto const datasets = rundata.hltConfig.datasetNames().size();
409  for (auto i = 0u; i < datasets; ++i)
410  lumidata->datasets.value()[i] += stream.datasets[i];
411 }
jsoncollector::HistoJ< unsigned int > hltReject
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
jsoncollector::HistoJ< unsigned int > hltErrors
std::vector< T > & value()
jsoncollector::HistoJ< unsigned int > hltWasRun
jsoncollector::HistoJ< unsigned int > hltPrePS
jsoncollector::HistoJ< unsigned int > processed
jsoncollector::HistoJ< unsigned int > datasets
jsoncollector::HistoJ< unsigned int > hltAccept
jsoncollector::HistoJ< unsigned int > hltPostPS

◆ writeIniFile()

void HLTriggerJSONMonitoring::writeIniFile ( HLTriggerJSONMonitoringData::run const &  rundata,
unsigned int  run 
)
staticprivate

Definition at line 521 of file HLTriggerJSONMonitoring.cc.

References Json::arrayValue, HLTriggerJSONMonitoringData::run::baseRunDir, Skims_PA_cff::content, makeLayoutFileForGui::datasetNames, HLTConfigProvider::datasetNames(), geometryDiff::file, HLTriggerJSONMonitoringData::run::hltConfig, heavyIonCSV_trainingSettings::idx, HLTriggerJSONMonitoringData::run::indicesOfTriggerPaths, Skims_PA_cff::name, writedatasetfile::run, AlCaHLTBitMon_QueryRunRegistry::string, L1TEGammaOffline_cfi::triggerNames, HLTConfigProvider::triggerNames(), and convertToRaw::writer.

Referenced by globalBeginRun().

521  {
523 
525  for (auto idx : rundata.indicesOfTriggerPaths)
526  triggerNames.append(rundata.hltConfig.triggerNames()[idx]);
527  content["Path-Names"] = triggerNames;
528 
530  for (auto const& name : rundata.hltConfig.datasetNames())
531  datasetNames.append(name);
532  content["Dataset-Names"] = datasetNames;
533 
534  std::string iniFileName = fmt::sprintf("run%06d_ls0000_streamHLTRates_pid%05d.ini", run, getpid());
535  std::ofstream file(rundata.baseRunDir + "/" + iniFileName);
537  file << writer.write(content);
538  file.close();
539 }
Represents a JSON value.
Definition: value.h:99
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:63
array value (ordered list)
Definition: value.h:30

◆ writeJsdFile()

void HLTriggerJSONMonitoring::writeJsdFile ( HLTriggerJSONMonitoringData::run const &  rundata)
staticprivate

Definition at line 503 of file HLTriggerJSONMonitoring.cc.

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

Referenced by globalBeginRun().

503  {
504  std::ofstream file(rundata.baseRunDir + "/" + rundata.jsdFileName);
505  file << R"""({
506  "data" : [
507  { "name" : "Processed", "type" : "integer", "operation" : "histo"},
508  { "name" : "Path-WasRun", "type" : "integer", "operation" : "histo"},
509  { "name" : "Path-AfterL1Seed", "type" : "integer", "operation" : "histo"},
510  { "name" : "Path-AfterPrescale", "type" : "integer", "operation" : "histo"},
511  { "name" : "Path-Accepted", "type" : "integer", "operation" : "histo"},
512  { "name" : "Path-Rejected", "type" : "integer", "operation" : "histo"},
513  { "name" : "Path-Errors", "type" : "integer", "operation" : "histo"},
514  { "name" : "Dataset-Accepted", "type" : "integer", "operation" : "histo"}
515  ]
516 }
517 )""";
518  file.close();
519 }

Member Data Documentation

◆ datasetPathNamePrefix_

constexpr const char* HLTriggerJSONMonitoring::datasetPathNamePrefix_ = "Dataset_"
staticprivate

Definition at line 138 of file HLTriggerJSONMonitoring.cc.

Referenced by globalBeginRun().

◆ streamName_

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

Definition at line 136 of file HLTriggerJSONMonitoring.cc.

Referenced by globalBeginRun().

◆ triggerResults_

const edm::InputTag HLTriggerJSONMonitoring::triggerResults_
private

Definition at line 144 of file HLTriggerJSONMonitoring.cc.

Referenced by analyze(), and globalBeginRun().

◆ triggerResultsToken_

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

Definition at line 145 of file HLTriggerJSONMonitoring.cc.

Referenced by analyze().