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