]>
Commit | Line | Data |
---|---|---|
cf471b1e | 1 | // @(#) $Id$ |
2 | /************************************************************************** | |
3 | * This file is property of and copyright by the ALICE HLT Project * | |
4 | * ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> * | |
7 | * Ivan Kisel <kisel@kip.uni-heidelberg.de> * | |
8 | * for The ALICE HLT Project. * | |
9 | * * | |
10 | * Permission to use, copy, modify and distribute this software and its * | |
11 | * documentation strictly for non-commercial purposes is hereby granted * | |
12 | * without fee, provided that the above copyright notice appears in all * | |
13 | * copies and that both the copyright notice and this permission notice * | |
14 | * appear in the supporting documentation. The authors make no claims * | |
15 | * about the suitability of this software for any purpose. It is * | |
16 | * provided "as is" without express or implied warranty. * | |
17 | **************************************************************************/ | |
18 | ||
19 | /////////////////////////////////////////////////////////////////////////////// | |
20 | // // | |
21 | // a TPC tracker processing component for the HLT based on CA by Ivan Kisel // | |
22 | // // | |
23 | /////////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #if __GNUC__>= 3 | |
26 | using namespace std; | |
27 | #endif | |
28 | ||
29 | #include "AliHLTTPCCATrackerComponent.h" | |
30 | #include "AliHLTTPCTransform.h" | |
31 | #include "AliHLTTPCCATracker.h" | |
32 | #include "AliHLTTPCCAHit.h" | |
33 | #include "AliHLTTPCCAOutTrack.h" | |
34 | ||
cf471b1e | 35 | #include "AliHLTTPCSpacePointData.h" |
cf471b1e | 36 | #include "AliHLTTPCClusterDataFormat.h" |
37 | #include "AliHLTTPCTransform.h" | |
38 | #include "AliHLTTPCTrackSegmentData.h" | |
39 | #include "AliHLTTPCTrackArray.h" | |
40 | #include "AliHLTTPCTrackletDataFormat.h" | |
41 | #include "AliHLTTPCDefinitions.h" | |
dc4788ec | 42 | #include "TStopwatch.h" |
cf471b1e | 43 | #include "TMath.h" |
cf471b1e | 44 | |
45 | ||
46 | // this is a global object used for automatic component registration, do not use this | |
47 | AliHLTTPCCATrackerComponent gAliHLTTPCCATrackerComponent; | |
48 | ||
49 | ClassImp(AliHLTTPCCATrackerComponent) | |
50 | ||
51 | AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent() | |
52 | : | |
53 | fTracker(NULL), | |
cf471b1e | 54 | fBField(0) |
55 | { | |
56 | // see header file for class documentation | |
57 | // or | |
58 | // refer to README to build package | |
59 | // or | |
60 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
61 | } | |
62 | ||
63 | AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent(const AliHLTTPCCATrackerComponent&) | |
64 | : | |
65 | fTracker(NULL), | |
cf471b1e | 66 | fBField(0) |
67 | { | |
68 | // see header file for class documentation | |
69 | HLTFatal("copy constructor untested"); | |
70 | } | |
71 | ||
72 | AliHLTTPCCATrackerComponent& AliHLTTPCCATrackerComponent::operator=(const AliHLTTPCCATrackerComponent&) | |
73 | { | |
74 | // see header file for class documentation | |
75 | HLTFatal("assignment operator untested"); | |
76 | return *this; | |
77 | } | |
78 | ||
79 | AliHLTTPCCATrackerComponent::~AliHLTTPCCATrackerComponent() | |
4c256004 | 80 | { |
cf471b1e | 81 | // see header file for class documentation |
4c256004 | 82 | delete fTracker; |
83 | } | |
cf471b1e | 84 | |
4c256004 | 85 | // |
cf471b1e | 86 | // Public functions to implement AliHLTComponent's interface. |
87 | // These functions are required for the registration process | |
4c256004 | 88 | // |
cf471b1e | 89 | |
90 | const char* AliHLTTPCCATrackerComponent::GetComponentID() | |
4c256004 | 91 | { |
cf471b1e | 92 | // see header file for class documentation |
4c256004 | 93 | return "TPCCATracker"; |
94 | } | |
cf471b1e | 95 | |
96 | void AliHLTTPCCATrackerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) | |
4c256004 | 97 | { |
cf471b1e | 98 | // see header file for class documentation |
4c256004 | 99 | list.clear(); |
100 | list.push_back( AliHLTTPCDefinitions::fgkClustersDataType ); | |
101 | } | |
cf471b1e | 102 | |
103 | AliHLTComponentDataType AliHLTTPCCATrackerComponent::GetOutputDataType() | |
4c256004 | 104 | { |
cf471b1e | 105 | // see header file for class documentation |
4c256004 | 106 | return AliHLTTPCDefinitions::fgkTrackSegmentsDataType; |
107 | } | |
cf471b1e | 108 | |
109 | void AliHLTTPCCATrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
4c256004 | 110 | { |
111 | // define guess for the output data size | |
112 | constBase = 200; // minimum size | |
113 | inputMultiplier = 0.5; // size relative to input | |
114 | } | |
cf471b1e | 115 | |
116 | AliHLTComponent* AliHLTTPCCATrackerComponent::Spawn() | |
4c256004 | 117 | { |
cf471b1e | 118 | // see header file for class documentation |
4c256004 | 119 | return new AliHLTTPCCATrackerComponent; |
120 | } | |
cf471b1e | 121 | |
122 | int AliHLTTPCCATrackerComponent::DoInit( int argc, const char** argv ) | |
4c256004 | 123 | { |
124 | // Initialize the CA tracker component | |
125 | // | |
126 | // arguments could be: | |
127 | // bfield - the magnetic field value | |
128 | // | |
cf471b1e | 129 | |
4c256004 | 130 | if ( fTracker ) return EINPROGRESS; |
131 | ||
132 | fTracker = new AliHLTTPCCATracker(); | |
133 | ||
134 | // read command line | |
cf471b1e | 135 | |
4c256004 | 136 | int i = 0; |
137 | char* cpErr; | |
138 | while ( i < argc ){ | |
139 | if ( !strcmp( argv[i], "bfield" ) ){ | |
140 | if ( i+1 >= argc ) | |
cf471b1e | 141 | { |
4c256004 | 142 | Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing B-field", "Missing B-field specifier." ); |
143 | return ENOTSUP; | |
144 | } | |
145 | fBField = strtod( argv[i+1], &cpErr ); | |
146 | if ( *cpErr ) | |
147 | { | |
148 | Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing multiplicity", "Cannot convert B-field specifier '%s'.", argv[i+1] ); | |
149 | return EINVAL; | |
cf471b1e | 150 | } |
cf471b1e | 151 | |
4c256004 | 152 | Logging( kHLTLogDebug, "HLT::TPCCATracker::DoInit", "Reading command line", |
153 | "Magnetic field value is set to %f kG", fBField ); | |
154 | ||
155 | i += 2; | |
156 | continue; | |
cf471b1e | 157 | } |
4c256004 | 158 | |
159 | Logging(kHLTLogError, "HLT::TPCCATracker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); | |
160 | return EINVAL; | |
161 | } | |
162 | ||
163 | return 0; | |
164 | } | |
cf471b1e | 165 | |
166 | int AliHLTTPCCATrackerComponent::DoDeinit() | |
4c256004 | 167 | { |
cf471b1e | 168 | // see header file for class documentation |
4c256004 | 169 | if ( fTracker ) delete fTracker; |
170 | fTracker = NULL; | |
171 | return 0; | |
172 | } | |
cf471b1e | 173 | |
4c256004 | 174 | int AliHLTTPCCATrackerComponent::DoEvent |
175 | ( | |
176 | const AliHLTComponentEventData& evtData, | |
177 | const AliHLTComponentBlockData* blocks, | |
178 | AliHLTComponentTriggerData& trigData, | |
179 | AliHLTUInt8_t* outputPtr, | |
180 | AliHLTUInt32_t& size, | |
181 | vector<AliHLTComponentBlockData>& outputBlocks ) | |
cf471b1e | 182 | { |
dc4788ec | 183 | |
184 | AliHLTUInt32_t MaxBufferSize = size; | |
185 | size = 0; // output size | |
186 | ||
187 | TStopwatch timer; | |
188 | ||
4c256004 | 189 | // Event reconstruction in one TPC slice with CA Tracker |
cf471b1e | 190 | |
191 | Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "DoEvent", "DoEvent()" ); | |
192 | if ( evtData.fBlockCnt<=0 ) | |
193 | { | |
194 | Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "DoEvent", "no blocks in event" ); | |
195 | return 0; | |
196 | } | |
4c256004 | 197 | |
cf471b1e | 198 | const AliHLTComponentBlockData* iter = NULL; |
199 | unsigned long ndx; | |
4c256004 | 200 | AliHLTTPCClusterData* inPtrSP; |
cf471b1e | 201 | |
4c256004 | 202 | // Determine the slice number |
cf471b1e | 203 | |
4c256004 | 204 | Int_t slice=-1; |
205 | { | |
206 | std::vector<Int_t> slices; | |
207 | std::vector<Int_t>::iterator slIter; | |
208 | std::vector<unsigned> sliceCnts; | |
209 | std::vector<unsigned>::iterator slCntIter; | |
cf471b1e | 210 | |
4c256004 | 211 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ){ |
cf471b1e | 212 | iter = blocks+ndx; |
4c256004 | 213 | if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue; |
214 | ||
cf471b1e | 215 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); |
dc4788ec | 216 | |
4c256004 | 217 | Bool_t found = 0; |
cf471b1e | 218 | slCntIter = sliceCnts.begin(); |
4c256004 | 219 | for( slIter = slices.begin(); slIter!=slices.end(); slIter++, slCntIter++ ){ |
220 | if ( *slIter == slice ){ | |
221 | found = kTRUE; | |
222 | break; | |
cf471b1e | 223 | } |
4c256004 | 224 | } |
225 | if ( !found ){ | |
226 | slices.push_back( slice ); | |
227 | sliceCnts.push_back( 1 ); | |
228 | } else *slCntIter++; | |
cf471b1e | 229 | } |
230 | ||
231 | ||
4c256004 | 232 | // Determine slice number to really use. |
233 | if ( slices.size()>1 ) | |
234 | { | |
235 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
236 | "Multiple slice numbers found in event 0x%08lX (%lu). Determining maximum occuring slice number...", | |
237 | evtData.fEventID, evtData.fEventID ); | |
238 | unsigned maxCntSlice=0; | |
239 | slCntIter = sliceCnts.begin(); | |
240 | for( slIter = slices.begin(); slIter != slices.end(); slIter++, slCntIter++ ) | |
241 | { | |
242 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
243 | "Slice %lu found %lu times.", *slIter, *slCntIter ); | |
244 | if ( maxCntSlice<*slCntIter ) | |
245 | { | |
246 | maxCntSlice = *slCntIter; | |
247 | slice = *slIter; | |
248 | } | |
249 | } | |
250 | Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event", | |
251 | "Using slice %lu.", slice ); | |
252 | } | |
253 | else if ( slices.size()>0 ) | |
254 | { | |
255 | slice = *(slices.begin()); | |
256 | } | |
257 | } | |
258 | ||
259 | if( slice<0 ){ | |
260 | Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "DoEvent", "no slices found in event" ); | |
261 | return 0; | |
262 | } | |
cf471b1e | 263 | |
4c256004 | 264 | |
265 | // Initialize the tracker | |
266 | ||
267 | Double_t Bz = fBField; | |
268 | ||
cf471b1e | 269 | { |
4c256004 | 270 | if( !fTracker ) fTracker = new AliHLTTPCCATracker; |
cf471b1e | 271 | Int_t iSec = slice; |
272 | Double_t inRmin = 83.65; | |
273 | Double_t inRmax = 133.3; | |
274 | Double_t outRmin = 133.5; | |
275 | Double_t outRmax = 247.7; | |
276 | Double_t plusZmin = 0.0529937; | |
277 | Double_t plusZmax = 249.778; | |
278 | Double_t minusZmin = -249.645; | |
279 | Double_t minusZmax = -0.0799937; | |
280 | Double_t dalpha = 0.349066; | |
281 | Double_t alpha = 0.174533 + dalpha*iSec; | |
282 | ||
dc4788ec | 283 | Bool_t zPlus = (iSec<18 ); |
cf471b1e | 284 | Double_t zMin = zPlus ?plusZmin :minusZmin; |
285 | Double_t zMax = zPlus ?plusZmax :minusZmax; | |
dc4788ec | 286 | //TPCZmin = -249.645, ZMax = 249.778 |
287 | Double_t rMin = inRmin; | |
288 | Double_t rMax = outRmax; | |
289 | Int_t NRows = AliHLTTPCTransform::GetNRows(); | |
290 | ||
cf471b1e | 291 | Double_t padPitch = 0.4; |
292 | Double_t sigmaZ = 0.228808; | |
293 | ||
dc4788ec | 294 | Double_t rowX[NRows]; |
295 | for( Int_t irow=0; irow<NRows; irow++){ | |
296 | rowX[irow] = AliHLTTPCTransform::Row2X( irow ); | |
297 | } | |
cf471b1e | 298 | |
299 | AliHLTTPCCAParam param; | |
dc4788ec | 300 | param.Initialize( iSec, NRows, rowX, alpha, dalpha, |
cf471b1e | 301 | inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, Bz ); |
dc4788ec | 302 | param.YErrorCorrection() = 1; |
303 | param.ZErrorCorrection() = 2; | |
4c256004 | 304 | |
dc4788ec | 305 | fTracker->Initialize( param ); |
4c256004 | 306 | |
cf471b1e | 307 | } |
308 | ||
4c256004 | 309 | |
310 | // min and max patch numbers and row numbers | |
311 | ||
312 | Int_t row[2] = {0,0}; | |
dc4788ec | 313 | Int_t minPatch=INT_MAX, maxPatch = -1; |
4c256004 | 314 | |
315 | // total n Hits | |
cf471b1e | 316 | |
317 | Int_t nHitsTotal = 0; | |
4c256004 | 318 | |
319 | // sort patches | |
320 | ||
321 | std::vector<unsigned long> patchIndices; | |
322 | ||
323 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ){ | |
324 | iter = blocks+ndx; | |
325 | if( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue; | |
326 | if( slice!=AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) continue; | |
cf471b1e | 327 | inPtrSP = (AliHLTTPCClusterData*)(iter->fPtr); |
328 | nHitsTotal+=inPtrSP->fSpacePointCnt; | |
4c256004 | 329 | Int_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); |
330 | if ( minPatch>patch ){ | |
331 | minPatch = patch; | |
332 | row[0] = AliHLTTPCTransform::GetFirstRow( patch ); | |
333 | } | |
334 | if ( maxPatch<patch ){ | |
335 | maxPatch = patch; | |
336 | row[1] = AliHLTTPCTransform::GetLastRow( patch ); | |
337 | } | |
338 | std::vector<unsigned long>::iterator pIter = patchIndices.begin(); | |
339 | while( pIter!=patchIndices.end() && AliHLTTPCDefinitions::GetMinPatchNr( blocks[*pIter] ) < patch ){ | |
340 | pIter++; | |
341 | } | |
342 | patchIndices.insert( pIter, ndx ); | |
cf471b1e | 343 | } |
4c256004 | 344 | |
345 | ||
346 | // pass event to CA Tracker | |
347 | ||
348 | fTracker->StartEvent(); | |
349 | ||
dc4788ec | 350 | AliHLTTPCCAHit vHits[nHitsTotal]; // CA hit array |
351 | Double_t vHitStoreX[nHitsTotal]; // hit X coordinates | |
352 | Int_t vHitStoreID[nHitsTotal]; // hit ID's | |
353 | Int_t vHitRowID[nHitsTotal]; // hit ID's | |
4c256004 | 354 | |
cf471b1e | 355 | Int_t nHits = 0; |
4c256004 | 356 | |
357 | Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits", | |
358 | "Total %d hits to read for slice %d", nHitsTotal, slice ); | |
359 | ||
dc4788ec | 360 | Int_t nClusters=0; |
361 | ||
4c256004 | 362 | for( std::vector<unsigned long>::iterator pIter = patchIndices.begin(); pIter!=patchIndices.end(); pIter++ ){ |
363 | ndx = *pIter; | |
364 | iter = blocks+ndx; | |
cf471b1e | 365 | |
4c256004 | 366 | Int_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); |
367 | inPtrSP = (AliHLTTPCClusterData*)(iter->fPtr); | |
cf471b1e | 368 | |
4c256004 | 369 | Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits", |
370 | "Reading %d hits for slice %d - patch %d", inPtrSP->fSpacePointCnt, slice, patch ); | |
cf471b1e | 371 | |
4c256004 | 372 | // Read patch hits, row by row |
373 | ||
374 | Int_t oldRow = -1; | |
375 | Int_t nRowHits = 0; | |
376 | Int_t firstRowHit = 0; | |
377 | for (UInt_t i=0; i<inPtrSP->fSpacePointCnt; i++ ){ | |
378 | AliHLTTPCSpacePointData* pSP = &(inPtrSP->fSpacePoints[i]); | |
379 | ||
4c256004 | 380 | if( pSP->fPadRow != oldRow ){ |
381 | if( oldRow>=0 ) fTracker->ReadHitRow( oldRow, vHits+firstRowHit, nRowHits ); | |
382 | oldRow = pSP->fPadRow; | |
383 | firstRowHit = nHits; | |
384 | nRowHits = 0; | |
385 | } | |
386 | AliHLTTPCCAHit &h = vHits[nHits]; | |
dc4788ec | 387 | if( TMath::Abs(pSP->fX- fTracker->Rows()[pSP->fPadRow].X() )>1.e-4 ) cout<<"row "<<(Int_t)pSP->fPadRow<<" "<<fTracker->Rows()[pSP->fPadRow].X()-pSP->fX <<endl; |
388 | ||
4c256004 | 389 | h.Y() = pSP->fY; |
390 | h.Z() = pSP->fZ; | |
dc4788ec | 391 | h.ErrY() = TMath::Sqrt(TMath::Abs(pSP->fSigmaY2)); |
392 | h.ErrZ() = TMath::Sqrt(TMath::Abs(pSP->fSigmaZ2)); | |
393 | if( h.ErrY()<.1 ) h.ErrY() = .1; | |
394 | if( h.ErrZ()<.1 ) h.ErrZ() = .1; | |
395 | if( h.ErrY()>1. ) h.ErrY() = 1.; | |
396 | if( h.ErrZ()>1. ) h.ErrZ() = 1.; | |
4c256004 | 397 | h.ID() = nHits; |
398 | vHitStoreX[nHits] = pSP->fX; | |
399 | vHitStoreID[nHits] = pSP->fID; | |
dc4788ec | 400 | vHitRowID[nHits] = pSP->fPadRow; |
4c256004 | 401 | nHits++; |
402 | nRowHits++; | |
dc4788ec | 403 | nClusters++; |
4c256004 | 404 | } |
405 | if( oldRow>=0 ) fTracker->ReadHitRow( oldRow, vHits+firstRowHit, nRowHits ); | |
406 | } | |
407 | ||
cf471b1e | 408 | // reconstruct the event |
409 | ||
dc4788ec | 410 | TStopwatch timerReco; |
411 | ||
cf471b1e | 412 | fTracker->Reconstruct(); |
413 | ||
dc4788ec | 414 | timerReco.Stop(); |
415 | ||
4c256004 | 416 | Int_t ret = 0; |
417 | ||
418 | Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reconstruct", | |
419 | "%d tracks found for slice %d",fTracker->NOutTracks(), slice); | |
cf471b1e | 420 | |
421 | // write reconstructed tracks | |
422 | ||
423 | AliHLTTPCTrackletData* outPtr = (AliHLTTPCTrackletData*)(outputPtr); | |
424 | ||
425 | AliHLTTPCTrackSegmentData* currOutTracklet = outPtr->fTracklets; | |
426 | ||
427 | Int_t ntracks = fTracker->NOutTracks(); | |
4c256004 | 428 | |
429 | UInt_t mySize = ((AliHLTUInt8_t *)currOutTracklet) - ((AliHLTUInt8_t *)outputPtr); | |
430 | ||
431 | outPtr->fTrackletCnt = 0; | |
432 | ||
cf471b1e | 433 | for( int itr=0; itr<ntracks; itr++ ){ |
434 | ||
435 | AliHLTTPCCAOutTrack &t = fTracker->OutTracks()[itr]; | |
4c256004 | 436 | |
437 | //Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Wrtite output","track %d with %d hits", itr, t.NHits()); | |
438 | ||
439 | // calculate output track size | |
440 | ||
441 | UInt_t dSize = sizeof(AliHLTTPCTrackSegmentData) + t.NHits()*sizeof(UInt_t); | |
442 | ||
dc4788ec | 443 | if( mySize + dSize > MaxBufferSize ){ |
444 | Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "Wrtite output","Output buffer size exceed (buffer size %d, current size %d), %d tracks are not stored", MaxBufferSize, mySize, ntracks-itr+1); | |
4c256004 | 445 | ret = -ENOSPC; |
446 | break; | |
447 | } | |
448 | ||
449 | // convert CA track parameters to HLT Track Segment | |
450 | ||
cf471b1e | 451 | Int_t iFirstHit = fTracker->OutTrackHits()[t.FirstHitRef()]; |
452 | Int_t iLastHit = fTracker->OutTrackHits()[t.FirstHitRef()+t.NHits()-1]; | |
4c256004 | 453 | |
cf471b1e | 454 | AliHLTTPCCAHit &firstHit = vHits[iFirstHit]; |
455 | AliHLTTPCCAHit &lastHit = vHits[iLastHit]; | |
4c256004 | 456 | |
457 | t.Param().TransportBz(Bz, vHitStoreX[iFirstHit], firstHit.Y(), firstHit.Z() ); | |
458 | ||
cf471b1e | 459 | currOutTracklet->fX = t.Param().Par()[0]; |
460 | currOutTracklet->fY = t.Param().Par()[1]; | |
461 | currOutTracklet->fZ = t.Param().Par()[2]; | |
462 | Double_t qp = t.Param().Par()[6]; | |
463 | Double_t p = TMath::Abs(qp)>1.e-5 ?1./TMath::Abs(qp) :1.e5; | |
464 | Double_t ex = t.Param().Par()[3]; | |
465 | Double_t ey = t.Param().Par()[4]; | |
466 | Double_t ez = t.Param().Par()[5]; | |
467 | Double_t et = TMath::Sqrt( ex*ex + ey*ey ); | |
4c256004 | 468 | |
cf471b1e | 469 | currOutTracklet->fCharge = (qp>0) ?+1 :(qp<0 ?-1 :0); |
470 | currOutTracklet->fPt = p*et; | |
4c256004 | 471 | |
cf471b1e | 472 | Double_t h3 = TMath::Abs(ex) >1.e-5 ? p*ex/et :0; |
473 | Double_t h4 = TMath::Abs(ey) >1.e-5 ? p*ey/et :0; | |
474 | Double_t h5; | |
475 | Double_t h6 = - currOutTracklet->fCharge * p * currOutTracklet->fPt; | |
4c256004 | 476 | |
cf471b1e | 477 | currOutTracklet->fPterr = ( h3*h3*t.Param().Cov()[9] + h4*h4*t.Param().Cov()[14] + h6*h6*t.Param().Cov()[27] |
478 | + 2.*(h3*h4*t.Param().Cov()[13]+h3*h6*t.Param().Cov()[24]+h4*h6*t.Param().Cov()[25] ) | |
4c256004 | 479 | ); |
dc4788ec | 480 | currOutTracklet->fPsi = TMath::ATan2(ey, ex); |
cf471b1e | 481 | |
482 | h3 = ex/(et*et); | |
483 | h4 = -ey/(et*et); | |
484 | currOutTracklet->fPsierr = h3*h3*t.Param().Cov()[9] + h4*h4*t.Param().Cov()[14] + 2.*h3*h4*t.Param().Cov()[13]; | |
485 | ||
dc4788ec | 486 | currOutTracklet->fTgl = TMath::Abs(et)>1.e-5 ? ez/et :1.e5; |
cf471b1e | 487 | |
dc4788ec | 488 | if( TMath::Abs(et) >1.e-2 ){ |
489 | h3 = -ez*ex/et/et; | |
490 | h4 = -ez*ey/et/et; | |
491 | h5 = 1.; | |
492 | currOutTracklet->fTglerr = ( h3*h3*t.Param().Cov()[9] + h4*h4*t.Param().Cov()[14] + h5*h5*t.Param().Cov()[20] | |
493 | + 2.*(h3*h4*t.Param().Cov()[13]+h3*h5*t.Param().Cov()[18]+h4*h5*t.Param().Cov()[19] ) | |
494 | )/et/et; | |
495 | }else{ | |
496 | currOutTracklet->fTglerr = 1.e-2; | |
497 | } | |
498 | ||
cf471b1e | 499 | currOutTracklet->fCharge = -currOutTracklet->fCharge; |
4c256004 | 500 | |
501 | t.Param().TransportBz(Bz, vHitStoreX[iLastHit], lastHit.Y(), lastHit.Z() ); | |
502 | ||
cf471b1e | 503 | currOutTracklet->fLastX = t.Param().Par()[0]; |
504 | currOutTracklet->fLastY = t.Param().Par()[1]; | |
505 | currOutTracklet->fLastZ = t.Param().Par()[2]; | |
506 | ||
dc4788ec | 507 | #ifdef INCLUDE_TPC_HOUGH |
508 | #ifdef ROWHOUGHPARAMS | |
509 | currOutTracklet->fTrackID = 0; | |
510 | currOutTracklet->fRowRange1 = vHitRowID[iFirstHit]; | |
511 | currOutTracklet->fRowRange2 = vHitRowID[iLastHit]; | |
512 | currOutTracklet->fSector = slice; | |
513 | currOutTracklet->fPID = 211; | |
514 | #endif | |
515 | #endif // INCLUDE_TPC_HOUGH | |
516 | ||
517 | ||
cf471b1e | 518 | currOutTracklet->fNPoints = t.NHits(); |
519 | ||
520 | for( Int_t i=0; i<t.NHits(); i++ ){ | |
4c256004 | 521 | currOutTracklet->fPointIDs[i] = vHitStoreID[fTracker->OutTrackHits()[t.FirstHitRef()+i]]; |
cf471b1e | 522 | } |
4c256004 | 523 | |
524 | currOutTracklet = (AliHLTTPCTrackSegmentData*)( (Byte_t *)currOutTracklet + dSize ); | |
525 | mySize+=dSize; | |
526 | outPtr->fTrackletCnt++; | |
cf471b1e | 527 | } |
dc4788ec | 528 | |
cf471b1e | 529 | |
cf471b1e | 530 | AliHLTComponentBlockData bd; |
531 | FillBlockData( bd ); | |
4c256004 | 532 | bd.fOffset = 0; |
cf471b1e | 533 | bd.fSize = mySize; |
534 | bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch ); | |
535 | outputBlocks.push_back( bd ); | |
536 | ||
cf471b1e | 537 | size = mySize; |
538 | ||
dc4788ec | 539 | timerReco.Stop(); |
540 | ||
541 | // Set log level to "Warning" for on-line system monitoring | |
542 | ||
543 | Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "Tracks", | |
544 | "CATracker slice %d: output %d tracks; input %d clusters, patches %d..%d, rows %d..%d; reco time %d/%d us", | |
545 | slice, ntracks, nClusters, minPatch, maxPatch, row[0], row[1], (Int_t) (timer.RealTime()*1.e6), (Int_t) (timerReco.RealTime()*1.e6) ); | |
546 | ||
4c256004 | 547 | return ret; |
548 | ||
cf471b1e | 549 | } |
550 | ||
551 |