Skip to content

TRD add additional helper functions#11644

Closed
pestratm wants to merge 1 commit intoAliceO2Group:devfrom
pestratm:dev
Closed

TRD add additional helper functions#11644
pestratm wants to merge 1 commit intoAliceO2Group:devfrom
pestratm:dev

Conversation

@pestratm
Copy link
Copy Markdown
Contributor

Added some additional helper functions for TRD that @tdietel provided in his macros
@martenole @pachmay

Copy link
Copy Markdown
Contributor

@martenole martenole left a comment

Choose a reason for hiding this comment

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

Hi @pestratm thanks, the update to the HelperMethods is fine with me. For the tracklet64 I think the existing functions should be OK. Can you see if they are sufficient for the macros you want to add to the TRD repo?
And please not in general functions in O2 need to start with lower case letter

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 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.

return 12.0 - (getPositionBinSigned() * GRANULARITYTRKLPOS);
}

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).


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

@alibuild
Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI for cfb7136 at 2023-07-12 20:24:

No log files found

Full log here.

@martenole
Copy link
Copy Markdown
Contributor

Ok, I'd suggest we add

  • getPositionInPadCol() to return the TRD pad column number as a float
  • getSlopeInPadsPerTB() to return the slope as float in units of pads per time bin
    These functions should then be used internally by getPadCol(), getUncalibratedY() and getUncalibratedDy().

But we still have to understand the offset. In the getPadCol() I currently set an offset of 8 pads, because this is what I see when matching digits to tracklets on tracks and simply looking for the maximum ADC sum inside the digits. On average this should give me the correct offset for the conversion, no? I probably need to look closer again.

@pestratm do you want to give it a try to implement the above 2 functions to Tracklet64 or should I do it?

@pestratm
Copy link
Copy Markdown
Contributor Author

Ok, I'd suggest we add

* `getPositionInPadCol()` to return the TRD pad column number as a float

* `getSlopeInPadsPerTB()` to return the slope as float in units of pads per time bin
  These functions should then be used internally by `getPadCol()`, `getUncalibratedY()` and `getUncalibratedDy()`.

But we still have to understand the offset. In the getPadCol() I currently set an offset of 8 pads, because this is what I see when matching digits to tracklets on tracks and simply looking for the maximum ADC sum inside the digits. On average this should give me the correct offset for the conversion, no? I probably need to look closer again.

@pestratm do you want to give it a try to implement the above 2 functions to Tracklet64 or should I do it?

You mean keeping PadPosition() as getPositionInPadCol(), and Slope() as getSlopeInPadsPerTB()?

@github-actions
Copy link
Copy Markdown
Contributor

This PR did not have any update in the last 30 days. Is it still needed? Unless further action in will be closed in 5 days.

@github-actions github-actions bot added the stale label Aug 14, 2023
@github-actions github-actions bot closed this Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants