6 #include "AliITSRecPoint.h"
7 #include "AliITSclusterV2.h"
8 #include "AliITSgeom.h"
9 #include "AliITSgeomMatrix.h"
11 #include "AliITSNeuralPoint.h"
14 ClassImp(AliITSNeuralPoint)
16 //------------------------------------------------------------------------------------------------------
18 AliITSNeuralPoint::AliITSNeuralPoint()
20 // Default constructor.
21 // Defines the point as a noise point in the origin.
26 fLabel[0] = fLabel[1] = fLabel[2] = -1;
32 //------------------------------------------------------------------------------------------------------
34 AliITSNeuralPoint::AliITSNeuralPoint(AliITSNeuralPoint *p) :
35 fX(p->fX), fY(p->fY), fZ(p->fZ), fEX(p->fEX), fEY(p->fEY), fEZ(p->fEZ)
37 // Modified copy constructor.
38 // Accepts a pointer to a like object and copies its datamembers.
41 for (Int_t i = 0; i < 3; i++) fLabel[i] = p->fLabel[i];
48 //------------------------------------------------------------------------------------------------------
50 AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeomMatrix *gm)
52 // Conversion constructor.
53 // Accepts a AliITSRecPoint and a AliITSgeomMatrix,
54 // and converts the local coord of the AliITSRecPoint object into global
57 Double_t locPos[3], globPos[3], locErr[3][3], globErr[3][3];
58 for (i = 0; i < 3; i++) {
60 for (k = 0; k < 3; k++) {
66 // local to global conversions of coords
70 gm->LtoGPosition(locPos, globPos);
75 // local to global conversions of sigmas
76 locErr[0][0] = rp->fSigmaX2;
77 locErr[2][2] = rp->fSigmaZ2;
78 gm->LtoGPositionError(locErr, globErr);
79 for (i = 0; i < 3; i++) fLabel[i] = rp->fTracks[i];
80 fEX = TMath::Sqrt(globErr[0][0]);
81 fEY = TMath::Sqrt(globErr[1][1]);
82 fEZ = TMath::Sqrt(globErr[2][2]);
84 // copy of other data-members
92 //-------------------------------------------------------------------------------------------------
94 AliITSNeuralPoint::AliITSNeuralPoint
95 (AliITSclusterV2 *rp, AliITSgeom *geom, Short_t module, Short_t index)
97 Int_t mod = (Int_t)module, lay, lad, det;
100 geom->GetModuleId(mod, lay, lad, det);
101 fLayer = (Short_t)lay;
105 geom->GetRotMatrix(fModule, rot);
106 geom->GetTrans(fLayer, lad, det, tx, ty, tz);
108 Double_t r, phi, cosPhi, sinPhi;
109 r = -tx*rot[1] + ty*rot[0];
110 if (lay == 1) r = -r;
111 phi = TMath::ATan2(rot[1], rot[0]);
112 if (lay==1) phi -= 3.1415927;
113 cosPhi = TMath::Cos(phi);
114 sinPhi = TMath::Sin(phi);
115 fX = r*cosPhi + rp->GetY()*sinPhi;
116 fY = -r*sinPhi + rp->GetY()*cosPhi;
118 fEX = TMath::Sqrt(rp->GetSigmaY2())*sinPhi;
119 fEY = TMath::Sqrt(rp->GetSigmaY2())*cosPhi;
120 fEZ = TMath::Sqrt(rp->GetSigmaZ2());
124 //-------------------------------------------------------------------------------------------------
126 Double_t AliITSNeuralPoint::GetPhi() const
127 // Returns the azimuthal coordinate in the range 0-2pi
130 q = TMath::ATan2(fY,fX);
134 return q + 2.0*TMath::Pi();
137 //------------------------------------------------------------------------------------------------------
139 Double_t AliITSNeuralPoint::GetError(Option_t *option)
140 // Returns the error or the square error of
141 // values related to the coordinates in different systems.
142 // The option argument specifies the coordinate error desired:
144 // "R2" --> error in transverse radius
145 // "R3" --> error in spherical radius
146 // "PHI" --> error in azimuthal angle
147 // "THETA" --> error in polar angle
148 // "SQ" --> get the square of error
150 // In order to get the error on the cartesian coordinates
151 // reference to the inline ErrX(), ErrY() adn ErrZ() methods.
154 Double_t errorSq = 0.0;
157 if (opt.Contains("R2")) {
158 errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY;
159 errorSq /= GetR2sq();
161 else if (opt.Contains("R3")) {
162 errorSq = fX*fX*fEX*fEX + fY*fY*fEY*fEY + fZ*fZ*fEZ*fEZ;
163 errorSq /= GetR3sq();
165 else if (opt.Contains("PHI")) {
166 errorSq = fY*fY*fEX*fEX;
167 errorSq += fX*fX*fEY*fEY;
168 errorSq /= GetR2sq() * GetR2sq();
170 else if (opt.Contains("THETA")) {
171 errorSq = fZ*fZ * (fX*fX*fEX*fEX + fY*fY*fEY*fEY);
172 errorSq += GetR2sq() * GetR2sq() * fEZ*fEZ;
173 errorSq /= GetR3sq() * GetR3sq() * GetR2() * GetR2();
176 if (!opt.Contains("SQ"))
177 return TMath::Sqrt(errorSq);
182 //------------------------------------------------------------------------------------------------------
184 Bool_t AliITSNeuralPoint::HasID(Int_t ID)
185 // Checks if the recpoint belongs to the GEANT track
186 // whose label is specified in the argument
191 return (fLabel[0]==ID || fLabel[1]==ID || fLabel[2]==ID);
194 //------------------------------------------------------------------------------------------------------
196 Int_t* AliITSNeuralPoint::SharedID(AliITSNeuralPoint *p)
197 // Checks if there is a GEANT track owning both
198 // <this> and the recpoint in the argument
199 // The return value is an array of 4 integers.
200 // The firs integer returns the count of matches between labels of
201 // <this> and labels of the argument (0 to 3)
202 // The other three return the matched labels.
203 // If a NULL pointer is passed, the array will be returned as:
206 Int_t i, *shared = new Int_t[4];
207 for (i = 0; i < 4; i++) shared[i] = -1;
209 if (!p) return shared;
210 for (i = 0; i < 3; i++) {
211 if (HasID(p->fLabel[i])) shared[i + 1] = p->fLabel[i];
219 void AliITSNeuralPoint::ConfMap(Double_t vx, Double_t vy)
221 Double_t dx = fX - vx;
222 Double_t dy = vy - fY;
223 Double_t r2 = dx*dx + dy*dy;