-
Notifications
You must be signed in to change notification settings - Fork 6
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
DR: Excluding Duplicates for CM #267
base: L1TK-dev-14_2_0_pre4
Are you sure you want to change the base?
Conversation
@dally96 given that in Settings.h , int numTracksComparedPerBin_ remains 9999, this PR should have no effect on tracking performance. But it fails git CI because the tracking performance has got worse. Do you understand why? |
I think it might have to do with the fact that this code doesn’t overwrite the inputstublists when a track is merged. For example, with this code, if track 1 is a duplicate of track 0, track 1’s stubs do not get added to track 0’s stub list, but track 1 will not be compared to the other tracks. So if track 2 is a duplicate of track 1, it won’t be removed. We tried overwriting the stublist before but it led to an error in the getPhiRes function in PurgeDuplicate that we didn’t figure out.
… On Apr 2, 2024, at 11:52 PM, Ian Tomalin ***@***.***> wrote:
@dally96 <https://github.com/dally96> given that in Settings.h , int numTracksComparedPerBin_ remains 9999, this PR should have no effect on tracking performance. But it fails git CI because the tracking performance has got worse. Do you understand why?
—
Reply to this email directly, view it on GitHub <#267 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ARUNMFZHRZLOIYQPXP77WE3Y3MSB3AVCNFSM6AAAAABFORV2GWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZTGE3DONZTGI>.
You are receiving this because you were mentioned.
|
Does the current code, before this PR, also behave incorrectly, by not overwriting the inputstublists when two tracks are merged? |
In your talk, you stated that if you correct this PR, so it does overwrite the inputstublists, then it crashes. My guess is that Tracklet:::proj() which you are calling from PurgeDuplicate is being called with a layer that fails the assert statement in Tracklet::validProj(). |
There are two loops one to check if two tracks are duplicate and the other to merge the tracks if they are duplicates. In the loop to merge tracks, the stubs and stub ids do get merged, but after all the comparisons have been done. This error arises when I try to use the merged stubs for the comparison (although they should really be in one loop for this PR, I will fix that, but the same error persists). |
There's been no progress on this PR in 4 months. Shall we close it? |
const unsigned int curSeed = aTrack->seedIndex(); | ||
static const std::vector<int> ranks{1, 5, 2, 7, 4, 3, 8, 6}; | ||
unsigned int curSeed = aTrack->seedIndex(); | ||
std::vector<int> ranks{1, 5, 2, 7, 4, 3, 8, 6}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has the "static const" qualifier been removed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put "static const" back.
@@ -181,38 +187,70 @@ void PurgeDuplicate::execute(std::vector<Track>& outputtracks, unsigned int iSec | |||
if (inputtracklets_.empty()) | |||
continue; | |||
const unsigned int numStublists = inputstublists_.size(); | |||
std::vector<int> seedRankIdx(numStublists); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment that you're ordering the tracks by seed rank.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment has been included.
@@ -86,6 +87,11 @@ void PurgeDuplicate::execute(std::vector<Track>& outputtracks, unsigned int iSec | |||
inputstublists_.clear(); | |||
mergedstubidslists_.clear(); | |||
|
|||
sortedinputtracklets_.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never understood why all these vectors are declared as class data members. If they were instead declared inside the loop over bins, e.g. near here https://github.com/cms-L1TK/cmssw/blob/dally_CMFix/L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc#L140 , they would automatically be deleted and recreated between loops, so no clear would be needed either here nor near L410. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I just wanted to mirror the actual class data members, but I can change them to only be declared in the loop over bins
This fails git CI only because the performance of HYBRID_DISPLACED is worse https://gitlab.cern.ch/cms-l1tk/cmssw_CI/-/pipelines/8056886 . The reason it is worse is presumably your discovery that that the DR binning equations need changing to work for displaced tracks. |
@tomalin It seems the number of CM affects hybrid displaced more than hybrid. I haven't optimized DR for displaced tracking, so would it be fine to merge this anyway? |
The Displaced Tracking fails CI, as the number of reconstructed tracks has gone up by about one quarter. Do you understand why this PR should have this effect? (Recall the git CI runs on ttbar + 0PU). Have you checked what happens in ttbar+200PU? Hi @dally96 there are still several unanswered review comments. I can't merge until they are answered. |
I don't know why this is the case for the displaced case, since we didn't study the effects of this PR on extended tracking. However, a quick fix would be to increase the number of CMs to 64. When I run on a TTbar + PU200 sample fro 32 CM, this my output |
bool barrel = (i > 0 && i <= N_LAYER); | ||
bool endcapA = (i > N_LAYER); | ||
bool endcapB = (i < 0); | ||
int lay = barrel * (i - 1) + endcapA * (i - 5) - endcapB * i; // encode in range 0-15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number 5 not allowed
bool barrel = (i > 0 && i <= N_LAYER); | ||
bool endcapA = (i > N_LAYER); | ||
bool endcapB = (i < 0); | ||
int lay = barrel * (i - 1) + endcapA * (i - 5) - endcapB * i; // encode in range 0-15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number 5 not allowed
How do your ttbar+PU200 results for displaced tracking compare for CM=32, 64 and before you made your PR? I suspect the L1 trigger group would be unhappy if the number of displaced tracks go up by a quarter. |
…acks excluding duplicates
…te tracks are skipped in the comparison
…=' which accounts for duplicate tracks with the same seed rank
…illing to merging in DR. Changed some magic numbers in PurgeDuplicate.cc when encoding the barrel and disk layers. Created a doCompareAll function to mirror doCompareBest in PurgeDuplicate. Made minor fixes and included comments.
|
@tomalin All checks have passed, but I did add a separate comparison of seed rank if hybrid displaced is being run. Hopefully that isn't a problem. I'm assuming once Alaa has looked at the seed ranking of the dispalced seeds, that we can go back to what I originally had in the PR> |
A general comment -- please try to keep CMSSW code as short and simple and CPU efficient as possible, since it makes it easier to understand and maintain. PurgeDuplicates.cc is now 915 lines long, which seems a lot for such a simple algorithm. |
…ep for extended tracking. Number of CM for extended tracking increased to 9999 while we work out a fix
@tomalin I put back in the < comparison instead of <= comparison for only extended seeds. Before I had them for every seed if we ran extended tracking. Here are the results for 9999 CM TTbar+PU200 |
@@ -448,15 +450,15 @@ namespace trklet { | |||
//have the factor if 2 | |||
double krprojshiftdisk() const { return 2 * kr(); } | |||
|
|||
double benddecode(unsigned int ibend, unsigned int layerdisk, bool isPSmodule) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have you changed "unsigned" to "int" in the arguments of function Settings::benddecode()?
if (layerdisk >= N_LAYER && (!isPSmodule)) | ||
layerdisk += N_DISK; | ||
double bend = benddecode_[layerdisk][ibend]; | ||
assert(bend < 99.0); | ||
return bend; | ||
} | ||
|
||
double bendcut(unsigned int ibend, unsigned int layerdisk, bool isPSmodule) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have you changed "unsigned" to "int" in the arguments of Settings::bendcut()?
The git CI runs on ttbar + 0PU. BEFORE THIS PR: AFTER THIS PR: There is therefore a significant bug somewhere. As a sanity check, I also tried running HYBRID on the ttbar+PU0 sample, and also the duplicate rate rises from 0.7% to 3.3%, this causes only a slight increase in the tracks/event, which is why git CI passes. |
Fixed track comparison in PurgeDuplicate.cc so that the comparison modules ignore duplicate tracks. However, this does not overwrite the stub list if a duplicate is found and is merged.