StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFtpcConfMapPoint.cc
1 // $Id: StFtpcConfMapPoint.cc,v 1.10 2007/01/15 08:23:01 jcs Exp $
2 // $Log: StFtpcConfMapPoint.cc,v $
3 // Revision 1.10 2007/01/15 08:23:01 jcs
4 // replace printf, cout and gMesMgr with Logger commands
5 //
6 // Revision 1.9 2004/04/06 18:36:12 oldi
7 // New data mebers for pad and time position and pad and time sigma added.
8 // Reference to StFtpcHit added.
9 // Possibility to update StFtpcHit coordinates directly included.
10 //
11 // Revision 1.8 2004/02/12 19:37:09 oldi
12 // *** empty log message ***
13 //
14 // Revision 1.7 2004/01/28 01:41:32 jeromel
15 // *** empty log message ***
16 //
17 // Revision 1.6 2003/01/20 13:16:22 oldi
18 // Additional volume segment added as garbage container. Hits which give a
19 // segment index which is out of range (esp. those ones sitting exactly on the
20 // beam line) are put in here.
21 // Handling of function GetSegm() simplified.
22 //
23 // Revision 1.5 2001/04/19 11:29:39 oldi
24 // Text of warning in SetAngles() changend.
25 //
26 // Revision 1.4 2000/11/10 18:34:31 oldi
27 // New constructor added.
28 //
29 // Revision 1.3 2000/07/18 21:22:15 oldi
30 // Changes due to be able to find laser tracks.
31 // Cleanup: - new functions in StFtpcConfMapper, StFtpcTrack, and StFtpcPoint
32 // to bundle often called functions
33 // - short functions inlined
34 // - formulas of StFormulary made static
35 // - avoid streaming of objects of unknown size
36 // (removes the bunch of CINT warnings during compile time)
37 // - two or three minor bugs cured
38 //
39 // Revision 1.2 2000/06/07 09:51:01 oldi
40 // Wrong setting in SetAllCoord(const StFtpcConfMapPoint *preceding_hit) in case
41 // of this == preceding_hit changed. Tracking with no vertex constraint works now
42 // poperly.
43 // Introduced a workaround for the exit(-1) in SetAngles().
44 //
45 // Revision 1.1 2000/05/11 15:14:38 oldi
46 // Changed class names *Hit.* due to already existing class StFtpcHit.cxx in StEvent
47 //
48 
49 //----------Author: Markus D. Oldenburg
50 //----------Last Modified: 13.07.2000
51 //----------Copyright: &copy MDO Production 1999
52 
53 #include "StFtpcConfMapPoint.hh"
54 #include "StMessMgr.h"
55 
57 // //
58 // StFtpcConfMapPoint class - representation of one cluster for the conformal //
59 // mapping track algorithm. //
60 // //
61 // This class inherits all data members from StFtpcPoint which are the output //
62 // of the FTPC cluster finder. Additionally it provides some data members and //
63 // member functions which are necessary for the tracking algorithm. //
64 // The errors are calulated using the Gaussian law of error propagation. //
65 // //
67 
68 ClassImp(StFtpcConfMapPoint)
69 
70 
72 {
73  // Default constructor.
74  // Sets additional values to zero.
75 
76  SetPhi(0.);
77  SetEta(0.);
78 
79  SetXprime(0.);
80  SetYprime(0.);
81  SetXprimeerr(0.);
82  SetYprimeerr(0.);
83  SetIntPoint(0., 0., 0., 0., 0., 0.);
84  SetShiftedCoord();
85  SetDist(0., 0.);
86 }
87 
88 
89 StFtpcConfMapPoint::StFtpcConfMapPoint(StFtpcPoint* point, StFtpcVertex *vertex) : StFtpcPoint(*point)
90 {
91  // "Copy" constructor.
92 
93  Setup(vertex);
94 }
95 
96 
97 StFtpcConfMapPoint::StFtpcConfMapPoint(Long_t row,
98  Long_t sector,
99  Long_t n_pads,
100  Long_t n_bins,
101  Long_t max_adc,
102  Long_t charge,
103  Float_t padpos,
104  Float_t timepos,
105  Float_t padpossigma,
106  Float_t timepossigma,
107  Double_t x,
108  Double_t y,
109  Double_t z,
110  Double_t x_err,
111  Double_t y_err,
112  Double_t z_err,
113  Double_t s_phi,
114  Double_t s_r,
115  Long_t flags) : StFtpcPoint(row,
116  sector,
117  n_pads,
118  n_bins,
119  max_adc,
120  charge,
121  padpos,
122  timepos,
123  padpossigma,
124  timepossigma,
125  x,
126  y,
127  z,
128  x_err,
129  y_err,
130  z_err,
131  s_phi,
132  s_r,
133  flags)
134 {
135  // Constructor which takes its arguments directly from the cluster finder.
136  // Sets additional values to zero.
137 
138  SetPhi(0.);
139  SetEta(0.);
140 
141  SetXprime(0.);
142  SetYprime(0.);
143  SetXprimeerr(0.);
144  SetYprimeerr(0.);
145  SetIntPoint(0., 0., 0., 0., 0., 0.);
146  SetShiftedCoord();
147  SetDist(0., 0.);
148 
149  return;
150 }
151 
152 
153 StFtpcConfMapPoint::StFtpcConfMapPoint(Double_t *x, Int_t row, StFtpcVertex *vertex) : StFtpcPoint(x, row)
154 {
155  // Constructor which handels arbitrary points with given coordinates.
156 
157  Setup(vertex);
158 }
159 
160 
161 StFtpcConfMapPoint::~StFtpcConfMapPoint()
162 {
163  // Destructor.
164  // Does nothing except destruct.
165 }
166 
167 
168 void StFtpcConfMapPoint::Setup(StFtpcVertex *vertex)
169 {
170  // Does the usual setup of a StFtpcConfMapPoint. It does it in the right order, especially.
171 
172  SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
173  vertex->GetXerr(), vertex->GetYerr(), vertex->GetZerr());
174  SetShiftedCoord();
175  SetConfCoord();
176  // The angles are set properly if they are set after the interaction point and the shifted coordinates
177  SetAngles();
178  SetDist(0., 0.);
179 
180  return;
181 }
182 
183 
184 void StFtpcConfMapPoint::SetIntPoint(const Double_t in_x, const Double_t in_y, const Double_t in_z,
185  const Double_t in_x_err, const Double_t in_y_err, const Double_t in_z_err)
186 {
187  // Defines a new interaction point. This point is needed to calculate
188  // the conformal coordinates.
189 
190  SetXt(in_x);
191  SetYt(in_y);
192  SetZt(in_z);
193  SetXterr(in_x_err);
194  SetYterr(in_y_err);
195  SetZterr(in_z_err);
196 
197  return;
198 }
199 
200 
201 void StFtpcConfMapPoint::SetAllCoord(const StFtpcConfMapPoint *preceding_hit)
202 {
203  // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
204  // These values are calculated from the interaction point of the given cluster which should be a
205  // already found cluster on the same track.
206 
207  if (this == preceding_hit) {
208  SetIntPoint(preceding_hit->GetX(), preceding_hit->GetY(), preceding_hit->GetZ(),
209  preceding_hit->GetXerr(), preceding_hit->GetYerr(), preceding_hit->GetZerr());
210  }
211 
212  else {
213  SetIntPoint(preceding_hit->GetXt(), preceding_hit->GetYt(), preceding_hit->GetZt(),
214  preceding_hit->GetXterr(), preceding_hit->GetYterr(), preceding_hit->GetZterr());
215  }
216 
217  SetShiftedCoord();
218  SetConfCoord();
219 
220  return;
221 }
222 
223 
224 void StFtpcConfMapPoint::SetShiftedCoord()
225 {
226  // Sets the coordinates with resepct to the given vertex point
227 
228  SetXv(GetX() - mXt);
229  SetYv(GetY() - mYt);
230  SetZv(GetZ() - mZt);
231  SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + mXterr*mXterr));
232  SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + mYterr*mYterr));
233  SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + mZterr*mZterr));
234 
235  return;
236 }
237 
238 
239 void StFtpcConfMapPoint::SetConfCoord()
240 {
241  // Calculates the conformal coordinates of one cluster.
242  // If the option "vertex_constraint" applies the interaction point is
243  // assumed to be at (0, 0, 0). Otherwise the function will use the
244  // interaction point specified by mXt and mYt.
245 
246  Double_t r2;
247 
248  if ((r2 = mXv*mXv + mYv*mYv)) {
249  mXprime = mXv / r2;
250  mYprime = -mYv / r2;
251  mXprimeerr = TMath::Sqrt(TMath::Power((-mXv * mXv + mYv*mYv) * mXverr, 2) + TMath::Power( 2*mXv*mYv*mYverr, 2)) / TMath::Power(mXv*mXv + mYv*mYv, 2);
252  mXprimeerr = TMath::Sqrt(TMath::Power((-mXv * mXv - 3*mYv*mYv) * mYverr, 2) + TMath::Power(-2*mXv*mYv*mXverr, 2)) / TMath::Power(mXv*mXv + mYv*mYv, 2);
253  }
254 
255  else {
256  mXprime = 0.;
257  mYprime = 0.;
258  mXprimeerr = 0.;
259  mYprimeerr = 0.;
260  }
261 
262  return;
263 }
264 
265 
266 void StFtpcConfMapPoint::SetAngles()
267 {
268  // Calculates the angle phi and the pseudorapidity eta for each cluster.
269  // So to say this is just a transformation of the coordinate system.
270 
271  Double_t r3dim = TMath::Sqrt(mXv*mXv + mYv*mYv + mZv*mZv);
272  Double_t r2dim = TMath::Sqrt(mXv*mXv + mYv*mYv);
273 
274  if (r2dim == 0.) {
275  // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
276  // This can only happen if the point is lying on the z-axis and this should never be possible.
277  LOG_WARN << "The pseudorapidity cannot be calculated! (2-dim radius is zero and set to 1.e-10.)" << endm;
278  r2dim = 1.e-10;
279  }
280 
281  if (mXv == 0.) {
282  mPhi = (mYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
283  }
284 
285  else {
286  mPhi = (mXv > 0.) ? TMath::ASin(mYv/r2dim) : TMath::Pi() - TMath::ASin(mYv/r2dim);
287  }
288 
289  if (mPhi < 0.) {
290  mPhi += 2. * TMath::Pi();
291  }
292 
293  mEta = 0.5 * TMath::Log((r3dim + mZv)/(r3dim - mZv));
294 
295  return;
296 }