Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CaloL1 online DQM to Global #32004

Merged
merged 5 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
267 changes: 179 additions & 88 deletions DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include <memory>
#include <string>
#include <array>
#include <map>

#include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h"

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
Expand Down Expand Up @@ -77,19 +80,189 @@ namespace ComparisonHelper {
}
} // namespace ComparisonHelper

class L1TStage2CaloLayer1 : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
namespace CaloL1Information {

struct monitoringDataHolder {
dqm::reco::MonitorElement *ecalDiscrepancy_;
dqm::reco::MonitorElement *ecalLinkError_;
dqm::reco::MonitorElement *ecalOccupancy_;
dqm::reco::MonitorElement *hcalDiscrepancy_;
dqm::reco::MonitorElement *hcalLinkError_;
dqm::reco::MonitorElement *hcalOccupancy_;

dqm::reco::MonitorElement *ecalOccEtDiscrepancy_;
dqm::reco::MonitorElement *ecalOccFgDiscrepancy_;
dqm::reco::MonitorElement *ecalOccLinkMasked_;
dqm::reco::MonitorElement *ecalOccRecdEtWgt_;
dqm::reco::MonitorElement *ecalOccRecdFgVB_;
dqm::reco::MonitorElement *ecalOccSentAndRecd_;
dqm::reco::MonitorElement *ecalOccSentFgVB_;
dqm::reco::MonitorElement *ecalOccSent_;
dqm::reco::MonitorElement *ecalOccTowerMasked_;
dqm::reco::MonitorElement *ecalTPRawEtCorrelation_;
dqm::reco::MonitorElement *ecalTPRawEtDiffNoMatch_;
dqm::reco::MonitorElement *ecalTPRawEtRecd_;
dqm::reco::MonitorElement *ecalTPRawEtSentAndRecd_;
dqm::reco::MonitorElement *ecalTPRawEtSent_;

dqm::reco::MonitorElement *ecalOccSentNotRecd_;
dqm::reco::MonitorElement *ecalOccRecdNotSent_;
dqm::reco::MonitorElement *ecalOccNoMatch_;

dqm::reco::MonitorElement *hcalOccEtDiscrepancy_;
dqm::reco::MonitorElement *hcalOccFbDiscrepancy_;
dqm::reco::MonitorElement *hcalOccFb2Discrepancy_;
dqm::reco::MonitorElement *hcalOccLinkMasked_;
dqm::reco::MonitorElement *hcalOccRecdEtWgt_;
dqm::reco::MonitorElement *hcalOccRecdFb_;
dqm::reco::MonitorElement *hcalOccRecdFb2_;
dqm::reco::MonitorElement *hcalOccSentAndRecd_;
dqm::reco::MonitorElement *hcalOccSentFb_;
dqm::reco::MonitorElement *hcalOccSentFb2_;
dqm::reco::MonitorElement *hcalOccSent_;
dqm::reco::MonitorElement *hcalOccTowerMasked_;
dqm::reco::MonitorElement *hcalTPRawEtCorrelationHBHE_;
dqm::reco::MonitorElement *hcalTPRawEtCorrelationHF_;
dqm::reco::MonitorElement *hcalTPRawEtDiffNoMatch_;
dqm::reco::MonitorElement *hcalTPRawEtRecd_;
dqm::reco::MonitorElement *hcalTPRawEtSentAndRecd_;
dqm::reco::MonitorElement *hcalTPRawEtSent_;

dqm::reco::MonitorElement *hcalOccSentNotRecd_;
dqm::reco::MonitorElement *hcalOccRecdNotSent_;
dqm::reco::MonitorElement *hcalOccNoMatch_;

dqm::reco::MonitorElement *ECALmismatchesPerBx_;
dqm::reco::MonitorElement *HBHEmismatchesPerBx_;
dqm::reco::MonitorElement *HFmismatchesPerBx_;

dqm::reco::MonitorElement *bxidErrors_;
dqm::reco::MonitorElement *l1idErrors_;
dqm::reco::MonitorElement *orbitErrors_;

dqm::reco::MonitorElement *ecalLinkErrorByLumi_;
dqm::reco::MonitorElement *ecalMismatchByLumi_;
dqm::reco::MonitorElement *hcalLinkErrorByLumi_;
dqm::reco::MonitorElement *hcalMismatchByLumi_;

dqm::reco::MonitorElement *maxEvtLinkErrorsByLumiECAL_;
dqm::reco::MonitorElement *maxEvtLinkErrorsByLumiHCAL_;
dqm::reco::MonitorElement *maxEvtLinkErrorsByLumi_;

dqm::reco::MonitorElement *maxEvtMismatchByLumiECAL_;
dqm::reco::MonitorElement *maxEvtMismatchByLumiHCAL_;
dqm::reco::MonitorElement *maxEvtMismatchByLumi_;

dqm::reco::MonitorElement *last20Mismatches_;

std::vector<std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int>> runMismatchList;
};

struct perStreamMonitoringDataHolder {
int streamNumMaxEvtLinkErrorsECAL{0};
int streamNumMaxEvtLinkErrorsHCAL{0};
int streamNumMaxEvtLinkErrors{0};

int streamNumMaxEvtMismatchECAL{0};
int streamNumMaxEvtMismatchHCAL{0};
int streamNumMaxEvtMismatch{0};
std::vector<std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int>> streamMismatchList;
};

struct perLumiBlockMonitoringInformation {
int lumiNumMaxEvtLinkErrorsECAL{0};
int lumiNumMaxEvtLinkErrorsHCAL{0};
int lumiNumMaxEvtLinkErrors{0};

int lumiNumMaxEvtMismatchECAL{0};
int lumiNumMaxEvtMismatchHCAL{0};
int lumiNumMaxEvtMismatch{0};

std::vector<std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int>> lumiMismatchList;
};

struct perRunSummaryMonitoringInformation {
std::vector<std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int>> runMismatchList;
};

} // namespace CaloL1Information

class L1TStage2CaloLayer1
: public DQMGlobalRunSummaryEDAnalyzer<
CaloL1Information::monitoringDataHolder,
CaloL1Information::perRunSummaryMonitoringInformation,
edm::StreamCache<CaloL1Information::perStreamMonitoringDataHolder>,
edm::LuminosityBlockSummaryCache<CaloL1Information::perLumiBlockMonitoringInformation>> {
public:
L1TStage2CaloLayer1(const edm::ParameterSet &ps);
~L1TStage2CaloLayer1() override;

protected:
void analyze(const edm::Event &e, const edm::EventSetup &c) override;
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override;
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override;
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override;
//DQM module implemented functionality
void dqmBeginRun(edm::Run const &, edm::EventSetup const &, CaloL1Information::monitoringDataHolder &) const override;
void bookHistograms(DQMStore::IBooker &ibooker,
const edm::Run &,
const edm::EventSetup &,
CaloL1Information::monitoringDataHolder &eventMonitors) const override;
void dqmAnalyze(edm::Event const &,
edm::EventSetup const &,
CaloL1Information::monitoringDataHolder const &) const override;
void dqmEndRun(edm::Run const &,
edm::EventSetup const &,
CaloL1Information::monitoringDataHolder const &,
CaloL1Information::perRunSummaryMonitoringInformation const &) const override;
//stream functionality
std::unique_ptr<CaloL1Information::perStreamMonitoringDataHolder> beginStream(edm::StreamID) const override {
return std::make_unique<CaloL1Information::perStreamMonitoringDataHolder>();
};
void streamEndLuminosityBlock(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &) const override{};

//lumi summary functionality
void streamEndLuminosityBlockSummary(edm::StreamID,
edm::LuminosityBlock const &,
edm::EventSetup const &,
CaloL1Information::perLumiBlockMonitoringInformation *) const override;

std::shared_ptr<CaloL1Information::perLumiBlockMonitoringInformation> globalBeginLuminosityBlockSummary(
edm::LuminosityBlock const &, edm::EventSetup const &) const override {
return std::make_unique<CaloL1Information::perLumiBlockMonitoringInformation>();
};

void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &,
edm::EventSetup const &,
CaloL1Information::perLumiBlockMonitoringInformation *) const override;

//run summary functionality.
std::shared_ptr<CaloL1Information::perRunSummaryMonitoringInformation> globalBeginRunSummary(
edm::Run const &, edm::EventSetup const &) const override {
return std::make_unique<CaloL1Information::perRunSummaryMonitoringInformation>();
};

void streamEndRunSummary(edm::StreamID,
edm::Run const &,
edm::EventSetup const &,
CaloL1Information::perRunSummaryMonitoringInformation *) const override;

void globalEndRunSummary(edm::Run const &,
edm::EventSetup const &,
CaloL1Information::perRunSummaryMonitoringInformation *) const override;

private:
void updateMismatch(const edm::Event &e, int mismatchType);
void updateMismatch(
const edm::Event &e,
int mismatchType,
std::vector<std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int>> &streamMismatches) const;

void mergeMismatchVectors(std::vector<std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int>> &,
std::vector<std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int>> &) const;

bool isLaterMismatch(std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int> &candidateMismatch,
std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int> &comparisonMismatch) const;

int findIndex(std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int>,
std::vector<std::tuple<edm::RunID, edm::LuminosityBlockID, edm::EventID, int>>,
int lowerIndexToSearch,
int upperIndexToSearch) const;
// Input and config info
edm::EDGetTokenT<EcalTrigPrimDigiCollection> ecalTPSourceRecd_;
std::string ecalTPSourceRecdLabel_;
Expand All @@ -103,88 +276,6 @@ class L1TStage2CaloLayer1 : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlo
std::string histFolder_;
int tpFillThreshold_;
bool ignoreHFfbs_;

MonitorElement *ecalDiscrepancy_;
MonitorElement *ecalLinkError_;
MonitorElement *ecalOccupancy_;
MonitorElement *hcalDiscrepancy_;
MonitorElement *hcalLinkError_;
MonitorElement *hcalOccupancy_;

MonitorElement *ecalOccEtDiscrepancy_;
MonitorElement *ecalOccFgDiscrepancy_;
MonitorElement *ecalOccLinkMasked_;
MonitorElement *ecalOccRecdEtWgt_;
MonitorElement *ecalOccRecdFgVB_;
MonitorElement *ecalOccSentAndRecd_;
MonitorElement *ecalOccSentFgVB_;
MonitorElement *ecalOccSent_;
MonitorElement *ecalOccTowerMasked_;
MonitorElement *ecalTPRawEtCorrelation_;
MonitorElement *ecalTPRawEtDiffNoMatch_;
MonitorElement *ecalTPRawEtRecd_;
MonitorElement *ecalTPRawEtSentAndRecd_;
MonitorElement *ecalTPRawEtSent_;

MonitorElement *ecalOccSentNotRecd_;
MonitorElement *ecalOccRecdNotSent_;
MonitorElement *ecalOccNoMatch_;

MonitorElement *hcalOccEtDiscrepancy_;
MonitorElement *hcalOccFbDiscrepancy_;
MonitorElement *hcalOccFb2Discrepancy_;
MonitorElement *hcalOccLinkMasked_;
MonitorElement *hcalOccRecdEtWgt_;
MonitorElement *hcalOccRecdFb_;
MonitorElement *hcalOccRecdFb2_;
MonitorElement *hcalOccSentAndRecd_;
MonitorElement *hcalOccSentFb_;
MonitorElement *hcalOccSentFb2_;
MonitorElement *hcalOccSent_;
MonitorElement *hcalOccTowerMasked_;
MonitorElement *hcalTPRawEtCorrelationHBHE_;
MonitorElement *hcalTPRawEtCorrelationHF_;
MonitorElement *hcalTPRawEtDiffNoMatch_;
MonitorElement *hcalTPRawEtRecd_;
MonitorElement *hcalTPRawEtSentAndRecd_;
MonitorElement *hcalTPRawEtSent_;

MonitorElement *hcalOccSentNotRecd_;
MonitorElement *hcalOccRecdNotSent_;
MonitorElement *hcalOccNoMatch_;

MonitorElement *last20Mismatches_;
std::array<std::pair<std::string, int>, 20> last20MismatchArray_;
size_t lastMismatchIndex_{0};

MonitorElement *ecalLinkErrorByLumi_;
MonitorElement *ecalMismatchByLumi_;
MonitorElement *hcalLinkErrorByLumi_;
MonitorElement *hcalMismatchByLumi_;

MonitorElement *maxEvtLinkErrorsByLumiECAL_;
MonitorElement *maxEvtLinkErrorsByLumiHCAL_;
MonitorElement *maxEvtLinkErrorsByLumi_;
int maxEvtLinkErrorsECALCurrentLumi_{0};
int maxEvtLinkErrorsHCALCurrentLumi_{0};

MonitorElement *maxEvtMismatchByLumiECAL_;
MonitorElement *maxEvtMismatchByLumiHCAL_;
MonitorElement *maxEvtMismatchByLumi_;
int maxEvtMismatchECALCurrentLumi_{0};
int maxEvtMismatchHCALCurrentLumi_{0};

MonitorElement *ECALmismatchesPerBx_;
MonitorElement *HBHEmismatchesPerBx_;
MonitorElement *HFmismatchesPerBx_;

MonitorElement *bxidErrors_;
MonitorElement *l1idErrors_;
MonitorElement *orbitErrors_;

// Prevent reallocation per event
std::vector<std::pair<EcalTriggerPrimitiveDigi, EcalTriggerPrimitiveDigi> > ecalTPSentRecd_;
std::vector<std::pair<HcalTriggerPrimitiveDigi, HcalTriggerPrimitiveDigi> > hcalTPSentRecd_;
};

#endif
Loading