Skip to content

Commit

Permalink
Totem T2 DQM timing plot fixes and enhancements, backport of PR cms-s…
Browse files Browse the repository at this point in the history
  • Loading branch information
oljemark committed Jun 12, 2023
1 parent 7fee37f commit 4150f03
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 12 deletions.
37 changes: 34 additions & 3 deletions DQM/CTPPS/plugins/TotemT2DQMSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer {

std::unique_ptr<TotemT2Segmentation> segm_;

static constexpr double HPTDC_BIN_WIDTH_NS_ = 25. / 1024;
static constexpr double T2_BIN_WIDTH_NS_ = 25. / 4;
MonitorElement* HPTDCErrorFlags_2D_ = nullptr;

const unsigned int nbinsx_, nbinsy_;
Expand Down Expand Up @@ -82,9 +82,18 @@ class TotemT2DQMSource : public DQMEDAnalyzer {
PlanePlots() = default;
PlanePlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int nbinsx, unsigned int nbinsy);
};
struct ChannelPlots {
MonitorElement* leadingEdgeCh = nullptr;
MonitorElement* trailingEdgeCh = nullptr;
MonitorElement* timeOverTresholdCh = nullptr;

ChannelPlots() = default;
ChannelPlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum);
};

std::unordered_map<unsigned int, SectorPlots> sectorPlots_;
std::unordered_map<unsigned int, PlanePlots> planePlots_;
std::unordered_map<unsigned int, ChannelPlots> channelPlots_;
};

TotemT2DQMSource::SectorPlots::SectorPlots(
Expand Down Expand Up @@ -145,6 +154,21 @@ TotemT2DQMSource::PlanePlots::PlanePlots(DQMStore::IBooker& ibooker,
double(nbinsy) - 0.5);
}

TotemT2DQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum) {
std::string title, path;
TotemT2DetId(id).channelName(title, TotemT2DetId::nFull);
TotemT2DetId(id).channelName(path, TotemT2DetId::nPath);
ibooker.setCurrentFolder(path);

leadingEdgeCh = ibooker.book1D(
"leading edge", title + " leading edge (DIGIs); leading edge (ns)", 25 * windowsNum, 0, 25 * windowsNum);
trailingEdgeCh = ibooker.book1D(
"trailing edge", title + " trailing edge (DIGIs); trailing edge (ns)", 25 * windowsNum, 0, 25 * windowsNum);

timeOverTresholdCh = ibooker.book1D(
"time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 250, -25, 100);
}

TotemT2DQMSource::TotemT2DQMSource(const edm::ParameterSet& iConfig)
: geometryToken_(esConsumes<TotemGeometry, TotemGeometryRcd, edm::Transition::BeginRun>()),
digiToken_(consumes<edmNew::DetSetVector<TotemT2Digi>>(iConfig.getParameter<edm::InputTag>("digisTag"))),
Expand All @@ -166,6 +190,10 @@ void TotemT2DQMSource::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run
const TotemT2DetId detid(arm, pl, 0);
const TotemT2DetId planeId(detid.planeId());
planePlots_[planeId] = PlanePlots(ibooker, planeId, nbinsx_, nbinsy_);
for (unsigned int ch = 0; ch <= TotemT2DetId::maxChannel; ++ch) {
const TotemT2DetId detidCh(arm, pl, ch);
channelPlots_[detidCh] = ChannelPlots(ibooker, detidCh, windowsNum_);
}
}
const TotemT2DetId detid(arm, 0, 0);
const TotemT2DetId secId(detid.armId());
Expand Down Expand Up @@ -273,13 +301,16 @@ void TotemT2DQMSource::fillErrorFlagsHistogram(const TotemT2Digi& digi) {

void TotemT2DQMSource::fillEdges(const TotemT2Digi& digi, const TotemT2DetId& detid) {
const TotemT2DetId secId(detid.armId());
sectorPlots_[secId].leadingEdge->Fill(HPTDC_BIN_WIDTH_NS_ * digi.leadingEdge());
sectorPlots_[secId].trailingEdge->Fill(HPTDC_BIN_WIDTH_NS_ * digi.trailingEdge());
sectorPlots_[secId].leadingEdge->Fill(T2_BIN_WIDTH_NS_ * digi.leadingEdge());
sectorPlots_[secId].trailingEdge->Fill(T2_BIN_WIDTH_NS_ * digi.trailingEdge());
channelPlots_[detid].leadingEdgeCh->Fill(T2_BIN_WIDTH_NS_ * digi.leadingEdge());
channelPlots_[detid].trailingEdgeCh->Fill(T2_BIN_WIDTH_NS_ * digi.trailingEdge());
}

void TotemT2DQMSource::fillToT(const TotemT2RecHit& rechit, const TotemT2DetId& detid) {
const TotemT2DetId secId(detid.armId());
sectorPlots_[secId].timeOverTreshold->Fill(rechit.toT());
channelPlots_[detid].timeOverTresholdCh->Fill(rechit.toT());
}

DEFINE_FWK_MODULE(TotemT2DQMSource);
30 changes: 21 additions & 9 deletions DQM/CTPPS/test/totemt2_dqm_test_cfg.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import FWCore.ParameterSet.Config as cms
import string

process = cms.Process('RECODQM')
from Configuration.Eras.Era_Run3_cff import Run3

process = cms.Process('RECODQM', Run3)

process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(6000) )
process.verbosity = cms.untracked.PSet( input = cms.untracked.int32(-1) )
Expand All @@ -19,32 +21,42 @@
process.load('Configuration.StandardSequences.Services_cff')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
#process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')

# load DQM framework
process.load("DQM.Integration.config.environment_cfi")
process.dqmEnv.subSystemFolder = "CTPPS"
process.dqmEnv.eventInfoFolder = "EventInfo"
process.dqmSaver.path = ""
process.dqmSaver.tag = "CTPPS"

process.source = cms.Source('PoolSource',
# raw data source
process.source = cms.Source("NewEventStreamFileReader",
fileNames = cms.untracked.vstring(
'/store/data/Run2018D/ZeroBias/RAW/v1/000/324/747/00000/97A72F4B-786F-5A48-B97E-C596DD73BD77.root',
),
'http://cmsrep.cern.ch/cmssw/download/data/RecoPPS/Local/V1/run364983_ls0001_streamA_StorageManager.dat',
# '/store/group/dpg_ctpps/comm_ctpps/TotemT2/RecoTest/run364983_ls0001_streamA_StorageManager.dat',
)
)

#from Configuration.AlCa.GlobalTag import GlobalTag
#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_hlt_relval', '')
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, '130X_dataRun3_HLT_v2', '')

process.load('CalibPPS.ESProducers.totemT2DAQMapping_cff')
#Raw-to-digi
process.load('EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff')

process.load('Geometry.ForwardCommonData.totemT22021V2XML_cfi')
process.load('Geometry.ForwardGeometry.totemGeometryESModule_cfi')
process.load('RecoPPS.Local.totemT2RecHits_cfi')
process.load('DQM.CTPPS.totemT2DQMSource_cfi')
process.totemDAQMappingESSourceXML_TotemT2.verbosity = 0
process.totemT2Digis.RawUnpacking.verbosity = 0
process.totemT2Digis.RawToDigi.verbosity = 0
process.totemT2Digis.RawToDigi.useOlderT2TestFile = cms.untracked.uint32(1)
process.totemT2Digis.RawToDigi.printUnknownFrameSummary = 0
process.totemT2Digis.RawToDigi.printErrorSummary = 0
process.totemDAQMappingESSourceXML_TotemT2.multipleChannelsPerPayload = True

process.path = cms.Path(
process.ctppsRawToDigi *
process.totemT2Digis *
process.totemT2RecHits *
process.totemT2DQMSource
Expand Down

0 comments on commit 4150f03

Please sign in to comment.