]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegment.cxx
Logging of Debug, Info and Error Messages follwing AliRoot Standard http://aliweb...
[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
88cb7938 16/* $Id$ */
a9e2aefa 17
3831f268 18///////////////////////////////////////////////////////////
a9e2aefa 19//
3831f268 20// Segment for reconstruction
21// in
22// ALICE
23// dimuon
24// spectrometer:
a9e2aefa 25// two hits for reconstruction in the two chambers of one station
3831f268 26//
27///////////////////////////////////////////////////////////
a9e2aefa 28
30178c30 29#include "AliMUONSegment.h"
a9e2aefa 30#include "AliMUON.h"
3831f268 31#include "AliMUONChamber.h"
a9e2aefa 32#include "AliMUONHitForRec.h"
33#include "AliMUONTrackParam.h"
3831f268 34#include "AliRun.h" // for gAlice
d12a7158 35#include "AliLog.h"
a9e2aefa 36
37ClassImp(AliMUONSegment) // Class implementation in ROOT context
38
762647ff 39 //__________________________________________________________________________
40AliMUONSegment::AliMUONSegment()
30178c30 41 : TObject()
762647ff 42{
43 // Default constructor
44 fHitForRecPtr1 = 0; // pointer to HitForRec in first chamber
45 fHitForRecPtr2 = 0; // pointer to HitForRec in second chamber
46 // Bending plane:
47 fBendingCoor = 0.0; // Coordinate in bending plane
48 fBendingSlope = 0.0; // Slope in bending plane
49 // Covariance in bending plane:
50 fBendingCoorReso2 = 0.0; // Covariance(coordinate C1 in first chamber)
51 fBendingSlopeReso2 = 0.0; // Covariance(slope)
52 fBendingCoorSlopeReso2 = 0.0; // Covariance(C1,slope)
53 fBendingImpact = 0.0; // Impact parameter in bending plane
54 // Non Bending plane:
55 fNonBendingCoor = 0.0; // Coordinate in non bending plane
56 fNonBendingSlope = 0.0; // Slope in non bending plane
57 // Covariance in non bending plane:
58 fNonBendingCoorReso2 = 0.0; // Covariance(coordinate C1 in first chamber)
59 fNonBendingSlopeReso2 = 0.0; // Covariance(slope)
60 fNonBendingCoorSlopeReso2 = 0.0; // Covariance(C1,slope)
61 fNonBendingImpact = 0.0; // Impact parameter in non bending plane
62 fInTrack = kFALSE; // TRUE if segment belongs to one track
63}
64
a9e2aefa 65 //__________________________________________________________________________
66AliMUONSegment::AliMUONSegment(AliMUONHitForRec* Hit1, AliMUONHitForRec* Hit2)
30178c30 67 : TObject()
a9e2aefa 68{
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".
77 Double_t dz;
78 // pointers to HitForRec's
79 fHitForRecPtr1 = Hit1;
80 fHitForRecPtr2 = Hit2;
81 dz = Hit1->GetZ() - Hit2->GetZ();
82 // bending plane
83 fBendingCoor = Hit1->GetBendingCoor();
84 fBendingSlope = (fBendingCoor - Hit2->GetBendingCoor()) / dz;
85 fBendingImpact = fBendingCoor - Hit1->GetZ() * fBendingSlope;
86 fBendingCoorReso2 = Hit1->GetBendingReso2();
87 fBendingSlopeReso2 = ( Hit1->GetBendingReso2() +
88 Hit2->GetBendingReso2() ) / dz / dz;
89 fBendingCoorSlopeReso2 = Hit1->GetBendingReso2() / dz;
90 // non bending plane
91 fNonBendingCoor = Hit1->GetNonBendingCoor();
92 fNonBendingSlope = (fNonBendingCoor - Hit2->GetNonBendingCoor()) / dz;
93 fNonBendingImpact = fNonBendingCoor - Hit1->GetZ() * fNonBendingSlope;
94 fNonBendingCoorReso2 = Hit1->GetNonBendingReso2();
95 fNonBendingSlopeReso2 = ( Hit1->GetNonBendingReso2() +
96 Hit2->GetNonBendingReso2() ) / dz / dz;
97 fNonBendingCoorSlopeReso2 = Hit1->GetNonBendingReso2() / dz;
98 // "fInTrack" flag to "kFALSE"
99 fInTrack = kFALSE;
100 return;
101}
102
30178c30 103AliMUONSegment::AliMUONSegment (const AliMUONSegment& theMUONSegment)
104 : TObject(theMUONSegment)
a9e2aefa 105{
30178c30 106// Protected copy constructor
107
d12a7158 108 AliFatal("Not implemented.");
a9e2aefa 109}
110
30178c30 111AliMUONSegment & AliMUONSegment::operator=(const AliMUONSegment& rhs)
a9e2aefa 112{
30178c30 113// Protected assignement operator
114
115 if (this == &rhs) return *this;
116
d12a7158 117 AliFatal("Not implemented.");
30178c30 118
119 return *this;
a9e2aefa 120}
121
a9e2aefa 122 //__________________________________________________________________________
2a941f4e 123Int_t AliMUONSegment::Compare(const TObject* Segment) const
a9e2aefa 124{
125 // "Compare" function to sort with increasing absolute value
126 // of the "impact parameter" in bending plane.
127 // Returns -1 (0, +1) if |impact parameter| of current Segment
128 // is smaller than (equal to, larger than) |impact parameter| of Segment
31817925 129 if (TMath::Abs(((AliMUONSegment*)this)->fBendingImpact)
130 < TMath::Abs(((AliMUONSegment*)Segment)->fBendingImpact))
a9e2aefa 131 return(-1);
132 // continuous parameter, hence no need for testing equal case
133 else return(+1);
134}
135
136 //__________________________________________________________________________
30178c30 137Double_t AliMUONSegment::NormalizedChi2WithSegment(AliMUONSegment* Segment, Double_t Sigma2Cut) const
a9e2aefa 138{
139 // Calculate the normalized Chi2 between the current Segment (this)
140 // and the Segment pointed to by "Segment",
141 // i.e. the square deviations between the coordinates and the slopes,
142 // in both the bending and the non bending plane,
143 // divided by the variance of the same quantities and by "Sigma2Cut".
144 // Returns 5 if none of the 4 quantities is OK,
145 // something smaller than or equal to 4 otherwise.
146 // Would it be more correct to use a real chi square
147 // including the non diagonal term ????
148 Double_t chi2, chi2Max, diff, normDiff;
149 chi2 = 0.0;
150 chi2Max = 5.0;
151 // coordinate in bending plane
152 diff = this->fBendingCoor - Segment->fBendingCoor;
153 normDiff = diff * diff /
154 (this->fBendingCoorReso2 + Segment->fBendingCoorReso2) / Sigma2Cut;
155 if (normDiff > 1.0) return chi2Max;
156 chi2 = chi2 + normDiff;
157 // slope in bending plane
158 diff = this->fBendingSlope - Segment->fBendingSlope;
159 normDiff = diff * diff /
160 (this->fBendingSlopeReso2 + Segment->fBendingSlopeReso2) / Sigma2Cut;
161 if (normDiff > 1.0) return chi2Max;
162 chi2 = chi2 + normDiff;
163 // coordinate in non bending plane
164 diff = this->fNonBendingCoor - Segment->fNonBendingCoor;
165 normDiff = diff * diff /
166 (this->fNonBendingCoorReso2 + Segment->fNonBendingCoorReso2) / Sigma2Cut;
167 if (normDiff > 1.0) return chi2Max;
168 chi2 = chi2 + normDiff;
169 // slope in non bending plane
170 diff = this->fNonBendingSlope - Segment->fNonBendingSlope;
171 normDiff = diff * diff /
172 (this->fNonBendingSlopeReso2 + Segment->fNonBendingSlopeReso2) / Sigma2Cut;
173 if (normDiff > 1.0) return chi2Max;
174 chi2 = chi2 + normDiff;
175 return chi2;
176}
177
178 //__________________________________________________________________________
d12a7158 179AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation (Int_t Station, Double_t MCSfactor) const
a9e2aefa 180{
181 // Extrapolates linearly the current Segment (this) to station (0..) "Station".
182 // Multiple Coulomb scattering calculated from "MCSfactor"
183 // corresponding to one chamber,
184 // with one chamber for the coordinate, two chambers for the angle,
185 // due to the arrangement in stations.
186 // Valid from station(1..) 4 to 5 or vice versa.
187 // Returns the pointer to the created AliMUONSegment object
188 // corresponding to this extrapolation.
189 // The caller has the responsibility to delete this object.
190 AliMUONSegment* extrapSegment = new AliMUONSegment(); // creates empty new segment
191 // dZ from first hit of current Segment to first chamber of station "Station"
d12a7158 192 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
193 Double_t dZ =
194 (&(pMUON->Chamber(2 * Station)))->Z() - (this->fHitForRecPtr1)->GetZ();
a9e2aefa 195 // Data in bending plane
196 // coordinate
197 extrapSegment->fBendingCoor = this->fBendingCoor + this->fBendingSlope * dZ;
198 // slope
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
207 // coordinate
208 extrapSegment->fNonBendingCoor =
209 this->fNonBendingCoor + this->fNonBendingSlope * dZ;
210 // slope
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;
220}
221
222 //__________________________________________________________________________
d12a7158 223AliMUONHitForRec* AliMUONSegment::CreateHitForRecFromLinearExtrapToChamber (Int_t Chamber, Double_t MCSfactor) const
a9e2aefa 224{
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
d12a7158 234 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
235 Double_t dZ =
236 (&(pMUON->Chamber(Chamber)))->Z() - (this->fHitForRecPtr1)->GetZ();
a9e2aefa 237 // Data in bending plane
238 // coordinate
239 extrapHitForRec->SetBendingCoor(this->fBendingCoor + this->fBendingSlope * dZ);
240 // covariance, including multiple Coulomb scattering over dZ due to one chamber
241 extrapHitForRec->SetBendingReso2(this->fBendingCoorReso2 +
242 (this->fBendingSlopeReso2 + MCSfactor) * dZ * dZ); // missing non diagonal term: "2.0 * this->fBendingCoorSlopeReso2 * dZ" !!!!
243 // Data in non bending plane
244 // coordinate
245 extrapHitForRec ->SetNonBendingCoor(this->fNonBendingCoor +
246 this->fNonBendingSlope * dZ);
247 // covariance, including multiple Coulomb scattering over dZ due to one chamber
248 extrapHitForRec->
249 SetNonBendingReso2(this->fNonBendingCoorReso2 +
250 (this->fNonBendingSlopeReso2 + MCSfactor) * dZ * dZ); // missing non diagonal term: "2.0 * this->fNonBendingCoorSlopeReso2 * dZ" !!!!
251 return extrapHitForRec;
252}
253
254 //__________________________________________________________________________
d9a3473d 255void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t /*MCSfactor*/, Double_t /*Dz1*/, Double_t /*Dz2*/, Double_t /*Dz3*/, Int_t Station, Double_t InverseMomentum)
a9e2aefa 256{
257 // Fill data members with values calculated from the array of track parameters
258 // pointed to by "TrackParam" (index = 0 and 1 for first and second chambers
259 // of the station, respectively).
260 // Multiple Coulomb scattering is taking into account with "MCSfactor"
261 // corresponding to one chamber,
262 // with one chamber for the coordinate, two chambers for the angle,
263 // due to the arrangement in stations.
264 // Resolution coming from:
04b5ea16 265 // coordinate in closest station at "Dz1" from current "Station",
a9e2aefa 266 // slope between closest stations, with "Dz2" interval between them,
04b5ea16 267 // interval "Dz3" between chambers of closest station,
268 // extrapolation over "Dz1" from closest station,
269 // "InverseMomentum".
a9e2aefa 270 // When called, "fBendingCoorReso2" and "fNonBendingCoorReso2"
271 // are assumed to be filled
272 // with the variance on bending and non bending coordinates.
04b5ea16 273 // The "road" is parametrized from the old reco_muon.F
274 // with 8 cm between stations.
a9e2aefa 275 AliMUONTrackParam *param0;
d0bfce8d 276// Double_t cReso2, sReso2;
04b5ea16 277 // parameters to define the widths of the searching roads in station 0,1,2
278 // width = p0 + p1/ (momentum)^2
279 // station number: 0 1 2
d0bfce8d 280// static Double_t p0BendingCoor[3] = { 6.43e-2, 1.64e-2, 0.034 };
281// static Double_t p1BendingCoor[3] = { 986., 821., 446. };
282// static Double_t p0BendingSlope[3] = { 3.54e-6, 3.63e-6, 3.6e-6 };
283// static Double_t p1BendingSlope[3] = { 4.49e-3, 4.8e-3, 0.011 };
284// static Double_t p0NonBendingCoor[3] = { 4.66e-2, 4.83e-2, 0.049 };
285// static Double_t p1NonBendingCoor[3] = { 1444., 866., 354. };
286// static Double_t p0NonBendingSlope[3] = { 6.14e-4, 6.49e-4, 6.85e-4 };
287// static Double_t p1NonBendingSlope[3] = { 0., 0., 0. };
288
289 static Double_t p0BendingCoor[3] = { 6.43e-2, 6.43e-2, 6.43e-2 };
290 static Double_t p1BendingCoor[3] = { 986., 986., 986. };
291 static Double_t p0BendingSlope[3] = { 3.6e-6, 3.6e-6, 3.6e-6 };
292 static Double_t p1BendingSlope[3] = { 1.1e-2, 1.1e-2, 1.1e-2 };
293 static Double_t p0NonBendingCoor[3] = { 0.049, 0.049, 0.049 };
294 static Double_t p1NonBendingCoor[3] = { 1444., 1444., 1444. };
295 static Double_t p0NonBendingSlope[3] = { 6.8e-4, 6.8e-4, 6.8e-4 };
296 static Double_t p1NonBendingSlope[3] = { 0., 0., 0. };
a9e2aefa 297 param0 = &(TrackParam[0]);
04b5ea16 298
299// OLD version
300// // Bending plane
301// fBendingCoor = param0->GetBendingCoor(); // coordinate
302// fBendingSlope = param0->GetBendingSlope(); // slope
303// cReso2 = fBendingCoorReso2;
304// sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
305// fBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
306// fBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
307// // Non bending plane
308// fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
309// fNonBendingSlope = param0->GetNonBendingSlope(); // slope
310// cReso2 = fNonBendingCoorReso2;
311// sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
312// fNonBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
313// fNonBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
314
315 // Coordinate and slope
a9e2aefa 316 // Bending plane
317 fBendingCoor = param0->GetBendingCoor(); // coordinate
318 fBendingSlope = param0->GetBendingSlope(); // slope
a9e2aefa 319 // Non bending plane
320 fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
321 fNonBendingSlope = param0->GetNonBendingSlope(); // slope
04b5ea16 322
323 // Resolutions
324 // cReso2 and sReso2 have to be subtracted here from the parametrization
325 // because they are added in the functions "NormalizedChi2WithSegment"
326 // and "NormalizedChi2WithHitForRec"
327 // Bending plane
d0bfce8d 328// cReso2 = fBendingCoorReso2;
329// sReso2 = (2. * cReso2 )/ (Dz3*Dz3) ;
330 fBendingCoorReso2 = p0BendingCoor[Station] + p1BendingCoor[Station]*InverseMomentum*InverseMomentum ; // - cReso2
331 fBendingSlopeReso2 = p0BendingSlope[Station] + p1BendingSlope[Station]*InverseMomentum*InverseMomentum; // - sReso2;
04b5ea16 332 // Non bending plane
d0bfce8d 333// cReso2 = fNonBendingCoorReso2;
334// sReso2 = (2. * cReso2 )/ (Dz3*Dz3) ;
335 fNonBendingCoorReso2 = p0NonBendingCoor[Station] + p1NonBendingCoor[Station]*InverseMomentum*InverseMomentum; // - cReso2;
336 fNonBendingSlopeReso2 = p0NonBendingSlope[Station] + p1NonBendingSlope[Station]*InverseMomentum*InverseMomentum; // - sReso2;
a9e2aefa 337 return;
338}
04b5ea16 339
340// OLD function, with roads automatically calculated instead from being parametrized
341// kept because it would be a better solution,
342// if one can really find the right values.
343// //__________________________________________________________________________
344// void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t MCSfactor, Double_t Dz1, Double_t Dz2)
345// {
346// // Fill data members with values calculated from the array of track parameters
347// // pointed to by "TrackParam" (index = 0 and 1 for first and second chambers
348// // of the station, respectively).
349// // Multiple Coulomb scattering is taking into account with "MCSfactor"
350// // corresponding to one chamber,
351// // with one chamber for the coordinate, two chambers for the angle,
352// // due to the arrangement in stations.
353// // Resolution coming from:
354// // coordinate in closest station at "Dz1",
355// // slope between closest stations, with "Dz2" interval between them,
356// // extrapolation over "Dz" from closest station.
357// // When called, "fBendingCoorReso2" and "fNonBendingCoorReso2"
358// // are assumed to be filled
359// // with the variance on bending and non bending coordinates.
360// AliMUONTrackParam *param0;
361// Double_t cReso2, sReso2;
362// param0 = &(TrackParam[0]);
363// // Bending plane
364// fBendingCoor = param0->GetBendingCoor(); // coordinate
365// fBendingSlope = param0->GetBendingSlope(); // slope
366// cReso2 = fBendingCoorReso2;
367// sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
368// fBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
369// fBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
370// // Non bending plane
371// fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
372// fNonBendingSlope = param0->GetNonBendingSlope(); // slope
373// cReso2 = fNonBendingCoorReso2;
374// sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
375// fNonBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
376// fNonBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
377// return;
378// }