]>
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" |
e8eee7af | 49 | #include "AliHLTCommonCDBEntries.h" |
669159ae | 50 | #include "TString.h" |
51 | #include "TObjString.h" | |
52 | #include "TObjArray.h" | |
53 | #include "AliCDBEntry.h" | |
54 | #include "AliCDBManager.h" | |
a7c32962 | 55 | //#include "AliHLTTPC.h" |
5df0cbb9 | 56 | //#include <stdlib.h> |
57 | //#include <cerrno> | |
71d7c760 | 58 | |
5df0cbb9 | 59 | /** ROOT macro for the implementation of ROOT specific class methods */ |
71d7c760 | 60 | ClassImp(AliHLTTPCSliceTrackerComponent) |
61 | ||
62 | AliHLTTPCSliceTrackerComponent::AliHLTTPCSliceTrackerComponent() | |
6235cd38 | 63 | : |
64 | fTracker(NULL), | |
65 | fVertex(NULL), | |
66 | fDoNonVertex(false), | |
ecefc48a | 67 | fDoPP(false), |
e6421c43 | 68 | fDoPbPb(false), |
6235cd38 | 69 | fMultiplicity(4000), |
70 | fBField(0.4), | |
6235cd38 | 71 | fnonvertextracking(kFALSE), |
ecefc48a | 72 | fmainvertextracking(kTRUE), |
e6421c43 | 73 | fPhisegment(50), |
74 | fEtasegment(100), | |
75 | fTrackletlength(3), | |
76 | fTracklength(60), | |
77 | fRowscopetracklet(6), | |
78 | fRowscopetrack(6), | |
79 | fMinPtFit(0), | |
80 | fMaxangle(0.1745), | |
81 | fGoodDist(5), | |
82 | fHitChi2Cut(100), | |
83 | fGoodHitChi2(5), | |
84 | fTrackChi2Cut(50), | |
85 | fMaxdist(50), | |
86 | fMaxphi(0.1), | |
b0914d2e | 87 | fMaxeta(0.1), |
88 | fpInterMerger(NULL) | |
6235cd38 | 89 | { |
90 | // see header file for class documentation | |
91 | // or | |
92 | // refer to README to build package | |
93 | // or | |
94 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
95 | fEta[0] = 0.; | |
96 | fEta[1] = 1.1; | |
97 | } | |
98 | ||
71d7c760 | 99 | AliHLTTPCSliceTrackerComponent::~AliHLTTPCSliceTrackerComponent() |
6235cd38 | 100 | { |
5df0cbb9 | 101 | // see header file for class documentation |
6235cd38 | 102 | } |
71d7c760 | 103 | |
104 | // Public functions to implement AliHLTComponent's interface. | |
105 | // These functions are required for the registration process | |
106 | ||
107 | const char* AliHLTTPCSliceTrackerComponent::GetComponentID() | |
6235cd38 | 108 | { |
5df0cbb9 | 109 | // see header file for class documentation |
6235cd38 | 110 | |
111 | return "TPCSliceTracker"; | |
112 | } | |
71d7c760 | 113 | |
7bcd6cad | 114 | void AliHLTTPCSliceTrackerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) |
6235cd38 | 115 | { |
5df0cbb9 | 116 | // see header file for class documentation |
6235cd38 | 117 | list.clear(); |
96bda103 | 118 | list.push_back( AliHLTTPCDefinitions::fgkClustersDataType ); |
119 | list.push_back( AliHLTTPCDefinitions::fgkVertexDataType ); | |
6235cd38 | 120 | } |
71d7c760 | 121 | |
8ede8717 | 122 | AliHLTComponentDataType AliHLTTPCSliceTrackerComponent::GetOutputDataType() |
6235cd38 | 123 | { |
5df0cbb9 | 124 | // see header file for class documentation |
96bda103 | 125 | return AliHLTTPCDefinitions::fgkTrackSegmentsDataType; |
6235cd38 | 126 | } |
71d7c760 | 127 | |
128 | void AliHLTTPCSliceTrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
6235cd38 | 129 | { |
5df0cbb9 | 130 | // see header file for class documentation |
6235cd38 | 131 | // XXX TODO: Find more realistic values. |
132 | constBase = 0; | |
e6421c43 | 133 | inputMultiplier = 1; |
6235cd38 | 134 | } |
71d7c760 | 135 | |
136 | AliHLTComponent* AliHLTTPCSliceTrackerComponent::Spawn() | |
6235cd38 | 137 | { |
5df0cbb9 | 138 | // see header file for class documentation |
6235cd38 | 139 | return new AliHLTTPCSliceTrackerComponent; |
140 | } | |
71d7c760 | 141 | |
6235cd38 | 142 | void AliHLTTPCSliceTrackerComponent::SetTrackerParam(Int_t phiSegments, Int_t etaSegments, |
71d7c760 | 143 | Int_t trackletlength, Int_t tracklength, |
144 | Int_t rowscopetracklet, Int_t rowscopetrack, | |
6235cd38 | 145 | Double_t minPtFit, Double_t maxangle, |
71d7c760 | 146 | Double_t goodDist, Double_t hitChi2Cut, |
147 | Double_t goodHitChi2, Double_t trackChi2Cut, | |
e6421c43 | 148 | Int_t maxdist, Double_t maxphi,Double_t maxeta) |
149 | { | |
5df0cbb9 | 150 | // see header file for class documentation |
71d7c760 | 151 | //fTracker->SetClusterFinderParam( fXYClusterError, fZClusterError, kTRUE ); // ?? |
152 | //Set parameters input to the tracker | |
153 | //If no arguments are given, default parameters will be used | |
154 | ||
6235cd38 | 155 | fTracker->SetNSegments(phiSegments,etaSegments); |
156 | fTracker->SetMaxDca(minPtFit); | |
71d7c760 | 157 | // fTracker->MainVertexSettings(trackletlength,tracklength,rowscopetracklet,rowscopetrack); |
738c049f | 158 | |
db16520a | 159 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "==============================" ); |
738c049f | 160 | |
161 | if ( fmainvertextracking == kTRUE && fnonvertextracking == kFALSE){ | |
162 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kTRUE); | |
163 | fTracker->SetTrackletCuts(maxangle,goodDist,kTRUE); | |
164 | ||
165 | fTracker->MainVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack, maxphi, maxeta); | |
db16520a | 166 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "MAINVERTEXTRACKING" ); |
738c049f | 167 | } |
168 | else if ( fmainvertextracking == kTRUE && fnonvertextracking == kTRUE){ | |
169 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kTRUE); | |
170 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kFALSE); | |
171 | fTracker->SetTrackletCuts(maxangle,goodDist,kTRUE); | |
172 | fTracker->SetTrackletCuts(maxangle,goodDist,kFALSE); | |
173 | ||
174 | fTracker->MainVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack, maxphi, maxeta); | |
175 | fTracker->NonVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack); | |
db16520a | 176 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "MAINVERTEXTRACKING - NONVERTEXTRACKING" ); |
738c049f | 177 | } |
178 | else if ( fmainvertextracking == kFALSE && fnonvertextracking == kTRUE){ | |
179 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,kFALSE); | |
180 | fTracker->SetTrackletCuts(maxangle,goodDist,kFALSE); | |
181 | ||
182 | fTracker->NonVertexSettings( trackletlength, tracklength, rowscopetracklet, rowscopetrack); | |
db16520a | 183 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::SetTrackerParam", "Tracking", "NONVERTEXTRACKING" ); |
738c049f | 184 | } |
71d7c760 | 185 | |
738c049f | 186 | //fTracker->SetParamDone(true); |
a7c32962 | 187 | /* Matthias 13.12.2006 |
188 | * the global variable AliHLTTPCS::fgDoVertexFit has never been used so far | |
189 | * and has always been kTRUE. | |
190 | * In order to remove the AliHLTTPC class (which is the old steering class for | |
191 | * HLT (TPC) tracking) from the compilation, this function can not be activated | |
192 | * again. We have to think about a more elegant way to specify the parameters | |
193 | * anyway. The following line was surely for some testing, but was never active | |
194 | * in a tested release. | |
195 | */ | |
a6c02c85 | 196 | //AliHLTTPC::SetVertexFit( kFALSE ); |
71d7c760 | 197 | |
198 | fTracker->InitVolumes(); | |
199 | } | |
200 | ||
738c049f | 201 | |
e6421c43 | 202 | void AliHLTTPCSliceTrackerComponent::SetTrackerParam( Bool_t doPP, Bool_t doPbPb, Int_t multiplicity, |
203 | Double_t bField, Int_t etasegment, Double_t hitchi2cut, | |
204 | Int_t rowscopetracklet, Int_t rowscopetrack, | |
205 | Int_t trackletlength, Int_t tracklength ) | |
206 | { | |
207 | // see header file for class documentation | |
208 | AliHLTTPCTransform::SetBField( bField ); | |
209 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "BField", "Setting b field to %f T\n", bField ); | |
210 | ||
211 | if ( doPP ) | |
212 | { | |
213 | //tracker->SetClusterFinderParam(xyerror,zerror,kTRUE); // ?? | |
214 | ||
215 | SetTrackerParam( 50, 100, 3, 10, | |
216 | 2, 2, | |
217 | 0, 0.1745, 5, 100, | |
218 | 5, 50, 50, 0.1, 0.1); | |
219 | } | |
220 | else if(doPbPb) | |
221 | { | |
222 | int mults[] = { 1000, 2000, 4000, 8000 }; | |
223 | int multCount = 4; | |
224 | int closestMult = 0; | |
225 | int i; | |
226 | int multDist, tmpMultDist; | |
227 | if ( multiplicity>mults[closestMult] ) | |
228 | multDist = multiplicity-mults[closestMult]; | |
229 | else | |
230 | multDist = mults[closestMult]-multiplicity; | |
231 | for ( i = 1; i < multCount; i++ ) | |
71d7c760 | 232 | { |
e6421c43 | 233 | if ( multiplicity>mults[i] ) |
234 | tmpMultDist = multiplicity-mults[i]; | |
235 | else | |
236 | tmpMultDist = mults[i]-multiplicity; | |
237 | if ( tmpMultDist < multDist ) | |
238 | { | |
239 | closestMult = i; | |
240 | multDist = tmpMultDist; | |
241 | } | |
71d7c760 | 242 | } |
e6421c43 | 243 | |
244 | double bfs[] = { 0.2, 0.4 }; | |
245 | int bfCount = 2; | |
246 | int closestBf = 0; | |
247 | double bfDist, tmpBFDist; | |
248 | if ( bField>bfs[closestBf] ) | |
249 | bfDist = bField-bfs[closestBf]; | |
250 | else | |
251 | bfDist = bfs[closestBf]-bField; | |
252 | for ( i = 1; i < bfCount; i++ ) | |
71d7c760 | 253 | { |
e6421c43 | 254 | if ( bField>bfs[i] ) |
255 | tmpBFDist = bField-bfs[i]; | |
256 | else | |
257 | tmpBFDist = bfs[i]-bField; | |
258 | if ( tmpBFDist < bfDist ) | |
71d7c760 | 259 | { |
e6421c43 | 260 | closestBf = i; |
261 | bfDist = tmpBFDist; | |
71d7c760 | 262 | } |
e6421c43 | 263 | } |
264 | ||
265 | switch ( closestMult ) | |
266 | { | |
267 | case 0: // 1000 | |
268 | switch ( closestBf ) | |
71d7c760 | 269 | { |
e6421c43 | 270 | case 0: // 0.2 |
271 | SetTrackerParam( 50, 100, 3, 10, | |
272 | 2, 4, | |
273 | 0, 0.1745, 5, 100, | |
274 | 5, 50, 50, 0.1, 0.1); | |
275 | break; | |
276 | case 1: // 0.4 | |
277 | SetTrackerParam( 50, 100, 3, 10, | |
278 | 2, 4, | |
279 | 0, 0.1745, 5, 100, | |
280 | 5, 50, 50, 0.1, 0.1); | |
281 | break; | |
71d7c760 | 282 | } |
e6421c43 | 283 | break; |
284 | case 1: // 2000 | |
285 | switch ( closestBf ) | |
71d7c760 | 286 | { |
e6421c43 | 287 | case 0: // 0.2 |
288 | SetTrackerParam( 50, 100, 3, 10, | |
289 | 2, 4, | |
290 | 0, 0.1745, 5, 30, | |
291 | 5, 20, 50, 0.1, 0.1); | |
292 | break; | |
293 | case 1: // 0.4 | |
294 | SetTrackerParam( 50, 100, 3, 10, | |
295 | 2, 5, | |
296 | 0, 0.1745, 5, 30, | |
297 | 5, 20, 50, 0.1, 0.1); | |
298 | break; | |
299 | } | |
300 | break; | |
301 | case 2: // 4000 | |
302 | switch ( closestBf ) | |
303 | { | |
304 | case 0: // 0.2 | |
305 | SetTrackerParam( 50, 100, 3, 10, | |
306 | 2 , 10, | |
307 | 0, 0.1745, 5, 20, | |
308 | 5, 10 , 50, 0.1, 0.1); | |
309 | break; | |
310 | case 1: // 0.4 | |
311 | SetTrackerParam( 50, 100, 3, 10, | |
312 | 2, 10, | |
313 | 0, 0.1745, 5, 20, | |
314 | 5, 10, 50, 0.1, 0.1); | |
315 | break; | |
316 | } | |
317 | break; | |
318 | case 3: // 8000 | |
319 | switch ( closestBf ) | |
320 | { | |
321 | case 0: // 0.2 | |
322 | SetTrackerParam( 50, 100, 3, 10, | |
323 | 3, 15, | |
324 | 0, 0.1745, 5, 10, | |
325 | 5, 5, 50, 0.1, 0.1); | |
326 | break; | |
327 | case 1: // 0.4 | |
328 | SetTrackerParam( 50, 100, 3, 10, | |
329 | 2, 15, | |
330 | 0, 0.1745, 5, 15, | |
331 | 5, 5, 50, 0.1, 0.1); | |
332 | break; | |
71d7c760 | 333 | } |
e6421c43 | 334 | break; |
71d7c760 | 335 | } |
e6421c43 | 336 | // Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "BField", "Setting b field to %f\n", bfs[closestBf] ); |
337 | // AliHLTTPCTransform::SetBField( bfs[closestBf] ); | |
338 | // AliHLTTPCTransform::SetBField( bField ); | |
339 | // Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "BField", "Setting b field to %f\n", bField ); | |
71d7c760 | 340 | } |
e6421c43 | 341 | else |
342 | { | |
343 | SetTrackerParam( 50, etasegment, trackletlength, tracklength, | |
344 | rowscopetracklet, rowscopetrack, | |
345 | 0, 0.1745, 5, hitchi2cut, | |
346 | 5, 50, 50, 0.1, 0.1); | |
347 | } | |
348 | } | |
71d7c760 | 349 | |
350 | int AliHLTTPCSliceTrackerComponent::DoInit( int argc, const char** argv ) | |
351 | { | |
5df0cbb9 | 352 | // see header file for class documentation |
a6c02c85 | 353 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "DoInit", "DoInit()" ); |
a6c02c85 | 354 | |
71d7c760 | 355 | if ( fTracker || fVertex ) |
356 | return EINPROGRESS; | |
a6c02c85 | 357 | fTracker = new AliHLTTPCConfMapper(); |
358 | fVertex = new AliHLTTPCVertex(); | |
71d7c760 | 359 | fEta[0] = 0.; |
360 | fEta[1] = 1.1; | |
361 | fDoNonVertex = false; | |
a6c02c85 | 362 | fMultiplicity = 4000; |
e6421c43 | 363 | fBField = 0.5; |
a6c02c85 | 364 | fDoPP = false; |
e6421c43 | 365 | fDoPbPb = false; |
366 | fPhisegment=50; | |
367 | fEtasegment=100; | |
368 | fTrackletlength=3; | |
369 | fTracklength=60; | |
370 | fRowscopetracklet=6; | |
371 | fRowscopetrack=6; | |
372 | fMinPtFit=0; | |
373 | fMaxangle=0.1745; | |
374 | fGoodDist=5; | |
375 | fHitChi2Cut=100; | |
376 | fGoodHitChi2=5; | |
377 | fTrackChi2Cut=50; | |
378 | fMaxdist=50; | |
379 | fMaxphi=0.1; | |
380 | fMaxeta=0.1; | |
669159ae | 381 | int iResult=0; |
437e8e54 | 382 | |
669159ae | 383 | TString configuration=""; |
384 | TString argument=""; | |
385 | for (int i=0; i<argc && iResult>=0; i++) { | |
386 | argument=argv[i]; | |
387 | if (!configuration.IsNull()) configuration+=" "; | |
388 | configuration+=argument; | |
389 | } | |
ecefc48a | 390 | |
669159ae | 391 | if (!configuration.IsNull()) { |
392 | iResult=Configure(configuration.Data()); | |
393 | } else { | |
394 | iResult=Reconfigure(NULL, NULL); | |
395 | } | |
396 | ||
397 | return iResult; | |
71d7c760 | 398 | } |
399 | ||
400 | int AliHLTTPCSliceTrackerComponent::DoDeinit() | |
ecefc48a | 401 | { |
5df0cbb9 | 402 | // see header file for class documentation |
ecefc48a | 403 | if ( fTracker ) |
404 | delete fTracker; | |
405 | fTracker = NULL; | |
406 | if ( fVertex ) | |
407 | delete fVertex; | |
408 | fVertex = NULL; | |
409 | if (fpInterMerger) { | |
410 | delete fpInterMerger; | |
411 | } | |
412 | fpInterMerger=NULL; | |
413 | return 0; | |
414 | } | |
71d7c760 | 415 | |
8ede8717 | 416 | int AliHLTTPCSliceTrackerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, |
5d2abf3b | 417 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, |
7bcd6cad | 418 | AliHLTUInt32_t& size, AliHLTComponentBlockDataList& outputBlocks ) |
71d7c760 | 419 | { |
5df0cbb9 | 420 | // see header file for class documentation |
a6c02c85 | 421 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "DoEvent", "DoEvent()" ); |
5235c3e9 | 422 | if ( evtData.fBlockCnt<=0 ) |
423 | { | |
424 | Logging( kHLTLogWarning, "HLT::TPCSliceTracker::DoEvent", "DoEvent", "no blocks in event" ); | |
425 | return 0; | |
426 | } | |
8ede8717 | 427 | const AliHLTComponentBlockData* iter = NULL; |
71d7c760 | 428 | unsigned long ndx; |
429 | AliHLTTPCClusterData* inPtrSP; | |
a6c02c85 | 430 | AliHLTTPCVertexData* inPtrV = NULL; |
8ede8717 | 431 | const AliHLTComponentBlockData* vertexIter=NULL; |
71d7c760 | 432 | AliHLTTPCTrackletData* outPtr; |
433 | AliHLTUInt8_t* outBPtr; | |
434 | AliHLTUInt32_t vSize = 0; | |
435 | UInt_t offset=0, mysize, tSize = 0; | |
436 | outBPtr = outputPtr; | |
5235c3e9 | 437 | Int_t slice=-1, patch=-1, row[2]; |
71d7c760 | 438 | Int_t minPatch=INT_MAX, maxPatch = 0; |
439 | offset = 0; | |
440 | std::vector<Int_t> slices; | |
441 | std::vector<Int_t>::iterator slIter, slEnd; | |
442 | std::vector<unsigned> sliceCnts; | |
443 | std::vector<unsigned>::iterator slCntIter; | |
5235c3e9 | 444 | Int_t vertexSlice=-1; |
71d7c760 | 445 | |
446 | // Find min/max rows used in total and find and read out vertex if it is present | |
447 | // also determine correct slice number, if multiple slice numbers are present in event | |
448 | // (which should not happen in the first place) we use the one that occurs the most times | |
449 | row[0] = 0; | |
450 | row[1] = 0; | |
451 | bool found; | |
452 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
453 | { | |
454 | iter = blocks+ndx; | |
455 | ||
cb703d46 | 456 | if(iter->fDataType!=AliHLTTPCDefinitions::fgkClustersDataType){ |
457 | HLTDebug("Data block type is not of type AliHLTTPCDefinitions::fgkClustersDataType"); | |
458 | continue; | |
459 | } | |
460 | ||
71d7c760 | 461 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); |
462 | found = false; | |
463 | slIter = slices.begin(); | |
464 | slEnd = slices.end(); | |
465 | slCntIter = sliceCnts.begin(); | |
466 | while ( slIter != slEnd ) | |
467 | { | |
468 | if ( *slIter == slice ) | |
469 | { | |
470 | found = true; | |
471 | break; | |
472 | } | |
473 | slIter++; | |
474 | slCntIter++; | |
475 | } | |
476 | if ( !found ) | |
477 | { | |
478 | slices.insert( slices.end(), slice ); | |
479 | sliceCnts.insert( sliceCnts.end(), 1 ); | |
480 | } | |
481 | else | |
482 | *slCntIter++; | |
483 | ||
96bda103 | 484 | if ( iter->fDataType == AliHLTTPCDefinitions::fgkVertexDataType ) |
71d7c760 | 485 | { |
a6c02c85 | 486 | inPtrV = (AliHLTTPCVertexData*)(iter->fPtr); |
71d7c760 | 487 | vertexIter = iter; |
488 | vSize = iter->fSize; | |
489 | fVertex->Read( inPtrV ); | |
490 | vertexSlice = slice; | |
491 | } | |
96bda103 | 492 | if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ) |
71d7c760 | 493 | { |
494 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
495 | if ( minPatch>patch ) | |
496 | { | |
497 | minPatch = patch; | |
a6c02c85 | 498 | row[0] = AliHLTTPCTransform::GetFirstRow( patch ); |
71d7c760 | 499 | } |
500 | if ( maxPatch<patch ) | |
501 | { | |
502 | maxPatch = patch; | |
a6c02c85 | 503 | row[1] = AliHLTTPCTransform::GetLastRow( patch ); |
71d7c760 | 504 | } |
505 | } | |
506 | } | |
507 | ||
508 | // Determine slice number to really use. | |
509 | if ( slices.size()>1 ) | |
510 | { | |
511 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
512 | "Multiple slice numbers found in event 0x%08lX (%lu). Determining maximum occuring slice number...", | |
513 | evtData.fEventID, evtData.fEventID ); | |
514 | unsigned maxCntSlice=0; | |
515 | slIter = slices.begin(); | |
516 | slEnd = slices.end(); | |
517 | slCntIter = sliceCnts.begin(); | |
518 | while ( slIter != slEnd ) | |
519 | { | |
520 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
521 | "Slice %lu found %lu times.", *slIter, *slCntIter ); | |
522 | if ( maxCntSlice<*slCntIter ) | |
523 | { | |
524 | maxCntSlice = *slCntIter; | |
525 | slice = *slIter; | |
526 | } | |
527 | slIter++; | |
528 | slCntIter++; | |
529 | } | |
530 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
531 | "Using slice %lu.", slice ); | |
532 | } | |
5235c3e9 | 533 | else if ( slices.size()>0 ) |
534 | { | |
71d7c760 | 535 | slice = *(slices.begin()); |
5235c3e9 | 536 | } |
537 | else | |
538 | { | |
539 | slice = -1; | |
540 | } | |
71d7c760 | 541 | |
542 | if ( vertexSlice != slice ) | |
543 | { | |
544 | // multiple vertex blocks in event and we used the wrong one... | |
545 | found = false; | |
546 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
547 | { | |
548 | iter = blocks+ndx; | |
96bda103 | 549 | if ( iter->fDataType == AliHLTTPCDefinitions::fgkVertexDataType && slice==AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) |
71d7c760 | 550 | { |
a6c02c85 | 551 | inPtrV = (AliHLTTPCVertexData*)(iter->fPtr); |
71d7c760 | 552 | vertexIter = iter; |
553 | vSize = iter->fSize; | |
554 | fVertex->Read( inPtrV ); | |
555 | break; | |
556 | } | |
557 | } | |
558 | } | |
559 | ||
560 | fTracker->InitSector( slice, row, fEta ); | |
561 | fTracker->SetVertex(fVertex); | |
562 | mysize = 0; | |
563 | // read in all hits | |
a6c02c85 | 564 | std::vector<unsigned long> patchIndices; |
565 | std::vector<unsigned long>::iterator pIter, pEnd; | |
71d7c760 | 566 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
567 | { | |
568 | iter = blocks+ndx; | |
569 | ||
96bda103 | 570 | if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType && slice==AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) |
71d7c760 | 571 | { |
572 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
a6c02c85 | 573 | pIter = patchIndices.begin(); |
574 | pEnd = patchIndices.end(); | |
575 | while ( pIter!=pEnd && AliHLTTPCDefinitions::GetMinSliceNr( blocks[*pIter] ) < patch ) | |
576 | pIter++; | |
577 | patchIndices.insert( pIter, ndx ); | |
71d7c760 | 578 | } |
579 | } | |
a6c02c85 | 580 | pIter = patchIndices.begin(); |
581 | pEnd = patchIndices.end(); | |
582 | while ( pIter!=pEnd ) | |
583 | { | |
584 | ndx = *pIter; | |
585 | iter = blocks+ndx; | |
586 | ||
587 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
588 | inPtrSP = (AliHLTTPCClusterData*)(iter->fPtr); | |
589 | ||
590 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Reading hits", | |
591 | "Reading hits for slice %d - patch %d", slice, patch ); | |
592 | fTracker->ReadHits( inPtrSP->fSpacePointCnt, inPtrSP->fSpacePoints ); | |
593 | pIter++; | |
594 | } | |
71d7c760 | 595 | |
596 | outPtr = (AliHLTTPCTrackletData*)(outBPtr); | |
437e8e54 | 597 | |
738c049f | 598 | if ( fmainvertextracking == kTRUE && fnonvertextracking == kFALSE){ |
437e8e54 | 599 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---MAINVERTEXTRACKING---"); |
600 | fTracker->MainVertexTrackingA(); | |
601 | fTracker->MainVertexTrackingB(); | |
602 | fTracker->FillTracks(); | |
738c049f | 603 | } |
604 | else if ( fmainvertextracking == kTRUE && fnonvertextracking == kTRUE){ | |
437e8e54 | 605 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---MAINVERTEXTRACKING---"); |
606 | fTracker->MainVertexTrackingA(); | |
607 | fTracker->MainVertexTrackingB(); | |
608 | fTracker->FillTracks(); | |
609 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---NONVERTEXTRACKING---"); | |
610 | fTracker->NonVertexTracking(); | |
738c049f | 611 | } |
612 | else if ( fmainvertextracking == kFALSE && fnonvertextracking == kTRUE){ | |
437e8e54 | 613 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracking", " ---NONVERTEXTRACKING---"); |
614 | fTracker->NonVertexTracking(); | |
615 | fTracker->FillTracks(); | |
738c049f | 616 | } |
437e8e54 | 617 | |
ecefc48a | 618 | UInt_t ntracks0 =0; |
619 | if(fpInterMerger){ | |
620 | AliHLTTPCMemHandler memory; | |
621 | AliHLTTPCTrackSegmentData *trackdata0 = | |
622 | (AliHLTTPCTrackSegmentData *) memory.Allocate(fTracker->GetTracks()); | |
623 | memory.TrackArray2Memory(ntracks0,trackdata0,fTracker->GetTracks()); | |
624 | fpInterMerger->Reset(); | |
625 | fpInterMerger->Init(row,patch); | |
626 | fpInterMerger->FillTracks(ntracks0,trackdata0); | |
627 | fpInterMerger->Merge(); | |
628 | } | |
629 | ntracks0=0; | |
5df0cbb9 | 630 | AliHLTTPCTrackArray* pArray=fTracker->GetTracks(); |
631 | mysize = pArray->WriteTracks( ntracks0, outPtr->fTracklets ); | |
71d7c760 | 632 | outPtr->fTrackletCnt = ntracks0; |
ecefc48a | 633 | |
71d7c760 | 634 | Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracks", |
635 | "Input: Number of tracks: %lu Slice/MinPatch/MaxPatch/RowMin/RowMax: %lu/%lu/%lu/%lu/%lu.", | |
636 | ntracks0, slice, minPatch, maxPatch, row[0], row[1] ); | |
637 | ||
055fed30 | 638 | fTracker->Reset(); |
639 | ||
71d7c760 | 640 | tSize += mysize+sizeof(AliHLTTPCTrackletData); |
641 | outBPtr += mysize+sizeof(AliHLTTPCTrackletData); | |
642 | ||
8ede8717 | 643 | AliHLTComponentBlockData bd; |
71d7c760 | 644 | FillBlockData( bd ); |
645 | bd.fOffset = offset; | |
646 | bd.fSize = tSize; | |
647 | bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch ); | |
648 | outputBlocks.push_back( bd ); | |
649 | ||
650 | #ifdef FORWARD_VERTEX_BLOCK | |
651 | if ( vertexIter ) | |
652 | { | |
653 | // Copy the descriptor block for the vertex information. | |
654 | bd = *vertexIter; | |
655 | outputBlocks.push_back( bd ); | |
656 | } | |
657 | #endif // FORWARD_VERTEX_BLOCK | |
658 | ||
659 | size = tSize; | |
660 | return 0; | |
661 | } | |
662 | ||
669159ae | 663 | int AliHLTTPCSliceTrackerComponent::Configure(const char* arguments) |
664 | { | |
665 | // see header file for class documentation | |
666 | int iResult=0; | |
667 | if (!arguments) return iResult; | |
668 | ||
669 | TString allArgs=arguments; | |
670 | TString argument; | |
671 | int bMissingParam=0; | |
672 | Bool_t bDoMerger=kTRUE; | |
673 | ||
674 | TObjArray* pTokens=allArgs.Tokenize(" "); | |
675 | if (pTokens) { | |
676 | for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
677 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
678 | if (argument.IsNull()) continue; | |
679 | ||
680 | if (argument.CompareTo("-disable-merger")==0) { | |
681 | HLTInfo("Disabled Inter Merger"); | |
682 | bDoMerger = kFALSE; | |
683 | continue; | |
684 | } | |
685 | else if (argument.CompareTo("-pp-run")==0) { | |
686 | HLTInfo("Using Trackparameters for pp-run"); | |
687 | fDoPP = true; | |
688 | continue; | |
689 | } | |
690 | else if (argument.CompareTo("-PbPb-run")==0) { | |
691 | HLTInfo("Using Trackparameters for Pb-Pb-run"); | |
692 | fDoPbPb = true; | |
693 | continue; | |
694 | } | |
695 | else if (argument.CompareTo("-nonvertextracking")==0) { | |
696 | HLTInfo("Doing Nonvertex Tracking"); | |
697 | fnonvertextracking = kTRUE; | |
698 | continue; | |
699 | } | |
700 | else if (argument.CompareTo("-mainvertextrackingoff")==0) { | |
701 | HLTInfo("Mainvertex Tracking off"); | |
702 | fmainvertextracking = kFALSE; | |
703 | continue; | |
704 | } | |
705 | else if (argument.CompareTo("-multiplicity")==0) { | |
706 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
707 | HLTInfo("Multiplicity set to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
708 | fMultiplicity=((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
709 | continue; | |
710 | } | |
711 | else if (argument.CompareTo("-bfield")==0) { | |
712 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
713 | HLTInfo("Magnetic Field set to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
714 | fBField=((TObjString*)pTokens->At(i))->GetString().Atof(); | |
715 | continue; | |
716 | } | |
717 | else if (argument.CompareTo("-etarange")==0) { | |
718 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
719 | HLTInfo("Etarange set to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
720 | fEta[1]=((TObjString*)pTokens->At(i))->GetString().Atof(); | |
721 | continue; | |
722 | } | |
723 | else if (argument.CompareTo("-etasegment")==0) { | |
724 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
725 | HLTInfo("Number of Etasegment: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
726 | fEtasegment=((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
727 | continue; | |
728 | } | |
729 | else if (argument.CompareTo("-chi2cut")==0) { | |
730 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
731 | HLTInfo("chi2cut set to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
732 | fHitChi2Cut=((TObjString*)pTokens->At(i))->GetString().Atof(); | |
733 | continue; | |
734 | } | |
735 | else if (argument.CompareTo("-rowscopetracklet")==0) { | |
736 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
737 | HLTInfo("Number of row to look for next cluster for tracklet: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
738 | fRowscopetracklet=((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
739 | continue; | |
740 | } | |
741 | else if (argument.CompareTo("-rowscopetrack")==0) { | |
742 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
743 | HLTInfo("Number of row to look for next cluster for track: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
744 | fRowscopetrack=((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
745 | continue; | |
746 | } | |
747 | else if (argument.CompareTo("-trackletlength")==0) { | |
748 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
749 | HLTInfo("Minimum number of clusters on a Tracklet: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
750 | fTrackletlength=((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
751 | continue; | |
752 | } | |
753 | else if (argument.CompareTo("-tracklength")==0) { | |
754 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
755 | HLTInfo("Minimum number of clusters on a Track: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
756 | fTracklength=((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
757 | continue; | |
758 | } | |
759 | else { | |
760 | HLTError("unknown argument %s", argument.Data()); | |
761 | iResult=-EINVAL; | |
762 | break; | |
763 | } | |
764 | } | |
765 | delete pTokens; | |
766 | } | |
767 | if (bMissingParam) { | |
768 | HLTError("missing parameter for argument %s", argument.Data()); | |
769 | iResult=-EINVAL; | |
770 | } | |
771 | if (fBField == 0.){ | |
772 | // parameter for B=0 T | |
773 | fDoPP = kTRUE; | |
774 | fnonvertextracking = kTRUE; | |
775 | fmainvertextracking = kFALSE; | |
776 | } | |
777 | ||
778 | if (bDoMerger) | |
779 | fpInterMerger = new AliHLTTPCInterMerger(); | |
780 | else | |
781 | fpInterMerger = NULL; | |
782 | ||
783 | SetTrackerParam(fDoPP,fDoPbPb,fMultiplicity,fBField,fEtasegment,fHitChi2Cut,fRowscopetracklet,fRowscopetrack,fTrackletlength,fTracklength); | |
784 | ||
785 | return iResult; | |
786 | } | |
787 | ||
788 | int AliHLTTPCSliceTrackerComponent::Reconfigure(const char* cdbEntry, const char* chainId) | |
789 | { | |
790 | // see header file for class documentation | |
791 | int iResult=0; | |
792 | const char* path="HLT/ConfigTPC/SliceTrackerComponent"; | |
793 | const char* defaultNotify=""; | |
794 | if (cdbEntry) { | |
795 | path=cdbEntry; | |
796 | defaultNotify=" (default)"; | |
797 | } | |
798 | if (path) { | |
799 | HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
800 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
801 | if (pEntry) { | |
802 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
803 | if (pString) { | |
804 | HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data()); | |
805 | iResult=Configure(pString->GetString().Data()); | |
806 | } else { | |
807 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
808 | } | |
809 | } else { | |
810 | HLTError("can not fetch object \"%s\" from CDB", path); | |
811 | } | |
812 | } | |
a67402b3 | 813 | |
e8eee7af | 814 | const char* pathBField=kAliHLTCDBSolenoidBz; |
a67402b3 | 815 | |
816 | if (pathBField) { | |
817 | HLTInfo("reconfigure B-Field from entry %s, chain id %s", path,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
818 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/); | |
819 | if (pEntry) { | |
820 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
821 | if (pString) { | |
822 | HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data()); | |
823 | iResult=Configure(pString->GetString().Data()); | |
824 | } else { | |
825 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
826 | } | |
827 | } else { | |
828 | HLTError("can not fetch object \"%s\" from CDB", path); | |
829 | } | |
830 | } | |
831 | ||
669159ae | 832 | return iResult; |
833 | } | |
834 | ||
5df0cbb9 | 835 | void AliHLTTPCSliceTrackerComponent::SetTrackerParam1() |
836 | { | |
e67b0680 | 837 | // see header file for class documentation |
5df0cbb9 | 838 | SetTrackerParam( 10, 20, 5, 10, 2,2, |
839 | 0, 1.31, 5, 100, | |
e6421c43 | 840 | 50, 100, 50, 0.1, 0.1); |
5df0cbb9 | 841 | } |
842 | ||
71d7c760 | 843 |