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