Skip to content

Commit

Permalink
Update the Totem T2 mapping, data format, and DQM functionality, from…
Browse files Browse the repository at this point in the history
… PR #41785
  • Loading branch information
oljemark committed Jun 2, 2023
1 parent b2aa6bb commit f6823b1
Show file tree
Hide file tree
Showing 25 changed files with 522 additions and 84 deletions.
12 changes: 9 additions & 3 deletions CalibPPS/ESProducers/python/totemT2DAQMapping_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@

totemDAQMappingESSourceXML = _xml.clone(
subSystem = "TotemT2",
multipleChannelsPerPayload = cms.untracked.bool(False),
multipleChannelsPerPayload = cms.untracked.bool(True),
configuration = cms.VPSet(
#initial dummy diamond map copy
cms.PSet(
validityRange = cms.EventRange("1:min - 364982:max"),
mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/mapping_totem_nt2_2021.xml"),
maskFileNames = cms.vstring()
),
#T2 firmware test files
#old v2.1 T2 firmware test file
cms.PSet(
validityRange = cms.EventRange("364983:min - 999999999:max"),
validityRange = cms.EventRange("364983:min - 368022:max"),
mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/mapping_totem_nt2_2023.xml"),
maskFileNames = cms.vstring()
),
#final T2 mapping test files
cms.PSet(
validityRange = cms.EventRange("368023:min - 999999999:max"),
mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/mapping_totem_nt2_2023_final.xml"),
maskFileNames = cms.vstring()
)
),
sampicSubDetId = cms.uint32(6),
Expand Down
103 changes: 103 additions & 0 deletions CondFormats/PPSObjects/xml/mapping_totem_nt2_2023_final.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<!-- This mapping is a preliminary real T2 mapping, still to be updated and validated
and made unique in each arm. -->
<top>
<arm id="0"> <!-- sector 45, CMS negative z -->
<nt2_plane id="0">
<nt2_tile id="0" hwId="0x20" FEDId="577" GOHId="1" IdxInFiber="0" pay="0"/>
<nt2_tile id="1" hwId="0x21" FEDId="577" GOHId="1" IdxInFiber="0" pay="1"/>
<nt2_tile id="2" hwId="0x22" FEDId="577" GOHId="1" IdxInFiber="1" pay="0"/>
<nt2_tile id="3" hwId="0x23" FEDId="577" GOHId="1" IdxInFiber="1" pay="1"/>
</nt2_plane>
<nt2_plane id="1">
<nt2_tile id="0" hwId="0x24" FEDId="577" GOHId="1" IdxInFiber="2" pay="0"/>
<nt2_tile id="1" hwId="0x25" FEDId="577" GOHId="1" IdxInFiber="2" pay="1"/>
<nt2_tile id="2" hwId="0x26" FEDId="577" GOHId="1" IdxInFiber="3" pay="0"/>
<nt2_tile id="3" hwId="0x27" FEDId="577" GOHId="1" IdxInFiber="3" pay="1"/>
</nt2_plane>
<nt2_plane id="2">
<nt2_tile id="0" hwId="0x28" FEDId="577" GOHId="1" IdxInFiber="4" pay="0"/>
<nt2_tile id="1" hwId="0x29" FEDId="577" GOHId="1" IdxInFiber="4" pay="1"/>
<nt2_tile id="2" hwId="0x2A" FEDId="577" GOHId="1" IdxInFiber="5" pay="0"/>
<nt2_tile id="3" hwId="0x2B" FEDId="577" GOHId="1" IdxInFiber="5" pay="1"/>
</nt2_plane>
<nt2_plane id="3">
<nt2_tile id="0" hwId="0x2C" FEDId="577" GOHId="1" IdxInFiber="6" pay="0"/>
<nt2_tile id="1" hwId="0x2D" FEDId="577" GOHId="1" IdxInFiber="6" pay="1"/>
<nt2_tile id="2" hwId="0x2E" FEDId="577" GOHId="1" IdxInFiber="7" pay="0"/>
<nt2_tile id="3" hwId="0x2F" FEDId="577" GOHId="1" IdxInFiber="7" pay="1"/>
</nt2_plane>
<nt2_plane id="4">
<nt2_tile id="0" hwId="0x30" FEDId="577" GOHId="1" IdxInFiber="8" pay="0"/>
<nt2_tile id="1" hwId="0x31" FEDId="577" GOHId="1" IdxInFiber="8" pay="1"/>
<nt2_tile id="2" hwId="0x32" FEDId="577" GOHId="1" IdxInFiber="9" pay="0"/>
<nt2_tile id="3" hwId="0x33" FEDId="577" GOHId="1" IdxInFiber="9" pay="1"/>
</nt2_plane>
<nt2_plane id="5">
<nt2_tile id="0" hwId="0x34" FEDId="577" GOHId="1" IdxInFiber="10" pay="0"/>
<nt2_tile id="1" hwId="0x35" FEDId="577" GOHId="1" IdxInFiber="10" pay="1"/>
<nt2_tile id="2" hwId="0x36" FEDId="577" GOHId="1" IdxInFiber="11" pay="0"/>
<nt2_tile id="3" hwId="0x37" FEDId="577" GOHId="1" IdxInFiber="11" pay="1"/>
</nt2_plane>
<nt2_plane id="6">
<nt2_tile id="0" hwId="0x38" FEDId="577" GOHId="1" IdxInFiber="12" pay="0"/>
<nt2_tile id="1" hwId="0x39" FEDId="577" GOHId="1" IdxInFiber="12" pay="1"/>
<nt2_tile id="2" hwId="0x3A" FEDId="577" GOHId="1" IdxInFiber="13" pay="0"/>
<nt2_tile id="3" hwId="0x3B" FEDId="577" GOHId="1" IdxInFiber="13" pay="1"/>
</nt2_plane>
<nt2_plane id="7">
<nt2_tile id="0" hwId="0x3C" FEDId="577" GOHId="1" IdxInFiber="14" pay="0"/>
<nt2_tile id="1" hwId="0x3D" FEDId="577" GOHId="1" IdxInFiber="14" pay="1"/>
<nt2_tile id="2" hwId="0x3E" FEDId="577" GOHId="1" IdxInFiber="15" pay="0"/>
<nt2_tile id="3" hwId="0x3F" FEDId="577" GOHId="1" IdxInFiber="15" pay="1"/>
</nt2_plane>
</arm>
<arm id="1"> <!-- sector 56, CMS positive z -->
<nt2_plane id="0">
<nt2_tile id="0" hwId="0x120" FEDId="577" GOHId="0" IdxInFiber="0" pay="0"/>
<nt2_tile id="1" hwId="0x121" FEDId="577" GOHId="0" IdxInFiber="0" pay="1"/>
<nt2_tile id="2" hwId="0x122" FEDId="577" GOHId="0" IdxInFiber="1" pay="0"/>
<nt2_tile id="3" hwId="0x123" FEDId="577" GOHId="0" IdxInFiber="1" pay="1"/>
</nt2_plane>
<nt2_plane id="1">
<nt2_tile id="0" hwId="0x124" FEDId="577" GOHId="0" IdxInFiber="2" pay="0"/>
<nt2_tile id="1" hwId="0x125" FEDId="577" GOHId="0" IdxInFiber="2" pay="1"/>
<nt2_tile id="2" hwId="0x126" FEDId="577" GOHId="0" IdxInFiber="3" pay="0"/>
<nt2_tile id="3" hwId="0x127" FEDId="577" GOHId="0" IdxInFiber="3" pay="1"/>
</nt2_plane>
<nt2_plane id="2">
<nt2_tile id="0" hwId="0x128" FEDId="577" GOHId="0" IdxInFiber="4" pay="0"/>
<nt2_tile id="1" hwId="0x129" FEDId="577" GOHId="0" IdxInFiber="4" pay="1"/>
<nt2_tile id="2" hwId="0x12A" FEDId="577" GOHId="0" IdxInFiber="5" pay="0"/>
<nt2_tile id="3" hwId="0x12B" FEDId="577" GOHId="0" IdxInFiber="5" pay="1"/>
</nt2_plane>
<nt2_plane id="3">
<nt2_tile id="0" hwId="0x12C" FEDId="577" GOHId="0" IdxInFiber="6" pay="0"/>
<nt2_tile id="1" hwId="0x12D" FEDId="577" GOHId="0" IdxInFiber="6" pay="1"/>
<nt2_tile id="2" hwId="0x12E" FEDId="577" GOHId="0" IdxInFiber="7" pay="0"/>
<nt2_tile id="3" hwId="0x12F" FEDId="577" GOHId="0" IdxInFiber="7" pay="1"/>
</nt2_plane>
<nt2_plane id="4">
<nt2_tile id="0" hwId="0x130" FEDId="577" GOHId="0" IdxInFiber="8" pay="0"/>
<nt2_tile id="1" hwId="0x131" FEDId="577" GOHId="0" IdxInFiber="8" pay="1"/>
<nt2_tile id="2" hwId="0x132" FEDId="577" GOHId="0" IdxInFiber="9" pay="0"/>
<nt2_tile id="3" hwId="0x133" FEDId="577" GOHId="0" IdxInFiber="9" pay="1"/>
</nt2_plane>
<nt2_plane id="5">
<nt2_tile id="0" hwId="0x134" FEDId="577" GOHId="0" IdxInFiber="10" pay="0"/>
<nt2_tile id="1" hwId="0x135" FEDId="577" GOHId="0" IdxInFiber="10" pay="1"/>
<nt2_tile id="2" hwId="0x136" FEDId="577" GOHId="0" IdxInFiber="11" pay="0"/>
<nt2_tile id="3" hwId="0x137" FEDId="577" GOHId="0" IdxInFiber="11" pay="1"/>
</nt2_plane>
<nt2_plane id="6">
<nt2_tile id="0" hwId="0x138" FEDId="577" GOHId="0" IdxInFiber="12" pay="0"/>
<nt2_tile id="1" hwId="0x139" FEDId="577" GOHId="0" IdxInFiber="12" pay="1"/>
<nt2_tile id="2" hwId="0x13A" FEDId="577" GOHId="0" IdxInFiber="13" pay="0"/>
<nt2_tile id="3" hwId="0x13B" FEDId="577" GOHId="0" IdxInFiber="13" pay="1"/>
</nt2_plane>
<nt2_plane id="7">
<nt2_tile id="0" hwId="0x13C" FEDId="577" GOHId="0" IdxInFiber="14" pay="0"/>
<nt2_tile id="1" hwId="0x13D" FEDId="577" GOHId="0" IdxInFiber="14" pay="1"/>
<nt2_tile id="2" hwId="0x13E" FEDId="577" GOHId="0" IdxInFiber="15" pay="0"/>
<nt2_tile id="3" hwId="0x13F" FEDId="577" GOHId="0" IdxInFiber="15" pay="1"/>
</nt2_plane>
</arm>
84 changes: 70 additions & 14 deletions DQM/CTPPS/plugins/TotemT2DQMSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ class TotemT2DQMSource : public DQMEDAnalyzer {
void clearTriggerBitset();
bool areChannelsTriggered(const TotemT2DetId&);
void bookErrorFlagsHistogram(DQMStore::IBooker&);
void fillErrorFlagsHistogram(const TotemT2Digi&);
void fillErrorFlagsHistogram(const TotemT2Digi&, const TotemT2DetId&);
void fillEdges(const TotemT2Digi&, const TotemT2DetId&);
void fillToT(const TotemT2RecHit&, const TotemT2DetId&);
void fillFlags(const TotemT2Digi&, const TotemT2DetId&);

const edm::ESGetToken<TotemGeometry, TotemGeometryRcd> geometryToken_;
const edm::EDGetTokenT<edmNew::DetSetVector<TotemT2Digi>> digiToken_;
Expand All @@ -55,7 +56,9 @@ class TotemT2DQMSource : public DQMEDAnalyzer {
std::unique_ptr<TotemT2Segmentation> segm_;

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

enum evFlag{t2TE=0, t2LE, t2MT, t2ML};

const unsigned int nbinsx_, nbinsy_;
const unsigned int windowsNum_;
Expand All @@ -68,7 +71,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer {
std::bitset<(TotemT2DetId::maxPlane + 1) * (TotemT2DetId::maxChannel + 1)> hitTilesArray;
static const unsigned int MINIMAL_TRIGGER = 3;

MonitorElement *leadingEdge = nullptr, *trailingEdge = nullptr, *timeOverTreshold = nullptr;
MonitorElement *leadingEdge = nullptr, *trailingEdge = nullptr, *timeOverTreshold = nullptr, *eventFlags = nullptr;

SectorPlots() = default;
SectorPlots(
Expand All @@ -78,6 +81,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer {
struct PlanePlots {
MonitorElement* digisMultiplicity = nullptr;
MonitorElement* rechitMultiplicity = nullptr;
MonitorElement* eventFlagsPl = nullptr;

PlanePlots() = default;
PlanePlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int nbinsx, unsigned int nbinsy);
Expand All @@ -86,6 +90,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer {
MonitorElement* leadingEdgeCh = nullptr;
MonitorElement* trailingEdgeCh = nullptr;
MonitorElement* timeOverTresholdCh = nullptr;
MonitorElement* eventFlagsCh = nullptr;

ChannelPlots() = default;
ChannelPlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum);
Expand Down Expand Up @@ -124,7 +129,14 @@ TotemT2DQMSource::SectorPlots::SectorPlots(
"trailing edge", title + " trailing edge (DIGIs); trailing edge (ns)", 25 * windowsNum, 0, 25 * windowsNum);

timeOverTreshold = ibooker.book1D(
"time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 250, -25, 100);
"time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 500, -50, 200);

eventFlags = ibooker.book1D(
"event flags", title + " event flags (digi);Event flags (TE/LE valid, TE/LE multiple)", 4, -0.5, 3.5);

for (unsigned short flag_index = 1; flag_index <= 4; ++flag_index)
eventFlags->setBinLabel(flag_index, "Flag " + std::to_string(flag_index));

}

TotemT2DQMSource::PlanePlots::PlanePlots(DQMStore::IBooker& ibooker,
Expand Down Expand Up @@ -152,6 +164,12 @@ TotemT2DQMSource::PlanePlots::PlanePlots(DQMStore::IBooker& ibooker,
nbinsy,
-0.5,
double(nbinsy) - 0.5);

eventFlagsPl = ibooker.book1D(
"event flags", title + " event flags (digi);Event flags (TE/LE valid, TE/LE multiple)", 4, -0.5, 3.5);

for (unsigned short flag_index = 1; flag_index <= 4; ++flag_index)
eventFlagsPl->setBinLabel(flag_index, "Flag " + std::to_string(flag_index));
}

TotemT2DQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum) {
Expand All @@ -166,7 +184,13 @@ TotemT2DQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, unsigne
"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);
"time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 500, -50, 200);

eventFlagsCh = ibooker.book1D(
"event flags", title + " event flags (digi);Event flags (TE/LE valid, TE/LE multiple)", 4, -0.5, 3.5);

for (unsigned short flag_index = 1; flag_index <= 4; ++flag_index)
eventFlagsCh->setBinLabel(flag_index, "Flag " + std::to_string(flag_index));
}

TotemT2DQMSource::TotemT2DQMSource(const edm::ParameterSet& iConfig)
Expand Down Expand Up @@ -212,8 +236,9 @@ void TotemT2DQMSource::analyze(const edm::Event& iEvent, const edm::EventSetup&
for (const auto& digi : ds_digis) {
segm_->fill(planePlots_[planeId].digisMultiplicity->getTH2D(), detid);
fillTriggerBitset(detid);
fillErrorFlagsHistogram(digi);
fillErrorFlagsHistogram(digi, detid);
fillEdges(digi, detid);
fillFlags(digi, detid);
}
}

Expand Down Expand Up @@ -285,18 +310,21 @@ bool TotemT2DQMSource::areChannelsTriggered(const TotemT2DetId& detid) {
}

void TotemT2DQMSource::bookErrorFlagsHistogram(DQMStore::IBooker& ibooker) {
HPTDCErrorFlags_2D_ = ibooker.book2D("HPTDC Errors", " HPTDC Errors?", 8, -0.5, 7.5, 2, -0.5, 1.5);
for (unsigned short error_index = 1; error_index <= 8; ++error_index)
HPTDCErrorFlags_2D_->setBinLabel(error_index, "Flag " + std::to_string(error_index));
totemT2ErrorFlags_2D_ = ibooker.book2D("nt2 readout flags", " nt2 readout flags", 4, -0.5, 3.5, 2, -0.5, 1.5);
for (unsigned short error_index = 1; error_index <= 4; ++error_index)
totemT2ErrorFlags_2D_->setBinLabel(error_index, "Flag " + std::to_string(error_index));

int tmpIndex = 0;
HPTDCErrorFlags_2D_->setBinLabel(++tmpIndex, "some id 0", /* axis */ 2);
HPTDCErrorFlags_2D_->setBinLabel(++tmpIndex, "some id 1", /* axis */ 2);
totemT2ErrorFlags_2D_->setBinLabel(++tmpIndex, "arm 4-5", /* axis */ 2);
totemT2ErrorFlags_2D_->setBinLabel(++tmpIndex, "arm 5-6", /* axis */ 2);
}

void TotemT2DQMSource::fillErrorFlagsHistogram(const TotemT2Digi& digi) {
// placeholder for error hitogram filling
(void)digi;
void TotemT2DQMSource::fillErrorFlagsHistogram(const TotemT2Digi& digi, const TotemT2DetId& detid) {
// readout flags histogram filling
for (unsigned int i = 0; i < 4; i++) {
if (digi.getStatus() & (1 << i))
totemT2ErrorFlags_2D_->Fill(i+0.0,detid.arm()+0.0);
}
}

void TotemT2DQMSource::fillEdges(const TotemT2Digi& digi, const TotemT2DetId& detid) {
Expand All @@ -313,4 +341,32 @@ void TotemT2DQMSource::fillToT(const TotemT2RecHit& rechit, const TotemT2DetId&
channelPlots_[detid].timeOverTresholdCh->Fill(rechit.toT());
}

void TotemT2DQMSource::fillFlags(const TotemT2Digi& digi, const TotemT2DetId& detid) {
const TotemT2DetId secId(detid.armId());
const TotemT2DetId planeId(detid.planeId());
if (digi.hasTE()) {
sectorPlots_[secId].eventFlags->Fill(t2TE+0.0);
planePlots_[planeId].eventFlagsPl->Fill(t2TE+0.0);
channelPlots_[detid].eventFlagsCh->Fill(t2TE+0.0);
}

if (digi.hasLE()) {
sectorPlots_[secId].eventFlags->Fill(t2LE+0.0);
planePlots_[planeId].eventFlagsPl->Fill(t2LE+0.0);
channelPlots_[detid].eventFlagsCh->Fill(t2LE+0.0);
}

if (digi.hasManyTE()) {
sectorPlots_[secId].eventFlags->Fill(t2MT+0.0);
planePlots_[planeId].eventFlagsPl->Fill(t2MT+0.0);
channelPlots_[detid].eventFlagsCh->Fill(t2MT+0.0);
}

if (digi.hasManyLE()) {
sectorPlots_[secId].eventFlags->Fill(t2ML+0.0);
planePlots_[planeId].eventFlagsPl->Fill(t2ML+0.0);
channelPlots_[detid].eventFlagsCh->Fill(t2ML+0.0);
}
}

DEFINE_FWK_MODULE(TotemT2DQMSource);
3 changes: 3 additions & 0 deletions DQM/CTPPS/python/ctppsDQM_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from DQM.CTPPS.totemTimingDQMSource_cfi import *

from DQM.CTPPS.totemT2DQMSource_cfi import *

from DQM.CTPPS.ctppsPixelDQMSource_cfi import *

from DQM.CTPPS.elasticPlotDQMSource_cfi import *
Expand Down Expand Up @@ -42,6 +44,7 @@
+ diamondSampicDQMSourceOnline
+ ctppsCommonDQMSourceOnline
+ elasticPlotDQMSource
+ totemT2DQMSource
)

_ctppsDQMCalibrationHarvest = cms.Sequence(
Expand Down
2 changes: 1 addition & 1 deletion DQM/CTPPS/python/totemT2DQMSource_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
rechitsTag = cms.InputTag('totemT2RecHits'),
nbinsx = cms.uint32(25),
nbinsy = cms.uint32(25),
windowsNum = cms.uint32(4),
windowsNum = cms.uint32(8),

perLSsaving = cms.untracked.bool(False), #driven by DQMServices/Core/python/DQMStore_cfi.py
)
6 changes: 3 additions & 3 deletions DQM/CTPPS/test/totemt2_dqm_test_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
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.totemT2Digis.RawToDigi.useOlderT2TestFile = True
process.totemT2Digis.RawToDigi.printUnknownFrameSummary = False
process.totemT2Digis.RawToDigi.printErrorSummary = False
process.totemDAQMappingESSourceXML_TotemT2.multipleChannelsPerPayload = True

process.path = cms.Path(
Expand Down
Loading

0 comments on commit f6823b1

Please sign in to comment.