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 Revision 1.5 2001/01/08 11:01:02 gosset
19 Modifications used for addendum to Dimuon TDR (JP Cussonneau):
20 *. MaxBendingMomentum to make both a segment and a track (default 500)
21 *. MaxChi2 per degree of freedom to make a track (default 100)
22 *. MinBendingMomentum used also to make a track
23 and not only a segment (default 3)
24 *. wider roads for track search in stations 1 to 3
25 *. extrapolation to actual Z instead of Z(chamber) in FollowTracks
27 - limits on parameters X and Y (+/-500)
28 - covariance matrices in double precision
29 - normalization of covariance matrices before inversion
30 - suppression of Minuit printouts
31 *. correction against memory leak (delete extrapHit) in FollowTracks
32 *. RMax to 10 degrees with Z(chamber) instead of fixed values;
33 RMin and Rmax cuts suppressed in NewHitForRecFromGEANT,
34 because useless with realistic geometry
36 Revision 1.4 2000/06/30 10:15:48 gosset
37 Changes to EventReconstructor...:
38 precision fit with multiple Coulomb scattering;
39 extrapolation to vertex with Branson correction in absorber (JPC)
41 Revision 1.3 2000/06/25 13:06:39 hristov
42 Inline functions moved from *.cxx to *.h files instead of forward declarations
44 Revision 1.2 2000/06/15 07:58:48 morsch
45 Code from MUON-dev joined
47 Revision 1.1.2.4 2000/06/12 10:10:21 morsch
48 Dummy copy constructor and assignment operator added
50 Revision 1.1.2.3 2000/06/09 21:01:16 morsch
51 Make includes consistent with new file structure.
53 Revision 1.1.2.2 2000/06/09 12:58:05 gosset
54 Removed comment beginnings in Log sections of .cxx files
55 Suppressed most violations of coding rules
57 Revision 1.1.2.1 2000/06/07 14:44:53 gosset
58 Addition of files for track reconstruction in C++
61 //__________________________________________________________________________
63 // Segment for reconstruction in ALICE dimuon spectrometer:
64 // two hits for reconstruction in the two chambers of one station
65 //__________________________________________________________________________
67 #include "AliMUONSegment.h"
70 #include "AliMUONHitForRec.h"
71 #include "AliMUONTrackParam.h"
72 #include "AliMUONChamber.h"
75 ClassImp(AliMUONSegment) // Class implementation in ROOT context
77 //__________________________________________________________________________
78 AliMUONSegment::AliMUONSegment(AliMUONHitForRec* Hit1, AliMUONHitForRec* Hit2)
80 // Constructor for AliMUONSegment from two HitForRec's,
81 // one, in the first chamber of the station, pointed to by "Hit1",
82 // the other one, in the second chamber of the station, pointed to by "Hit1".
83 // Fills the pointers to both hits,
84 // the slope, the covariance for (coordinate in first chamber, slope),
85 // and the impact parameter at vertex (Z=0),
86 // in bending and non bending planes.
87 // Puts the "fInTrack" flag to "kFALSE".
89 // pointers to HitForRec's
90 fHitForRecPtr1 = Hit1;
91 fHitForRecPtr2 = Hit2;
92 dz = Hit1->GetZ() - Hit2->GetZ();
94 fBendingCoor = Hit1->GetBendingCoor();
95 fBendingSlope = (fBendingCoor - Hit2->GetBendingCoor()) / dz;
96 fBendingImpact = fBendingCoor - Hit1->GetZ() * fBendingSlope;
97 fBendingCoorReso2 = Hit1->GetBendingReso2();
98 fBendingSlopeReso2 = ( Hit1->GetBendingReso2() +
99 Hit2->GetBendingReso2() ) / dz / dz;
100 fBendingCoorSlopeReso2 = Hit1->GetBendingReso2() / dz;
102 fNonBendingCoor = Hit1->GetNonBendingCoor();
103 fNonBendingSlope = (fNonBendingCoor - Hit2->GetNonBendingCoor()) / dz;
104 fNonBendingImpact = fNonBendingCoor - Hit1->GetZ() * fNonBendingSlope;
105 fNonBendingCoorReso2 = Hit1->GetNonBendingReso2();
106 fNonBendingSlopeReso2 = ( Hit1->GetNonBendingReso2() +
107 Hit2->GetNonBendingReso2() ) / dz / dz;
108 fNonBendingCoorSlopeReso2 = Hit1->GetNonBendingReso2() / dz;
109 // "fInTrack" flag to "kFALSE"
114 AliMUONSegment::AliMUONSegment (const AliMUONSegment& MUONSegment)
116 // Dummy copy constructor
119 AliMUONSegment & AliMUONSegment::operator=(const AliMUONSegment& MUONSegment)
121 // Dummy assignment operator
125 //__________________________________________________________________________
126 Int_t AliMUONSegment::Compare(const TObject* Segment) const
128 // "Compare" function to sort with increasing absolute value
129 // of the "impact parameter" in bending plane.
130 // Returns -1 (0, +1) if |impact parameter| of current Segment
131 // is smaller than (equal to, larger than) |impact parameter| of Segment
132 if (TMath::Abs(((AliMUONSegment*)this)->fBendingSlope)
133 < TMath::Abs(((AliMUONSegment*)Segment)->fBendingSlope))
135 // continuous parameter, hence no need for testing equal case
139 //__________________________________________________________________________
140 Double_t AliMUONSegment::NormalizedChi2WithSegment(AliMUONSegment* Segment, Double_t Sigma2Cut)
142 // Calculate the normalized Chi2 between the current Segment (this)
143 // and the Segment pointed to by "Segment",
144 // i.e. the square deviations between the coordinates and the slopes,
145 // in both the bending and the non bending plane,
146 // divided by the variance of the same quantities and by "Sigma2Cut".
147 // Returns 5 if none of the 4 quantities is OK,
148 // something smaller than or equal to 4 otherwise.
149 // Would it be more correct to use a real chi square
150 // including the non diagonal term ????
151 Double_t chi2, chi2Max, diff, normDiff;
154 // coordinate in bending plane
155 diff = this->fBendingCoor - Segment->fBendingCoor;
156 normDiff = diff * diff /
157 (this->fBendingCoorReso2 + Segment->fBendingCoorReso2) / Sigma2Cut;
158 if (normDiff > 1.0) return chi2Max;
159 chi2 = chi2 + normDiff;
160 // slope in bending plane
161 diff = this->fBendingSlope - Segment->fBendingSlope;
162 normDiff = diff * diff /
163 (this->fBendingSlopeReso2 + Segment->fBendingSlopeReso2) / Sigma2Cut;
164 if (normDiff > 1.0) return chi2Max;
165 chi2 = chi2 + normDiff;
166 // coordinate in non bending plane
167 diff = this->fNonBendingCoor - Segment->fNonBendingCoor;
168 normDiff = diff * diff /
169 (this->fNonBendingCoorReso2 + Segment->fNonBendingCoorReso2) / Sigma2Cut;
170 if (normDiff > 1.0) return chi2Max;
171 chi2 = chi2 + normDiff;
172 // slope in non bending plane
173 diff = this->fNonBendingSlope - Segment->fNonBendingSlope;
174 normDiff = diff * diff /
175 (this->fNonBendingSlopeReso2 + Segment->fNonBendingSlopeReso2) / Sigma2Cut;
176 if (normDiff > 1.0) return chi2Max;
177 chi2 = chi2 + normDiff;
181 //__________________________________________________________________________
182 AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation (Int_t Station, Double_t MCSfactor)
184 // Extrapolates linearly the current Segment (this) to station (0..) "Station".
185 // Multiple Coulomb scattering calculated from "MCSfactor"
186 // corresponding to one chamber,
187 // with one chamber for the coordinate, two chambers for the angle,
188 // due to the arrangement in stations.
189 // Valid from station(1..) 4 to 5 or vice versa.
190 // Returns the pointer to the created AliMUONSegment object
191 // corresponding to this extrapolation.
192 // The caller has the responsibility to delete this object.
193 AliMUONSegment* extrapSegment = new AliMUONSegment(); // creates empty new segment
194 // dZ from first hit of current Segment to first chamber of station "Station"
195 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
197 (&(pMUON->Chamber(2 * Station)))->Z() - (this->fHitForRecPtr1)->GetZ();
198 // Data in bending plane
200 extrapSegment->fBendingCoor = this->fBendingCoor + this->fBendingSlope * dZ;
202 extrapSegment->fBendingSlope = this->fBendingSlope;
203 // covariance, including multiple Coulomb scattering over dZ due to one chamber
204 extrapSegment->fBendingCoorReso2 = this->fBendingCoorReso2 +
205 (this->fBendingSlopeReso2 + MCSfactor) * dZ * dZ; // missing non diagonal term: "2.0 * this->fBendingCoorSlopeReso2 * dZ" !!!!
206 extrapSegment->fBendingSlopeReso2 = this->fBendingSlopeReso2 + 2.0 * MCSfactor;
207 extrapSegment->fBendingCoorSlopeReso2 =
208 this->fBendingCoorSlopeReso2 + this->fBendingSlopeReso2 * dZ; // missing: contribution from multiple Coulomb scattering !!!!
209 // Data in non bending plane
211 extrapSegment->fNonBendingCoor =
212 this->fNonBendingCoor + this->fNonBendingSlope * dZ;
214 extrapSegment->fNonBendingSlope = this->fNonBendingSlope;
215 // covariance, including multiple Coulomb scattering over dZ due to one chamber
216 extrapSegment->fNonBendingCoorReso2 = this->fNonBendingCoorReso2 +
217 (this->fNonBendingSlopeReso2 + MCSfactor) *dZ * dZ; // missing non diagonal term: "2.0 * this->fNonBendingCoorSlopeReso2 * dZ" !!!!
218 extrapSegment->fNonBendingSlopeReso2 =
219 this->fNonBendingSlopeReso2 + 2.0 * MCSfactor;
220 extrapSegment->fNonBendingCoorSlopeReso2 =
221 this->fNonBendingCoorSlopeReso2 + this->fNonBendingSlopeReso2 * dZ; // missing: contribution from multiple Coulomb scattering !!!!
222 return extrapSegment;
225 //__________________________________________________________________________
226 AliMUONHitForRec* AliMUONSegment::CreateHitForRecFromLinearExtrapToChamber (Int_t Chamber, Double_t MCSfactor)
228 // Extrapolates linearly the current Segment (this) to chamber(0..) "Chamber".
229 // Multiple Coulomb scattering calculated from "MCSfactor"
230 // corresponding to one chamber.
231 // Valid from station(1..) 4 to 5 or vice versa.
232 // Returns the pointer to the created AliMUONHitForRec object
233 // corresponding to this extrapolation.
234 // The caller has the responsibility to delete this object.
235 AliMUONHitForRec* extrapHitForRec = new AliMUONHitForRec(); // creates empty new HitForRec
236 // dZ from first hit of current Segment to chamber
237 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
239 (&(pMUON->Chamber(Chamber)))->Z() - (this->fHitForRecPtr1)->GetZ();
240 // Data in bending plane
242 extrapHitForRec->SetBendingCoor(this->fBendingCoor + this->fBendingSlope * dZ);
243 // covariance, including multiple Coulomb scattering over dZ due to one chamber
244 extrapHitForRec->SetBendingReso2(this->fBendingCoorReso2 +
245 (this->fBendingSlopeReso2 + MCSfactor) * dZ * dZ); // missing non diagonal term: "2.0 * this->fBendingCoorSlopeReso2 * dZ" !!!!
246 // Data in non bending plane
248 extrapHitForRec ->SetNonBendingCoor(this->fNonBendingCoor +
249 this->fNonBendingSlope * dZ);
250 // covariance, including multiple Coulomb scattering over dZ due to one chamber
252 SetNonBendingReso2(this->fNonBendingCoorReso2 +
253 (this->fNonBendingSlopeReso2 + MCSfactor) * dZ * dZ); // missing non diagonal term: "2.0 * this->fNonBendingCoorSlopeReso2 * dZ" !!!!
254 return extrapHitForRec;
257 //__________________________________________________________________________
258 void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t MCSfactor, Double_t Dz1, Double_t Dz2, Double_t Dz3, Int_t Station, Double_t InverseMomentum)
260 // Fill data members with values calculated from the array of track parameters
261 // pointed to by "TrackParam" (index = 0 and 1 for first and second chambers
262 // of the station, respectively).
263 // Multiple Coulomb scattering is taking into account with "MCSfactor"
264 // corresponding to one chamber,
265 // with one chamber for the coordinate, two chambers for the angle,
266 // due to the arrangement in stations.
267 // Resolution coming from:
268 // coordinate in closest station at "Dz1" from current "Station",
269 // slope between closest stations, with "Dz2" interval between them,
270 // interval "Dz3" between chambers of closest station,
271 // extrapolation over "Dz1" from closest station,
272 // "InverseMomentum".
273 // When called, "fBendingCoorReso2" and "fNonBendingCoorReso2"
274 // are assumed to be filled
275 // with the variance on bending and non bending coordinates.
276 // The "road" is parametrized from the old reco_muon.F
277 // with 8 cm between stations.
278 AliMUONTrackParam *param0;
279 // Double_t cReso2, sReso2;
280 // parameters to define the widths of the searching roads in station 0,1,2
281 // width = p0 + p1/ (momentum)^2
282 // station number: 0 1 2
283 // static Double_t p0BendingCoor[3] = { 6.43e-2, 1.64e-2, 0.034 };
284 // static Double_t p1BendingCoor[3] = { 986., 821., 446. };
285 // static Double_t p0BendingSlope[3] = { 3.54e-6, 3.63e-6, 3.6e-6 };
286 // static Double_t p1BendingSlope[3] = { 4.49e-3, 4.8e-3, 0.011 };
287 // static Double_t p0NonBendingCoor[3] = { 4.66e-2, 4.83e-2, 0.049 };
288 // static Double_t p1NonBendingCoor[3] = { 1444., 866., 354. };
289 // static Double_t p0NonBendingSlope[3] = { 6.14e-4, 6.49e-4, 6.85e-4 };
290 // static Double_t p1NonBendingSlope[3] = { 0., 0., 0. };
292 static Double_t p0BendingCoor[3] = { 6.43e-2, 6.43e-2, 6.43e-2 };
293 static Double_t p1BendingCoor[3] = { 986., 986., 986. };
294 static Double_t p0BendingSlope[3] = { 3.6e-6, 3.6e-6, 3.6e-6 };
295 static Double_t p1BendingSlope[3] = { 1.1e-2, 1.1e-2, 1.1e-2 };
296 static Double_t p0NonBendingCoor[3] = { 0.049, 0.049, 0.049 };
297 static Double_t p1NonBendingCoor[3] = { 1444., 1444., 1444. };
298 static Double_t p0NonBendingSlope[3] = { 6.8e-4, 6.8e-4, 6.8e-4 };
299 static Double_t p1NonBendingSlope[3] = { 0., 0., 0. };
300 param0 = &(TrackParam[0]);
304 // fBendingCoor = param0->GetBendingCoor(); // coordinate
305 // fBendingSlope = param0->GetBendingSlope(); // slope
306 // cReso2 = fBendingCoorReso2;
307 // sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
308 // fBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
309 // fBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
310 // // Non bending plane
311 // fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
312 // fNonBendingSlope = param0->GetNonBendingSlope(); // slope
313 // cReso2 = fNonBendingCoorReso2;
314 // sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
315 // fNonBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
316 // fNonBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
318 // Coordinate and slope
320 fBendingCoor = param0->GetBendingCoor(); // coordinate
321 fBendingSlope = param0->GetBendingSlope(); // slope
323 fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
324 fNonBendingSlope = param0->GetNonBendingSlope(); // slope
327 // cReso2 and sReso2 have to be subtracted here from the parametrization
328 // because they are added in the functions "NormalizedChi2WithSegment"
329 // and "NormalizedChi2WithHitForRec"
331 // cReso2 = fBendingCoorReso2;
332 // sReso2 = (2. * cReso2 )/ (Dz3*Dz3) ;
333 fBendingCoorReso2 = p0BendingCoor[Station] + p1BendingCoor[Station]*InverseMomentum*InverseMomentum ; // - cReso2
334 fBendingSlopeReso2 = p0BendingSlope[Station] + p1BendingSlope[Station]*InverseMomentum*InverseMomentum; // - sReso2;
336 // cReso2 = fNonBendingCoorReso2;
337 // sReso2 = (2. * cReso2 )/ (Dz3*Dz3) ;
338 fNonBendingCoorReso2 = p0NonBendingCoor[Station] + p1NonBendingCoor[Station]*InverseMomentum*InverseMomentum; // - cReso2;
339 fNonBendingSlopeReso2 = p0NonBendingSlope[Station] + p1NonBendingSlope[Station]*InverseMomentum*InverseMomentum; // - sReso2;
343 // OLD function, with roads automatically calculated instead from being parametrized
344 // kept because it would be a better solution,
345 // if one can really find the right values.
346 // //__________________________________________________________________________
347 // void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t MCSfactor, Double_t Dz1, Double_t Dz2)
349 // // Fill data members with values calculated from the array of track parameters
350 // // pointed to by "TrackParam" (index = 0 and 1 for first and second chambers
351 // // of the station, respectively).
352 // // Multiple Coulomb scattering is taking into account with "MCSfactor"
353 // // corresponding to one chamber,
354 // // with one chamber for the coordinate, two chambers for the angle,
355 // // due to the arrangement in stations.
356 // // Resolution coming from:
357 // // coordinate in closest station at "Dz1",
358 // // slope between closest stations, with "Dz2" interval between them,
359 // // extrapolation over "Dz" from closest station.
360 // // When called, "fBendingCoorReso2" and "fNonBendingCoorReso2"
361 // // are assumed to be filled
362 // // with the variance on bending and non bending coordinates.
363 // AliMUONTrackParam *param0;
364 // Double_t cReso2, sReso2;
365 // param0 = &(TrackParam[0]);
367 // fBendingCoor = param0->GetBendingCoor(); // coordinate
368 // fBendingSlope = param0->GetBendingSlope(); // slope
369 // cReso2 = fBendingCoorReso2;
370 // sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
371 // fBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
372 // fBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
373 // // Non bending plane
374 // fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
375 // fNonBendingSlope = param0->GetNonBendingSlope(); // slope
376 // cReso2 = fNonBendingCoorReso2;
377 // sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
378 // fNonBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
379 // fNonBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;