1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
23 // Alex Bercuci <A.Bercuci@gsi.de> //
24 // Markus Fasel <M.Fasel@gsi.de> //
26 ///////////////////////////////////////////////////////////////////////////////
28 #include "AliTRDtrackV1.h"
29 #include "AliTRDcluster.h"
30 #include "AliTRDcalibDB.h"
31 #include "AliTRDrecoParam.h"
33 #include "AliESDtrack.h"
35 ClassImp(AliTRDtrackV1)
38 //_______________________________________________________________
39 AliTRDtrackV1::AliTRDtrackV1() :
44 // Default constructor
47 for(int ip=0; ip<6; ip++){
48 fTrackletIndex[ip] = -1;
49 fTracklet[ip].Reset();
53 //_______________________________________________________________
54 AliTRDtrackV1::AliTRDtrackV1(const AliESDtrack &t) :
59 // Standard constructor
62 //AliInfo(Form("alpha %f", GetAlpha()));
63 t.GetTRDtracklets(&fTrackletIndex[0]);
64 for(int ip=0; ip<6; ip++) fTracklet[ip].Reset();
67 //_______________________________________________________________
68 AliTRDtrackV1::AliTRDtrackV1(const AliTRDtrackV1 &t) :
78 //_______________________________________________________________
79 // AliTRDtrackV1::~AliTRDtrackV1()
85 //_______________________________________________________________
86 AliTRDtrackV1::AliTRDtrackV1(AliTRDseedV1 *trklts, const Double_t p[5], const Double_t cov[15], Double_t x, Double_t alpha) :
90 // The stand alone tracking constructor
91 // TEMPORARY !!!!!!!!!!!
93 // 1. covariance matrix
94 // 2. dQdl calculation
97 Double_t cnv = 1.0 / (GetBz() * kB2C);
99 Double_t pp[5] = { p[0]
105 Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[ 5];
106 Double_t c32 = x*cov[13] - cov[ 8];
107 Double_t c20 = x*cov[10] - cov[ 3];
108 Double_t c21 = x*cov[11] - cov[ 4];
109 Double_t c42 = x*cov[14] - cov[12];
111 Double_t cc[15] = { cov[ 0]
114 , cov[ 6], cov[ 7], c32, cov[ 9]
115 , cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv };
118 Double_t s = GetSnp();
119 Double_t t = GetTgl();
121 Int_t ncl = 0, nclPlane; AliTRDcluster *c = 0x0;
122 for(int iplane=0; iplane<6; iplane++){
123 fTrackletIndex[iplane] = -1;
124 fTracklet[iplane] = trklts[iplane];
126 for(int ic = 0; ic<AliTRDseed::knTimebins; ic++){
127 if(!fTracklet[iplane].IsUsable(ic)) continue;
128 if(!(c = fTracklet[iplane].GetClusters(ic))) continue;
130 fIndex[ncl] = fTracklet[iplane].GetIndexes(ic);
131 Double_t q = TMath::Abs(c->GetQ());
134 // This is not correctly. Has to be updated in the AliTRDtrackerV1::FollowBackProlonagation()
135 fdQdl[ncl] = q * (s*s < 1.) ? TMath::Sqrt((1-s*s)/(1+t*t)) : 1.;
139 //printf("%d N clusters plane %d [%d %d].\n", iplane, nclPlane, fTracklet[iplane].GetN2(), trklts[iplane].GetN());
141 //printf("N clusters in AliTRDtrackV1 %d.\n", ncl);
142 SetNumberOfClusters(ncl);
145 //_______________________________________________________________
146 Bool_t AliTRDtrackV1::CookPID()
148 // CookdEdx(); // truncated mean ... do we still need it ?
150 // CookdEdxTimBin(seed->GetID());
151 for(int itrklt=0; itrklt<6; itrklt++){
152 for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) fdEdxPlane[itrklt][iSlice] = -1.;
154 if(fTrackletIndex[itrklt]<0) continue;
155 fTracklet[itrklt].CookdEdx(fdEdxPlane[itrklt]);
158 // retrive calibration db
159 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
161 AliError("No access to calibration data");
165 // Retrieve the CDB container class with the parametric detector response
166 const AliTRDCalPID *pd = calibration->GetPIDObject(0/*fRecoParam->GetPIDMethod()*/);
168 AliError("No access to AliTRDCalPID object");
178 //_______________________________________________________________
179 Double_t AliTRDtrackV1::GetPredictedChi2(const AliTRDseedV1 *trklt) const
182 // Returns the predicted chi2
185 Double_t x = trklt->GetX0();
186 Double_t p[2] = { trklt->GetYat(x)
187 , trklt->GetZat(x) };
189 trklt->GetCovAt(x, cov);
191 return AliExternalTrackParam::GetPredictedChi2(p, cov);
195 //_______________________________________________________________
196 void AliTRDtrackV1::SetTracklet(AliTRDseedV1 *trklt, Int_t plane, Int_t index)
199 // Sets the tracklets
202 if(plane < 0 || plane >=6) return;
203 fTracklet[plane] = (*trklt);
204 fTrackletIndex[plane] = index;
207 //_______________________________________________________________
208 Bool_t AliTRDtrackV1::Update(const AliTRDseedV1 *trklt, Double_t chisq)
214 Double_t x = trklt->GetX0();
215 Double_t p[2] = { trklt->GetYat(x)
216 , trklt->GetZat(x) };
218 trklt->GetCovAt(x, cov);
221 // AliInfo(Form("cov[%f %f %f]", cov[0], cov[1], cov[2]));
223 if(!AliExternalTrackParam::Update(p, cov)) return kFALSE;
226 // Register info to track
227 // Int_t n = GetNumberOfClusters();
228 // fIndex[n] = index;
230 SetNumberOfClusters(GetNumberOfClusters()+trklt->GetN());
231 SetChi2(GetChi2() + chisq);
236 //_______________________________________________________________
237 void AliTRDtrackV1::UpdateESDdEdx(AliESDtrack *track)
240 // Update the dedx info
243 for (Int_t i = 0; i < AliESDtrack::kNPlane; i++) {
244 for (Int_t j = 0; j < AliESDtrack::kNSlice; j++) {
245 track->SetTRDsignals(fdEdxPlane[i][j], i, j);
247 track->SetTRDTimBin(fTimBinPlane[i], i);