25 triggerResults_(ps.getParameter<edm::
InputTag>(
"triggerResults")),
27 level1Results_(ps.getParameter<edm::
InputTag>(
"L1Results")),
29 hltPrescaleProvider_(ps, consumesCollector(), *this)
44 descriptions.
add(
"triggerJSONMonitoring", desc);
61 LogDebug(
"TriggerJSONMonitoring") <<
"Not Physics, Calibration or Random. experimentType = " << ex << std::endl;
70 const std::vector<bool> & algoword = L1TResults.decisionWord();
72 for (
unsigned int i = 0;
i < algoword.size();
i++){
82 LogWarning(
"TriggerJSONMonitoring")<<
"L1 Algo Trigger Mask size does not match number of L1 Algo Triggers!";
85 const std::vector<bool> & techword = L1TResults.technicalTriggerWord();
87 for (
unsigned int i = 0;
i < techword.size();
i++){
97 LogWarning(
"TriggerJSONMonitoring")<<
"L1 Tech Trigger Mask size does not match number of L1 Tech Triggers!";
103 if (!HLTR.isValid()) {
110 for (
unsigned int i=0;
i<
n;
i++) {
116 const int index(static_cast<int>(HLTR->index(
i)));
117 if (HLTR->accept(
i)) {
127 std::vector<bool> acceptedByDS(
hltIndex_.size(),
false);
128 for (
unsigned int ds=0; ds <
hltIndex_.size(); ds++) {
130 if (acceptedByDS[ds]>0 || HLTR->accept(
hltIndex_[ds][
p]) ) {
131 acceptedByDS[ds] =
true;
165 int bitNumber = (itAlgo->second).algoBitNumber();
175 int bitNumber = (itAlgo->second).algoBitNumber();
219 for (
unsigned int ds = 0; ds <
d; ds++) {
222 for (
unsigned int p = 0;
p <
size;
p++) {
232 for (
unsigned int i = 0;
i <
n; ++
i) {
236 for (
unsigned int j = 0;
j < moduleLabels.size(); ++
j) {
238 if (label ==
"HLTLevel1GTSeed")
240 else if (label ==
"HLTPrescaler")
322 LogDebug(
"TriggerJSONMonitoring") <<
"HLTPrescaleProvider initialization failed!" << std::endl;
328 bool expected =
false;
329 if( runCache()->wroteFiles.compare_exchange_strong(expected,
true) ){
330 runCache()->wroteFiles =
true;
332 unsigned int nRun = iRun.
run();
335 std::stringstream ssHltJsd;
336 ssHltJsd <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000";
337 ssHltJsd <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsd";
343 std::stringstream ssL1Jsd;
344 ssL1Jsd <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000";
345 ssL1Jsd <<
"_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsd";
365 hltIni[
"Path-Names"] = hltNamesVal;
366 hltIni[
"Dataset-Names"] = datasetNamesVal;
370 std::stringstream ssHltIni;
371 ssHltIni <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".ini";
373 std::ofstream outHltIni( monPath + ssHltIni.str() );
395 l1Ini[
"L1-Algo-Names"] = l1AlgoNamesVal;
396 l1Ini[
"L1-Tech-Names"] = l1TechNamesVal;
397 l1Ini[
"Event-Type"] = eventTypeVal;
399 result = writer.
write(l1Ini);
401 std::stringstream ssL1Ini;
402 ssL1Ini <<
"run" << std::setfill(
'0') << std::setw(6) << nRun <<
"_ls0000_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".ini";
404 std::ofstream outL1Ini( monPath + ssL1Ini.str() );
417 std::shared_ptr<hltJson::lumiVars>
422 unsigned int MAXPATHS = 500;
435 iSummary->prescaleIndex = 100;
447 iSummary->baseRunDir =
"";
448 iSummary->stHltJsd =
"";
449 iSummary->stL1Jsd =
"";
450 iSummary->streamL1Destination =
"";
451 iSummary->streamHLTDestination =
"";
540 unsigned int iRun = iLumi.
run();
542 bool writeFiles=
true;
554 gethostname(hostname,32);
560 std::stringstream sOutDef;
561 sOutDef << monPath <<
"output_" << getpid() <<
".jsd";
567 hltJsnData[DataPoint::DEFINITION] = iSummary->
stHltJsd;
583 std::stringstream ssHltJsnData;
584 ssHltJsnData <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
585 ssHltJsnData <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsndata";
588 std::ofstream outHltJsnData( monPath + ssHltJsnData.str() );
590 outHltJsnData.close();
595 IntJ hltJsnFilesize = 0;
596 unsigned int hltJsnFileAdler32 = 1;
598 hltJsnFilelist.
update(ssHltJsnData.str());
599 hltJsnFilesize = result.size();
600 hltJsnFileAdler32 =
cms::Adler32(result.c_str(),result.size());
603 hltJsnInputFiles.
update(
"");
608 l1JsnData[DataPoint::DEFINITION] = iSummary->
stL1Jsd;
620 result = writer.
write(l1JsnData);
622 std::stringstream ssL1JsnData;
623 ssL1JsnData <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
624 ssL1JsnData <<
"_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsndata";
627 std::ofstream outL1JsnData( monPath +
"/" + ssL1JsnData.str() );
629 outL1JsnData.close();
634 IntJ l1JsnFilesize = 0;
635 unsigned int l1JsnFileAdler32 = 1;
637 l1JsnFilelist.
update(ssL1JsnData.str());
638 l1JsnFilesize = result.size();
639 l1JsnFileAdler32 =
cms::Adler32(result.c_str(),result.size());
642 l1JsnInputFiles.
update(
"");
649 IntJ daqJsnAccepted = daqJsnProcessed;
650 IntJ daqJsnErrorEvents = 0;
651 IntJ daqJsnRetCodeMask = 0;
652 IntJ daqJsnHLTErrorEvents = 0;
657 hltDaqJsn[DataPoint::DEFINITION] = sOutDef.str();
670 result = writer.
write(hltDaqJsn);
672 std::stringstream ssHltDaqJsn;
673 ssHltDaqJsn <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
674 ssHltDaqJsn <<
"_streamHLTRates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsn";
676 std::ofstream outHltDaqJsn( monPath + ssHltDaqJsn.str() );
678 outHltDaqJsn.close();
683 l1DaqJsn[DataPoint::DEFINITION] = sOutDef.str();
696 result = writer.
write(l1DaqJsn);
698 std::stringstream ssL1DaqJsn;
699 ssL1DaqJsn <<
"run" << std::setfill(
'0') << std::setw(6) << iRun <<
"_ls" << std::setfill(
'0') << std::setw(4) << iLs;
700 ssL1DaqJsn <<
"_streamL1Rates_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".jsn";
702 std::ofstream outL1DaqJsn( monPath + ssL1DaqJsn.str() );
739 outfile <<
"{" << std::endl;
740 outfile <<
" \"data\" : [" << std::endl;
742 outfile <<
" \"name\" : \"Processed\"," ;
743 outfile <<
" \"type\" : \"integer\"," ;
744 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
747 outfile <<
" \"name\" : \"Path-WasRun\"," ;
748 outfile <<
" \"type\" : \"integer\"," ;
749 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
752 outfile <<
" \"name\" : \"Path-AfterL1Seed\"," ;
753 outfile <<
" \"type\" : \"integer\"," ;
754 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
757 outfile <<
" \"name\" : \"Path-AfterPrescale\"," ;
758 outfile <<
" \"type\" : \"integer\"," ;
759 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
762 outfile <<
" \"name\" : \"Path-Accepted\"," ;
763 outfile <<
" \"type\" : \"integer\"," ;
764 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
767 outfile <<
" \"name\" : \"Path-Rejected\"," ;
768 outfile <<
" \"type\" : \"integer\"," ;
769 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
772 outfile <<
" \"name\" : \"Path-Errors\"," ;
773 outfile <<
" \"type\" : \"integer\"," ;
774 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
777 outfile <<
" \"name\" : \"Dataset-Accepted\"," ;
778 outfile <<
" \"type\" : \"integer\"," ;
779 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
782 outfile <<
" \"name\" : \"Prescale-Index\"," ;
783 outfile <<
" \"type\" : \"integer\"," ;
784 outfile <<
" \"operation\" : \"sample\"}" << std::endl;
786 outfile <<
" ]" << std::endl;
787 outfile <<
"}" << std::endl;
797 outfile <<
"{" << std::endl;
798 outfile <<
" \"data\" : [" << std::endl;
800 outfile <<
" \"name\" : \"Processed\"," ;
801 outfile <<
" \"type\" : \"integer\"," ;
802 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
805 outfile <<
" \"name\" : \"L1-AlgoAccepted\"," ;
806 outfile <<
" \"type\" : \"integer\"," ;
807 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
810 outfile <<
" \"name\" : \"L1-TechAccepted\"," ;
811 outfile <<
" \"type\" : \"integer\"," ;
812 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
815 outfile <<
" \"name\" : \"L1-AlgoAccepted-Physics\"," ;
816 outfile <<
" \"type\" : \"integer\"," ;
817 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
820 outfile <<
" \"name\" : \"L1-TechAccepted-Physics\"," ;
821 outfile <<
" \"type\" : \"integer\"," ;
822 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
825 outfile <<
" \"name\" : \"L1-AlgoAccepted-Calibration\"," ;
826 outfile <<
" \"type\" : \"integer\"," ;
827 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
830 outfile <<
" \"name\" : \"L1-TechAccepted-Calibration\"," ;
831 outfile <<
" \"type\" : \"integer\"," ;
832 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
835 outfile <<
" \"name\" : \"L1-AlgoAccepted-Random\"," ;
836 outfile <<
" \"type\" : \"integer\"," ;
837 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
840 outfile <<
" \"name\" : \"L1-TechAccepted-Random\"," ;
841 outfile <<
" \"type\" : \"integer\"," ;
842 outfile <<
" \"operation\" : \"histo\"}," << std::endl;
845 outfile <<
" \"name\" : \"L1-Global\"," ;
846 outfile <<
" \"type\" : \"integer\"," ;
847 outfile <<
" \"operation\" : \"histo\"}" << std::endl;
849 outfile <<
" ]" << std::endl;
850 outfile <<
"}" << std::endl;
TriggerJSONMonitoring(const edm::ParameterSet &)
void resetRun(bool changed)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1t_results
HistoJ< unsigned int > * L1TechAccept
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
HistoJ< unsigned int > * hltReject
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)
HistoJ< unsigned int > * hltErrors
Value & append(const Value &value)
Append value to array at the end.
void update(std::string const &newStr)
HistoJ< unsigned int > * L1AlgoAccept
std::vector< unsigned int > hltErrors_
static void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, hltJson::lumiVars *)
std::vector< unsigned int > L1TechAcceptRandom_
void beginRun(edm::Run const &, edm::EventSetup const &)
HistoJ< unsigned int > * processed
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()
HistoJ< unsigned int > * hltAccept
HistoJ< unsigned int > * L1AlgoAcceptCalibration
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
tuple path
else: Piece not in the list, fine.
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_
HistoJ< unsigned int > * L1TechAcceptCalibration
const L1GtTriggerMask * m_l1tTechMask
std::vector< std::string > datasetNames_
std::vector< std::string > L1GlobalType_
std::vector< unsigned int > hltReject_
HistoJ< unsigned int > * hltPre
HistoJ< unsigned int > * L1AlgoAcceptRandom
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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
HistoJ< unsigned int > * hltDatasets
HistoJ< unsigned int > * L1TechAcceptRandom
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
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
HistoJ< unsigned int > * hltL1s
std::vector< unsigned int > L1TechAcceptPhysics_
edm::InputTag triggerResults_
std::vector< std::string > L1TechNames_
HistoJ< unsigned int > * L1TechAcceptPhysics
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.
HistoJ< unsigned int > * L1Global
HistoJ< unsigned int > * hltWasRun
void writeL1DefJson(std::string path)
tuple size
Write out results.
AlgorithmMap technicalMap
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
HistoJ< unsigned int > * L1AlgoAcceptPhysics
const std::vector< std::string > & datasetNames() const
std::vector< unsigned int > hltPre_
array value (ordered list)