26 triggerResults_(ps.getParameter<
edm::InputTag>(
"triggerResults")),
27 triggerResultsToken_(consumes<
edm::TriggerResults>(triggerResults_)),
28 level1Results_(ps.getParameter<
edm::InputTag>(
"L1Results")),
42 descriptions.
add(
"triggerJSONMonitoring", desc);
59 LogDebug(
"TriggerJSONMonitoring") <<
"Not Physics, Calibration or Random. experimentType = " << ex << std::endl;
109 for (
unsigned int i=0;
i<
n;
i++) {
126 std::vector<bool> acceptedByDS(
hltIndex_.size(),
false);
127 for (
unsigned int ds=0; ds <
hltIndex_.size(); ds++) {
130 acceptedByDS[ds] =
true;
166 int bitNumber = (itAlgo->second).algoBitNumber();
167 L1AlgoNames_.at(bitNumber) = itAlgo->first;
176 int bitNumber = (itAlgo->second).algoBitNumber();
177 L1TechNames_.at(bitNumber) = itAlgo->first;
220 for (
unsigned int ds = 0; ds <
d; ds++) {
223 for (
unsigned int p = 0;
p <
size;
p++) {
233 for (
unsigned int i = 0;
i <
n; ++
i) {
237 for (
unsigned int j = 0; j < moduleLabels.size(); ++j) {
239 if (label ==
"HLTLevel1GTSeed")
241 else if (label ==
"HLTPrescaler")
320 LogDebug(
"TriggerJSONMonitoring") <<
"HLTConfigProvider initialization failed!" << std::endl;
326 bool expected =
false;
327 if( runCache()->wroteFiles.compare_exchange_strong(expected,
true) ){
328 runCache()->wroteFiles =
true;
330 unsigned int nRun = iRun.
run();
333 std::stringstream ssHltJsd;
334 ssHltJsd <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000";
335 ssHltJsd <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsd";
341 std::stringstream ssL1Jsd;
342 ssL1Jsd <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000";
343 ssL1Jsd <<
"_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsd";
355 hltNamesVal.
append(hltName);
363 hltIni[
"Path-Names"] = hltNamesVal;
364 hltIni[
"Dataset-Names"] = datasetNamesVal;
368 std::stringstream ssHltIni;
369 ssHltIni <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".ini";
371 std::ofstream outHltIni( monPath + ssHltIni.str() );
380 l1AlgoNamesVal.
append(L1AlgoName);
385 l1TechNamesVal.
append(L1TechName);
393 l1Ini[
"L1-Algo-Names"] = l1AlgoNamesVal;
394 l1Ini[
"L1-Tech-Names"] = l1TechNamesVal;
395 l1Ini[
"Event-Type"] = eventTypeVal;
397 result = writer.
write(l1Ini);
399 std::stringstream ssL1Ini;
400 ssL1Ini <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".ini";
402 std::ofstream outL1Ini( monPath + ssL1Ini.str() );
415 std::shared_ptr<trigJson::lumiVars>
420 unsigned int MAXPATHS = 1000;
433 iSummary->prescaleIndex = 100;
445 iSummary->baseRunDir =
"";
446 iSummary->stHltJsd =
"";
447 iSummary->stL1Jsd =
"";
448 iSummary->streamL1Destination =
"";
449 iSummary->streamHLTDestination =
"";
450 iSummary->streamL1MergeType =
"";
451 iSummary->streamHLTMergeType =
"";
542 unsigned int iRun = iLumi.
run();
544 bool writeFiles=
true;
556 gethostname(hostname,32);
562 std::stringstream sOutDef;
563 sOutDef << monPath <<
"output_" << getpid() <<
".jsd";
568 hltJsnData[DataPoint::SOURCE] = sourceHost;
569 hltJsnData[DataPoint::DEFINITION] = iSummary->
stHltJsd;
585 std::stringstream ssHltJsnData;
586 ssHltJsnData <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
587 ssHltJsnData <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsndata";
590 std::ofstream outHltJsnData( monPath + ssHltJsnData.str() );
592 outHltJsnData.close();
597 IntJ hltJsnFilesize = 0;
598 unsigned int hltJsnFileAdler32 = 1;
600 hltJsnFilelist.
update(ssHltJsnData.str());
601 hltJsnFilesize = result.size();
602 hltJsnFileAdler32 =
cms::Adler32(result.c_str(),result.size());
605 hltJsnInputFiles.
update(
"");
609 l1JsnData[DataPoint::SOURCE] = sourceHost;
610 l1JsnData[DataPoint::DEFINITION] = iSummary->
stL1Jsd;
622 result = writer.
write(l1JsnData);
624 std::stringstream ssL1JsnData;
625 ssL1JsnData <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
626 ssL1JsnData <<
"_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsndata";
629 std::ofstream outL1JsnData( monPath +
"/" + ssL1JsnData.str() );
631 outL1JsnData.close();
636 IntJ l1JsnFilesize = 0;
637 unsigned int l1JsnFileAdler32 = 1;
639 l1JsnFilelist.
update(ssL1JsnData.str());
640 l1JsnFilesize = result.size();
641 l1JsnFileAdler32 =
cms::Adler32(result.c_str(),result.size());
644 l1JsnInputFiles.
update(
"");
651 IntJ daqJsnAccepted = daqJsnProcessed;
652 IntJ daqJsnErrorEvents = 0;
653 IntJ daqJsnRetCodeMask = 0;
654 IntJ daqJsnHLTErrorEvents = 0;
658 hltDaqJsn[DataPoint::SOURCE] = sourceHost;
659 hltDaqJsn[DataPoint::DEFINITION] = sOutDef.str();
673 result = writer.
write(hltDaqJsn);
675 std::stringstream ssHltDaqJsn;
676 ssHltDaqJsn <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
677 ssHltDaqJsn <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsn";
679 std::ofstream outHltDaqJsn( monPath + ssHltDaqJsn.str() );
681 outHltDaqJsn.close();
685 l1DaqJsn[DataPoint::SOURCE] = sourceHost;
686 l1DaqJsn[DataPoint::DEFINITION] = sOutDef.str();
700 result = writer.
write(l1DaqJsn);
702 std::stringstream ssL1DaqJsn;
703 ssL1DaqJsn <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
704 ssL1DaqJsn <<
"_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsn";
706 std::ofstream outL1DaqJsn( monPath + ssL1DaqJsn.str() );
743 outfile <<
"{" << std::endl;
744 outfile <<
" \"data\" : [" << std::endl;
746 outfile <<
" \"name\" : \"Processed\"," ;
747 outfile <<
" \"type\" : \"integer\"," ;
748 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
751 outfile <<
" \"name\" : \"Path-WasRun\"," ;
752 outfile <<
" \"type\" : \"integer\"," ;
753 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
756 outfile <<
" \"name\" : \"Path-AfterL1Seed\"," ;
757 outfile <<
" \"type\" : \"integer\"," ;
758 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
761 outfile <<
" \"name\" : \"Path-AfterPrescale\"," ;
762 outfile <<
" \"type\" : \"integer\"," ;
763 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
766 outfile <<
" \"name\" : \"Path-Accepted\"," ;
767 outfile <<
" \"type\" : \"integer\"," ;
768 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
771 outfile <<
" \"name\" : \"Path-Rejected\"," ;
772 outfile <<
" \"type\" : \"integer\"," ;
773 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
776 outfile <<
" \"name\" : \"Path-Errors\"," ;
777 outfile <<
" \"type\" : \"integer\"," ;
778 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
781 outfile <<
" \"name\" : \"Dataset-Accepted\"," ;
782 outfile <<
" \"type\" : \"integer\"," ;
783 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
786 outfile <<
" \"name\" : \"Prescale-Index\"," ;
787 outfile <<
" \"type\" : \"integer\"," ;
788 outfile <<
" \"operation\" : \"sample\"}" << std::endl;
790 outfile <<
" ]" << std::endl;
791 outfile <<
"}" << std::endl;
801 outfile <<
"{" << std::endl;
802 outfile <<
" \"data\" : [" << std::endl;
804 outfile <<
" \"name\" : \"Processed\"," ;
805 outfile <<
" \"type\" : \"integer\"," ;
806 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
809 outfile <<
" \"name\" : \"L1-AlgoAccepted\"," ;
810 outfile <<
" \"type\" : \"integer\"," ;
811 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
814 outfile <<
" \"name\" : \"L1-TechAccepted\"," ;
815 outfile <<
" \"type\" : \"integer\"," ;
816 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
819 outfile <<
" \"name\" : \"L1-AlgoAccepted-Physics\"," ;
820 outfile <<
" \"type\" : \"integer\"," ;
821 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
824 outfile <<
" \"name\" : \"L1-TechAccepted-Physics\"," ;
825 outfile <<
" \"type\" : \"integer\"," ;
826 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
829 outfile <<
" \"name\" : \"L1-AlgoAccepted-Calibration\"," ;
830 outfile <<
" \"type\" : \"integer\"," ;
831 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
834 outfile <<
" \"name\" : \"L1-TechAccepted-Calibration\"," ;
835 outfile <<
" \"type\" : \"integer\"," ;
836 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
839 outfile <<
" \"name\" : \"L1-AlgoAccepted-Random\"," ;
840 outfile <<
" \"type\" : \"integer\"," ;
841 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
844 outfile <<
" \"name\" : \"L1-TechAccepted-Random\"," ;
845 outfile <<
" \"type\" : \"integer\"," ;
846 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
849 outfile <<
" \"name\" : \"L1-Global\"," ;
850 outfile <<
" \"type\" : \"integer\"," ;
851 outfile <<
" \"operation\" : \"histo\"}" << std::endl;
853 outfile <<
" ]" << std::endl;
854 outfile <<
"}" << std::endl;
TriggerJSONMonitoring(const edm::ParameterSet &)
const_iterator end(int bx) const
void resetRun(bool changed)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool wasrun() const
Was at least one path run?
jsoncollector::HistoJ< unsigned int > * hltPre
unsigned int prescaleIndex_
const std::string moduleType(const std::string &module) const
C++ class name of module.
static std::shared_ptr< trigJson::lumiVars > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
jsoncollector::HistoJ< unsigned int > * processed
jsoncollector::HistoJ< unsigned int > * hltDatasets
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< unsigned int > hltDatasets_
jsoncollector::HistoJ< unsigned int > * L1TechAccept
std::string streamHLTMergeType
unsigned int prescaleIndex
std::vector< unsigned int > L1AlgoAccept_
static void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, trigJson::lumiVars *)
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< unsigned int > L1AlgoAcceptPhysics_
bool shouldWriteFiles(unsigned int lumi, unsigned int *proc=0)
jsoncollector::HistoJ< unsigned int > * L1Global
Value & append(const Value &value)
Append value to array at the end.
void update(std::string const &newStr)
std::vector< unsigned int > hltErrors_
std::vector< unsigned int > L1TechAcceptRandom_
void beginRun(edm::Run const &, edm::EventSetup const &)
jsoncollector::HistoJ< unsigned int > * L1TechAcceptCalibration
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results
std::vector< unsigned int > hltL1s_
std::vector< unsigned int > L1TechAcceptCalibration_
const L1GtTriggerMenu * m_l1GtMenu
std::vector< unsigned int > L1AlgoAcceptRandom_
virtual Json::Value toJsonValue() const
std::vector< std::vector< unsigned int > > hltIndex_
LuminosityBlockNumber_t luminosityBlock() const
std::vector< T > & value()
jsoncollector::HistoJ< unsigned int > * L1AlgoAccept
std::vector< unsigned int > hltAccept_
LuminosityBlockNumber_t luminosityBlock() const
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
AlgorithmMap algorithmMap
jsoncollector::HistoJ< unsigned int > * L1AlgoAcceptRandom
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
std::vector< std::string > hltNames_
HLTConfigProvider hltConfig_
jsoncollector::HistoJ< unsigned int > * L1AlgoAcceptPhysics
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
std::string streamHLTDestination
const L1GtTriggerMask * m_l1tTechMask
bool error() const
Has any path encountered an error (exception)
std::vector< std::string > datasetNames_
std::string streamL1MergeType
std::vector< std::string > L1GlobalType_
std::vector< unsigned int > hltReject_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
jsoncollector::HistoJ< unsigned int > * L1TechAcceptRandom
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
std::vector< int > posL1s_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
std::vector< std::string > L1AlgoNames_
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
jsoncollector::HistoJ< unsigned int > * hltWasRun
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
EventAuxiliary const & eventAuxiliary() const
jsoncollector::HistoJ< unsigned int > * hltErrors
std::vector< unsigned int > L1TechAccept_
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
const L1GtTriggerMask * m_l1tAlgoMask
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void writeDefJson(std::string path)
std::vector< unsigned int > L1Global_
const std::vector< std::vector< std::string > > & datasetContents() const
names of trigger paths for all datasets
std::vector< unsigned int > hltWasRun_
jsoncollector::HistoJ< unsigned int > * hltL1s
jsoncollector::HistoJ< unsigned int > * hltReject
std::vector< std::vector< std::string > > datasetContents_
std::vector< int > posPre_
edm::EventAuxiliary::ExperimentType experimentType() const
std::string streamL1Destination
std::vector< unsigned int > L1TechAcceptPhysics_
jsoncollector::HistoJ< unsigned int > * hltAccept
edm::InputTag triggerResults_
std::vector< std::string > L1TechNames_
std::vector< unsigned int > L1AlgoAcceptCalibration_
void analyze(edm::Event const &, edm::EventSetup const &)
jsoncollector::HistoJ< unsigned int > * L1TechAcceptPhysics
unsigned int oldPrescaleIndex
Writes a Value in JSON format in a human friendly way.
const_iterator begin(int bx) const
void writeL1DefJson(std::string path)
T const * product() const
AlgorithmMap technicalMap
const std::vector< std::string > & datasetNames() const
std::vector< unsigned int > hltPre_
jsoncollector::HistoJ< unsigned int > * L1AlgoAcceptCalibration
array value (ordered list)
void endLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, trigJson::lumiVars *) const