cms-L1TK / cmssw

Fork of CMSSW where improvements to L1 tracking code are developed.
http://cms-sw.github.io/
Apache License 2.0
4 stars 5 forks source link

MP fix new tracklet with projections #237

Closed bryates closed 11 months ago

bryates commented 1 year ago

PR description:

This PR fixes a disagreement between the HLS and emulation. Currently, the emulation resets the best match values only when a new tracklet is found. This means tracklets with multiple projections can have issues, e.g.:

D2 PHIB
tracklet: 0x4933f000
proj: 0x7106acaa7f8a3c2  passes
proj: 0x01129bb27e8883d  failes

The PR looks instead uses the current and previous projection. It currently uses the string value, as this was easy to access. If this is inefficient, we could look into comparing the member values.

PR validation:

Full agreement with HLS in the barrel and disks for PHIB and PHIC

                      Tracklet  SUMMARY
number of stubs     per TFP = 363.0212 +- 8.0716
number of tracks    per TFP =  70.6402 +- 1.5618
current tracking efficiency =   0.9284 +- 0.0122
max     tracking efficiency =   0.9306 +- 0.0120
                  fake rate =   0.1789
             duplicate rate =   0.589
bryates commented 1 year ago

CI is failing due to the fatal: detected dubious ownership in repository at '/github/workspace' error brought up today.

aryd commented 1 year ago

I'm confused. A tracklet can only have one projection to a specific layer or disk. I don't see how we can have multiple projections to the same layer with one tracklet.

bryates commented 1 year ago

I'm confused. A tracklet can only have one projection to a specific layer or disk. I don't see how we can have multiple projections to the same layer with one tracklet.

Sorry, I mislabeled it above since I was testing D2 PHIB in HLS. The emulation does all layers together. I'll check where that other projection comes from.

tomalin commented 12 months ago

@bryates I think we're just waiting for you to finish answering Anders's comment above, before merging this.

bryates commented 12 months ago

I'm confused. A tracklet can only have one projection to a specific layer or disk. I don't see how we can have multiple projections to the same layer with one tracklet.

Sorry, I mislabeled it above since I was testing D2 PHIB in HLS. The emulation does all layers together. I'll check where that other projection comes from.

Ok

I'm confused. A tracklet can only have one projection to a specific layer or disk. I don't see how we can have multiple projections to the same layer with one tracklet.

Sorry, I mislabeled it above since I was testing D2 PHIB in HLS. The emulation does all layers together. I'll check where that other projection comes from.

@aryd, running again with it just set to print D2 PHIB I find he following:

Event 20:
tracklet = 0x1dd0b000
projection 1 = 0x01129bb27e8883d (no FM output)
projection 2 = 0x7106acaa7f8a3c2 (FM=0x011258000ff159)

So with the old setup, 0x01129bb27e8883d is processed correctly, but when it gets to 0x7106acaa7f8a3c2, it will not reload the LUT values.

The corresponding FM for projection 2 is found in FullMatches_FM_L1L2_D2PHIB_04.dat. This still doesn't answer the original question of why a single tracklet (in this case from L1L2) can have multiple projections into the disks (in this case D2).

Looking into TrackletProjections_TPROJ_L1L2B_D2PHIB_04.dat I only see the (correct) second projection (0x7106acaa7f8a3c2), meaning the TP emulation does not write out 0x01129bb27e8883d. I'm not as familiar with how the modules are chained together in the emulation. @aryd does the MP in the emulation read the TP text files, or are the memories passed directly as objects between the modules?

aryd commented 12 months ago

I'm confused. A tracklet can only have one projection to a specific layer or disk. I don't see how we can have multiple projections to the same layer with one tracklet.

Sorry, I mislabeled it above since I was testing D2 PHIB in HLS. The emulation does all layers together. I'll check where that other projection comes from.

Ok

I'm confused. A tracklet can only have one projection to a specific layer or disk. I don't see how we can have multiple projections to the same layer with one tracklet.

Sorry, I mislabeled it above since I was testing D2 PHIB in HLS. The emulation does all layers together. I'll check where that other projection comes from.

@aryd, running again with it just set to print D2 PHIB I find he following:

Event 20:
tracklet = 0x1dd0b000
projection 1 = 0x01129bb27e8883d (no FM output)
projection 2 = 0x7106acaa7f8a3c2 (FM=0x011258000ff159)

So with the old setup, 0x01129bb27e8883d is processed correctly, but when it gets to 0x7106acaa7f8a3c2, it will not reload the LUT values.

The corresponding FM for projection 2 is found in FullMatches_FM_L1L2_D2PHIB_04.dat. This still doesn't answer the original question of why a single tracklet (in this case from L1L2) can have multiple projections into the disks (in this case D2).

Looking into TrackletProjections_TPROJ_L1L2B_D2PHIB_04.dat I only see the (correct) second projection (0x7106acaa7f8a3c2), meaning the TP emulation does not write out 0x01129bb27e8883d. I'm not as familiar with how the modules are chained together in the emulation. @aryd does the MP in the emulation read the TP text files, or are the memories passed directly as objects between the modules?

Can you share the code for how you generated the printout? In the emulation the data is passed directly as objects without out writing/reading files. Files can be written out for use in the HLS code.

bryates commented 12 months ago

I'm confused. A tracklet can only have one projection to a specific layer or disk. I don't see how we can have multiple projections to the same layer with one tracklet.

Sorry, I mislabeled it above since I was testing D2 PHIB in HLS. The emulation does all layers together. I'll check where that other projection comes from.

Ok

I'm confused. A tracklet can only have one projection to a specific layer or disk. I don't see how we can have multiple projections to the same layer with one tracklet.

Sorry, I mislabeled it above since I was testing D2 PHIB in HLS. The emulation does all layers together. I'll check where that other projection comes from.

@aryd, running again with it just set to print D2 PHIB I find he following:

Event 20:
tracklet = 0x1dd0b000
projection 1 = 0x01129bb27e8883d (no FM output)
projection 2 = 0x7106acaa7f8a3c2 (FM=0x011258000ff159)

So with the old setup, 0x01129bb27e8883d is processed correctly, but when it gets to 0x7106acaa7f8a3c2, it will not reload the LUT values. The corresponding FM for projection 2 is found in FullMatches_FM_L1L2_D2PHIB_04.dat. This still doesn't answer the original question of why a single tracklet (in this case from L1L2) can have multiple projections into the disks (in this case D2). Looking into TrackletProjections_TPROJ_L1L2B_D2PHIB_04.dat I only see the (correct) second projection (0x7106acaa7f8a3c2), meaning the TP emulation does not write out 0x01129bb27e8883d. I'm not as familiar with how the modules are chained together in the emulation. @aryd does the MP in the emulation read the TP text files, or are the memories passed directly as objects between the modules?

Can you share the code for how you generated the printout? In the emulation the data is passed directly as objects without out writing/reading files. Files can be written out for use in the HLS code.

I've just pushed a branch called mp_log which has all my code. The important part for this study is in https://github.com/cms-L1TK/cmssw/blob/e8e9db8571b22e5e6100d07e9086237db70b967f/L1Trigger/TrackFindingTracklet/src/MatchProcessor.cc#L833-L840

aryd commented 11 months ago

I looked at the code in mp_log, but it was not obvious where this:

tracklet = 0x1dd0b000 projection 1 = 0x01129bb27e8883d (no FM output) projection 2 = 0x7106acaa7f8a3c2 (FM=0x011258000ff159)

was printed out - can you tell men the line numbers for these printouts? (I did not yet try to checkout and run the code.)

bryates commented 11 months ago

I looked at the code in mp_log, but it was not obvious where this:

tracklet = 0x1dd0b000 projection 1 = 0x01129bb27e8883d (no FM output) projection 2 = 0x7106acaa7f8a3c2 (FM=0x011258000ff159)

was printed out - can you tell men the line numbers for these printouts? (I did not yet try to checkout and run the code.)

These lines should give a similar printout: https://github.com/cms-L1TK/cmssw/blob/e8e9db8571b22e5e6100d07e9086237db70b967f/L1Trigger/TrackFindingTracklet/src/MatchProcessor.cc#L837-L839 it will print whether it would be skipped, the projection, the tracklet in parentheses, and the previous projection

It's currently set to print just D2_PHIB https://github.com/cms-L1TK/cmssw/blob/e8e9db8571b22e5e6100d07e9086237db70b967f/L1Trigger/TrackFindingTracklet/src/MatchProcessor.cc#L833-L834