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 "AliITSclusterV2.h"
15 #include "AliITSgeom.h"
16 #include "AliITSgeomMatrix.h"
18 #include "AliITSNeuralPoint.h"
21 ClassImp(AliITSNeuralPoint)
23 //------------------------------------------------------------------------------------------------------
25 AliITSNeuralPoint::AliITSNeuralPoint()
27 // Default constructor.
28 // Defines the point as a noise point in the origin.
33 fLabel[0] = fLabel[1] = fLabel[2] = -1;
39 //------------------------------------------------------------------------------------------------------
41 AliITSNeuralPoint::AliITSNeuralPoint(AliITSNeuralPoint *p) :
42 fX(p->fX), fY(p->fY), fZ(p->fZ), fEX(p->fEX), fEY(p->fEY), fEZ(p->fEZ)
44 // Modified copy constructor.
45 // Accepts a pointer to a like object and copies its datamembers.
48 for (Int_t i = 0; i < 3; i++) fLabel[i] = p->fLabel[i];
55 //------------------------------------------------------------------------------------------------------
57 AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeomMatrix *gm)
59 // Conversion constructor.
60 // Accepts a AliITSRecPoint and a AliITSgeomMatrix,
61 // and converts the local coord of the AliITSRecPoint object into global
64 Double_t locPos[3], globPos[3], locErr[3][3], globErr[3][3];
65 for (i = 0; i < 3; i++) {
67 for (k = 0; k < 3; k++) {
73 // local to global conversions of coords
77 gm->LtoGPosition(locPos, globPos);
82 // local to global conversions of sigmas
83 locErr[0][0] = rp->fSigmaX2;
84 locErr[2][2] = rp->fSigmaZ2;
85 gm->LtoGPositionError(locErr, globErr);
86 for (i = 0; i < 3; i++) fLabel[i] = rp->fTracks[i];
87 fEX = TMath::Sqrt(globErr[0][0]);
88 fEY = TMath::Sqrt(globErr[1][1]);
89 fEZ = TMath::Sqrt(globErr[2][2]);
91 // copy of other data-members
99 //-------------------------------------------------------------------------------------------------
101 AliITSNeuralPoint::AliITSNeuralPoint
102 (AliITSclusterV2 *rp, AliITSgeom *geom, Short_t module, Short_t index)
104 // Conversion constructor.
105 // Accepts a AliITSclusterV2 and an AliITSgeom,
106 // and converts the local coord of the AliITSclusterV2 object into global
108 Int_t mod = (Int_t)module, lay, lad, det;
111 geom->GetModuleId(mod, lay, lad, det);
112 fLayer = (Short_t)lay;
116 geom->GetRotMatrix(fModule, rot);
117 geom->GetTrans(fLayer, lad, det, tx, ty, tz);
119 Double_t r, phi, cosPhi, sinPhi;
120 r = -tx*rot[1] + ty*rot[0];
121 if (lay == 1) r = -r;
122 phi = TMath::ATan2(rot[1], rot[0]);
123 if (lay==1) phi -= 3.1415927;
124 cosPhi = TMath::Cos(phi);
125 sinPhi = TMath::Sin(phi);
126 fX = r*cosPhi + rp->GetY()*sinPhi;
127 fY = -r*sinPhi + rp->GetY()*cosPhi;
129 fEX = TMath::Sqrt(rp->GetSigmaY2())*sinPhi;
130 fEY = TMath::Sqrt(rp->GetSigmaY2())*cosPhi;
131 fEZ = TMath::Sqrt(rp->GetSigmaZ2());
135 //-------------------------------------------------------------------------------------------------
137 Double_t AliITSNeuralPoint::GetPhi() const
139 // Returns the azimuthal coordinate in the range 0-2pi
141 q = TMath::ATan2(fY,fX);
145 return q + 2.0*TMath::Pi();
148 //------------------------------------------------------------------------------------------------------
150 Double_t AliITSNeuralPoint::GetError(Option_t *option)
152 // Returns the error or the square error of
153 // values related to the coordinates in different systems.
154 // The option argument specifies the coordinate error desired:
156 // "R2" --> error in transverse radius
157 // "R3" --> error in spherical radius
158 // "PHI" --> error in azimuthal angle
159 // "THETA" --> error in polar angle
160 // "SQ" --> get the square of error
162 // In order to get the error on the cartesian coordinates
163 // reference to the inline ErrX(), ErrY() adn ErrZ() methods.
166 Double_t errorSq = 0.0;
169 if (opt.Contains("R2")) {
170 errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY;
171 errorSq /= GetR2sq();
173 else if (opt.Contains("R3")) {
174 errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY + fZ*fZ*fEZ*fEZ;
175 errorSq /= GetR3sq();
177 else if (opt.Contains("PHI")) {
178 errorSq = fY*fY*fEX*fEX;
179 errorSq += fX*fX*fEY*fEY;
180 errorSq /= GetR2sq() * GetR2sq();
182 else if (opt.Contains("THETA")) {
183 errorSq = fZ*fZ * (fX*fX*fEX*fEX + fY*fY*fEY*fEY);
184 errorSq += GetR2sq() * GetR2sq() * fEZ*fEZ;
185 errorSq /= GetR3sq() * GetR3sq() * GetR2() * GetR2();
188 if (!opt.Contains("SQ"))
189 return TMath::Sqrt(errorSq);
194 //------------------------------------------------------------------------------------------------------
196 Bool_t AliITSNeuralPoint::HasID(Int_t ID) const
198 // Checks if the recpoint belongs to the GEANT track
199 // whose label is specified in the argument
203 return (fLabel[0]==ID || fLabel[1]==ID || fLabel[2]==ID);
206 //------------------------------------------------------------------------------------------------------
208 Int_t* AliITSNeuralPoint::SharedID(AliITSNeuralPoint *p) const
210 // Checks if there is a GEANT track owning both
211 // <this> and the recpoint in the argument
212 // The return value is an array of 4 integers.
213 // The firs integer returns the count of matches between labels of
214 // <this> and labels of the argument (0 to 3)
215 // The other three return the matched labels.
216 // If a NULL pointer is passed, the array will be returned as:
219 Int_t i, *shared = new Int_t[4];
220 for (i = 0; i < 4; i++) shared[i] = -1;
222 if (!p) return shared;
223 for (i = 0; i < 3; i++) {
224 if (HasID(p->fLabel[i])) shared[i + 1] = p->fLabel[i];
232 void AliITSNeuralPoint::ConfMap(Double_t vx, Double_t vy)
234 // Performs conformal mapping vertex-constrained
236 Double_t dx = fX - vx;
237 Double_t dy = vy - fY;
238 Double_t r2 = dx*dx + dy*dy;