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