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 ==
"HLTL1TSeed")
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 =
"";
253 iSummary->streamHLTMergeType =
"";
308 unsigned int iRun = iLumi.
run();
310 bool writeFiles=
true;
322 gethostname(hostname,32);
328 std::stringstream sOutDef;
329 sOutDef << monPath <<
"output_" << getpid() <<
".jsd";
335 hltJsnData[DataPoint::DEFINITION] = iSummary->
stHltJsd;
349 std::stringstream ssHltJsnData;
350 ssHltJsnData <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
351 ssHltJsnData <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsndata";
354 std::ofstream outHltJsnData( monPath + ssHltJsnData.str() );
356 outHltJsnData.close();
361 IntJ hltJsnFilesize = 0;
362 unsigned int hltJsnFileAdler32 = 1;
364 hltJsnFilelist.
update(ssHltJsnData.str());
365 hltJsnFilesize = result.size();
366 hltJsnFileAdler32 =
cms::Adler32(result.c_str(),result.size());
369 hltJsnInputFiles.
update(
"");
375 IntJ daqJsnAccepted = daqJsnProcessed;
376 IntJ daqJsnErrorEvents = 0;
377 IntJ daqJsnRetCodeMask = 0;
378 IntJ daqJsnHLTErrorEvents = 0;
383 hltDaqJsn[DataPoint::DEFINITION] = sOutDef.str();
397 result = writer.
write(hltDaqJsn);
399 std::stringstream ssHltDaqJsn;
400 ssHltDaqJsn <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
401 ssHltDaqJsn <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsn";
403 std::ofstream outHltDaqJsn( monPath + ssHltDaqJsn.str() );
405 outHltDaqJsn.close();
427 iSummary->
hltL1s =
nullptr;
428 iSummary->
hltPre =
nullptr;
442 outfile <<
"{" << std::endl;
443 outfile <<
" \"data\" : [" << std::endl;
445 outfile <<
" \"name\" : \"Processed\"," ;
446 outfile <<
" \"type\" : \"integer\"," ;
447 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
450 outfile <<
" \"name\" : \"Path-WasRun\"," ;
451 outfile <<
" \"type\" : \"integer\"," ;
452 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
455 outfile <<
" \"name\" : \"Path-AfterL1Seed\"," ;
456 outfile <<
" \"type\" : \"integer\"," ;
457 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
460 outfile <<
" \"name\" : \"Path-AfterPrescale\"," ;
461 outfile <<
" \"type\" : \"integer\"," ;
462 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
465 outfile <<
" \"name\" : \"Path-Accepted\"," ;
466 outfile <<
" \"type\" : \"integer\"," ;
467 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
470 outfile <<
" \"name\" : \"Path-Rejected\"," ;
471 outfile <<
" \"type\" : \"integer\"," ;
472 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
475 outfile <<
" \"name\" : \"Path-Errors\"," ;
476 outfile <<
" \"type\" : \"integer\"," ;
477 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
480 outfile <<
" \"name\" : \"Dataset-Accepted\"," ;
481 outfile <<
" \"type\" : \"integer\"," ;
482 outfile <<
" \"operation\" : \"histo\"}" << std::endl;
484 outfile <<
" ]" << std::endl;
485 outfile <<
"}" << std::endl;
std::vector< std::string > hltNames_
HLTConfigProvider hltConfig_
std::string streamHLTMergeType
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_