3 // A class which resumes the information of ITS clusters
4 // in the global reference frame.
5 // Author: A. Pulvirenti
8 //#include <Riostream.h>
12 #include "AliITSRecPoint.h"
13 #include "AliITSclusterV2.h"
14 #include "AliITSgeom.h"
15 #include "AliITSgeomMatrix.h"
17 #include "AliITSNeuralPoint.h"
20 ClassImp(AliITSNeuralPoint)
22 //------------------------------------------------------------------------------------------------------
24 AliITSNeuralPoint::AliITSNeuralPoint()
26 // Default constructor.
27 // Defines the point as a noise point in the origin.
32 fLabel[0] = fLabel[1] = fLabel[2] = -1;
38 //------------------------------------------------------------------------------------------------------
40 AliITSNeuralPoint::AliITSNeuralPoint(AliITSNeuralPoint *p) :
41 fX(p->fX), fY(p->fY), fZ(p->fZ), fEX(p->fEX), fEY(p->fEY), fEZ(p->fEZ)
43 // Modified copy constructor.
44 // Accepts a pointer to a like object and copies its datamembers.
47 for (Int_t i = 0; i < 3; i++) fLabel[i] = p->fLabel[i];
54 //------------------------------------------------------------------------------------------------------
56 AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeomMatrix *gm)
58 // Conversion constructor.
59 // Accepts a AliITSRecPoint and a AliITSgeomMatrix,
60 // and converts the local coord of the AliITSRecPoint object into global
63 Double_t locPos[3], globPos[3], locErr[3][3], globErr[3][3];
64 for (i = 0; i < 3; i++) {
66 for (k = 0; k < 3; k++) {
72 // local to global conversions of coords
76 gm->LtoGPosition(locPos, globPos);
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]);
90 // copy of other data-members
98 //-------------------------------------------------------------------------------------------------
100 AliITSNeuralPoint::AliITSNeuralPoint
101 (AliITSclusterV2 *rp, AliITSgeom *geom, Short_t module, Short_t index)
103 // Conversion constructor.
104 // Accepts a AliITSclusterV2 and an AliITSgeom,
105 // and converts the local coord of the AliITSclusterV2 object into global
107 Int_t mod = (Int_t)module, lay, lad, det;
110 geom->GetModuleId(mod, lay, lad, det);
111 fLayer = (Short_t)lay;
115 geom->GetRotMatrix(fModule, rot);
116 geom->GetTrans(fLayer, lad, det, tx, ty, tz);
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;
128 fEX = TMath::Sqrt(rp->GetSigmaY2())*sinPhi;
129 fEY = TMath::Sqrt(rp->GetSigmaY2())*cosPhi;
130 fEZ = TMath::Sqrt(rp->GetSigmaZ2());
134 //-------------------------------------------------------------------------------------------------
136 Double_t AliITSNeuralPoint::GetPhi() const
138 // Returns the azimuthal coordinate in the range 0-2pi
140 q = TMath::ATan2(fY,fX);
144 return q + 2.0*TMath::Pi();
147 //------------------------------------------------------------------------------------------------------
149 Double_t AliITSNeuralPoint::GetError(Option_t *option)
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:
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
161 // In order to get the error on the cartesian coordinates
162 // reference to the inline ErrX(), ErrY() adn ErrZ() methods.
165 Double_t errorSq = 0.0;
168 if (opt.Contains("R2")) {
169 errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY;
170 errorSq /= GetR2sq();
172 else if (opt.Contains("R3")) {
173 errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY + fZ*fZ*fEZ*fEZ;
174 errorSq /= GetR3sq();
176 else if (opt.Contains("PHI")) {
177 errorSq = fY*fY*fEX*fEX;
178 errorSq += fX*fX*fEY*fEY;
179 errorSq /= GetR2sq() * GetR2sq();
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();
187 if (!opt.Contains("SQ"))
188 return TMath::Sqrt(errorSq);
193 //------------------------------------------------------------------------------------------------------
195 Bool_t AliITSNeuralPoint::HasID(Int_t ID) const
197 // Checks if the recpoint belongs to the GEANT track
198 // whose label is specified in the argument
202 return (fLabel[0]==ID || fLabel[1]==ID || fLabel[2]==ID);
205 //------------------------------------------------------------------------------------------------------
207 Int_t* AliITSNeuralPoint::SharedID(AliITSNeuralPoint *p)
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:
218 Int_t i, *shared = new Int_t[4];
219 for (i = 0; i < 4; i++) shared[i] = -1;
221 if (!p) return shared;
222 for (i = 0; i < 3; i++) {
223 if (HasID(p->fLabel[i])) shared[i + 1] = p->fLabel[i];
231 void AliITSNeuralPoint::ConfMap(Double_t vx, Double_t vy)
233 // Performs conformal mapping vertex-constrained
235 Double_t dx = fX - vx;
236 Double_t dy = vy - fY;
237 Double_t r2 = dx*dx + dy*dy;