15 #include <fmt/printf.h> 59 std::vector<std::vector<unsigned int>>
datasets;
78 edm::StreamCache<HLTriggerJSONMonitoringData::stream>,
80 edm::RunCache<HLTriggerJSONMonitoringData::run>,
82 edm::LuminosityBlockSummaryCache<HLTriggerJSONMonitoringData::lumisection>> {
152 descriptions.
add(
"HLTriggerJSONMonitoring",
desc);
157 return std::make_unique<HLTriggerJSONMonitoringData::stream>();
163 auto rundata = std::make_shared<HLTriggerJSONMonitoringData::run>();
168 rundata->streamMergeType =
172 rundata->streamDestination =
"";
173 rundata->streamMergeType =
"";
174 rundata->baseRunDir =
".";
180 edm::LogError(
"HLTriggerJSONMonitoring") <<
"HLTConfigProvider initialization failed!";
181 }
else if (changed) {
183 auto const&
triggerNames = rundata->hltConfig.triggerNames();
187 rundata->indicesOfTriggerPaths.clear();
188 rundata->indicesOfTriggerPaths.reserve(triggerNamesSize);
189 for (
auto triggerNameIdx = 0u; triggerNameIdx < triggerNamesSize; ++triggerNameIdx) {
192 rundata->indicesOfTriggerPaths.emplace_back(triggerNameIdx);
195 auto const triggersSize = rundata->indicesOfTriggerPaths.size();
198 auto const&
datasets = rundata->hltConfig.datasetContents();
199 auto const&
datasetNames = rundata->hltConfig.datasetNames();
201 rundata->datasets.resize(datasetsSize);
202 for (
auto ds = 0u; ds < datasetsSize; ++ds) {
203 auto&
dataset = rundata->datasets[ds];
208 auto const datasetPathExists =
210 if (datasetPathExists) {
215 auto const index = rundata->hltConfig.triggerIndex(datasetPathName);
216 if (
index < triggerNamesSize)
222 auto const index = rundata->hltConfig.triggerIndex(
datasets[ds][
p]);
223 if (
index < triggerNamesSize)
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;
247 rundata->jsdFileName = fmt::sprintf(
"run%06d_ls0000_streamHLTRates_pid%05d.jsd",
run.run(), getpid());
262 auto&
stream = *streamCache(sid);
263 auto const& rundata = *runCache(
event.getRun().index());
268 if (not rundata.hltConfig.inited())
279 assert(
results.size() == rundata.hltConfig.triggerNames().size());
282 for (
auto idx = 0u;
idx < rundata.indicesOfTriggerPaths.size(); ++
idx) {
283 auto const triggerPathIdx = rundata.indicesOfTriggerPaths[
idx];
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) {
317 unsigned int triggers = 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();
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);
352 lumidata->datasets.update(0);
361 auto&
stream = *streamCache(sid);
363 unsigned int triggers = 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();
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);
387 auto const&
stream = *streamCache(sid);
388 auto const& rundata = *runCache(
lumi.getRun().index());
392 if (not rundata.hltConfig.inited())
395 auto const triggers = rundata.indicesOfTriggerPaths.size();
396 for (
auto i = 0u;
i < triggers; ++
i) {
404 auto const datasets = rundata.hltConfig.datasetNames().size();
413 unsigned int ls =
lumi.luminosityBlock();
416 bool writeFiles =
true;
427 auto const& rundata = *runCache(
lumi.getRun().index());
432 gethostname(hostname, 32);
436 std::stringstream sOutDef;
437 sOutDef << rundata.baseRunDir <<
"/" 438 <<
"output_" << getpid() <<
".jsd";
441 unsigned int jsndataSize = 0;
442 unsigned int jsndataAdler32 = 1;
458 auto jsndataFileName = fmt::sprintf(
"run%06d_ls%04d_streamHLTRates_pid%05d.jsndata",
run,
ls, getpid());
461 std::ofstream jsndataFile(rundata.baseRunDir +
"/" + jsndataFileName);
465 jsndataFileList = jsndataFileName;
466 jsndataSize =
result.size();
471 unsigned int jsnProcessed = processed;
472 unsigned int jsnAccepted = processed;
473 unsigned int jsnErrorEvents = 0;
474 unsigned int jsnRetCodeMask = 0;
476 unsigned int jsnHLTErrorEvents = 0;
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);
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"} 530 std::string iniFileName = fmt::sprintf(
"run%06d_ls0000_streamHLTRates_pid%05d.ini",
run, getpid());
static constexpr const char * streamName_
std::vector< int > posL1s
void globalEndRun(edm::Run const &, edm::EventSetup const &) const override
static constexpr const char * datasetPathNamePrefix_
static const std::string SOURCE
std::vector< unsigned int > hltPre
std::vector< unsigned int > hltL1s
HLTConfigProvider hltConfig
#define DEFINE_FWK_MODULE(type)
~HLTriggerJSONMonitoring() override=default
std::vector< std::vector< unsigned int > > datasets
HLTriggerJSONMonitoring(const edm::ParameterSet &)
void streamBeginLuminosityBlock(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &) const override
static void writeIniFile(HLTriggerJSONMonitoringData::run const &, unsigned int)
Value & append(const Value &value)
Append value to array at the end.
std::vector< unsigned int > hltErrors
jsoncollector::HistoJ< unsigned int > hltReject
std::string streamMergeType
Log< level::Error, false > LogError
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
jsoncollector::HistoJ< unsigned int > hltErrors
std::vector< T > & value()
static const std::string DATA
void analyze(edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
jsoncollector::HistoJ< unsigned int > hltPre
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
std::unique_ptr< HLTriggerJSONMonitoringData::stream > beginStream(edm::StreamID) const override
std::shared_ptr< HLTriggerJSONMonitoringData::lumisection > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &) const override
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
std::string streamDestination
virtual Json::Value toJsonValue() const
static void writeJsdFile(HLTriggerJSONMonitoringData::run const &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
jsoncollector::HistoJ< unsigned int > hltWasRun
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< unsigned int > hltWasRun
void streamEndLuminosityBlockSummary(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &, HLTriggerJSONMonitoringData::lumisection *) const override
jsoncollector::HistoJ< unsigned int > hltL1s
std::vector< unsigned int > datasets
const edm::InputTag triggerResults_
void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, HLTriggerJSONMonitoringData::lumisection *) const override
std::vector< unsigned int > hltAccept
jsoncollector::HistoJ< unsigned int > processed
const std::vector< std::string > & datasetNames() const
std::vector< unsigned int > hltReject
Writes a Value in JSON format in a human friendly way.
bool shouldWriteFiles(unsigned int lumi, unsigned int *proc=nullptr)
static const std::string DEFINITION
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
jsoncollector::HistoJ< unsigned int > datasets
std::vector< unsigned int > indicesOfTriggerPaths
std::shared_ptr< HLTriggerJSONMonitoringData::run > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
jsoncollector::HistoJ< unsigned int > hltAccept
array value (ordered list)
std::vector< int > posPre