1 #include "StiCATpcTrackerInterface.h"
2 #include "TPCCATracker/AliHLTTPCCAGBHit.h"
3 #include "TPCCATracker/AliHLTTPCCAGBTrack.h"
4 #include "TPCCATracker/AliHLTTPCCAParam.h"
7 #include "StTpcDb/StTpcDb.h"
8 #include "StDbUtilities/StTpcCoordinateTransform.hh"
9 #include "StDbUtilities/StTpcLocalSectorCoordinate.hh"
11 #include "tables/St_g2t_track_Table.h"
12 #include "tables/St_g2t_tpc_hit_Table.h"
13 #include "TDatabasePDG.h"
14 #include "StBFChain.h"
15 #include "Sti/StiDetectorBuilder.h"
16 #include "Sti/StiDetectorGroups.h"
17 #include "Sti/StiGenericDetectorGroup.h"
20 #include "StDetectorDbMaker/StiTpcInnerHitErrorCalculator.h"
21 #include "StDetectorDbMaker/StiTpcOuterHitErrorCalculator.h"
23 #include "StarMagField/StarMagField.h"
26 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
27 #include "TPCCATrackerPerformance/AliHLTTPCCAStiPerformance.h"
28 #include "TPCCATrackerPerformance/AliHLTTPCCAMergerPerformance.h"
29 #include "StDetectorDbMaker/St_tpcPadConfigC.h"
31 #include "Sti/StiKalmanTrackNode.h"
40 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
53 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
54 fOutFile = StMaker::GetChain()->GetTFile();
55 if(!fOutFile) cout <<
"W StiCATpcTrackerInterface: Warning - There isn't any tag file, so histograms won't be saved!" << endl;
57 fPerformance = &(AliHLTTPCCAPerformance::Instance());
58 fPerformance->SetOutputFile(fOutFile);
63 StiCATpcTrackerInterface::~StiCATpcTrackerInterface( )
67 void StiCATpcTrackerInterface::SetNewEvent()
76 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
77 assert(fPerformance != 0);
88 if (fTracker)
delete fTracker;
90 if (fStiTracker)
delete fStiTracker;
93 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
94 fPerformance->SetTracker(fTracker);
102 assert(fHitsMap != 0);
110 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
112 FillPerformance(fCaHits,fIdTruth, fMCTracks,fMCPoints,fHitLabels);
113 fPerformance->SetMCTracks(fMCTracks);
114 fPerformance->SetMCPoints(fMCPoints);
115 fPerformance->SetHitLabels(fHitLabels);
116 #endif // DO_TPCCATRACKER_EFF_PERFORMANCE
120 fTracker->SetSettings(fCaParam);
123 #ifdef STORE_STANDALONE_DATA // write data in files for Standalone
124 static int iEvent = -1;
126 TString name =
"./data/";
127 if (iEvent == 0) fTracker->SaveSettingsInFile(
string(name));
131 fTracker->SaveHitsInFile(
string(name));
132 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
133 fPerformance->SaveDataInFiles(
string(name));
137 if (fTracker)
delete fTracker;
139 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
140 fPerformance->SetTracker(fTracker);
142 TString name =
"./data/";
143 fTracker->ReadSettingsFromFile(
string(name));
147 fTracker->ReadHitsFromFile(
string(name));
148 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
149 fPerformance->ReadDataFromFiles(
string(name));
151 fTracker->SetSettings(fCaParam);
155 #endif // STORE_STANDALONE_DATA
160 fPreparationTime_real = timer.RealTime();
161 fPreparationTime_cpu = timer.CpuTime();
171 fPreparationTime_real += timer.RealTime();
172 fPreparationTime_cpu += timer.CpuTime();
175 void StiCATpcTrackerInterface::RunPerformance()
177 cout <<
" ---- CA TPC Tracker ---- " << endl;
178 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
182 assert(fStiTracks != 0);
183 assert(fStiTracker != 0);
188 fPerformance->InitSubPerformances();
192 FillStiPerformance();
195 fStiTracker->
SetHits(fStiCaHits);
196 fStiTracker->SetSettings(fCaParam);
198 AliHLTTPCCAStiPerformance* stiPerf = (AliHLTTPCCAStiPerformance*)fPerformance->GetSubPerformance(
"Sti Performance");
199 stiPerf->SetNewEvent(fStiTracker,&fStiHitLabels,&fStiMCTracks,&fStiMCPoints);
200 stiPerf->SetRecoTracks(fStiCaTracks);
201 fPerformance->ExecPerformance();
204 fPreparationTime_real += timer.RealTime();
205 fPreparationTime_cpu += timer.CpuTime();
206 #endif // DO_TPCCATRACKER_EFF_PERFORMANCE
211 const int printTime = 3;
212 const int fullTiming = 1;
213 if ((printTime == 2) || (printTime == 3)){
215 std::cout <<
"Sector reconstruction Time"
216 <<
" Real = " << std::setw( 10 ) << fTracker->SliceTrackerTime() * 1.e3 <<
" ms,"
217 <<
" CPU = " << std::setw( 10 ) << fTracker->SliceTrackerCpuTime() * 1.e3 <<
" ms,";
218 if (fTracker->SliceTrackerTime() > 0)
219 std::cout <<
" parallelization speedup: " << fTracker->SliceTrackerCpuTime() / fTracker->SliceTrackerTime();
220 std::cout << std::endl;
221 if ((fullTiming == 2) || (fullTiming == 3)) {
223 <<
" | sum slice trackers: " << std::setw( 10 ) << fTracker->StatTime( 0 ) * 1000. <<
" ms\n"
224 <<
" | NeighboursFinder: " << std::setw( 10 ) << fTracker->StatTime( 1 ) * 1000. <<
" ms, " << std::setw( 12 ) << fTracker->StatTime( 5 ) <<
" cycles\n"
225 <<
" | StartHitsFinder: " << std::setw( 10 ) << fTracker->StatTime( 4 ) * 1000. <<
" ms\n"
226 <<
" | TrackletConstructor: " << std::setw( 10 ) << fTracker->StatTime( 2 ) * 1000. <<
" ms, " << std::setw( 12 ) << fTracker->StatTime( 7 ) <<
" cycles\n"
227 <<
" | TrackletSelector: " << std::setw( 10 ) << fTracker->StatTime( 3 ) * 1000. <<
" ms, " << std::setw( 12 ) << fTracker->StatTime( 8 ) <<
" cycles\n"
228 <<
" | WriteOutput: " << std::setw( 10 ) << fTracker->StatTime( 6 ) * 1000. <<
" ms\n"
229 <<
" | merge: " << std::setw( 10 ) << fTracker->StatTime( 9 ) * 1000. <<
" ms" << std::endl;
231 std::cout <<
"Total (sector+merge) reconstuction time"
232 <<
" Real = " << std::setw( 10 ) << (fTracker->SliceTrackerTime()+fTracker->StatTime( 9 )) * 1.e3 <<
" ms,"
233 <<
" CPU = " << std::setw( 10 ) << (fTracker->SliceTrackerCpuTime()+fTracker->StatTime( 10 )) * 1.e3 <<
" ms"
235 std::cout <<
"Preparation time"
236 <<
" Real = " << std::setw( 10 ) << fPreparationTime_real * 1.e3 <<
" ms,"
237 <<
" CPU = " << std::setw( 10 ) << fPreparationTime_cpu * 1.e3 <<
" ms"
240 if ((printTime == 1) || (printTime == 3)){
241 const int NTimers = 20;
242 static int statIEvent = 0;
243 static double statTime[NTimers];
244 static double statTime_SliceTrackerTime = 0;
245 static double statTime_SliceTrackerCpuTime = 0;
246 static double statPreparationTime_real = 0;
247 static double statPreparationTime_cpu = 0;
250 for (
int i = 0; i < NTimers; i++){
256 for (
int i = 0; i < NTimers; i++){
257 statTime[i] += fTracker->StatTime( i );
259 statTime_SliceTrackerTime += fTracker->SliceTrackerTime();
260 statTime_SliceTrackerCpuTime += fTracker->SliceTrackerCpuTime();
261 statPreparationTime_real += fPreparationTime_real;
262 statPreparationTime_cpu += fPreparationTime_cpu;
264 std::cout <<
"Average sector reconstruction Time"
265 <<
" Real = " << std::setw( 10 ) << 1./statIEvent*statTime_SliceTrackerTime * 1.e3 <<
" ms,"
266 <<
" CPU = " << std::setw( 10 ) << 1./statIEvent*statTime_SliceTrackerCpuTime * 1.e3 <<
" ms,";
267 if (statTime_SliceTrackerTime > 0)
268 std::cout <<
" parallelization speedup: " << statTime_SliceTrackerCpuTime / statTime_SliceTrackerTime;
269 std::cout << std::endl;
270 if ((fullTiming == 1) || (fullTiming == 3)) {
272 <<
" | sum slice trackers: " << std::setw( 10 ) << 1./statIEvent*statTime[ 0 ] * 1000. <<
" ms\n"
273 <<
" | NeighboursFinder: " << std::setw( 10 ) << 1./statIEvent*statTime[ 1 ] * 1000. <<
" ms, " << std::setw( 12 ) << 1./statIEvent*statTime[ 5 ] <<
" cycles\n"
274 <<
" | StartHitsFinder: " << std::setw( 10 ) << 1./statIEvent*statTime[ 4 ] * 1000. <<
" ms\n"
275 <<
" | TrackletConstructor: " << std::setw( 10 ) << 1./statIEvent*statTime[ 2 ] * 1000. <<
" ms, " << std::setw( 12 ) << 1./statIEvent*statTime[ 7 ] <<
" cycles\n"
276 <<
" | TrackletSelector: " << std::setw( 10 ) << 1./statIEvent*statTime[ 3 ] * 1000. <<
" ms, " << std::setw( 12 ) << 1./statIEvent*statTime[ 8 ] <<
" cycles\n"
277 <<
" | WriteOutput: " << std::setw( 10 ) << 1./statIEvent*statTime[ 6 ] * 1000. <<
" ms\n"
278 <<
" | merge: " << std::setw( 10 ) << 1./statIEvent*statTime[ 9 ] * 1000. <<
" ms" << std::endl;
280 std::cout <<
"Total (sector+merge) avarage reconstuction time"
281 <<
" Real = " << std::setw( 10 ) << (statTime_SliceTrackerTime+statTime[ 9 ])/statIEvent * 1.e3 <<
" ms,"
282 <<
" CPU = " << std::setw( 10 ) << (statTime_SliceTrackerCpuTime+statTime[ 10 ])/statIEvent * 1.e3 <<
" ms"
284 std::cout <<
"Avarage preparation time"
285 <<
" Real = " << std::setw( 10 ) << statPreparationTime_real/statIEvent * 1.e3 <<
" ms,"
286 <<
" CPU = " << std::setw( 10 ) << statPreparationTime_cpu/statIEvent * 1.e3 <<
" ms."
291 #if 0//def DO_TPCCATRACKER_EFF_PERFORMANCE outdated
292 ((AliHLTTPCCAMergerPerformance*)(AliHLTTPCCAPerformance::Instance().GetSubPerformance(
"Merger")))->FillTree();
293 #endif //DO_TPCCATRACKER_EFF_PERFORMANCE
297 void StiCATpcTrackerInterface::MakeSettings()
300 const int NSlices = 24;
301 for (
int iSlice = 0; iSlice < NSlices; iSlice++ ) {
305 Int_t sector = iSlice+1;
307 const int NoOfInnerRows = St_tpcPadConfigC::instance()->innerPadRows(sector);
308 const int NRows = St_tpcPadConfigC::instance()->padRows(sector);
309 SlicePar.SetISlice( iSlice );
310 SlicePar.SetNRows ( NRows );
311 SlicePar.SetNInnerRows ( NoOfInnerRows );
313 if (sector > 12) beta = (24-sector)*2.*TMath::Pi()/12.;
314 else beta = sector *2.*TMath::Pi()/12.;
315 SlicePar.SetAlpha ( beta );
316 SlicePar.SetDAlpha ( 30*TMath::DegToRad() );
317 SlicePar.SetCosAlpha ( TMath::Cos(SlicePar.Alpha()) );
318 SlicePar.SetSinAlpha ( TMath::Sin(SlicePar.Alpha()) );
319 SlicePar.SetAngleMin ( SlicePar.Alpha() - 0.5*SlicePar.DAlpha() );
320 SlicePar.SetAngleMax ( SlicePar.Alpha() + 0.5*SlicePar.DAlpha() );
321 SlicePar.SetRMin ( 51. );
322 SlicePar.SetRMax ( 194. );
323 SlicePar.SetErrX ( 0. );
324 SlicePar.SetErrY ( 0.12 );
325 SlicePar.SetErrZ ( 0.16 );
327 if (! StiKalmanTrackNode::IsLaser()) {
328 float x[3]={0,0,0},b[3];
329 StarMagField::Instance()->BField(x,b);
330 SlicePar.SetBz ( - b[2] );
332 static const double HZERO=2e-6;
333 SlicePar.SetBz (HZERO);
336 SlicePar.SetZMin ( 0. );
337 SlicePar.SetZMax ( 210. );
339 SlicePar.SetZMin (-210. );
340 SlicePar.SetZMax ( 0. );
342 for(
int iR = 0; iR < NRows; iR++){
343 SlicePar.SetRowX(iR, St_tpcPadConfigC::instance()->radialDistanceAtRow(sector,iR+1));
346 Double_t *coeffInner = StiTpcInnerHitErrorCalculator::instance()->coeff();
347 for(
int iCoef=0; iCoef<6; iCoef++)
349 SlicePar.SetParamS0Par(0, 0, iCoef, (
float)coeffInner[iCoef] );
352 SlicePar.SetParamS0Par(0, 0, 6, 0.0f );
354 Double_t *coeffOuter =StiTpcOuterHitErrorCalculator::instance()->coeff();
355 for(
int iCoef=0; iCoef<6; iCoef++)
357 SlicePar.SetParamS0Par(0, 1, iCoef, (
float)coeffOuter[iCoef] );
360 SlicePar.SetParamS0Par(0, 1, 6, 0.0f );
361 SlicePar.SetParamS0Par(0, 2, 0, 0.0f );
362 SlicePar.SetParamS0Par(0, 2, 1, 0.0f );
363 SlicePar.SetParamS0Par(0, 2, 2, 0.0f );
364 SlicePar.SetParamS0Par(0, 2, 3, 0.0f );
365 SlicePar.SetParamS0Par(0, 2, 4, 0.0f );
366 SlicePar.SetParamS0Par(0, 2, 5, 0.0f );
367 SlicePar.SetParamS0Par(0, 2, 6, 0.0f );
368 SlicePar.SetParamS0Par(1, 0, 0, 0.0f );
369 SlicePar.SetParamS0Par(1, 0, 1, 0.0f );
370 SlicePar.SetParamS0Par(1, 0, 2, 0.0f );
371 SlicePar.SetParamS0Par(1, 0, 3, 0.0f );
372 SlicePar.SetParamS0Par(1, 0, 4, 0.0f );
373 SlicePar.SetParamS0Par(1, 0, 5, 0.0f );
374 SlicePar.SetParamS0Par(1, 0, 6, 0.0f );
375 SlicePar.SetParamS0Par(1, 1, 0, 0.0f );
376 SlicePar.SetParamS0Par(1, 1, 1, 0.0f );
377 SlicePar.SetParamS0Par(1, 1, 2, 0.0f );
378 SlicePar.SetParamS0Par(1, 1, 3, 0.0f );
379 SlicePar.SetParamS0Par(1, 1, 4, 0.0f );
380 SlicePar.SetParamS0Par(1, 1, 5, 0.0f );
381 SlicePar.SetParamS0Par(1, 1, 6, 0.0f );
382 SlicePar.SetParamS0Par(1, 2, 0, 0.0f );
383 SlicePar.SetParamS0Par(1, 2, 1, 0.0f );
384 SlicePar.SetParamS0Par(1, 2, 2, 0.0f );
385 SlicePar.SetParamS0Par(1, 2, 3, 0.0f );
386 SlicePar.SetParamS0Par(1, 2, 4, 0.0f );
387 SlicePar.SetParamS0Par(1, 2, 5, 0.0f );
388 SlicePar.SetParamS0Par(1, 2, 6, 0.0f );
390 fCaParam.push_back(SlicePar);
395 void StiCATpcTrackerInterface::MakeHits()
399 for (HitMapToVectorAndEndType::iterator it= fHitsMap->begin(); it!= fHitsMap->end(); ++it){
400 vector<StiHit*>& tempvec = (*it).second.hits();
401 vector<StiHit*>::iterator start = tempvec.begin();
402 vector<StiHit*>::iterator stop = tempvec.end();
403 for (vector<StiHit*>::iterator cit = start; cit != stop; cit++) {
407 if ( !(hit->
detector()->isActive()) )
continue;
408 if (! hit->
stHit())
continue;
412 if ( ! tpcHit)
continue;
414 tran(glob,loc,tpcHit->sector(),tpcHit->padrow());
419 hitc.mMinPad = tpcHit->minPad();
420 hitc.mMaxPad = tpcHit->maxPad();
421 hitc.mMinTmbk = tpcHit->minTmbk();
422 hitc.mMaxTmbk = tpcHit->maxTmbk();
424 hitc.padrow = tpcHit->padrow()-1;
425 hitc.x = loc.position().x();
426 hitc.y = loc.position().y();
427 hitc.z = loc.position().z();
430 hitc.track_key=tpcHit->idTruth();
432 fSeedHits.push_back(hitc);
436 caHit.SetIRow( hitc.padrow );
439 caHit.SetY( - hit->y() );
440 caHit.SetZ( - hit->z() );
442 caHit.SetErrY( 0.12 );
443 caHit.SetErrZ( 0.16 );
444 caHit.SetISlice( tpcHit->sector() - 1 );
445 caHit.SetIRow( hitc.padrow );
446 caHit.SetID( fCaHits.size() );
447 fIdTruth.push_back( hitc.track_key );
449 fCaHits.push_back(caHit);
465 nodePars.x() = caPar.GetX();
466 nodePars.y() = JI[0] * caPar.GetY();
467 nodePars.z() = JI[1] * caPar.GetZ();
468 nodePars.eta() = JI[2] * asin(caPar.GetSinPhi());
469 nodePars.ptin() = JI[3] * caPar.GetQPt();
470 nodePars.tanl() = JI[4] * caPar.GetDzDs();
473 static const double EC = 2.99792458e-4, ZEROHZ = 2e-6;
475 #ifndef USE_CA_FIELD // use field in the point. Need this because of check in StiTrackNodeHelper::set()
476 const double ca = cos(_alpha), sa = sin(_alpha);
477 double globalXYZ[3] = {
478 ca * nodePars.x() - sa * nodePars.y(),
479 sa * nodePars.x() + ca * nodePars.y(),
484 if (! StiKalmanTrackNode::IsLaser()) {
486 StarMagField::Instance()->BField(globalXYZ,b);
490 #else // these parameters have been obtained with that MF, so let's use it.
491 double h2 = - fTracker->Slice(0).Param().Bz();
502 J[2] = JI[2]/cos(nodePars.eta());
507 const float *caCov = caPar.GetCov();
519 double *A = nodeErrs.G();
526 nodeErrs._cYY = caCov[ 0];
527 nodeErrs._cZY = caCov[ 1]*J[0]*J[1];
528 nodeErrs._cZZ = caCov[ 2]*J[0]*J[1];
529 nodeErrs._cEY = caCov[ 3]*J[0]*J[2];
530 nodeErrs._cEZ = caCov[ 4]*J[1]*J[2];
531 nodeErrs._cEE = caCov[ 5]*J[2]*J[2];
532 nodeErrs._cTY = caCov[ 6]*J[0]*J[4];
533 nodeErrs._cTZ = caCov[ 7]*J[1]*J[4];
534 nodeErrs._cTE = caCov[ 8]*J[2]*J[4];
535 nodeErrs._cTT = caCov[ 9]*J[4]*J[4];
536 nodeErrs._cPY = caCov[10]*J[0]*J[3];
537 nodeErrs._cPZ = caCov[11]*J[1]*J[3];
538 nodeErrs._cPE = caCov[12]*J[2]*J[3];
539 nodeErrs._cTP = caCov[13]*J[4]*J[3];
540 nodeErrs._cPP = caCov[14]*J[3]*J[3];
551 void StiCATpcTrackerInterface::MakeSeeds()
553 const int NRecoTracks = fTracker->NTracks();
554 for (
int iTr = 0; iTr < NRecoTracks; iTr++ ) {
559 const int NHits = tr.NHits();
561 for (
int iHit = NHits-1; iHit >= 0; iHit-- ){
562 const int index = fTracker->TrackHit( tr.FirstHitRef() + iHit );
563 const int hId = fTracker->Hit( index ).ID();
565 seed.vhit.push_back(&(fSeedHits[hId]));
570 seed.total_hits = seed.vhit.size();
572 ConvertPars( tr.OuterParam(), tr.Alpha(), seed.firstNodePars, seed.firstNodeErrs );
573 ConvertPars( tr.InnerParam(), tr.Alpha(), seed.lastNodePars, seed.lastNodeErrs );
575 fSeeds.push_back(seed);
579 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
580 bool myfunction (AliHLTTPCCALocalMCPoint i,AliHLTTPCCALocalMCPoint j) {
581 return (i.TrackI() < j.TrackI()) || ( i.TrackI()==j.TrackI() && i.IRow() < j.IRow() );
584 void StiCATpcTrackerInterface::FillPerformance(
const vector<AliHLTTPCCAGBHit>& caHits,
const vector<int>& idsTruth, vector<AliHLTTPCCAMCTrack>& mcTracks, vector<AliHLTTPCCALocalMCPoint>& mcPoints, vector<AliHLTTPCCAHitLabel>& hitLabels)
589 hitLabels.resize(caHits.size());
592 St_g2t_track *
Track = (St_g2t_track *) chain->FindObject(
"g2t_track");
593 St_g2t_tpc_hit *mcTpcHits = (St_g2t_tpc_hit *) chain->FindObject(
"g2t_tpc_hit");
594 if (Track && mcTpcHits) {
598 int nMCTracks = Track->GetNRows();
599 const g2t_track_st *
track = Track->GetTable();
601 vector<int> truthToIndex;
602 truthToIndex.resize(nMCTracks+1,-1);
604 const g2t_tpc_hit_st *mcTpcHit = mcTpcHits->GetTable();
605 const Int_t nMcTpcHits = mcTpcHits->GetNRows();
607 AliHLTTPCCAMCTrack mcTrack;
608 for (Int_t l = 0; l < nMCTracks; l++, track++) {
609 if (! track->n_tpc_hit)
continue;
610 if (track->ptot < 1e-3)
continue;
611 memset(&mcTrack, 0,
sizeof(AliHLTTPCCAMCTrack));
612 mcTrack.SetPDG( TDatabasePDG::Instance()->ConvertGeant3ToPdg(track->ge_pid) );
613 TParticlePDG *part = TDatabasePDG::Instance()->GetParticle( mcTrack.PDG() );
614 Float_t q = part->Charge();
615 mcTrack.SetP ( track->ptot );
616 mcTrack.SetPt( track->pt );
618 for (Int_t i = 0; i < 3; i++) {
619 mcTrack.SetPar( i, ((i>=1)?-1:1) * 0 );
621 for (Int_t i = 0; i < 3; i++) {
622 mcTrack.SetPar( 3+i, ((i>=1)?-1:1) * track->p[i]/mcTrack.P() );
624 mcTrack.SetPar(6, q/mcTrack.P()/3 );
625 mcTrack.SetNTurns( 1 );
626 const int idTruth = l+1;
628 truthToIndex[idTruth] = mcTracks.size();
629 mcTracks.push_back(mcTrack);
633 const int nHits = caHits.size();
634 for (
int iHit = 0; iHit < nHits; iHit++){
635 const int iTrack = truthToIndex[idsTruth[iHit]];
636 if (iTrack == -1)
continue;
637 AliHLTTPCCAHitLabel &l = hitLabels[iHit];
641 mcTracks[iTrack].SetNHits( 1 + mcTracks[iTrack].NHits() );
645 for (Int_t iP = 0; iP < nMcTpcHits; iP++, mcTpcHit++) {
646 AliHLTTPCCALocalMCPoint mcPoint;
647 Int_t is = mcTpcHit->volume_id/100000;
649 const int iTrack = truthToIndex[mcTpcHit->track_p];
650 if (iTrack == -1)
continue;
651 AliHLTTPCCAMCTrack& mcTrack = mcTracks[iTrack];
653 mcPoint.SetIRow( mcTpcHit->volume_id%100 - 1 );
654 mcPoint.SetISlice( (mcTpcHit->volume_id/100)%100 - 1 );
656 Int_t sector = (mcTpcHit->volume_id%100000)/100;
657 Int_t row = mcTpcHit->volume_id%100;
662 vector<StiGenericDetectorGroup *>::iterator it = groups->begin();
663 for (; it != groups->end(); ++it) {
666 TString builderName = (
const char*)(detectorBuilder->
getName().c_str());
667 if (builderName ==
"TpcBuilder")
670 int sectorTpm = sector - 1;
671 if (sectorTpm >= 12) sectorTpm = 11 - (sectorTpm - 11)%12;
672 StiDetector* detector = detectorBuilder->getDetector(row-1,sectorTpm);
678 double energyTmp = 0.;
679 tmpStiHit.
setGlobal(detector, mpTmp, mcTpcHit->x[0], mcTpcHit->x[1], mcTpcHit->x[2], energyTmp);
680 mcPoint.SetX( tmpStiHit.
x() );
681 mcPoint.SetY( - tmpStiHit.y() );
682 mcPoint.SetZ( - tmpStiHit.z() );
686 transform(gDir,dirSect,sector,row);
687 double px = mcTpcHit->p[0], py = mcTpcHit->p[1], pz_new = mcTpcHit->p[2], px_new, py_new;
688 double angle = detector->getPlacement()->getNormalRefAngle();
689 px_new = cos(angle)*px + sin(angle)*py;
690 py_new = -sin(angle)*px + cos(angle)*py;
692 mcPoint.SetPx( px_new );
693 mcPoint.SetPy( - py_new );
694 mcPoint.SetPz( - pz_new );
695 const int qpSign = fabs(mcTrack.Par(6))/mcTrack.Par(6);
696 mcPoint.SetQP(
double( qpSign ) / sqrt(px_new*px_new + py_new*py_new + pz_new*pz_new) );
697 mcPoint.SetTrackI( iTrack );
698 mcPoint.SetTrackID( mcTpcHit->track_p );
700 mcPoints.push_back(mcPoint);
703 std::sort( mcPoints.begin(), mcPoints.end(), myfunction );
704 mcTracks[0].SetFirstMCPointID(0);
707 for( UInt_t iP = 0; iP < mcPoints.size(); ++iP ) {
708 if ( mcPoints[iP].TrackI() != iTr ) {
709 mcTracks[iTr].SetNMCPoints(iP - iPLast);
711 iTr = mcPoints[iP].TrackI();
712 mcTracks[iTr].SetFirstMCPointID(iP);
715 mcTracks[iTr].SetNMCPoints(mcPoints.size() - iPLast);
719 void StiCATpcTrackerInterface::FillStiPerformance()
723 fStiCaTracks.clear();
725 AliHLTTPCCAStiPerformance* stiPerf = (AliHLTTPCCAStiPerformance*)fPerformance->GetSubPerformance(
"Sti Performance");
735 vector<StiHit*> hits_v = track-> getHits();
742 for(
unsigned iH=0; iH<hits_v.size(); iH++)
745 if (! hit->
stHit())
continue;
748 if ( ! tpcHit)
continue;
750 tran(glob,loc,tpcHit->sector(),tpcHit->padrow());
754 caHit.SetIRow( tpcHit->padrow()-1 );
756 caHit.SetY( - hit->y() );
757 caHit.SetZ( - hit->z() );
758 caHit.SetErrY( 0.12 );
759 caHit.SetErrZ( 0.16 );
760 caHit.SetISlice( tpcHit->sector() - 1 );
761 caHit.SetID( fStiCaHits.size() );
762 fStiIdTruth.push_back( tpcHit->idTruth() );
764 int iHit = NGBHits+iH;
765 stiPerf->AddHit(iHit);
768 fStiCaHits.push_back(caHit);
772 if (!NodePar)
continue;
784 J[2] = JI[2]*cos(NodePar->fitPars().eta());
788 double Cos = cos(NodePar->fitPars().eta());
789 float sgnCos = fabs(Cos)/Cos;
792 GBTrackParam.SetX ( NodePar->fitPars().x() );
793 GBTrackParam.SetY ( JI[0] * NodePar->fitPars().y() );
794 GBTrackParam.SetZ ( JI[1] * NodePar->fitPars().z() );
795 GBTrackParam.SetSinPhi( JI[2] * sin(NodePar->fitPars().eta()));
796 GBTrackParam.SetQPt ( JI[3] * NodePar->fitPars().ptin() );
797 GBTrackParam.SetDzDs ( JI[4] * NodePar->fitPars().tanl() );
799 GBTrackParam.SetCov( 0, NodePar->fitErrs()._cYY);
800 GBTrackParam.SetCov( 1, NodePar->fitErrs()._cZY*J[0]*J[1]);
801 GBTrackParam.SetCov( 2, NodePar->fitErrs()._cZZ*J[0]*J[1]);
802 GBTrackParam.SetCov( 3, NodePar->fitErrs()._cEY*J[0]*J[2]);
803 GBTrackParam.SetCov( 4, NodePar->fitErrs()._cEZ*J[1]*J[2]);
804 GBTrackParam.SetCov( 5, NodePar->fitErrs()._cEE*J[2]*J[2]);
805 GBTrackParam.SetCov( 6, NodePar->fitErrs()._cTY*J[0]*J[4]);
806 GBTrackParam.SetCov( 7, NodePar->fitErrs()._cTZ*J[1]*J[4]);
807 GBTrackParam.SetCov( 8, NodePar->fitErrs()._cTE*J[2]*J[4]);
808 GBTrackParam.SetCov( 9, NodePar->fitErrs()._cTT*J[4]*J[4]);
809 GBTrackParam.SetCov(10, NodePar->fitErrs()._cPY*J[0]*J[3]);
810 GBTrackParam.SetCov(11, NodePar->fitErrs()._cPZ*J[1]*J[3]);
811 GBTrackParam.SetCov(12, NodePar->fitErrs()._cPE*J[2]*J[3]);
812 GBTrackParam.SetCov(13, NodePar->fitErrs()._cTP*J[4]*J[3]);
813 GBTrackParam.SetCov(14, NodePar->fitErrs()._cPP*J[3]*J[3]);
815 GBTrackParam.SetSignCosPhi(sgnCos);
817 GBTrack.SetInnerParam(GBTrackParam);
819 GBTrack.SetNHits( nTrackHits );
820 GBTrack.SetFirstHitRef( NGBHits );
822 NGBHits += nTrackHits;
824 fStiCaTracks.push_back(GBTrack);
828 vector<AliHLTTPCCAMCTrack> stiMCTracks;
829 vector<AliHLTTPCCALocalMCPoint> stiMCPoints;
830 vector<AliHLTTPCCAHitLabel> stiHitLabels;
831 FillPerformance(fStiCaHits,fStiIdTruth, stiMCTracks,stiMCPoints,stiHitLabels);
833 fStiMCTracks.Resize(stiMCTracks.size());
834 for (
unsigned i = 0; i < stiMCTracks.size(); i++) {
835 fStiMCTracks[i] = stiMCTracks[i];
837 fStiMCPoints.Resize(stiMCPoints.size());
838 for (
unsigned i = 0; i < stiMCPoints.size(); i++) {
839 fStiMCPoints[i] = stiMCPoints[i];
841 fStiHitLabels.Resize(stiHitLabels.size());
842 for (
unsigned i = 0; i < stiHitLabels.size(); i++) {
843 fStiHitLabels[i] = stiHitLabels[i];
848 #endif // DO_TPCCATRACKER_EFF_PERFORMANCE
Definition of Kalman Track.
void setGlobal(const StiDetector *detector, const StMeasuredPoint *stHit, Float_t x, Float_t y, Float_t z, Float_t energy)
const Float_t & x() const
Return the local x, y, z values.
const StiDetector * detector() const
StiCATpcTrackerInterface()
constructor - destructor
void SetHits(const std::vector< AliHLTTPCCAGBHit > &hits)
Try to group close hits in row formed by one track. After sort hits.
Definition of Kalman Track.
void Run()
Copy data to CATracker. Run CATracker. Copy tracks in fSeeds.
UInt_t timesUsed() const
Return the number of times this hit was assigned to a track.
int getTrackCount(Filter< StiTrack > *filter) const
virtual StiDetectorBuilder * getDetectorBuilder()
Get a detector builder appropriate for this detector group.
Float_t position() const
Return the position of the detector plane from which the hit arose.
const StMeasuredPoint * stHit() const
static StiCATpcTrackerInterface & Instance()
Instance.
const string & getName() const
Get the name of the object.