Skip to content

Commit

Permalink
Add ByLS DQM plots for ES
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyungmin Park committed Oct 11, 2024
1 parent 4bc3e62 commit 1242a50
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 38 deletions.
17 changes: 11 additions & 6 deletions DQM/EcalPreshowerMonitorModule/interface/ESIntegrityTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"

struct ESLSCache {
struct ESIntLSCache {
int ievtLS_;
int DIErrorsLS_[2][2][40][40];
int DIErrorsByLS_[2][2][40][40];
};

class ESIntegrityTask : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<ESLSCache>> {
class ESIntegrityTask : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<ESIntLSCache>> {
public:
ESIntegrityTask(const edm::ParameterSet& ps);
~ESIntegrityTask() override {}
Expand All @@ -32,8 +32,8 @@ class ESIntegrityTask : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<ESLSCa
void dqmEndRun(const edm::Run& r, const edm::EventSetup& c) override;

/// Begin Lumi
std::shared_ptr<ESLSCache> globalBeginLuminosityBlock(const edm::LuminosityBlock& lumi,
const edm::EventSetup& c) const override;
std::shared_ptr<ESIntLSCache> globalBeginLuminosityBlock(const edm::LuminosityBlock& lumi,
const edm::EventSetup& c) const override;

/// End Lumi
void globalEndLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& c) override;
Expand All @@ -52,20 +52,25 @@ class ESIntegrityTask : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<ESLSCa
MonitorElement* meGain_;
MonitorElement* meFED_;
MonitorElement* meSLinkCRCErr_;
MonitorElement* meSLinkCRCErrByLS_;
MonitorElement* meDCCErr_;
MonitorElement* meDCCCRCErr_;
MonitorElement* meDCCCRCErrByLS_;
MonitorElement* meOptoRX_;
MonitorElement* meOptoBC_;
MonitorElement* meOptoBCByLS_;
MonitorElement* meFiberBadStatus_;
MonitorElement* meFiberErrCode_;
MonitorElement* meFiberErrCodeByLS_;
MonitorElement* meFiberOff_;
MonitorElement* meFiberOffByLS_;
MonitorElement* meEVDR_;
MonitorElement* meKF1_;
MonitorElement* meKF2_;
MonitorElement* meKBC_;
MonitorElement* meKEC_;
MonitorElement* meDIErrors_[2][2];
MonitorElement* meDIErrorsLS_[2][2];
MonitorElement* meDIErrorsByLS_[2][2];
MonitorElement* meDIFraction_;

edm::FileInPath lookup_;
Expand Down
16 changes: 14 additions & 2 deletions DQM/EcalPreshowerMonitorModule/interface/ESOccupancyTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,33 @@

#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"

class ESOccupancyTask : public DQMOneEDAnalyzer<> {
struct ESOccLSCache {
int ievtLS_;
};

class ESOccupancyTask : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<ESOccLSCache>> {
public:
ESOccupancyTask(const edm::ParameterSet& ps);
~ESOccupancyTask() override {}

private:
protected:
void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
void analyze(const edm::Event&, const edm::EventSetup&) override;

/// Begin Lumi
std::shared_ptr<ESOccLSCache> globalBeginLuminosityBlock(const edm::LuminosityBlock& lumi,
const edm::EventSetup& c) const override;
/// End Lumi
void globalEndLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& c) override;

private:
// ----------member data ---------------------------
edm::EDGetTokenT<ESRecHitCollection> rechittoken_;
std::string prefixME_;

MonitorElement* hRecOCC_[2][2];
MonitorElement* hSelOCC_[2][2];
MonitorElement* hSelOCCByLS_[2][2];
MonitorElement* hRecNHit_[2][2];
MonitorElement* hEnDensity_[2][2];
MonitorElement* hSelEnDensity_[2][2];
Expand Down
17 changes: 15 additions & 2 deletions DQM/EcalPreshowerMonitorModule/interface/ESRawDataTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@

#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"

class ESRawDataTask : public DQMEDAnalyzer {
struct ESRawLSCache {
int ievtLS_;
};

class ESRawDataTask : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<ESRawLSCache>> {
public:
ESRawDataTask(const edm::ParameterSet& ps);
~ESRawDataTask() override {}
Expand All @@ -22,6 +27,12 @@ class ESRawDataTask : public DQMEDAnalyzer {
/// Setup
void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;

/// Begin Lumi
std::shared_ptr<ESRawLSCache> globalBeginLuminosityBlock(const edm::LuminosityBlock& lumi,
const edm::EventSetup& c) const override;
/// End Lumi
void globalEndLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& c) override;

private:
int ievt_;

Expand All @@ -30,10 +41,12 @@ class ESRawDataTask : public DQMEDAnalyzer {
edm::EDGetTokenT<ESRawDataCollection> dccCollections_;
edm::EDGetTokenT<FEDRawDataCollection> FEDRawDataCollection_;

//MonitorElement* meRunNumberErrors_;
MonitorElement* meL1ADCCErrors_;
MonitorElement* meL1ADCCErrorsByLS_;
MonitorElement* meBXDCCErrors_;
MonitorElement* meBXDCCErrorsByLS_;
MonitorElement* meOrbitNumberDCCErrors_;
MonitorElement* meOrbitNumberDCCErrorsByLS_;
MonitorElement* meL1ADiff_;
MonitorElement* meBXDiff_;
MonitorElement* meOrbitNumberDiff_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
ESDCCCollections = cms.InputTag("ecalPreshowerDigis"),
ESKChipCollections = cms.InputTag("ecalPreshowerDigis"),
OutputFile = cms.untracked.string(""),
DoLumiAnalysis = cms.bool(False)
DoLumiAnalysis = cms.bool(True)
)

104 changes: 80 additions & 24 deletions DQM/EcalPreshowerMonitorModule/src/ESIntegrityTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ ESIntegrityTask::ESIntegrityTask(const ParameterSet& ps) {
dccCollections_ = consumes<ESRawDataCollection>(ps.getParameter<InputTag>("ESDCCCollections"));
kchipCollections_ = consumes<ESLocalRawDataCollection>(ps.getParameter<InputTag>("ESKChipCollections"));

doLumiAnalysis_ = ps.getParameter<bool>("DoLumiAnalysis");

// read in look-up table
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
Expand Down Expand Up @@ -67,29 +65,35 @@ void ESIntegrityTask::dqmEndRun(const Run& r, const EventSetup& c) {
// TODO: no longer possible, clone histo beforehand if full statisticcs at end of run are required.
}

std::shared_ptr<ESLSCache> ESIntegrityTask::globalBeginLuminosityBlock(const edm::LuminosityBlock& lumi,
const edm::EventSetup& c) const {
std::shared_ptr<ESIntLSCache> ESIntegrityTask::globalBeginLuminosityBlock(const edm::LuminosityBlock& lumi,
const edm::EventSetup& c) const {
LogInfo("ESIntegrityTask") << "analyzed " << ievt_ << " events";
// In case of Lumi based analysis SoftReset the Integrity histogram
auto lumiCache = std::make_shared<ESLSCache>();
auto lumiCache = std::make_shared<ESIntLSCache>();
lumiCache->ievtLS_ = 0;
if (doLumiAnalysis_) {
for (int iz = 0; iz < 2; ++iz) {
for (int ip = 0; ip < 2; ++ip) {
for (int ix = 0; ix < 40; ++ix) {
for (int iy = 0; iy < 40; ++iy) {
(lumiCache->DIErrorsLS_)[iz][ip][ix][iy] = 0;
}

for (int iz = 0; iz < 2; ++iz) {
for (int ip = 0; ip < 2; ++ip) {
meDIErrorsByLS_[iz][ip]->Reset();
for (int ix = 0; ix < 40; ++ix) {
for (int iy = 0; iy < 40; ++iy) {
(lumiCache->DIErrorsByLS_)[iz][ip][ix][iy] = 0;
}
}
}
}

meDCCCRCErrByLS_->Reset();
meFiberErrCodeByLS_->Reset();
meFiberOffByLS_->Reset();
meOptoBCByLS_->Reset();
meSLinkCRCErrByLS_->Reset();

return lumiCache;
}

void ESIntegrityTask::globalEndLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& c) {
if (doLumiAnalysis_)
calculateDIFraction(lumi, c);
calculateDIFraction(lumi, c);
}

void ESIntegrityTask::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&, edm::EventSetup const&) {
Expand Down Expand Up @@ -181,9 +185,44 @@ void ESIntegrityTask::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&
meDIErrors_[i][j]->setAxisTitle("Si Y", 2);
}

if (doLumiAnalysis_) {
sprintf(histo, "ES Good Channel Fraction");
meDIFraction_ = iBooker.book2D(histo, histo, 3, 1.0, 3.0, 3, 1.0, 3.0);
// LS-based histos
sprintf(histo, "ES Good Channel Fraction");
meDIFraction_ = iBooker.book2D(histo, histo, 3, 1.0, 3.0, 3, 1.0, 3.0);

iBooker.setCurrentFolder(prefixME_ + "/ByLumiSection");

sprintf(histo, "ES SLink CRC Errors");
meSLinkCRCErrByLS_ = iBooker.book1D(histo, histo, 56, 519.5, 575.5);
meSLinkCRCErrByLS_->setAxisTitle("ES FED", 1);
meSLinkCRCErrByLS_->setAxisTitle("Num of Events", 2);

sprintf(histo, "ES DCC CRC Errors");
meDCCCRCErrByLS_ = iBooker.book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
meDCCCRCErrByLS_->setAxisTitle("ES FED", 1);
meDCCCRCErrByLS_->setAxisTitle("ES OptoRX", 2);

sprintf(histo, "ES OptoRX BC mismatch");
meOptoBCByLS_ = iBooker.book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
meOptoBCByLS_->setAxisTitle("ES FED", 1);
meOptoBCByLS_->setAxisTitle("ES OptoRX", 2);

sprintf(histo, "ES Fiber Error Code");
meFiberErrCodeByLS_ = iBooker.book1D(histo, histo, 17, -0.5, 16.5);
meFiberErrCodeByLS_->setAxisTitle("Fiber Error Code", 1);

sprintf(histo, "ES Fiber Off");
meFiberOffByLS_ = iBooker.book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
meFiberOffByLS_->setAxisTitle("ES FED", 1);
meFiberOffByLS_->setAxisTitle("Fiber Number", 2);

for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
int iz = (i == 0) ? 1 : -1;
sprintf(histo, "ES Integrity Errors Z %d P %d", iz, j + 1);
meDIErrorsByLS_[i][j] = iBooker.book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
meDIErrorsByLS_[i][j]->setAxisTitle("Si X", 1);
meDIErrorsByLS_[i][j]->setAxisTitle("Si Y", 2);
}
}
}

Expand All @@ -200,10 +239,13 @@ void ESIntegrityTask::analyze(const Event& e, const EventSetup& c) {
// Fill # of events
meDCCErr_->Fill(575, 2, 1);
meDCCCRCErr_->Fill(575, 2, 1);
meDCCCRCErrByLS_->Fill(575, 2, 1);
meOptoRX_->Fill(575, 2, 1);
meOptoBC_->Fill(575, 2, 1);
meOptoBCByLS_->Fill(575, 2, 1);
meFiberBadStatus_->Fill(575, 36, 1);
meFiberOff_->Fill(575, 36, 1);
meFiberOffByLS_->Fill(575, 36, 1);
meEVDR_->Fill(575, 36, 1);

// # of DI errors
Expand All @@ -225,38 +267,48 @@ void ESIntegrityTask::analyze(const Event& e, const EventSetup& c) {
// SLink CRC error
if (dcc.getDCCErrors() == 101) {
meSLinkCRCErr_->Fill(dcc.fedId());
meSLinkCRCErrByLS_->Fill(dcc.fedId());
for (int j = 0; j < 36; ++j)
nDIErr[dcc.fedId() - 520][j]++;
}

if (dcc.getOptoRX0() == 129) {
meOptoRX_->Fill(dcc.fedId(), 0);
if (((dcc.getOptoBC0() - 15) & 0x0fff) != dcc.getBX())
if (((dcc.getOptoBC0() - 15) & 0x0fff) != dcc.getBX()) {
meOptoBC_->Fill(dcc.fedId(), 0);
meOptoBCByLS_->Fill(dcc.fedId(), 0);
}
}
if (dcc.getOptoRX1() == 129) {
meOptoRX_->Fill(dcc.fedId(), 1);
if (((dcc.getOptoBC1() - 15) & 0x0fff) != dcc.getBX())
if (((dcc.getOptoBC1() - 15) & 0x0fff) != dcc.getBX()) {
meOptoBC_->Fill(dcc.fedId(), 1);
meOptoBCByLS_->Fill(dcc.fedId(), 1);
}
}
if (dcc.getOptoRX2() == 129) {
meOptoRX_->Fill(dcc.fedId(), 2);
if (((dcc.getOptoBC2() - 15) & 0x0fff) != dcc.getBX())
if (((dcc.getOptoBC2() - 15) & 0x0fff) != dcc.getBX()) {
meOptoBC_->Fill(dcc.fedId(), 2);
meOptoBCByLS_->Fill(dcc.fedId(), 2);
}
}

if (dcc.getOptoRX0() == 128) {
meDCCCRCErr_->Fill(dcc.fedId(), 0);
meDCCCRCErrByLS_->Fill(dcc.fedId(), 0);
for (int j = 0; j < 12; ++j)
nDIErr[dcc.fedId() - 520][j]++;
}
if (dcc.getOptoRX1() == 128) {
meDCCCRCErr_->Fill(dcc.fedId(), 1);
meDCCCRCErrByLS_->Fill(dcc.fedId(), 1);
for (int j = 12; j < 24; ++j)
nDIErr[dcc.fedId() - 520][j]++;
}
if (dcc.getOptoRX2() == 128) {
meDCCCRCErr_->Fill(dcc.fedId(), 2);
meDCCCRCErrByLS_->Fill(dcc.fedId(), 2);
for (int j = 24; j < 36; ++j)
nDIErr[dcc.fedId() - 520][j]++;
}
Expand All @@ -268,12 +320,16 @@ void ESIntegrityTask::analyze(const Event& e, const EventSetup& c) {
fiberStatus[i] == 12) {
meFiberBadStatus_->Fill(dcc.fedId(), i + 1, 1);
meFiberErrCode_->Fill(fiberStatus[i]);
meFiberErrCodeByLS_->Fill(fiberStatus[i]);
nDIErr[dcc.fedId() - 520][i]++;
}
if (fiberStatus[i] == 7)
if (fiberStatus[i] == 7) {
meFiberOff_->Fill(dcc.fedId(), i + 1, 1);
meFiberOffByLS_->Fill(dcc.fedId(), i + 1, 1);
}
if (fiberStatus[i] == 6) {
meFiberErrCode_->Fill(fiberStatus[i]);
meFiberErrCodeByLS_->Fill(fiberStatus[i]);
meEVDR_->Fill(dcc.fedId(), i + 1, 1);
}
}
Expand Down Expand Up @@ -316,8 +372,8 @@ void ESIntegrityTask::analyze(const Event& e, const EventSetup& c) {

if (nDIErr[fed_[iz][ip][ix][iy] - 520][fiber_[iz][ip][ix][iy]] > 0) {
meDIErrors_[iz][ip]->Fill(ix + 1, iy + 1, 1);
if (doLumiAnalysis_)
(lumiCache->DIErrorsLS_)[iz][ip][ix][iy] += 1;
(lumiCache->DIErrorsByLS_)[iz][ip][ix][iy] += 1;
meDIErrorsByLS_[iz][ip]->Fill(ix + 1, iy + 1, 1);
}
}
}
Expand All @@ -336,7 +392,7 @@ void ESIntegrityTask::calculateDIFraction(const edm::LuminosityBlock& lumi, cons
float reportSummaryES = -1;
for (int x = 0; x < 40; ++x) {
for (int y = 0; y < 40; ++y) {
float val = 1.0 * ((lumiCache->DIErrorsLS_)[i][j][x][y]);
float val = 1.0 * ((lumiCache->DIErrorsByLS_)[i][j][x][y]);
if (fed_[i][j][x][y] == -1)
continue;
if ((lumiCache->ievtLS_) != 0)
Expand Down
Loading

0 comments on commit 1242a50

Please sign in to comment.