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
fix matchtp variables #76
Conversation
hi @cgsavard - thanks for this cleanup. i am going to hold off on this a few days since we are trying to merge code from Anders to avoid further confusion with that PR. |
I thought we'd fixed the d0 & z0 and their signs two years ago. But they still look weird.
|
|
||
float tmp_matchtp_charge = my_tp->charge(); | ||
float K = Kmagnitude * tmp_matchtp_charge; | ||
float d = 0; |
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.
What is the point of "float d = 0" if its value is always zero?
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.
Good question, I'm not sure. I just followed exactly what was done in the tracking particle section of the code and this variable was there but I did not write it. I can take it out of both sections if you think it's not important?
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.
@skinnari any objections if Claire removes "float d"?
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.
As far as I can see, this "K" is inv(2R). I don't know either what is purpose of "d".
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 have removed the d=0 variable both here and in calculating the tp_d0
I did not look into any other d0 variables, I just took what was already there to be the truth and copied it to create trk_matchtp_d0. If you would like to make these fixes in this PR then let me know and I can commit some more changes. |
float delx = -tmp_matchtp_vx; | ||
float dely = -tmp_matchtp_vy; | ||
|
||
float A = 0.01 * 0.5696; |
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.
This float "A" basically contains information of B filed that needs to be re
placed with a constant.
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 changed this to now depend on the magnetic field and speed of light constants in cmssw. I also redefined the K variable to r2_inv to avoid confusion with this variable in the future. I double checked to make sure that the K and r2_inv matched after the switch to using the cms constants.
|
||
float tmp_matchtp_t = tan(2.0 * atan(1.0) - 2.0 * atan(exp(-tmp_matchtp_eta))); | ||
|
||
float delx = -tmp_matchtp_vx; |
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 think the minus signs on L1021 and L1022 might be wrong.
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 don't know enough about propagating back to know if this is wrong or not. If you can confirm that this is incorrect then I will make the change. Do you also think that the overall sign of d0 is wrong? Ian proposes that it might be incorrect.
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.
To your second point on whether or not the overall sign of d0 is wrong, I agree with Ian that the sign of d0 does not seem to follow the cms convention. The easiest way to see this is to plot tp_d0 vs tp_d0_prod
There seems to be a negative association between the two variables and I am pretty sure the sign of tp_d0_prod is correct.
The only way I can think of to fix this sign problem is NOT directly flipping the sign on L1163 (i.e. tmp_tp_d0). Instead, I believe the signs on L1151&L1152 (delx & dely) are incorrect. If we modify those two lines and plot tp_d0 vs tp_d0_prod again:
.
Let me talk to Louise to see we can reach an agreement.
Can we please finish this PR, before we merge cms-L1TK into official CMSSW (~1 week)? I think we just need to fix the d0 signs.
|
Hi Ian, -1 I completely agree that the sign of tmp_trk_d0 and tmp_matchtrk_d0 need multiplying by -1. If finishing this PR before merging into official CMSSW is the goal, I would recommend the following ways forward regarding the 3rd bullet point: |
@cgsavard based on discussion above, please: |
I made the first two changes.
When looking at the difference in a ttbar+200PU sample, most changes are negligible but there are a few on the order of 10^-1 and 10^-2 which seem like a big enough change to look further. I could not run the displaced particle sample (https://twiki.cern.ch/twiki/bin/view/CMS/L1TrackMC#CMSSW_11_3_0) as the files failed to open and there doesn't seem to be another displaced dataset currently ready to use. |
@cgsavard try running on the displaced MC https://cmsweb.cern.ch/das/request?view=list&limit=50&instance=prod%2Fglobal&input=%2FRelVal*Displaced*%2FCMSSW_11_3_0_pre6*%2FGEN-SIM-DIGI-RAW . (N.B. It's D76, so you'll have to change the geometry in cfg). Checking which eqn. gives best d0 resolution might also help. |
@tomalin The results are very similar. Here I have attached the results for the displaced SUSY sample (noPU). "tp_d0" is the current d0 calculation with a sign flip at the end, and "tp_d02" is the d0 calculation when delx and dely have a sign flip. We see in both this and with the ttbar sample that the resolution for "tp_d02" is slightly larger than for "tp_d0". For comparison, the std of the difference tp_d0-tp_d02 for the ttbar sample is 0.4442 instead of 0.8873 for the displaced SUSY sample shown here. Since the results are very similar and the difference is small, should we select tp_d0 with the slightly smaller resolution? |
hi all, I am trying to understand this thread and am a bit confused. AFAIK the known problem is with the sign of track d0 vs TP d0? are you saying there is another problem here? |
Hi Louise, the signs of tmp_trk_d0 and tmp_matchtrk_d0 were wrong, which this PR has now fixed. |
@cgsavard @Jingyan95 I am confused now when looking at the changes. I know there is a problem with the d0 sign, but I thought it was only the (-1) that needed to be removed for the TP. but it seems that you are also changing the sign of the track d0? |
That's right. The signs of tmp_trk_d0 [1] and tmp_matchtrk_d0 [2] are also incorrect. Currently these two take the following form: [1] https://github.com/cms-L1TK/cmssw/blob/L1TK-dev-11_3_0_pre3/L1Trigger/TrackFindingTracklet/test/L1TrackNtupleMaker.cc#L864 |
@tomalin I removed the sign flip on tp_d0. I believe that was the last thing we were waiting on, unless you can think of anything else? |
As a sanity check, I've verified that with the latest version of this branch, 2D plots of matchtrk_d0 vs. tp_d0 or tp_d0_prod show a line gradient of +1. (And the resolution is much better for tp_d0 than for tp_d0_prod, as one would expect). |
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.
Happy
* fix matchtp variables * remove d=0 variables * switch values for cms constants * change pi to constant * change trk_d0 sign * move tmp_tp_d0 and tmp_tp_z0 calc up * flip tp_d0 sign
* fix matchtp variables * remove d=0 variables * switch values for cms constants * change pi to constant * change trk_d0 sign * move tmp_tp_d0 and tmp_tp_z0 calc up * flip tp_d0 sign
* fix matchtp variables * remove d=0 variables * switch values for cms constants * change pi to constant * change trk_d0 sign * move tmp_tp_d0 and tmp_tp_z0 calc up * flip tp_d0 sign
* fix matchtp variables * remove d=0 variables * switch values for cms constants * change pi to constant * change trk_d0 sign * move tmp_tp_d0 and tmp_tp_z0 calc up * flip tp_d0 sign
* fix matchtp variables * remove d=0 variables * switch values for cms constants * change pi to constant * change trk_d0 sign * move tmp_tp_d0 and tmp_tp_z0 calc up * flip tp_d0 sign
PR description:
The trk_matchtp_{} variables in the standard ntuple maker had some issues. First, the trk_matchtp_z0 was incorrect. It was actually the vz, not z0. Next, trk_matchtp_d0 was not included in the collection but is an important variable to have for studying displaced tracks. Lastly, many of the calls to get the variables, such as the tp phi, were outdated although it still worked.
I made all these fixes by followiing exactly what was done in the regular tp collection to get/calculate all of the variables.
PR validation:
Here are the distributions of the trk_matchtp_z0 and trk_matchtp_d0 to show that they are calculated correctly. The rest of the matchtp variables did not change.