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 76 of file HLTriggerJSONMonitoring.cc.

Constructor & Destructor Documentation

◆ HLTriggerJSONMonitoring()

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

Definition at line 144 of file HLTriggerJSONMonitoring.cc.

145  : 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 261 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_.

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

156  {
157  return std::make_unique<HLTriggerJSONMonitoringData::stream>();
158 }

◆ fillDescriptions()

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

Definition at line 149 of file HLTriggerJSONMonitoring.cc.

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

149  {
151  desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "@currentProcess"));
152  descriptions.add("HLTriggerJSONMonitoring", desc);
153 }
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 315 of file HLTriggerJSONMonitoring.cc.

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

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

◆ globalBeginRun()

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

Definition at line 161 of file HLTriggerJSONMonitoring.cc.

References makeLayoutFileForGui::datasetNames, datasetPathNamePrefix_, contentValuesFiles::datasets, spr::find(), mps_fire::i, edm::Service< T >::isAvailable(), dqmiolumiharvest::j, label, 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().

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

412  {
413  unsigned int ls = lumi.luminosityBlock();
414  unsigned int run = lumi.run();
415 
416  bool writeFiles = true;
417  if (edm::Service<evf::MicroStateService>().isAvailable()) {
420  if (fms)
421  writeFiles = fms->shouldWriteFiles(ls);
422  }
423  if (not writeFiles)
424  return;
425 
426  unsigned int processed = lumidata->processed.value().at(0);
427  auto const& rundata = *runCache(lumi.getRun().index());
429 
430  // [SIC]
431  char hostname[33];
432  gethostname(hostname, 32);
433  std::string sourceHost(hostname);
434 
435  // [SIC]
436  std::stringstream sOutDef;
437  sOutDef << rundata.baseRunDir << "/"
438  << "output_" << getpid() << ".jsd";
439 
440  std::string jsndataFileList = "";
441  unsigned int jsndataSize = 0;
442  unsigned int jsndataAdler32 = 1; // adler32 checksum for an empty file
443 
444  if (processed) {
445  // write the .jsndata files which contain the actual rates
446  Json::Value jsndata;
447  jsndata[jsoncollector::DataPoint::SOURCE] = sourceHost;
448  jsndata[jsoncollector::DataPoint::DEFINITION] = rundata.jsdFileName;
457 
458  auto jsndataFileName = fmt::sprintf("run%06d_ls%04d_streamHLTRates_pid%05d.jsndata", run, ls, getpid());
459 
460  std::string result = writer.write(jsndata);
461  std::ofstream jsndataFile(rundata.baseRunDir + "/" + jsndataFileName);
462  jsndataFile << result;
463  jsndataFile.close();
464 
465  jsndataFileList = jsndataFileName;
466  jsndataSize = result.size();
467  jsndataAdler32 = cms::Adler32(result.c_str(), result.size());
468  }
469 
470  // create a metadata json file for the "HLT rates" pseudo-stream
471  unsigned int jsnProcessed = processed;
472  unsigned int jsnAccepted = processed;
473  unsigned int jsnErrorEvents = 0;
474  unsigned int jsnRetCodeMask = 0;
475  std::string jsnInputFiles = "";
476  unsigned int jsnHLTErrorEvents = 0;
477 
478  Json::Value jsn;
479  jsn[jsoncollector::DataPoint::SOURCE] = sourceHost;
480  jsn[jsoncollector::DataPoint::DEFINITION] = sOutDef.str();
481  jsn[jsoncollector::DataPoint::DATA].append(jsnProcessed);
482  jsn[jsoncollector::DataPoint::DATA].append(jsnAccepted);
483  jsn[jsoncollector::DataPoint::DATA].append(jsnErrorEvents);
484  jsn[jsoncollector::DataPoint::DATA].append(jsnRetCodeMask);
485  jsn[jsoncollector::DataPoint::DATA].append(jsndataFileList);
486  jsn[jsoncollector::DataPoint::DATA].append(jsndataSize);
487  jsn[jsoncollector::DataPoint::DATA].append(jsnInputFiles);
488  jsn[jsoncollector::DataPoint::DATA].append(jsndataAdler32);
489  jsn[jsoncollector::DataPoint::DATA].append(rundata.streamDestination);
490  jsn[jsoncollector::DataPoint::DATA].append(rundata.streamMergeType);
491  jsn[jsoncollector::DataPoint::DATA].append(jsnHLTErrorEvents);
492 
493  auto jsnFileName = fmt::sprintf("run%06d_ls%04d_streamHLTRates_pid%05d.jsn", run, ls, getpid());
494  std::ofstream jsnFile(rundata.baseRunDir + "/" + jsnFileName);
495  jsnFile << writer.write(jsn);
496  jsnFile.close();
497 }
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
jsoncollector::HistoJ< unsigned int > hltPre
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 > hltL1s
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

◆ globalEndRun()

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

Definition at line 258 of file HLTriggerJSONMonitoring.cc.

258 {}

◆ streamBeginLuminosityBlock()

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

Definition at line 358 of file HLTriggerJSONMonitoring.cc.

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

360  {
361  auto& stream = *streamCache(sid);
362 
363  unsigned int triggers = 0;
364  unsigned int datasets = 0;
365  auto const& rundata = *runCache(lumi.getRun().index());
366  if (rundata.hltConfig.inited()) {
367  triggers = rundata.indicesOfTriggerPaths.size();
368  datasets = rundata.hltConfig.datasetNames().size();
369  };
370 
371  // reset the stream counters
372  stream.processed = 0;
373  stream.hltWasRun.assign(triggers, 0);
374  stream.hltL1s.assign(triggers, 0);
375  stream.hltPre.assign(triggers, 0);
376  stream.hltAccept.assign(triggers, 0);
377  stream.hltReject.assign(triggers, 0);
378  stream.hltErrors.assign(triggers, 0);
379  stream.datasets.assign(datasets, 0);
380 }
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 383 of file HLTriggerJSONMonitoring.cc.

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

386  {
387  auto const& stream = *streamCache(sid);
388  auto const& rundata = *runCache(lumi.getRun().index());
389  lumidata->processed.value()[0] += stream.processed;
390 
391  // check that the HLTConfigProvider for the current run has been successfully initialised
392  if (not rundata.hltConfig.inited())
393  return;
394 
395  auto const triggers = rundata.indicesOfTriggerPaths.size();
396  for (auto i = 0u; i < triggers; ++i) {
397  lumidata->hltWasRun.value()[i] += stream.hltWasRun[i];
398  lumidata->hltL1s.value()[i] += stream.hltL1s[i];
399  lumidata->hltPre.value()[i] += stream.hltPre[i];
400  lumidata->hltAccept.value()[i] += stream.hltAccept[i];
401  lumidata->hltReject.value()[i] += stream.hltReject[i];
402  lumidata->hltErrors.value()[i] += stream.hltErrors[i];
403  }
404  auto const datasets = rundata.hltConfig.datasetNames().size();
405  for (auto i = 0u; i < datasets; ++i)
406  lumidata->datasets.value()[i] += stream.datasets[i];
407 }
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 > 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

◆ writeIniFile()

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

Definition at line 517 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().

517  {
519 
521  for (auto idx : rundata.indicesOfTriggerPaths)
522  triggerNames.append(rundata.hltConfig.triggerNames()[idx]);
523  content["Path-Names"] = triggerNames;
524 
526  for (auto const& name : rundata.hltConfig.datasetNames())
527  datasetNames.append(name);
528  content["Dataset-Names"] = datasetNames;
529 
530  std::string iniFileName = fmt::sprintf("run%06d_ls0000_streamHLTRates_pid%05d.ini", run, getpid());
531  std::ofstream file(rundata.baseRunDir + "/" + iniFileName);
533  file << writer.write(content);
534  file.close();
535 }
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 499 of file HLTriggerJSONMonitoring.cc.

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

Referenced by globalBeginRun().

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

Member Data Documentation

◆ datasetPathNamePrefix_

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

Definition at line 133 of file HLTriggerJSONMonitoring.cc.

Referenced by globalBeginRun().

◆ streamName_

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

Definition at line 131 of file HLTriggerJSONMonitoring.cc.

Referenced by globalBeginRun().

◆ triggerResults_

const edm::InputTag HLTriggerJSONMonitoring::triggerResults_
private

Definition at line 139 of file HLTriggerJSONMonitoring.cc.

Referenced by analyze(), and globalBeginRun().

◆ triggerResultsToken_

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

Definition at line 140 of file HLTriggerJSONMonitoring.cc.

Referenced by analyze().