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.2 2000/06/15 07:58:48 morsch
19 Code from MUON-dev joined
21 Revision 1.1.2.4 2000/06/12 10:10:21 morsch
22 Dummy copy constructor and assignment operator added
24 Revision 1.1.2.3 2000/06/09 21:01:16 morsch
25 Make includes consistent with new file structure.
27 Revision 1.1.2.2 2000/06/09 12:58:05 gosset
28 Removed comment beginnings in Log sections of .cxx files
29 Suppressed most violations of coding rules
31 Revision 1.1.2.1 2000/06/07 14:44:53 gosset
32 Addition of files for track reconstruction in C++
35 //__________________________________________________________________________
37 // Segment for reconstruction in ALICE dimuon spectrometer:
38 // two hits for reconstruction in the two chambers of one station
39 //__________________________________________________________________________
41 #include "AliMUONSegment.h"
44 #include "AliMUONHitForRec.h"
45 #include "AliMUONTrackParam.h"
46 #include "AliMUONChamber.h"
49 ClassImp(AliMUONSegment) // Class implementation in ROOT context
51 //__________________________________________________________________________
52 AliMUONSegment::AliMUONSegment(AliMUONHitForRec* Hit1, AliMUONHitForRec* Hit2)
54 // Constructor for AliMUONSegment from two HitForRec's,
55 // one, in the first chamber of the station, pointed to by "Hit1",
56 // the other one, in the second chamber of the station, pointed to by "Hit1".
57 // Fills the pointers to both hits,
58 // the slope, the covariance for (coordinate in first chamber, slope),
59 // and the impact parameter at vertex (Z=0),
60 // in bending and non bending planes.
61 // Puts the "fInTrack" flag to "kFALSE".
63 // pointers to HitForRec's
64 fHitForRecPtr1 = Hit1;
65 fHitForRecPtr2 = Hit2;
66 dz = Hit1->GetZ() - Hit2->GetZ();
68 fBendingCoor = Hit1->GetBendingCoor();
69 fBendingSlope = (fBendingCoor - Hit2->GetBendingCoor()) / dz;
70 fBendingImpact = fBendingCoor - Hit1->GetZ() * fBendingSlope;
71 fBendingCoorReso2 = Hit1->GetBendingReso2();
72 fBendingSlopeReso2 = ( Hit1->GetBendingReso2() +
73 Hit2->GetBendingReso2() ) / dz / dz;
74 fBendingCoorSlopeReso2 = Hit1->GetBendingReso2() / dz;
76 fNonBendingCoor = Hit1->GetNonBendingCoor();
77 fNonBendingSlope = (fNonBendingCoor - Hit2->GetNonBendingCoor()) / dz;
78 fNonBendingImpact = fNonBendingCoor - Hit1->GetZ() * fNonBendingSlope;
79 fNonBendingCoorReso2 = Hit1->GetNonBendingReso2();
80 fNonBendingSlopeReso2 = ( Hit1->GetNonBendingReso2() +
81 Hit2->GetNonBendingReso2() ) / dz / dz;
82 fNonBendingCoorSlopeReso2 = Hit1->GetNonBendingReso2() / dz;
83 // "fInTrack" flag to "kFALSE"
88 AliMUONSegment::AliMUONSegment (const AliMUONSegment& MUONSegment)
90 // Dummy copy constructor
93 AliMUONSegment & AliMUONSegment::operator=(const AliMUONSegment& MUONSegment)
95 // Dummy assignment operator
99 //__________________________________________________________________________
100 Int_t AliMUONSegment::Compare(TObject* Segment)
102 // "Compare" function to sort with increasing absolute value
103 // of the "impact parameter" in bending plane.
104 // Returns -1 (0, +1) if |impact parameter| of current Segment
105 // is smaller than (equal to, larger than) |impact parameter| of Segment
106 if (TMath::Abs(((AliMUONSegment*)this)->fBendingSlope)
107 < TMath::Abs(((AliMUONSegment*)Segment)->fBendingSlope))
109 // continuous parameter, hence no need for testing equal case
113 //__________________________________________________________________________
114 Double_t AliMUONSegment::NormalizedChi2WithSegment(AliMUONSegment* Segment, Double_t Sigma2Cut)
116 // Calculate the normalized Chi2 between the current Segment (this)
117 // and the Segment pointed to by "Segment",
118 // i.e. the square deviations between the coordinates and the slopes,
119 // in both the bending and the non bending plane,
120 // divided by the variance of the same quantities and by "Sigma2Cut".
121 // Returns 5 if none of the 4 quantities is OK,
122 // something smaller than or equal to 4 otherwise.
123 // Would it be more correct to use a real chi square
124 // including the non diagonal term ????
125 Double_t chi2, chi2Max, diff, normDiff;
128 // coordinate in bending plane
129 diff = this->fBendingCoor - Segment->fBendingCoor;
130 normDiff = diff * diff /
131 (this->fBendingCoorReso2 + Segment->fBendingCoorReso2) / Sigma2Cut;
132 if (normDiff > 1.0) return chi2Max;
133 chi2 = chi2 + normDiff;
134 // slope in bending plane
135 diff = this->fBendingSlope - Segment->fBendingSlope;
136 normDiff = diff * diff /
137 (this->fBendingSlopeReso2 + Segment->fBendingSlopeReso2) / Sigma2Cut;
138 if (normDiff > 1.0) return chi2Max;
139 chi2 = chi2 + normDiff;
140 // coordinate in non bending plane
141 diff = this->fNonBendingCoor - Segment->fNonBendingCoor;
142 normDiff = diff * diff /
143 (this->fNonBendingCoorReso2 + Segment->fNonBendingCoorReso2) / Sigma2Cut;
144 if (normDiff > 1.0) return chi2Max;
145 chi2 = chi2 + normDiff;
146 // slope in non bending plane
147 diff = this->fNonBendingSlope - Segment->fNonBendingSlope;
148 normDiff = diff * diff /
149 (this->fNonBendingSlopeReso2 + Segment->fNonBendingSlopeReso2) / Sigma2Cut;
150 if (normDiff > 1.0) return chi2Max;
151 chi2 = chi2 + normDiff;
155 //__________________________________________________________________________
156 AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation (Int_t Station, Double_t MCSfactor)
158 // Extrapolates linearly the current Segment (this) to station (0..) "Station".
159 // Multiple Coulomb scattering calculated from "MCSfactor"
160 // corresponding to one chamber,
161 // with one chamber for the coordinate, two chambers for the angle,
162 // due to the arrangement in stations.
163 // Valid from station(1..) 4 to 5 or vice versa.
164 // Returns the pointer to the created AliMUONSegment object
165 // corresponding to this extrapolation.
166 // The caller has the responsibility to delete this object.
167 AliMUONSegment* extrapSegment = new AliMUONSegment(); // creates empty new segment
168 // dZ from first hit of current Segment to first chamber of station "Station"
169 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
171 (&(pMUON->Chamber(2 * Station)))->Z() - (this->fHitForRecPtr1)->GetZ();
172 // Data in bending plane
174 extrapSegment->fBendingCoor = this->fBendingCoor + this->fBendingSlope * dZ;
176 extrapSegment->fBendingSlope = this->fBendingSlope;
177 // covariance, including multiple Coulomb scattering over dZ due to one chamber
178 extrapSegment->fBendingCoorReso2 = this->fBendingCoorReso2 +
179 (this->fBendingSlopeReso2 + MCSfactor) * dZ * dZ; // missing non diagonal term: "2.0 * this->fBendingCoorSlopeReso2 * dZ" !!!!
180 extrapSegment->fBendingSlopeReso2 = this->fBendingSlopeReso2 + 2.0 * MCSfactor;
181 extrapSegment->fBendingCoorSlopeReso2 =
182 this->fBendingCoorSlopeReso2 + this->fBendingSlopeReso2 * dZ; // missing: contribution from multiple Coulomb scattering !!!!
183 // Data in non bending plane
185 extrapSegment->fNonBendingCoor =
186 this->fNonBendingCoor + this->fNonBendingSlope * dZ;
188 extrapSegment->fNonBendingSlope = this->fNonBendingSlope;
189 // covariance, including multiple Coulomb scattering over dZ due to one chamber
190 extrapSegment->fNonBendingCoorReso2 = this->fNonBendingCoorReso2 +
191 (this->fNonBendingSlopeReso2 + MCSfactor) *dZ * dZ; // missing non diagonal term: "2.0 * this->fNonBendingCoorSlopeReso2 * dZ" !!!!
192 extrapSegment->fNonBendingSlopeReso2 =
193 this->fNonBendingSlopeReso2 + 2.0 * MCSfactor;
194 extrapSegment->fNonBendingCoorSlopeReso2 =
195 this->fNonBendingCoorSlopeReso2 + this->fNonBendingSlopeReso2 * dZ; // missing: contribution from multiple Coulomb scattering !!!!
196 return extrapSegment;
199 //__________________________________________________________________________
200 AliMUONHitForRec* AliMUONSegment::CreateHitForRecFromLinearExtrapToChamber (Int_t Chamber, Double_t MCSfactor)
202 // Extrapolates linearly the current Segment (this) to chamber(0..) "Chamber".
203 // Multiple Coulomb scattering calculated from "MCSfactor"
204 // corresponding to one chamber.
205 // Valid from station(1..) 4 to 5 or vice versa.
206 // Returns the pointer to the created AliMUONHitForRec object
207 // corresponding to this extrapolation.
208 // The caller has the responsibility to delete this object.
209 AliMUONHitForRec* extrapHitForRec = new AliMUONHitForRec(); // creates empty new HitForRec
210 // dZ from first hit of current Segment to chamber
211 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
213 (&(pMUON->Chamber(Chamber)))->Z() - (this->fHitForRecPtr1)->GetZ();
214 // Data in bending plane
216 extrapHitForRec->SetBendingCoor(this->fBendingCoor + this->fBendingSlope * dZ);
217 // covariance, including multiple Coulomb scattering over dZ due to one chamber
218 extrapHitForRec->SetBendingReso2(this->fBendingCoorReso2 +
219 (this->fBendingSlopeReso2 + MCSfactor) * dZ * dZ); // missing non diagonal term: "2.0 * this->fBendingCoorSlopeReso2 * dZ" !!!!
220 // Data in non bending plane
222 extrapHitForRec ->SetNonBendingCoor(this->fNonBendingCoor +
223 this->fNonBendingSlope * dZ);
224 // covariance, including multiple Coulomb scattering over dZ due to one chamber
226 SetNonBendingReso2(this->fNonBendingCoorReso2 +
227 (this->fNonBendingSlopeReso2 + MCSfactor) * dZ * dZ); // missing non diagonal term: "2.0 * this->fNonBendingCoorSlopeReso2 * dZ" !!!!
228 return extrapHitForRec;
231 //__________________________________________________________________________
232 void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t MCSfactor, Double_t Dz1, Double_t Dz2)
234 // Fill data members with values calculated from the array of track parameters
235 // pointed to by "TrackParam" (index = 0 and 1 for first and second chambers
236 // of the station, respectively).
237 // Multiple Coulomb scattering is taking into account with "MCSfactor"
238 // corresponding to one chamber,
239 // with one chamber for the coordinate, two chambers for the angle,
240 // due to the arrangement in stations.
241 // Resolution coming from:
242 // coordinate in closest station at "Dz1",
243 // slope between closest stations, with "Dz2" interval between them,
244 // extrapolation over "Dz" from closest station.
245 // When called, "fBendingCoorReso2" and "fNonBendingCoorReso2"
246 // are assumed to be filled
247 // with the variance on bending and non bending coordinates.
248 AliMUONTrackParam *param0;
249 Double_t cReso2, sReso2;
250 param0 = &(TrackParam[0]);
252 fBendingCoor = param0->GetBendingCoor(); // coordinate
253 fBendingSlope = param0->GetBendingSlope(); // slope
254 cReso2 = fBendingCoorReso2;
255 sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
256 fBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
257 fBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;
259 fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
260 fNonBendingSlope = param0->GetNonBendingSlope(); // slope
261 cReso2 = fNonBendingCoorReso2;
262 sReso2 = 2.0 * cReso2 / Dz2 / Dz2;
263 fNonBendingCoorReso2 = cReso2 + (sReso2 + MCSfactor) * Dz1 * Dz1;
264 fNonBendingSlopeReso2 = sReso2 + 2.0 * MCSfactor;