]>
Commit | Line | Data |
---|---|---|
71d7c760 | 1 | // $Id$ |
2 | ||
3 | /************************************************************************** | |
9be2600f | 4 | * This file is property of and copyright by the ALICE HLT Project * |
5 | * ALICE Experiment at CERN, All rights reserved. * | |
71d7c760 | 6 | * * |
9be2600f | 7 | * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * |
8 | * Timm Steinbeck <timm@kip.uni-heidelberg.de> * | |
9 | * for The ALICE HLT Project. * | |
71d7c760 | 10 | * * |
11 | * Permission to use, copy, modify and distribute this software and its * | |
12 | * documentation strictly for non-commercial purposes is hereby granted * | |
13 | * without fee, provided that the above copyright notice appears in all * | |
14 | * copies and that both the copyright notice and this permission notice * | |
15 | * appear in the supporting documentation. The authors make no claims * | |
16 | * about the suitability of this software for any purpose. It is * | |
17 | * provided "as is" without express or implied warranty. * | |
18 | **************************************************************************/ | |
19 | ||
de554e07 | 20 | /** @file AliHLTTPCSliceTrackerComponent.cxx |
21 | @author Timm Steinbeck, Matthias Richter | |
22 | @date | |
23 | @brief The TPC conformal mapping tracker component. | |
24 | */ | |
71d7c760 | 25 | |
e67b0680 | 26 | // see header file for class documentation |
27 | // or | |
28 | // refer to README to build package | |
29 | // or | |
30 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
31 | ||
db16520a | 32 | #if __GNUC__>= 3 |
71d7c760 | 33 | using namespace std; |
34 | #endif | |
35 | ||
36 | #include "AliHLTTPCSliceTrackerComponent.h" | |
a6c02c85 | 37 | #include "AliHLTTPCTransform.h" |
38 | #include "AliHLTTPCConfMapper.h" | |
39 | #include "AliHLTTPCVertex.h" | |
a6c02c85 | 40 | #include "AliHLTTPCVertexData.h" |
71d7c760 | 41 | #include "AliHLTTPCClusterDataFormat.h" |
a6c02c85 | 42 | #include "AliHLTTPCTransform.h" |
43 | #include "AliHLTTPCTrackSegmentData.h" | |
44 | #include "AliHLTTPCTrackArray.h" | |
71d7c760 | 45 | #include "AliHLTTPCTrackletDataFormat.h" |
ecefc48a | 46 | #include "AliHLTTPCInterMerger.h" |
47 | #include "AliHLTTPCMemHandler.h" | |
5df0cbb9 | 48 | #include "AliHLTTPCDefinitions.h" |
a7c32962 | 49 | //#include "AliHLTTPC.h" |
5df0cbb9 | 50 | //#include <stdlib.h> |
51 | //#include <cerrno> | |
71d7c760 | 52 | |
53 | // this is a global object used for automatic component registration, do not use this | |
54 | AliHLTTPCSliceTrackerComponent gAliHLTTPCSliceTrackerComponent; | |
55 | ||
5df0cbb9 | 56 | /** ROOT macro for the implementation of ROOT specific class methods */ |
71d7c760 | 57 | ClassImp(AliHLTTPCSliceTrackerComponent) |
58 | ||
59 | AliHLTTPCSliceTrackerComponent::AliHLTTPCSliceTrackerComponent() | |
6235cd38 | 60 | : |
61 | fTracker(NULL), | |
62 | fVertex(NULL), | |
63 | fDoNonVertex(false), | |
ecefc48a | 64 | fDoPP(false), |
6235cd38 | 65 | fMultiplicity(4000), |
66 | fBField(0.4), | |
6235cd38 | 67 | fnonvertextracking(kFALSE), |
ecefc48a | 68 | fmainvertextracking(kTRUE), |
ecefc48a | 69 | fpInterMerger(NULL) |
6235cd38 | 70 | { |
71 | // see header file for class documentation | |
72 | // or | |
73 | // refer to README to build package | |
74 | // or | |
75 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
76 | fEta[0] = 0.; | |
77 | fEta[1] = 1.1; | |
78 | } | |
79 | ||
71d7c760 | 80 | AliHLTTPCSliceTrackerComponent::~AliHLTTPCSliceTrackerComponent() |
6235cd38 | 81 | { |
5df0cbb9 | 82 | // see header file for class documentation |
6235cd38 | 83 | } |
71d7c760 | 84 | |
85 | // Public functions to implement AliHLTComponent's interface. | |
86 | // These functions are required for the registration process | |
87 | ||
88 | const char* AliHLTTPCSliceTrackerComponent::GetComponentID() | |
6235cd38 | 89 | { |
5df0cbb9 | 90 | // see header file for class documentation |
6235cd38 | 91 | |
92 | return "TPCSliceTracker"; | |
93 | } | |
71d7c760 | 94 | |
7bcd6cad | 95 | void AliHLTTPCSliceTrackerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) |
6235cd38 | 96 | { |
5df0cbb9 | 97 | // see header file for class documentation |
6235cd38 | 98 | list.clear(); |
96bda103 | 99 | list.push_back( AliHLTTPCDefinitions::fgkClustersDataType ); |
100 | list.push_back( AliHLTTPCDefinitions::fgkVertexDataType ); | |
6235cd38 | 101 | } |
71d7c760 | 102 | |
8ede8717 | 103 | AliHLTComponentDataType AliHLTTPCSliceTrackerComponent::GetOutputDataType() |
6235cd38 | 104 | { |
5df0cbb9 | 105 | // see header file for class documentation |
96bda103 | 106 | return AliHLTTPCDefinitions::fgkTrackSegmentsDataType; |
6235cd38 | 107 | } |
71d7c760 | 108 | |
109 | void AliHLTTPCSliceTrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
6235cd38 | 110 | { |
5df0cbb9 | 111 | // see header file for class documentation |
6235cd38 | 112 | // XXX TODO: Find more realistic values. |
113 | constBase = 0; | |
114 | inputMultiplier = 0.2; | |
115 | } | |
71d7c760 | 116 | |
117 | AliHLTComponent* AliHLTTPCSliceTrackerComponent::Spawn() | |
6235cd38 | 118 | { |
5df0cbb9 | 119 | // see header file for class documentation |
6235cd38 | 120 | return new AliHLTTPCSliceTrackerComponent; |
121 | } | |
71d7c760 | 122 | |
6235cd38 | 123 | void AliHLTTPCSliceTrackerComponent::SetTrackerParam(Int_t phiSegments, Int_t etaSegments, |
71d7c760 | 124 | Int_t trackletlength, Int_t tracklength, |
125 | Int_t rowscopetracklet, Int_t rowscopetrack, | |
6235cd38 | 126 | Double_t minPtFit, Double_t maxangle, |
71d7c760 | 127 | Double_t goodDist, Double_t hitChi2Cut, |
128 | Double_t goodHitChi2, Double_t trackChi2Cut, | |
5d2abf3b | 129 | Int_t maxdist, Double_t maxphi,Double_t maxeta, bool /*vertexConstraints*/ ) |
71d7c760 | 130 | { |
5df0cbb9 | 131 | // see header file for class documentation |
71d7c760 | 132 | //fTracker->SetClusterFinderParam( fXYClusterError, fZClusterError, kTRUE ); // ?? |
133 | //Set parameters input to the tracker | |
134 | //If no arguments are given, default parameters will be used | |
135 | ||
6235cd38 | 136 | fTracker->SetNSegments(phiSegments,etaSegments); |
137 | fTracker->SetMaxDca(minPtFit); | |
71d7c760 | 138 | // fTracker->MainVertexSettings(trackletlength,tracklength,rowscopetracklet,rowscopetrack); |
738c049f | 139 | |
db16520a | 140 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "==============================" ); |
738c049f | 141 | |
142 | if ( fmainvertextracking == kTRUE && fnonvertextracking == kFALSE){ | |
143 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kTRUE); | |
144 | fTracker->SetTrackletCuts(maxangle,goodDist,kTRUE); | |
145 | ||
146 | fTracker->MainVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack, maxphi, maxeta); | |
db16520a | 147 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "MAINVERTEXTRACKING" ); |
738c049f | 148 | } |
149 | else if ( fmainvertextracking == kTRUE && fnonvertextracking == kTRUE){ | |
150 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kTRUE); | |
151 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kFALSE); | |
152 | fTracker->SetTrackletCuts(maxangle,goodDist,kTRUE); | |
153 | fTracker->SetTrackletCuts(maxangle,goodDist,kFALSE); | |
154 | ||
155 | fTracker->MainVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack, maxphi, maxeta); | |
156 | fTracker->NonVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack); | |
db16520a | 157 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "MAINVERTEXTRACKING - NONVERTEXTRACKING" ); |
738c049f | 158 | } |
159 | else if ( fmainvertextracking == kFALSE && fnonvertextracking == kTRUE){ | |
160 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kFALSE); | |
161 | fTracker->SetTrackletCuts(maxangle,goodDist,kFALSE); | |
162 | ||
163 | fTracker->NonVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack); | |
db16520a | 164 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "NONVERTEXTRACKING" ); |
738c049f | 165 | } |
71d7c760 | 166 | |
738c049f | 167 | //fTracker->SetParamDone(true); |
a7c32962 | 168 | /* Matthias 13.12.2006 |
169 | * the global variable AliHLTTPCS::fgDoVertexFit has never been used so far | |
170 | * and has always been kTRUE. | |
171 | * In order to remove the AliHLTTPC class (which is the old steering class for | |
172 | * HLT (TPC) tracking) from the compilation, this function can not be activated | |
173 | * again. We have to think about a more elegant way to specify the parameters | |
174 | * anyway. The following line was surely for some testing, but was never active | |
175 | * in a tested release. | |
176 | */ | |
a6c02c85 | 177 | //AliHLTTPC::SetVertexFit( kFALSE ); |
71d7c760 | 178 | |
179 | fTracker->InitVolumes(); | |
180 | } | |
181 | ||
182 | void AliHLTTPCSliceTrackerComponent::SetTrackerParam( bool doPP, int multiplicity, double bField ) | |
183 | { | |
e67b0680 | 184 | // see header file for class documentation |
738c049f | 185 | AliHLTTPCTransform::SetBField( bField ); |
db16520a | 186 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "BField", "Setting b field to %f T\n", bField ); |
738c049f | 187 | |
71d7c760 | 188 | if ( doPP ) |
189 | { | |
190 | //tracker->SetClusterFinderParam(xyerror,zerror,kTRUE); // ?? | |
ecefc48a | 191 | /* the old setup used during TPC |
192 | SetTrackerParam( 50, 100, 3, 10, | |
193 | 2, 2, | |
194 | 0, 0.1745, 5, 100, | |
195 | 5, 50, 50, 0.1, 0.1, kTRUE); | |
196 | */ | |
197 | SetTrackerParam( 50, // phi_segments: Devide the space into phi_segments | |
198 | 100, // ets_segments: Devide the space into eta_segments | |
199 | 3, // trackletlength: Number of hits a tracklet has to have | |
df46daee | 200 | 50, // tracklength: Number of hits a track has to have |
ecefc48a | 201 | 6, // rowscopetracklet: Search range of rows for a tracklet |
202 | 6, // rowscopetrack: Search range of rows for a track | |
203 | 0, // min_pt_fit: Cut for moment fit, use:SetMaxDca(min_pt_fit) | |
204 | AliHLTTPCTransform::Deg2Rad(10), | |
205 | // maxangle: AliHLTTPCTransform::Deg2Rad(10), max angle for the three point look aheand | |
206 | 5, // goodDist: Threshold distancs between two hits when building tracklets | |
207 | 100, // hitChi2Cut: Max chi2 of added hit to track | |
208 | 5, // goodHitChi2: Stop looking for next hit to add if chi2 is less then goodHitChi2 | |
209 | 50, // trackChi2Cut: Max chi2 for track after final fit | |
210 | 50, // maxdist: Maximum distance between two clusters when forming segments | |
211 | 0.1, // maxphi: Max phi difference for neighboring hits | |
212 | 0.1, // maxeta: Max eta difference for neighboring hits | |
213 | kTRUE); // vertexConstrain: False if one want to look for secondary vertex track | |
71d7c760 | 214 | } |
215 | else | |
216 | { | |
217 | int mults[] = { 1000, 2000, 4000, 8000 }; | |
218 | int multCount = 4; | |
219 | int closestMult = 0; | |
220 | int i; | |
221 | int multDist, tmpMultDist; | |
222 | if ( multiplicity>mults[closestMult] ) | |
223 | multDist = multiplicity-mults[closestMult]; | |
224 | else | |
225 | multDist = mults[closestMult]-multiplicity; | |
226 | for ( i = 1; i < multCount; i++ ) | |
227 | { | |
228 | if ( multiplicity>mults[i] ) | |
229 | tmpMultDist = multiplicity-mults[i]; | |
230 | else | |
231 | tmpMultDist = mults[i]-multiplicity; | |
232 | if ( tmpMultDist < multDist ) | |
233 | { | |
234 | closestMult = i; | |
235 | multDist = tmpMultDist; | |
236 | } | |
237 | } | |
238 | ||
239 | double bfs[] = { 0.2, 0.4 }; | |
240 | int bfCount = 2; | |
241 | int closestBf = 0; | |
242 | double bfDist, tmpBFDist; | |
243 | if ( bField>bfs[closestBf] ) | |
244 | bfDist = bField-bfs[closestBf]; | |
245 | else | |
246 | bfDist = bfs[closestBf]-bField; | |
247 | for ( i = 1; i < bfCount; i++ ) | |
248 | { | |
249 | if ( bField>bfs[i] ) | |
250 | tmpBFDist = bField-bfs[i]; | |
251 | else | |
252 | tmpBFDist = bfs[i]-bField; | |
253 | if ( tmpBFDist < bfDist ) | |
254 | { | |
255 | closestBf = i; | |
256 | bfDist = tmpBFDist; | |
257 | } | |
258 | } | |
259 | ||
260 | switch ( closestMult ) | |
261 | { | |
262 | case 0: // 1000 | |
263 | switch ( closestBf ) | |
264 | { | |
265 | case 0: // 0.2 | |
266 | SetTrackerParam( 50, 100, 3, 10, | |
267 | 2, 4, | |
268 | 0, 0.1745, 5, 100, | |
269 | 5, 50, 50, 0.1, 0.1, kTRUE ); | |
270 | break; | |
271 | case 1: // 0.4 | |
272 | SetTrackerParam( 50, 100, 3, 10, | |
273 | 2, 4, | |
274 | 0, 0.1745, 5, 100, | |
275 | 5, 50, 50, 0.1, 0.1, kTRUE ); | |
276 | break; | |
277 | } | |
278 | break; | |
279 | case 1: // 2000 | |
280 | switch ( closestBf ) | |
281 | { | |
282 | case 0: // 0.2 | |
283 | SetTrackerParam( 50, 100, 3, 10, | |
284 | 2, 4, | |
285 | 0, 0.1745, 5, 30, | |
286 | 5, 20, 50, 0.1, 0.1, kTRUE ); | |
287 | break; | |
288 | case 1: // 0.4 | |
289 | SetTrackerParam( 50, 100, 3, 10, | |
290 | 2, 5, | |
291 | 0, 0.1745, 5, 30, | |
292 | 5, 20, 50, 0.1, 0.1, kTRUE ); | |
293 | break; | |
294 | } | |
295 | break; | |
296 | case 2: // 4000 | |
297 | switch ( closestBf ) | |
298 | { | |
299 | case 0: // 0.2 | |
300 | SetTrackerParam( 50, 100, 3, 10, | |
301 | 2 , 10, | |
302 | 0, 0.1745, 5, 20, | |
303 | 5, 10 , 50, 0.1, 0.1, kTRUE ); | |
304 | break; | |
305 | case 1: // 0.4 | |
306 | SetTrackerParam( 50, 100, 3, 10, | |
307 | 2, 10, | |
308 | 0, 0.1745, 5, 20, | |
309 | 5, 10, 50, 0.1, 0.1, kTRUE ); | |
310 | break; | |
311 | } | |
312 | break; | |
313 | case 3: // 8000 | |
314 | switch ( closestBf ) | |
315 | { | |
316 | case 0: // 0.2 | |
317 | SetTrackerParam( 50, 100, 3, 10, | |
318 | 3, 15, | |
319 | 0, 0.1745, 5, 10, | |
320 | 5, 5, 50, 0.1, 0.1, kTRUE ); | |
321 | break; | |
322 | case 1: // 0.4 | |
323 | SetTrackerParam( 50, 100, 3, 10, | |
324 | 2, 15, | |
325 | 0, 0.1745, 5, 15, | |
326 | 5, 5, 50, 0.1, 0.1, kTRUE ); | |
327 | break; | |
328 | } | |
329 | break; | |
330 | } | |
738c049f | 331 | // Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "BField", "Setting b field to %f\n", bfs[closestBf] ); |
332 | // AliHLTTPCTransform::SetBField( bfs[closestBf] ); | |
333 | // AliHLTTPCTransform::SetBField( bField ); | |
334 | // Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "BField", "Setting b field to %f\n", bField ); | |
71d7c760 | 335 | } |
336 | } | |
337 | ||
338 | ||
339 | ||
340 | int AliHLTTPCSliceTrackerComponent::DoInit( int argc, const char** argv ) | |
341 | { | |
5df0cbb9 | 342 | // see header file for class documentation |
a6c02c85 | 343 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "DoInit", "DoInit()" ); |
a6c02c85 | 344 | |
71d7c760 | 345 | if ( fTracker || fVertex ) |
346 | return EINPROGRESS; | |
a6c02c85 | 347 | fTracker = new AliHLTTPCConfMapper(); |
348 | fVertex = new AliHLTTPCVertex(); | |
71d7c760 | 349 | fEta[0] = 0.; |
350 | fEta[1] = 1.1; | |
351 | fDoNonVertex = false; | |
ecefc48a | 352 | Bool_t bDoMerger=kTRUE; |
a6c02c85 | 353 | fMultiplicity = 4000; |
354 | fBField = 0.4; | |
355 | fDoPP = false; | |
71d7c760 | 356 | |
357 | int i = 0; | |
358 | char* cpErr; | |
359 | while ( i < argc ) | |
360 | { | |
ecefc48a | 361 | if ( !strcmp( argv[i], "disable-merger" ) ){ |
362 | bDoMerger = kFALSE; | |
363 | i++; | |
364 | continue; | |
365 | } | |
366 | ||
a6c02c85 | 367 | if ( !strcmp( argv[i], "pp-run" ) ) |
71d7c760 | 368 | { |
369 | fDoPP = true; | |
370 | i++; | |
371 | continue; | |
372 | } | |
a6c02c85 | 373 | if ( !strcmp( argv[i], "multiplicity" ) ) |
71d7c760 | 374 | { |
375 | if ( argc <= i+1 ) | |
376 | { | |
377 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing multiplicity", "Missing event multiplicity specifier." ); | |
378 | return ENOTSUP; | |
379 | } | |
380 | fMultiplicity = strtoul( argv[i+1], &cpErr, 0 ); | |
381 | if ( *cpErr ) | |
382 | { | |
383 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing multiplicity", "Cannot convert event multiplicity specifier '%s'.", argv[i+1] ); | |
384 | return EINVAL; | |
385 | } | |
386 | i += 2; | |
387 | continue; | |
388 | } | |
a6c02c85 | 389 | if ( !strcmp( argv[i], "bfield" ) ) |
71d7c760 | 390 | { |
391 | if ( argc <= i+1 ) | |
392 | { | |
393 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing B-field", "Missing B-field specifier." ); | |
394 | return ENOTSUP; | |
395 | } | |
396 | fBField = strtod( argv[i+1], &cpErr ); | |
397 | if ( *cpErr ) | |
398 | { | |
399 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing multiplicity", "Cannot convert B-field specifier '%s'.", argv[i+1] ); | |
400 | return EINVAL; | |
401 | } | |
402 | i += 2; | |
403 | continue; | |
404 | } | |
738c049f | 405 | |
738c049f | 406 | if ( !strcmp( argv[i], "nonvertextracking" ) ){ |
437e8e54 | 407 | fnonvertextracking = kTRUE; |
408 | i++; | |
409 | continue; | |
738c049f | 410 | } |
411 | ||
412 | if ( !strcmp( argv[i], "mainvertextrackingoff" ) ){ | |
437e8e54 | 413 | fmainvertextracking = kFALSE; |
414 | i++; | |
415 | continue; | |
738c049f | 416 | } |
437e8e54 | 417 | |
738c049f | 418 | if ( !strcmp( argv[i], "etarange" ) ){ |
437e8e54 | 419 | if ( argc <= i+1 ){ |
420 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing Eta range", "Missing Eta-range specifiers." ); | |
421 | return ENOTSUP; | |
422 | } | |
423 | fEta[1] = strtod( argv[i+1], &cpErr ); | |
424 | if ( *cpErr ){ | |
425 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing Eta range", "Cannot convert Eta-range specifier '%s'.", argv[i+1] ); | |
426 | return EINVAL; | |
427 | } | |
428 | ||
429 | i += 2; | |
430 | continue; | |
738c049f | 431 | } |
71d7c760 | 432 | Logging(kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); |
433 | return EINVAL; | |
434 | } | |
db16520a | 435 | if (fBField == 0.){ |
437e8e54 | 436 | // parameter for B=0 T |
437 | fDoPP = kTRUE; | |
438 | fnonvertextracking = kTRUE; | |
439 | fmainvertextracking = kFALSE; | |
db16520a | 440 | } |
437e8e54 | 441 | |
ecefc48a | 442 | if (bDoMerger) |
443 | fpInterMerger = new AliHLTTPCInterMerger(); | |
444 | ||
71d7c760 | 445 | SetTrackerParam( fDoPP, fMultiplicity, fBField ); |
446 | return 0; | |
447 | } | |
448 | ||
449 | int AliHLTTPCSliceTrackerComponent::DoDeinit() | |
ecefc48a | 450 | { |
5df0cbb9 | 451 | // see header file for class documentation |
ecefc48a | 452 | if ( fTracker ) |
453 | delete fTracker; | |
454 | fTracker = NULL; | |
455 | if ( fVertex ) | |
456 | delete fVertex; | |
457 | fVertex = NULL; | |
458 | if (fpInterMerger) { | |
459 | delete fpInterMerger; | |
460 | } | |
461 | fpInterMerger=NULL; | |
462 | return 0; | |
463 | } | |
71d7c760 | 464 | |
8ede8717 | 465 | int AliHLTTPCSliceTrackerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, |
5d2abf3b | 466 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, |
7bcd6cad | 467 | AliHLTUInt32_t& size, AliHLTComponentBlockDataList& outputBlocks ) |
71d7c760 | 468 | { |
5df0cbb9 | 469 | // see header file for class documentation |
a6c02c85 | 470 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "DoEvent", "DoEvent()" ); |
5235c3e9 | 471 | if ( evtData.fBlockCnt<=0 ) |
472 | { | |
473 | Logging( kHLTLogWarning, "HLT::TPCSliceTracker::DoEvent", "DoEvent", "no blocks in event" ); | |
474 | return 0; | |
475 | } | |
8ede8717 | 476 | const AliHLTComponentBlockData* iter = NULL; |
71d7c760 | 477 | unsigned long ndx; |
478 | AliHLTTPCClusterData* inPtrSP; | |
a6c02c85 | 479 | AliHLTTPCVertexData* inPtrV = NULL; |
8ede8717 | 480 | const AliHLTComponentBlockData* vertexIter=NULL; |
71d7c760 | 481 | AliHLTTPCTrackletData* outPtr; |
482 | AliHLTUInt8_t* outBPtr; | |
483 | AliHLTUInt32_t vSize = 0; | |
484 | UInt_t offset=0, mysize, tSize = 0; | |
485 | outBPtr = outputPtr; | |
5235c3e9 | 486 | Int_t slice=-1, patch=-1, row[2]; |
71d7c760 | 487 | Int_t minPatch=INT_MAX, maxPatch = 0; |
488 | offset = 0; | |
489 | std::vector<Int_t> slices; | |
490 | std::vector<Int_t>::iterator slIter, slEnd; | |
491 | std::vector<unsigned> sliceCnts; | |
492 | std::vector<unsigned>::iterator slCntIter; | |
5235c3e9 | 493 | Int_t vertexSlice=-1; |
71d7c760 | 494 | |
495 | // Find min/max rows used in total and find and read out vertex if it is present | |
496 | // also determine correct slice number, if multiple slice numbers are present in event | |
497 | // (which should not happen in the first place) we use the one that occurs the most times | |
498 | row[0] = 0; | |
499 | row[1] = 0; | |
500 | bool found; | |
501 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
502 | { | |
503 | iter = blocks+ndx; | |
504 | ||
cb703d46 | 505 | if(iter->fDataType!=AliHLTTPCDefinitions::fgkClustersDataType){ |
506 | HLTDebug("Data block type is not of type AliHLTTPCDefinitions::fgkClustersDataType"); | |
507 | continue; | |
508 | } | |
509 | ||
71d7c760 | 510 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); |
511 | found = false; | |
512 | slIter = slices.begin(); | |
513 | slEnd = slices.end(); | |
514 | slCntIter = sliceCnts.begin(); | |
515 | while ( slIter != slEnd ) | |
516 | { | |
517 | if ( *slIter == slice ) | |
518 | { | |
519 | found = true; | |
520 | break; | |
521 | } | |
522 | slIter++; | |
523 | slCntIter++; | |
524 | } | |
525 | if ( !found ) | |
526 | { | |
527 | slices.insert( slices.end(), slice ); | |
528 | sliceCnts.insert( sliceCnts.end(), 1 ); | |
529 | } | |
530 | else | |
531 | *slCntIter++; | |
532 | ||
96bda103 | 533 | if ( iter->fDataType == AliHLTTPCDefinitions::fgkVertexDataType ) |
71d7c760 | 534 | { |
a6c02c85 | 535 | inPtrV = (AliHLTTPCVertexData*)(iter->fPtr); |
71d7c760 | 536 | vertexIter = iter; |
537 | vSize = iter->fSize; | |
538 | fVertex->Read( inPtrV ); | |
539 | vertexSlice = slice; | |
540 | } | |
96bda103 | 541 | if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ) |
71d7c760 | 542 | { |
543 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
544 | if ( minPatch>patch ) | |
545 | { | |
546 | minPatch = patch; | |
a6c02c85 | 547 | row[0] = AliHLTTPCTransform::GetFirstRow( patch ); |
71d7c760 | 548 | } |
549 | if ( maxPatch<patch ) | |
550 | { | |
551 | maxPatch = patch; | |
a6c02c85 | 552 | row[1] = AliHLTTPCTransform::GetLastRow( patch ); |
71d7c760 | 553 | } |
554 | } | |
555 | } | |
556 | ||
557 | // Determine slice number to really use. | |
558 | if ( slices.size()>1 ) | |
559 | { | |
560 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
561 | "Multiple slice numbers found in event 0x%08lX (%lu). Determining maximum occuring slice number...", | |
562 | evtData.fEventID, evtData.fEventID ); | |
563 | unsigned maxCntSlice=0; | |
564 | slIter = slices.begin(); | |
565 | slEnd = slices.end(); | |
566 | slCntIter = sliceCnts.begin(); | |
567 | while ( slIter != slEnd ) | |
568 | { | |
569 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
570 | "Slice %lu found %lu times.", *slIter, *slCntIter ); | |
571 | if ( maxCntSlice<*slCntIter ) | |
572 | { | |
573 | maxCntSlice = *slCntIter; | |
574 | slice = *slIter; | |
575 | } | |
576 | slIter++; | |
577 | slCntIter++; | |
578 | } | |
579 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
580 | "Using slice %lu.", slice ); | |
581 | } | |
5235c3e9 | 582 | else if ( slices.size()>0 ) |
583 | { | |
71d7c760 | 584 | slice = *(slices.begin()); |
5235c3e9 | 585 | } |
586 | else | |
587 | { | |
588 | slice = -1; | |
589 | } | |
71d7c760 | 590 | |
591 | if ( vertexSlice != slice ) | |
592 | { | |
593 | // multiple vertex blocks in event and we used the wrong one... | |
594 | found = false; | |
595 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
596 | { | |
597 | iter = blocks+ndx; | |
96bda103 | 598 | if ( iter->fDataType == AliHLTTPCDefinitions::fgkVertexDataType && slice==AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) |
71d7c760 | 599 | { |
a6c02c85 | 600 | inPtrV = (AliHLTTPCVertexData*)(iter->fPtr); |
71d7c760 | 601 | vertexIter = iter; |
602 | vSize = iter->fSize; | |
603 | fVertex->Read( inPtrV ); | |
604 | break; | |
605 | } | |
606 | } | |
607 | } | |
608 | ||
609 | fTracker->InitSector( slice, row, fEta ); | |
610 | fTracker->SetVertex(fVertex); | |
611 | mysize = 0; | |
612 | // read in all hits | |
a6c02c85 | 613 | std::vector<unsigned long> patchIndices; |
614 | std::vector<unsigned long>::iterator pIter, pEnd; | |
71d7c760 | 615 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
616 | { | |
617 | iter = blocks+ndx; | |
618 | ||
96bda103 | 619 | if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType && slice==AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) |
71d7c760 | 620 | { |
621 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
a6c02c85 | 622 | pIter = patchIndices.begin(); |
623 | pEnd = patchIndices.end(); | |
624 | while ( pIter!=pEnd && AliHLTTPCDefinitions::GetMinSliceNr( blocks[*pIter] ) < patch ) | |
625 | pIter++; | |
626 | patchIndices.insert( pIter, ndx ); | |
71d7c760 | 627 | } |
628 | } | |
a6c02c85 | 629 | pIter = patchIndices.begin(); |
630 | pEnd = patchIndices.end(); | |
631 | while ( pIter!=pEnd ) | |
632 | { | |
633 | ndx = *pIter; | |
634 | iter = blocks+ndx; | |
635 | ||
636 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
637 | inPtrSP = (AliHLTTPCClusterData*)(iter->fPtr); | |
638 | ||
639 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Reading hits", | |
640 | "Reading hits for slice %d - patch %d", slice, patch ); | |
641 | fTracker->ReadHits( inPtrSP->fSpacePointCnt, inPtrSP->fSpacePoints ); | |
642 | pIter++; | |
643 | } | |
71d7c760 | 644 | |
645 | outPtr = (AliHLTTPCTrackletData*)(outBPtr); | |
437e8e54 | 646 | |
738c049f | 647 | if ( fmainvertextracking == kTRUE && fnonvertextracking == kFALSE){ |
437e8e54 | 648 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---MAINVERTEXTRACKING---"); |
649 | fTracker->MainVertexTrackingA(); | |
650 | fTracker->MainVertexTrackingB(); | |
651 | fTracker->FillTracks(); | |
738c049f | 652 | } |
653 | else if ( fmainvertextracking == kTRUE && fnonvertextracking == kTRUE){ | |
437e8e54 | 654 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---MAINVERTEXTRACKING---"); |
655 | fTracker->MainVertexTrackingA(); | |
656 | fTracker->MainVertexTrackingB(); | |
657 | fTracker->FillTracks(); | |
658 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---NONVERTEXTRACKING---"); | |
659 | fTracker->NonVertexTracking(); | |
738c049f | 660 | } |
661 | else if ( fmainvertextracking == kFALSE && fnonvertextracking == kTRUE){ | |
437e8e54 | 662 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---NONVERTEXTRACKING---"); |
663 | fTracker->NonVertexTracking(); | |
664 | fTracker->FillTracks(); | |
738c049f | 665 | } |
437e8e54 | 666 | |
ecefc48a | 667 | UInt_t ntracks0 =0; |
668 | if(fpInterMerger){ | |
669 | AliHLTTPCMemHandler memory; | |
670 | AliHLTTPCTrackSegmentData *trackdata0 = | |
671 | (AliHLTTPCTrackSegmentData *) memory.Allocate(fTracker->GetTracks()); | |
672 | memory.TrackArray2Memory(ntracks0,trackdata0,fTracker->GetTracks()); | |
673 | fpInterMerger->Reset(); | |
674 | fpInterMerger->Init(row,patch); | |
675 | fpInterMerger->FillTracks(ntracks0,trackdata0); | |
676 | fpInterMerger->Merge(); | |
677 | } | |
678 | ntracks0=0; | |
5df0cbb9 | 679 | AliHLTTPCTrackArray* pArray=fTracker->GetTracks(); |
680 | mysize = pArray->WriteTracks( ntracks0, outPtr->fTracklets ); | |
71d7c760 | 681 | outPtr->fTrackletCnt = ntracks0; |
ecefc48a | 682 | |
71d7c760 | 683 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracks", |
684 | "Input: Number of tracks: %lu Slice/MinPatch/MaxPatch/RowMin/RowMax: %lu/%lu/%lu/%lu/%lu.", | |
685 | ntracks0, slice, minPatch, maxPatch, row[0], row[1] ); | |
686 | ||
055fed30 | 687 | fTracker->Reset(); |
688 | ||
71d7c760 | 689 | tSize += mysize+sizeof(AliHLTTPCTrackletData); |
690 | outBPtr += mysize+sizeof(AliHLTTPCTrackletData); | |
691 | ||
8ede8717 | 692 | AliHLTComponentBlockData bd; |
71d7c760 | 693 | FillBlockData( bd ); |
694 | bd.fOffset = offset; | |
695 | bd.fSize = tSize; | |
696 | bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch ); | |
697 | outputBlocks.push_back( bd ); | |
698 | ||
699 | #ifdef FORWARD_VERTEX_BLOCK | |
700 | if ( vertexIter ) | |
701 | { | |
702 | // Copy the descriptor block for the vertex information. | |
703 | bd = *vertexIter; | |
704 | outputBlocks.push_back( bd ); | |
705 | } | |
706 | #endif // FORWARD_VERTEX_BLOCK | |
707 | ||
708 | size = tSize; | |
709 | return 0; | |
710 | } | |
711 | ||
5df0cbb9 | 712 | void AliHLTTPCSliceTrackerComponent::SetTrackerParam1() |
713 | { | |
e67b0680 | 714 | // see header file for class documentation |
5df0cbb9 | 715 | SetTrackerParam( 10, 20, 5, 10, 2,2, |
716 | 0, 1.31, 5, 100, | |
717 | 50, 100, 50, 0.1, 0.1, | |
718 | true ); | |
719 | } | |
720 | ||
71d7c760 | 721 |