23 using namespace jsoncollector;
26 triggerResults_(ps.getParameter<edm::
InputTag>(
"triggerResults")),
28 level1Results_(ps.getParameter<edm::
InputTag>(
"L1Results")),
30 hltPrescaleProvider_(ps, consumesCollector(), *this)
45 descriptions.
add(
"triggerJSONMonitoring", desc);
62 LogDebug(
"TriggerJSONMonitoring") <<
"Not Physics, Calibration or Random. experimentType = " << ex << std::endl;
71 const std::vector<bool> & algoword = L1TResults.decisionWord();
73 for (
unsigned int i = 0;
i < algoword.size();
i++){
83 LogWarning(
"TriggerJSONMonitoring")<<
"L1 Algo Trigger Mask size does not match number of L1 Algo Triggers!";
86 const std::vector<bool> & techword = L1TResults.technicalTriggerWord();
88 for (
unsigned int i = 0;
i < techword.size();
i++){
98 LogWarning(
"TriggerJSONMonitoring")<<
"L1 Tech Trigger Mask size does not match number of L1 Tech Triggers!";
104 if (!HLTR.isValid()) {
111 for (
unsigned int i=0;
i<
n;
i++) {
117 const int index(static_cast<int>(HLTR->index(
i)));
118 if (HLTR->accept(
i)) {
128 std::vector<bool> acceptedByDS(
hltIndex_.size(),
false);
129 for (
unsigned int ds=0; ds <
hltIndex_.size(); ds++) {
131 if (acceptedByDS[ds]>0 || HLTR->accept(
hltIndex_[ds][
p]) ) {
132 acceptedByDS[ds] =
true;
166 int bitNumber = (itAlgo->second).algoBitNumber();
176 int bitNumber = (itAlgo->second).algoBitNumber();
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")
323 LogDebug(
"TriggerJSONMonitoring") <<
"HLTPrescaleProvider initialization failed!" << std::endl;
329 bool expected =
false;
330 if( runCache()->wroteFiles.compare_exchange_strong(expected,
true) ){
331 runCache()->wroteFiles =
true;
333 unsigned int nRun = iRun.
run();
336 std::stringstream ssHltJsd;
337 ssHltJsd <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000";
338 ssHltJsd <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsd";
344 std::stringstream ssL1Jsd;
345 ssL1Jsd <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000";
346 ssL1Jsd <<
"_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsd";
366 hltIni[
"Path-Names"] = hltNamesVal;
367 hltIni[
"Dataset-Names"] = datasetNamesVal;
371 std::stringstream ssHltIni;
372 ssHltIni <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".ini";
374 std::ofstream outHltIni( monPath + ssHltIni.str() );
396 l1Ini[
"L1-Algo-Names"] = l1AlgoNamesVal;
397 l1Ini[
"L1-Tech-Names"] = l1TechNamesVal;
398 l1Ini[
"Event-Type"] = eventTypeVal;
400 result = writer.
write(l1Ini);
402 std::stringstream ssL1Ini;
403 ssL1Ini <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".ini";
405 std::ofstream outL1Ini( monPath + ssL1Ini.str() );
418 std::shared_ptr<hltJson::lumiVars>
423 unsigned int MAXPATHS = 500;
436 iSummary->prescaleIndex = 100;
448 iSummary->baseRunDir =
"";
449 iSummary->stHltJsd =
"";
450 iSummary->stL1Jsd =
"";
451 iSummary->streamL1Destination =
"";
452 iSummary->streamHLTDestination =
"";
541 unsigned int iRun = iLumi.
run();
543 bool writeFiles=
true;
555 gethostname(hostname,32);
561 std::stringstream sOutDef;
562 sOutDef << monPath <<
"output_" << getpid() <<
".jsd";
568 hltJsnData[DataPoint::DEFINITION] = iSummary->
stHltJsd;
584 std::stringstream ssHltJsnData;
585 ssHltJsnData <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
586 ssHltJsnData <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsndata";
589 std::ofstream outHltJsnData( monPath + ssHltJsnData.str() );
591 outHltJsnData.close();
596 IntJ hltJsnFilesize = 0;
597 unsigned int hltJsnFileAdler32 = 1;
599 hltJsnFilelist.
update(ssHltJsnData.str());
600 hltJsnFilesize = result.size();
601 hltJsnFileAdler32 =
cms::Adler32(result.c_str(),result.size());
604 hltJsnInputFiles.
update(
"");
609 l1JsnData[DataPoint::DEFINITION] = iSummary->
stL1Jsd;
621 result = writer.
write(l1JsnData);
623 std::stringstream ssL1JsnData;
624 ssL1JsnData <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
625 ssL1JsnData <<
"_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsndata";
628 std::ofstream outL1JsnData( monPath +
"/" + ssL1JsnData.str() );
630 outL1JsnData.close();
635 IntJ l1JsnFilesize = 0;
636 unsigned int l1JsnFileAdler32 = 1;
638 l1JsnFilelist.
update(ssL1JsnData.str());
639 l1JsnFilesize = result.size();
640 l1JsnFileAdler32 =
cms::Adler32(result.c_str(),result.size());
643 l1JsnInputFiles.
update(
"");
650 IntJ daqJsnAccepted = daqJsnProcessed;
651 IntJ daqJsnErrorEvents = 0;
652 IntJ daqJsnRetCodeMask = 0;
653 IntJ daqJsnHLTErrorEvents = 0;
658 hltDaqJsn[DataPoint::DEFINITION] = sOutDef.str();
671 result = writer.
write(hltDaqJsn);
673 std::stringstream ssHltDaqJsn;
674 ssHltDaqJsn <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
675 ssHltDaqJsn <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsn";
677 std::ofstream outHltDaqJsn( monPath + ssHltDaqJsn.str() );
679 outHltDaqJsn.close();
684 l1DaqJsn[DataPoint::DEFINITION] = sOutDef.str();
697 result = writer.
write(l1DaqJsn);
699 std::stringstream ssL1DaqJsn;
700 ssL1DaqJsn <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
701 ssL1DaqJsn <<
"_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsn";
703 std::ofstream outL1DaqJsn( monPath + ssL1DaqJsn.str() );
740 outfile <<
"{" << std::endl;
741 outfile <<
" \"data\" : [" << std::endl;
743 outfile <<
" \"name\" : \"Processed\"," ;
744 outfile <<
" \"type\" : \"integer\"," ;
745 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
748 outfile <<
" \"name\" : \"Path-WasRun\"," ;
749 outfile <<
" \"type\" : \"integer\"," ;
750 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
753 outfile <<
" \"name\" : \"Path-AfterL1Seed\"," ;
754 outfile <<
" \"type\" : \"integer\"," ;
755 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
758 outfile <<
" \"name\" : \"Path-AfterPrescale\"," ;
759 outfile <<
" \"type\" : \"integer\"," ;
760 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
763 outfile <<
" \"name\" : \"Path-Accepted\"," ;
764 outfile <<
" \"type\" : \"integer\"," ;
765 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
768 outfile <<
" \"name\" : \"Path-Rejected\"," ;
769 outfile <<
" \"type\" : \"integer\"," ;
770 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
773 outfile <<
" \"name\" : \"Path-Errors\"," ;
774 outfile <<
" \"type\" : \"integer\"," ;
775 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
778 outfile <<
" \"name\" : \"Dataset-Accepted\"," ;
779 outfile <<
" \"type\" : \"integer\"," ;
780 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
783 outfile <<
" \"name\" : \"Prescale-Index\"," ;
784 outfile <<
" \"type\" : \"integer\"," ;
785 outfile <<
" \"operation\" : \"sample\"}" << std::endl;
787 outfile <<
" ]" << std::endl;
788 outfile <<
"}" << std::endl;
798 outfile <<
"{" << std::endl;
799 outfile <<
" \"data\" : [" << std::endl;
801 outfile <<
" \"name\" : \"Processed\"," ;
802 outfile <<
" \"type\" : \"integer\"," ;
803 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
806 outfile <<
" \"name\" : \"L1-AlgoAccepted\"," ;
807 outfile <<
" \"type\" : \"integer\"," ;
808 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
811 outfile <<
" \"name\" : \"L1-TechAccepted\"," ;
812 outfile <<
" \"type\" : \"integer\"," ;
813 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
816 outfile <<
" \"name\" : \"L1-AlgoAccepted-Physics\"," ;
817 outfile <<
" \"type\" : \"integer\"," ;
818 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
821 outfile <<
" \"name\" : \"L1-TechAccepted-Physics\"," ;
822 outfile <<
" \"type\" : \"integer\"," ;
823 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
826 outfile <<
" \"name\" : \"L1-AlgoAccepted-Calibration\"," ;
827 outfile <<
" \"type\" : \"integer\"," ;
828 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
831 outfile <<
" \"name\" : \"L1-TechAccepted-Calibration\"," ;
832 outfile <<
" \"type\" : \"integer\"," ;
833 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
836 outfile <<
" \"name\" : \"L1-AlgoAccepted-Random\"," ;
837 outfile <<
" \"type\" : \"integer\"," ;
838 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
841 outfile <<
" \"name\" : \"L1-TechAccepted-Random\"," ;
842 outfile <<
" \"type\" : \"integer\"," ;
843 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
846 outfile <<
" \"name\" : \"L1-Global\"," ;
847 outfile <<
" \"type\" : \"integer\"," ;
848 outfile <<
" \"operation\" : \"histo\"}" << std::endl;
850 outfile <<
" ]" << std::endl;
851 outfile <<
"}" << std::endl;
TriggerJSONMonitoring(const edm::ParameterSet &)
void resetRun(bool changed)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
jsoncollector::HistoJ< unsigned int > * hltAccept
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1t_results
unsigned int prescaleIndex_
unsigned int prescaleIndex
const std::string moduleType(const std::string &module) const
C++ class name of module.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< unsigned int > hltDatasets_
static std::shared_ptr< hltJson::lumiVars > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
std::vector< unsigned int > L1AlgoAccept_
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)
Value & append(const Value &value)
Append value to array at the end.
void update(std::string const &newStr)
std::vector< unsigned int > hltErrors_
static void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, hltJson::lumiVars *)
jsoncollector::HistoJ< unsigned int > * L1Global
std::vector< unsigned int > L1TechAcceptRandom_
void beginRun(edm::Run const &, edm::EventSetup const &)
std::vector< unsigned int > hltL1s_
std::vector< unsigned int > L1TechAcceptCalibration_
const L1GtTriggerMenu * m_l1GtMenu
std::vector< unsigned int > L1AlgoAcceptRandom_
jsoncollector::HistoJ< unsigned int > * hltWasRun
virtual Json::Value toJsonValue() const
jsoncollector::HistoJ< unsigned int > * L1AlgoAcceptCalibration
std::vector< std::vector< unsigned int > > hltIndex_
LuminosityBlockNumber_t luminosityBlock() const
jsoncollector::HistoJ< unsigned int > * L1TechAcceptPhysics
std::vector< T > & value()
triggerResultsToken_(consumes< edm::TriggerResults >(edm::InputTag("TriggerResults")))
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
std::string streamL1Destination
jsoncollector::HistoJ< unsigned int > * hltDatasets
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
void endLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, hltJson::lumiVars *) const
std::vector< std::string > hltNames_
HLTConfigProvider hltConfig_
const L1GtTriggerMask * m_l1tTechMask
std::vector< std::string > datasetNames_
std::vector< std::string > L1GlobalType_
jsoncollector::HistoJ< unsigned int > * L1AlgoAccept
jsoncollector::HistoJ< unsigned int > * L1AlgoAcceptPhysics
std::vector< unsigned int > hltReject_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
jsoncollector::HistoJ< unsigned int > * L1TechAcceptCalibration
std::string streamHLTDestination
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
std::vector< int > posL1s_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::vector< std::string > L1AlgoNames_
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)
EventAuxiliary const & eventAuxiliary() const
jsoncollector::HistoJ< unsigned int > * hltPre
std::vector< unsigned int > L1TechAccept_
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
T const * product() const
const L1GtTriggerMask * m_l1tAlgoMask
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void writeDefJson(std::string path)
HLTConfigProvider const & hltConfigProvider() const
jsoncollector::HistoJ< unsigned int > * L1AlgoAcceptRandom
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_
std::vector< std::vector< std::string > > datasetContents_
< trclass="colgroup">< tdclass="colgroup"colspan=5 > DT local reconstruction</td ></tr >< tr >< td >< ahref="classDTRecHit1DPair.html"> DTRecHit1DPair</a ></td >< td >< ahref="DataFormats_DTRecHit.html"> edm::RangeMap & lt
std::vector< int > posPre_
edm::EventAuxiliary::ExperimentType experimentType() const
jsoncollector::HistoJ< unsigned int > * hltErrors
jsoncollector::HistoJ< unsigned int > * processed
std::vector< unsigned int > L1TechAcceptPhysics_
edm::InputTag triggerResults_
std::vector< std::string > L1TechNames_
HLTPrescaleProvider hltPrescaleProvider_
std::vector< unsigned int > L1AlgoAcceptCalibration_
void analyze(edm::Event const &, edm::EventSetup const &)
unsigned int oldPrescaleIndex
Writes a Value in JSON format in a human friendly way.
void writeL1DefJson(std::string path)
jsoncollector::HistoJ< unsigned int > * L1TechAccept
tuple size
Write out results.
AlgorithmMap technicalMap
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
jsoncollector::HistoJ< unsigned int > * hltL1s
jsoncollector::HistoJ< unsigned int > * hltReject
const std::vector< std::string > & datasetNames() const
std::vector< unsigned int > hltPre_
jsoncollector::HistoJ< unsigned int > * L1TechAcceptRandom
array value (ordered list)