LCOV - code coverage report
Current view: top level - HLT/TPCLib/tracking-ca - AliTPCtrackerCA.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 233 0.4 %
Date: 2016-06-14 17:26:59 Functions: 1 13 7.7 %

          Line data    Source code
       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: Sergey Gorbunov <sergey.gorbunov@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             : #include "AliTPCtrackerCA.h"
      21             : 
      22             : #include "TTree.h"
      23             : #include "Riostream.h"
      24             : //#include "AliCluster.h"
      25             : #include "AliTPCClustersRow.h"
      26             : #include "AliTPCParam.h"
      27             : #include "AliTPCClusterParam.h"
      28             : 
      29             : #include "AliRun.h"
      30             : #include "AliRunLoader.h"
      31             : #include "AliStack.h"
      32             : 
      33             : #include "AliHLTTPCCAPerformance.h"
      34             : #include "AliHLTTPCCAParam.h"
      35             : #include "AliHLTTPCCATracker.h"
      36             : #include "AliHLTTPCCAStandaloneFramework.h"
      37             : #include "AliHLTTPCGMMergedTrack.h"
      38             : 
      39             : #include "TMath.h"
      40             : #include "AliTPCLoader.h"
      41             : #include "AliTPC.h"
      42             : #include "AliTPCclusterMI.h"
      43             : #include "AliTPCTransform.h"
      44             : #include "AliTPCcalibDB.h"
      45             : #include "AliTPCtrack.h"
      46             : #include "AliTPCseed.h"
      47             : #include "AliESDtrack.h"
      48             : #include "AliESDEvent.h"
      49             : #include "AliTrackReference.h"
      50             : #include "TStopwatch.h"
      51             : #include "AliTPCReconstructor.h"
      52             : #include <memory>
      53             : 
      54             : //#include <fstream.h>
      55             : 
      56           6 : ClassImp( AliTPCtrackerCA )
      57             : 
      58             : AliTPCtrackerCA::AliTPCtrackerCA()
      59           0 :     : AliTracker(), fkParam( 0 ), fClusters( 0 ), fClusterSliceRow( 0 ), fNClusters( 0 ), fDoHLTPerformance( 0 ), fDoHLTPerformanceClusters( 0 ), fStatCPUTime( 0 ), fStatRealTime( 0 ), fStatNEvents( 0 )
      60           0 : {
      61             :   //* default constructor
      62           0 : }
      63             : 
      64             : AliTPCtrackerCA::~AliTPCtrackerCA()
      65           0 : {
      66             :   //* destructor
      67           0 :   delete[] fClusters;
      68           0 :   delete[] fClusterSliceRow;
      69           0 : }
      70             : 
      71             : //#include "AliHLTTPCCADisplay.h"
      72             : 
      73             : AliTPCtrackerCA::AliTPCtrackerCA( const AliTPCParam *par ):
      74           0 :     AliTracker(), fkParam( par ), fClusters( 0 ), fClusterSliceRow( 0 ), fNClusters( 0 ), fDoHLTPerformance( 0 ), fDoHLTPerformanceClusters( 0 ), fStatCPUTime( 0 ), fStatRealTime( 0 ), fStatNEvents( 0 )
      75           0 : {
      76             :   //* constructor
      77             : 
      78           0 :   fDoHLTPerformance = 0;
      79           0 :   fDoHLTPerformanceClusters = 0;
      80             : 
      81           0 :   AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
      82             : 
      83             : 
      84           0 :   for ( int iSlice = 0; iSlice < hlt.NSlices(); iSlice++ ) {
      85             : 
      86           0 :     float bz = AliTracker::GetBz();
      87             : 
      88           0 :     float inRmin = fkParam->GetInnerRadiusLow();
      89             :     //float inRmax = fkParam->GetInnerRadiusUp();
      90             :     //float outRmin = fkParam->GetOuterRadiusLow();
      91           0 :     float outRmax = fkParam->GetOuterRadiusUp();
      92             :     float plusZmin = 0.0529937;
      93             :     float plusZmax = 249.778;
      94             :     float minusZmin = -249.645;
      95             :     float minusZmax = -0.0799937;
      96             :     float dalpha = 0.349066;
      97           0 :     float alpha = 0.174533 + dalpha * iSlice;
      98             : 
      99           0 :     bool zPlus = ( iSlice < 18 );
     100           0 :     float zMin =  zPlus ? plusZmin : minusZmin;
     101           0 :     float zMax =  zPlus ? plusZmax : minusZmax;
     102             :     //TPCZmin = -249.645, ZMax = 249.778
     103             :     //float rMin =  inRmin;
     104             :     //float rMax =  outRmax;
     105             : 
     106             :     float padPitch = 0.4;
     107             :     float sigmaZ = 0.228808;
     108             : 
     109           0 :     int nRows = fkParam->GetNRowLow() + fkParam->GetNRowUp();
     110           0 :     int dimRowX=fkParam->GetNRowLow()+fkParam->GetNRowUp();
     111           0 :     std::auto_ptr<float> rowX(new float[dimRowX]);
     112           0 :     for ( int irow = 0; irow < fkParam->GetNRowLow(); irow++ ) {
     113           0 :       (rowX.get())[irow] = fkParam->GetPadRowRadiiLow( irow );
     114             :     }
     115           0 :     for ( int irow = 0; irow < fkParam->GetNRowUp(); irow++ ) {
     116           0 :       (rowX.get())[fkParam->GetNRowLow()+irow] = fkParam->GetPadRowRadiiUp( irow );
     117             :     }
     118           0 :     AliHLTTPCCAParam param;
     119           0 :     param.Initialize( iSlice, nRows, rowX.get(), alpha, dalpha,
     120             :                       inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, bz );
     121           0 :     param.SetHitPickUpFactor( 1. );
     122           0 :     param.SetMaxTrackMatchDRow( 5 );
     123           0 :     param.SetTrackConnectionFactor( 3.5 );
     124           0 :     param.SetMinNTrackClusters( 30 );
     125           0 :     param.SetMinTrackPt(0.2);
     126           0 :     AliTPCClusterParam * clparam = AliTPCcalibDB::Instance()->GetClusterParam();
     127           0 :     for ( int iRow = 0; iRow < nRows; iRow++ ) {
     128           0 :       int    type = ( iRow < 63 ) ? 0 : ( ( iRow > 126 ) ? 1 : 2 );
     129           0 :       for ( int iyz = 0; iyz < 2; iyz++ ) {
     130           0 :         for ( int k = 0; k < 7; k++ ) {
     131             :           //std::cout<<param.fParamS0Par[iyz][type][k]<<" "<<clparam->fParamS0Par[iyz][type][k] - param.fParamS0Par[iyz][type][k]<<std::endl;
     132             : #ifndef HAVE_NOT_ALITPCCLUSTERPARAM_r40128
     133           0 :           param.SetParamS0Par( iyz, type, k, clparam->ParamS0Par(iyz, type, k));
     134             : #else
     135             :           param.SetParamS0Par( iyz, type, k, clparam->fParamS0Par[iyz][type][k] );
     136             : #endif //HAVE_NOT_ALITPCCLUSTERPARAM_r40128
     137             :         }
     138             :       }
     139             :     }
     140             :     //hlt.SliceTracker( iSlice ).Initialize( param );
     141           0 :         hlt.InitializeSliceParam(iSlice, param);
     142           0 :   }
     143           0 : }
     144             : 
     145             : 
     146             : 
     147             : int AliTPCtrackerCA::LoadClusters ( TTree * fromTree )
     148             : {
     149             :   // load clusters to the local arrays
     150           0 :   fNClusters = 0;
     151           0 :   delete[] fClusters;
     152           0 :   delete[] fClusterSliceRow;
     153             : 
     154           0 :   AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
     155             : 
     156           0 :   if ( fDoHLTPerformance ) {
     157           0 :     AliHLTTPCCAPerformance::Instance().StartEvent();
     158           0 :     if ( fDoHLTPerformanceClusters ) AliHLTTPCCAPerformance::Instance().SetDoClusterPulls( 1 );
     159             :   }
     160             : 
     161           0 :   if ( !fkParam ) return 1;
     162             : 
     163             :   // load mc tracks
     164           0 :   while ( fDoHLTPerformance ) {
     165           0 :     if ( !gAlice ) break;
     166             : #ifndef HAVE_NOT_ALIRUNLOADER30859
     167           0 :     AliRunLoader *rl = AliRunLoader::Instance();//gAlice->GetRunLoader();
     168             : #else
     169             :     // the old way before rev 30859
     170             :     AliRunLoader *rl = AliRunLoader::GetRunLoader();
     171             : #endif
     172           0 :     if ( !rl ) break;
     173           0 :     rl->LoadKinematics();
     174           0 :     AliStack *stack = rl->Stack();
     175           0 :     if ( !stack ) break;
     176           0 :     int nMCtracks = stack->GetNtrack();
     177           0 :     if( nMCtracks<0 || nMCtracks>10000000 ) nMCtracks = 0;
     178             : 
     179           0 :     AliHLTTPCCAPerformance::Instance().SetNMCTracks( nMCtracks );
     180             : 
     181           0 :     for ( int itr = 0; itr < nMCtracks; itr++ ) {
     182           0 :       TParticle *part = stack->Particle( itr );
     183           0 :       AliHLTTPCCAPerformance::Instance().ReadMCTrack( itr, part );
     184             :     }
     185             : 
     186             :     { // check for MC tracks at the TPC entrance
     187             : 
     188           0 :       rl->LoadTrackRefs();
     189           0 :       TTree *mcTree = rl->TreeTR();
     190           0 :       if ( !mcTree ) break;
     191           0 :       TBranch *branch = mcTree->GetBranch( "TrackReferences" );
     192           0 :       if ( !branch ) break;
     193           0 :       TClonesArray tpcdummy( "AliTrackReference", 1000 ), *tpcRefs = &tpcdummy;
     194           0 :       branch->SetAddress( &tpcRefs );
     195             : 
     196           0 :       bool *isTPC = new bool [nMCtracks];
     197           0 :       for ( int i = 0; i < nMCtracks; i++ ) isTPC[i] = 0;
     198             : 
     199           0 :       int nr = ( int )mcTree->GetEntries();
     200           0 :       for ( int r = 0; r < nr; r++ ) {
     201           0 :         mcTree->GetEvent( r );
     202           0 :         int nref = tpcRefs->GetEntriesFast();
     203           0 :         if ( !nref ) continue;
     204             :         AliTrackReference *tpcRef = 0x0;
     205           0 :         for ( int iref = 0; iref < nref; ++iref ) {
     206           0 :           tpcRef = ( AliTrackReference* )tpcRefs->UncheckedAt( iref );
     207           0 :           if ( tpcRef->DetectorId() == AliTrackReference::kTPC ) break;
     208             :           tpcRef = 0x0;
     209             :         }
     210           0 :         if ( !tpcRef ) continue;
     211             : 
     212           0 :         if ( isTPC[tpcRef->Label()] ) continue;
     213             : 
     214           0 :         AliHLTTPCCAPerformance::Instance().ReadMCTPCTrack( tpcRef->Label(),
     215           0 :             tpcRef->X(), tpcRef->Y(), tpcRef->Z(),
     216           0 :             tpcRef->Px(), tpcRef->Py(), tpcRef->Pz() );
     217           0 :         isTPC[tpcRef->Label()] = 1;
     218           0 :         tpcRefs->Clear();
     219           0 :       }
     220           0 :       delete[] isTPC;
     221           0 :     }
     222             : 
     223           0 :     while ( fDoHLTPerformanceClusters ) {
     224           0 :       AliTPCLoader *tpcl = ( AliTPCLoader* ) rl->GetDetectorLoader( "TPC" );
     225           0 :       if ( !tpcl ) break;
     226           0 :       if ( tpcl->TreeH() == 0x0 ) {
     227           0 :         if ( tpcl->LoadHits() ) break;
     228             :       }
     229           0 :       if ( tpcl->TreeH() == 0x0 ) break;
     230             : 
     231           0 :       AliTPC *tpc = ( AliTPC* ) gAlice->GetDetector( "TPC" );
     232           0 :       int nEnt = ( int )tpcl->TreeH()->GetEntries();
     233             :       int nPoints = 0;
     234           0 :       for ( int iEnt = 0; iEnt < nEnt; iEnt++ ) {
     235           0 :         tpc->ResetHits();
     236           0 :         tpcl->TreeH()->GetEvent( iEnt );
     237           0 :         AliTPChit *phit = ( AliTPChit* )tpc->FirstHit( -1 );
     238           0 :         for ( ; phit; phit = ( AliTPChit* )tpc->NextHit() ) nPoints++;
     239             :       }
     240           0 :       AliHLTTPCCAPerformance::Instance().SetNMCPoints( nPoints );
     241             : 
     242           0 :       for ( int iEnt = 0; iEnt < nEnt; iEnt++ ) {
     243           0 :         tpc->ResetHits();
     244           0 :         tpcl->TreeH()->GetEvent( iEnt );
     245           0 :         AliTPChit *phit = ( AliTPChit* )tpc->FirstHit( -1 );
     246           0 :         for ( ; phit; phit = ( AliTPChit* )tpc->NextHit() ) {
     247           0 :           AliHLTTPCCAPerformance::Instance().ReadMCPoint( phit->GetTrack(), phit->X(), phit->Y(), phit->Z(), phit->Time(), phit->fSector % 36 );
     248             :         }
     249             :       }
     250             :       break;
     251             :     }
     252           0 :     break;
     253             :   }
     254             : 
     255           0 :   TBranch * br = fromTree->GetBranch( "Segment" );
     256           0 :   if ( !br ) return 1;
     257             : 
     258           0 :   AliTPCClustersRow *clrow = new AliTPCClustersRow;
     259           0 :   clrow->SetClass( "AliTPCclusterMI" );
     260           0 :   clrow->SetArray( 0 );
     261           0 :   clrow->GetArray()->ExpandCreateFast( 10000 );
     262             : 
     263           0 :   br->SetAddress( &clrow );
     264             : 
     265             :   //
     266           0 :   int nEnt = int( fromTree->GetEntries() );
     267             : 
     268           0 :   fNClusters = 0;
     269           0 :   for ( int i = 0; i < nEnt; i++ ) {
     270           0 :     br->GetEntry( i );
     271           0 :     int sec, row;
     272           0 :     fkParam->AdjustSectorRow( clrow->GetID(), sec, row );
     273           0 :     fNClusters += clrow->GetArray()->GetEntriesFast();
     274           0 :   }
     275             : 
     276           0 :   fClusters = new AliTPCclusterMI [fNClusters];
     277           0 :   fClusterSliceRow = new unsigned int [fNClusters];
     278             : 
     279           0 :   hlt.StartDataReading( fNClusters );
     280             : 
     281           0 :   if ( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().SetNHits( fNClusters );
     282             : 
     283             :   int ind = 0;
     284           0 :   for ( int i = 0; i < nEnt; i++ ) {
     285           0 :     br->GetEntry( i );
     286           0 :     int sec, row;
     287           0 :     fkParam->AdjustSectorRow( clrow->GetID(), sec, row );
     288           0 :     int nClu = clrow->GetArray()->GetEntriesFast();
     289           0 :     float x = fkParam->GetPadRowRadii( sec, row );
     290             : 
     291           0 :     if ( sec >= 36 ) {
     292           0 :       sec = sec - 36;
     293           0 :       row = row + fkParam->GetNRowLow();
     294           0 :     }
     295             : 
     296           0 :     unsigned int sliceRow = ( sec << 8 ) + row;
     297             : 
     298           0 :     for ( int icl = 0; icl < nClu; icl++ ) {
     299             :       int lab0 = -1;
     300             :       int lab1 = -1;
     301             :       int lab2 = -1;
     302           0 :       AliTPCclusterMI* cluster = ( AliTPCclusterMI* )( clrow->GetArray()->At( icl ) );
     303           0 :       if ( !cluster ) continue;
     304           0 :       lab0 = cluster->GetLabel( 0 );
     305           0 :       lab1 = cluster->GetLabel( 1 );
     306           0 :       lab2 = cluster->GetLabel( 2 );
     307             : 
     308           0 :       AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ; 
     309           0 :       if ( !transform ) {
     310           0 :         AliFatal( "Tranformations not in calibDB" );
     311           0 :         break;
     312             :       }
     313             : 
     314           0 :       transform->SetCurrentRecoParam((AliTPCRecoParam*)AliTPCReconstructor::GetRecoParam());
     315           0 :       double xx[3] = {static_cast<double>(cluster->GetRow()), cluster->GetPad(), cluster->GetTimeBin()};
     316           0 :       int id[1] = {cluster->GetDetector()};
     317           0 :       transform->Transform( xx, id, 0, 1 );
     318             : 
     319           0 :       cluster->SetX( xx[0] );
     320           0 :       cluster->SetY( xx[1] );
     321           0 :       cluster->SetZ( xx[2] );
     322             : 
     323           0 :       TGeoHMatrix  *mat = fkParam->GetClusterMatrix( cluster->GetDetector() );
     324           0 :       double pos[3] = {cluster->GetX(), cluster->GetY(), cluster->GetZ()};
     325           0 :       double posC[3] = {cluster->GetX(), cluster->GetY(), cluster->GetZ()};
     326           0 :       if ( mat ) mat->LocalToMaster( pos, posC );
     327             :       else {
     328             :         // chack Loading of Geo matrices from GeoManager - TEMPORARY FIX
     329             :       }
     330           0 :       cluster->SetX( posC[0] );
     331           0 :       cluster->SetY( posC[1] );
     332           0 :       cluster->SetZ( posC[2] );
     333             : 
     334           0 :       x = cluster->GetX();
     335           0 :       float y = cluster->GetY();
     336           0 :       float z = cluster->GetZ();
     337             : 
     338             : 
     339           0 :       int index = ind++;
     340           0 :       fClusters[index] = *cluster;
     341             : 
     342           0 :       fClusterSliceRow[index] = sliceRow;
     343             : 
     344           0 :       hlt.ReadCluster( index, sec, row, x, y, z, cluster->GetQ() );
     345             : 
     346           0 :       if ( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().ReadHitLabel( index, lab0, lab1, lab2 );
     347           0 :     }
     348           0 :   }
     349           0 :   delete clrow;
     350             : 
     351           0 :   hlt.FinishDataReading();
     352             : 
     353             :   //AliHLTTPCCAPerformance::Instance().SmearClustersMC();
     354             : 
     355             :   return 0;
     356           0 : }
     357             : 
     358             : AliCluster * AliTPCtrackerCA::GetCluster( int index ) const
     359             : {
     360           0 :   return &( fClusters[index] );
     361             : }
     362             : 
     363             : int AliTPCtrackerCA::Clusters2Tracks( AliESDEvent *event )
     364             : {
     365             :   // reconstruction
     366             :   //cout<<"Start of AliTPCtrackerCA"<<endl;
     367           0 :   TStopwatch timer;
     368             : 
     369           0 :   AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
     370             : 
     371           0 :   hlt.ProcessEvent();
     372             : 
     373           0 :   if ( event ) {  
     374             : 
     375           0 :     for ( int itr = 0; itr < hlt.Merger().NOutputTracks(); itr++ ) {
     376             : 
     377           0 :       AliTPCseed tTPC;
     378             : 
     379           0 :       const AliHLTTPCGMMergedTrack &tCA = hlt.Merger().OutputTracks()[itr];
     380             : 
     381           0 :       AliHLTTPCGMTrackParam par = tCA.GetParam();      
     382           0 :       par.GetExtParam( tTPC, tCA.GetAlpha() );
     383           0 :       tTPC.SetMass( 0.13957 );
     384           0 :       if ( TMath::Abs( tTPC.GetSigned1Pt() ) > 1. / 0.02 ) continue;
     385           0 :       int nhits = tCA.NClusters();
     386             :       int firstHit = 0;
     387           0 :       if ( nhits > 160 ) {
     388           0 :         firstHit = nhits - 160;
     389             :         nhits = 160;
     390           0 :       }
     391           0 :       tTPC.SetNumberOfClusters( nhits );
     392             :       //float alpha = tCA.GetAlpha();
     393           0 :       AliHLTTPCGMTrackParam t0 = par;
     394           0 :       for ( int ih = 0; ih < nhits; ih++ ) {
     395           0 :         int index = hlt.Merger().OutputClusterIds()[ tCA.FirstClusterRef() + firstHit + ih ];
     396           0 :         tTPC.SetClusterIndex( ih, index );
     397           0 :         AliTPCclusterMI *c = &( fClusters[index] );
     398             :         //int iSlice = fClusterSliceRow[index] >> 8;
     399           0 :         int row = fClusterSliceRow[index] & 0xff;
     400             : 
     401           0 :         tTPC.SetClusterPointer( row, c );
     402             :         /*
     403             :         AliTPCTrackerPoint &point = *( tTPC.GetTrackPoint( row ) );
     404             :         {
     405             :           //AliHLTTPCCATracker &slice = hlt.SliceTracker( iSlice );
     406             :           if ( hlt.Param(iSlice).Alpha() != alpha ) {
     407             :             if ( ! t0.Rotate(  hlt.Param(iSlice).Alpha() - alpha, .999 ) ) continue;
     408             :             alpha = hlt.Param(iSlice).Alpha();
     409             :           }
     410             :           float x = hlt.Row(iSlice, row).X();
     411             :           if ( !t0.TransportToX( x, hlt.Param(iSlice).GetBz( t0 ), .999 ) ) continue;
     412             :           float sy2, sz2;
     413             :           //slice.GetErrors2( row, t0, sy2, sz2 );
     414             :                   hlt.Param(iSlice).GetClusterErrors2( row, t0.GetZ(), t0.SinPhi(), t0.GetCosPhi(), t0.DzDs(), sy2, sz2 );
     415             :           point.SetSigmaY( c->GetSigmaY2() / sy2 );
     416             :           point.SetSigmaZ( c->GetSigmaZ2() / sz2 );
     417             :           point.SetAngleY( TMath::Abs( t0.GetSinPhi() / t0.GetCosPhi() ) );
     418             :           point.SetAngleZ( TMath::Abs( t0.GetDzDs() ) );
     419             :         }
     420             :         */
     421             :       }
     422             :       //tTPC.CookdEdx( 0.02, 0.6 );
     423             : 
     424           0 :       CookLabel( &tTPC, 0.1 );
     425             :       
     426             :       if ( 1 ) { // correction like in off-line --- Adding systematic error
     427             : 
     428           0 :         const double *param = AliTPCReconstructor::GetRecoParam()->GetSystematicError();
     429           0 :         double covar[15];
     430           0 :         for ( int i = 0; i < 15; i++ ) covar[i] = 0;
     431           0 :         covar[0] = param[0] * param[0];
     432           0 :         covar[2] = param[1] * param[1];
     433           0 :         covar[5] = param[2] * param[2];
     434           0 :         covar[9] = param[3] * param[3];
     435           0 :         double facC =  AliTracker::GetBz() * kB2C;
     436           0 :         covar[14] = param[4] * param[4] * facC * facC;
     437           0 :         tTPC.AddCovariance( covar );
     438           0 :       }
     439             : 
     440           0 :       AliESDtrack tESD;
     441           0 :       tESD.UpdateTrackParams( &( tTPC ), AliESDtrack::kTPCin );
     442             :       //tESD.SetStatus( AliESDtrack::kTPCrefit );
     443             :       //tESD.SetTPCPoints(tTPC.GetPoints());
     444           0 :       int   ndedx = tTPC.GetNCDEDX( 0 );
     445           0 :       float sdedx = tTPC.GetSDEDX( 0 );
     446           0 :       float dedx  = tTPC.GetdEdx();
     447           0 :       tESD.SetTPCsignal( dedx, sdedx, ndedx );
     448             :       //tESD.myTPC = tTPC;
     449             : 
     450           0 :       event->AddTrack( &tESD );
     451           0 :     }
     452           0 :   }
     453             : 
     454             : 
     455           0 :   timer.Stop();
     456             : 
     457           0 :   fStatCPUTime += timer.CpuTime();
     458           0 :   fStatRealTime += timer.RealTime();
     459             : 
     460             :   //cout << "\n\nCA tracker speed: cpu = " << fStatCPUTime / ( fStatNEvents + 1 )*1.e3 << " [ms/ev], real = " << fStatRealTime / ( fStatNEvents + 1 )*1.e3 << " [ms/ev], n calls = " << ( fStatNEvents + 1 ) << endl << endl;
     461             : 
     462             : 
     463             :   //cout<<"Do performance.."<<endl;
     464             : 
     465           0 :   if ( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().Performance();
     466             : 
     467             :   if ( 0 ) {// Write Event
     468             :     if ( fStatNEvents == 0 ) {
     469             :       fstream geo;
     470             :       geo.open( "CAEvents/settings.dat", ios::out );
     471             :       if ( geo.is_open() ) {
     472             :         hlt.WriteSettings( geo );
     473             :       }
     474             :       geo.close();
     475             :     }
     476             : 
     477             :     fstream hits;
     478             :     char name[255];
     479             :     sprintf( name, "CAEvents/%i.event.dat", fStatNEvents );
     480             :     hits.open( name, ios::out );
     481             :     if ( hits.is_open() ) {
     482             :       hlt.WriteEvent( hits );
     483             :       fstream tracks;
     484             :       sprintf( name, "CAEvents/%i.tracks.dat", fStatNEvents );
     485             :       tracks.open( name, ios::out );
     486             :       hlt.WriteTracks( tracks );
     487             :     }
     488             :     hits.close();
     489             :     if ( fDoHLTPerformance ) {
     490             :       fstream mcevent, mcpoints;
     491             :       char mcname[255];
     492             :       sprintf( mcname, "CAEvents/%i.mcevent.dat", fStatNEvents );
     493             :       mcevent.open( mcname, ios::out );
     494             :       if ( mcevent.is_open() ) {
     495             :         AliHLTTPCCAPerformance::Instance().WriteMCEvent( mcevent );
     496             :       }
     497             :       if ( 1 && fDoHLTPerformanceClusters ) {
     498             :         sprintf( mcname, "CAEvents/%i.mcpoints.dat", fStatNEvents );
     499             :         mcpoints.open( mcname, ios::out );
     500             :         if ( mcpoints.is_open() ) {
     501             :           AliHLTTPCCAPerformance::Instance().WriteMCPoints( mcpoints );
     502             :         }
     503             :         mcpoints.close();
     504             :       }
     505             :       mcevent.close();
     506             :     }
     507             :   }
     508             : 
     509           0 :   fStatNEvents++;
     510             : 
     511             : 
     512             :   //cout<<"End of AliTPCtrackerCA"<<endl;
     513             :   return 0;
     514           0 : }
     515             : 
     516             : 
     517             : int AliTPCtrackerCA::RefitInward ( AliESDEvent * /*event*/ )
     518             : {
     519             :   //* forward propagation of ESD tracks
     520             : #ifdef XXX
     521             :   float xTPC = fkParam->GetInnerRadiusLow();
     522             :   float dAlpha = fkParam->GetInnerAngle() / 180.*TMath::Pi();
     523             :   float yMax = xTPC * TMath::Tan( dAlpha / 2. );
     524             : 
     525             :   AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
     526             : 
     527             :   int nentr = event->GetNumberOfTracks();
     528             : 
     529             :   for ( int itr = 0; itr < nentr; itr++ ) {
     530             :     AliESDtrack *esd = event->GetTrack( itr );
     531             :     ULong_t status = esd->GetStatus();
     532             :     if ( !( status&AliESDtrack::kTPCin ) ) continue;
     533             :     AliHLTTPCCATrackParam t0;
     534             :     AliHLTTPCCATrackConvertor::SetExtParam( t0, *esd );
     535             :     AliHLTTPCCATrackParam t = t0;
     536             :     float alpha = esd->GetAlpha();
     537             :     //float dEdX=0;
     538             :     AliHLTTPCCAMerger::AliHLTTPCCAClusterInfo infos[500];
     539             :     int hits[500], hits1[500];
     540             :     int nHits = esd->GetTPCclusters( hits );
     541             :     for ( int i = 0; i < nHits; i++ ) {
     542             :       hits1[i] = i;
     543             :       int index = hits[i];
     544             :       infos[i].SetISlice( fClusterSliceRow[index] >> 8 );
     545             :       int row = fClusterSliceRow[index] & 0xff;
     546             :       int type = ( row < 63 ) ? 0 : ( ( row > 126 ) ? 1 : 2 );
     547             :       infos[i].SetRowType( type );
     548             :       infos[i].SetId( index );
     549             :       infos[i].SetX( fClusters[index].GetX() );
     550             :       infos[i].SetY( fClusters[index].GetY() );
     551             :       infos[i].SetZ( fClusters[index].GetZ() );
     552             :     }
     553             : 
     554             :     bool ok = hlt.Merger().FitTrack( t, alpha, t0, alpha, hits1, nHits, 0, 1,infos );
     555             : 
     556             :     if ( ok &&  nHits > 15 ) {
     557             :       if ( t.TransportToXWithMaterial( xTPC, hlt.Merger().SliceParam().GetBz( t ) ) ) {
     558             :         if ( t.GetY() > yMax ) {
     559             :           if ( t.Rotate( dAlpha ) ) {
     560             :             alpha += dAlpha;
     561             :             t.TransportToXWithMaterial( xTPC, hlt.Merger().SliceParam().GetBz( t ) );
     562             :           }
     563             :         } else if ( t.GetY() < -yMax ) {
     564             :           if ( t.Rotate( -dAlpha ) ) {
     565             :             alpha += -dAlpha;
     566             :             t.TransportToXWithMaterial( xTPC, hlt.Merger().SliceParam().GetBz( t ) );
     567             :           }
     568             :         }
     569             :       }
     570             : 
     571             :       AliTPCtrack tt( *esd );
     572             :       if ( AliHLTTPCCATrackConvertor::GetExtParam( t, tt, alpha ) ) {
     573             :         if ( t.X() > 50 ) esd->UpdateTrackParams( &tt, AliESDtrack::kTPCrefit );
     574             :       }
     575             :     }
     576             :   }
     577             : #endif
     578           0 :   return 0;
     579             : }
     580             : 
     581             : int AliTPCtrackerCA::PropagateBack( AliESDEvent * /*event*/ )
     582             : {
     583             :   //* backward propagation of ESD tracks
     584             : #ifdef XXX
     585             : 
     586             :   AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
     587             : 
     588             :   int nentr = event->GetNumberOfTracks();
     589             : 
     590             :   for ( int itr = 0; itr < nentr; itr++ ) {
     591             : 
     592             :     AliESDtrack *esd = event->GetTrack( itr );
     593             :     ULong_t status = esd->GetStatus();
     594             :     if ( !( status&AliESDtrack::kTPCin ) ) continue;
     595             : 
     596             :     AliHLTTPCCATrackParam t0;
     597             :     AliHLTTPCCATrackConvertor::SetExtParam( t0, *esd  );
     598             :     AliHLTTPCCATrackParam t = t0;
     599             :     float alpha = esd->GetAlpha();
     600             :     //float dEdX=0;
     601             :     AliHLTTPCCAMerger::AliHLTTPCCAClusterInfo infos[500];
     602             :     int hits[500], hits1[500];
     603             :     int nHits = esd->GetTPCclusters( hits );
     604             :     for ( int i = 0; i < nHits; i++ ) {
     605             :       hits1[i] = i;
     606             :       int index = hits[i];
     607             :       infos[i].SetISlice( fClusterSliceRow[index] >> 8 );
     608             :       int row = fClusterSliceRow[index] & 0xff;
     609             :       int type = ( row < 63 ) ? 0 : ( ( row > 126 ) ? 1 : 2 );
     610             :       infos[i].SetRowType( type );
     611             :       infos[i].SetId( index );
     612             :       infos[i].SetX( fClusters[index].GetX() );
     613             :       infos[i].SetY( fClusters[index].GetY() );
     614             :       infos[i].SetZ( fClusters[index].GetZ() );
     615             :     }
     616             : 
     617             :     bool ok = hlt.Merger().FitTrack( t, alpha, t0, alpha, hits1, nHits, 1, 1, infos );
     618             : 
     619             :     if ( ok &&  nHits > 15 ) {
     620             :       AliTPCtrack tt( *esd );
     621             :       if ( AliHLTTPCCATrackConvertor::GetExtParam( t, tt, alpha ) ) {
     622             :         if ( t.X() > 50 ) esd->UpdateTrackParams( &tt, AliESDtrack::kTPCout );
     623             :       }
     624             :     }
     625             :   }
     626             : #endif
     627           0 :   return 0;
     628             : }

Generated by: LCOV version 1.11