diff --git a/DataFormats/Detectors/TRD/include/DataFormatsTRD/HelperMethods.h b/DataFormats/Detectors/TRD/include/DataFormatsTRD/HelperMethods.h index 4468528865d3b..8ee4ee9257643 100644 --- a/DataFormats/Detectors/TRD/include/DataFormatsTRD/HelperMethods.h +++ b/DataFormats/Detectors/TRD/include/DataFormatsTRD/HelperMethods.h @@ -150,9 +150,9 @@ struct HelperMethods { static int getLinkIDfromHCID(int hcid) { - //return a number in range [0:29] for the link related to this hcid with in its respective CRU - //lower 15 is endpoint 0 and upper 15 is endpoint 1 - //a side has 30, c side has 30 to give 60 links for a supermodule + // return a number in range [0:29] for the link related to this hcid with in its respective CRU + // lower 15 is endpoint 0 and upper 15 is endpoint 1 + // a side has 30, c side has 30 to give 60 links for a supermodule int sector = hcid / constants::NHCPERSEC; return getORIinSuperModule(hcid) + constants::NHCPERSEC * sector; } @@ -204,6 +204,12 @@ struct HelperMethods { mcm = (row % constants::NMCMROBINROW) * constants::NMCMROBINCOL + (mcmCol % constants::NMCMROBINCOL); channel = constants::NADCMCM - 1 - ((chamberIndex % constants::NCHANNELSPERROW) % constants::NADCMCM); } + + static int getMCMCol(int irob, int imcm) + { + // calculate the column number of the MCM within the TRD detector + return (imcm % constants::NMCMROBINCOL) + constants::NMCMROBINCOL * (irob % 2); + } }; } // namespace trd diff --git a/DataFormats/Detectors/TRD/include/DataFormatsTRD/Tracklet64.h b/DataFormats/Detectors/TRD/include/DataFormatsTRD/Tracklet64.h index 7801427799ee8..d60b2141f0ea1 100644 --- a/DataFormats/Detectors/TRD/include/DataFormatsTRD/Tracklet64.h +++ b/DataFormats/Detectors/TRD/include/DataFormatsTRD/Tracklet64.h @@ -93,6 +93,10 @@ class Tracklet64 GPUd() int getHCID() const { return ((mtrackletWord & hcidmask) >> hcidbs); }; // no units 0..1079 GPUd() int getPadRow() const { return ((mtrackletWord & padrowmask) >> padrowbs); }; // pad row number [0..15] GPUd() int getPadCol() const; // estimate the pad column number from the tracklet offset (can be off by +-1 pad) + GPUd() float PadPositionMCM() const; // pad position within the MCM + GPUd() float PadPosition() const; // pad position within the TRD chamber + GPUd() float UncalibratedPad() const; // uncalibrated pad number corresponding to tracklet position + GPUd() float Slope() const; // slope of tracklet in pad units per timebin GPUd() int getColumn() const { return ((mtrackletWord & colmask) >> colbs); }; // column refers to MCM position in column direction on readout board [0..3] GPUd() int getPosition() const { return ((mtrackletWord & posmask) >> posbs); }; // in units of 1/40 pads, 11 bit granularity GPUd() int getSlope() const { return ((mtrackletWord & slopemask) >> slopebs); }; // in units of 1/1000 pads/timebin, 8 bit granularity diff --git a/DataFormats/Detectors/TRD/src/Tracklet64.cxx b/DataFormats/Detectors/TRD/src/Tracklet64.cxx index 35879fcec09e3..04cefc821adf6 100644 --- a/DataFormats/Detectors/TRD/src/Tracklet64.cxx +++ b/DataFormats/Detectors/TRD/src/Tracklet64.cxx @@ -43,6 +43,35 @@ GPUd() int Tracklet64::getPadCol() const return CAMath::Nint(6.f + mcmCol * ((float)NCOLMCM) + padLocal); } +GPUd() float Tracklet64::PadPositionMCM() const +{ + return 12.0 - (getPositionBinSigned() * GRANULARITYTRKLPOS); +} + +GPUd() float Tracklet64::PadPosition() const +{ + // int padLocalBin = tracklet.getPosition() ^ 0x80; + float padMCM = PadPositionMCM(); + int mcmCol = HelperMethods::getMCMCol(getROB(), getMCM()); + return float((mcmCol + 1) * NCOLMCM) + 2.0 - padMCM; +} + +GPUd() float Tracklet64::UncalibratedPad() const +{ + float y = getUncalibratedY(); + int mcmCol = (getMCM() % NMCMROBINCOL) + NMCMROBINCOL * (getROB() % 2); + // one pad column has 144 pads, the offset of -63 is the center of the first MCM in that column + // which is connected to the pads -63 - 9 = -72 to -63 + 9 = -54 + // float offset = -63.f + ((float)NCOLMCM) * mcmCol; + float padWidth = 0.635f + 0.03f * (getDetector() % NLAYER); + return y / padWidth + 71.0; +} + +GPUd() float Tracklet64::Slope() const +{ + return getSlopeBinSigned() * GRANULARITYTRKLSLOPE / ADDBITSHIFTSLOPE; +} + #ifndef GPUCA_GPUCODE_DEVICE void Tracklet64::printStream(std::ostream& stream) const {