]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/v0/AliITStrackU.cxx
don't sort clusters after local reco, do this in AliITSUTrackerGlo
[u/mrichter/AliRoot.git] / ITS / UPGRADE / v0 / AliITStrackU.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16
17 ////////////////////////////////////////////////////////
18 //  Stand alone track class UPGRADE                   //
19 //  Authors: A.Mastroserio                            //
20 //           C.Terrevoli                              //
21 //           annalisa.mastroserio@cern.ch             //      
22 //           cristina.terrevoli@ba.infn.it            //                                                    
23 ////////////////////////////////////////////////////////
24
25 #include "AliESDtrack.h"
26 #include "AliITStrackU.h"
27 #include "AliITSsegmentationUpgrade.cxx"
28
29 ClassImp(AliITStrackU)
30
31 //_____________________________________
32   AliITStrackU:: AliITStrackU() : 
33     AliITStrackV2(),
34     fNLayers(0),
35     fNU(0),
36     fExpQ(40)
37 {
38   // Default constructor  fgMaxNLayer
39   SetNumberOfClusters(0);
40   SetNumberOfClustersU(0);
41   ResetIndexU();
42   for(Int_t nlay=0;nlay<fgMaxNLayer;nlay++){ 
43     fNM[nlay]=0;
44     fDy[nlay]=0; fDz[nlay]=0; fSigmaY[nlay]=0; fSigmaZ[nlay]=0; fSigmaYZ[nlay]=0;
45     fClIndex[nlay]=-1; 
46     fNy[nlay]=0; fNz[nlay]=0; fNormQ[nlay]=0; fNormChi2[nlay]=1000;
47     SetNumberOfMarked(nlay,0);
48   }
49   ResetMarked();
50 }
51 //_____________________________________
52 AliITStrackU:: AliITStrackU(Int_t nlay) : 
53   AliITStrackV2(),
54   fNLayers(nlay),
55   fNU(0),
56   fExpQ(40)
57 {
58   // Constructor
59   SetNumberOfClusters(0);
60   SetNumberOfClustersU(0);
61   ResetIndexU();
62   for(Int_t nl=0;nl<fgMaxNLayer;nl++){
63     fNM[nlay]=0;
64     fDy[nl]=0; fDz[nl]=0; fSigmaY[nl]=0; fSigmaZ[nl]=0; fSigmaYZ[nl]=0;
65     fClIndex[nl]=-1;
66     fNy[nl]=0; fNz[nl]=0; fNormQ[nl]=0; fNormChi2[nl]=1000;
67     SetNumberOfMarked(nl,0);
68   }
69   ResetMarked();
70 }
71
72 //_____________________________________________________
73 AliITStrackU::AliITStrackU(AliESDtrack& t,Bool_t c):
74   AliITStrackV2(t,c),
75   fNLayers(0),
76   fNU(0),
77   fExpQ(40)
78 {
79   //------------------------------------------------------------------
80   // Copy a V2 track into a U track
81   // -> to be checked
82   //------------------------------------------------------------------
83  ResetIndexU();
84  ResetMarked();
85   for(Int_t nlay=0;nlay<fgMaxNLayer;nlay++){
86     fNM[nlay]=0;
87     fDy[nlay]=0; fDz[nlay]=0; fSigmaY[nlay]=0; fSigmaZ[nlay]=0; fSigmaYZ[nlay]=0;
88     fClIndex[nlay]=-1; fNy[nlay]=0; fNz[nlay]=0; fNormQ[nlay]=0; fNormChi2[nlay]=1000;  
89   }
90 }
91 //___________________________________________________
92
93 AliITStrackU::AliITStrackU(const AliITStrackU& t, Bool_t trackMI) : 
94   AliITStrackV2(t),
95   fNLayers(t.fNLayers),
96   fNU(t.fNU),
97   fExpQ(t.fExpQ)
98 {
99   // Copy constructor
100
101   ResetIndexU();
102   ResetMarked();
103   Int_t number = t.GetNumberOfClustersU();
104   SetNumberOfClustersU(number);
105   for(Int_t lay=0;lay<fgMaxNLayer;lay++){
106     SetNumberOfMarked(lay,t.GetNumberOfMarked(lay));
107   }
108   for(Int_t i=0;i<number;i++){
109     fSain[i]=t.fSain[i];
110   }
111   for(Int_t nlay=0;nlay<fNLayers;nlay++){
112     for(Int_t i=0;i<t.GetNumberOfMarked(nlay);i++){
113       fCluMark[nlay][i]=t.fCluMark[nlay][i];
114     }
115   }
116   for(Int_t nlay=0;nlay<fgMaxNLayer;nlay++){
117     fNM[nlay]=t.fNM[nlay];
118     fDy[nlay]=t.fDy[nlay]; fDz[nlay]=t.fDz[nlay];
119      fSigmaY[nlay]=t.fSigmaY[nlay]; fSigmaZ[nlay]=t.fSigmaZ[nlay]; fSigmaYZ[nlay]=t.fSigmaYZ[nlay];
120     fClIndex[nlay]= t.fClIndex[nlay]; fNy[nlay]=t.fNy[nlay]; fNz[nlay]=t.fNz[nlay]; fNormQ[nlay]=t.fNormQ[nlay]; fNormChi2[nlay] = t.fNormChi2[nlay];
121   } 
122   
123   if(trackMI){
124     fLab = t.fLab;
125     fFakeRatio = t.fFakeRatio;
126   }
127 //  for(Int_t i=0; i<fgMaxNLayer; i++) {fDy[i]=t.fDy[i]; fDz[i]=t.fDz[i];
128 //    fSigmaY[i]=t.fSigmaY[i]; fSigmaZ[i]=t.fSigmaZ[i]; fSigmaYZ[i]=t.fSigmaYZ[i]; 
129 //  }
130 }
131
132 //____________________________________________________
133 AliITStrackU::AliITStrackU(Double_t alpha, Double_t radius, Double_t Ycoor, Double_t Zcoor, Double_t phi, Double_t tanlambda, Double_t curv, Int_t lab, Int_t nlay ):
134   fNLayers(nlay),
135   fNU(0), 
136   fExpQ(40)
137 {
138   
139   for(Int_t i=0; i<fgMaxNLayer; i++) { fClIndex[i]=-1; fNy[i]=0; fNz[i]=0; fNormQ[i]=0; fNormChi2[i]=1000; }
140   // standard constructor. Used for ITSUpgrade standalone tracking
141
142   // get the azimuthal angle of the detector containing the innermost
143   // cluster of this track (data member fAlpha)
144   for(Int_t i=0; i<fgMaxNLayer; i++) {fNM[i]=0;fDy[i]=0; fDz[i]=0; fSigmaY[i]=0; fSigmaZ[i]=0; fSigmaYZ[i]=0;}
145
146   if (alpha<0) alpha+=TMath::TwoPi();
147   else if (alpha>=TMath::TwoPi()) alpha-=TMath::TwoPi();
148   Init(alpha,radius,Ycoor,Zcoor,phi,tanlambda,curv,lab/*,nlay*/);
149 }
150 //____________________________________________________
151 void AliITStrackU::Init(Double_t alpha, Double_t radius, Double_t Ycoor, Double_t Zcoor, Double_t phi, Double_t tanlambda, Double_t curv, Int_t lab/*, Int_t nlay*/){
152   // initialize parameters
153   fdEdx = 0;
154   Double_t conv=GetBz()*kB2C;
155   Double_t sC[] = {0.000009, // 0.000009
156                    0.,
157                    0.000003, //0.000030
158                    0.,
159                    0.,
160                    0.000001, //0.000001
161                    0.,
162                    0.,
163                    0.,
164                    0.000002, //0.000002
165                    0.,
166                    0.,
167                    0.,
168                    0.,
169                    0.000001/(conv*conv)}; //0.0000001
170
171   Double_t sP[] = {Ycoor,
172                    Zcoor,
173                    TMath::Sin(phi-alpha),
174                    tanlambda,
175                    curv/conv};
176
177
178   // dealing with the case B=0 (taken from AliTPCtrack.cxx)
179   Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt();
180   Double_t p0=TMath::Sign(1/mostProbablePt,sP[4]);
181   Double_t w0=sC[14]/(sC[14] + p0*p0), w1=p0*p0/(sC[14] + p0*p0);
182   sP[4] = w0*p0 + w1*sP[4];
183   sC[14]*=w1;
184                                                                               
185   Set(radius,alpha,sP,sC);
186
187   for(Int_t i=0; i<fNLayers; i++) fIndex[i] = 0;  // to be set explicitely
188
189   for(Int_t i=0; i<4; i++) fdEdxSample[i] = 0; 
190
191   SetNumberOfClusters(0);
192   SetNumberOfClustersU(0);
193   for(Int_t nl=0;nl<fNLayers;nl++) SetNumberOfMarked(nl,0);
194   ResetIndexU();
195   ResetMarked();
196   SetChi2(0);
197   SetMass(0.139);    // pion mass
198   SetLabel(lab); 
199   
200 }
201
202 //____________________________________________________________
203 void AliITStrackU::AddClusterU(Int_t layer, Int_t clnumb) {
204   // add one clusters to the list (maximum number=kMaxNumberOfClusters)
205   Int_t presnum = GetNumberOfClustersU();
206   if(presnum>=kMaxNumberOfClusters){
207     Warning("AddClusterU","Maximum number of clusters already reached. Nothing is done\n");
208     return;
209   }
210
211   fSain[presnum] = (layer<<28)+clnumb;  
212   presnum++;
213   SetNumberOfClustersU(presnum);
214 }
215
216 //____________________________________________________________
217 void AliITStrackU::AddClusterMark(Int_t layer, Int_t clnumb) {
218   // add one clusters to the list (maximum number=kMaxNumberOfClusters)
219   Int_t presnum = GetNumberOfMarked(layer);
220   //printf("presnum=%d\n",presnum);
221   if(presnum>=kMaxNumberOfClustersL){
222     Warning("AddClusterMark","Maximum number of clusters already reached. Nothing is done\n");
223     return;
224   }
225
226   fCluMark[layer][presnum] = clnumb;  
227   presnum++;
228   SetNumberOfMarked(layer,presnum);
229 }
230
231 //____________________________________________________________
232 void AliITStrackU::AddClusterV2(Int_t layer,Int_t clnumb) {
233   // add one clusters to the list (maximum number=6)
234   Int_t presnum = GetNumberOfClusters();
235   if(presnum>=fNLayers){
236     Warning("AddClusterV2","Maximum number of clusters already reached. Nothing is done\n");
237     return;
238   }    
239
240   fIndex[presnum] = (layer<<28)+clnumb;  
241   presnum++;
242   SetNumberOfClusters(presnum);
243 }
244
245 //_____________________________________________________________
246 void AliITStrackU::ResetMarked(){
247
248   //Reset array of marked clusters
249   for(Int_t nlay=0;nlay<fNLayers;nlay++){
250     for(Int_t k=0; k<kMaxNumberOfClustersL; k++) fCluMark[nlay][k]=0;
251   }
252 }
253 //_____________________________________________________________
254 Double_t AliITStrackU::GetPredictedChi2MI(Double_t cy, Double_t cz, Double_t cerry, Double_t cerrz, Double_t covyz) const
255 {
256   //-----------------------------------------------------------------
257   // This function calculates a predicted chi2 increment.
258   //-----------------------------------------------------------------
259   Double_t p[2]={cy, cz};
260   Double_t cov[3]={cerry*cerry, covyz, cerrz*cerrz};
261   return AliExternalTrackParam::GetPredictedChi2(p,cov);
262 }
263
264 //____________________________________________________________________________
265 Bool_t AliITStrackU::UpdateMI(const AliCluster *c, Double_t chi2, Int_t index) {
266   //------------------------------------------------------------------
267   //This function updates track parameters
268   //------------------------------------------------------------------
269   Double_t dy=c->GetY() - GetY(), dz=c->GetZ() - GetZ();
270   Int_t layer = (index & 0xf0000000) >> 28;
271   fDy[layer] = dy;
272   fDz[layer] = dz;
273   fSigmaY[layer] = TMath::Sqrt(c->GetSigmaY2()+GetSigmaY2());
274   fSigmaZ[layer] = TMath::Sqrt(c->GetSigmaZ2()+GetSigmaZ2());
275   fSigmaYZ[layer] = c->GetSigmaYZ()+GetSigmaZY();
276
277
278   return Update(c,chi2,index);
279 }
280