Skip to content

Commit

Permalink
Merge pull request #34341 from abhih1/ECALDQM_AddOfflineDBPlots_1131p…
Browse files Browse the repository at this point in the history
…atch1

Add new plots to ECAL Offline DQM with Pedestal and Laser transparency correction from the Database
  • Loading branch information
cmsbuild authored Jul 7, 2021
2 parents 7f3a22a + ba94b0e commit ee3541e
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 7 deletions.
13 changes: 11 additions & 2 deletions DQM/EcalMonitorTasks/interface/OccupancyTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h"
#include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h"
#include "DataFormats/Provenance/interface/Timestamp.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"

namespace ecaldqm {
class OccupancyTask : public DQWorkerTask {
Expand All @@ -16,20 +21,24 @@ namespace ecaldqm {
bool filterRunType(short const*) override;

void beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) override;

void beginRun(edm::Run const&, edm::EventSetup const&) override;
bool analyze(void const*, Collections) override;

void runOnRawData(EcalRawDataCollection const&);
template <typename DigiCollection>
void runOnDigis(DigiCollection const&, Collections);
void runOnTPDigis(EcalTrigPrimDigiCollection const&);
void runOnRecHits(EcalRecHitCollection const&, Collections);
void setEventTime(const edm::TimeValue_t& iTime);
void setTokens(edm::ConsumesCollector&) override;

private:
void setParams(edm::ParameterSet const&) override;

edm::ESGetToken<EcalLaserDbService, EcalLaserDbRecord> lasertoken_;
bool FillLaser = false;
float recHitThreshold_;
float tpThreshold_;
edm::TimeValue_t m_iTime;
};

inline bool OccupancyTask::analyze(void const* _p, Collections _collection) {
Expand Down
9 changes: 8 additions & 1 deletion DQM/EcalMonitorTasks/interface/PresampleTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
#include "DataFormats/EcalDigi/interface/EcalDataFrame.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "CondFormats/EcalObjects/interface/EcalPedestals.h"
#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"

namespace ecaldqm {
class PresampleTask : public DQWorkerTask {
Expand All @@ -14,19 +18,22 @@ namespace ecaldqm {

bool filterRunType(short const*) override;

void beginRun(edm::Run const&, edm::EventSetup const&) override;
void beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) override;
bool analyze(void const*, Collections) override;

template <typename DigiCollection>
void runOnDigis(DigiCollection const&);
void setTokens(edm::ConsumesCollector&) override;

private:
void setParams(edm::ParameterSet const&) override;

edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> Pedtoken_;
bool doPulseMaxCheck_;
int pulseMaxPosition_;
int nSamples_;
MESet* mePedestalByLS;
bool FillPedestal = false;
};

inline bool PresampleTask::analyze(void const* _p, Collections _collection) {
Expand Down
11 changes: 11 additions & 0 deletions DQM/EcalMonitorTasks/python/OccupancyTask_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,18 @@
btype = cms.untracked.string('User'),
path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT rec hit thr occupancy z+(far) - z-(near)'),
description = cms.untracked.string('Filtered rechit occupancy difference.')
),
LaserCorrProjEta = cms.untracked.PSet(
path = cms.untracked.string('Ecal/Trends/%(prefix)sOT Laser Transparency correction from DB %(suffix)s eta projection'),
kind = cms.untracked.string('TProfile'),
yaxis = cms.untracked.PSet(
title= cms.untracked.string('Laser transparency correction')
),
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('ProjEta'),
description = cms.untracked.string('Projection of average laser transparency correction from DB.')
)

# TPDigiProjPhi = cms.untracked.PSet(
# path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT TP digi occupancy%(suffix)s projection phi'),
# kind = cms.untracked.string('TH1F'),
Expand Down
36 changes: 34 additions & 2 deletions DQM/EcalMonitorTasks/python/PresampleTask_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,38 @@
otype = cms.untracked.string('SM'),
btype = cms.untracked.string('Crystal'),
description = cms.untracked.string('2D distribution of mean presample value for "current" LS.')
)
)
),
PedestalProjEtaG1 = cms.untracked.PSet(
path = cms.untracked.string('Ecal/Trends/%(prefix)sOT Pedestal RMS values from DB %(suffix)s eta projection Gain1'),
kind = cms.untracked.string('TProfile'),
yaxis = cms.untracked.PSet(
title = cms.untracked.string('Pedestal RMS')
),
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('ProjEta'),
description = cms.untracked.string('Projection of Pedestal rms values from DB')
),
PedestalProjEtaG6 = cms.untracked.PSet(
path = cms.untracked.string('Ecal/Trends/%(prefix)sOT Pedestal RMS values from DB %(suffix)s eta projection Gain6'),
kind = cms.untracked.string('TProfile'),
yaxis = cms.untracked.PSet(
title = cms.untracked.string('Pedestal RMS')
),
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('ProjEta'),
description = cms.untracked.string('Projection of Pedestal rms values from DB')
),

PedestalProjEtaG12 = cms.untracked.PSet(
path = cms.untracked.string('Ecal/Trends/%(prefix)sOT Pedestal RMS values from DB %(suffix)s eta projection Gain12'),
kind = cms.untracked.string('TProfile'),
yaxis = cms.untracked.PSet(
title = cms.untracked.string('Pedestal RMS')
),
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('ProjEta'),
description = cms.untracked.string('Projection of Pedestal rms values from DB')
)

)
)
30 changes: 28 additions & 2 deletions DQM/EcalMonitorTasks/src/OccupancyTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

#include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
#include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"

namespace ecaldqm {
OccupancyTask::OccupancyTask() : DQWorkerTask(), recHitThreshold_(0.), tpThreshold_(0.) {}
OccupancyTask::OccupancyTask() : DQWorkerTask(), recHitThreshold_(0.), tpThreshold_(0.), m_iTime(0.) {}

void OccupancyTask::setParams(edm::ParameterSet const& _params) {
recHitThreshold_ = _params.getUntrackedParameter<double>("recHitThreshold");
tpThreshold_ = _params.getUntrackedParameter<double>("tpThreshold");
}

void OccupancyTask::setTokens(edm::ConsumesCollector& _collector) { lasertoken_ = _collector.esConsumes(); }

bool OccupancyTask::filterRunType(short const* _runType) {
for (int iFED(0); iFED < 54; iFED++) {
if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
Expand All @@ -25,6 +26,8 @@ namespace ecaldqm {
return false;
}

void OccupancyTask::beginRun(edm::Run const&, edm::EventSetup const& _es) { FillLaser = true; }
void OccupancyTask::setEventTime(const edm::TimeValue_t& iTime) { m_iTime = iTime; }
void OccupancyTask::beginEvent(edm::Event const& _evt,
edm::EventSetup const& _es,
bool const& ByLumiResetSwitch,
Expand All @@ -34,6 +37,29 @@ namespace ecaldqm {
MEs_.at("TPDigiThrAllByLumi").reset(GetElectronicsMap());
MEs_.at("RecHitThrAllByLumi").reset(GetElectronicsMap());
}
MESet& meLaserCorrProjEta(MEs_.at("LaserCorrProjEta"));
if (FillLaser) {
float lasercalib = 1.;
auto const& laser = &_es.getData(lasertoken_);
const edm::Timestamp& evtTimeStamp = edm::Timestamp(m_iTime);

for (int i = 0; i < EBDetId::kSizeForDenseIndexing; i++) {
if (!EBDetId::validDenseIndex(i))
continue;
EBDetId ebid(EBDetId::unhashIndex(i));
lasercalib = laser->getLaserCorrection(ebid, evtTimeStamp);
meLaserCorrProjEta.fill(getEcalDQMSetupObjects(), ebid, lasercalib);
}

for (int i = 0; i < EEDetId::kSizeForDenseIndexing; i++) {
if (!EEDetId::validDenseIndex(i))
continue;
EEDetId eeid(EEDetId::unhashIndex(i));
lasercalib = laser->getLaserCorrection(eeid, evtTimeStamp);
meLaserCorrProjEta.fill(getEcalDQMSetupObjects(), eeid, lasercalib);
}
FillLaser = false;
}
}

void OccupancyTask::runOnRawData(EcalRawDataCollection const& _dcchs) {
Expand Down
37 changes: 37 additions & 0 deletions DQM/EcalMonitorTasks/src/PresampleTask.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "DQM/EcalMonitorTasks/interface/PresampleTask.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"

Expand All @@ -15,6 +16,7 @@ namespace ecaldqm {
pulseMaxPosition_ = _params.getUntrackedParameter<int>("pulseMaxPosition");
nSamples_ = _params.getUntrackedParameter<int>("nSamples");
}
void PresampleTask::setTokens(edm::ConsumesCollector& _collector) { Pedtoken_ = _collector.esConsumes(); }

bool PresampleTask::filterRunType(short const* _runType) {
for (int iFED(0); iFED < nDCC; iFED++) {
Expand All @@ -28,6 +30,8 @@ namespace ecaldqm {
return false;
}

void PresampleTask::beginRun(edm::Run const&, edm::EventSetup const& _es) { FillPedestal = true; }

void PresampleTask::beginEvent(edm::Event const& _evt,
edm::EventSetup const& _es,
bool const& ByLumiResetSwitch,
Expand All @@ -40,6 +44,39 @@ namespace ecaldqm {
if (timestamp_.iLumi % 10 == 0)
mePedestalByLS->reset(GetElectronicsMap());
}

MESet& mePedestalProjEtaG1(MEs_.at("PedestalProjEtaG1"));
MESet& mePedestalProjEtaG6(MEs_.at("PedestalProjEtaG6"));
MESet& mePedestalProjEtaG12(MEs_.at("PedestalProjEtaG12"));

if (FillPedestal) {
const EcalPedestals* myped = &_es.getData(Pedtoken_);

for (int i = 0; i < EBDetId::kSizeForDenseIndexing; i++) {
if (!EBDetId::validDenseIndex(i))
continue;
EBDetId ebid(EBDetId::unhashIndex(i));
EcalPedestals::const_iterator it = myped->find(ebid.rawId());
if (it != myped->end()) {
mePedestalProjEtaG1.fill(getEcalDQMSetupObjects(), ebid, (*it).rms_x1);
mePedestalProjEtaG6.fill(getEcalDQMSetupObjects(), ebid, (*it).rms_x6);
mePedestalProjEtaG12.fill(getEcalDQMSetupObjects(), ebid, (*it).rms_x12);
}
}
for (int i = 0; i < EEDetId::kSizeForDenseIndexing; i++) {
if (!EEDetId::validDenseIndex(i))
continue;
EEDetId eeid(EEDetId::unhashIndex(i));
EcalPedestals::const_iterator it = myped->find(eeid.rawId());
if (it != myped->end()) {
mePedestalProjEtaG1.fill(getEcalDQMSetupObjects(), eeid, (*it).rms_x1);
mePedestalProjEtaG6.fill(getEcalDQMSetupObjects(), eeid, (*it).rms_x6);
mePedestalProjEtaG12.fill(getEcalDQMSetupObjects(), eeid, (*it).rms_x12);
}
}

FillPedestal = false;
}
}

template <typename DigiCollection>
Expand Down

0 comments on commit ee3541e

Please sign in to comment.