]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITStrackU.cxx
Added version tailored for pp (AliTrackletTaskMultipp) with additional
[u/mrichter/AliRoot.git] / ITS / UPGRADE / 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     fDy[nlay]=0; fDz[nlay]=0; fSigmaY[nlay]=0; fSigmaZ[nlay]=0; fSigmaYZ[nlay]=0;
44     fClIndex[nlay]=-1; 
45     fNy[nlay]=0; fNz[nlay]=0; fNormQ[nlay]=0; fNormChi2[nlay]=1000;
46     SetNumberOfMarked(nlay,0);
47   }
48   ResetMarked();
49 }
50 //_____________________________________
51 AliITStrackU:: AliITStrackU(Int_t nlay) : 
52   AliITStrackV2(),
53   fNLayers(nlay),
54   fNU(0),
55   fExpQ(40)
56 {
57   // Constructor
58   SetNumberOfClusters(0);
59   SetNumberOfClustersU(0);
60   ResetIndexU();
61   for(Int_t nl=0;nl<fgMaxNLayer;nl++){
62     fDy[nl]=0; fDz[nl]=0; fSigmaY[nl]=0; fSigmaZ[nl]=0; fSigmaYZ[nl]=0;
63     fClIndex[nl]=-1;
64     fNy[nl]=0; fNz[nl]=0; fNormQ[nl]=0; fNormChi2[nl]=1000;
65     SetNumberOfMarked(nl,0);
66   }
67   ResetMarked();
68 }
69
70 //_____________________________________________________
71 AliITStrackU::AliITStrackU(AliESDtrack& t,Bool_t c):
72   AliITStrackV2(t,c),
73   fNLayers(0),
74   fNU(0),
75   fExpQ(40)
76 {
77   //------------------------------------------------------------------
78   // Copy a V2 track into a U track
79   // -> to be checked
80   //------------------------------------------------------------------
81
82   for(Int_t nlay=0;nlay<fgMaxNLayer;nlay++){
83     fDy[nlay]=0; fDz[nlay]=0; fSigmaY[nlay]=0; fSigmaZ[nlay]=0; fSigmaYZ[nlay]=0;
84     fClIndex[nlay]=-1; fNy[nlay]=0; fNz[nlay]=0; fNormQ[nlay]=0; fNormChi2[nlay]=1000;  
85   }
86 }
87 //___________________________________________________
88
89 AliITStrackU::AliITStrackU(const AliITStrackU& t, Bool_t trackMI) : 
90   AliITStrackV2(t),
91   fNLayers(t.fNLayers),
92   fNU(t.fNU),
93   fExpQ(t.fExpQ)
94 {
95   // Copy constructor
96
97   ResetIndexU();
98   ResetMarked();
99   Int_t number = t.GetNumberOfClustersU();
100   SetNumberOfClustersU(number);
101   for(Int_t lay=0;lay<fgMaxNLayer;lay++){
102     SetNumberOfMarked(lay,t.GetNumberOfMarked(lay));
103   }
104   for(Int_t i=0;i<number;i++){
105     fSain[i]=t.fSain[i];
106   }
107   for(Int_t nlay=0;nlay<fNLayers;nlay++){
108     for(Int_t i=0;i<t.GetNumberOfMarked(nlay);i++){
109       fCluMark[nlay][i]=t.fCluMark[nlay][i];
110     }
111   }
112   for(Int_t nlay=0;nlay<fgMaxNLayer;nlay++){
113     fDy[nlay]=t.fDy[nlay]; fDz[nlay]=t.fDz[nlay];
114      fSigmaY[nlay]=t.fSigmaY[nlay]; fSigmaZ[nlay]=t.fSigmaZ[nlay]; fSigmaYZ[nlay]=t.fSigmaYZ[nlay];
115     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];
116   } 
117   
118   if(trackMI){
119     fLab = t.fLab;
120     fFakeRatio = t.fFakeRatio;
121   }
122 //  for(Int_t i=0; i<fgMaxNLayer; i++) {fDy[i]=t.fDy[i]; fDz[i]=t.fDz[i];
123 //    fSigmaY[i]=t.fSigmaY[i]; fSigmaZ[i]=t.fSigmaZ[i]; fSigmaYZ[i]=t.fSigmaYZ[i]; 
124 //  }
125 }
126 //____________________________________________________
127 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 ):
128   fNLayers(nlay),
129   fNU(0), 
130   fExpQ(40)
131 {
132   
133   for(Int_t i=0; i<fgMaxNLayer; i++) { fClIndex[i]=-1; fNy[i]=0; fNz[i]=0; fNormQ[i]=0; fNormChi2[i]=1000; }
134   // standard constructor. Used for ITSUpgrade standalone tracking
135
136   // get the azimuthal angle of the detector containing the innermost
137   // cluster of this track (data member fAlpha)
138   for(Int_t i=0; i<fgMaxNLayer; i++) {fDy[i]=0; fDz[i]=0; fSigmaY[i]=0; fSigmaZ[i]=0; fSigmaYZ[i]=0;}
139
140   if (alpha<0) alpha+=TMath::TwoPi();
141   else if (alpha>=TMath::TwoPi()) alpha-=TMath::TwoPi();
142   Init(alpha,radius,Ycoor,Zcoor,phi,tanlambda,curv,lab/*,nlay*/);
143 }
144 //____________________________________________________
145 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*/){
146   // initialize parameters
147   fdEdx = 0;
148   Double_t conv=GetBz()*kB2C;
149   Double_t sC[] = {0.000009, // 0.000009
150                    0.,
151                    0.000003, //0.000030
152                    0.,
153                    0.,
154                    0.000001, //0.000001
155                    0.,
156                    0.,
157                    0.,
158                    0.000002, //0.000002
159                    0.,
160                    0.,
161                    0.,
162                    0.,
163                    0.000001/(conv*conv)}; //0.0000001
164
165   Double_t sP[] = {Ycoor,
166                    Zcoor,
167                    TMath::Sin(phi-alpha),
168                    tanlambda,
169                    curv/conv};
170
171
172   // dealing with the case B=0 (taken from AliTPCtrack.cxx)
173   Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt();
174   Double_t p0=TMath::Sign(1/mostProbablePt,sP[4]);
175   Double_t w0=sC[14]/(sC[14] + p0*p0), w1=p0*p0/(sC[14] + p0*p0);
176   sP[4] = w0*p0 + w1*sP[4];
177   sC[14]*=w1;
178                                                                               
179   Set(radius,alpha,sP,sC);
180
181   for(Int_t i=0; i<fNLayers; i++) fIndex[i] = 0;  // to be set explicitely
182
183   for(Int_t i=0; i<4; i++) fdEdxSample[i] = 0; 
184
185   SetNumberOfClusters(0);
186   SetNumberOfClustersU(0);
187   for(Int_t nl=0;nl<fNLayers;nl++) SetNumberOfMarked(nl,0);
188   ResetIndexU();
189   ResetMarked();
190   SetChi2(0);
191   SetMass(0.139);    // pion mass
192   SetLabel(lab); 
193   
194 }
195
196 //____________________________________________________________
197 void AliITStrackU::AddClusterU(Int_t layer, Int_t clnumb) {
198   // add one clusters to the list (maximum number=kMaxNumberOfClusters)
199   Int_t presnum = GetNumberOfClustersU();
200   if(presnum>=kMaxNumberOfClusters){
201     Warning("AddClusterU","Maximum number of clusters already reached. Nothing is done\n");
202     return;
203   }
204
205   fSain[presnum] = (layer<<28)+clnumb;  
206   presnum++;
207   SetNumberOfClustersU(presnum);
208 }
209
210 //____________________________________________________________
211 void AliITStrackU::AddClusterMark(Int_t layer, Int_t clnumb) {
212   // add one clusters to the list (maximum number=kMaxNumberOfClusters)
213   Int_t presnum = GetNumberOfMarked(layer);
214   //printf("presnum=%d\n",presnum);
215   if(presnum>=kMaxNumberOfClustersL){
216     Warning("AddClusterMark","Maximum number of clusters already reached. Nothing is done\n");
217     return;
218   }
219
220   fCluMark[layer][presnum] = clnumb;  
221   presnum++;
222   SetNumberOfMarked(layer,presnum);
223 }
224
225 //____________________________________________________________
226 void AliITStrackU::AddClusterV2(Int_t layer,Int_t clnumb) {
227   // add one clusters to the list (maximum number=6)
228   Int_t presnum = GetNumberOfClusters();
229   if(presnum>=fNLayers){
230     Warning("AddClusterV2","Maximum number of clusters already reached. Nothing is done\n");
231     return;
232   }    
233
234   fIndex[presnum] = (layer<<28)+clnumb;  
235   presnum++;
236   SetNumberOfClusters(presnum);
237 }
238
239 //_____________________________________________________________
240 void AliITStrackU::ResetMarked(){
241
242   //Reset array of marked clusters
243   for(Int_t nlay=0;nlay<fNLayers;nlay++){
244     for(Int_t k=0; k<kMaxNumberOfClustersL; k++) fCluMark[nlay][k]=0;
245   }
246 }
247 //_____________________________________________________________
248 Double_t AliITStrackU::GetPredictedChi2MI(Double_t cy, Double_t cz, Double_t cerry, Double_t cerrz, Double_t covyz) const
249 {
250   //-----------------------------------------------------------------
251   // This function calculates a predicted chi2 increment.
252   //-----------------------------------------------------------------
253   Double_t p[2]={cy, cz};
254   Double_t cov[3]={cerry*cerry, covyz, cerrz*cerrz};
255   return AliExternalTrackParam::GetPredictedChi2(p,cov);
256 }
257
258 //____________________________________________________________________________
259 Bool_t AliITStrackU::UpdateMI(const AliCluster *c, Double_t chi2, Int_t index) {
260   //------------------------------------------------------------------
261   //This function updates track parameters
262   //------------------------------------------------------------------
263   Double_t dy=c->GetY() - GetY(), dz=c->GetZ() - GetZ();
264   Int_t layer = (index & 0xf0000000) >> 28;
265   fDy[layer] = dy;
266   fDz[layer] = dz;
267   fSigmaY[layer] = TMath::Sqrt(c->GetSigmaY2()+GetSigmaY2());
268   fSigmaZ[layer] = TMath::Sqrt(c->GetSigmaZ2()+GetSigmaZ2());
269   fSigmaYZ[layer] = c->GetSigmaYZ()+GetSigmaZY();
270
271
272   return Update(c,chi2,index);
273 }
274