10 #include <fmt/printf.h> 72 edm::StreamCache<L1TriggerJSONMonitoringData::stream>,
74 edm::RunCache<L1TriggerJSONMonitoringData::run>,
76 edm::LuminosityBlockSummaryCache<L1TriggerJSONMonitoringData::lumisection> > {
168 std::ofstream
file(initFileName);
171 <<
"Cannot create INITEMP file: " << initFileName <<
" error: " << strerror(errno);
180 descriptions.
add(
"L1TriggerJSONMonitoring",
desc);
185 return std::make_unique<L1TriggerJSONMonitoringData::stream>();
191 auto rundata = std::make_shared<L1TriggerJSONMonitoringData::run>();
196 rundata->streamMergeType =
200 rundata->streamDestination =
"";
201 rundata->streamMergeType =
"";
202 rundata->baseRunDir =
".";
208 if (menuHandle.isValid()) {
209 for (
auto const&
algo : menuHandle->getAlgorithmMap())
212 edm::LogWarning(
"L1TriggerJSONMonitoring") <<
"L1TUtmTriggerMenu not found in the EventSetup.\nThe Level 1 Trigger " 213 "rate monitoring will not include the trigger names.";
217 rundata->jsdFileName = fmt::sprintf(
"run%06d_ls0000_streamL1Rates_pid%05d.jsd",
run.run(), getpid());
232 auto&
stream = *streamCache(sid);
235 unsigned int eventType =
event.experimentType();
253 auto const& decision =
results.getAlgoDecisionFinal();
257 for (
unsigned int i = 0;
i < decision.size(); ++
i) {
265 ++
stream.l1tAcceptCalibration[
i];
277 int prescaleIndex =
results.getPreScColumn();
279 stream.prescaleIndex = prescaleIndex;
282 }
else if (
stream.prescaleIndex != prescaleIndex) {
283 edm::LogWarning(
"L1TriggerJSONMonitoring") <<
"Prescale index changed from " <<
stream.prescaleIndex <<
" to " 284 << prescaleIndex <<
" inside lumisection " <<
event.luminosityBlock();
303 lumidata->processed.update(0);
305 lumidata->l1tAccept.update(0);
307 lumidata->l1tAcceptPhysics.update(0);
309 lumidata->l1tAcceptCalibration.update(0);
311 lumidata->l1tAcceptRandom.update(0);
313 lumidata->tcdsAccept.update(0);
323 auto&
stream = *streamCache(sid);
340 auto const&
stream = *streamCache(sid);
363 unsigned int ls =
lumi.luminosityBlock();
366 bool writeFiles =
true;
377 auto const& rundata = *runCache(
lumi.getRun().index());
382 gethostname(hostname, 32);
386 std::stringstream sOutDef;
387 sOutDef << rundata.baseRunDir <<
"/" 388 <<
"output_" << getpid() <<
".jsd";
391 unsigned int jsndataSize = 0;
392 unsigned int jsndataAdler32 = 1;
416 auto jsndataFileName = fmt::sprintf(
"run%06d_ls%04d_streamL1Rates_pid%05d.jsndata",
run,
ls, getpid());
419 std::ofstream jsndataFile(rundata.baseRunDir +
"/" + jsndataFileName);
423 jsndataFileList = jsndataFileName;
424 jsndataSize =
result.size();
429 unsigned int jsnProcessed = processed;
430 unsigned int jsnAccepted = processed;
431 unsigned int jsnErrorEvents = 0;
432 unsigned int jsnRetCodeMask = 0;
434 unsigned int jsnHLTErrorEvents = 0;
451 auto jsnFileName = fmt::sprintf(
"run%06d_ls%04d_streamL1Rates_pid%05d.jsn",
run,
ls, getpid());
452 std::ofstream jsnFile(rundata.baseRunDir +
"/" + jsnFileName);
453 jsnFile <<
writer.write(jsn);
461 { "name" : "Processed", "type" : "integer", "operation" : "histo"}, 462 { "name" : "L1-AlgoAccepted", "type" : "integer", "operation" : "histo"}, 463 { "name" : "L1-AlgoAccepted-Physics", "type" : "integer", "operation" : "histo"}, 464 { "name" : "L1-AlgoAccepted-Calibration", "type" : "integer", "operation" : "histo"}, 465 { "name" : "L1-AlgoAccepted-Random", "type" : "integer", "operation" : "histo"}, 466 { "name" : "L1-Global", "type" : "integer", "operation" : "histo"}, 467 { "name" : "Prescale-Index", "type" : "integer", "operation" : "sample"} 475 std::vector<std::string>
const& l1TriggerNames) {
479 for (
auto const&
name : l1TriggerNames)
493 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
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
#define DEFINE_FWK_MODULE(type)
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)