Data structures for track and clusters
[u/mrichter/AliRoot.git] / HLT / comp / AliL3ModelTrack.cxx
CommitLineData
735e167e 1//$Id$
2
3// Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
4//*-- Copyright &copy ASV
5
6#include <stream.h>
7#include <string.h>
95a00d93 8#include <math.h>
735e167e 9
10#include "AliL3ModelTrack.h"
11#include "AliL3Defs.h"
95a00d93 12#include "AliL3Transform.h"
735e167e 13
14ClassImp(AliL3ModelTrack)
15
16AliL3ModelTrack::AliL3ModelTrack()
17{
18 fNClusters = 0;
19 fClusters = 0;
20 fOverlap = -1;
21 fPad=0;
22 fTime=0;
23 fClusterCharge=0;
95a00d93 24 fTrackModel=0;
735e167e 25}
26
27
28AliL3ModelTrack::~AliL3ModelTrack()
29{
30 if(fClusters)
31 delete [] fClusters;
32 if(fPad)
33 delete [] fPad;
34 if(fTime)
35 delete [] fTime;
95a00d93 36 if(fTrackModel)
37 delete fTrackModel;
735e167e 38}
39
40void AliL3ModelTrack::Init(Int_t slice,Int_t patch)
41{
42 fNClusters = 0;
43 Int_t nrows = NumRows[patch];
95a00d93 44 fClusters = new AliL3ClusterModel[nrows];
45 memset((void*)fClusters,0,nrows*sizeof(AliL3ClusterModel));
735e167e 46
47 fPad = new Float_t[NRowsSlice];
48 fTime = new Float_t[NRowsSlice];
95a00d93 49 fTrackModel = new AliL3TrackModel;
50 memset(fTrackModel,0,sizeof(AliL3TrackModel));
735e167e 51
52 fClusterCharge = 100;
95a00d93 53 AliL3Transform transform;
735e167e 54
95a00d93 55 fXYResidualQ = 0.01/transform.GetPadPitchWidth(patch);
56 fZResidualQ = 0.01/transform.GetPadPitchWidth(patch);
735e167e 57}
58
59
60void AliL3ModelTrack::SetCluster(Float_t fpad,Float_t ftime,Float_t charge,Float_t sigmaY2,Float_t sigmaZ2)
61{
95a00d93 62
63 AliL3ClusterModel *cl = &fClusters[fNClusters];
735e167e 64 if(!charge)
95a00d93 65 cl->fPresent = kFALSE;
735e167e 66 else
67 {
95a00d93 68 cl->fPresent = kTRUE;
69 cl->fDTime = (ftime - GetTimeHit(fNClusters))/fXYResidualQ;
70 cl->fDPad = (fpad - GetPadHit(fNClusters))/fZResidualQ;
71 cl->fDCharge = charge;
72 cl->fDSigmaY2 = sigmaY2;
73 cl->fDSigmaZ2 = sigmaZ2;
735e167e 74 }
95a00d93 75 //cout<<"Pad "<<fpad<<" dtime "<<ftime<<" charge "<<charge<<" sigmaY2 "<<sigmaY2<<" sigmaZ2 "<<sigmaZ2<<endl;
735e167e 76 fNClusters++;
77}
78
95a00d93 79
80
81void AliL3ModelTrack::FillModel()
82{
83 //fTrackModel = new AliL3TrackModel;
84 fTrackModel->fKappa = GetKappa();
85 fTrackModel->fFirstPointX = GetFirstPointX();
86 fTrackModel->fFirstPointY = GetFirstPointY();
87 fTrackModel->fFirstPointZ = GetFirstPointZ();
88 fTrackModel->fTgl = GetTgl();
89 fTrackModel->fPsi = GetPsi();
90 fTrackModel->fLength = GetLength();
91 fTrackModel->fClusterCharge = fClusterCharge;
92 fTrackModel->fNClusters = fNClusters;
93
94}
95
96void AliL3ModelTrack::Print()
97{
98 //Print info
99
100 cout<<"---------------------"<<endl;
101 for(Int_t i=0; i<fNClusters; i++)
102 {
103 AliL3ClusterModel *cl = &fClusters[i];
104 if(!cl->fPresent)
105 cout<<i<<" Empty"<<endl;
106 else
107 {
108 cout<<i<<" Dpad "<<cl->fDPad<<" Dtime "<<cl->fDTime<<" Dcharge "<<cl->fDCharge;
109 cout<<" Padcrossing "<<GetPadHit(i)<<" Timecrossing "<<GetTimeHit(i)<<endl;
110 }
111 }
112}
113
114Bool_t AliL3ModelTrack::GetPadResidual(Int_t row,Float_t &res)
115{
116 res = fClusters[row].fDPad;
117 return fClusters[row].fPresent;
118}
119
120Bool_t AliL3ModelTrack::GetTimeResidual(Int_t row,Float_t &res)
121{
122 res = fClusters[row].fDTime;
123 return fClusters[row].fPresent;
124}
125
126//----------Code below taken from AliTPCTracker.cxx-----------------------
127//Functions that give the expected cluster errors based on track parameters.
128Double_t AliL3ModelTrack::GetParSigmaY2(Double_t r)//, Double_t tgl, Double_t pt)
129{
130
131 //
132 // Parametrised error of the cluster reconstruction (pad direction)
133 //
134 // Sigma rphi
135
136 Double_t tgl = GetTgl();
137 Double_t pt = GetPt();
138
139 const Float_t kArphi=0.41818e-2;
140 const Float_t kBrphi=0.17460e-4;
141 const Float_t kCrphi=0.30993e-2;
142 const Float_t kDrphi=0.41061e-3;
143
144 pt=fabs(pt)*1000.;
145 Double_t x=r/pt;
146 tgl=fabs(tgl);
147 Double_t s=kArphi - kBrphi*r*tgl + kCrphi*x*x + kDrphi*x;
148 if (s<0.4e-3) s=0.4e-3;
149 s*=1.3; //Iouri Belikov
150
151 return s;
152}
153
154Double_t AliL3ModelTrack::GetParSigmaZ2(Double_t r)//, Double_t tgl)
155{
156 //
157 // Parametrised error of the cluster reconstruction (drift direction)
158 //
159 // Sigma z
160
161 Double_t tgl = GetTgl();
162
163 const Float_t kAz=0.39614e-2;
164 const Float_t kBz=0.22443e-4;
165 const Float_t kCz=0.51504e-1;
166
167
168 tgl=fabs(tgl);
169 Double_t s=kAz - kBz*r*tgl + kCz*tgl*tgl;
170 if (s<0.4e-3) s=0.4e-3;
171 s*=1.3; //Iouri Belikov
172
173 return s;
174}