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

Fixing the disp tracking bug #59

Merged
merged 3 commits into from
Dec 17, 2020
Merged

Conversation

gabhijith
Copy link

Changed a couple of asserts into if statements

PR description:

This is to fix the bug when using displaced tracking. The problem is coming from a couple of "pile-up" tracks, reconstructed using displaced seed. There is a slight discrepancy arising from the approx projection.

To rectify this, I have turned a couple of asserts in the match calculator to if statements. This way, the function of asserts is served when we have this discrepancy, that if conditions will do the job, without breaking the program.

PR validation:

The fix is run over ttbar+200 PU for validation.

Changed a couple of asserts into if statements
@tomalin
Copy link
Collaborator

tomalin commented Dec 14, 2020

It's illegal to have unnamed constants hard-wired in code, such as 0.25. Are you able to name these, and perhaps add a comment explaining how the value is derived?

@tomalin tomalin requested a review from aehart December 14, 2020 17:25
@gabhijith gabhijith requested a review from aryd December 14, 2020 17:48
@tomalin
Copy link
Collaborator

tomalin commented Dec 14, 2020

Could you please check if comments in Settings.h make it clear how to switch between exact & approx floating point. Is it the same cfg param for prompt & displaced tracking? Perhaps useapprox_?


imatch = (std::abs(ideltaphi * irstub) < idrphicut) && (std::abs(ideltar) < idrcut);
Copy link
Collaborator

@tomalin tomalin Dec 14, 2020

Choose a reason for hiding this comment

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

Compiler says imatch may be undefined at L482. I think it is right! Same true for variable match.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, Sorry about that.
I Fixed it,

}
else{
edm::LogProblem("Tracklet") << "WARNING dphi and/or dphiapprox too large : " << dphi << " " << dphiapprox
<< "dphi " << dphi << " Seed / ISeed " << tracklet->getISeed()<< endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Replace "dphi " by " dphi "

@gabhijith
Copy link
Author

It's illegal to have unnamed constants hard-wired in code, such as 0.25. Are you able to name these, and perhaps add a comment explaining how the value is derived?

These asserts were in place before. I don't know the exact reason for 0.25 or 0.2

@tomalin
Copy link
Collaborator

tomalin commented Dec 14, 2020

It's illegal to have unnamed constants hard-wired in code, such as 0.25. Are you able to name these, and perhaps add a comment explaining how the value is derived?

These asserts were in place before. I don't know the exact reason for 0.25 or 0.2

@aryd do you know what motivates numbers 0.2 & 0.25 in MatchCalculator.cc? Displaced tracking code exceeds them, but don't know if it matters.

Since these constants were already in the code, and the authors don't know what they are, they needn't delay this PR. I've added a request to eliminate them to #45 .

@tomalin
Copy link
Collaborator

tomalin commented Dec 14, 2020

I confirm that displaced tracking no longer crashes. Checked on 1k ttbarPU200.

Fixed the following warning:

/cms/threejet-2/abhijith/hware_temp/approx_cal/CMSSW_11_2_0_pre6/src/L1Trigger/TrackFindingTracklet/src/MatchCalculator.cc:482:7: warning: 'imatch' may be used uninitialized in this function [-Wmaybe-uninitialized]
@gabhijith
Copy link
Author

Could you please check if comments in Settings.h make it clear how to switch between exact & approx floating point. Is it the same cfg param for prompt & displaced tracking? Perhaps useapprox_?

I have added the switch to make sure approx turns on with the useapprox_ in settings.h

@aehart
Copy link

aehart commented Dec 15, 2020

Could you please check if comments in Settings.h make it clear how to switch between exact & approx floating point. Is it the same cfg param for prompt & displaced tracking? Perhaps useapprox_?

I have added the switch to make sure approx turns on with the useapprox_ in settings.h

I'm not sure this is what we want.

Previously in the TrackletCalculatorDisplaced, we were assigning the exact floating point parameters and projections to all three sets of values in the corresponding Tracklet object: the exact, approximate, and integer. This was the only choice, since the approximate calculation hadn't been developed yet.

But now that we have the approximate calculation, we can assign the results of that to the approximate parameters and projections. I don't think that needs to be controlled at all by a configuration flag, let alone useapprox, which is already being used to control whether the approximate stub positions are used.

  • To clarify my request. People should be able to compare the tracking performance with the exact vs. approx floating point, to ensure that the approx is not doing any harm. I'd assumed that a cfg param in Settings.h must switch between the TTTrack being created from the two options -- so one could then run L1TrackNtuplePlot.C? If not, how is this done?

@aehart
Copy link

aehart commented Dec 17, 2020

* To clarify my request. People should be able to compare the tracking performance with the exact vs. approx floating point, to ensure that the approx is not doing any harm. I'd assumed that a cfg param in Settings.h must switch between the TTTrack being created from the two options -- so one could then run L1TrackNtuplePlot.C? If not, how is this done?

@tomalin Right now, I don't think there is an easy way to compare the exact and approximate calculations, either from the TrackletCalculator or TrackletCalculatorDisplaced. Everything downstream of the TrackletCalculatorDisplaced is set up to use the approximate calculation, whether that's the floating point or integer version, since that should match what is ultimately done on the FPGA. For example, when setting the input parameters for the fit:

double kfrinv = tracklet->rinvapprox();
double kfphi0 = tracklet->phi0approx();
double kfz0 = tracklet->z0approx();
double kft = tracklet->tapprox();
double kfd0 = tracklet->d0approx();

Probably the most straightforward way of implementing the flag that you're proposing would be to have the methods in the Tracklet class that return the approximate parameters and projections return the exact versions instead, based on the value of the flag. Or the flag could control whether the exact or approximate values are stored in the approximate variables in the constructor. Are there preferences for how this is done?

@tomalin
Copy link
Collaborator

tomalin commented Dec 17, 2020

* To clarify my request. People should be able to compare the tracking performance with the exact vs. approx floating point, to ensure that the approx is not doing any harm. I'd assumed that a cfg param in Settings.h must switch between the TTTrack being created from the two options -- so one could then run L1TrackNtuplePlot.C? If not, how is this done?

@tomalin Right now, I don't think there is an easy way to compare the exact and approximate calculations, either from the TrackletCalculator or TrackletCalculatorDisplaced. Everything downstream of the TrackletCalculatorDisplaced is set up to use the approximate calculation, whether that's the floating point or integer version, since that should match what is ultimately done on the FPGA. For example, when setting the input parameters for the fit:

double kfrinv = tracklet->rinvapprox();
double kfphi0 = tracklet->phi0approx();
double kfz0 = tracklet->z0approx();
double kft = tracklet->tapprox();
double kfd0 = tracklet->d0approx();

Probably the most straightforward way of implementing the flag that you're proposing would be to have the methods in the Tracklet class that return the approximate parameters and projections return the exact versions instead, based on the value of the flag. Or the flag could control whether the exact or approximate values are stored in the approximate variables in the constructor. Are there preferences for how this is done?

  • As your answer makes clear that this feature doesn't even exist for the prompt tracking, and would require work to implement, my request is apparently beyond the scope of this PR. So whilst it would be nice to add this option in future, I won't insist on it here.

Copy link
Collaborator

@tomalin tomalin left a comment

Choose a reason for hiding this comment

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

I've checked the issues raised during the review have been addressed. Happy to merge.

@tomalin tomalin merged commit 05f0c67 into L1TK-dev-11_2_0_pre6 Dec 17, 2020
skinnari pushed a commit that referenced this pull request Mar 2, 2021
* Fixing the disp tracking bug

Changed a couple of asserts into if statements

* fixing warning

Fixed the following warning:

/cms/threejet-2/abhijith/hware_temp/approx_cal/CMSSW_11_2_0_pre6/src/L1Trigger/TrackFindingTracklet/src/MatchCalculator.cc:482:7: warning: 'imatch' may be used uninitialized in this function [-Wmaybe-uninitialized]

* add use approx switch to Tracklet Calculator Displaced
tschuh pushed a commit that referenced this pull request Apr 8, 2021
* Fixing the disp tracking bug

Changed a couple of asserts into if statements

* fixing warning

Fixed the following warning:

/cms/threejet-2/abhijith/hware_temp/approx_cal/CMSSW_11_2_0_pre6/src/L1Trigger/TrackFindingTracklet/src/MatchCalculator.cc:482:7: warning: 'imatch' may be used uninitialized in this function [-Wmaybe-uninitialized]

* add use approx switch to Tracklet Calculator Displaced
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.

3 participants