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 **************************************************************************/
17 // This class stores a tracklet (a track that lives only in a single TPC
18 // sector). Its objects can be constructed out of TPCseeds, that are
19 // holding the necessary cluster information.
25 #include "AliTPCTracklet.h"
26 #include "TObjArray.h"
27 #include "AliTPCseed.h"
28 #include "AliESDVertex.h"
30 ClassImp(AliTPCTracklet)
32 AliTPCTracklet::AliTPCTracklet()
33 : fNClusters(0),fSector(-1),fOuter(0),fInner(0),fPrimary(0) {
35 // The default constructor. It is intended to be used for I/O only.
39 AliTPCTracklet::AliTPCTracklet(const AliTPCseed *track,Int_t sector)
40 : fNClusters(0),fSector(sector),fOuter(0),fInner(0),fPrimary(0) {
42 // Contructor for a tracklet out of a track. Only clusters within a given
46 AliTPCseed *t=new AliTPCseed(*track);
48 if (!t->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-t->GetAlpha())) {
53 // fit from inner to outer row
54 AliTPCseed *outerSeed=new AliTPCseed(*t);
56 for (Int_t i=0;i<160;++i) {
57 AliTPCclusterMI *c=t->GetClusterPointer(i);
58 if (c&&c->GetDetector()==sector) {
60 outerSeed->ResetCovariance(100.);
63 Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()};
64 Double_t cov[3]={0.1,0.,0.1}; //TODO: correct error parametrisation
65 if (!outerSeed->PropagateTo(r[0])
66 || !static_cast<AliExternalTrackParam*>(outerSeed)->Update(&r[1],cov)) {
75 fOuter=new AliExternalTrackParam(*outerSeed);
77 // fit from outer to inner rows
78 AliTPCseed *innerSeed=new AliTPCseed(*t);
80 for (Int_t i=159;i>=0;--i) {
81 AliTPCclusterMI *c=t->GetClusterPointer(i);
82 if (c&&c->GetDetector()==sector) {
84 innerSeed->ResetCovariance(100.);
87 Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()};
88 Double_t cov[3]={0.1,0.,0.1};
89 if (!innerSeed->PropagateTo(r[0])
90 || !static_cast<AliExternalTrackParam*>(innerSeed)->Update(&r[1],cov)) {
97 fNClusters=TMath::Max(fNClusters,n);
99 fInner=new AliExternalTrackParam(*outerSeed);
100 // propagate to the primary vertex
102 AliTPCseed *primarySeed=new AliTPCseed(*innerSeed);
103 Double_t pos[]={0.,0.,0.};
104 Double_t sigma[]={.1,.1,.1}; //TODO: is this correct?
105 AliESDVertex vertex(pos,sigma);
106 if (primarySeed->PropagateToVertex(&vertex))
107 fPrimary=new AliExternalTrackParam(*primarySeed);
112 if (!fOuter&&!fInner)
118 AliTPCTracklet::AliTPCTracklet(const AliTPCTracklet &t)
119 : fNClusters(t.fNClusters),fSector(t.fSector),fOuter(0),fInner(0),
122 // The copy constructor. You can copy tracklets!
126 fOuter=new AliExternalTrackParam(*t.fOuter);
128 fInner=new AliExternalTrackParam(*t.fInner);
130 fPrimary=new AliExternalTrackParam(*t.fPrimary);
133 AliTPCTracklet& AliTPCTracklet::operator=(const AliTPCTracklet &t) {
135 // The assignment constructor. You can assign tracklets!
137 fNClusters=t.fNClusters;
144 fOuter=new AliExternalTrackParam(*t.fOuter);
155 fInner=new AliExternalTrackParam(*t.fInner);
164 *fPrimary=*t.fPrimary;
166 fPrimary=new AliExternalTrackParam(*t.fPrimary);
176 AliTPCTracklet::~AliTPCTracklet() {
178 // The destructor. Yes, you can even destruct tracklets.
185 TObjArray AliTPCTracklet::CreateTracklets(const AliTPCseed *s,
187 Int_t maxTracklets) {
188 // The tracklet factory: It creates several tracklets out of a track. They
189 // are created for sectors that fullfill the constraint of having enough
190 // clusters inside. Futhermore you can specify the maximum amount of
191 // tracklets that are to be created.
192 // The tracklets appear in a sorted fashion, beginning with those having the
195 Int_t sectors[72]={0};
196 for (Int_t i=0;i<160;++i) {
197 AliTPCclusterMI *c=s->GetClusterPointer(i);
199 ++sectors[c->GetDetector()];
202 TMath::Sort(72,sectors,indices);
204 if (maxTracklets>72) maxTracklets=72; // just to protect against "users".
205 for (Int_t i=0;i<maxTracklets&§ors[indices[i]]>=minClusters;++i) {
206 tracklets.Add(new AliTPCTracklet(s,indices[i]));