Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions DataFormats/Detectors/TRD/src/Tracklet64.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getPositionBinSigned() * GRANULARITYTRKLPOS should give the local pad number relative to the MCM center. Why are you subtracting 12 here? Shouldn't it be 10.5? But in any case I am not sure if these functions are needed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my memory, the reason for 12 is that it matches the digits in the raw data display. At the time, I did not try to figure out why this works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in UncalibratedPad() there is also a +2 which I don't understand. This effectively turns the 12 into a 10, so closer to the expected 10.5

}

GPUd() float Tracklet64::PadPosition() const
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this a duplicate of getPadCol()?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this a duplicate of getPadCol()?

getPadCol() returns an int, but the position of a tracklet is known better than a pad. Therefore I think it makes sense to provide a function that gives the tracklet position with float precision.
I suspect changing getPadCol() to return a float might break some code, hence I introduced another helper function. I am thinking about calling it getPadColF() (or getPadColFloat, suggestions welcome).

{
// 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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this a duplicate of getUncalibratedY()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UncalibratedPad() gives the uncalibrated pad number corresponding to the tracklet position, while getUncalibratedY() gives the uncalibrated y-coordinate. That's why for UncalibratedPad(), we divide by the pad width, isn't it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the uncalibrated pad number should really be given by getPadCol(). I just want to avoid any confusion and that we use consistently the functions we have in all the places. Otherwise it get's quite messy. So maybe you could use the functions in your PR to the TRD repo which are already available and drop the ones which are added to Tracklet64? The additional function in HelperMethods is fine of course

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this essentially does the same thing as PadPosition() discussed above, but in a different way (i.e. calculating the pad from the y coordinate, rather than from MCM and position within the MCM).
I don't remember exactly, but I might have compared the two to make sure I get it right.

{
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could for this not getUncalibratedDy(1) be used? And I think one needs to take into account the pad width for the slope, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we take into account the pad width, then we can use getUncalibratedDy(1). Tbh, I'm not sure about Tom's reasoning not to take it into account.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The slope is given in units of pad/timebin, while dy is a distance in cm.
For my raw data display, I wanted everything in pads and timebins, hence the extra function.
I find code with getSlope() more readable than writing the below calculation, but that might be personal preference.

{
return getSlopeBinSigned() * GRANULARITYTRKLSLOPE / ADDBITSHIFTSLOPE;
}

#ifndef GPUCA_GPUCODE_DEVICE
void Tracklet64::printStream(std::ostream& stream) const
{
Expand Down