]>
Commit | Line | Data |
---|---|---|
78001a73 | 1 | // $Id$ |
2 | ||
3 | /************************************************************************** | |
4 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
7 | * Timm Steinbeck <timm@kip.uni-heidelberg.de> * | |
8 | * for The ALICE Off-line Project. * | |
9 | * * | |
10 | * Permission to use, copy, modify and distribute this software and its * | |
11 | * documentation strictly for non-commercial purposes is hereby granted * | |
12 | * without fee, provided that the above copyright notice appears in all * | |
13 | * copies and that both the copyright notice and this permission notice * | |
14 | * appear in the supporting documentation. The authors make no claims * | |
15 | * about the suitability of this software for any purpose. It is * | |
16 | * provided "as is" without express or implied warranty. * | |
17 | **************************************************************************/ | |
18 | ||
19 | /////////////////////////////////////////////////////////////////////////////// | |
20 | // // | |
21 | // a TPC sector tracker processing component for the HLT // | |
22 | // // | |
23 | /////////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #if __GNUC__== 3 | |
26 | using namespace std; | |
27 | #endif | |
28 | ||
29 | #include "AliHLTTPCSliceTrackerComponent.h" | |
30 | #include "AliHLTTPCTransform.h" | |
31 | #include "AliHLTTPCConfMapper.h" | |
32 | #include "AliHLTTPCVertex.h" | |
33 | #include "AliHLTTPCSpacePointData.h" | |
34 | #include "AliHLTTPCVertexData.h" | |
35 | #include "AliHLTTPCClusterDataFormat.h" | |
36 | #include "AliHLTTPCTransform.h" | |
37 | #include "AliHLTTPCTrackSegmentData.h" | |
38 | #include "AliHLTTPCTrackArray.h" | |
39 | #include "AliHLTTPCTrackletDataFormat.h" | |
40 | #include "AliHLTTPC.h" | |
41 | #include <stdlib.h> | |
42 | #include <errno.h> | |
43 | ||
44 | // this is a global object used for automatic component registration, do not use this | |
45 | AliHLTTPCSliceTrackerComponent gAliHLTTPCSliceTrackerComponent; | |
46 | ||
47 | ClassImp(AliHLTTPCSliceTrackerComponent) | |
48 | ||
49 | AliHLTTPCSliceTrackerComponent::AliHLTTPCSliceTrackerComponent() | |
50 | { | |
51 | fTracker = NULL; | |
52 | fVertex = NULL; | |
53 | fEta[0] = 0.; | |
54 | fEta[1] = 1.1; | |
55 | fDoNonVertex = false; | |
56 | fMultiplicity = 4000; | |
57 | fBField = 0.4; | |
58 | fDoPP = false; | |
738c049f | 59 | // --JMT---------------------- NEW ---------------------------- |
60 | fnonvertextracking = kFALSE; | |
61 | fmainvertextracking = kTRUE; | |
62 | // --JMT---------------------- NEW ---------------------------- | |
78001a73 | 63 | } |
64 | ||
65 | AliHLTTPCSliceTrackerComponent::~AliHLTTPCSliceTrackerComponent() | |
66 | { | |
67 | } | |
68 | ||
69 | // Public functions to implement AliHLTComponent's interface. | |
70 | // These functions are required for the registration process | |
71 | ||
72 | const char* AliHLTTPCSliceTrackerComponent::GetComponentID() | |
73 | { | |
74 | return "TPCSliceTracker"; | |
75 | } | |
76 | ||
77 | void AliHLTTPCSliceTrackerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list) | |
78 | { | |
79 | list.clear(); | |
80 | list.push_back( AliHLTTPCDefinitions::gkClustersDataType ); | |
81 | list.push_back( AliHLTTPCDefinitions::gkVertexDataType ); | |
82 | } | |
83 | ||
84 | AliHLTComponent_DataType AliHLTTPCSliceTrackerComponent::GetOutputDataType() | |
85 | { | |
86 | return AliHLTTPCDefinitions::gkTrackSegmentsDataType; | |
87 | } | |
88 | ||
89 | void AliHLTTPCSliceTrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
90 | { | |
91 | // XXX TODO: Find more realistic values. | |
92 | constBase = 0; | |
93 | inputMultiplier = 0.2; | |
94 | } | |
95 | ||
96 | AliHLTComponent* AliHLTTPCSliceTrackerComponent::Spawn() | |
97 | { | |
98 | return new AliHLTTPCSliceTrackerComponent; | |
99 | } | |
100 | ||
101 | void AliHLTTPCSliceTrackerComponent::SetTrackerParam(Int_t phi_segments, Int_t eta_segments, | |
102 | Int_t trackletlength, Int_t tracklength, | |
103 | Int_t rowscopetracklet, Int_t rowscopetrack, | |
104 | Double_t min_pt_fit, Double_t maxangle, | |
105 | Double_t goodDist, Double_t hitChi2Cut, | |
106 | Double_t goodHitChi2, Double_t trackChi2Cut, | |
107 | Int_t maxdist, Double_t maxphi,Double_t maxeta, bool vertexConstraints ) | |
108 | { | |
109 | //fTracker->SetClusterFinderParam( fXYClusterError, fZClusterError, kTRUE ); // ?? | |
110 | //Set parameters input to the tracker | |
111 | //If no arguments are given, default parameters will be used | |
112 | ||
113 | fTracker->SetNSegments(phi_segments,eta_segments); | |
114 | fTracker->SetMaxDca(min_pt_fit); | |
115 | // fTracker->MainVertexSettings(trackletlength,tracklength,rowscopetracklet,rowscopetrack); | |
738c049f | 116 | |
117 | // --JMT---------------------- NEW ---------------------------- | |
118 | #if 0 | |
78001a73 | 119 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,vertexConstraints); |
120 | fTracker->SetTrackletCuts(maxangle,goodDist,vertexConstraints); | |
738c049f | 121 | #endif |
122 | Logging( kHLTLogError, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "==============================" ); | |
123 | ||
124 | if ( fmainvertextracking == kTRUE && fnonvertextracking == kFALSE){ | |
125 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kTRUE); | |
126 | fTracker->SetTrackletCuts(maxangle,goodDist,kTRUE); | |
127 | ||
128 | fTracker->MainVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack, maxphi, maxeta); | |
129 | Logging( kHLTLogError, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "MAINVERTEXTRACKING" ); | |
130 | } | |
131 | else if ( fmainvertextracking == kTRUE && fnonvertextracking == kTRUE){ | |
132 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kTRUE); | |
133 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kFALSE); | |
134 | fTracker->SetTrackletCuts(maxangle,goodDist,kTRUE); | |
135 | fTracker->SetTrackletCuts(maxangle,goodDist,kFALSE); | |
136 | ||
78001a73 | 137 | fTracker->MainVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack, maxphi, maxeta); |
738c049f | 138 | fTracker->NonVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack); |
139 | Logging( kHLTLogError, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "MAINVERTEXTRACKING - NONVERTEXTRACKING" ); | |
140 | } | |
141 | else if ( fmainvertextracking == kFALSE && fnonvertextracking == kTRUE){ | |
142 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kFALSE); | |
143 | fTracker->SetTrackletCuts(maxangle,goodDist,kFALSE); | |
144 | ||
78001a73 | 145 | fTracker->NonVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack); |
738c049f | 146 | Logging( kHLTLogError, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "NONVERTEXTRACKING" ); |
147 | } | |
148 | ||
149 | ||
150 | #if 0 | |
151 | if( vertexConstraints ) fTracker->MainVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack, maxphi, maxeta); | |
152 | else fTracker->NonVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack); | |
153 | #endif | |
154 | // --JMT---------------------- NEW ---------------------------- | |
78001a73 | 155 | //fTracker->SetParamDone(true); |
156 | ||
157 | //AliHLTTPC::SetVertexFit( kFALSE ); | |
158 | ||
159 | fTracker->InitVolumes(); | |
160 | } | |
161 | ||
162 | void AliHLTTPCSliceTrackerComponent::SetTrackerParam( bool doPP, int multiplicity, double bField ) | |
163 | { | |
738c049f | 164 | AliHLTTPCTransform::SetBField( bField ); |
165 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "BField", "Setting b field to %f\n", bField ); | |
166 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "BField", "B field is %f\n",AliHLTTPCTransform::GetBFieldValue()); | |
167 | ||
78001a73 | 168 | if ( doPP ) |
169 | { | |
170 | //tracker->SetClusterFinderParam(xyerror,zerror,kTRUE); // ?? | |
171 | SetTrackerParam( 50, 100, 3, 10, | |
172 | 2, 2, | |
173 | 0, 0.1745, 5, 100, | |
174 | 5, 50, 50, 0.1, 0.1, kTRUE); | |
175 | } | |
176 | else | |
177 | { | |
178 | int mults[] = { 1000, 2000, 4000, 8000 }; | |
179 | int multCount = 4; | |
180 | int closestMult = 0; | |
181 | int i; | |
182 | int multDist, tmpMultDist; | |
183 | if ( multiplicity>mults[closestMult] ) | |
184 | multDist = multiplicity-mults[closestMult]; | |
185 | else | |
186 | multDist = mults[closestMult]-multiplicity; | |
187 | for ( i = 1; i < multCount; i++ ) | |
188 | { | |
189 | if ( multiplicity>mults[i] ) | |
190 | tmpMultDist = multiplicity-mults[i]; | |
191 | else | |
192 | tmpMultDist = mults[i]-multiplicity; | |
193 | if ( tmpMultDist < multDist ) | |
194 | { | |
195 | closestMult = i; | |
196 | multDist = tmpMultDist; | |
197 | } | |
198 | } | |
199 | ||
200 | double bfs[] = { 0.2, 0.4 }; | |
201 | int bfCount = 2; | |
202 | int closestBf = 0; | |
203 | double bfDist, tmpBFDist; | |
204 | if ( bField>bfs[closestBf] ) | |
205 | bfDist = bField-bfs[closestBf]; | |
206 | else | |
207 | bfDist = bfs[closestBf]-bField; | |
208 | for ( i = 1; i < bfCount; i++ ) | |
209 | { | |
210 | if ( bField>bfs[i] ) | |
211 | tmpBFDist = bField-bfs[i]; | |
212 | else | |
213 | tmpBFDist = bfs[i]-bField; | |
214 | if ( tmpBFDist < bfDist ) | |
215 | { | |
216 | closestBf = i; | |
217 | bfDist = tmpBFDist; | |
218 | } | |
219 | } | |
220 | ||
221 | switch ( closestMult ) | |
222 | { | |
223 | case 0: // 1000 | |
224 | switch ( closestBf ) | |
225 | { | |
226 | case 0: // 0.2 | |
227 | SetTrackerParam( 50, 100, 3, 10, | |
228 | 2, 4, | |
229 | 0, 0.1745, 5, 100, | |
230 | 5, 50, 50, 0.1, 0.1, kTRUE ); | |
231 | break; | |
232 | case 1: // 0.4 | |
233 | SetTrackerParam( 50, 100, 3, 10, | |
234 | 2, 4, | |
235 | 0, 0.1745, 5, 100, | |
236 | 5, 50, 50, 0.1, 0.1, kTRUE ); | |
237 | break; | |
238 | } | |
239 | break; | |
240 | case 1: // 2000 | |
241 | switch ( closestBf ) | |
242 | { | |
243 | case 0: // 0.2 | |
244 | SetTrackerParam( 50, 100, 3, 10, | |
245 | 2, 4, | |
246 | 0, 0.1745, 5, 30, | |
247 | 5, 20, 50, 0.1, 0.1, kTRUE ); | |
248 | break; | |
249 | case 1: // 0.4 | |
250 | SetTrackerParam( 50, 100, 3, 10, | |
251 | 2, 5, | |
252 | 0, 0.1745, 5, 30, | |
253 | 5, 20, 50, 0.1, 0.1, kTRUE ); | |
254 | break; | |
255 | } | |
256 | break; | |
257 | case 2: // 4000 | |
258 | switch ( closestBf ) | |
259 | { | |
260 | case 0: // 0.2 | |
261 | SetTrackerParam( 50, 100, 3, 10, | |
262 | 2 , 10, | |
263 | 0, 0.1745, 5, 20, | |
264 | 5, 10 , 50, 0.1, 0.1, kTRUE ); | |
265 | break; | |
266 | case 1: // 0.4 | |
267 | SetTrackerParam( 50, 100, 3, 10, | |
268 | 2, 10, | |
269 | 0, 0.1745, 5, 20, | |
270 | 5, 10, 50, 0.1, 0.1, kTRUE ); | |
271 | break; | |
272 | } | |
273 | break; | |
274 | case 3: // 8000 | |
275 | switch ( closestBf ) | |
276 | { | |
277 | case 0: // 0.2 | |
278 | SetTrackerParam( 50, 100, 3, 10, | |
279 | 3, 15, | |
280 | 0, 0.1745, 5, 10, | |
281 | 5, 5, 50, 0.1, 0.1, kTRUE ); | |
282 | break; | |
283 | case 1: // 0.4 | |
284 | SetTrackerParam( 50, 100, 3, 10, | |
285 | 2, 15, | |
286 | 0, 0.1745, 5, 15, | |
287 | 5, 5, 50, 0.1, 0.1, kTRUE ); | |
288 | break; | |
289 | } | |
290 | break; | |
291 | } | |
738c049f | 292 | // Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "BField", "Setting b field to %f\n", bfs[closestBf] ); |
293 | // AliHLTTPCTransform::SetBField( bfs[closestBf] ); | |
78001a73 | 294 | |
295 | } | |
296 | } | |
297 | ||
298 | ||
299 | ||
300 | int AliHLTTPCSliceTrackerComponent::DoInit( int argc, const char** argv ) | |
301 | { | |
302 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "DoInit", "DoInit()" ); | |
303 | fprintf( stderr, "sizeof(AliHLTTPCTrackSegmentData): %d\n", sizeof(AliHLTTPCTrackSegmentData) ); | |
304 | ||
305 | if ( fTracker || fVertex ) | |
306 | return EINPROGRESS; | |
307 | fTracker = new AliHLTTPCConfMapper(); | |
308 | fVertex = new AliHLTTPCVertex(); | |
309 | fEta[0] = 0.; | |
738c049f | 310 | |
311 | #if 0 | |
312 | fEta[1] = 10.1; | |
313 | #else | |
314 | fEta[1] = 1.1; | |
315 | #endif | |
78001a73 | 316 | fDoNonVertex = false; |
317 | fMultiplicity = 4000; | |
318 | fBField = 0.4; | |
319 | fDoPP = false; | |
320 | ||
321 | int i = 0; | |
322 | char* cpErr; | |
323 | while ( i < argc ) | |
324 | { | |
325 | if ( !strcmp( argv[i], "pp-run" ) ) | |
326 | { | |
327 | fDoPP = true; | |
328 | i++; | |
329 | continue; | |
330 | } | |
331 | if ( !strcmp( argv[i], "multiplicity" ) ) | |
332 | { | |
333 | if ( argc <= i+1 ) | |
334 | { | |
335 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing multiplicity", "Missing event multiplicity specifier." ); | |
336 | return ENOTSUP; | |
337 | } | |
338 | fMultiplicity = strtoul( argv[i+1], &cpErr, 0 ); | |
339 | if ( *cpErr ) | |
340 | { | |
341 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing multiplicity", "Cannot convert event multiplicity specifier '%s'.", argv[i+1] ); | |
342 | return EINVAL; | |
343 | } | |
344 | i += 2; | |
345 | continue; | |
346 | } | |
347 | if ( !strcmp( argv[i], "bfield" ) ) | |
348 | { | |
349 | if ( argc <= i+1 ) | |
350 | { | |
351 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing B-field", "Missing B-field specifier." ); | |
352 | return ENOTSUP; | |
353 | } | |
354 | fBField = strtod( argv[i+1], &cpErr ); | |
355 | if ( *cpErr ) | |
356 | { | |
738c049f | 357 | // --JMT---------------------- MODIFY ---------------------------- |
358 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Missing B-field", "Cannot convert B-field specifier '%s'.", argv[i+1] ); | |
359 | // --JMT---------------------- MODIFY ---------------------------- | |
78001a73 | 360 | return EINVAL; |
361 | } | |
362 | i += 2; | |
363 | continue; | |
364 | } | |
738c049f | 365 | // --JMT---------------------- NEW ---------------------------- |
366 | if ( !strcmp( argv[i], "-nonvertextracking" ) ){ | |
367 | fnonvertextracking = kTRUE; | |
368 | i++; | |
369 | continue; | |
370 | } | |
371 | ||
372 | if ( !strcmp( argv[i], "-mainvertextrackingoff" ) ){ | |
373 | fmainvertextracking = kFALSE; | |
374 | i++; | |
375 | continue; | |
376 | } | |
377 | // --JMT---------------------- NEW ---------------------------- | |
378 | ||
78001a73 | 379 | Logging(kHLTLogError, "HLT::TPCSliceTracker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); |
380 | return EINVAL; | |
381 | } | |
738c049f | 382 | |
78001a73 | 383 | SetTrackerParam( fDoPP, fMultiplicity, fBField ); |
384 | return 0; | |
385 | } | |
386 | ||
387 | int AliHLTTPCSliceTrackerComponent::DoDeinit() | |
388 | { | |
389 | if ( fTracker ) | |
390 | delete fTracker; | |
391 | fTracker = NULL; | |
392 | if ( fVertex ) | |
393 | delete fVertex; | |
394 | fVertex = NULL; | |
395 | return 0; | |
396 | } | |
397 | ||
398 | int AliHLTTPCSliceTrackerComponent::DoEvent( const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks, | |
399 | AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr, | |
400 | AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks ) | |
401 | { | |
402 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "DoEvent", "DoEvent()" ); | |
403 | const AliHLTComponent_BlockData* iter = NULL; | |
404 | unsigned long ndx; | |
405 | AliHLTTPCClusterData* inPtrSP; | |
406 | AliHLTTPCVertexData* inPtrV = NULL; | |
407 | const AliHLTComponent_BlockData* vertexIter=NULL; | |
408 | AliHLTTPCTrackletData* outPtr; | |
409 | AliHLTUInt8_t* outBPtr; | |
410 | AliHLTUInt32_t vSize = 0; | |
411 | UInt_t offset=0, mysize, tSize = 0; | |
412 | outBPtr = outputPtr; | |
413 | Int_t slice, patch, row[2]; | |
414 | Int_t minPatch=INT_MAX, maxPatch = 0; | |
415 | offset = 0; | |
416 | std::vector<Int_t> slices; | |
417 | std::vector<Int_t>::iterator slIter, slEnd; | |
418 | std::vector<unsigned> sliceCnts; | |
419 | std::vector<unsigned>::iterator slCntIter; | |
420 | Int_t vertexSlice=0; | |
421 | ||
422 | // Find min/max rows used in total and find and read out vertex if it is present | |
423 | // also determine correct slice number, if multiple slice numbers are present in event | |
424 | // (which should not happen in the first place) we use the one that occurs the most times | |
425 | row[0] = 0; | |
426 | row[1] = 0; | |
427 | bool found; | |
428 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
429 | { | |
430 | iter = blocks+ndx; | |
431 | ||
432 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); | |
433 | found = false; | |
434 | slIter = slices.begin(); | |
435 | slEnd = slices.end(); | |
436 | slCntIter = sliceCnts.begin(); | |
437 | while ( slIter != slEnd ) | |
438 | { | |
439 | if ( *slIter == slice ) | |
440 | { | |
441 | found = true; | |
442 | break; | |
443 | } | |
444 | slIter++; | |
445 | slCntIter++; | |
446 | } | |
447 | if ( !found ) | |
448 | { | |
449 | slices.insert( slices.end(), slice ); | |
450 | sliceCnts.insert( sliceCnts.end(), 1 ); | |
451 | } | |
452 | else | |
453 | *slCntIter++; | |
454 | ||
455 | if ( iter->fDataType == AliHLTTPCDefinitions::gkVertexDataType ) | |
456 | { | |
457 | inPtrV = (AliHLTTPCVertexData*)(iter->fPtr); | |
458 | vertexIter = iter; | |
459 | vSize = iter->fSize; | |
460 | fVertex->Read( inPtrV ); | |
461 | vertexSlice = slice; | |
462 | } | |
463 | if ( iter->fDataType == AliHLTTPCDefinitions::gkClustersDataType ) | |
464 | { | |
465 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
466 | if ( minPatch>patch ) | |
467 | { | |
468 | minPatch = patch; | |
469 | row[0] = AliHLTTPCTransform::GetFirstRow( patch ); | |
470 | } | |
471 | if ( maxPatch<patch ) | |
472 | { | |
473 | maxPatch = patch; | |
474 | row[1] = AliHLTTPCTransform::GetLastRow( patch ); | |
475 | } | |
476 | } | |
477 | } | |
478 | ||
479 | // Determine slice number to really use. | |
480 | if ( slices.size()>1 ) | |
481 | { | |
482 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
483 | "Multiple slice numbers found in event 0x%08lX (%lu). Determining maximum occuring slice number...", | |
484 | evtData.fEventID, evtData.fEventID ); | |
485 | unsigned maxCntSlice=0; | |
486 | slIter = slices.begin(); | |
487 | slEnd = slices.end(); | |
488 | slCntIter = sliceCnts.begin(); | |
489 | while ( slIter != slEnd ) | |
490 | { | |
491 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
492 | "Slice %lu found %lu times.", *slIter, *slCntIter ); | |
493 | if ( maxCntSlice<*slCntIter ) | |
494 | { | |
495 | maxCntSlice = *slCntIter; | |
496 | slice = *slIter; | |
497 | } | |
498 | slIter++; | |
499 | slCntIter++; | |
500 | } | |
501 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
502 | "Using slice %lu.", slice ); | |
503 | } | |
504 | else | |
505 | slice = *(slices.begin()); | |
506 | ||
507 | if ( vertexSlice != slice ) | |
508 | { | |
509 | // multiple vertex blocks in event and we used the wrong one... | |
510 | found = false; | |
511 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
512 | { | |
513 | iter = blocks+ndx; | |
514 | if ( iter->fDataType == AliHLTTPCDefinitions::gkVertexDataType && slice==AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) | |
515 | { | |
516 | inPtrV = (AliHLTTPCVertexData*)(iter->fPtr); | |
517 | vertexIter = iter; | |
518 | vSize = iter->fSize; | |
519 | fVertex->Read( inPtrV ); | |
520 | break; | |
521 | } | |
522 | } | |
523 | } | |
524 | ||
525 | fTracker->InitSector( slice, row, fEta ); | |
526 | fTracker->SetVertex(fVertex); | |
527 | mysize = 0; | |
528 | // read in all hits | |
529 | std::vector<unsigned long> patchIndices; | |
530 | std::vector<unsigned long>::iterator pIter, pEnd; | |
531 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
532 | { | |
533 | iter = blocks+ndx; | |
534 | ||
535 | if ( iter->fDataType == AliHLTTPCDefinitions::gkClustersDataType && slice==AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) | |
536 | { | |
537 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
538 | pIter = patchIndices.begin(); | |
539 | pEnd = patchIndices.end(); | |
540 | while ( pIter!=pEnd && AliHLTTPCDefinitions::GetMinSliceNr( blocks[*pIter] ) < patch ) | |
541 | pIter++; | |
542 | patchIndices.insert( pIter, ndx ); | |
543 | } | |
544 | } | |
545 | pIter = patchIndices.begin(); | |
546 | pEnd = patchIndices.end(); | |
547 | while ( pIter!=pEnd ) | |
548 | { | |
549 | ndx = *pIter; | |
550 | iter = blocks+ndx; | |
551 | ||
552 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
553 | inPtrSP = (AliHLTTPCClusterData*)(iter->fPtr); | |
554 | ||
555 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Reading hits", | |
556 | "Reading hits for slice %d - patch %d", slice, patch ); | |
557 | fTracker->ReadHits( inPtrSP->fSpacePointCnt, inPtrSP->fSpacePoints ); | |
558 | pIter++; | |
559 | } | |
560 | ||
561 | outPtr = (AliHLTTPCTrackletData*)(outBPtr); | |
738c049f | 562 | |
563 | // --JMT---------------------- NEW ---------------------------- | |
564 | ||
565 | fTracker->SetPointers(); | |
566 | if ( fmainvertextracking == kTRUE && fnonvertextracking == kFALSE){ | |
567 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---MAINVERTEXTRACKING---"); | |
568 | fTracker->MainVertexTracking_a(); | |
569 | fTracker->MainVertexTracking_b(); | |
570 | fTracker->FillTracks(); | |
571 | } | |
572 | else if ( fmainvertextracking == kTRUE && fnonvertextracking == kTRUE){ | |
573 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---MAINVERTEXTRACKING---"); | |
574 | fTracker->MainVertexTracking_a(); | |
575 | fTracker->MainVertexTracking_b(); | |
576 | fTracker->FillTracks(); | |
577 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---NONVERTEXTRACKING---"); | |
578 | fTracker->NonVertexTracking(); | |
579 | } | |
580 | else if ( fmainvertextracking == kFALSE && fnonvertextracking == kTRUE){ | |
581 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---NONVERTEXTRACKING---"); | |
582 | fTracker->NonVertexTracking(); | |
583 | fTracker->FillTracks(); | |
584 | } | |
585 | ||
586 | #if 0 | |
78001a73 | 587 | fTracker->MainVertexTracking_a(); |
588 | fTracker->MainVertexTracking_b(); | |
589 | fTracker->FillTracks(); | |
738c049f | 590 | if (fDoNonVertex) fTracker->NonVertexTracking();//Do a second pass for nonvertex tracks |
591 | #endif | |
592 | // --JMT---------------------- NEW ---------------------------- | |
593 | ||
594 | ||
78001a73 | 595 | |
596 | // XXX Do track merging?? | |
597 | ||
598 | UInt_t ntracks0=0; | |
599 | mysize = fTracker->GetTracks()->WriteTracks( ntracks0, outPtr->fTracklets ); | |
600 | outPtr->fTrackletCnt = ntracks0; | |
601 | ||
602 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracks", | |
603 | "Input: Number of tracks: %lu Slice/MinPatch/MaxPatch/RowMin/RowMax: %lu/%lu/%lu/%lu/%lu.", | |
604 | ntracks0, slice, minPatch, maxPatch, row[0], row[1] ); | |
605 | ||
606 | tSize += mysize+sizeof(AliHLTTPCTrackletData); | |
607 | outBPtr += mysize+sizeof(AliHLTTPCTrackletData); | |
608 | ||
609 | AliHLTComponent_BlockData bd; | |
610 | FillBlockData( bd ); | |
611 | bd.fOffset = offset; | |
612 | bd.fSize = tSize; | |
613 | bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch ); | |
614 | outputBlocks.push_back( bd ); | |
615 | ||
616 | #ifdef FORWARD_VERTEX_BLOCK | |
617 | if ( vertexIter ) | |
618 | { | |
619 | // Copy the descriptor block for the vertex information. | |
620 | bd = *vertexIter; | |
621 | outputBlocks.push_back( bd ); | |
622 | } | |
623 | #endif // FORWARD_VERTEX_BLOCK | |
624 | ||
625 | size = tSize; | |
626 | return 0; | |
627 | } | |
628 | ||
629 |