LCOV - code coverage report
Current view: top level - HLT/TPCLib - AliHLTTPCAgent.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 45 269 16.7 %
Date: 2016-06-14 17:26:59 Functions: 7 23 30.4 %

          Line data    Source code
       1             : // $Id$
       2             : 
       3             : //**************************************************************************
       4             : //* This file is property of and copyright by the                          * 
       5             : //* ALICE Experiment at CERN, All rights reserved.                         *
       6             : //*                                                                        *
       7             : //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
       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             : //  @file   AliHLTTPCAgent.cxx
      19             : //  @author Matthias Richter
      20             : //  @date   
      21             : //  @brief  Agent of the libAliHLTTPC library
      22             : //  @note   
      23             : 
      24             : #include "AliHLTTPCAgent.h"
      25             : #include "AliHLTTPCDefinitions.h"
      26             : #include "AliHLTOUT.h"
      27             : #include "AliHLTOUTHandlerChain.h"
      28             : #include "AliHLTMisc.h"
      29             : #include "AliRunLoader.h"
      30             : #include "AliCDBManager.h"
      31             : #include "AliCDBEntry.h"
      32             : #include "AliTPCParam.h"
      33             : #include "AliTPCRecoParam.h"
      34             : #include "AliDAQ.h"
      35             : #include "TObject.h"
      36             : #include "AliHLTPluginBase.h"
      37             : #include "AliHLTSystem.h"
      38             : 
      39             : /** global instance for agent registration */
      40           6 : AliHLTTPCAgent gAliHLTTPCAgent;
      41             : 
      42             : // component headers
      43             : #include "AliHLTTPCCAInputDataCompressorComponent.h"
      44             : #include "AliHLTTPCCATrackerComponent.h"
      45             : #include "AliHLTTPCCATrackerOutputConverter.h"
      46             : #include "AliHLTTPCTrackMCMarkerComponent.h"
      47             : #include "AliHLTTPCCAGlobalMergerComponent.h"
      48             : #include "AliHLTTPCdEdxComponent.h"
      49             : #include "AliHLTTPCdEdxMonitoringComponent.h"
      50             : #include "AliHLTTPCClusterFinderComponent.h"
      51             : #include "AliHLTTPCDigitPublisherComponent.h"
      52             : #include "AliHLTTPCDigitDumpComponent.h"
      53             : #include "AliHLTTPCClusterDumpComponent.h"
      54             : #include "AliHLTTPCClusterHistoComponent.h"
      55             : #include "AliHLTTPCHistogramHandlerComponent.h"
      56             : #include "AliHLTTPCTrackHistoComponent.h"
      57             : #include "AliHLTTPCHWCFDataReverterComponent.h"
      58             : #include "AliHLTTPCCFComparisonComponent.h"
      59             : #include "AliHLTTPCDataCheckerComponent.h"
      60             : #include "AliHLTTPCHWCFEmulatorComponent.h"
      61             : #include "AliHLTTPCHWCFConsistencyControlComponent.h"
      62             : #include "AliHLTTPCClusterStatComponent.h"
      63             : #include "AliHLTTPCDataCompressionComponent.h"
      64             : #include "AliHLTTPCDataCompressionMonitorComponent.h"
      65             : #include "AliHLTTPCDataCompressionUnpackerComponent.h"
      66             : #include "AliHLTTPCDataCompressionFilterComponent.h"
      67             : #include "AliHLTTPCDataPublisherComponent.h"
      68             : #include "AliHLTTPCHWClusterDecoderComponent.h"
      69             : #include "AliHLTTPCClusterTransformationComponent.h"
      70             : #include "AliHLTTPCClusterTransformationPrepareComponent.h"
      71             : #include "AliHLTTPCOfflinePreprocessorWrapperComponent.h"
      72             : 
      73             : /** ROOT macro for the implementation of ROOT specific class methods */
      74           6 : ClassImp(AliHLTTPCAgent)
      75             : 
      76             : AliHLTTPCAgent::AliHLTTPCAgent()
      77           3 :   : AliHLTModuleAgent("TPC")
      78           3 :   , fRawDataHandler(NULL)
      79           3 :   , fTracksegsDataHandler(NULL)
      80           3 :   , fClustersDataHandler(NULL)
      81           3 :   , fCompressionMonitorHandler(NULL)
      82          15 : {
      83             :   // see header file for class documentation
      84             :   // or
      85             :   // refer to README to build package
      86             :   // or
      87             :   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
      88           6 : }
      89             : 
      90           0 : AliHLTTPCAgent::~AliHLTTPCAgent()
      91           6 : {
      92             :   // see header file for class documentation
      93           9 : }
      94             : 
      95             : UInt_t AliHLTTPCAgent::GetDetectorMask() const
      96             : {
      97           0 :   return AliDAQ::kTPC;
      98             : }
      99             : 
     100             : int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
     101             :                                          AliRawReader* rawReader,
     102             :                                          AliRunLoader* runloader) const
     103             : {
     104             :   // see header file for class documentation
     105           0 :   if (handler) {
     106             :     // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
     107             :     // AliReconstruction: indicated by runloader==NULL, run always on raw data
     108           0 :     bool bPublishRaw=rawReader!=NULL || runloader==NULL;
     109             : 
     110           0 :     AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();
     111             : 
     112             :     bool isRawHLTOUT = 1;
     113             :     int tpcInputMode = 0;
     114           0 :     if( pHLT ){
     115           0 :       TString hltoptions = pHLT->GetConfigurationString();
     116           0 :       TObjArray* pTokens=hltoptions.Tokenize(" ");
     117           0 :       if( pTokens ){
     118           0 :         int iEntries=pTokens->GetEntriesFast();
     119           0 :         for (int i=0; i<iEntries; i++) {
     120           0 :           if (!pTokens->At(i)) continue;
     121           0 :           TString token = pTokens->At(i)->GetName();
     122           0 :           if (token.CompareTo("ignore-hltout")==0) {
     123             :             isRawHLTOUT = 0;
     124           0 :           } else if (token.CompareTo("run-online-config")==0) {
     125             :             isRawHLTOUT = 0;
     126           0 :           } else if (token.Contains("TPC-input=")) {
     127           0 :             TString param=token.ReplaceAll("TPC-input=", "");
     128           0 :             if (param == "default") {
     129             :               tpcInputMode = 0;
     130           0 :             } else if (param == "raw") {
     131             :               tpcInputMode = 1;
     132           0 :             } else if (param == "compressed") {
     133             :               tpcInputMode = 2;
     134           0 :             } else {
     135           0 :               HLTWarning("wrong parameter \'%s\' for option \'TPC-input=\', expected \'default\'/\'raw\'/\'compressed\'",param.Data() );
     136             :             }
     137           0 :           }
     138           0 :         }
     139           0 :         delete pTokens;
     140           0 :       }
     141           0 :     }
     142             : 
     143             :     // This the tracking configuration for the full TPC
     144             :     // - 216 clusterfinders (1 per partition)
     145             :     // - 36 slice trackers
     146             :     // - one global merger
     147             :     // - the esd converter
     148             :     // The ESD is shipped embedded into a TTree
     149             :     int iMinSlice=0; 
     150             :     int iMaxSlice=35;
     151             :     int iMinPart=0;
     152             :     int iMaxPart=5;
     153           0 :     TString arg;
     154           0 :     TString mergerInput;
     155           0 :     TString sinkRawData;
     156           0 :     TString sinkHWClusterInput;
     157           0 :     TString dEdXInput;
     158           0 :     TString hwcfemuInput;
     159           0 :     TString hwclustOutput;
     160           0 :     TString compressorInput;
     161           0 :     TString trackerInput;
     162             : 
     163             :     // Default TPC input: raw data or compressed clusters 
     164             : 
     165           0 :     if( isRawHLTOUT ){
     166             :       // Compressed clusters are already copied from the raw file to the HLTOUT.
     167             :       // The system should only reconstruct raw data for the sectors where the compressed clusters are missing
     168           0 :       arg.Form("-publish-clusters off -publish-raw filtered");
     169             :     } else {
     170             :       // HLTOUT is initially empty, therefore the HLT system reconstructs everything
     171             :       // The prefered input data is compressed clusters. TPC raw data is only published when the clusters are not present.
     172           0 :       arg.Form("-publish-clusters all -publish-raw filtered");
     173             :     }
     174             : 
     175             :     // Overwrite the default input when "TPC-input=.." option is set by user
     176             : 
     177           0 :     if( tpcInputMode==1 ){
     178           0 :       arg.Form("-publish-clusters off -publish-raw all");
     179           0 :     } else if ( tpcInputMode==2 ){
     180           0 :       arg.Form("-publish-clusters all -publish-raw off");
     181             :     }
     182             : 
     183           0 :     handler->CreateConfiguration("TPC-DP", "TPCDataPublisher", NULL , arg.Data());
     184             : 
     185           0 :     if (bPublishRaw) {
     186           0 :       hwcfemuInput = "TPC-DP";
     187             :     }
     188             : 
     189           0 :     for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
     190           0 :       for (int part=iMinPart; part<=iMaxPart; part++) {
     191           0 :         TString publisher;
     192             :         // digit publisher components
     193           0 :         publisher.Form("TPC-DP_%02d_%d", slice, part);
     194           0 :         if (bPublishRaw) {
     195             :           // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
     196             :           // AliReconstruction: indicated by runloader==NULL, run always on raw data
     197             :           int ddlno=768;
     198           0 :           if (part>1) ddlno+=72+4*slice+(part-2);
     199           0 :           else ddlno+=2*slice+part;
     200             : 
     201             :           // arg.Form("-datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x", slice, slice, part, part);
     202           0 :           arg.Form("-dataspec 0x%02x%02x%02x%02x", slice, slice, part, part); // publish also unpacked clusters, not only raw data
     203             : 
     204           0 :           handler->CreateConfiguration(publisher.Data(), "BlockFilter", "TPC-DP" , arg.Data());
     205           0 :           if (sinkRawData.Length()>0) sinkRawData+=" ";
     206           0 :           sinkRawData+=publisher;
     207           0 :         } else {
     208           0 :           arg.Form("-slice %d -partition %d", slice, part);
     209           0 :           handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
     210           0 :           if (hwcfemuInput.Length()>0) hwcfemuInput+=" ";
     211           0 :           hwcfemuInput+=publisher;
     212             :         }
     213           0 :       }
     214             :     }
     215             : 
     216             :     // Hardware CF emulator
     217           0 :     TString hwcfemu;
     218           0 :     hwcfemu.Form("TPC-HWCFEmu");
     219           0 :     arg="";
     220           0 :     if (!bPublishRaw) arg+=" -do-mc 1";
     221           0 :     handler->CreateConfiguration(hwcfemu.Data(), "TPCHWClusterFinderEmulator", hwcfemuInput.Data(), arg.Data());
     222           0 :     if (hwclustOutput.Length()>0) hwclustOutput+=" ";
     223           0 :     hwclustOutput+=hwcfemu;
     224             :  
     225           0 :     TString hwcfDecoder = "TPC-HWCFDecoder";
     226           0 :     handler->CreateConfiguration(hwcfDecoder.Data(), "TPCHWClusterDecoder",hwclustOutput.Data(), "");
     227             : 
     228           0 :     TString clusterTransformation = "TPC-ClusterTransformation";
     229           0 :     handler->CreateConfiguration(clusterTransformation.Data(), "TPCClusterTransformation",hwcfDecoder.Data(), "-offline-mode");
     230             : 
     231           0 :     if (trackerInput.Length()>0) trackerInput+=" ";
     232           0 :     trackerInput+=clusterTransformation;
     233           0 :     if (dEdXInput.Length()>0) dEdXInput+=" ";
     234           0 :     dEdXInput+=clusterTransformation;
     235           0 :     if (sinkHWClusterInput.Length()>0) sinkHWClusterInput+=" ";
     236           0 :     sinkHWClusterInput+=clusterTransformation;
     237             : 
     238             :     // tracker finder component
     239             :     // 2012-01-05 changing the configuration according to online setup
     240             :     // the tracking strategy has been changed in the online system in Sep 2011
     241             :     // the tracker now processes all clusters, and several of this 'global' trackers
     242             :     // run in parallel. The GlobalMerger is still in the chain as it produces the final
     243             :     // fit.
     244           0 :     TString tracker;
     245           0 :     tracker.Form("TPC-TR");
     246           0 :     handler->CreateConfiguration(tracker.Data(), "TPCCATracker", trackerInput.Data(), "-GlobalTracking");
     247             : 
     248           0 :     if (mergerInput.Length()>0) mergerInput+=" ";
     249           0 :     mergerInput+=tracker;
     250             : 
     251             :     // GlobalMerger component
     252           0 :     handler->CreateConfiguration("TPC-globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
     253             : 
     254             :     // dEdx component
     255           0 :     if (dEdXInput.Length()>0) dEdXInput+=" ";
     256           0 :     dEdXInput+="TPC-globalmerger";
     257             : 
     258           0 :     handler->CreateConfiguration("TPC-dEdx","TPCdEdx",dEdXInput.Data(),"");
     259             : 
     260             :     // compression component
     261           0 :     if (compressorInput.Length()>0) compressorInput+=" ";
     262             :     //compressorInput+=hwclustOutput;
     263           0 :     compressorInput+=hwcfDecoder;
     264             : 
     265             :     // special configuration to run the emulation automatically if the compressed clusters
     266             :     // of a particular partition is missing. This configuration is announced for reconstruction
     267             :     // of raw data if the HLT mode of the TPC reconstruction is enabled. Compression component
     268             :     // always needs to run in mode 1. Even if the recorded data is mode 3 (optimized partition
     269             :     // clusters), 2 (track model compression), or 4. The emulation can not be in mode 2 or 4,
     270             :     // since the track model block can not be identified with a partition. Have to duplicate the
     271             :     // configuration of the compression component
     272           0 :     handler->CreateConfiguration("TPC-compression-emulation", "TPCDataCompressor", compressorInput.Data(), "-mode 1");
     273             : 
     274           0 :     if (compressorInput.Length()>0) compressorInput+=" ";
     275           0 :     compressorInput+="TPC-globalmerger";
     276           0 :     handler->CreateConfiguration("TPC-compression", "TPCDataCompressor", compressorInput.Data(), "");
     277           0 :     handler->CreateConfiguration("TPC-compression-huffman-trainer", "TPCDataCompressor", compressorInput.Data(),"-deflater-mode 3");
     278           0 :     handler->CreateConfiguration("TPC-compression-monitoring-component", "TPCDataCompressorMonitor", "TPC-compression TPC-hwcfdata","-pushback-period=30");
     279           0 :     handler->CreateConfiguration("TPC-compression-monitoring", "ROOTFileWriter", "TPC-compression-monitoring-component","-concatenate-events -overwrite -datafile HLT.TPCDataCompression-statistics.root");
     280             : 
     281             :     // the esd converter configuration
     282           0 :     TString converterInput="TPC-globalmerger";
     283           0 :     if (!bPublishRaw) {
     284             :       // propagate cluster info to the esd converter in order to fill the MC information
     285           0 :       handler->CreateConfiguration("TPC-clustermc-info", "BlockFilter"   , sinkHWClusterInput.Data(), "-datatype 'CLMCINFO' 'TPC '");  
     286           0 :       handler->CreateConfiguration("TPC-mcTrackMarker","TPCTrackMCMarker","TPC-globalmerger TPC-clustermc-info","" );
     287           0 :       converterInput+=" ";
     288           0 :       converterInput+="TPC-mcTrackMarker";
     289             :     }
     290           0 :     handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter"   , converterInput.Data(), "");
     291             : 
     292             :     // cluster dump collection
     293           0 :     handler->CreateConfiguration("TPC-clusters", "BlockFilter"   , sinkHWClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
     294           0 :     handler->CreateConfiguration("TPC-raw-clusters", "BlockFilter"   , sinkHWClusterInput.Data(), "-datatype 'CLUSTRAW' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
     295           0 :     handler->CreateConfiguration("TPC-hwclusters", "BlockFilter"   , sinkHWClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
     296           0 :     handler->CreateConfiguration("TPC-raw-hwclusters", "BlockFilter"   , sinkHWClusterInput.Data(), "-datatype 'CLUSTRAW' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
     297             : 
     298             :     // raw data
     299           0 :     handler->CreateConfiguration("TPC-raw-data", "BlockFilter"   , sinkRawData.Data(), "");
     300             : 
     301           0 :     handler->CreateConfiguration("TPC-hwcfdata", "BlockFilter"   , hwclustOutput.Data(), "-datatype 'HWCLUST1' 'TPC '");
     302             : 
     303             :     /////////////////////////////////////////////////////////////////////////////////////
     304             :     //
     305             :     // dumps on the ALTRO digit level
     306             :     //
     307             :     // selected channel dump
     308           0 :     arg.Form("-datafile selected-channel.dump -specfmt=_0x%%08x -subdir -blcknofmt= -idfmt=");
     309           0 :     handler->CreateConfiguration("TPC-selected-altro-digits", "TPCDigitDump", "RCU-channelselect", arg.Data());
     310             : 
     311             :     // raw channel dump
     312           0 :     arg.Form("-datafile channel.dump -specfmt=_0x%%08x -subdir -blcknofmt= -idfmt=");
     313           0 :     handler->CreateConfiguration("TPC-raw-altro-digits", "TPCDigitDump", "TPC-raw-data", arg.Data());
     314             : 
     315             :     /////////////////////////////////////////////////////////////////////////////////////
     316             :     //
     317             :     // a kChain HLTOUT configuration for processing of {'TRAKSEGS':'TPC '} data blocks
     318             :     // collects the data blocks, merges the tracks and produces an ESD object
     319             : 
     320             :     // publisher component
     321           0 :     handler->CreateConfiguration("TPC-hltout-tracksegs-publisher", "AliHLTOUTPublisher"   , NULL, "");
     322             : 
     323             :     // GlobalMerger component
     324           0 :     handler->CreateConfiguration("TPC-hltout-tracksegs-merger", "TPCGlobalMerger", "TPC-hltout-tracksegs-publisher", "");
     325             : 
     326             :     // the esd converter configuration
     327           0 :     handler->CreateConfiguration("TPC-hltout-tracksegs-esd-converter", "TPCEsdConverter", "TPC-hltout-tracksegs-merger", "");
     328             : 
     329             :     /////////////////////////////////////////////////////////////////////////////////////
     330             :     //
     331             :     // a kChain HLTOUT configuration for processing of {'TRACKS  ':'TPC '} data blocks
     332             :     // produces an ESD object from the track structure
     333             : 
     334             :     // publisher component
     335           0 :     handler->CreateConfiguration("TPC-hltout-tracks-publisher", "AliHLTOUTPublisher"   , NULL, "");
     336             : 
     337             :     // the esd converter configuration
     338           0 :     handler->CreateConfiguration("TPC-hltout-tracks-esd-converter", "TPCEsdConverter", "TPC-hltout-tracks-publisher", "");
     339             : 
     340             :     /////////////////////////////////////////////////////////////////////////////////////
     341             :     //
     342             :     // a kChain HLTOUT configuration for processing of {'CLUSTERS':'TPC '} data blocks
     343             :     // stores the blocks in file HLT.TPC.Clusters.root in HOMER format
     344             : 
     345             :     // publisher component
     346           0 :     handler->CreateConfiguration("TPC-hltout-cluster-publisher", "AliHLTOUTPublisher"   , NULL, "");
     347             : 
     348             :     // the HLTOUT component collects the blocks and stores the file
     349           0 :     handler->CreateConfiguration("TPC-hltout-cluster-dump", "HLTOUT", "TPC-hltout-cluster-publisher", "-digitfile HLT.TPC.Clusters.root -rawout=off -links 2");
     350             : 
     351             :     /////////////////////////////////////////////////////////////////////////////////////
     352             :     //
     353             :     // monitoring of compressed TPC data {CLUSTRAW:TPC }, {REMCLSCM,TPC }, {CLSTRKCM,TPC }
     354             :     // 
     355             : 
     356             :     // publisher component
     357           0 :     handler->CreateConfiguration("TPC-hltout-compressionmonitor-publisher", "AliHLTOUTPublisher"   , NULL,
     358             :                                  "-datatype HWCLUST1 'TPC ' "
     359             :                                  "-datatype CLUSTRAW 'TPC ' "
     360             :                                  "-datatype REMCLSCM 'TPC ' "
     361             :                                  "-datatype CLSTRKCM 'TPC ' "
     362             :                                  "-datatype REMCLIDS 'TPC ' "
     363             :                                  "-datatype CLIDSTRK 'TPC ' "
     364             :                                  );
     365             : 
     366             :     // the HLTOUT component collects the blocks and stores the file
     367           0 :     handler->CreateConfiguration("TPC-hltout-compressionmonitor", "TPCDataCompressorMonitor", "TPC-hltout-compressionmonitor-publisher", "-histogram-file HLT.TPC-compression-statistics.root -publishing-mode off");
     368           0 :   }
     369             : 
     370           0 :   return 0;
     371           0 : }
     372             : 
     373             : const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
     374             :                                                     AliRunLoader* runloader) const
     375             : {
     376             :   // see header file for class documentation
     377           0 :   if (runloader) {
     378             :     // reconstruction chains for AliRoot simulation
     379           0 :     return "TPC-compression";
     380             :   } else {
     381           0 :     return "TPC-compression-emulation";
     382             :   }
     383             :   return NULL;
     384           0 : }
     385             : 
     386             : const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
     387             : {
     388             :   // see header file for class documentation
     389             : 
     390             :   // actually, the TPC library has dependencies to Util and RCU
     391             :   // so the two has to be loaded anyhow before we get here
     392             :   //return "libAliHLTUtil.so libAliHLTRCU.so";
     393           0 :   return "libAliHLTUtil.so";
     394             : }
     395             : 
     396             : int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
     397             : {
     398             :   // see header file for class documentation
     399           6 :   if (!pHandler) return -EINVAL;
     400             : 
     401           6 :   pHandler->AddComponent(new AliHLTTPCCAInputDataCompressorComponent);
     402           6 :   pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
     403           6 :   pHandler->AddComponent(new AliHLTTPCCATrackerOutputConverter);
     404           6 :   pHandler->AddComponent(new AliHLTTPCCAGlobalMergerComponent);
     405           6 :   pHandler->AddComponent(new AliHLTTPCTrackMCMarkerComponent);
     406           6 :   pHandler->AddComponent(new AliHLTTPCdEdxComponent);
     407           6 :   pHandler->AddComponent(new AliHLTTPCdEdxMonitoringComponent);
     408           6 :   pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
     409           6 :   pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
     410           6 :   pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
     411           6 :   pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinder32Bit));
     412           6 :   pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
     413           6 :   pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
     414           6 :   pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
     415           6 :   pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
     416           6 :   pHandler->AddComponent(new AliHLTTPCHistogramHandlerComponent);
     417           6 :   pHandler->AddComponent(new AliHLTTPCTrackHistoComponent);
     418           6 :   pHandler->AddComponent(new AliHLTTPCHWCFDataReverterComponent);
     419           6 :   pHandler->AddComponent(new AliHLTTPCCFComparisonComponent);
     420           6 :   pHandler->AddComponent(new AliHLTTPCDataCheckerComponent);
     421           6 :   pHandler->AddComponent(new AliHLTTPCHWCFEmulatorComponent);
     422             : //  pHandler->AddComponent(new AliHLTTPCHWCFConsistencyControlComponent);  //FIXME: Causes crash: https://savannah.cern.ch/bugs/?83677
     423           6 :   pHandler->AddComponent(new AliHLTTPCClusterStatComponent);
     424           6 :   pHandler->AddComponent(new AliHLTTPCDataCompressionComponent);
     425           6 :   pHandler->AddComponent(new AliHLTTPCDataCompressionMonitorComponent);
     426           6 :   pHandler->AddComponent(new AliHLTTPCDataCompressionUnpackerComponent);
     427           6 :   pHandler->AddComponent(new AliHLTTPCDataCompressionFilterComponent);
     428           6 :   pHandler->AddComponent(new AliHLTTPCDataPublisherComponent);
     429           6 :   pHandler->AddComponent(new AliHLTTPCHWClusterDecoderComponent);
     430           6 :   pHandler->AddComponent(new AliHLTTPCClusterTransformationComponent);
     431           6 :   pHandler->AddComponent(new AliHLTTPCClusterTransformationPrepareComponent);
     432           6 :   pHandler->AddComponent(new AliHLTTPCOfflinePreprocessorWrapperComponent);
     433           3 :   return 0;
     434           3 : }
     435             : 
     436             : int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
     437             :                                           AliHLTUInt32_t spec,
     438             :                                           AliHLTOUTHandlerDesc& desc) const
     439             : {
     440             :   // see header file for class documentation
     441             : 
     442             :   // raw data blocks to be fed into offline reconstruction
     443           0 :   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
     444           0 :     int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
     445           0 :     int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
     446           0 :     if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
     447           0 :         part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
     448           0 :       desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
     449           0 :       return 1;
     450             :     } else {
     451           0 :       HLTWarning("handler can not process merged data from multiple ddls:"
     452             :                  " min slice %d, max slice %d, min part %d, max part %d",
     453             :                  slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
     454             :                  part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
     455           0 :       return 0;
     456             :     }
     457             :   }
     458             : 
     459             :   // dump for {'CLUSTERS':'TPC '} blocks stored in a 'digit' file
     460           0 :   if (dt==AliHLTTPCDefinitions::fgkClustersDataType) {
     461           0 :       desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
     462           0 :       return 1;
     463             :   }
     464             : 
     465             :   // define handlers for all blocks related to compression, flag if the
     466             :   // cluster id blocks are existing, this will be used to decide
     467             :   // whether to create the handler or not
     468             :   // {'CLUSTRAW':'TPC '}
     469             :   // {'HWCLUST1':'TPC '}
     470             :   // {'REMCLSCM':'TPC '}
     471             :   // {'CLSTRKCM':'TPC '}
     472             :   // {'REMCLIDS':'TPC '}
     473             :   // {'CLIDSTRK':'TPC '}
     474             :   // {'CLSFLAGS':'TPC '}
     475             :   // {'COMPDESC':'TPC '}
     476           0 :   if (dt==AliHLTTPCDefinitions::RawClustersDataType() ||
     477           0 :       dt==AliHLTTPCDefinitions::RawClustersDataTypeNotCompressed() ||
     478           0 :       dt==AliHLTTPCDefinitions::HWClustersDataType() ||
     479           0 :       dt==AliHLTTPCDefinitions::RemainingClustersCompressedDataType() ||
     480           0 :       dt==AliHLTTPCDefinitions::ClusterTracksCompressedDataType() ||
     481           0 :       dt==AliHLTTPCDefinitions::ClustersFlagsDataType() ||
     482           0 :       dt==AliHLTTPCDefinitions::DataCompressionDescriptorDataType()) {
     483           0 :       desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
     484           0 :       return 1;
     485             :   }
     486           0 :   if (dt==AliHLTTPCDefinitions::RemainingClusterIdsDataType() ||
     487           0 :       dt==AliHLTTPCDefinitions::ClusterIdTracksDataType()) {
     488           0 :       desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
     489           0 :       const_cast<AliHLTTPCAgent*>(this)->SetBit(kHaveCompressedClusterIdDataBlock);
     490           0 :       return 1;
     491             :   }
     492             : 
     493             :   // {'CLMCINFO':'TPC '} 
     494           0 :   if (dt==AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo) {
     495           0 :       desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
     496           0 :       return 1;
     497             :   }
     498             : 
     499             :   // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
     500           0 :   if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
     501           0 :       desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
     502           0 :       return 1;
     503             :   }
     504             : 
     505             :   // afterburner for {'TRACKS  ':'TPC '} block to be converted to ESD format
     506             :   // there is only one data block
     507           0 :   if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
     508           0 :       desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
     509           0 :       return 1;
     510             :   }
     511           0 :   return 0;
     512           0 : }
     513             : 
     514             : AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
     515             :                                                    AliHLTUInt32_t /*spec*/)
     516             : {
     517             :   // see header file for class documentation
     518             : 
     519             :   // raw data blocks to be fed into offline reconstruction
     520           0 :   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
     521           0 :     if (!fRawDataHandler) {
     522           0 :       fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
     523           0 :     }
     524           0 :     return fRawDataHandler;
     525             :   }
     526             : 
     527             :   // dump for {'CLUSTERS':'TPC '}, stored in a file HLT.TPC.Clusters.root in HOMER format
     528           0 :   if (dt==AliHLTTPCDefinitions::fgkClustersDataType) {
     529           0 :     if (fClustersDataHandler==NULL)
     530           0 :       fClustersDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-cluster-dump libHLTsim.so libAliHLTUtil.so");
     531           0 :     return fClustersDataHandler;
     532             :   }
     533             : 
     534             :   // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
     535             :   // in a kChain HLTOUT handler
     536           0 :   if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
     537           0 :     if (fTracksegsDataHandler==NULL)
     538           0 :       fTracksegsDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-tracksegs-esd-converter");
     539           0 :     return fTracksegsDataHandler;
     540             :   }
     541             : 
     542             :   // afterburner for {'TRACKS  ':'TPC '} block to be converted to ESD format
     543             :   // there is only one data block
     544           0 :   if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
     545           0 :     return new AliHLTOUTHandlerChain("chains=TPC-hltout-tracks-esd-converter");
     546             :   }
     547             : 
     548             :   // monitoring of compressed data if cluster verification blocks exist
     549             :   // {'REMCLIDS':'TPC '}
     550             :   // {'CLIDSTRK':'TPC '}
     551             :   // FIXME: needs to be commissioned
     552             :   // if (dt==AliHLTTPCDefinitions::RawClustersDataType() ||
     553             :   //     dt==AliHLTTPCDefinitions::RawClustersDataTypeNotCompressed() ||
     554             :   //     dt==AliHLTTPCDefinitions::HWClustersDataType() ||
     555             :   //     dt==AliHLTTPCDefinitions::RemainingClustersCompressedDataType() ||
     556             :   //     dt==AliHLTTPCDefinitions::ClusterTracksCompressedDataType() ||
     557             :   //     dt==AliHLTTPCDefinitions::RemainingClusterIdsDataType() ||
     558             :   //     dt==AliHLTTPCDefinitions::ClusterIdTracksDataType()) {
     559             :   //   const char* arg="chains=TPC-hltout-compressionmonitor";
     560             :   //   if (!TestBit(kHaveCompressedClusterIdDataBlock))
     561             :   //     arg="chains=TPC-hltout-compressionmonitorpublisher";
     562             :   //   if (!fCompressionMonitorHandler)
     563             :   //     fCompressionMonitorHandler=new AliHLTOUTHandlerChain(arg);
     564             :   //   return fCompressionMonitorHandler;
     565             :   // }
     566             : 
     567           0 :   return NULL;
     568           0 : }
     569             : 
     570             : int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
     571             : {
     572             :   // see header file for class documentation
     573           0 :   if (pInstance==NULL) return -EINVAL;
     574             : 
     575           0 :   if (pInstance==fRawDataHandler) {
     576           0 :     delete fRawDataHandler;
     577           0 :     fRawDataHandler=NULL;
     578           0 :   }
     579             : 
     580           0 :   if (pInstance==fTracksegsDataHandler) {
     581           0 :     delete fTracksegsDataHandler;
     582           0 :     fTracksegsDataHandler=NULL;
     583           0 :   }
     584             : 
     585           0 :   if (pInstance==fClustersDataHandler) {
     586           0 :     delete fClustersDataHandler;
     587           0 :     fClustersDataHandler=NULL;
     588           0 :   }
     589             : 
     590           0 :   if (pInstance==fCompressionMonitorHandler) {
     591           0 :     delete fCompressionMonitorHandler;
     592           0 :     fCompressionMonitorHandler=NULL;
     593           0 :   }
     594             : 
     595           0 :   return 0;
     596           0 : }
     597             : 
     598           0 : AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
     599           0 : {
     600             :   // see header file for class documentation
     601           0 : }
     602             : 
     603             : AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
     604           0 : {
     605             :   // see header file for class documentation
     606           0 : }
     607             : 
     608             : int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
     609             : {
     610             :   // see header file for class documentation
     611           0 :   if (!pData) return -EINVAL;
     612           0 :   AliHLTComponentDataType dt=kAliHLTVoidDataType;
     613           0 :   AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
     614           0 :   int iResult=pData->GetDataBlockDescription(dt, spec);
     615           0 :   if (iResult>=0) {
     616           0 :     int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
     617           0 :     int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
     618           0 :     if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
     619           0 :         part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
     620             :       iResult=768;
     621           0 :       if (part>1) iResult+=72+4*slice+(part-2);
     622           0 :       else iResult+=2*slice+part;
     623             :     } else {
     624           0 :       HLTError("handler can not process merged data from multiple ddls:"
     625             :                " min slice %d, max slice %d, min part %d, max part %d",
     626             :                slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
     627             :                part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
     628             :       iResult=-EBADMSG;
     629             :     }
     630           0 :   }
     631             :   return iResult;
     632           0 : }

Generated by: LCOV version 1.11