1 ///////////////////////////////////////////////////////////////
2 // AliITSneuralPoint //
4 // A class which resumes the information of ITS clusters //
5 // in the global reference frame. //
6 // Author: A. Pulvirenti //
7 ///////////////////////////////////////////////////////////////
9 //#include <Riostream.h>
13 #include "AliITSRecPoint.h"
14 #include "AliITSRecPoint.h"
15 #include "AliITSgeom.h"
16 #include "AliITSgeomMatrix.h"
18 #include "AliITSNeuralPoint.h"
21 ClassImp(AliITSNeuralPoint)
23 //------------------------------------------------------------------------------------------------------
25 AliITSNeuralPoint::AliITSNeuralPoint():
40 // Default constructor.
41 // Defines the point as a noise point in the origin.
43 fLabel[0] = fLabel[1] = fLabel[2] = -1;
47 //------------------------------------------------------------------------------------------------------
49 AliITSNeuralPoint::AliITSNeuralPoint(AliITSNeuralPoint *p) :
65 // Modified copy constructor.
66 // Accepts a pointer to a like object and copies its datamembers.
69 for (Int_t i = 0; i < 3; i++) fLabel[i] = p->fLabel[i];
73 //------------------------------------------------------------------------------------------------------
75 AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeomMatrix *gm):
91 // Conversion constructor.
92 // Accepts a AliITSRecPoint and a AliITSgeomMatrix,
93 // and converts the local coord of the AliITSRecPoint object into global
96 Double_t locPos[3], globPos[3], locErr[3][3], globErr[3][3];
97 for (i = 0; i < 3; i++) {
99 for (k = 0; k < 3; k++) {
105 // local to global conversions of coords
106 locPos[0] = rp->GetDetLocalX();
108 locPos[2] = rp->GetDetLocalZ();
109 gm->LtoGPosition(locPos, globPos);
114 // local to global conversions of sigmas
115 locErr[0][0] = rp->GetSigmaDetLocX2();
116 locErr[2][2] = rp->GetSigmaZ2();
117 gm->LtoGPositionError(locErr, globErr);
118 for (i = 0; i < 3; i++) fLabel[i] = rp->GetLabel(i);
119 fEX = TMath::Sqrt(globErr[0][0]);
120 fEY = TMath::Sqrt(globErr[1][1]);
121 fEZ = TMath::Sqrt(globErr[2][2]);
123 // copy of other data-members
124 fCharge = rp->GetQ();
131 //-------------------------------------------------------------------------------------------------
133 AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeom *geom, Short_t module, Short_t index):
149 // Conversion constructor.
150 // Accepts a AliITSRecPoint and an AliITSgeom,
151 // and converts the local coord of the AliITSRecPoint object into global
153 Int_t mod = (Int_t)module, lay, lad, det;
156 geom->GetModuleId(mod, lay, lad, det);
157 fLayer = (Short_t)lay;
161 geom->GetRotMatrix(fModule, rot);
162 geom->GetTrans(fLayer, lad, det, tx, ty, tz);
164 Double_t r, phi, cosPhi, sinPhi;
165 r = -tx*rot[1] + ty*rot[0];
166 if (lay == 1) r = -r;
167 phi = TMath::ATan2(rot[1], rot[0]);
168 if (lay==1) phi -= 3.1415927;
169 cosPhi = TMath::Cos(phi);
170 sinPhi = TMath::Sin(phi);
171 fX = r*cosPhi + rp->GetY()*sinPhi;
172 fY = -r*sinPhi + rp->GetY()*cosPhi;
174 fEX = TMath::Sqrt(rp->GetSigmaY2())*sinPhi;
175 fEY = TMath::Sqrt(rp->GetSigmaY2())*cosPhi;
176 fEZ = TMath::Sqrt(rp->GetSigmaZ2());
180 //-------------------------------------------------------------------------------------------------
182 Double_t AliITSNeuralPoint::GetPhi() const
184 // Returns the azimuthal coordinate in the range 0-2pi
186 q = TMath::ATan2(fY,fX);
190 return q + 2.0*TMath::Pi();
193 //------------------------------------------------------------------------------------------------------
195 Double_t AliITSNeuralPoint::GetError(Option_t *option)
197 // Returns the error or the square error of
198 // values related to the coordinates in different systems.
199 // The option argument specifies the coordinate error desired:
201 // "R2" --> error in transverse radius
202 // "R3" --> error in spherical radius
203 // "PHI" --> error in azimuthal angle
204 // "THETA" --> error in polar angle
205 // "SQ" --> get the square of error
207 // In order to get the error on the cartesian coordinates
208 // reference to the inline ErrX(), ErrY() adn ErrZ() methods.
211 Double_t errorSq = 0.0;
214 if (opt.Contains("R2")) {
215 errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY;
216 errorSq /= GetR2sq();
218 else if (opt.Contains("R3")) {
219 errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY + fZ*fZ*fEZ*fEZ;
220 errorSq /= GetR3sq();
222 else if (opt.Contains("PHI")) {
223 errorSq = fY*fY*fEX*fEX;
224 errorSq += fX*fX*fEY*fEY;
225 errorSq /= GetR2sq() * GetR2sq();
227 else if (opt.Contains("THETA")) {
228 errorSq = fZ*fZ * (fX*fX*fEX*fEX + fY*fY*fEY*fEY);
229 errorSq += GetR2sq() * GetR2sq() * fEZ*fEZ;
230 errorSq /= GetR3sq() * GetR3sq() * GetR2() * GetR2();
233 if (!opt.Contains("SQ"))
234 return TMath::Sqrt(errorSq);
239 //------------------------------------------------------------------------------------------------------
241 Bool_t AliITSNeuralPoint::HasID(Int_t ID) const
243 // Checks if the recpoint belongs to the GEANT track
244 // whose label is specified in the argument
248 return (fLabel[0]==ID || fLabel[1]==ID || fLabel[2]==ID);
251 //------------------------------------------------------------------------------------------------------
253 Int_t* AliITSNeuralPoint::SharedID(AliITSNeuralPoint *p) const
255 // Checks if there is a GEANT track owning both
256 // <this> and the recpoint in the argument
257 // The return value is an array of 4 integers.
258 // The firs integer returns the count of matches between labels of
259 // <this> and labels of the argument (0 to 3)
260 // The other three return the matched labels.
261 // If a NULL pointer is passed, the array will be returned as:
264 Int_t i, *shared = new Int_t[4];
265 for (i = 0; i < 4; i++) shared[i] = -1;
267 if (!p) return shared;
268 for (i = 0; i < 3; i++) {
269 if (HasID(p->fLabel[i])) shared[i + 1] = p->fLabel[i];
277 void AliITSNeuralPoint::ConfMap(Double_t vx, Double_t vy)
279 // Performs conformal mapping vertex-constrained
281 Double_t dx = fX - vx;
282 Double_t dy = vy - fY;
283 Double_t r2 = dx*dx + dy*dy;