@@ -126,7 +126,7 @@ GPUd() void GPUTPCCompressionTrackModel::Init(float x, float y, float z, float a
126126 mP [4 ] = (qPt - 127 .f ) * (20 .f / 127 .f );
127127 resetCovariance ();
128128 mNDF = -5 ;
129- mField = & param.polynomialField ;
129+ mBz = param.ConstBz ;
130130 float pti = CAMath::Abs (mP [4 ]);
131131 if (pti < 1 .e -4f ) {
132132 pti = 1 .e -4f ; // set 10.000 GeV momentum for straight track
@@ -163,22 +163,20 @@ GPUd() int GPUTPCCompressionTrackModel::Propagate(float x, float alpha)
163163 return 0 ;
164164 }
165165
166- float Bz = getBz (mTrk .x , mTrk .y , mTrk .z );
167-
168166 // propagate mTrk to t0e
169167 PhysicalTrackModel t0e (mTrk );
170168 float dLp = 0 ;
171169 if (CAMath::Abs (x - t0e.x ) < 1 .e -8f ) {
172170 return 0 ;
173171 }
174- if (propagateToXBzLightNoUpdate (t0e, x, Bz , dLp)) {
172+ if (propagateToXBzLightNoUpdate (t0e, x, mBz , dLp)) {
175173 return 1 ;
176174 }
177175 updatePhysicalTrackValues (t0e);
178176 if (CAMath::Abs (t0e.sinphi ) >= MaxSinPhi) {
179177 return -3 ;
180178 }
181- return followLinearization (t0e, Bz , dLp);
179+ return followLinearization (t0e, mBz , dLp);
182180}
183181
184182GPUd () int GPUTPCCompressionTrackModel::Filter(float y, float z, int iRow)
@@ -294,11 +292,7 @@ GPUd() int GPUTPCCompressionTrackModel::Filter(float y, float z, int iRow)
294292
295293GPUd () int GPUTPCCompressionTrackModel::Mirror()
296294{
297- float Bz = getBz (mTrk .x , mTrk .y , mTrk .z );
298- if (CAMath::Abs (Bz) < 1 .e -8f ) {
299- Bz = 1 .e -8f ;
300- }
301- float dy = -2 .f * mTrk .q * mTrk .px / Bz;
295+ float dy = -2 .f * mTrk .q * mTrk .px / mBz ;
302296 float dS; // path in XY
303297 {
304298 float chord = dy; // chord to the extrapolated point == |dy|*sign(x direction)
@@ -361,25 +355,6 @@ GPUd() int GPUTPCCompressionTrackModel::Mirror()
361355 return 0 ;
362356}
363357
364- GPUd () void GPUTPCCompressionTrackModel::getBxByBz(float cosAlpha, float sinAlpha, float x, float y, float z, float b[3 ]) const
365- {
366- float xGlb = x * cosAlpha - y * sinAlpha;
367- float yGlb = x * sinAlpha + y * cosAlpha;
368- float bb[3 ];
369- mField ->GetField (xGlb, yGlb, z, bb);
370- // rotate field to local coordinates
371- b[0 ] = bb[0 ] * cosAlpha + bb[1 ] * sinAlpha;
372- b[1 ] = -bb[0 ] * sinAlpha + bb[1 ] * cosAlpha;
373- b[2 ] = bb[2 ];
374- }
375-
376- GPUd () float GPUTPCCompressionTrackModel::getBz(float x, float y, float z) const
377- {
378- float xGlb = x * mCosAlpha - y * mSinAlpha ;
379- float yGlb = x * mSinAlpha + y * mCosAlpha ;
380- return mField ->GetFieldBz (xGlb, yGlb, z);
381- }
382-
383358GPUd () void GPUTPCCompressionTrackModel::updatePhysicalTrackValues(PhysicalTrackModel& trk)
384359{
385360 float px = trk.px ;
@@ -460,12 +435,11 @@ GPUd() int GPUTPCCompressionTrackModel::rotateToAlpha(float newAlpha)
460435 float trackX = x0 * cc + ss * mP [0 ];
461436
462437 // transport t0 to trackX
463- float B[3 ];
464- getBxByBz (CAMath::Cos (newAlpha), CAMath::Sin (newAlpha), t0.x , t0.y , t0.z , B);
465438 float dLp = 0 ;
466- if (propagateToXBxByBz (t0, trackX, B[ 0 ], B[ 1 ], B[ 2 ] , dLp)) {
439+ if (propagateToXBzLightNoUpdate (t0, trackX, mBz , dLp)) {
467440 return -1 ;
468441 }
442+ updatePhysicalTrackValues (t0);
469443
470444 if (CAMath::Abs (t0.sinphi ) >= MaxSinPhi) {
471445 return -1 ;
@@ -531,7 +505,7 @@ GPUd() int GPUTPCCompressionTrackModel::rotateToAlpha(float newAlpha)
531505 // only covariance changes. Use rotated and transported t0 for linearisation
532506 float j3 = -t0.py / t0.px ;
533507 float j4 = -t0.pz / t0.px ;
534- float j5 = t0.qpt * B[ 2 ] ;
508+ float j5 = t0.qpt * mBz ;
535509
536510 // Y Z Sin DzDs q/p X
537511 // Jacobian J1 = { { 1, 0, 0, 0, 0, j3 }, // Y
@@ -566,98 +540,6 @@ GPUd() int GPUTPCCompressionTrackModel::rotateToAlpha(float newAlpha)
566540 return 0 ;
567541}
568542
569- GPUd () int GPUTPCCompressionTrackModel::propagateToXBxByBz(PhysicalTrackModel& t, float x, float Bx, float By, float Bz, float & dLp)
570- {
571- //
572- // transport the track to X=x in magnetic field B = ( Bx, By, Bz )[kG*0.000299792458]
573- // xyzPxPyPz as well as all the additional values will change. No need to call UpdateValues() afterwards.
574- // the method returns error code (0 == no error)
575- //
576- dLp = 0 .f ;
577-
578- // Rotate to the system where Bx=By=0.
579-
580- float bt = CAMath::Sqrt (Bz * Bz + By * By);
581- float bb = CAMath::Sqrt (Bx * Bx + By * By + Bz * Bz);
582-
583- float c1 = 1 .f , s1 = 0 .f ;
584- float c2 = 1 .f , s2 = 0 .f ;
585-
586- if (bt > 1 .e -4f ) {
587- c1 = Bz / bt;
588- s1 = By / bt;
589- c2 = bt / bb;
590- s2 = -Bx / bb;
591- }
592-
593- // rotation matrix: first around x, then around y'
594- // after the first rotation: Bx'==Bx, By'==0, Bz'==Bt, X'==X
595- // after the second rotation: Bx''==0, By''==0, Bz''==B, X'' axis is as close as possible to the original X
596-
597- //
598- // ( c2 0 s2 ) ( 1 0 0 )
599- // R = ( 0 1 0 ) X ( 0 c1 -s1 )
600- // (-s2 0 c2 ) ( 0 s1 c1 )
601- //
602-
603- float R0[3 ] = {c2, s1 * s2, c1 * s2};
604- float R1[3 ] = {0 , c1, -s1};
605- float R2[3 ] = {-s2, s1 * c2, c1 * c2};
606-
607- // parameters and the extrapolation point in the rotated coordinate system
608- {
609- float lx = t.x , ly = t.y , lz = t.z , lpx = t.px , lpy = t.py , lpz = t.pz ;
610-
611- t.x = R0[0 ] * lx + R0[1 ] * ly + R0[2 ] * lz;
612- t.y = R1[0 ] * lx + R1[1 ] * ly + R1[2 ] * lz;
613- t.z = R2[0 ] * lx + R2[1 ] * ly + R2[2 ] * lz;
614-
615- t.px = R0[0 ] * lpx + R0[1 ] * lpy + R0[2 ] * lpz;
616- t.py = R1[0 ] * lpx + R1[1 ] * lpy + R1[2 ] * lpz;
617- t.pz = R2[0 ] * lpx + R2[1 ] * lpy + R2[2 ] * lpz;
618- }
619-
620- float dx = x - mX ;
621- float xe = t.x + dx; // propagate on same dx in rotated system
622-
623- // transport in rotated coordinate system to X''=xe:
624-
625- if (t.px < (1 .f - MaxSinPhi)) {
626- t.px = 1 .f - MaxSinPhi;
627- }
628- if (propagateToXBzLightNoUpdate (t, xe, bb, dLp) != 0 ) {
629- return -1 ;
630- }
631-
632- // rotate coordinate system back to the original R{-1}==R{T}
633- {
634- float lx = t.x , ly = t.y , lz = t.z , lpx = t.px , lpy = t.py , lpz = t.pz ;
635-
636- t.x = R0[0 ] * lx + R1[0 ] * ly + R2[0 ] * lz;
637- t.y = R0[1 ] * lx + R1[1 ] * ly + R2[1 ] * lz;
638- t.z = R0[2 ] * lx + R1[2 ] * ly + R2[2 ] * lz;
639-
640- t.px = R0[0 ] * lpx + R1[0 ] * lpy + R2[0 ] * lpz;
641- t.py = R0[1 ] * lpx + R1[1 ] * lpy + R2[1 ] * lpz;
642- t.pz = R0[2 ] * lpx + R1[2 ] * lpy + R2[2 ] * lpz;
643- }
644-
645- // a small (hopefully) additional step to X=x. Perhaps it may be replaced by linear extrapolation.
646-
647- float ddLp = 0 ;
648- if (t.px < (1 .f - MaxSinPhi)) {
649- t.px = 1 .f - MaxSinPhi;
650- }
651- if (propagateToXBzLightNoUpdate (t, x, Bz, ddLp) != 0 ) {
652- return -1 ;
653- }
654-
655- dLp += ddLp;
656-
657- updatePhysicalTrackValues (t);
658- return 0 ;
659- }
660-
661543GPUd () int GPUTPCCompressionTrackModel::propagateToXBzLightNoUpdate(PhysicalTrackModel& t, float x, float Bz, float & dLp)
662544{
663545 //
0 commit comments