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