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 > l1tAcceptRandom
static constexpr const int kPrescaleConflict
static void writeJsdFile(L1TriggerJSONMonitoringData::run const &)
const edm::InputTag level1Results_
jsoncollector::HistoJ< unsigned int > l1tAccept
static const std::string SOURCE
std::vector< unsigned int > l1tAcceptPhysics
#define DEFINE_FWK_MODULE(type)
void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, L1TriggerJSONMonitoringData::lumisection *) const override
Value & append(const Value &value)
Append value to array at the end.
jsoncollector::HistoJ< unsigned int > l1tAcceptCalibration
jsoncollector::HistoJ< unsigned int > processed
Log< level::Error, false > LogError
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< T > & value()
std::vector< unsigned int > tcdsAccept
static const std::string DATA
jsoncollector::HistoJ< unsigned int > tcdsAccept
static void writeIniFile(L1TriggerJSONMonitoringData::run const &, unsigned int, std::vector< std::string > const &)
static constexpr const int kPrescaleUndefined
std::string streamMergeType
std::shared_ptr< L1TriggerJSONMonitoringData::lumisection > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &) const override
std::vector< unsigned int > l1tAcceptRandom
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::vector< unsigned int > l1tAccept
std::string streamDestination
jsoncollector::HistoJ< unsigned int > l1tAcceptPhysics
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
virtual Json::Value toJsonValue() const
void globalEndRun(edm::Run const &, edm::EventSetup const &) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static constexpr const std::array< const char *, 16 > tcdsTriggerTypes_
const edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > l1tUtmTriggerMenuRcdToken_
void streamEndLuminosityBlockSummary(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &, L1TriggerJSONMonitoringData::lumisection *) const override
void streamBeginLuminosityBlock(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &) const override
void analyze(edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
std::unique_ptr< L1TriggerJSONMonitoringData::stream > beginStream(edm::StreamID) const override
L1TriggerJSONMonitoring(const edm::ParameterSet &)
std::vector< unsigned int > l1tAcceptCalibration
static constexpr unsigned int maxPhysicsTriggers
std::shared_ptr< L1TriggerJSONMonitoringData::run > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
Log< level::Warning, false > LogWarning
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > level1ResultsToken_
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 constexpr const char * streamName_
~L1TriggerJSONMonitoring() override=default
array value (ordered list)