1
2
3
4
5
6
7
8
9 package org.lcsim.recon.tracking.trfzp;
10
11 import org.lcsim.recon.tracking.trfbase.ETrack;
12 import org.lcsim.recon.tracking.trfbase.Interactor;
13 import org.lcsim.recon.tracking.trfbase.PropDir;
14 import org.lcsim.recon.tracking.trfbase.Propagator;
15 import org.lcsim.recon.tracking.trfbase.Surface;
16 import org.lcsim.recon.tracking.trfbase.TrackError;
17 import org.lcsim.recon.tracking.trfbase.TrackVector;
18 import org.lcsim.recon.tracking.trfeloss.DeDx;
19 import org.lcsim.recon.tracking.trfutil.Assert;
20
21 import static java.lang.Math.abs;
22 import static java.lang.Math.sqrt;
23
24 import static org.lcsim.recon.tracking.trfzp.SurfZPlane.IX;
25 import static org.lcsim.recon.tracking.trfzp.SurfZPlane.IY;
26 import static org.lcsim.recon.tracking.trfzp.SurfZPlane.IDXDZ;
27 import static org.lcsim.recon.tracking.trfzp.SurfZPlane.IDYDZ;
28 import static org.lcsim.recon.tracking.trfzp.SurfZPlane.IQP;
29
30
31
32
33
34
35
36 public class ZPlaneEloss extends Interactor
37 {
38
39
40
41 private double _thickness;
42 private DeDx _dedx;
43
44
45
46
47 public ZPlaneEloss(double thickness, DeDx dedx)
48 {
49 _thickness = thickness;
50 _dedx = dedx;
51 }
52
53 public void interact(ETrack tre)
54 {
55 }
56
57 public void interact_dir( ETrack theTrack, PropDir direction )
58 {
59
60
61 Surface srf = theTrack.surface();
62 Assert.assertTrue( srf instanceof SurfZPlane);
63
64
65
66 Propagator.reduceDirection(direction);
67 Assert.assertTrue(direction == PropDir.FORWARD || direction == PropDir.BACKWARD);
68
69
70 TrackError cleanError = theTrack.error();
71
72
73 TrackError newError = new TrackError(cleanError);
74
75 TrackVector theVec = theTrack.vector();
76 TrackVector newVector = new TrackVector(theVec);
77
78 double pionMass = 0.13957;
79 double ptmax = 10000.;
80
81 double pinv = abs(theVec.get(IQP));
82 double dxdz = theVec.get(IDXDZ);
83 double dydz = theVec.get(IDYDZ);
84 double lfac = sqrt(1. + dxdz*dxdz + dydz*dydz);
85
86
87
88
89 double sign = 1.;
90 if ( pinv < 1./ptmax )
91 pinv = 1./ptmax;
92 else
93 sign = theVec.get(IQP) > 0. ? 1. : -1.;
94
95
96
97 double trackEnergy = sqrt(1./(pinv*pinv) + pionMass*pionMass);
98
99 double trueLength = lfac * _thickness;
100
101
102 double stdEnergy = _dedx.sigmaEnergy(trackEnergy, trueLength);
103
104 if(direction == PropDir.BACKWARD) trueLength = -trueLength;
105 _dedx.loseEnergy(trackEnergy, trueLength);
106
107 double newMomentum = trackEnergy>pionMass ?
108 sqrt(trackEnergy*trackEnergy - pionMass*pionMass) :
109 1./pinv;
110
111
112 newVector.set(IQP, sign/newMomentum);
113
114
115 double stdVec = theVec.get(IQP)*theVec.get(IQP)*stdEnergy;
116 stdVec *= stdVec;
117 newError.set(IQP, IQP, newError.get(IQP, IQP)+stdVec);
118
119
120 theTrack.setVectorAndKeepDirection(newVector);
121 theTrack.setError( newError );
122
123 }
124
125
126
127
128
129
130
131 public double thickness()
132 {
133 return _thickness;
134 }
135
136
137
138
139
140
141 public DeDx dEdX()
142 {
143 return _dedx;
144 }
145
146
147
148
149
150
151 public Interactor newCopy()
152 {
153 return new ZPlaneEloss(_thickness, _dedx);
154 }
155
156
157
158
159
160
161 public String toString()
162 {
163 return "ZPlaneEloss with thickness "+_thickness+" and energy loss "+_dedx;
164 }
165
166
167 }