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

Update position_from_cell calculation #605

Merged
merged 9 commits into from
Jun 7, 2024

Conversation

fredevb
Copy link
Contributor

@fredevb fredevb commented Jun 6, 2024

  • Added half of pitch in position_from_cell calculation to obtain the center.
  • Changed the name of min_center_x and min_center_y to min_corner_x and min_corner_y in the pixel data structure.

@fredevb fredevb changed the title bug: fixed pixel min center calculation in module bug fix: pixel min center calculation in module Jun 6, 2024
@asalzburger
Copy link
Contributor

Hi @krasznaa - we encountered that in comparing cluster positions between ACTS and traccc - that showed a systematic shift of half a pixel / strip shift.

The measurement creation uses center + n * pitch which is correct:

  // Retrieve the specific values based on module idx
    return {mod.pixel.min_center_x + cell.channel0 * mod.pixel.pitch_x,
            mod.pixel.min_center_y + cell.channel1 * mod.pixel.pitch_y};

However, what's filled into the mod.pixel.min_center from the bin utility is min and not min_center.

Copy link
Member

@krasznaa krasznaa left a comment

Choose a reason for hiding this comment

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

Should this be part of the module description? Should it not rather be the measurement creation code that uses the segmentation information in such a way? 🤔

Since the "segmentation information", I believe, is correct as is. It's how we calculate the measurement locations based on this segmentation info that would need to use the centers of the pixels/stripts. 🤔

@krasznaa
Copy link
Member

krasznaa commented Jun 6, 2024

Crossed with the messages... I'm absolutely on board with shifting the measurement locations like this. Just not with exactly this change. I.e. I would rather change this function instead: https://github.com/acts-project/traccc/blob/main/core/include/traccc/clusterization/impl/measurement_creation.ipp#L18-L24

The CPU and GPU code shares that function, so we should only fix this one function. 😄

@asalzburger
Copy link
Contributor

Crossed with the messages... I'm absolutely on board with shifting the measurement locations like this. Just not with exactly this change. I.e. I would rather change this function instead: https://github.com/acts-project/traccc/blob/main/core/include/traccc/clusterization/impl/measurement_creation.ipp#L18-L24

The CPU and GPU code shares that function, so we should only fix this one function. 😄

Hi, absolutely fine as well, we should then rename the module info then:

min_center_x -> min_corner_x 
min_center_y -> min_corner_y

What do you think?

@krasznaa
Copy link
Member

krasznaa commented Jun 6, 2024

Yes. Let's rename the variables indeed. I only realized that myself after sending the previous message. 🤔

I think there aren't a ridiculous number of clients of those variables, so updating their names should not be a huge undertaking.

@asalzburger
Copy link
Contributor

Good, @fredevb - can you go ahead and make the changes, please?

@fredevb
Copy link
Contributor Author

fredevb commented Jun 6, 2024

I've made the changes :) Would it be possible to make a new release so that I can include the changes in Acts?

@fredevb fredevb changed the title bug fix: pixel min center calculation in module bug fix: min corner and position_from_cell Jun 6, 2024
@fredevb fredevb changed the title bug fix: min corner and position_from_cell bug fix: position_from_cell Jun 6, 2024
@fredevb fredevb changed the title bug fix: position_from_cell bug fix: added half of pitch in position_from_cell calculation and renamed min center to min corner Jun 6, 2024
@fredevb fredevb changed the title bug fix: added half of pitch in position_from_cell calculation and renamed min center to min corner bug fix: position_from_cell calculation Jun 6, 2024
@fredevb fredevb changed the title bug fix: position_from_cell calculation Updated position_from_cell calculation Jun 6, 2024
@fredevb fredevb changed the title Updated position_from_cell calculation Update position_from_cell calculation Jun 6, 2024
@krasznaa
Copy link
Member

krasznaa commented Jun 6, 2024

Ahh... I did not expect the unit tests to go belly up. 😦 Can you investigate Fred?

@stephenswat
Copy link
Member

The CCL results are now all offset by a value of 0.5 so they no longer match the expected values.

@krasznaa
Copy link
Member

krasznaa commented Jun 6, 2024

The CCL results are now all offset by a value of 0.5 so they no longer match the expected values.

Any pointers for Fred for what he should update to account for this shift in the tests?

@stephenswat
Copy link
Member

The easiest way to update this would be to edit https://github.com/acts-project/traccc/blob/main/tests/common/tests/cca_test.hpp on lines 128, 129, 134, and 135.

@stephenswat
Copy link
Member

Note that that value of 0.5 would need to be updated for the pitch of the modules, but these are always assumed to be 1 in the tests so 0.5 should work fine.

@krasznaa
Copy link
Member

krasznaa commented Jun 6, 2024

🤔 How about we just update this line?

https://github.com/acts-project/traccc/blob/main/tests/common/tests/cca_test.hpp#L101

I guess

        for (std::size_t i = 0; i < modules.size(); i++) {
            modules.at(i).pixel = traccc::pixel_data{-0.5f, -0.5f, 1.f, 1.f};
        }

should work, right? 🤔

@krasznaa
Copy link
Member

krasznaa commented Jun 7, 2024

I'll be damned... 😲 This does visibly help our track finding efficiency on the ODD.

With the code from #582 (without this PR's fix), I see:

eff

With this PR put on top, I get:

efficiency_digifix

I.e. there is a small, but visible improvement. 😄

Copy link
Member

@krasznaa krasznaa left a comment

Choose a reason for hiding this comment

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

I'm cheating, since I'm now approving some of my own code, but c'est la vie...

@krasznaa krasznaa merged commit ddeeade into acts-project:main Jun 7, 2024
20 of 21 checks passed
@asalzburger
Copy link
Contributor

I'll be damned... 😲 This does visibly help our track finding efficiency on the ODD.

With the code from #582 (without this PR's fix), I see:

eff

With this PR put on top, I get:

efficiency_digifix

I.e. there is a small, but visible improvement. 😄

Ha, shall I say "told you so" ... or would that just say I am very old and have been working on this for all too long?

@asalzburger
Copy link
Contributor

By looking at it, I saw that we still have some areas of improvement to make in the cluster error positions.

stephenswat added a commit to stephenswat/traccc that referenced this pull request Jun 14, 2024
The expected values in this unit tests were consistenly a value of 0.5
off since the merging of acts-project#605. This commit updates the expected values,
and also renames the unit test to be more in line with our other tests.
stephenswat added a commit to stephenswat/traccc that referenced this pull request Jun 14, 2024
The expected values in this unit tests were consistenly a value of 0.5
off since the merging of acts-project#605. This commit updates the expected values,
and also renames the unit test to be more in line with our other tests.
stephenswat added a commit that referenced this pull request Jun 15, 2024
stephenswat added a commit to stephenswat/traccc that referenced this pull request Jun 18, 2024
stephenswat added a commit to stephenswat/traccc that referenced this pull request Jun 19, 2024
stephenswat added a commit that referenced this pull request Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants