]>
Commit | Line | Data |
---|---|---|
853a0f19 | 1 | // AliITSneuralPoint |
2 | // | |
3 | // A class which resumes the information of ITS clusters | |
4 | // in the global reference frame. | |
5 | // Author: A. Pulvirenti | |
6 | ||
7 | //#include <stdlib.h> | |
8 | //#include <Riostream.h> | |
b9d722bc | 9 | |
10 | #include <TString.h> | |
11 | ||
12 | #include "AliITSRecPoint.h" | |
13 | #include "AliITSclusterV2.h" | |
14 | #include "AliITSgeom.h" | |
15 | #include "AliITSgeomMatrix.h" | |
16 | ||
17 | #include "AliITSNeuralPoint.h" | |
18 | ||
19 | ||
20 | ClassImp(AliITSNeuralPoint) | |
21 | // | |
22 | //------------------------------------------------------------------------------------------------------ | |
23 | // | |
24 | AliITSNeuralPoint::AliITSNeuralPoint() | |
25 | { | |
26 | // Default constructor. | |
27 | // Defines the point as a noise point in the origin. | |
28 | ||
29 | fX = fY = fZ = 0.; | |
30 | fEX = fEY = fEZ = 0.; | |
31 | fLayer = 0; | |
32 | fLabel[0] = fLabel[1] = fLabel[2] = -1; | |
33 | fModule = 0; | |
34 | fIndex = 0; | |
35 | fUser = 0; | |
36 | } | |
37 | // | |
38 | //------------------------------------------------------------------------------------------------------ | |
39 | // | |
40 | AliITSNeuralPoint::AliITSNeuralPoint(AliITSNeuralPoint *p) : | |
41 | fX(p->fX), fY(p->fY), fZ(p->fZ), fEX(p->fEX), fEY(p->fEY), fEZ(p->fEZ) | |
42 | { | |
43 | // Modified copy constructor. | |
44 | // Accepts a pointer to a like object and copies its datamembers. | |
45 | ||
46 | fLayer = p->fLayer; | |
47 | for (Int_t i = 0; i < 3; i++) fLabel[i] = p->fLabel[i]; | |
48 | fModule = p->fModule; | |
49 | fIndex = p->fIndex; | |
50 | fUser = p->fUser; | |
51 | fCharge = p->fCharge; | |
52 | } | |
53 | // | |
54 | //------------------------------------------------------------------------------------------------------ | |
55 | // | |
56 | AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeomMatrix *gm) | |
57 | { | |
58 | // Conversion constructor. | |
59 | // Accepts a AliITSRecPoint and a AliITSgeomMatrix, | |
60 | // and converts the local coord of the AliITSRecPoint object into global | |
61 | ||
62 | Int_t i, k; | |
63 | Double_t locPos[3], globPos[3], locErr[3][3], globErr[3][3]; | |
64 | for (i = 0; i < 3; i++) { | |
65 | globPos[i] = 0.0; | |
66 | for (k = 0; k < 3; k++) { | |
67 | locErr[i][k] = 0.0; | |
68 | globErr[i][k] = 0.0; | |
69 | } | |
70 | } | |
71 | ||
72 | // local to global conversions of coords | |
73 | locPos[0] = rp->fX; | |
74 | locPos[1] = 0.0; | |
75 | locPos[2] = rp->fZ; | |
76 | gm->LtoGPosition(locPos, globPos); | |
77 | fX = globPos[0]; | |
78 | fY = globPos[1]; | |
79 | fZ = globPos[2]; | |
80 | ||
81 | // local to global conversions of sigmas | |
82 | locErr[0][0] = rp->fSigmaX2; | |
83 | locErr[2][2] = rp->fSigmaZ2; | |
84 | gm->LtoGPositionError(locErr, globErr); | |
85 | for (i = 0; i < 3; i++) fLabel[i] = rp->fTracks[i]; | |
86 | fEX = TMath::Sqrt(globErr[0][0]); | |
87 | fEY = TMath::Sqrt(globErr[1][1]); | |
88 | fEZ = TMath::Sqrt(globErr[2][2]); | |
89 | ||
90 | // copy of other data-members | |
91 | fCharge = rp->fQ; | |
92 | fLayer = 0; | |
93 | fIndex = 0; | |
94 | fModule = 0; | |
95 | fUser = 0; | |
96 | } | |
97 | // | |
98 | //------------------------------------------------------------------------------------------------- | |
99 | // | |
100 | AliITSNeuralPoint::AliITSNeuralPoint | |
101 | (AliITSclusterV2 *rp, AliITSgeom *geom, Short_t module, Short_t index) | |
102 | { | |
853a0f19 | 103 | // Conversion constructor. |
104 | // Accepts a AliITSclusterV2 and an AliITSgeom, | |
105 | // and converts the local coord of the AliITSclusterV2 object into global | |
106 | ||
b9d722bc | 107 | Int_t mod = (Int_t)module, lay, lad, det; |
108 | fModule = module; | |
109 | fIndex = index; | |
110 | geom->GetModuleId(mod, lay, lad, det); | |
111 | fLayer = (Short_t)lay; | |
112 | ||
113 | Double_t rot[9]; | |
114 | Float_t tx, ty, tz; | |
115 | geom->GetRotMatrix(fModule, rot); | |
116 | geom->GetTrans(fLayer, lad, det, tx, ty, tz); | |
117 | ||
118 | Double_t r, phi, cosPhi, sinPhi; | |
119 | r = -tx*rot[1] + ty*rot[0]; | |
120 | if (lay == 1) r = -r; | |
121 | phi = TMath::ATan2(rot[1], rot[0]); | |
122 | if (lay==1) phi -= 3.1415927; | |
123 | cosPhi = TMath::Cos(phi); | |
124 | sinPhi = TMath::Sin(phi); | |
125 | fX = r*cosPhi + rp->GetY()*sinPhi; | |
126 | fY = -r*sinPhi + rp->GetY()*cosPhi; | |
127 | fZ = rp->GetZ(); | |
128 | fEX = TMath::Sqrt(rp->GetSigmaY2())*sinPhi; | |
129 | fEY = TMath::Sqrt(rp->GetSigmaY2())*cosPhi; | |
130 | fEZ = TMath::Sqrt(rp->GetSigmaZ2()); | |
131 | fLayer--; | |
132 | } | |
133 | // | |
134 | //------------------------------------------------------------------------------------------------- | |
135 | // | |
136 | Double_t AliITSNeuralPoint::GetPhi() const | |
b9d722bc | 137 | { |
853a0f19 | 138 | // Returns the azimuthal coordinate in the range 0-2pi |
b9d722bc | 139 | Double_t q; |
140 | q = TMath::ATan2(fY,fX); | |
141 | if (q >= 0.) | |
142 | return q; | |
143 | else | |
144 | return q + 2.0*TMath::Pi(); | |
145 | } | |
146 | // | |
147 | //------------------------------------------------------------------------------------------------------ | |
148 | // | |
149 | Double_t AliITSNeuralPoint::GetError(Option_t *option) | |
853a0f19 | 150 | { |
b9d722bc | 151 | // Returns the error or the square error of |
152 | // values related to the coordinates in different systems. | |
153 | // The option argument specifies the coordinate error desired: | |
154 | // | |
155 | // "R2" --> error in transverse radius | |
156 | // "R3" --> error in spherical radius | |
157 | // "PHI" --> error in azimuthal angle | |
158 | // "THETA" --> error in polar angle | |
159 | // "SQ" --> get the square of error | |
160 | // | |
161 | // In order to get the error on the cartesian coordinates | |
162 | // reference to the inline ErrX(), ErrY() adn ErrZ() methods. | |
853a0f19 | 163 | |
b9d722bc | 164 | TString opt(option); |
165 | Double_t errorSq = 0.0; | |
166 | opt.ToUpper(); | |
167 | ||
168 | if (opt.Contains("R2")) { | |
169 | errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY; | |
170 | errorSq /= GetR2sq(); | |
171 | } | |
172 | else if (opt.Contains("R3")) { | |
173 | errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY + fZ*fZ*fEZ*fEZ; | |
174 | errorSq /= GetR3sq(); | |
175 | } | |
176 | else if (opt.Contains("PHI")) { | |
177 | errorSq = fY*fY*fEX*fEX; | |
178 | errorSq += fX*fX*fEY*fEY; | |
179 | errorSq /= GetR2sq() * GetR2sq(); | |
180 | } | |
181 | else if (opt.Contains("THETA")) { | |
182 | errorSq = fZ*fZ * (fX*fX*fEX*fEX + fY*fY*fEY*fEY); | |
183 | errorSq += GetR2sq() * GetR2sq() * fEZ*fEZ; | |
184 | errorSq /= GetR3sq() * GetR3sq() * GetR2() * GetR2(); | |
185 | } | |
186 | ||
187 | if (!opt.Contains("SQ")) | |
188 | return TMath::Sqrt(errorSq); | |
189 | else | |
190 | return errorSq; | |
191 | } | |
192 | // | |
193 | //------------------------------------------------------------------------------------------------------ | |
194 | // | |
853a0f19 | 195 | Bool_t AliITSNeuralPoint::HasID(Int_t ID) const |
196 | { | |
b9d722bc | 197 | // Checks if the recpoint belongs to the GEANT track |
198 | // whose label is specified in the argument | |
b9d722bc | 199 | if (ID<0) |
200 | return kFALSE; | |
201 | else | |
202 | return (fLabel[0]==ID || fLabel[1]==ID || fLabel[2]==ID); | |
203 | } | |
204 | // | |
205 | //------------------------------------------------------------------------------------------------------ | |
206 | // | |
207 | Int_t* AliITSNeuralPoint::SharedID(AliITSNeuralPoint *p) | |
853a0f19 | 208 | { |
b9d722bc | 209 | // Checks if there is a GEANT track owning both |
210 | // <this> and the recpoint in the argument | |
211 | // The return value is an array of 4 integers. | |
212 | // The firs integer returns the count of matches between labels of | |
213 | // <this> and labels of the argument (0 to 3) | |
214 | // The other three return the matched labels. | |
215 | // If a NULL pointer is passed, the array will be returned as: | |
216 | // {0, -1, -1, -1} | |
853a0f19 | 217 | |
b9d722bc | 218 | Int_t i, *shared = new Int_t[4]; |
219 | for (i = 0; i < 4; i++) shared[i] = -1; | |
220 | shared[0] = 0; | |
221 | if (!p) return shared; | |
222 | for (i = 0; i < 3; i++) { | |
223 | if (HasID(p->fLabel[i])) shared[i + 1] = p->fLabel[i]; | |
224 | shared[0]++; | |
225 | } | |
226 | return shared; | |
227 | } | |
228 | // | |
229 | // | |
230 | // | |
231 | void AliITSNeuralPoint::ConfMap(Double_t vx, Double_t vy) | |
232 | { | |
853a0f19 | 233 | // Performs conformal mapping vertex-constrained |
234 | ||
b9d722bc | 235 | Double_t dx = fX - vx; |
236 | Double_t dy = vy - fY; | |
237 | Double_t r2 = dx*dx + dy*dy; | |
238 | fConfX = dx / r2; | |
239 | fConfY = dy / r2; | |
240 | } |