Skip to content

Commit

Permalink
Merge pull request #38232 from ChrisMisan/PPS_subdet_fix_12_3
Browse files Browse the repository at this point in the history
[12_3_X]Fix for hardcoded subdetector id in PPS reconstruction code
  • Loading branch information
cmsbuild committed Jun 9, 2022
2 parents 125251b + 887c989 commit d459b48
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
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

0 comments on commit d459b48

Please sign in to comment.