1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 public class CylElossSim extends SimInteractor
18 {
19
20
21
22 private double _thickness;
23
24 private DeDx _dedx;
25
26
27
28
29
30
31
32
33
34
35
36 public CylElossSim(double thickness, DeDx dedx)
37 {
38 _thickness = thickness;
39 _dedx = dedx;
40 }
41
42
43
44
45
46
47
48
49 public CylElossSim(CylEloss inter)
50 {
51 _thickness = inter.thickness();
52 _dedx = inter.dEdX();
53 }
54
55
56
57
58
59
60
61
62
63
64
65 public void interact( VTrack vtrk )
66 {
67
68
69 Assert.assertTrue( vtrk.surface() instanceof SurfCylinder );
70
71
72 TrackVector theVec = vtrk.vector();
73 TrackVector newVector = new TrackVector(theVec);
74
75 double pionMass = 0.13957;
76 double ptmax = 10000.;
77
78 double pinv = Math.abs(theVec.get(SurfCylinder.IQPT)*Math.cos(Math.atan(theVec.get(SurfCylinder.ITLM))));
79
80
81
82
83 double sign = 1;
84 if(pinv < 1./ptmax)
85 pinv = 1./ptmax;
86 else
87 sign = theVec.get(SurfCylinder.IQPT)/Math.abs(theVec.get(SurfCylinder.IQPT));
88
89
90
91 double trackEnergy = Math.sqrt(1./pinv/pinv+pionMass*pionMass);
92
93 double trueLength = _thickness/Math.abs(Math.cos(theVec.get(SurfCylinder.IALF)))/
94 Math.cos(Math.atan(theVec.get(SurfCylinder.ITLM)));
95
96 double stdEnergy = _dedx.sigmaEnergy(trackEnergy, trueLength);
97 double stdMomentum = stdEnergy;
98
99
100
101
102 if(vtrk.isTrackForward()) trueLength = -trueLength;
103 trackEnergy=_dedx.loseEnergy(trackEnergy, trueLength);
104 double newMomentum = trackEnergy>pionMass ?
105 Math.sqrt(trackEnergy*trackEnergy-
106 pionMass*pionMass): 1./pinv;
107
108 newVector.set(SurfCylinder.IQPT, 1./newMomentum/Math.cos(Math.atan(theVec.get(SurfCylinder.ITLM)))*sign);
109 vtrk.setVectorAndKeepDirection(newVector);
110
111 }
112
113
114
115
116
117
118
119 public double thickness()
120 { return _thickness;
121 }
122
123
124
125
126
127
128
129 public DeDx dEdX()
130 {
131 return _dedx;
132 }
133
134
135
136
137
138
139
140
141
142 public SimInteractor newCopy()
143 {
144 return new CylElossSim(_thickness,_dedx);
145 }
146
147
148
149
150
151
152
153 public String toString()
154 {
155 return "CylElossSim with thickness "+_thickness+" and energy loss "+_dedx;
156 }
157 }