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

Implement T3 r-z helix chi2 cuts #92

Conversation

bucket420
Copy link

@bucket420 bucket420 commented Sep 13, 2024

Summary:

This PR implements T3 r-z helix chi2 cuts, which replace the current linear approximation method. 2 MDs are used to build a helical trajectory, and the remaining MD is used to calculate the chi2. The T3s are divided into 25 regions according to the positions of the MDs, and the cuts are selected based on the ROC curves in each regions.

f102db1a-7cf3-4dce-b8ef-fe2735cbaa0d

To get optimal performance, the linear cuts are kept for regions 9, 20-24, the middle MD is used to calculate the helix chi2 for regions 5 and 19, and the last MD is used to calculate the helix chi2 for all other regions.

Performance:

Link to slides.

@slava77
Copy link

slava77 commented Sep 13, 2024

please update the target branch to CMSSW_14_1_0_pre3_LST_X_LSTCore_realfiles_batch1_devel

@bucket420 bucket420 changed the base branch from CMSSW_14_1_0_pre3_LST_X_LSTCore_realfiles to CMSSW_14_1_0_pre3_LST_X_LSTCore_realfiles_batch1_devel September 13, 2024 16:16
@bucket420 bucket420 marked this pull request as ready for review September 16, 2024 20:54
… into CMSSW_14_1_0_pre3_LST_X_LSTCore_realfiles_T3_rzchi2_final
@bucket420 bucket420 marked this pull request as draft September 17, 2024 17:00
@bucket420 bucket420 marked this pull request as ready for review September 18, 2024 00:27
@bucket420
Copy link
Author

/run all

@ariostas
Copy link
Member

@bucket420 I added you so you can use the CI. If you leave another comment it should work

@bucket420
Copy link
Author

/run all

Copy link

The PR was built and ran successfully in standalone mode. Here are some of the comparison plots.

Efficiency vs pT comparison Efficiency vs eta comparison
Fake rate vs pT comparison Fake rate vs eta comparison
Duplicate rate vs pT comparison Duplicate rate vs eta comparison

The full set of validation and comparison plots can be found here.

Here is a timing comparison:

   Evt    Hits       MD       LS      T3       T5       pLS       pT5      pT3      TC       Reset    Event     Short             Rate
   avg     43.5    323.3    114.6     45.6     90.6    499.1    112.1    148.6     99.2      2.4    1479.1     936.5+/- 247.4     405.1   explicit_cache[s=4] (target branch)
   avg     47.2    328.0    115.7     96.8    107.8    506.3    121.1    135.8    102.2      1.9    1562.8    1009.3+/- 261.0     424.1   explicit_cache[s=4] (this PR)

Copy link

There was a problem while building and running with CMSSW. The logs can be found here.

@ariostas
Copy link
Member

There was a problem while building and running with CMSSW.

This is probably because the devel branch has not been updated to 14_2_0_pre1

Copy link
Collaborator

@VourMa VourMa left a comment

Choose a reason for hiding this comment

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

As a general comment, it would be great if the calculations applied here would be harmonized with the ones applied for T5: the logic is the same but it is applied in a different order. Even better, would it make sense to put some of the code here in functions and apply those, both here and in the T5 calculations, to simplify the code and make it clearer. It would also expose potential bugs and/or omissions in the different implementations.

RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
@VourMa
Copy link
Collaborator

VourMa commented Sep 26, 2024

Just to understand the future of this PR, do you intend to put things in functions and reuse them for the different objects? My request seems to become even more relevant in light of #97 (comment).

@bucket420
Copy link
Author

Yes, I do plan to refactor the code so that we can reuse functions for different objects. Just wondering if I should put the common functions in a new file or somewhere else? Also, would it be better to make a separate PR for that? Or should I keep working on this PR?

@VourMa
Copy link
Collaborator

VourMa commented Sep 26, 2024

Yes, I do plan to refactor the code so that we can reuse functions for different objects. Just wondering if I should put the common functions in a new file or somewhere else? Also, would it be better to make a separate PR for that? Or should I keep working on this PR?

Keep working on this PR would be fine for me.
As the code is right now, a lot of the common functions are in the Hit.h file but I don't think this is the best place. Either Kernels.h (would require a new include) or alpaka/Constants.h would work? Maybe people have a(nother) preference.

@slava77
Copy link

slava77 commented Sep 30, 2024

/run all

Copy link
Collaborator

@VourMa VourMa left a comment

Choose a reason for hiding this comment

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

Thank you for the updates, @bucket420! I think the majority of the comments have been dealt with. There are a few small follow-ups on still unresolved discussions.

By the way, I see that the syntax tests fail. Have you tried running scram b -j 12 code-checks >& c.log && scram b -j 12 code-format >& f.log and commit the proposed changes?
@ariostas will that work or there are issues with code checks?

RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
RecoTracker/LSTCore/src/alpaka/Triplet.h Outdated Show resolved Hide resolved
@bucket420
Copy link
Author

/run all

Copy link

The PR was built and ran successfully in standalone mode. Here are some of the comparison plots.

Efficiency vs pT comparison Efficiency vs eta comparison
Fake rate vs pT comparison Fake rate vs eta comparison
Duplicate rate vs pT comparison Duplicate rate vs eta comparison

The full set of validation and comparison plots can be found here.

Here is a timing comparison:

   Evt    Hits       MD       LS      T3       T5       pLS       pT5      pT3      TC       Reset    Event     Short             Rate
   avg     44.0    321.6    116.6     47.9     90.2    544.9    110.5    149.4    104.6      2.7    1532.4     943.5+/- 249.3     419.5   explicit_cache[s=4] (target branch)
   avg     43.2    320.2    114.8     71.8    117.9    545.1    119.2    138.9    106.5      3.0    1580.4     992.1+/- 262.1     431.0   explicit_cache[s=4] (this PR)

Copy link

The PR was built and ran successfully with CMSSW. Here are some plots.

OOTB All Tracks
Efficiency and fake rate vs pT, eta, and phi

The full set of validation and comparison plots can be found here.

@bucket420
Copy link
Author

Thank you for the updates, @bucket420! I think the majority of the comments have been dealt with. There are a few small follow-ups on still unresolved discussions.

By the way, I see that the syntax tests fail. Have you tried running scram b -j 12 code-checks >& c.log && scram b -j 12 code-format >& f.log and commit the proposed changes? @ariostas will that work or there are issues with code checks?

I've run the command and committed the suggested change, but the static checks still failed

@VourMa
Copy link
Collaborator

VourMa commented Oct 20, 2024

/run checks

@VourMa
Copy link
Collaborator

VourMa commented Oct 20, 2024

I've run the command and committed the suggested change, but the static checks still failed

I took the liberty to try and fix the formatting issues. My hypothesis is that you were working on an older CMSSW version and the formatting changes were not compatible with the ones in CMSSW_14_2_0_pre1 which is our baseline now. I set up an CMSSW_14_2_0_pre1 area, checked out your branch there and used scram b code-format. Let's see if that worked.

Other than that, the PR seems to be ok from my side. I left a comment about having a presentation linked as documentation, and let's agree that this be added to the PR description, so that it doesn't block the merge.
@slava77 and @bucket420 could you clarify whether the last couple of comments have been successfully resolved and let me know, so that I can merge?

@VourMa
Copy link
Collaborator

VourMa commented Oct 20, 2024

/run checks

@VourMa
Copy link
Collaborator

VourMa commented Oct 20, 2024

I took the liberty to try and fix the formatting issues. My hypothesis is that you were working on an older CMSSW version and the formatting changes were not compatible with the ones in CMSSW_14_2_0_pre1 which is our baseline now. I set up an CMSSW_14_2_0_pre1 area, checked out your branch there and used scram b code-format. Let's see if that worked.

Well, I failed. Pinging @ariostas again, for any ideas on the source of the issue.

@slava77
Copy link

slava77 commented Oct 21, 2024

@slava77 and @bucket420 could you clarify whether the last couple of comments have been successfully resolved and let me know, so that I can merge?

I think that my question/comment about variable naming was clarified

@slava77
Copy link

slava77 commented Oct 21, 2024

My hypothesis is that you were working on an older CMSSW version and the formatting changes

yes, CI is further ahead than this topic and target branch (we are missing batch6 (and 5?) in the devel branch)

@VourMa
Copy link
Collaborator

VourMa commented Oct 21, 2024

yes, CI is further ahead than this topic and target branch (we are missing batch6 (and 5?) in the devel branch)

Ok, then I propose that we merge even with the static checks not passed.

Unless there is any disagreement, I will merge the PR as is at the end of my day (~4h).

@slava77
Copy link

slava77 commented Oct 21, 2024

yes, CI is further ahead than this topic and target branch (we are missing batch6 (and 5?) in the devel branch)

Ok, then I propose that we merge even with the static checks not passed.

Unless there is any disagreement, I will merge the PR as is at the end of my day (~4h).

I merged PRs in devel recently after checking explicitly in the code check logs that the part to be modified was not modified by the PR

@VourMa
Copy link
Collaborator

VourMa commented Oct 21, 2024

yes, CI is further ahead than this topic and target branch (we are missing batch6 (and 5?) in the devel branch)

Ok, then I propose that we merge even with the static checks not passed.
Unless there is any disagreement, I will merge the PR as is at the end of my day (~4h).

I merged PRs in devel recently after checking explicitly in the code check logs that the part to be modified was not modified by the PR

Indeed, this is the case. As you may have noticed in my last commits, I ended up chasing differences in the standalone folder, which is not what this PR is changing.

@VourMa VourMa merged commit 7a2c422 into CMSSW_14_1_0_pre3_LST_X_LSTCore_realfiles_batch1_devel Oct 21, 2024
1 check failed
@@ -238,8 +238,7 @@ namespace cxxopts {
class Option_syntax_exception : public OptionParseException {
public:
Option_syntax_exception(const std::string& text)
: OptionParseException("Argument " + LQUOTE + text + RQUOTE + " starts with a - but has incorrect syntax") {
}
: OptionParseException(u8"Argument " + LQUOTE + text + RQUOTE + u8" starts with a - but has incorrect syntax") {}
Copy link

Choose a reason for hiding this comment

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

@VourMa
it looks like this broke the standalone in devel

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like it, even though I am not sure why this change was proposed by the checks. Anyways, trying to fix the checks was a bigger failure that initially thought, sorry about that.

Let me make a standalone PR to fix that.

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.

6 participants