22 using namespace jsoncollector;
25 triggerResults_(ps.getParameter<edm::
InputTag>(
"triggerResults")),
40 descriptions.
add(
"HLTriggerJSONMonitoring", desc);
61 for (
unsigned int i=0;
i<
n;
i++) {
67 const int index(static_cast<int>(HLTR->index(
i)));
68 if (HLTR->accept(
i)) {
78 std::vector<bool> acceptedByDS(
hltIndex_.size(),
false);
79 for (
unsigned int ds=0; ds <
hltIndex_.size(); ds++) {
81 if (acceptedByDS[ds]>0 || HLTR->accept(
hltIndex_[ds][
p]) ) {
82 acceptedByDS[ds] =
true;
117 for (
unsigned int ds = 0; ds <
d; ds++) {
120 for (
unsigned int p = 0;
p <
size;
p++) {
130 for (
unsigned int i = 0;
i <
n; ++
i) {
134 for (
unsigned int j = 0;
j < moduleLabels.size(); ++
j) {
136 if (label ==
"HLTLevel1GTSeed")
138 else if (label ==
"HLTPrescaler")
180 LogDebug(
"HLTriggerJSONMonitoring") <<
"HLTConfigProvider initialization failed!" << std::endl;
186 bool expected =
false;
187 if( runCache()->wroteFiles.compare_exchange_strong(expected,
true) ){
188 runCache()->wroteFiles =
true;
190 unsigned int nRun = iRun.
run();
193 std::stringstream ssHltJsd;
194 ssHltJsd <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000";
195 ssHltJsd <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsd";
215 hltIni[
"Path-Names"] = hltNamesVal;
216 hltIni[
"Dataset-Names"] = datasetNamesVal;
220 std::stringstream ssHltIni;
221 ssHltIni <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".ini";
223 std::ofstream outHltIni( monPath + ssHltIni.str() );
232 std::shared_ptr<hltJson::lumiVars>
237 unsigned int MAXPATHS = 1000;
250 iSummary->baseRunDir =
"";
251 iSummary->stHltJsd =
"";
252 iSummary->streamHLTDestination =
"";
306 unsigned int iRun = iLumi.
run();
308 bool writeFiles=
true;
320 gethostname(hostname,32);
326 std::stringstream sOutDef;
327 sOutDef << monPath <<
"output_" << getpid() <<
".jsd";
333 hltJsnData[DataPoint::DEFINITION] = iSummary->
stHltJsd;
347 std::stringstream ssHltJsnData;
348 ssHltJsnData <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
349 ssHltJsnData <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsndata";
352 std::ofstream outHltJsnData( monPath + ssHltJsnData.str() );
354 outHltJsnData.close();
359 IntJ hltJsnFilesize = 0;
360 unsigned int hltJsnFileAdler32 = 1;
362 hltJsnFilelist.
update(ssHltJsnData.str());
363 hltJsnFilesize = result.size();
364 hltJsnFileAdler32 =
cms::Adler32(result.c_str(),result.size());
367 hltJsnInputFiles.
update(
"");
373 IntJ daqJsnAccepted = daqJsnProcessed;
374 IntJ daqJsnErrorEvents = 0;
375 IntJ daqJsnRetCodeMask = 0;
376 IntJ daqJsnHLTErrorEvents = 0;
381 hltDaqJsn[DataPoint::DEFINITION] = sOutDef.str();
394 result = writer.
write(hltDaqJsn);
396 std::stringstream ssHltDaqJsn;
397 ssHltDaqJsn <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
398 ssHltDaqJsn <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsn";
400 std::ofstream outHltDaqJsn( monPath + ssHltDaqJsn.str() );
402 outHltDaqJsn.close();
424 iSummary->
hltL1s =
nullptr;
425 iSummary->
hltPre =
nullptr;
439 outfile <<
"{" << std::endl;
440 outfile <<
" \"data\" : [" << std::endl;
442 outfile <<
" \"name\" : \"Processed\"," ;
443 outfile <<
" \"type\" : \"integer\"," ;
444 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
447 outfile <<
" \"name\" : \"Path-WasRun\"," ;
448 outfile <<
" \"type\" : \"integer\"," ;
449 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
452 outfile <<
" \"name\" : \"Path-AfterL1Seed\"," ;
453 outfile <<
" \"type\" : \"integer\"," ;
454 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
457 outfile <<
" \"name\" : \"Path-AfterPrescale\"," ;
458 outfile <<
" \"type\" : \"integer\"," ;
459 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
462 outfile <<
" \"name\" : \"Path-Accepted\"," ;
463 outfile <<
" \"type\" : \"integer\"," ;
464 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
467 outfile <<
" \"name\" : \"Path-Rejected\"," ;
468 outfile <<
" \"type\" : \"integer\"," ;
469 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
472 outfile <<
" \"name\" : \"Path-Errors\"," ;
473 outfile <<
" \"type\" : \"integer\"," ;
474 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
477 outfile <<
" \"name\" : \"Dataset-Accepted\"," ;
478 outfile <<
" \"type\" : \"integer\"," ;
479 outfile <<
" \"operation\" : \"histo\"}" << std::endl;
481 outfile <<
" ]" << std::endl;
482 outfile <<
"}" << std::endl;
std::vector< std::string > hltNames_
HLTConfigProvider hltConfig_
jsoncollector::HistoJ< unsigned int > * hltAccept
const std::string moduleType(const std::string &module) const
C++ class name of module.
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
void endLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, hltJson::lumiVars *) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< int > posL1s_
std::vector< unsigned int > hltDatasets_
static void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, hltJson::lumiVars *)
HLTriggerJSONMonitoring(const edm::ParameterSet &)
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< unsigned int > hltPre_
bool shouldWriteFiles(unsigned int lumi, unsigned int *proc=0)
Value & append(const Value &value)
Append value to array at the end.
void update(std::string const &newStr)
std::vector< unsigned int > hltAccept_
std::vector< unsigned int > hltReject_
std::vector< int > posPre_
jsoncollector::HistoJ< unsigned int > * hltWasRun
virtual Json::Value toJsonValue() const
static std::shared_ptr< hltJson::lumiVars > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
std::vector< T > & value()
triggerResultsToken_(consumes< edm::TriggerResults >(edm::InputTag("TriggerResults")))
LuminosityBlockNumber_t luminosityBlock() const
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
std::vector< std::vector< unsigned int > > hltIndex_
void beginRun(edm::Run const &, edm::EventSetup const &)
jsoncollector::HistoJ< unsigned int > * hltDatasets
edm::InputTag triggerResults_
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
~HLTriggerJSONMonitoring()
std::vector< unsigned int > hltL1s_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::string streamHLTDestination
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
void resetRun(bool changed)
jsoncollector::HistoJ< unsigned int > * hltPre
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
std::vector< std::string > datasetNames_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< unsigned int > hltWasRun_
const std::vector< std::vector< std::string > > & datasetContents() const
names of trigger paths for all datasets
jsoncollector::HistoJ< unsigned int > * hltErrors
jsoncollector::HistoJ< unsigned int > * processed
void writeHLTDefJson(std::string path)
std::vector< unsigned int > hltErrors_
void analyze(edm::Event const &, edm::EventSetup const &)
Writes a Value in JSON format in a human friendly way.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
tuple size
Write out results.
jsoncollector::HistoJ< unsigned int > * hltL1s
jsoncollector::HistoJ< unsigned int > * hltReject
const std::vector< std::string > & datasetNames() const
array value (ordered list)
std::vector< std::vector< std::string > > datasetContents_