Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12_3_X]Fix for hardcoded subdetector id in PPS reconstruction code #38232

Merged
merged 1 commit into from Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc
Expand Up @@ -754,8 +754,13 @@ void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType,
unsigned int StationNum = (parentID / 1000) % 10;
unsigned int RpNum = (parentID / 100) % 10;

vfatInfo.symbolicID.symbolicID = TotemTimingDetId(
ArmNum, StationNum, RpNum, 0, TotemTimingDetId::ID_NOT_SET); //Dynamical: it is encoded in the frame
vfatInfo.symbolicID.symbolicID =
TotemTimingDetId(ArmNum,
StationNum,
RpNum,
0,
TotemTimingDetId::ID_NOT_SET,
TotemTimingDetId::sdTimingDiamond); //Dynamical: it is encoded in the frame

mapping->insert(framepos, vfatInfo);

Expand Down
10 changes: 8 additions & 2 deletions DataFormats/CTPPSDetId/interface/TotemTimingDetId.h
Expand Up @@ -33,15 +33,21 @@ class TotemTimingDetId : public CTPPSDetId {
TotemTimingDetId(const CTPPSDetId& id) : CTPPSDetId(id) {}

/// Construct from hierarchy indices.
TotemTimingDetId(uint32_t arm, uint32_t station, uint32_t romanPot = 0, uint32_t plane = 0, uint32_t channel = 0);
TotemTimingDetId(uint32_t arm,
uint32_t station,
uint32_t romanPot = 0,
uint32_t plane = 0,
uint32_t channel = 0,
uint32_t subdet = sdTimingFastSilicon);

static constexpr uint32_t startPlaneBit = 17, maskPlane = 0x3, maxPlane = 3, lowMaskPlane = 0x1FFFF;
static constexpr uint32_t startDetBit = 12, maskChannel = 0x1F, maxChannel = 31, lowMaskChannel = 0xFFF;

/// returns true if the raw ID is a PPS-timing one
static bool check(unsigned int raw) {
return (((raw >> DetId::kDetOffset) & 0xF) == DetId::VeryForward &&
((raw >> DetId::kSubdetOffset) & 0x7) == sdTimingFastSilicon);
(((raw >> DetId::kSubdetOffset) & 0x7) == sdTimingFastSilicon ||
((raw >> DetId::kSubdetOffset) & 0x7) == sdTimingDiamond));
}
//-------------------- getting and setting methods --------------------

Expand Down
5 changes: 3 additions & 2 deletions DataFormats/CTPPSDetId/src/TotemTimingDetId.cc
Expand Up @@ -18,8 +18,9 @@ TotemTimingDetId::TotemTimingDetId(uint32_t id) : CTPPSDetId(id) {

//----------------------------------------------------------------------------------------------------

TotemTimingDetId::TotemTimingDetId(uint32_t arm, uint32_t station, uint32_t romanPot, uint32_t plane, uint32_t channel)
: CTPPSDetId(sdTimingFastSilicon, arm, station, romanPot) {
TotemTimingDetId::TotemTimingDetId(
uint32_t arm, uint32_t station, uint32_t romanPot, uint32_t plane, uint32_t channel, uint32_t subdet)
: CTPPSDetId(subdet, arm, station, romanPot) {
if (arm > maxArm || station > maxStation || romanPot > maxRP || plane > maxPlane || channel > maxChannel) {
throw cms::Exception("InvalidDetId") << "TotemTimingDetId ctor:"
<< " Invalid parameters:"
Expand Down
6 changes: 2 additions & 4 deletions EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc
Expand Up @@ -101,6 +101,7 @@ void RawToDigiConverter::runCommon(const VFATFrameCollection &input,
stopProcessing = true;
}
}

// check the id mismatch
if (testID != tfNoTest && record.frame->isIDPresent() &&
(record.frame->getChipID() & 0xFFF) != (record.info->hwID & 0xFFF)) {
Expand Down Expand Up @@ -331,11 +332,10 @@ void RawToDigiConverter::run(const VFATFrameCollection &coll,
eventInfoTmp);
// calculate ids
TotemTimingDetId detId(record.info->symbolicID.symbolicID);

const TotemDAQMapping::TotemTimingPlaneChannelPair SWpair =
mapping.getTimingChannel(totemSampicFrame.getHardwareId());
// for FW Version > 0 plane and channel are encoded in the dataframe
if (totemSampicFrame.getFWVersion() < 0x30) // Mapping not present in HW, read from SW for FW versions < 3.0
if (totemSampicFrame.getFWVersion() == 0) // Mapping not present in HW, read from SW for FW versions == 0
{
if (SWpair.plane == -1 || SWpair.channel == -1) {
if (verbosity > 0)
Expand All @@ -345,7 +345,6 @@ void RawToDigiConverter::run(const VFATFrameCollection &coll,
} else {
detId.setPlane(SWpair.plane % 4);
detId.setChannel(SWpair.channel);
detId.setRP(SWpair.plane / 4); // Top:0 or Bottom:1
}
} else // Mapping read from HW, checked by SW
{
Expand All @@ -368,7 +367,6 @@ void RawToDigiConverter::run(const VFATFrameCollection &coll,
}
detId.setPlane(HWplane % 4);
detId.setChannel(HWchannel);
detId.setRP(HWplane / 4); // Top:0 or Bottom:1
}

DetSet<TotemTimingDigi> &digiDetSet = digi.find_or_insert(detId);
Expand Down