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