1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////
20 // Segment for reconstruction
25 // two hits for reconstruction in the two chambers of one station
27 ///////////////////////////////////////////////////////////
29 #include "AliMUONSegment.h"
31 #include "AliMUONHitForRec.h"
32 #include "AliMUONTrackParam.h"
33 #include "AliRun.h" // for gAlice
36 ClassImp(AliMUONSegment) // Class implementation in ROOT context
38 //__________________________________________________________________________
39 AliMUONSegment::AliMUONSegment()
42 // Default constructor
43 fHitForRecPtr1 = 0; // pointer to HitForRec in first chamber
44 fHitForRecPtr2 = 0; // pointer to HitForRec in second chamber
46 fBendingCoor = 0.0; // Coordinate in bending plane
47 fBendingSlope = 0.0; // Slope in bending plane
48 // Covariance in bending plane:
49 fBendingCoorReso2 = 0.0; // Covariance(coordinate C1 in first chamber)
50 fBendingSlopeReso2 = 0.0; // Covariance(slope)
51 fBendingCoorSlopeReso2 = 0.0; // Covariance(C1,slope)
52 fBendingImpact = 0.0; // Impact parameter in bending plane
54 fNonBendingCoor = 0.0; // Coordinate in non bending plane
55 fNonBendingSlope = 0.0; // Slope in non bending plane
56 // Covariance in non bending plane:
57 fNonBendingCoorReso2 = 0.0; // Covariance(coordinate C1 in first chamber)
58 fNonBendingSlopeReso2 = 0.0; // Covariance(slope)
59 fNonBendingCoorSlopeReso2 = 0.0; // Covariance(C1,slope)
60 fZ = 0.0; // z in first plane
61 fNonBendingImpact = 0.0; // Impact parameter in non bending plane
62 fInTrack = kFALSE; // TRUE if segment belongs to one track
65 //__________________________________________________________________________
66 AliMUONSegment::AliMUONSegment(AliMUONHitForRec* Hit1, AliMUONHitForRec* Hit2)
69 // Constructor for AliMUONSegment from two HitForRec's,
70 // one, in the first chamber of the station, pointed to by "Hit1",
71 // the other one, in the second chamber of the station, pointed to by "Hit1".
72 // Fills the pointers to both hits,
73 // the slope, the covariance for (coordinate in first chamber, slope),
74 // and the impact parameter at vertex (Z=0),
75 // in bending and non bending planes.
76 // Puts the "fInTrack" flag to "kFALSE".
78 // pointers to HitForRec's
79 fHitForRecPtr1 = Hit1;
80 fHitForRecPtr2 = Hit2;
81 dz = Hit1->GetZ() - Hit2->GetZ();
84 fBendingCoor = Hit1->GetBendingCoor();
85 fBendingSlope = (fBendingCoor - Hit2->GetBendingCoor()) / dz;
86 fBendingImpact = fBendingCoor - Hit1->GetZ() * fBendingSlope;
87 fBendingCoorReso2 = Hit1->GetBendingReso2();
88 fBendingSlopeReso2 = ( Hit1->GetBendingReso2() +
89 Hit2->GetBendingReso2() ) / dz / dz;
90 fBendingCoorSlopeReso2 = Hit1->GetBendingReso2() / dz;
92 fNonBendingCoor = Hit1->GetNonBendingCoor();
93 fNonBendingSlope = (fNonBendingCoor - Hit2->GetNonBendingCoor()) / dz;
94 fNonBendingImpact = fNonBendingCoor - Hit1->GetZ() * fNonBendingSlope;
95 fNonBendingCoorReso2 = Hit1->GetNonBendingReso2();
96 fNonBendingSlopeReso2 = ( Hit1->GetNonBendingReso2() +
97 Hit2->GetNonBendingReso2() ) / dz / dz;
98 fNonBendingCoorSlopeReso2 = Hit1->GetNonBendingReso2() / dz;
99 // "fInTrack" flag to "kFALSE"
104 AliMUONSegment::AliMUONSegment (const AliMUONSegment& theMUONSegment)
105 : TObject(theMUONSegment)
107 // Protected copy constructor
109 AliFatal("Not implemented.");
112 AliMUONSegment & AliMUONSegment::operator=(const AliMUONSegment& rhs)
114 // Protected assignement operator
116 if (this == &rhs) return *this;
118 AliFatal("Not implemented.");
123 //__________________________________________________________________________
124 Int_t AliMUONSegment::Compare(const TObject* Segment) const
126 // "Compare" function to sort with increasing absolute value
127 // of the "impact parameter" in bending plane.
128 // Returns -1 (0, +1) if |impact parameter| of current Segment
129 // is smaller than (equal to, larger than) |impact parameter| of Segment
130 if (TMath::Abs(((AliMUONSegment*)this)->fBendingImpact)
131 < TMath::Abs(((AliMUONSegment*)Segment)->fBendingImpact))
133 // continuous parameter, hence no need for testing equal case
137 //__________________________________________________________________________
138 Double_t AliMUONSegment::NormalizedChi2WithSegment(AliMUONSegment* Segment, Double_t Sigma2Cut) const
140 // Calculate the normalized Chi2 between the current Segment (this)
141 // and the Segment pointed to by "Segment",
142 // i.e. the square deviations between the coordinates and the slopes,
143 // in both the bending and the non bending plane,
144 // divided by the variance of the same quantities and by "Sigma2Cut".
145 // Returns 5 if none of the 4 quantities is OK,
146 // something smaller than or equal to 4 otherwise.
147 // Would it be more correct to use a real chi square
148 // including the non diagonal term ????
149 Double_t chi2, chi2Max, diff, normDiff;
152 // coordinate in bending plane
153 diff = this->fBendingCoor - Segment->fBendingCoor;
154 normDiff = diff * diff /
155 (this->fBendingCoorReso2 + Segment->fBendingCoorReso2) / Sigma2Cut;
156 if (normDiff > 1.0) return chi2Max;
157 chi2 = chi2 + normDiff;
158 // slope in bending plane
159 diff = this->fBendingSlope - Segment->fBendingSlope;
160 normDiff = diff * diff /
161 (this->fBendingSlopeReso2 + Segment->fBendingSlopeReso2) / Sigma2Cut;
162 if (normDiff > 1.0) return chi2Max;
163 chi2 = chi2 + normDiff;
164 // coordinate in non bending plane
165 diff = this->fNonBendingCoor - Segment->fNonBendingCoor;
166 normDiff = diff * diff /
167 (this->fNonBendingCoorReso2 + Segment->fNonBendingCoorReso2) / Sigma2Cut;
168 if (normDiff > 1.0) return chi2Max;
169 chi2 = chi2 + normDiff;
170 // slope in non bending plane
171 diff = this->fNonBendingSlope - Segment->fNonBendingSlope;
172 normDiff = diff * diff /
173 (this->fNonBendingSlopeReso2 + Segment->fNonBendingSlopeReso2) / Sigma2Cut;
174 if (normDiff > 1.0) return chi2Max;
175 chi2 = chi2 + normDiff;
179 //__________________________________________________________________________
180 AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation ( Double_t z, Double_t MCSfactor) const
182 // Extrapolates linearly the current Segment (this) to station (0..) "Station".
183 // Multiple Coulomb scattering calculated from "MCSfactor"
184 // corresponding to one chamber,
185 // with one chamber for the coordinate, two chambers for the angle,
186 // due to the arrangement in stations.
187 // Valid from station(1..) 4 to 5 or vice versa.
188 // Returns the pointer to the created AliMUONSegment object
189 // corresponding to this extrapolation.
190 // The caller has the responsibility to delete this object.
191 AliMUONSegment* extrapSegment = new AliMUONSegment(); // creates empty new segment
192 // dZ from first hit of current Segment to first chamber of station "Station"
193 Double_t dZ = z - this->GetZ();
194 // Data in bending plane
195 extrapSegment->fZ = z;
197 extrapSegment->fBendingCoor = this->fBendingCoor + this->fBendingSlope * dZ;
199 extrapSegment->fBendingSlope = this->fBendingSlope;
200 // covariance, including multiple Coulomb scattering over dZ due to one chamber
201 extrapSegment->fBendingCoorReso2 = this->fBendingCoorReso2 +
202 (this->fBendingSlopeReso2 + MCSfactor) * dZ * dZ; // missing non diagonal term: "2.0 * this->fBendingCoorSlopeReso2 * dZ" !!!!
203 extrapSegment->fBendingSlopeReso2 = this->fBendingSlopeReso2 + 2.0 * MCSfactor;
204 extrapSegment->fBendingCoorSlopeReso2 =
205 this->fBendingCoorSlopeReso2 + this->fBendingSlopeReso2 * dZ; // missing: contribution from multiple Coulomb scattering !!!!
206 // Data in non bending plane
208 extrapSegment->fNonBendingCoor =
209 this->fNonBendingCoor + this->fNonBendingSlope * dZ;
211 extrapSegment->fNonBendingSlope = this->fNonBendingSlope;
212 // covariance, including multiple Coulomb scattering over dZ due to one chamber
213 extrapSegment->fNonBendingCoorReso2 = this->fNonBendingCoorReso2 +
214 (this->fNonBendingSlopeReso2 + MCSfactor) *dZ * dZ; // missing non diagonal term: "2.0 * this->fNonBendingCoorSlopeReso2 * dZ" !!!!
215 extrapSegment->fNonBendingSlopeReso2 =
216 this->fNonBendingSlopeReso2 + 2.0 * MCSfactor;
217 extrapSegment->fNonBendingCoorSlopeReso2 =
218 this->fNonBendingCoorSlopeReso2 + this->fNonBendingSlopeReso2 * dZ; // missing: contribution from multiple Coulomb scattering !!!!
219 return extrapSegment;
222 //__________________________________________________________________________
223 AliMUONHitForRec* AliMUONSegment::CreateHitForRecFromLinearExtrapToChamber ( Double_t z, Double_t MCSfactor) const
225 // Extrapolates linearly the current Segment (this) to chamber(0..) "Chamber".
226 // Multiple Coulomb scattering calculated from "MCSfactor"
227 // corresponding to one chamber.
228 // Valid from station(1..) 4 to 5 or vice versa.
229 // Returns the pointer to the created AliMUONHitForRec object
230 // corresponding to this extrapolation.
231 // The caller has the responsibility to delete this object.
232 AliMUONHitForRec* extrapHitForRec = new AliMUONHitForRec(); // creates empty new HitForRec
233 // dZ from first hit of current Segment to chamber
234 Double_t dZ = z - this->GetZ();
235 // Data in bending plane
236 extrapHitForRec->SetZ(z);
238 extrapHitForRec->SetBendingCoor(this->fBendingCoor + this->fBendingSlope * dZ);
239 // covariance, including multiple Coulomb scattering over dZ due to one chamber
240 extrapHitForRec->SetBendingReso2(this->fBendingCoorReso2 +
241 (this->fBendingSlopeReso2 + MCSfactor) * dZ * dZ); // missing non diagonal term: "2.0 * this->fBendingCoorSlopeReso2 * dZ" !!!!
242 // Data in non bending plane
244 extrapHitForRec ->SetNonBendingCoor(this->fNonBendingCoor +
245 this->fNonBendingSlope * dZ);
246 // covariance, including multiple Coulomb scattering over dZ due to one chamber
248 SetNonBendingReso2(this->fNonBendingCoorReso2 +
249 (this->fNonBendingSlopeReso2 + MCSfactor) * dZ * dZ); // missing non diagonal term: "2.0 * this->fNonBendingCoorSlopeReso2 * dZ" !!!!
250 return extrapHitForRec;
253 //__________________________________________________________________________
254 void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t /*MCSfactor*/, Double_t /*Dz1*/, Double_t /*Dz2*/, Double_t /*Dz3*/, Int_t Station, Double_t InverseMomentum)
256 // Fill data members with values calculated from the array of track parameters
257 // pointed to by "TrackParam" (index = 0 and 1 for first and second chambers
258 // of the station, respectively).
259 // Multiple Coulomb scattering is taking into account with "MCSfactor"
260 // corresponding to one chamber,
261 // with one chamber for the coordinate, two chambers for the angle,
262 // due to the arrangement in stations.
263 // Resolution coming from:
264 // coordinate in closest station at "Dz1" from current "Station",
265 // slope between closest stations, with "Dz2" interval between them,
266 // interval "Dz3" between chambers of closest station,
267 // extrapolation over "Dz1" from closest station,
268 // "InverseMomentum".
269 // When called, "fBendingCoorReso2" and "fNonBendingCoorReso2"
270 // are assumed to be filled
271 // with the variance on bending and non bending coordinates.
272 // The "road" is parametrized from the old reco_muon.F
273 // with 8 cm between stations.
274 AliMUONTrackParam *param0;
275 // Double_t cReso2, sReso2;
276 // parameters to define the widths of the searching roads in station 0,1,2
277 // width = p0 + p1/ (momentum)^2
278 // station number: 0 1 2
279 // static Double_t p0BendingCoor[3] = { 6.43e-2, 1.64e-2, 0.034 };
280 // static Double_t p1BendingCoor[3] = { 986., 821., 446. };
281 // static Double_t p0BendingSlope[3] = { 3.54e-6, 3.63e-6, 3.6e-6 };
282 // static Double_t p1BendingSlope[3] = { 4.49e-3, 4.8e-3, 0.011 };
283 // static Double_t p0NonBendingCoor[3] = { 4.66e-2, 4.83e-2, 0.049 };
284 // static Double_t p1NonBendingCoor[3] = { 1444., 866., 354. };
285 // static Double_t p0NonBendingSlope[3] = { 6.14e-4, 6.49e-4, 6.85e-4 };
286 // static Double_t p1NonBendingSlope[3] = { 0., 0., 0. };
288 static Double_t p0BendingCoor[3] = { 6.43e-2, 6.43e-2, 6.43e-2 };
289 static Double_t p1BendingCoor[3] = { 986., 986., 986. };
290 static Double_t p0BendingSlope[3] = { 3.6e-6, 3.6e-6, 3.6e-6 };
291 static Double_t p1BendingSlope[3] = { 1.1e-2, 1.1e-2, 1.1e-2 };
292 static Double_t p0NonBendingCoor[3] = { 0.049, 0.049, 0.049 };
293 static Double_t p1NonBendingCoor[3] = { 1444., 1444., 1444. };
294 static Double_t p0NonBendingSlope[3] = { 6.8e-4, 6.8e-4, 6.8e-4 };
295 static Double_t p1NonBendingSlope[3] = { 0., 0., 0. };
296 param0 = &(TrackParam[0]);
300 // fBendingCoor = param0->GetBendingCoor(); // coordinate
301 // fBendingSlope = param0->GetBendingSlope(); // slope
302 // cReso2 = fBendingCoorReso2;
303 // sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
304 // fBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
305 // fBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
306 // // Non bending plane
307 // fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
308 // fNonBendingSlope = param0->GetNonBendingSlope(); // slope
309 // cReso2 = fNonBendingCoorReso2;
310 // sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
311 // fNonBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
312 // fNonBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
314 // Coordinate and slope
316 fBendingCoor = param0->GetBendingCoor(); // coordinate
317 fBendingSlope = param0->GetBendingSlope(); // slope
319 fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
320 fNonBendingSlope = param0->GetNonBendingSlope(); // slope
322 fZ = param0->GetZ(); // z
325 // cReso2 and sReso2 have to be subtracted here from the parametrization
326 // because they are added in the functions "NormalizedChi2WithSegment"
327 // and "NormalizedChi2WithHitForRec"
329 // cReso2 = fBendingCoorReso2;
330 // sReso2 = (2. * cReso2 )/ (Dz3*Dz3) ;
331 fBendingCoorReso2 = p0BendingCoor[Station] + p1BendingCoor[Station]*InverseMomentum*InverseMomentum ; // - cReso2
332 fBendingSlopeReso2 = p0BendingSlope[Station] + p1BendingSlope[Station]*InverseMomentum*InverseMomentum; // - sReso2;
334 // cReso2 = fNonBendingCoorReso2;
335 // sReso2 = (2. * cReso2 )/ (Dz3*Dz3) ;
336 fNonBendingCoorReso2 = p0NonBendingCoor[Station] + p1NonBendingCoor[Station]*InverseMomentum*InverseMomentum; // - cReso2;
337 fNonBendingSlopeReso2 = p0NonBendingSlope[Station] + p1NonBendingSlope[Station]*InverseMomentum*InverseMomentum; // - sReso2;
341 // OLD function, with roads automatically calculated instead from being parametrized
342 // kept because it would be a better solution,
343 // if one can really find the right values.
344 // //__________________________________________________________________________
345 // void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t MCSfactor, Double_t Dz1, Double_t Dz2)
347 // // Fill data members with values calculated from the array of track parameters
348 // // pointed to by "TrackParam" (index = 0 and 1 for first and second chambers
349 // // of the station, respectively).
350 // // Multiple Coulomb scattering is taking into account with "MCSfactor"
351 // // corresponding to one chamber,
352 // // with one chamber for the coordinate, two chambers for the angle,
353 // // due to the arrangement in stations.
354 // // Resolution coming from:
355 // // coordinate in closest station at "Dz1",
356 // // slope between closest stations, with "Dz2" interval between them,
357 // // extrapolation over "Dz" from closest station.
358 // // When called, "fBendingCoorReso2" and "fNonBendingCoorReso2"
359 // // are assumed to be filled
360 // // with the variance on bending and non bending coordinates.
361 // AliMUONTrackParam *param0;
362 // Double_t cReso2, sReso2;
363 // param0 = &(TrackParam[0]);
365 // fBendingCoor = param0->GetBendingCoor(); // coordinate
366 // fBendingSlope = param0->GetBendingSlope(); // slope
367 // cReso2 = fBendingCoorReso2;
368 // sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
369 // fBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
370 // fBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
371 // // Non bending plane
372 // fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
373 // fNonBendingSlope = param0->GetNonBendingSlope(); // slope
374 // cReso2 = fNonBendingCoorReso2;
375 // sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
376 // fNonBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
377 // fNonBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;