]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/ITS/AliHLTITStracker.cxx
adding initialization
[u/mrichter/AliRoot.git] / HLT / ITS / AliHLTITStracker.cxx
1 // $Id$
2
3 /**************************************************************************
4  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  *                                                                        *
6  * Author: The ALICE Off-line Project.                                    *
7  * Contributors are mentioned in the code where appropriate.              *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 //-------------------------------------------------------------------------
19 //               Implementation of the HLT ITS tracker class
20 //    It reads AliITSclusterV2 clusters and HLT ESD tracks and creates 
21 //    AliITStrackV2 tracks. For details, see also RunHLTITS.C macro.
22 //          Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
23 //-------------------------------------------------------------------------
24
25 #include "AliESDEvent.h"
26 #include "AliESDtrack.h"
27 #include "AliHLTITStrack.h"
28 #include "AliHLTITStracker.h"
29
30 ClassImp(AliHLTITStracker)
31
32 static Int_t CorrectForDeadZoneMaterial(AliITStrackV2 *t) {
33   //--------------------------------------------------------------------
34   // Correction for the material between the TPC and the ITS
35   // (should it belong to the TPC code ?)
36   //--------------------------------------------------------------------
37   Double_t riw=80., diw=0.0053, x0iw=30; // TPC inner wall ? 
38   Double_t rcd=61., dcd=0.0053, x0cd=30; // TPC "central drum" ?
39   Double_t yr=12.8, dr=0.03; // rods ?
40   Double_t zm=0.2, dm=0.40;  // membrane
41   //Double_t rr=52., dr=0.19, x0r=24., yyr=7.77; //rails
42   Double_t rs=50., ds=0.001; // something belonging to the ITS (screen ?)
43
44   if (t->GetX() > riw) {
45      if (!t->PropagateTo(riw,diw,x0iw)) return 1;
46      if (TMath::Abs(t->GetY())>yr) t->CorrectForMaterial(dr);
47      if (TMath::Abs(t->GetZ())<zm) t->CorrectForMaterial(dm);
48      if (!t->PropagateTo(rcd,dcd,x0cd)) return 1;
49      //Double_t x,y,z; t->GetGlobalXYZat(rr,x,y,z);
50      //if (TMath::Abs(y)<yyr) t->PropagateTo(rr,dr,x0r); 
51      if (!t->PropagateTo(rs,ds)) return 1;
52   } else if (t->GetX() < rs) {
53      if (!t->PropagateTo(rs,-ds)) return 1;
54      //Double_t x,y,z; t->GetGlobalXYZat(rr,x,y,z);
55      //if (TMath::Abs(y)<yyr) t->PropagateTo(rr,-dr,x0r); 
56      if (!t->PropagateTo(rcd,-dcd,x0cd)) return 1;
57      if (!t->PropagateTo(riw+0.001,-diw,x0iw)) return 1;
58   } else {
59     //    ::Error("CorrectForDeadZoneMaterial","track is already in the dead zone !");
60     return 1;
61   }
62   
63   return 0;
64 }
65
66 Int_t AliHLTITStracker::Clusters2Tracks(AliESDEvent *event) {
67   //--------------------------------------------------------------------
68   // This functions reconstructs HLT ITS tracks
69   //--------------------------------------------------------------------
70   TObjArray itsTracks(15000);
71
72   {/* Read HLT ESD tracks */
73     Int_t nentr;
74     nentr=event->GetNumberOfTracks();
75     Info("Clusters2Tracks", "Number of ESD HLT tracks: %d\n", nentr);
76     while (nentr--) {
77
78       AliESDtrack *esd=event->GetTrack(nentr);
79
80       AliHLTITStrack *t=0;
81       try {
82         t=new AliHLTITStrack(*esd);
83       } catch (const Char_t *msg) {
84         Warning("Clusters2Tracks",msg);
85         delete t;
86         continue;
87       }
88       if (TMath::Abs(t->GetD(GetX(),GetY()))>5) {
89         delete t;
90         continue;
91       }
92
93       if (CorrectForDeadZoneMaterial(t)!=0) {
94         Warning("Clusters2Tracks",
95                 "failed to correct for the material in the dead zone !\n");
96         delete t;
97         continue;
98       }
99       itsTracks.AddLast(t);
100     }
101   } /* End Read HLT ESD tracks */
102
103   itsTracks.Sort();
104   Int_t nentr=itsTracks.GetEntriesFast();
105   Info("Clusters2Tracks", "Number of Selected for tracking HLT ESD tracks: %d\n", nentr);
106
107   Int_t ntrk=0;
108   for (fPass=0; fPass<2; fPass++) {
109      Int_t &constraint=fConstraint[fPass]; if (constraint<0) continue;
110      for (Int_t i=0; i<nentr; i++) {
111        AliHLTITStrack *t=(AliHLTITStrack*)itsTracks.UncheckedAt(i);
112        if (t==0) continue;              //this track has been already tracked
113        Int_t tpcLabel=t->GetLabel(); //save the TPC track label
114        ResetTrackToFollow(*t);
115        ResetBestTrack();
116
117        for (FollowProlongation(); fI<AliITSgeomTGeo::GetNLayers(); fI++) {
118          while (TakeNextProlongation()) FollowProlongation();
119        }
120
121        if (fBestTrack.GetNumberOfClusters() == 0) continue;
122        
123        if (fConstraint[fPass]) {
124          ResetTrackToFollow(*t);
125          if (!RefitAt(3.7, &fTrackToFollow, &fBestTrack)) continue;
126          ResetBestTrack();
127        }
128        
129        if (!fBestTrack.PropagateTo(3.,0.0028,65.19)) continue;
130        if (!fBestTrack.PropagateToVertex(event->GetVertex())) continue;
131        fBestTrack.SetLabel(tpcLabel);
132        fBestTrack.CookdEdx();
133        CookLabel(&fBestTrack,0.); //For comparison only
134        fBestTrack.UpdateESDtrack(AliESDtrack::kITSin);
135        {
136        AliESDtrack  *esdTrack =fBestTrack.GetESDtrack();
137        Double_t r[3]={0.,0.,0.};
138        Double_t maxD=3.;
139        esdTrack->RelateToVertex(event->GetVertex(),GetBz(r),maxD);
140        }
141        UseClusters(&fBestTrack);
142        delete itsTracks.RemoveAt(i);
143        ntrk++;
144      }
145   }
146
147   itsTracks.Delete();
148
149   Info("Clusters2Tracks","Number of prolonged tracks: %d\n",ntrk);
150
151   return 0;
152 }
153
154 Int_t AliHLTITStracker::PropagateBack(AliESDEvent *event) {
155   //--------------------------------------------------------------------
156   // This functions propagates reconstructed ITS tracks back
157   //--------------------------------------------------------------------
158   Int_t nentr=event->GetNumberOfTracks();
159   Info("PropagateBack", "The method is not yet implemented! %d\n", nentr);
160   return 0;
161 }
162
163 Int_t AliHLTITStracker::RefitInward(AliESDEvent *event) {
164   //--------------------------------------------------------------------
165   // This functions refits ITS tracks using the 
166   // "inward propagated" TPC tracks
167   //--------------------------------------------------------------------
168
169   Int_t nentr=event->GetNumberOfTracks();
170   Info("RefitInward", "The method is not yet implemented! %d",nentr);
171   return 0;
172 }