]>
Commit | Line | Data |
---|---|---|
e10815f1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // high level filter algorithm for TPC using a hough transformation // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
e10815f1 | 24 | #include <TStopwatch.h> |
25 | ||
26 | #include "AliL3StandardIncludes.h" | |
27 | #include "AliL3Logging.h" | |
28 | #include "AliL3Transform.h" | |
29 | #include "AliL3Hough.h" | |
30 | #include "AliLog.h" | |
d6186083 | 31 | #include <AliL3ITSclusterer.h> |
32 | #include <AliL3ITSVertexerZ.h> | |
33 | #include <AliL3ITStracker.h> | |
e10815f1 | 34 | |
35 | #include "AliHoughFilter.h" | |
36 | ||
d6186083 | 37 | #include "AliRawReaderRoot.h" |
38 | #include <AliMagF.h> | |
39 | #include <AliMagFMaps.h> | |
40 | #include <AliKalmanTrack.h> | |
41 | #include <AliITSgeom.h> | |
e10815f1 | 42 | |
43 | ClassImp(AliHoughFilter) | |
44 | ||
45 | //_____________________________________________________________________________ | |
46 | AliHoughFilter::AliHoughFilter() | |
47 | { | |
48 | // default constructor | |
49 | ||
d6186083 | 50 | // Init debug level |
e10815f1 | 51 | AliL3Log::fgLevel = AliL3Log::kError; |
52 | if (AliDebugLevel() > 0) AliL3Log::fgLevel = AliL3Log::kWarning; | |
53 | if (AliDebugLevel() > 1) AliL3Log::fgLevel = AliL3Log::kInformational; | |
54 | if (AliDebugLevel() > 2) AliL3Log::fgLevel = AliL3Log::kDebug; | |
d6186083 | 55 | |
56 | // Init TPC HLT geometry | |
57 | const char *path = gSystem->Getenv("ALICE_ROOT"); | |
58 | Char_t pathname[1024]; | |
59 | strcpy(pathname,path); | |
60 | strcat(pathname,"/HLT/src"); | |
61 | if (!AliL3Transform::Init(pathname, kFALSE)) | |
e10815f1 | 62 | AliError("HLT initialization failed!"); |
d6186083 | 63 | |
64 | // Init magnetic field | |
65 | AliKalmanTrack::SetConvConst( | |
66 | 1000/0.299792458/AliL3Transform::GetSolenoidField() | |
67 | ); | |
68 | AliMagF* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG); | |
69 | AliTracker::SetFieldMap(field); | |
70 | fPtmin = 0.1*AliL3Transform::GetSolenoidField(); | |
71 | ||
72 | // Init ITS geometry | |
73 | fITSgeom = new AliITSgeom(); | |
74 | fITSgeom->ReadNewFile("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det"); | |
75 | if (!fITSgeom) | |
76 | AliError("ITS geometry not found!"); | |
77 | ||
c27411e7 | 78 | // Init PID |
79 | AliPID pid; | |
e10815f1 | 80 | } |
81 | ||
82 | //_____________________________________________________________________________ | |
83 | Bool_t AliHoughFilter::Filter(AliRawEvent* event, AliESD* esd) | |
84 | { | |
d6186083 | 85 | // Run fast online reconstruction |
86 | // based on the HLT tracking algorithms | |
87 | ||
88 | TStopwatch globaltimer; | |
89 | globaltimer.Start(); | |
90 | ||
d6186083 | 91 | TStopwatch timer; |
92 | timer.Start(); | |
93 | ||
94 | TTree *treeITSclusters = new TTree("TreeL3ITSclusters"," "); //make a tree | |
79eedd0f | 95 | treeITSclusters->SetDirectory(0); |
96 | ||
d6186083 | 97 | RunITSclusterer(event,treeITSclusters); |
98 | RunITSvertexer(esd,treeITSclusters); | |
99 | RunTPCtracking(event,esd); | |
100 | RunITStracking(esd,treeITSclusters); | |
101 | delete treeITSclusters; | |
102 | ||
d6186083 | 103 | AliInfo(Form("Event filter has finished in %f seconds\n\n\n\n\n\n",globaltimer.RealTime())); |
104 | ||
105 | return kTRUE; | |
106 | } | |
107 | ||
108 | //_____________________________________________________________________________ | |
109 | void AliHoughFilter::RunITSclusterer(AliRawEvent* event, TTree *treeClusters) | |
110 | { | |
111 | // Run ITS Clusterer | |
112 | // The clusters are stored in a tree | |
113 | ||
114 | TStopwatch timer; | |
115 | timer.Start(); | |
116 | ||
117 | if(!fITSgeom) | |
118 | AliError("ITS geometry not created!"); | |
119 | AliL3ITSclusterer clusterer(fITSgeom); | |
120 | AliRawReader *itsrawreader=new AliRawReaderRoot(event); | |
121 | clusterer.Digits2Clusters(itsrawreader,treeClusters); | |
122 | delete itsrawreader; | |
123 | AliInfo(Form("ITS clusterer has finished in %f seconds\n",timer.RealTime())); | |
124 | ||
125 | } | |
126 | ||
127 | ||
128 | //_____________________________________________________________________________ | |
129 | void AliHoughFilter::RunITSvertexer(AliESD* esd, TTree *treeClusters) | |
130 | { | |
131 | // Run SPD vertexerZ | |
132 | // Store the result in the ESD | |
133 | ||
134 | TStopwatch timer; | |
135 | timer.Start(); | |
e10815f1 | 136 | |
d6186083 | 137 | AliL3ITSVertexerZ vertexer; |
138 | AliESDVertex *vertex = vertexer.FindVertexForCurrentEvent(fITSgeom,treeClusters); | |
139 | esd->SetVertex(vertex); | |
140 | AliInfo(Form("ITS vertexer has finished in %f seconds\n",timer.RealTime())); | |
141 | ||
142 | } | |
143 | ||
144 | //_____________________________________________________________________________ | |
145 | void AliHoughFilter::RunTPCtracking(AliRawEvent* event, AliESD* esd) | |
146 | { | |
147 | // Run hough transform tracking in TPC | |
148 | // The z of the vertex is taken from the ESD | |
149 | // The result of the tracking is stored in the ESD | |
e10815f1 | 150 | TStopwatch timer; |
151 | timer.Start(); | |
152 | ||
d6186083 | 153 | const AliESDVertex *vertex = esd->GetVertex(); |
154 | Float_t zvertex = vertex->GetZv(); | |
e10815f1 | 155 | |
156 | AliL3Hough *hough1 = new AliL3Hough(); | |
157 | ||
158 | hough1->SetThreshold(4); | |
d6186083 | 159 | hough1->CalcTransformerParams(fPtmin); |
e10815f1 | 160 | hough1->SetPeakThreshold(70,-1); |
d6186083 | 161 | hough1->Init(100,4,event,zvertex); |
e10815f1 | 162 | hough1->SetAddHistograms(); |
163 | ||
164 | AliL3Hough *hough2 = new AliL3Hough(); | |
d6186083 | 165 | |
e10815f1 | 166 | hough2->SetThreshold(4); |
d6186083 | 167 | hough2->CalcTransformerParams(fPtmin); |
e10815f1 | 168 | hough2->SetPeakThreshold(70,-1); |
d6186083 | 169 | hough2->Init(100,4,event,zvertex); |
e10815f1 | 170 | hough2->SetAddHistograms(); |
171 | ||
172 | Int_t nglobaltracks = 0; | |
173 | /* In case we run HLT code in 2 threads */ | |
174 | hough1->StartProcessInThread(0,17); | |
175 | hough2->StartProcessInThread(18,35); | |
176 | ||
177 | if(hough1->WaitForThreadFinish()) | |
d6186083 | 178 | ::Fatal("AliL3Hough::WaitForThreadFinish"," Can not join the required thread! "); |
e10815f1 | 179 | if(hough2->WaitForThreadFinish()) |
d6186083 | 180 | ::Fatal("AliL3Hough::WaitForThreadFinish"," Can not join the required thread! "); |
181 | ||
182 | /* In case we run HLT code in the main thread | |
183 | for(Int_t slice=0; slice<=17; slice++) | |
184 | { | |
185 | hough1->ReadData(slice,0); | |
186 | hough1->Transform(); | |
187 | hough1->AddAllHistogramsRows(); | |
188 | hough1->FindTrackCandidatesRow(); | |
189 | hough1->AddTracks(); | |
190 | } | |
191 | for(Int_t slice=18; slice<=35; slice++) | |
192 | { | |
193 | hough2->ReadData(slice,0); | |
194 | hough2->Transform(); | |
195 | hough2->AddAllHistogramsRows(); | |
196 | hough2->FindTrackCandidatesRow(); | |
197 | hough2->AddTracks(); | |
198 | } | |
199 | */ | |
e10815f1 | 200 | |
201 | nglobaltracks += hough1->FillESD(esd); | |
202 | nglobaltracks += hough2->FillESD(esd); | |
203 | ||
d6186083 | 204 | /* In case we want to debug the ESD |
205 | gSystem->MakeDirectory("hough1"); | |
206 | hough1->WriteTracks("./hough1"); | |
207 | gSystem->MakeDirectory("hough2"); | |
208 | hough2->WriteTracks("./hough2"); | |
209 | */ | |
e10815f1 | 210 | |
211 | delete hough1; | |
212 | delete hough2; | |
213 | ||
d6186083 | 214 | AliInfo(Form("\nHough Transformer has found %d TPC tracks in %f seconds\n\n", nglobaltracks,timer.RealTime())); |
215 | ||
216 | } | |
217 | ||
218 | //_____________________________________________________________________________ | |
219 | void AliHoughFilter::RunITStracking(AliESD* esd, TTree *treeClusters) | |
220 | { | |
221 | // Run the ITS tracker | |
222 | // The tracks from the HT TPC tracking are used as seeds | |
223 | // The prologated tracks are updated in the ESD | |
224 | TStopwatch timer; | |
225 | timer.Start(); | |
226 | ||
227 | Double_t vtxPos[3]; | |
228 | Double_t vtxErr[3]={0.005,0.005,0.010}; | |
229 | const AliESDVertex *vertex = esd->GetVertex(); | |
230 | vertex->GetXYZ(vtxPos); | |
231 | ||
232 | AliL3ITStracker itsTracker(fITSgeom); | |
233 | itsTracker.SetVertex(vtxPos,vtxErr); | |
234 | ||
235 | itsTracker.LoadClusters(treeClusters); | |
236 | itsTracker.Clusters2Tracks(esd); | |
237 | itsTracker.UnloadClusters(); | |
238 | AliInfo(Form("ITS tracker has finished in %f seconds\n",timer.RealTime())); | |
e10815f1 | 239 | |
e10815f1 | 240 | } |