]>
Commit | Line | Data |
---|---|---|
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 | |
d19b6003 | 18 | // ------------------------ |
19 | // Class AliMUONHitForRec | |
20 | // ------------------------ | |
a9e2aefa | 21 | // Hit for reconstruction in ALICE dimuon spectrometer |
d19b6003 | 22 | // Author: J. Gosset |
a9e2aefa | 23 | |
29fc2c86 | 24 | #include "AliTrackReference.h" |
a9e2aefa | 25 | #include "AliMUONHitForRec.h" |
a9e2aefa | 26 | #include "AliMUONRawCluster.h" |
27 | #include "AliMUONHit.h" | |
29fc2c86 | 28 | #include "AliMUONConstants.h" |
8c343c7c | 29 | #include "AliLog.h" |
a9e2aefa | 30 | |
31 | ClassImp(AliMUONHitForRec) // Class implementation in ROOT context | |
32 | ||
33 | //__________________________________________________________________________ | |
30178c30 | 34 | AliMUONHitForRec::AliMUONHitForRec() |
54d7ba50 | 35 | : TObject(), |
36 | fBendingCoor(0.), | |
37 | fNonBendingCoor(0.), | |
38 | fZ(0.), | |
39 | fBendingReso2(0.), | |
40 | fNonBendingReso2(0.), | |
41 | fChamberNumber(0), | |
42 | fDetElemId(0), | |
43 | fHitNumber(0), | |
44 | fTTRTrack(0), | |
45 | fTrackRefSignal(0), | |
46 | fIndexOfFirstSegment(0), | |
47 | fNSegments(0), | |
48 | fFirstTrackHitPtr(0x0), | |
49 | fLastTrackHitPtr(0x0), | |
50 | fNTrackHits(0) | |
30178c30 | 51 | { |
d19b6003 | 52 | /// Default Constructor |
30178c30 | 53 | |
30178c30 | 54 | } |
55 | ||
56 | //__________________________________________________________________________ | |
29fc2c86 | 57 | AliMUONHitForRec::AliMUONHitForRec(AliTrackReference* theGhit) |
54d7ba50 | 58 | : TObject(), |
59 | fBendingCoor(theGhit->Y()), | |
60 | fNonBendingCoor(theGhit->X()), | |
61 | fZ(theGhit->Z()), | |
62 | fBendingReso2(0.), | |
63 | fNonBendingReso2(0.), | |
64 | fChamberNumber(0), | |
65 | fDetElemId(0), | |
66 | fHitNumber(0), | |
67 | fTTRTrack(0), | |
68 | fTrackRefSignal(0), | |
69 | fIndexOfFirstSegment(-1), | |
70 | fNSegments(0), | |
71 | fFirstTrackHitPtr(0x0), | |
72 | fLastTrackHitPtr(0x0), | |
73 | fNTrackHits(0) | |
a9e2aefa | 74 | { |
d19b6003 | 75 | /// Constructor for AliMUONHitForRec from a track ref. hit. |
76 | /// Fills the bending, non bending, and Z coordinates, | |
77 | /// which are taken from the coordinates of the track ref. hit, | |
78 | /// the track number (track ref. and not TH), | |
79 | /// and the chamber number (0...). | |
80 | ||
30178c30 | 81 | // fTrack = theGhit->fTrack; ????????? |
30d3ea8a | 82 | fDetElemId = theGhit->UserId(); |
83 | if (fDetElemId) fChamberNumber = fDetElemId / 100 - 1; | |
84 | else fChamberNumber = AliMUONConstants::ChamberNumber(fZ); | |
a9e2aefa | 85 | // other fields will be updated in |
54d7ba50 | 86 | // AliMUONEventReconstructor::NewHitForRecFromTrackRef |
a9e2aefa | 87 | return; |
88 | } | |
89 | ||
90 | // //__________________________________________________________________________ | |
91 | // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel) | |
92 | // { | |
93 | // // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster. | |
94 | // // Fills the bending and non bending coordinates. | |
95 | // // Only the first correlation is taken into account. | |
96 | // // The bending coordinate is taken from the first cathode. | |
97 | // // The non bending coordinate is taken | |
98 | // // from the second cathode if it exists, | |
99 | // // from the first one otherwise. | |
100 | // fBendingCoor = CathCorrel->fY[3]; | |
101 | // if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0]; | |
102 | // else fNonBendingCoor = CathCorrel->fX[3]; | |
103 | // return; | |
104 | // } | |
105 | ||
106 | //__________________________________________________________________________ | |
30178c30 | 107 | AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster) |
54d7ba50 | 108 | : TObject(), |
109 | fBendingCoor(theRawCluster->GetY(0)), | |
110 | fNonBendingCoor(theRawCluster->GetX(0)), | |
111 | fZ(0.), | |
112 | fBendingReso2(0.), | |
113 | fNonBendingReso2(0.), | |
114 | fChamberNumber(0), | |
115 | fDetElemId(theRawCluster->GetDetElemId()), | |
116 | fHitNumber(0), | |
117 | fTTRTrack(-1), | |
118 | fTrackRefSignal(-1), | |
119 | fIndexOfFirstSegment(-1), | |
120 | fNSegments(0), | |
121 | fFirstTrackHitPtr(0x0), | |
122 | fLastTrackHitPtr(0x0), | |
123 | fNTrackHits(0) | |
a9e2aefa | 124 | { |
d19b6003 | 125 | /// Constructor for AliMUONHitForRec from a raw cluster. |
126 | /// Fills the bending and non bending coordinates. | |
127 | ||
a9e2aefa | 128 | // other fields will be updated in |
129 | // AliMUONEventReconstructor::AddHitsForRecFromRawClusters, | |
a9e2aefa | 130 | return; |
131 | } | |
132 | ||
30178c30 | 133 | //__________________________________________________________________________ |
b8dc484b | 134 | AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec) |
54d7ba50 | 135 | : TObject(theMUONHitForRec), |
136 | fBendingCoor(theMUONHitForRec.fBendingCoor), | |
137 | fNonBendingCoor(theMUONHitForRec.fNonBendingCoor), | |
138 | fZ(theMUONHitForRec.fZ), | |
139 | fBendingReso2(theMUONHitForRec.fBendingReso2), | |
140 | fNonBendingReso2(theMUONHitForRec.fNonBendingReso2), | |
141 | fChamberNumber(theMUONHitForRec.fChamberNumber), | |
142 | fDetElemId(theMUONHitForRec.fDetElemId), | |
143 | fHitNumber(theMUONHitForRec.fHitNumber), | |
144 | fTTRTrack(theMUONHitForRec.fTTRTrack), | |
145 | fTrackRefSignal(theMUONHitForRec.fTrackRefSignal), | |
146 | fIndexOfFirstSegment(theMUONHitForRec.fIndexOfFirstSegment), | |
147 | fNSegments(theMUONHitForRec.fNSegments), | |
148 | fFirstTrackHitPtr(theMUONHitForRec.fFirstTrackHitPtr), | |
149 | fLastTrackHitPtr(theMUONHitForRec.fLastTrackHitPtr), | |
150 | fNTrackHits(theMUONHitForRec.fNTrackHits) | |
a9e2aefa | 151 | { |
d19b6003 | 152 | /// Copy constructor |
153 | ||
a9e2aefa | 154 | } |
155 | ||
30178c30 | 156 | //__________________________________________________________________________ |
b8dc484b | 157 | AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec) |
a9e2aefa | 158 | { |
d19b6003 | 159 | /// Assignment operator |
160 | ||
b8dc484b | 161 | fBendingCoor = theMUONHitForRec.fBendingCoor; |
162 | fNonBendingCoor = theMUONHitForRec.fNonBendingCoor; | |
163 | fZ = theMUONHitForRec.fZ; | |
164 | fBendingReso2 = theMUONHitForRec.fBendingReso2; | |
165 | fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2; | |
166 | fChamberNumber = theMUONHitForRec.fChamberNumber; | |
38804330 | 167 | fDetElemId = theMUONHitForRec.fDetElemId; |
b8dc484b | 168 | fHitNumber = theMUONHitForRec.fHitNumber; |
29fc2c86 | 169 | fTTRTrack = theMUONHitForRec.fTTRTrack; |
170 | fTrackRefSignal = theMUONHitForRec.fTrackRefSignal; | |
b8dc484b | 171 | fIndexOfFirstSegment = theMUONHitForRec.fIndexOfFirstSegment; |
172 | fNSegments = theMUONHitForRec.fNSegments; | |
173 | fFirstTrackHitPtr = theMUONHitForRec.fFirstTrackHitPtr; | |
174 | fLastTrackHitPtr = theMUONHitForRec.fLastTrackHitPtr; | |
175 | fNTrackHits = theMUONHitForRec.fNTrackHits; | |
b8dc484b | 176 | return *this; |
a9e2aefa | 177 | } |
a9e2aefa | 178 | //__________________________________________________________________________ |
83dbc640 | 179 | /*AZ |
2a941f4e | 180 | Int_t AliMUONHitForRec::Compare(const TObject* Hit) const |
a9e2aefa | 181 | { |
182 | // "Compare" function to sort with increasing chamber number. | |
183 | // Returns -1 (0, +1) if ChamberNumber of current HitForRec | |
184 | // is smaller than (equal to, larger than) ChamberNumber of Hit | |
185 | if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1); | |
186 | else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0); | |
187 | else return(+1); | |
188 | } | |
83dbc640 | 189 | */ |
190 | //__________________________________________________________________________ | |
191 | Int_t AliMUONHitForRec::Compare(const TObject* Hit) const | |
192 | { | |
d19b6003 | 193 | /// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0). |
194 | /// Returns 1 (0, -1) if Z-coordinate of current HitForRec | |
195 | /// is smaller than (equal to, larger than) Z-coordinate of Hit | |
196 | ||
5b64e914 | 197 | if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1); |
83dbc640 | 198 | else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0); |
5b64e914 | 199 | else return(-1); |
83dbc640 | 200 | } |
a9e2aefa | 201 | |
202 | //__________________________________________________________________________ | |
30178c30 | 203 | Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const |
a9e2aefa | 204 | { |
d19b6003 | 205 | /// Calculate the normalized Chi2 between the current hitForRec (this) |
206 | /// and the hitForRec pointed to by "hitForRec", | |
207 | /// i.e. the square deviations between the coordinates, | |
208 | /// in both the bending and the non bending plane, | |
209 | /// divided by the variance of the same quantities and by "Sigma2Cut". | |
210 | /// Returns 3 if none of the 2 quantities is OK, | |
211 | /// something smaller than or equal to 2 otherwise. | |
212 | /// Would it be more correct to use a real chi square | |
213 | /// including the non diagonal term ???? | |
214 | ||
a9e2aefa | 215 | Double_t chi2, chi2Max, diff, normDiff; |
216 | chi2 = 0.0; | |
217 | chi2Max = 3.0; | |
218 | // coordinate in bending plane | |
30178c30 | 219 | diff = fBendingCoor - hitForRec->fBendingCoor; |
a9e2aefa | 220 | normDiff = diff * diff / |
30178c30 | 221 | (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut; |
a9e2aefa | 222 | if (normDiff > 1.0) return chi2Max; |
223 | chi2 = chi2 + normDiff; | |
224 | // coordinate in non bending plane | |
30178c30 | 225 | diff = fNonBendingCoor - hitForRec->fNonBendingCoor; |
a9e2aefa | 226 | normDiff = diff * diff / |
30178c30 | 227 | (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut; |
a9e2aefa | 228 | if (normDiff > 1.0) return chi2Max; |
229 | chi2 = chi2 + normDiff; | |
230 | return chi2; | |
231 | } |