miranov25 / fastMCKalman

Fast simulation and performance parameterization - primary for ALICE3 and DUNE
MIT License
0 stars 1 forks source link

When Propagate fails -> PropagateToMirrorX #20

Closed Trenchcoat95 closed 1 year ago

Trenchcoat95 commented 1 year ago

Modified so that if the propagation fails, then we PropagateToMirrorX() , we find the point with the closest x coordinate and continue from there. Problem with the rotation failures still exists but will require an alternative solution, since it happens AFTER the mirror.

Trenchcoat95 commented 1 year ago

Before modifications: Pulls:

Info in <testFastTracker partFull reco pull test P0 >: pullAnalytical - OK - 0.97       1.02
Info in <testFastTracker partFull reco pull test P1 >: pullAnalytical - OK - 0.99       1.03
Info in <testFastTracker partFull reco pull test P2 >: pullAnalytical - OK - 1.04       1.13
Info in <testFastTracker partFull reco pull test P3 >: pullAnalytical - OK - 0.99       1.04
Error in <testFastTracker partFull reco pull test P4>: pullAnalytical- FAILED- 0.87     1.00

Logs:

fastParticle::reconstructParticleFull: 2809
fastParticle::reconstructParticleFull: short track 2250
fastParticle::reconstructParticleFull: Too few consecutive points 57
fastParticle::reconstructParticleFull: Rotation failed 163
fastParticle::reconstructParticleFull: Propagation failed 298
fastParticle::reconstructParticleFull: Update failed 0
fastParticle::reconstructParticleFull: Too big chi2 19
fastParticle::reconstructParticleFull: Correct for material failed 12
fastParticle::reconstructParticleFull: PropagateToMirrorX failed 10
Trenchcoat95 commented 1 year ago

After Modifications: Pulls:

Info in <testFastTracker partFull reco pull test P0 >: pullAnalytical - OK - 0.96       1.01
Info in <testFastTracker partFull reco pull test P1 >: pullAnalytical - OK - 1.01       1.05
Error in <testFastTracker partFull reco pull test P2>: pullAnalytical- FAILED- 1.07     1.15
Info in <testFastTracker partFull reco pull test P3 >: pullAnalytical - OK - 1.01       1.07
Error in <testFastTracker partFull reco pull test P4>: pullAnalytical- FAILED- 0.88     0.98

Logs:

fastParticle::reconstructParticleFull: 2608
fastParticle::reconstructParticleFull: short track 2314
fastParticle::reconstructParticleFull: Too few consecutive points 60
fastParticle::reconstructParticleFull: Rotation failed 184
fastParticle::reconstructParticleFull: Propagation failed 0
fastParticle::reconstructParticleFull: Update failed 0
fastParticle::reconstructParticleFull: Too big chi2 17
fastParticle::reconstructParticleFull: Correct for material failed 14
fastParticle::reconstructParticleFull: PropagateToMirrorX failed 19
Trenchcoat95 commented 1 year ago

Rotation failure ALWAYS happens right after PropagateToMirrorX(), as shown in plot below: treeFast->Draw("(fLoop[]-fLoop[Iteration$+1])","Iteration$>2&&partFull.fStatusMaskIn==0","",40000) image

miranov25 commented 1 year ago

When you change the status to -1 will the bitmask not work anymore? Did I miss something? The default was one and each success added some bitmask. I assume this will not work as you expect

miranov25 commented 1 year ago

In case the problem happens after propatatetomirrow, maybe we have the same problem as with the propagate, update ... In case you do not understand, we can meet tomorrow to fix the problem.

Trenchcoat95 commented 1 year ago

Logs after latest commit:

fastParticle::reconstructParticleFull: 2426
fastParticle::reconstructParticleFull: short track 2259
fastParticle::reconstructParticleFull: Too few consecutive points 57
fastParticle::reconstructParticleFull: Rotation failed 30
fastParticle::reconstructParticleFull: Propagation failed 0
fastParticle::reconstructParticleFull: Update failed 0
fastParticle::reconstructParticleFull: Too big chi2 53
fastParticle::reconstructParticleFull: Correct for material failed 13
fastParticle::reconstructParticleFull: PropagateToMirrorX failed 14

Pulls after latest commit:

Info in <testFastTracker partFull reco pull test P0 >: pullAnalytical - OK - 0.96       1.00
Info in <testFastTracker partFull reco pull test P1 >: pullAnalytical - OK - 1.01       1.05
Info in <testFastTracker partFull reco pull test P2 >: pullAnalytical - OK - 1.06       1.13
Info in <testFastTracker partFull reco pull test P3 >: pullAnalytical - OK - 1.00       1.06
Error in <testFastTracker partFull reco pull test P4>: pullAnalytical- FAILED- 0.87     0.99
miranov25 commented 1 year ago

As I wrote above we should use bitmask to indicate the status. Default value of bitmask is 0 - nothing happened 2 additional bit to be added: kTrackEnter, kTrackSkip, and kTrackOK

  enum TrackingBits {
  kTrackEnter     =0x1,
  kTrackRotate   = 0x1,
  kTrackPropagate  = 0x2,
  kTrackCorrectForMaterial =0x4,
  kTrackUpdate =0x8,
  kTrackChi2   =0x10,
  kTrackSkip =0x20,
kTrackOK=0x40
} ;

kTrackOK should be set if everything fine Update and Chi2test kTrackSkip flag should be set if latyer was skipped because of some problems

Trenchcoat95 commented 1 year ago

After bit mask modification and added protection on Propagate failures:

Pull Test:

Info in <testFastTracker partFull reco pull test P0 >: pullAnalytical - OK - 0.97       1.02
Info in <testFastTracker partFull reco pull test P1 >: pullAnalytical - OK - 1.00       1.03
Error in <testFastTracker partFull reco pull test P2>: pullAnalytical- FAILED- 1.09     1.14
Info in <testFastTracker partFull reco pull test P3 >: pullAnalytical - OK - 1.00       1.05
Error in <testFastTracker partFull reco pull test P4>: pullAnalytical- FAILED- 0.88     1.00

Logs:

fastParticle::reconstructParticleFull: 2480
fastParticle::reconstructParticleFull: short track 2318
fastParticle::reconstructParticleFull: Too few consecutive points 57
fastParticle::reconstructParticleFull: Rotation failed 30
fastParticle::reconstructParticleFull: Propagation failed 30
fastParticle::reconstructParticleFull: Update failed 0
fastParticle::reconstructParticleFull: Too big chi2 29
fastParticle::reconstructParticleFull: Correct for material failed 16
fastParticle::reconstructParticleFull: PropagateToMirrorX failed 0
Trenchcoat95 commented 1 year ago

New possible statuses

Trenchcoat95 commented 1 year ago

New covariance plot:

image

miranov25 commented 1 year ago

I think the failure rate is already acceptable In real use case, we will connect the track segment (legs of helices) and for the brag peak the fit will be done in another direction higher momenta-> lower momenta-> brag peak Currently, we are doing it vice versa starting from the end of the trajectory getting optimal parameter at vertex I future we will do Kalman smoothing (up-down) and brag peak fit will be a separate function

miranov25 commented 1 year ago

Todo: get rid of the hardwired constant for the status mask in the test I will commit it. Merging for a moment

miranov25 commented 1 year ago

Relates to #9