LCOV - code coverage report
Current view: top level - HLT/ITS/trackingSAP - AliHLTITSSAPTrackerComponent.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 19 287 6.6 %
Date: 2016-06-14 17:26:59 Functions: 7 23 30.4 %

          Line data    Source code
       1             : // **************************************************************************
       2             : // This file is property of and copyright by the ALICE HLT Project          *
       3             : // ALICE Experiment at CERN, All rights reserved.                           *
       4             : //                                                                          *
       5             : // Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
       6             : //                  Ivan Kisel <kisel@kip.uni-heidelberg.de>                *
       7             : //                  for The ALICE HLT Project.                              *
       8             : //                                                                          *
       9             : // Permission to use, copy, modify and distribute this software and its     *
      10             : // documentation strictly for non-commercial purposes is hereby granted     *
      11             : // without fee, provided that the above copyright notice appears in all     *
      12             : // copies and that both the copyright notice and this permission notice     *
      13             : // appear in the supporting documentation. The authors make no claims       *
      14             : // about the suitability of this software for any purpose. It is            *
      15             : // provided "as is" without express or implied warranty.                    *
      16             : //                                                                          *
      17             : //***************************************************************************
      18             : 
      19             : ///  @file   AliHLTITSSAPTrackerComponent.h
      20             : ///  @author Ruben Shahoyan <ruben.shahoyan@cern.ch>
      21             : ///  @date   August 2014
      22             : ///  @brief  An ITS standalone primaries tracker/vertexer processing component for the HLT
      23             : ///  Adapted from HLT/ITS/tracking/AliHLTITSSAPTrackerComponent component
      24             : 
      25             : /////////////////////////////////////////////////////
      26             : //                                                 //
      27             : // a ITS tracker processing component for the HLT  //
      28             : //                                                 //
      29             : /////////////////////////////////////////////////////
      30             : 
      31             : #include "AliHLTITSSAPTrackerComponent.h"
      32             : #include "AliHLTArray.h"
      33             : #include "AliExternalTrackParam.h"
      34             : #include "TStopwatch.h"
      35             : #include "TMath.h"
      36             : #include "AliCDBEntry.h"
      37             : #include "AliCDBManager.h"
      38             : #include "AliGeomManager.h"
      39             : #include <TObjString.h>
      40             : #include <TObjArray.h>
      41             : #include <TClonesArray.h>
      42             : #include <TGeoGlobalMagField.h>
      43             : #include "AliITSSAPTracker.h"
      44             : #include "AliITSSAPLayer.h"
      45             : #include "AliHLTITSSpacePointData.h"
      46             : #include "AliHLTITSClusterDataFormat.h"
      47             : #include "AliHLTDataTypes.h"
      48             : #include "AliHLTExternalTrackParam.h"
      49             : #include "AliGeomManager.h"
      50             : #include "AliHLTTrackMCLabel.h"
      51             : #include "AliITSRecPoint.h"
      52             : #include "AliITSRecoParam.h"
      53             : #include "AliHLTSAPTrackerData.h"
      54             : #include "AliHLTMessage.h"
      55             : #include "AliFlatESDVertex.h"
      56             : #include "AliHLTReadoutList.h"
      57             : #include "AliHLTCTPData.h"
      58             : #include <map>
      59             : 
      60             : using namespace std;
      61             : 
      62             : /** ROOT macro for the implementation of ROOT specific class methods */
      63           6 : ClassImp( AliHLTITSSAPTrackerComponent )
      64           3 : AliHLTITSSAPTrackerComponent::AliHLTITSSAPTrackerComponent()
      65           3 : : fRecoParamType(AliRecoParam::kDefault),
      66           3 :   fSkipSDD(-1),
      67           3 :   fMaxMissL(1),
      68           3 :   fMaxTrackletsToRun(-1),
      69           3 :   fMaxVtxIter(-1),
      70           3 :   fStopScaleChange(-1),
      71           3 :   fMaxRSPDVtx(-1),
      72           3 :   fBenchmark("ITSSAPTracker"),
      73           3 :   fTracker(0),
      74           3 :   fClusters(0)
      75             : 
      76          15 : {
      77             :   // see header file for class documentation
      78             :   // or
      79             :   // refer to README to build package
      80             :   // or
      81             :   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
      82           6 : }
      83             : 
      84             : AliHLTITSSAPTrackerComponent::AliHLTITSSAPTrackerComponent( const AliHLTITSSAPTrackerComponent& )
      85           0 :   :AliHLTProcessor(),
      86           0 :    fRecoParamType(AliRecoParam::kDefault),
      87           0 :    fSkipSDD(-1),
      88           0 :    fMaxMissL(1),
      89           0 :    fMaxTrackletsToRun(-1),
      90           0 :    fMaxVtxIter(-1),
      91           0 :    fStopScaleChange(-1),
      92           0 :    fMaxRSPDVtx(-1),
      93           0 :    fBenchmark("ITSSAPTracker"),
      94           0 :    fTracker(0),
      95           0 :    fClusters(0)
      96           0 : {
      97             :   // see header file for class documentation
      98           0 :   HLTFatal( "copy constructor untested" );
      99           0 : }
     100             : 
     101             : AliHLTITSSAPTrackerComponent& AliHLTITSSAPTrackerComponent::operator=( const AliHLTITSSAPTrackerComponent& )
     102             : {
     103             :   // see header file for class documentation
     104           0 :   HLTFatal( "assignment operator untested" );
     105           0 :   return *this;
     106             : }
     107             : 
     108             : AliHLTITSSAPTrackerComponent::~AliHLTITSSAPTrackerComponent()
     109          18 : {
     110             :   // see header file for class documentation
     111           3 :   delete fTracker;
     112           3 :   delete fClusters;
     113           9 : }
     114             : 
     115             : //
     116             : // Public functions to implement AliHLTComponent's interface.
     117             : // These functions are required for the registration process
     118             : //
     119             : 
     120             : const char* AliHLTITSSAPTrackerComponent::GetComponentID()
     121             : {
     122             :   // see header file for class documentation
     123          30 :   return "ITSSAPTracker";
     124             : }
     125             : 
     126             : void AliHLTITSSAPTrackerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list )
     127             : {
     128             :   // see header file for class documentation
     129           0 :   list.clear();
     130           0 :   list.push_back( kAliHLTDataTypeESDVertex|kAliHLTDataOriginITSSPD );
     131           0 :   list.push_back( kAliHLTDataTypeClusters|kAliHLTDataOriginITSSSD );
     132           0 :   list.push_back( kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD );
     133           0 :   list.push_back( kAliHLTDataTypeClusters|kAliHLTDataOriginITSSDD );
     134           0 :   list.push_back( kAliHLTDataTypeClusters|kAliHLTDataOriginITS );
     135           0 : }
     136             : 
     137             : AliHLTComponentDataType AliHLTITSSAPTrackerComponent::GetOutputDataType()
     138             : {
     139             :   // see header file for class documentation  
     140           0 :   return kAliHLTMultipleDataType;
     141             : }
     142             : 
     143             : int AliHLTITSSAPTrackerComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
     144             : {
     145             :   // see header file for class documentation  
     146           0 :   tgtList.clear();
     147           0 :   tgtList.push_back(kAliHLTDataTypeITSSAPData|kAliHLTDataOriginITS);
     148           0 :   tgtList.push_back(kAliHLTDataTypeFlatESDVertex|kAliHLTDataOriginITS ); // RS??: is this correct?
     149           0 :   return tgtList.size();
     150             : }
     151             : 
     152             : void AliHLTITSSAPTrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
     153             : {
     154             :   // define guess for the output data size
     155           0 :   constBase = 200;       // minimum size
     156           0 :   inputMultiplier = 2.; // size relative to input
     157           0 : }
     158             : 
     159             : AliHLTComponent* AliHLTITSSAPTrackerComponent::Spawn()
     160             : {
     161             :   // see header file for class documentation
     162           0 :   return new AliHLTITSSAPTrackerComponent;
     163           0 : }
     164             : 
     165             : void AliHLTITSSAPTrackerComponent::SetDefaultConfiguration()
     166             : {
     167             :   // Set default configuration for the ITSSAP tracker component
     168             :   // Some parameters can be later overwritten from the OCDB
     169             :     
     170           0 : }
     171             : 
     172             : int AliHLTITSSAPTrackerComponent::ReadConfigurationString(  const char* arguments )
     173             : {
     174             :   // Set configuration parameters for the CA tracker component from the string
     175             : 
     176             :   int iResult = 0;
     177           0 :   TString allArgs = arguments;
     178           0 :   if (allArgs.IsNull()) return iResult;
     179             : 
     180           0 :   TString argument;
     181             :   int bMissingParam = 0;
     182             : 
     183           0 :   TObjArray* pTokens = allArgs.Tokenize( " " );
     184             : 
     185           0 :   int nArgs =  pTokens ? pTokens->GetEntries() : 0;
     186             : 
     187           0 :   for ( int i = 0; i < nArgs; i++ ) {
     188           0 :     argument = ( ( TObjString* )pTokens->At( i ) )->GetString();
     189           0 :     argument.ToLower();
     190           0 :     if ( argument.IsNull() ) continue;
     191             :     
     192           0 :     if (argument.CompareTo("-lowflux")==0) {
     193           0 :       fRecoParamType = AliRecoParam::kLowMult;
     194           0 :       HLTInfo("Low flux reconstruction selected");
     195             :       continue;
     196             :     }
     197           0 :     if (argument.CompareTo("-highflux")==0) {
     198           0 :       fRecoParamType = AliRecoParam::kHighMult;
     199           0 :       HLTInfo("High flux reconstruction selected");
     200             :       continue;
     201             :     }
     202           0 :     if (argument.CompareTo("-cosmics")==0 ||
     203           0 :              argument.CompareTo("-calib")==0) {
     204           0 :       HLTWarning("%s reconstruction selected: override to default",argument.Data());
     205             :       continue;
     206             :     }    
     207             :     //
     208           0 :     if (argument.CompareTo("-skipsdd")==0) {
     209           0 :       fSkipSDD = 1;
     210           0 :       HLTInfo("SDD will be ignored");
     211             :       continue;
     212             :     }    
     213             :     //
     214           0 :     if (argument.CompareTo("-maxmisslayers")==0) {
     215           0 :       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
     216           0 :       fMaxMissL = ((TObjString*)pTokens->At(i))->GetString().Atoi();
     217           0 :       HLTInfo("Allow max active layers missed: %d", fMaxMissL);
     218             :       continue;
     219             :     } 
     220             :     //
     221           0 :     if (argument.CompareTo("-maxmult")==0) {
     222           0 :       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
     223           0 :       fMaxTrackletsToRun = ((TObjString*)pTokens->At(i))->GetString().Atoi();
     224           0 :       HLTInfo("Skip tracking if N SPD tracklets > %d", fMaxTrackletsToRun);
     225             :       continue;
     226             :     } 
     227             :     //
     228           0 :     if (argument.CompareTo("-maxitervtx")==0) {
     229           0 :       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
     230           0 :       fMaxVtxIter = ((TObjString*)pTokens->At(i))->GetString().Atoi();
     231           0 :       if (fMaxVtxIter<1) {
     232           0 :         HLTError("Incorrect maxitervtx %d supplied, ITSSAPTracker default will be used", fMaxVtxIter);
     233           0 :         fMaxVtxIter = -1;
     234           0 :       }
     235           0 :       else HLTInfo("Allow max %d iterations for vertexer", fMaxVtxIter);
     236             :       continue;
     237             :     } 
     238             :     //
     239           0 :     if (argument.CompareTo("-stopscalevtx")==0) {
     240           0 :       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
     241           0 :       fStopScaleChange = ((TObjString*)pTokens->At(i))->GetString().Atof();
     242           0 :       if (fStopScaleChange<0.3) {
     243           0 :         HLTError("Incorrect stopscalevtx %.2f supplied, ITSSAPTracker default will be used", fStopScaleChange);
     244           0 :         fStopScaleChange = -1;
     245           0 :       }
     246           0 :       else HLTInfo("Stop vertexing on scale change below %.2f", fStopScaleChange);
     247             :       continue;
     248             :     } 
     249             :     //
     250           0 :     if (argument.CompareTo("-maxrspdv")==0) {
     251           0 :       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
     252           0 :       fMaxRSPDVtx = ((TObjString*)pTokens->At(i))->GetString().Atof();
     253           0 :       HLTInfo("Accept SPD vertices with R<",fMaxRSPDVtx);
     254             :       continue;
     255             :     }
     256             :     //
     257           0 :     HLTError( "Unknown option \"%s\"", argument.Data() );
     258             :     iResult = -EINVAL;
     259           0 :   }
     260           0 :   delete pTokens;
     261             : 
     262           0 :   if ( bMissingParam ) {
     263           0 :     HLTError( "Specifier missed for parameter \"%s\"", argument.Data() );
     264             :     iResult = -EINVAL;
     265           0 :   }
     266             :   
     267             :   return iResult;
     268           0 : }
     269             : 
     270             : 
     271             : int AliHLTITSSAPTrackerComponent::ReadCDBEntry( const char* cdbEntry, const char* chainId )
     272             : {
     273             :   // see header file for class documentation
     274             : 
     275             :   const char* defaultNotify = "";
     276             : 
     277           0 :   if ( !cdbEntry ) {
     278           0 :     return 0;// need to add the HLT/ConfigITS/ITSTracker directory to cdb SG!!!
     279             :     //cdbEntry = "HLT/ConfigITS/ITSTracker";
     280             :     //defaultNotify = " (default)";
     281             :     //chainId = 0;
     282             :   }
     283             : 
     284           0 :   HLTInfo( "configure from entry \"%s\"%s, chain id %s", cdbEntry, defaultNotify, ( chainId != NULL && chainId[0] != 0 ) ? chainId : "<none>" );
     285           0 :   AliCDBEntry *pEntry = AliCDBManager::Instance()->Get( cdbEntry );//,GetRunNo());
     286             : 
     287           0 :   if ( !pEntry ) {
     288           0 :     HLTError( "cannot fetch object \"%s\" from CDB", cdbEntry );
     289           0 :     return -EINVAL;
     290             :   }
     291             : 
     292           0 :   TObjString* pString = dynamic_cast<TObjString*>( pEntry->GetObject() );
     293             : 
     294           0 :   if ( !pString ) {
     295           0 :     HLTError( "configuration object \"%s\" has wrong type, required TObjString", cdbEntry );
     296           0 :     return -EINVAL;
     297             :   }
     298             : 
     299           0 :   HLTInfo( "received configuration object string: \"%s\"", pString->GetString().Data() );
     300             : 
     301           0 :   return  ReadConfigurationString( pString->GetString().Data() );
     302           0 : }
     303             : 
     304             : 
     305             : int AliHLTITSSAPTrackerComponent::Configure( const char* cdbEntry, const char* chainId, const char *commandLine )
     306             : {
     307             :   // Configure the component
     308             :   // There are few levels of configuration,
     309             :   // parameters which are set on one step can be overwritten on the next step
     310           0 :   HLTInfo("cdbEnty: %s chaindId: %s commandLine: %s",cdbEntry,chainId,commandLine);
     311             :   //* read hard-coded values
     312             : 
     313           0 :   SetDefaultConfiguration();
     314             : 
     315             :   //* read the default CDB entry
     316             : 
     317           0 :   int iResult1 = ReadCDBEntry( NULL, chainId );
     318             : 
     319             :   //* read the actual CDB entry if required
     320             : 
     321           0 :   int iResult2 = ( cdbEntry ) ? ReadCDBEntry( cdbEntry, chainId ) : 0;
     322             : 
     323             :   //* read extra parameters from input (if they are)
     324             : 
     325             :   int iResult3 = 0;
     326             : 
     327           0 :   if ( commandLine && commandLine[0] != '\0' ) {
     328             :     //    HLTInfo( "received configuration string from HLT framework: \"%s\"", commandLine );
     329           0 :     iResult3 = ReadConfigurationString( commandLine );
     330           0 :   }
     331             : 
     332             :   // Initialise the tracker here
     333             : 
     334           0 :   return iResult1 ? iResult1 : ( iResult2 ? iResult2 : iResult3 );
     335             : }
     336             : 
     337             : 
     338             : 
     339             : int AliHLTITSSAPTrackerComponent::DoInit( int argc, const char** argv )
     340             : {
     341             :   // Configure the ITS tracker component
     342             : 
     343           0 :   if ( fTracker ) return -EINPROGRESS;
     344             : 
     345           0 :   SetupCTPData();
     346             : 
     347           0 :   if(AliGeomManager::GetGeometry()==NULL){
     348           0 :     AliGeomManager::LoadGeometry();
     349           0 :   }
     350           0 :   AliGeomManager::ApplyAlignObjsFromCDB("ITS");
     351             : 
     352           0 :   TString arguments = "";
     353           0 :   for ( int i = 0; i < argc; i++ ) {
     354           0 :     if ( !arguments.IsNull() ) arguments += " ";
     355           0 :     arguments += argv[i];
     356             :   }
     357             : 
     358           0 :   int ret = Configure( NULL, NULL, arguments.Data() );
     359             : 
     360             :   // Check field
     361           0 :   if (!TGeoGlobalMagField::Instance()) {
     362           0 :     HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF");
     363           0 :     return -ENODEV;
     364             :   }
     365             : 
     366           0 :   fTracker = new AliITSSAPTracker();
     367           0 :   fTracker->SetBz(GetBz());
     368           0 :   fTracker->Init();  // init defaults
     369             :   //
     370             :   // check consistency of options (if provided)
     371           0 :   TObjArray* pArr = dynamic_cast<TObjArray*>(LoadAndExtractOCDBObject("ITS/Calib/RecoParam"));
     372             :   AliITSRecoParam* param = 0;   // fetch relevant recoparam
     373           0 :   if (pArr) {
     374           0 :     int np = pArr->GetEntriesFast();
     375           0 :     for (int ip=np;ip--;) {
     376           0 :       if (!(param=(AliITSRecoParam*)pArr->At(ip)) ||
     377           0 :           param->GetEventSpecie()!=fRecoParamType) {
     378             :         param = 0;
     379           0 :         continue;
     380             :       }
     381             :     }
     382           0 :   }
     383             :   //
     384           0 :   if (fSkipSDD<0) {
     385           0 :     if (param && (param->GetLayersToSkip(2)||param->GetLayersToSkip(3))) {
     386           0 :       fSkipSDD = 1;
     387           0 :       HLTInfo("Force to skip SDD layers (recoparam)");
     388             :     }
     389           0 :     else fSkipSDD = 0;
     390             :   }
     391             :   //
     392           0 :   if (fMaxTrackletsToRun<0) {
     393           0 :     if (param) fMaxTrackletsToRun = param->GetMaxSPDcontrForSAToUseAllClusters();
     394           0 :     else fMaxTrackletsToRun = 99999;
     395             :   }
     396           0 :   HLTInfo("Max N SPD tracklets to run tracking: %d",fMaxTrackletsToRun);
     397             :   //
     398           0 :   if (fMaxMissL<0 && param) {
     399           0 :     fMaxMissL = 6 - param->GetMinNPointsSA();
     400           0 :   }
     401           0 :   if (fMaxMissL>3) fMaxMissL = 3;
     402           0 :   HLTInfo("Allow to skip at most %d layers",fMaxMissL);
     403             :   //
     404           0 :   if (fMaxRSPDVtx<0) fMaxRSPDVtx = 1.5;
     405           0 :   else HLTInfo("Accept SPD vertices with R<",fMaxRSPDVtx);
     406           0 :   fTracker->SetMaxRSPDVtx(fMaxRSPDVtx);
     407             : 
     408           0 :   fBenchmark.Reset();
     409           0 :   fBenchmark.SetTimer(0,"total");
     410           0 :   fBenchmark.SetTimer(1,"reco");
     411             :   return ret;
     412           0 : }
     413             : 
     414             : 
     415             : int AliHLTITSSAPTrackerComponent::DoDeinit()
     416             : {
     417             :   // see header file for class documentation
     418           0 :   delete fTracker;
     419           0 :   fTracker = 0;
     420           0 :   return 0;
     421             : }
     422             : 
     423             : 
     424             : 
     425             : int AliHLTITSSAPTrackerComponent::Reconfigure( const char* cdbEntry, const char* chainId )
     426             : {
     427             :   // Reconfigure the component from OCDB .
     428             : 
     429           0 :   return Configure( cdbEntry, chainId, NULL );
     430             : }
     431             : 
     432             : 
     433             : 
     434             : int AliHLTITSSAPTrackerComponent::DoEvent
     435             : (
     436             :   const AliHLTComponentEventData& evtData,
     437             :   const AliHLTComponentBlockData* blocks,
     438             :   AliHLTComponentTriggerData& trigData,
     439             :   AliHLTUInt8_t* outputPtr,
     440             :   AliHLTUInt32_t& size,
     441             :   vector<AliHLTComponentBlockData>& outputBlocks )
     442             : {
     443             :   //* process event
     444           0 :   AliHLTUInt32_t maxBufferSize = size;
     445           0 :   size = 0; // output size
     446             :   
     447           0 :   if (!IsDataEvent()) return 0;
     448             : 
     449           0 :   if ( evtData.fBlockCnt <= 0 ) {
     450           0 :     HLTWarning( "no blocks in event" );
     451           0 :     return 0;
     452             :   }
     453             : 
     454             :   // we don't use SDD if not in trigger or explicitly forbidden
     455           0 :   const AliHLTCTPData* ctpdata=CTPData();
     456           0 :   AliHLTReadoutList rd=ctpdata->ReadoutList(trigData);
     457           0 :   Bool_t skipSDD = fSkipSDD || !rd.DetectorEnabled(AliHLTReadoutList::kITSSDD);
     458           0 :   fTracker->SetSkipLayer(AliITSSAPTracker::kALrSDD1,skipSDD);
     459           0 :   fTracker->SetSkipLayer(AliITSSAPTracker::kALrSDD2,skipSDD);
     460             : 
     461           0 :   int maxMiss = fMaxMissL;
     462           0 :   if (skipSDD && maxMiss>1) maxMiss = 1; // there should be at least 1 hits above SPD
     463           0 :   fTracker->SetMaxMissedLayers(maxMiss);
     464             : 
     465           0 :   if (fMaxVtxIter>0)      fTracker->SetMaxVtxIter(fMaxVtxIter);
     466           0 :   if (fStopScaleChange>0) fTracker->SetStopScaleChange(fStopScaleChange);
     467             : 
     468           0 :   fBenchmark.StartNewEvent();
     469           0 :   fBenchmark.Start(0);
     470             : 
     471             :   // Event reconstruction in ITS
     472             : 
     473             :   int iResult=0;
     474             : 
     475             : 
     476             :   // Check if there is an SPD vertex
     477             :   const AliESDVertex *vertexSPD = 0;
     478             : 
     479             :   {
     480           0 :     const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITSSPD);
     481           0 :     if( iter != NULL  ) {
     482           0 :       if( !( vertexSPD = dynamic_cast<AliESDVertex*>(const_cast<TObject*>( iter ) ) ) ){    
     483           0 :         HLTError("ITS SPD vertex object is corrupted");
     484             :         iResult = -EINVAL;    
     485           0 :       }
     486             :     }
     487             :     else {
     488           0 :       HLTInfo("No SPD vertex, skip ITS standalone reconstruction");
     489           0 :       return 0;
     490             :     }
     491           0 :   }  
     492             :   
     493           0 :   if (vertexSPD->GetNContributors()>fMaxTrackletsToRun) {
     494           0 :     HLTInfo("Skip tracking: HLT SPD vertex has %d>%d tracklets",
     495             :             vertexSPD->GetNContributors(),fMaxTrackletsToRun );
     496           0 :     return 0;
     497             :   }
     498           0 :   fTracker->SetMaxTrackletsToRunTracking(fMaxTrackletsToRun);
     499             : 
     500           0 :   int nBlocks = evtData.fBlockCnt;
     501           0 :   if (!fClusters) fClusters = new TClonesArray("AliITSRecPoint",1000);
     502             :   //
     503             :   int nClTotal = 0;
     504           0 :   for (int ndx=0; ndx<nBlocks && iResult>=0; ndx++) {
     505             : 
     506           0 :     const AliHLTComponentBlockData* iter = blocks+ndx;
     507             :     
     508             :     // Read ITS clusters
     509             : 
     510           0 :     if ( (iter->fDataType == (kAliHLTDataTypeClusters|kAliHLTDataOriginITSSSD) ) || 
     511           0 :          (iter->fDataType == (kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD) ) ||
     512           0 :          (iter->fDataType == (kAliHLTDataTypeClusters|kAliHLTDataOriginITSSDD) ) ||
     513           0 :          (iter->fDataType == (kAliHLTDataTypeClusters|kAliHLTDataOriginITS) ) 
     514             :          ){
     515             :       
     516           0 :       fBenchmark.AddInput(iter->fSize);
     517             : 
     518           0 :       AliHLTITSClusterData *inPtr=reinterpret_cast<AliHLTITSClusterData*>( iter->fPtr );
     519           0 :       int nClusters = inPtr->fSpacePointCnt;
     520           0 :       for( int icl=0; icl<nClusters; icl++ ){
     521           0 :         AliHLTITSSpacePointData &d = inPtr->fSpacePoints[icl];
     522             : 
     523           0 :         Int_t lab[4] = { d.fTracks[0], d.fTracks[1], d.fTracks[2], d.fIndex };
     524           0 :         Int_t info[3] = { d.fNy, d.fNz, d.fLayer };
     525           0 :         Float_t hit[6] = { d.fY, d.fZ, d.fSigmaY2, d.fSigmaZ2, d.fQ, d.fSigmaYZ };
     526           0 :         if( d.fLayer==4 ) hit[5] = -hit[5];
     527             :         // tracker does not out the clusters, add them to transient array
     528           0 :         fTracker->AddCluster( new((*fClusters)[nClTotal++]) AliITSRecPoint(lab,hit,info) );
     529           0 :       }   
     530           0 :     }
     531             :     
     532             :   }// end read input blocks
     533             :   
     534             :   // Reconstruct the event
     535             :   
     536           0 :   fBenchmark.Start(1);
     537           0 :   fTracker->SetSPDVertex(vertexSPD);
     538           0 :   fTracker->ProcessEvent();
     539           0 :   fBenchmark.Stop(1);
     540             : 
     541             :   
     542             :   // Fill output tracks
     543             :   int nAddedTracks = 0;
     544             :   {  
     545           0 :     int nFoundTracks = fTracker->GetNTracks();
     546           0 :     AliHLTUInt32_t blockSize = sizeof(AliHLTITSSAPTrackerDataContainer) + nFoundTracks*sizeof(AliHLTITSSAPTrackerData);
     547           0 :     if( size + blockSize + AliFlatESDVertex::GetSize() > maxBufferSize ){            
     548           0 :       HLTWarning( "Output buffer size exceed (buffer size %d, current size %d), %d tracks are not stored", 
     549             :                   maxBufferSize, size + blockSize, nFoundTracks);
     550             :       iResult = -ENOSPC;
     551           0 :     }    
     552           0 :     if( iResult>=0 ){
     553             :       blockSize = sizeof(AliHLTITSSAPTrackerDataContainer);
     554           0 :       AliHLTITSSAPTrackerDataContainer *data = reinterpret_cast<AliHLTITSSAPTrackerDataContainer*>(outputPtr);
     555           0 :       data->fCount=0;
     556           0 :       data->fNSPDtracklets = fTracker->GetNTracklets();
     557           0 :       for (int i=AliITSSAPTracker::kNLrActive;i--;) data->fNclusters[i] = fTracker->GetLayer(i)->GetNClusters();
     558           0 :       for (int itr=0;itr<nFoundTracks;itr++) {
     559           0 :         const AliITSSAPTracker::ITStrack_t& track = fTracker->GetTrack(itr);
     560             :         // the track is just a struct of 2 AliExternalTrackParams (params at vertex and at the outer ITS layer)
     561             :         // + some extra info, see "struct ITStrack" in the AliITSSAPTracker.h
     562           0 :         if ( track.paramOut.TestBit(AliITSSAPTracker::kInvalidBit) || 
     563           0 :              track.paramInw.TestBit(AliITSSAPTracker::kInvalidBit)) continue;
     564             :         // use only those tracks whose both inward and outward params are OK.
     565           0 :         AliHLTITSSAPTrackerData &trcHLT = data->fTracks[data->fCount];
     566           0 :         trcHLT.paramOut.SetExternalTrackParam(&track.paramOut);
     567           0 :         trcHLT.paramInw.SetExternalTrackParam(&track.paramInw);
     568           0 :         trcHLT.chi2 = track.chi2;
     569           0 :         trcHLT.ncl  = track.ncl;
     570           0 :         trcHLT.label = track.label;
     571           0 :         data->fCount++;
     572           0 :         blockSize += sizeof(AliHLTITSSAPTrackerData);
     573           0 :         nAddedTracks++;
     574           0 :       }
     575             :       
     576           0 :       AliHLTComponentBlockData resultData;
     577           0 :       FillBlockData( resultData );
     578           0 :       resultData.fOffset = size;
     579           0 :       resultData.fSize = blockSize;      
     580           0 :       resultData.fDataType = kAliHLTDataTypeITSSAPData|kAliHLTDataOriginITS;
     581           0 :       fBenchmark.AddOutput(resultData.fSize);
     582           0 :       outputBlocks.push_back( resultData );
     583           0 :       size += resultData.fSize;
     584           0 :     }
     585             :   }
     586             : 
     587             :   Bool_t vtxOK = kFALSE;
     588             :   { // Fill output vertexTracks  
     589           0 :     AliESDVertex& vtxTracks = fTracker->GetTrackVertex();
     590           0 :     if ( iResult>=0 && vtxTracks.GetStatus()==1 ) {
     591           0 :       AliFlatESDVertex *flatVtx = reinterpret_cast<AliFlatESDVertex*>( outputPtr + size );
     592           0 :       flatVtx->SetFromESDVertex( vtxTracks );
     593           0 :       AliHLTComponentBlockData resultData;
     594           0 :       FillBlockData( resultData );
     595           0 :       resultData.fOffset = size;
     596           0 :       resultData.fSize = flatVtx->GetSize();      
     597           0 :       resultData.fDataType = kAliHLTDataTypeFlatESDVertex|kAliHLTDataOriginITS;
     598           0 :       fBenchmark.AddOutput(resultData.fSize);
     599           0 :       outputBlocks.push_back( resultData );
     600           0 :       size += resultData.fSize;
     601             :       vtxOK = kTRUE;
     602           0 :     }
     603             :   }
     604             :   //
     605           0 :   fTracker->Clear();
     606           0 :   fClusters->Clear();
     607             :   //  
     608           0 :   fBenchmark.Stop(0);
     609             : 
     610             :   // Set log level to "Warning" for on-line system monitoring
     611           0 :   HLTInfo( "ITS SAP Tracker: output %d tracks;  input %d clusters, VertexTracks: %s",
     612             :            nAddedTracks, nClTotal, vtxOK ? "OK" : "Not Found" );
     613             : 
     614           0 :   HLTInfo(fBenchmark.GetStatistics());
     615             :   return iResult;
     616           0 : }

Generated by: LCOV version 1.11