CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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< T > edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
 
std::unique_ptr
< HLTriggerJSONMonitoringData::stream
beginStream (edm::StreamID) const override
 
std::shared_ptr
< HLTriggerJSONMonitoringData::lumisection
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &) const override
 
std::shared_ptr
< HLTriggerJSONMonitoringData::run
globalBeginRun (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< T >
 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::TriggerResults
triggerResultsToken_
 

Static Private Attributes

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< B > consumes (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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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 70 of file HLTriggerJSONMonitoring.cc.

Constructor & Destructor Documentation

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

Definition at line 136 of file HLTriggerJSONMonitoring.cc.

137  : triggerResults_(config.getParameter<edm::InputTag>("triggerResults")),
138  triggerResultsToken_(consumes<edm::TriggerResults>(triggerResults_)) {}
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 227 of file HLTriggerJSONMonitoring.cc.

References edm::HLTGlobalStatus::accept(), cms::cuda::assert(), edm::HLTGlobalStatus::at(), edm::InputTag::encode(), edm::Event::getByToken(), edm::Event::getRun(), patZpeak::handle, mps_fire::i, edm::Run::index(), edm::HandleBase::isValid(), or, fed_dqm_sourceclient-live_cfg::path, bookConverter::results, edm::HLTGlobalStatus::size(), mps_update::status, cms::cuda::stream, triggerResults_, and triggerResultsToken_.

227  {
228  auto& stream = *streamCache(sid);
229  auto const& rundata = *runCache(event.getRun().index());
230 
231  ++stream.processed;
232 
233  // check that the HLTConfigProvider for the current run has been successfully initialised
234  if (not rundata.hltConfig.inited())
235  return;
236 
237  // get hold of TriggerResults
239  if (not event.getByToken(triggerResultsToken_, handle) or not handle.isValid()) {
240  edm::LogError("HLTriggerJSONMonitoring")
241  << "TriggerResults with label [" + triggerResults_.encode() + "] not present or invalid";
242  return;
243  }
245  assert(results.size() == stream.hltWasRun.size());
246 
247  // check the results for each HLT path
248  for (unsigned int i = 0; i < results.size(); ++i) {
249  auto const& status = results.at(i);
250  if (status.wasrun()) {
251  ++stream.hltWasRun[i];
252  if (status.accept()) {
253  ++stream.hltL1s[i];
254  ++stream.hltPre[i];
255  ++stream.hltAccept[i];
256  } else {
257  int index = (int)status.index();
258  if (index > rundata.posL1s[i])
259  ++stream.hltL1s[i];
260  if (index > rundata.posPre[i])
261  ++stream.hltPre[i];
262  if (status.error())
263  ++stream.hltErrors[i];
264  else
265  ++stream.hltReject[i];
266  }
267  }
268  }
269 
270  // check the decision for each dataset
271  // FIXME this ignores the prescales, "smart" prescales, and event selection applied in the OutputModule itself
272  for (unsigned int i = 0; i < rundata.datasets.size(); ++i)
273  if (std::any_of(rundata.datasets[i].begin(), rundata.datasets[i].end(), [&](unsigned int path) {
274  return results.accept(path);
275  }))
276  ++stream.datasets[i];
277 }
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
dictionary results
bool accept() const
Has at least one path accepted the event?
list status
Definition: mps_update.py:107
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)
std::string encode() const
Definition: InputTag.cc:159
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
unsigned int size() const
Get number of paths stored.
tuple handle
Definition: patZpeak.py:23
bool isValid() const
Definition: HandleBase.h:70
const HLTPathStatus & at(const unsigned int i) const
const edm::InputTag triggerResults_
std::unique_ptr< HLTriggerJSONMonitoringData::stream > HLTriggerJSONMonitoring::beginStream ( edm::StreamID  ) const
override

Definition at line 148 of file HLTriggerJSONMonitoring.cc.

148  {
149  return std::make_unique<HLTriggerJSONMonitoringData::stream>();
150 }
void HLTriggerJSONMonitoring::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 141 of file HLTriggerJSONMonitoring.cc.

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

141  {
143  desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "HLT"));
144  descriptions.add("HLTriggerJSONMonitoring", desc);
145 }
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 280 of file HLTriggerJSONMonitoring.cc.

References contentValuesFiles::datasets, edm::LuminosityBlock::getRun(), mps_fire::i, and edm::Run::index().

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

Definition at line 153 of file HLTriggerJSONMonitoring.cc.

References writedatasetfile::dataset, makeLayoutFileForGui::datasetNames, contentValuesFiles::datasets, mps_fire::i, edm::Service< T >::isAvailable(), dqmiolumiharvest::j, label, evf::MergeTypeJSNDATA, AlCaHLTBitMon_ParallelJobs::p, mergeAndRegister::paths, edm::InputTag::process(), edm::RunBase::run(), streamName_, AlCaHLTBitMon_QueryRunRegistry::string, L1TMuonDQMOffline_cfi::triggerNames, triggerResults_, writeIniFile(), and writeJsdFile().

154  {
155  auto rundata = std::make_shared<HLTriggerJSONMonitoringData::run>();
156 
157  // set the DAQ parameters
159  rundata->streamDestination = edm::Service<evf::EvFDaqDirector>()->getStreamDestinations(streamName_);
160  rundata->streamMergeType =
162  rundata->baseRunDir = edm::Service<evf::EvFDaqDirector>()->baseRunDir();
163  } else {
164  rundata->streamDestination = "";
165  rundata->streamMergeType = "";
166  rundata->baseRunDir = ".";
167  }
168 
169  // initialize HLTConfigProvider
170  bool changed = true;
171  if (not rundata->hltConfig.init(run, setup, triggerResults_.process(), changed)) {
172  edm::LogError("HLTriggerJSONMonitoring") << "HLTConfigProvider initialization failed!" << std::endl;
173  } else if (changed) {
174  // update the trigger and dataset names
175  auto const& triggerNames = rundata->hltConfig.triggerNames();
176  auto const& datasetNames = rundata->hltConfig.datasetNames();
177  auto const& datasets = rundata->hltConfig.datasetContents();
178 
179  const unsigned int triggersSize = triggerNames.size();
180  const unsigned int datasetsSize = datasetNames.size();
181 
182  // extract the definition of the datasets
183  rundata->datasets.resize(datasetsSize);
184  for (unsigned int ds = 0; ds < datasetsSize; ++ds) {
185  auto& dataset = rundata->datasets[ds];
186  unsigned int paths = datasets[ds].size();
187  dataset.reserve(paths);
188  for (unsigned int p = 0; p < paths; p++) {
189  unsigned int index = rundata->hltConfig.triggerIndex(datasets[ds][p]);
190  if (index < triggersSize)
191  dataset.push_back(index);
192  }
193  }
194 
195  // find the positions of the L1 seed and prescale filters
196  rundata->posL1s.resize(triggersSize);
197  rundata->posPre.resize(triggersSize);
198  for (unsigned int i = 0; i < triggersSize; ++i) {
199  rundata->posL1s[i] = -1;
200  rundata->posPre[i] = -1;
201  std::vector<std::string> const& moduleLabels = rundata->hltConfig.moduleLabels(i);
202  for (unsigned int j = 0; j < moduleLabels.size(); ++j) {
203  std::string const& label = rundata->hltConfig.moduleType(moduleLabels[j]);
204  if (label == "HLTL1TSeed")
205  rundata->posL1s[i] = j;
206  else if (label == "HLTPrescaler")
207  rundata->posPre[i] = j;
208  }
209  }
210  }
211 
212  // write the per-run .jsd file
213  rundata->jsdFileName = fmt::sprintf("run%06d_ls0000_streamHLTRates_pid%05d.jsd", run.run(), getpid());
214  writeJsdFile(*rundata);
215 
216  // write the per-run .ini file
217  //iniFileName = fmt::sprintf("run%06d_ls0000_streamHLTRates_pid%05d.ini", run.run(), getpid());
218  writeIniFile(*rundata, run.run());
219 
220  return rundata;
221 }
static constexpr const char * streamName_
static void writeIniFile(HLTriggerJSONMonitoringData::run const &, unsigned int)
Log< level::Error, false > LogError
char const * label
bool isAvailable() const
Definition: Service.h:40
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 375 of file HLTriggerJSONMonitoring.cc.

References cms::Adler32(), Json::Value::append(), jsoncollector::DataPoint::DATA, HLTriggerJSONMonitoringData::lumisection::datasets, jsoncollector::DataPoint::DEFINITION, 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(), submitPVValidationJobs::run, evf::FastMonitoringService::shouldWriteFiles(), jsoncollector::DataPoint::SOURCE, AlCaHLTBitMon_QueryRunRegistry::string, jsoncollector::HistoJ< T >::toJsonValue(), and jsoncollector::HistoJ< T >::value().

377  {
378  unsigned int ls = lumi.luminosityBlock();
379  unsigned int run = lumi.run();
380 
381  bool writeFiles = true;
382  if (edm::Service<evf::MicroStateService>().isAvailable()) {
385  if (fms)
386  writeFiles = fms->shouldWriteFiles(ls);
387  }
388  if (not writeFiles)
389  return;
390 
391  unsigned int processed = lumidata->processed.value().at(0);
392  auto const& rundata = *runCache(lumi.getRun().index());
393  Json::StyledWriter writer;
394 
395  // [SIC]
396  char hostname[33];
397  gethostname(hostname, 32);
398  std::string sourceHost(hostname);
399 
400  // [SIC]
401  std::stringstream sOutDef;
402  sOutDef << rundata.baseRunDir << "/"
403  << "output_" << getpid() << ".jsd";
404 
405  std::string jsndataFileList = "";
406  unsigned int jsndataSize = 0;
407  unsigned int jsndataAdler32 = 1; // adler32 checksum for an empty file
408 
409  if (processed) {
410  // write the .jsndata files which contain the actual rates
411  Json::Value jsndata;
412  jsndata[jsoncollector::DataPoint::SOURCE] = sourceHost;
413  jsndata[jsoncollector::DataPoint::DEFINITION] = rundata.jsdFileName;
422 
423  auto jsndataFileName = fmt::sprintf("run%06d_ls%04d_streamHLTRates_pid%05d.jsndata", run, ls, getpid());
424 
425  std::string result = writer.write(jsndata);
426  std::ofstream jsndataFile(rundata.baseRunDir + "/" + jsndataFileName);
427  jsndataFile << result;
428  jsndataFile.close();
429 
430  jsndataFileList = jsndataFileName;
431  jsndataSize = result.size();
432  jsndataAdler32 = cms::Adler32(result.c_str(), result.size());
433  }
434 
435  // create a metadata json file for the "HLT rates" pseudo-stream
436  unsigned int jsnProcessed = processed;
437  unsigned int jsnAccepted = processed;
438  unsigned int jsnErrorEvents = 0;
439  unsigned int jsnRetCodeMask = 0;
440  std::string jsnInputFiles = "";
441  unsigned int jsnHLTErrorEvents = 0;
442 
443  Json::Value jsn;
444  jsn[jsoncollector::DataPoint::SOURCE] = sourceHost;
445  jsn[jsoncollector::DataPoint::DEFINITION] = sOutDef.str();
446  jsn[jsoncollector::DataPoint::DATA].append(jsnProcessed);
447  jsn[jsoncollector::DataPoint::DATA].append(jsnAccepted);
448  jsn[jsoncollector::DataPoint::DATA].append(jsnErrorEvents);
449  jsn[jsoncollector::DataPoint::DATA].append(jsnRetCodeMask);
450  jsn[jsoncollector::DataPoint::DATA].append(jsndataFileList);
451  jsn[jsoncollector::DataPoint::DATA].append(jsndataSize);
452  jsn[jsoncollector::DataPoint::DATA].append(jsnInputFiles);
453  jsn[jsoncollector::DataPoint::DATA].append(jsndataAdler32);
454  jsn[jsoncollector::DataPoint::DATA].append(rundata.streamDestination);
455  jsn[jsoncollector::DataPoint::DATA].append(rundata.streamMergeType);
456  jsn[jsoncollector::DataPoint::DATA].append(jsnHLTErrorEvents);
457 
458  auto jsnFileName = fmt::sprintf("run%06d_ls%04d_streamHLTRates_pid%05d.jsn", run, ls, getpid());
459  std::ofstream jsnFile(rundata.baseRunDir + "/" + jsnFileName);
460  jsnFile << writer.write(jsn);
461  jsnFile.close();
462 }
static const std::string SOURCE
Definition: DataPoint.h:116
def ls
Definition: eostools.py:349
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
virtual Json::Value toJsonValue() const
jsoncollector::HistoJ< unsigned int > hltErrors
std::vector< T > & value()
tuple result
Definition: mps_fire.py:311
static const std::string DATA
Definition: DataPoint.h:118
jsoncollector::HistoJ< unsigned int > hltPre
list lumi
Definition: dqmdumpme.py:53
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
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
void HLTriggerJSONMonitoring::globalEndRun ( edm::Run const &  ,
edm::EventSetup const &   
) const
override

Definition at line 224 of file HLTriggerJSONMonitoring.cc.

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

Definition at line 323 of file HLTriggerJSONMonitoring.cc.

References contentValuesFiles::datasets, edm::LuminosityBlock::getRun(), edm::Run::index(), and cms::cuda::stream.

325  {
326  auto& stream = *streamCache(sid);
327 
328  unsigned int triggers = 0;
329  unsigned int datasets = 0;
330  auto const& rundata = *runCache(lumi.getRun().index());
331  if (rundata.hltConfig.inited()) {
332  triggers = rundata.hltConfig.triggerNames().size();
333  datasets = rundata.hltConfig.datasetNames().size();
334  };
335 
336  // reset the stream counters
337  stream.processed = 0;
338  stream.hltWasRun.assign(triggers, 0);
339  stream.hltL1s.assign(triggers, 0);
340  stream.hltPre.assign(triggers, 0);
341  stream.hltAccept.assign(triggers, 0);
342  stream.hltReject.assign(triggers, 0);
343  stream.hltErrors.assign(triggers, 0);
344  stream.datasets.assign(datasets, 0);
345 }
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
list lumi
Definition: dqmdumpme.py:53
void HLTriggerJSONMonitoring::streamEndLuminosityBlockSummary ( edm::StreamID  sid,
edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  ,
HLTriggerJSONMonitoringData::lumisection lumidata 
) const
override

Definition at line 348 of file HLTriggerJSONMonitoring.cc.

References contentValuesFiles::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, cms::cuda::stream, and jsoncollector::HistoJ< T >::value().

351  {
352  auto const& stream = *streamCache(sid);
353  auto const& rundata = *runCache(lumi.getRun().index());
354  lumidata->processed.value()[0] += stream.processed;
355 
356  // check that the HLTConfigProvider for the current run has been successfully initialised
357  if (not rundata.hltConfig.inited())
358  return;
359 
360  unsigned int triggers = rundata.hltConfig.triggerNames().size();
361  for (unsigned int i = 0; i < triggers; ++i) {
362  lumidata->hltWasRun.value()[i] += stream.hltWasRun[i];
363  lumidata->hltL1s.value()[i] += stream.hltL1s[i];
364  lumidata->hltPre.value()[i] += stream.hltPre[i];
365  lumidata->hltAccept.value()[i] += stream.hltAccept[i];
366  lumidata->hltReject.value()[i] += stream.hltReject[i];
367  lumidata->hltErrors.value()[i] += stream.hltErrors[i];
368  }
369  unsigned int datasets = rundata.hltConfig.datasetNames().size();
370  for (unsigned int i = 0; i < datasets; ++i)
371  lumidata->datasets.value()[i] += stream.datasets[i];
372 }
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
list lumi
Definition: dqmdumpme.py:53
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 482 of file HLTriggerJSONMonitoring.cc.

Referenced by globalBeginRun().

482  {
484 
486  for (auto const& name : rundata.hltConfig.triggerNames())
487  triggerNames.append(name);
488  content["Path-Names"] = triggerNames;
489 
491  for (auto const& name : rundata.hltConfig.datasetNames())
492  datasetNames.append(name);
493  content["Dataset-Names"] = datasetNames;
494 
495  std::string iniFileName = fmt::sprintf("run%06d_ls0000_streamHLTRates_pid%05d.ini", run, getpid());
496  std::ofstream file(rundata.baseRunDir + "/" + iniFileName);
497  Json::StyledWriter writer;
498  file << writer.write(content);
499  file.close();
500 }
Represents a JSON value.
Definition: value.h:99
std::string write(const Value &root) override
Serialize a Value in JSON format.
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:63
array value (ordered list)
Definition: value.h:30
void HLTriggerJSONMonitoring::writeJsdFile ( HLTriggerJSONMonitoringData::run const &  rundata)
staticprivate

Definition at line 464 of file HLTriggerJSONMonitoring.cc.

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

Referenced by globalBeginRun().

464  {
465  std::ofstream file(rundata.baseRunDir + "/" + rundata.jsdFileName);
466  file << R"""({ "data" : [ { "name" : "Processed", "type" : "integer", "operation" : "histo"}, { "name" : "Path-WasRun", "type" : "integer", "operation" : "histo"}, { "name" : "Path-AfterL1Seed", "type" : "integer", "operation" : "histo"}, { "name" : "Path-AfterPrescale", "type" : "integer", "operation" : "histo"}, { "name" : "Path-Accepted", "type" : "integer", "operation" : "histo"}, { "name" : "Path-Rejected", "type" : "integer", "operation" : "histo"}, { "name" : "Path-Errors", "type" : "integer", "operation" : "histo"}, { "name" : "Dataset-Accepted", "type" : "integer", "operation" : "histo"} ] } )""";
467  file.close();
468 }

Member Data Documentation

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

Definition at line 125 of file HLTriggerJSONMonitoring.cc.

Referenced by globalBeginRun().

const edm::InputTag HLTriggerJSONMonitoring::triggerResults_
private

Definition at line 131 of file HLTriggerJSONMonitoring.cc.

Referenced by analyze(), and globalBeginRun().

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

Definition at line 132 of file HLTriggerJSONMonitoring.cc.

Referenced by analyze().