Skip to content
Draft
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
117 changes: 63 additions & 54 deletions DQM/CTPPS/plugins/TotemT2DQMSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer {
enum evFlag { t2TE = 0, t2LE, t2MT, t2ML };

const unsigned int nbinsx_, nbinsy_;
const bool t2Plots_;
const unsigned int windowsNum_;

struct SectorPlots {
Expand Down Expand Up @@ -214,77 +215,85 @@ TotemT2DQMSource::TotemT2DQMSource(const edm::ParameterSet& iConfig)
: digiToken_(consumes<edmNew::DetSetVector<TotemT2Digi>>(iConfig.getParameter<edm::InputTag>("digisTag"))),
nbinsx_(iConfig.getParameter<unsigned int>("nbinsx")),
nbinsy_(iConfig.getParameter<unsigned int>("nbinsy")),
t2Plots_(iConfig.getParameter<bool>("specialRunT2")),
windowsNum_(iConfig.getParameter<unsigned int>("windowsNum")) {}

void TotemT2DQMSource::dqmBeginRun(const edm::Run&, const edm::EventSetup&) {}

void TotemT2DQMSource::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup& iSetup) {
ibooker.cd();
ibooker.setCurrentFolder("TotemT2");

bookErrorFlagsHistogram(ibooker);

for (unsigned int arm = 0; arm <= CTPPSDetId::maxArm; ++arm) {
for (unsigned int pl = 0; pl <= TotemT2DetId::maxPlane; ++pl) {
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_);
if (t2Plots_) {
ibooker.cd();
ibooker.setCurrentFolder("TotemT2");

bookErrorFlagsHistogram(ibooker);

for (unsigned int arm = 0; arm <= CTPPSDetId::maxArm; ++arm) {
for (unsigned int pl = 0; pl <= TotemT2DetId::maxPlane; ++pl) {
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());
sectorPlots_[secId] = SectorPlots(ibooker, secId, nbinsx_, nbinsy_, windowsNum_);
}
const TotemT2DetId detid(arm, 0, 0);
const TotemT2DetId secId(detid.armId());
sectorPlots_[secId] = SectorPlots(ibooker, secId, nbinsx_, nbinsy_, windowsNum_);
}

// build a segmentation helper for the size of histograms previously booked
segm_ = std::make_unique<TotemT2Segmentation>(nbinsx_, nbinsy_);
// build a segmentation helper for the size of histograms previously booked
segm_ = std::make_unique<TotemT2Segmentation>(nbinsx_, nbinsy_);
}
}

void TotemT2DQMSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
// fill digis information
std::unordered_map<unsigned int, std::set<unsigned int>> planes;

for (const auto& ds_digis : iEvent.get(digiToken_)) {
if (!ds_digis.empty()) {
const TotemT2DetId detid(ds_digis.detId());
const TotemT2DetId planeId(detid.planeId());
for (const auto& digi : ds_digis) {
if (digi.hasLE()) {
segm_->fill(planePlots_[planeId].digisMultiplicity->getTH2D(), detid);
if (digi.hasTE())
fillTriggerBitset(detid);
if (t2Plots_) {
// fill digis information
std::unordered_map<unsigned int, std::set<unsigned int>> planes;

if (!iEvent.getHandle(digiToken_).isValid())
return;

for (const auto& ds_digis : iEvent.get(digiToken_)) {
if (!ds_digis.empty()) {
const TotemT2DetId detid(ds_digis.detId());
const TotemT2DetId planeId(detid.planeId());
for (const auto& digi : ds_digis) {
if (digi.hasLE()) {
segm_->fill(planePlots_[planeId].digisMultiplicity->getTH2D(), detid);
if (digi.hasTE())
fillTriggerBitset(detid);
}
fillErrorFlagsHistogram(digi, detid);
fillEdges(digi, detid);
fillToT(digi, detid);
fillFlags(digi, detid);
int bx = iEvent.bunchCrossing();
fillBX(digi, detid, bx);
if (digi.hasLE() && digi.hasTE()) //good digi
fillActivePlanes(planes, detid);
}
fillErrorFlagsHistogram(digi, detid);
fillEdges(digi, detid);
fillToT(digi, detid);
fillFlags(digi, detid);
int bx = iEvent.bunchCrossing();
fillBX(digi, detid, bx);
if (digi.hasLE() && digi.hasTE()) //good digi
fillActivePlanes(planes, detid);
}
}
}

for (const auto& plt : sectorPlots_)
plt.second.activePlanesCount->Fill(planes[plt.first].size());

for (unsigned short arm = 0; arm <= CTPPSDetId::maxArm; ++arm)
for (unsigned short plane = 0; plane <= 1; ++plane)
for (unsigned short id = 0; id <= TotemT2DetId::maxChannel; ++id) {
const TotemT2DetId detid(arm, plane, id);
if (areChannelsTriggered(detid)) {
const TotemT2DetId secId(detid.armId());
segm_->fill(sectorPlots_[secId].triggerEmulator->getTH2D(), detid);
for (const auto& plt : sectorPlots_)
plt.second.activePlanesCount->Fill(planes[plt.first].size());

for (unsigned short arm = 0; arm <= CTPPSDetId::maxArm; ++arm)
for (unsigned short plane = 0; plane <= 1; ++plane)
for (unsigned short id = 0; id <= TotemT2DetId::maxChannel; ++id) {
const TotemT2DetId detid(arm, plane, id);
if (areChannelsTriggered(detid)) {
const TotemT2DetId secId(detid.armId());
segm_->fill(sectorPlots_[secId].triggerEmulator->getTH2D(), detid);
}
}
}

// fill rechits information
// fill rechits information

clearTriggerBitset();
clearTriggerBitset();
}
}

void TotemT2DQMSource::fillActivePlanes(std::unordered_map<unsigned int, std::set<unsigned int>>& planes,
Expand Down Expand Up @@ -353,8 +362,8 @@ void TotemT2DQMSource::fillEdges(const TotemT2Digi& digi, const TotemT2DetId& de
}

void TotemT2DQMSource::fillBX(const TotemT2Digi& digi, const TotemT2DetId& detid, const int bx) {
const TotemT2DetId secId(detid.armId());
if (digi.hasLE()) {
const TotemT2DetId secId(detid.armId());
sectorPlots_[secId].activityPerBX->Fill(bx);
channelPlots_[detid].activityPerBXCh->Fill(bx);
}
Expand Down
1 change: 1 addition & 0 deletions DQM/CTPPS/python/totemT2DQMSource_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
digisTag = cms.InputTag('totemT2Digis', 'TotemT2'),
nbinsx = cms.uint32(25),
nbinsy = cms.uint32(25),
specialRunT2 = cms.bool(False),
windowsNum = cms.uint32(8),

perLSsaving = cms.untracked.bool(False), #driven by DQMServices/Core/python/DQMStore_cfi.py
Expand Down
2 changes: 2 additions & 0 deletions DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
# CTPPS DQM modules
process.load("DQM.CTPPS.ctppsDQM_cff")

process.totemT2DQMSource.specialRunT2 = True

process.path = cms.Path(
process.ctppsRawToDigi *
process.recoCTPPS *
Expand Down
5 changes: 0 additions & 5 deletions RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
'keep TotemRPUVPatternedmDetSetVector_totemRPUVPatternFinder_*_*',
'keep TotemRPLocalTrackedmDetSetVector_totemRPLocalTrackFitter_*_*',

# totem T2
'keep TotemFEDInfos_totemT2Digis_*_*',
'keep TotemT2DigiedmNewDetSetVector_totemT2Digis_*_*',
'keep TotemVFATStatusedmDetSetVector_totemT2Digis_*_*',

# timing diamonds
'keep TotemFEDInfos_ctppsDiamondRawToDigi_*_*',
'keep CTPPSDiamondDigiedmDetSetVector_ctppsDiamondRawToDigi_*_*',
Expand Down