|
|
Go to the documentation of this file.
10 #include <fmt/printf.h>
72 edm::StreamCache<L1TriggerJSONMonitoringData::stream>,
74 edm::RunCache<L1TriggerJSONMonitoringData::run>,
76 edm::LuminosityBlockSummaryCache<L1TriggerJSONMonitoringData::lumisection> > {
170 descriptions.
add(
"L1TriggerJSONMonitoring",
desc);
175 return std::make_unique<L1TriggerJSONMonitoringData::stream>();
181 auto rundata = std::make_shared<L1TriggerJSONMonitoringData::run>();
186 rundata->streamMergeType =
190 rundata->streamDestination =
"";
191 rundata->streamMergeType =
"";
192 rundata->baseRunDir =
".";
198 if (menuHandle.isValid()) {
199 for (
auto const&
algo : menuHandle->getAlgorithmMap())
202 edm::LogWarning(
"L1TriggerJSONMonitoring") <<
"L1TUtmTriggerMenu not found in the EventSetup.\nThe Level 1 Trigger "
203 "rate monitoring will not include the trigger names.";
207 rundata->jsdFileName = fmt::sprintf(
"run%06d_ls0000_streamL1Rates_pid%05d.jsd",
run.run(), getpid());
222 auto&
stream = *streamCache(sid);
225 unsigned int eventType =
event.experimentType();
243 auto const& decision =
results.getAlgoDecisionFinal();
247 for (
unsigned int i = 0;
i < decision.size(); ++
i) {
255 ++
stream.l1tAcceptCalibration[
i];
267 int prescaleIndex =
results.getPreScColumn();
269 stream.prescaleIndex = prescaleIndex;
272 }
else if (
stream.prescaleIndex != prescaleIndex) {
273 edm::LogWarning(
"L1TriggerJSONMonitoring") <<
"Prescale index changed from " <<
stream.prescaleIndex <<
" to "
274 << prescaleIndex <<
" inside lumisection " <<
event.luminosityBlock();
293 lumidata->processed.update(0);
295 lumidata->l1tAccept.update(0);
297 lumidata->l1tAcceptPhysics.update(0);
299 lumidata->l1tAcceptCalibration.update(0);
301 lumidata->l1tAcceptRandom.update(0);
303 lumidata->tcdsAccept.update(0);
313 auto&
stream = *streamCache(sid);
330 auto const&
stream = *streamCache(sid);
353 unsigned int ls =
lumi.luminosityBlock();
356 bool writeFiles =
true;
367 auto const& rundata = *runCache(
lumi.getRun().index());
372 gethostname(hostname, 32);
376 std::stringstream sOutDef;
377 sOutDef << rundata.baseRunDir <<
"/"
378 <<
"output_" << getpid() <<
".jsd";
381 unsigned int jsndataSize = 0;
382 unsigned int jsndataAdler32 = 1;
406 auto jsndataFileName = fmt::sprintf(
"run%06d_ls%04d_streamL1Rates_pid%05d.jsndata",
run,
ls, getpid());
409 std::ofstream jsndataFile(rundata.baseRunDir +
"/" + jsndataFileName);
413 jsndataFileList = jsndataFileName;
414 jsndataSize =
result.size();
419 unsigned int jsnProcessed = processed;
420 unsigned int jsnAccepted = processed;
421 unsigned int jsnErrorEvents = 0;
422 unsigned int jsnRetCodeMask = 0;
424 unsigned int jsnHLTErrorEvents = 0;
441 auto jsnFileName = fmt::sprintf(
"run%06d_ls%04d_streamL1Rates_pid%05d.jsn",
run,
ls, getpid());
442 std::ofstream jsnFile(rundata.baseRunDir +
"/" + jsnFileName);
443 jsnFile <<
writer.write(jsn);
451 { "name" : "Processed", "type" : "integer", "operation" : "histo"},
452 { "name" : "L1-AlgoAccepted", "type" : "integer", "operation" : "histo"},
453 { "name" : "L1-AlgoAccepted-Physics", "type" : "integer", "operation" : "histo"},
454 { "name" : "L1-AlgoAccepted-Calibration", "type" : "integer", "operation" : "histo"},
455 { "name" : "L1-AlgoAccepted-Random", "type" : "integer", "operation" : "histo"},
456 { "name" : "L1-Global", "type" : "integer", "operation" : "histo"},
457 { "name" : "Prescale-Index", "type" : "integer", "operation" : "sample"}
465 std::vector<std::string>
const& l1TriggerNames) {
469 for (
auto const&
name : l1TriggerNames)
483 std::string iniFileName = fmt::sprintf(
"run%06d_ls0000_streamL1Rates_pid%05d.ini",
run, getpid());
jsoncollector::HistoJ< unsigned int > processed
std::vector< unsigned int > tcdsAccept
static constexpr const int kPrescaleConflict
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< L1TriggerJSONMonitoringData::stream > beginStream(edm::StreamID) const override
bool shouldWriteFiles(unsigned int lumi, unsigned int *proc=nullptr)
std::vector< T > & value()
void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, L1TriggerJSONMonitoringData::lumisection *) const override
array value (ordered list)
static constexpr const int kPrescaleUndefined
static void writeIniFile(L1TriggerJSONMonitoringData::run const &, unsigned int, std::vector< std::string > const &)
std::vector< unsigned int > l1tAccept
jsoncollector::HistoJ< unsigned int > l1tAcceptRandom
Log< level::Warning, false > LogWarning
std::string streamMergeType
void globalEndRun(edm::Run const &, edm::EventSetup const &) const override
std::vector< unsigned int > l1tAcceptRandom
L1TriggerJSONMonitoring(const edm::ParameterSet &)
std::shared_ptr< L1TriggerJSONMonitoringData::run > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
const edm::InputTag level1Results_
virtual Json::Value toJsonValue() const
#define DEFINE_FWK_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static const std::string DATA
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
static void writeJsdFile(L1TriggerJSONMonitoringData::run const &)
Writes a Value in JSON format in a human friendly way.
static const std::string DEFINITION
jsoncollector::HistoJ< unsigned int > l1tAccept
static constexpr const char * streamName_
Value & append(const Value &value)
Append value to array at the end.
void streamBeginLuminosityBlock(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &) const override
jsoncollector::HistoJ< unsigned int > l1tAcceptCalibration
Log< level::Error, false > LogError
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > level1ResultsToken_
void analyze(edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
static const std::string SOURCE
std::vector< unsigned int > l1tAcceptPhysics
std::string streamDestination
jsoncollector::HistoJ< unsigned int > l1tAcceptPhysics
void streamEndLuminosityBlockSummary(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &, L1TriggerJSONMonitoringData::lumisection *) const override
jsoncollector::HistoJ< unsigned int > tcdsAccept
std::shared_ptr< L1TriggerJSONMonitoringData::lumisection > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &) const override
static constexpr const std::array< const char *, 16 > tcdsTriggerTypes_
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
const edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > l1tUtmTriggerMenuRcdToken_
static constexpr unsigned int maxPhysicsTriggers
~L1TriggerJSONMonitoring() override=default
std::vector< unsigned int > l1tAcceptCalibration