AddTaskFemto for train update
[u/mrichter/AliRoot.git] / ITS / AliITStrackSA.cxx
CommitLineData
13918578 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 **************************************************************************/
bf6adc12 15
16/* $Id$ */
17
13918578 18////////////////////////////////////////////////////
19// Stand alone track class //
20// Origin: Elisabetta Crescio //
21// e-mail: crescio@to.infn.it //
22// it is a V2 track with a possible number //
deae0246 23// of cluster equal to kMaxNumberOfClusters //
13918578 24////////////////////////////////////////////////////
25
cc088660 26#include "AliITSgeomTGeo.h"
13918578 27#include "AliITStrackSA.h"
28
29
30ClassImp(AliITStrackSA)
31
32//_____________________________________
e399f961 33AliITStrackSA:: AliITStrackSA() : AliITStrackMI(),
34fNSA(0)
35{
13918578 36// Default constructor
37 SetNumberOfClusters(0);
38 SetNumberOfClustersSA(0);
39 ResetIndexSA();
e50912db 40 for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
7e5bf5af 41 SetNumberOfMarked(nlay,0);
42 }
43 ResetMarked();
13918578 44}
45
46
47//___________________________________________________
15dd636f 48AliITStrackSA::AliITStrackSA(const AliITStrackMI& t) :
e399f961 49AliITStrackMI(t),
50fNSA(0){
13918578 51// Copy a V2 track into a SA track
52 SetNumberOfClustersSA(0);
53 ResetIndexSA();
e50912db 54 for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
7e5bf5af 55 SetNumberOfMarked(nlay,0);
56 }
57 ResetMarked();
58
13918578 59}
60//___________________________________________________
61AliITStrackSA::AliITStrackSA(const AliITStrackSA& t) :
e399f961 62AliITStrackMI(t),
63fNSA(t.fNSA){
13918578 64// Copy constructor
65
7d62fb64 66
13918578 67 ResetIndexSA();
7e5bf5af 68 ResetMarked();
13918578 69 Int_t number = t.GetNumberOfClustersSA();
70 SetNumberOfClustersSA(number);
e50912db 71 for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
7e5bf5af 72 SetNumberOfMarked(nlay,t.GetNumberOfMarked(nlay));
73 }
13918578 74 for(Int_t i=0;i<number;i++){
75 fSain[i]=t.fSain[i];
76 }
e50912db 77 for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
7e5bf5af 78 for(Int_t i=0;i<t.GetNumberOfMarked(nlay);i++){
79 fCluMark[nlay][i]=t.fCluMark[nlay][i];
80 }
81 }
13918578 82}
83//____________________________________________________
cc088660 84AliITStrackSA::AliITStrackSA(Int_t layer, Int_t ladder, Int_t detector, Double_t Ycoor, Double_t Zcoor, Double_t phi, Double_t tanlambda, Double_t curv, Int_t lab ):
e399f961 85fNSA(0)
86{
13918578 87 // standard constructor. Used for ITS standalone tracking
7d62fb64 88
13918578 89 // get the azimuthal angle of the detector containing the innermost
90 // cluster of this track (data member fAlpha)
13918578 91
55d316db 92 TGeoHMatrix m; AliITSgeomTGeo::GetOrigMatrix(layer,ladder,detector,m);
93 const TGeoHMatrix *tm=AliITSgeomTGeo::GetTracking2LocalMatrix(layer,ladder,detector);
94 m.Multiply(tm);
95 Double_t txyz[3]={0.}, xyz[3]={0.};
96 m.LocalToMaster(txyz,xyz);
97 Double_t sAlpha=TMath::ATan2(xyz[1],xyz[0]);
98
99 if (sAlpha<0) sAlpha+=TMath::TwoPi();
100 else if (sAlpha>=TMath::TwoPi()) sAlpha-=TMath::TwoPi();
101
102 Double_t sX=TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]);
13918578 103
54e5c32c 104 Init(sAlpha,sX,Ycoor,Zcoor,phi,tanlambda,curv,lab);
105
106}
107//____________________________________________________
108AliITStrackSA::AliITStrackSA(Double_t alpha, Double_t radius, Double_t Ycoor, Double_t Zcoor, Double_t phi, Double_t tanlambda, Double_t curv, Int_t lab ):
109fNSA(0)
110{
111 // standard constructor. Used for ITS standalone tracking
112
113 // get the azimuthal angle of the detector containing the innermost
114 // cluster of this track (data member fAlpha)
115
116 if (alpha<0) alpha+=TMath::TwoPi();
117 else if (alpha>=TMath::TwoPi()) alpha-=TMath::TwoPi();
118 Init(alpha,radius,Ycoor,Zcoor,phi,tanlambda,curv,lab);
119}
120//____________________________________________________
121 void AliITStrackSA::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 ){
122 // initialize parameters
123
13918578 124 fdEdx = 0;
125
6c94f330 126 Double_t conv=GetBz()*kB2C;
127 Double_t sC[] = {0.000009, // 0.000009
128 0.,
129 0.000003, //0.000030
130 0.,
131 0.,
132 0.000001, //0.000001
133 0.,
134 0.,
135 0.,
136 0.000002, //0.000002
137 0.,
138 0.,
139 0.,
140 0.,
141 0.000001/(conv*conv)}; //0.0000001
142
143 Double_t sP[] = {Ycoor,
144 Zcoor,
54e5c32c 145 TMath::Sin(phi-alpha),
6c94f330 146 tanlambda,
147 curv/conv};
148
1966f03c 149
150 // dealing with the case B=0 (taken from AliTPCtrack.cxx)
0e7590c3 151 Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt();
152 Double_t p0=TMath::Sign(1/mostProbablePt,sP[4]);
1966f03c 153 Double_t w0=sC[14]/(sC[14] + p0*p0), w1=p0*p0/(sC[14] + p0*p0);
154 sP[4] = w0*p0 + w1*sP[4];
155 sC[14]*=w1;
156
54e5c32c 157 Set(radius,alpha,sP,sC);
6c94f330 158
e50912db 159 for(Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fIndex[i] = 0; // to be set explicitely
13918578 160
161 for(Int_t i=0; i<4; i++) fdEdxSample[i] = 0;
162
163 SetNumberOfClusters(0);
164 SetNumberOfClustersSA(0);
e50912db 165 for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++) SetNumberOfMarked(nlay,0);
13918578 166 ResetIndexSA();
7e5bf5af 167 ResetMarked();
13918578 168 SetChi2(0);
169 SetMass(0.139); // pion mass
170 SetLabel(lab);
171
172}
173
174//____________________________________________________________
175void AliITStrackSA::AddClusterSA(Int_t layer, Int_t clnumb) {
deae0246 176 // add one clusters to the list (maximum number=kMaxNumberOfClusters)
13918578 177 Int_t presnum = GetNumberOfClustersSA();
deae0246 178 if(presnum>=kMaxNumberOfClusters){
13918578 179 Warning("AddClusterSA","Maximum number of clusters already reached. Nothing is done\n");
180 return;
181 }
182
183 fSain[presnum] = (layer<<28)+clnumb;
184 presnum++;
185 SetNumberOfClustersSA(presnum);
186}
187
188//____________________________________________________________
7e5bf5af 189void AliITStrackSA::AddClusterMark(Int_t layer, Int_t clnumb) {
deae0246 190 // add one clusters to the list (maximum number=kMaxNumberOfClusters)
7e5bf5af 191 Int_t presnum = GetNumberOfMarked(layer);
192 // printf("presnum=%d\n",presnum);
deae0246 193 if(presnum>=kMaxNumberOfClustersL){
7e5bf5af 194 Warning("AddClusterMark","Maximum number of clusters already reached. Nothing is done\n");
195 return;
196 }
197
198 fCluMark[layer][presnum] = clnumb;
199 presnum++;
200 SetNumberOfMarked(layer,presnum);
201}
202
203//____________________________________________________________
13918578 204void AliITStrackSA::AddClusterV2(Int_t layer,Int_t clnumb) {
205 // add one clusters to the list (maximum number=6)
206 Int_t presnum = GetNumberOfClusters();
e50912db 207 if(presnum>=AliITSgeomTGeo::GetNLayers()){
13918578 208 Warning("AddClusterV2","Maximum number of clusters already reached. Nothing is done\n");
209 return;
210 }
211
212 fIndex[presnum] = (layer<<28)+clnumb;
213 presnum++;
214 SetNumberOfClusters(presnum);
215}
216
7e5bf5af 217//_____________________________________________________________
218void AliITStrackSA::ResetMarked(){
13918578 219
7e5bf5af 220 //Reset array of marked clusters
e50912db 221 for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
deae0246 222 for(Int_t k=0; k<kMaxNumberOfClustersL; k++) fCluMark[nlay][k]=0;
7e5bf5af 223 }
224}
13918578 225