]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCAgent.cxx
Adding first version of data checking component for TPC.
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCAgent.cxx
index c25bf70671ad1f684fe669d43162901b3c9c628a..0150a7fc696dba6e79105ea0e1503bf0581dd969 100644 (file)
@@ -1,4 +1,4 @@
-// @(#) $Id$
+// $Id$
 
 //**************************************************************************
 //* This file is property of and copyright by the ALICE HLT Project        * 
 //* provided "as is" without express or implied warranty.                  *
 //**************************************************************************
 
-/** @file   AliHLTTPCAgent.cxx
-    @author Matthias Richter
-    @date   
-    @brief  Agent of the libAliHLTTPC library
-*/
+/ @file   AliHLTTPCAgent.cxx
+//  @author Matthias Richter
+//  @date   
+//  @brief  Agent of the libAliHLTTPC library
+//  @note   
 
 #include "AliHLTTPCAgent.h"
-#include "AliHLTConfiguration.h"
 #include "AliHLTTPCDefinitions.h"
 #include "AliHLTOUT.h"
 #include "AliHLTOUTHandlerChain.h"
 #include "AliRunLoader.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliTPCParam.h"
 
 /** global instance for agent registration */
 AliHLTTPCAgent gAliHLTTPCAgent;
@@ -40,10 +42,15 @@ AliHLTTPCAgent gAliHLTTPCAgent;
 #include "AliHLTTPCCompModelDeconverterComponent.h"
 #include "AliHLTTPCCompModelConverterComponent.h"
 #include "AliHLTTPCCompDumpComponent.h"
-#include "AliHLTTPCCalibCEComponent.h"
-#include "AliHLTTPCCalibPulserComponent.h"
-#include "AliHLTTPCCalibPedestalComponent.h"
+//#include "AliHLTTPCCalibCEComponent.h"
+//#include "AliHLTTPCCalibPulserComponent.h"
+//#include "AliHLTTPCCalibPedestalComponent.h"
+#include "AliHLTTPCCAInputDataCompressorComponent.h"
 #include "AliHLTTPCCATrackerComponent.h"
+#include "AliHLTTPCCATrackerOutputConverter.h"
+#include "AliHLTTPCTrackMCMarkerComponent.h"
+#include "AliHLTTPCCAGlobalMergerComponent.h"
+#include "AliHLTTPCdEdxComponent.h"
 #include "AliHLTTPCGlobalMergerComponent.h"
 #include "AliHLTTPCSliceTrackerComponent.h"
 #include "AliHLTTPCVertexFinderComponent.h"
@@ -57,23 +64,30 @@ AliHLTTPCAgent gAliHLTTPCAgent;
 #include "AliHLTTPCOfflineClustererComponent.h"
 #include "AliHLTTPCOfflineTrackerComponent.h"
 #include "AliHLTTPCOfflineTrackerCalibComponent.h"
-#include "AliHLTTPCOfflineCalibrationComponent.h"
+#include "AliHLTTPCOfflineCalibrationComponent.h" // to be added to the calibration library agent
 #include "AliHLTTPCClusterHistoComponent.h"
 #include "AliHLTTPCNoiseMapComponent.h"
 #include "AliHLTTPCHistogramHandlerComponent.h"
-#include "AliHLTTPCCalibTracksComponent.h"
+//#include "AliHLTTPCCalibTracksComponent.h"
 #include "AliHLTTPCTrackHistoComponent.h"
 #include "AliHLTTPCTrackDumpComponent.h"
 #include "AliHLTTPCHWCFDataReverterComponent.h"
+#include "AliHLTTPCHWClusterTransformComponent.h"
+#include "AliHLTTPCCFComparisonComponent.h"
+// #include "AliHLTTPCCalibSeedMakerComponent.h"
+// #include "AliHLTTPCCalibTimeComponent.h"
+// #include "AliHLTTPCCalibTimeGainComponent.h"
+// #include "AliHLTTPCCalibrationComponent.h"
+#include "AliHLTTPCDataCheckerComponent.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCAgent)
 
 AliHLTTPCAgent::AliHLTTPCAgent()
-  :
-  AliHLTModuleAgent("TPC"),
-  fRawDataHandler(NULL),
-  fTracksegsDataHandler(NULL)
+  : AliHLTModuleAgent("TPC")
+  , fRawDataHandler(NULL)
+  , fTracksegsDataHandler(NULL)
+  , fClustersDataHandler(NULL)
 {
   // see header file for class documentation
   // or
@@ -89,7 +103,7 @@ AliHLTTPCAgent::~AliHLTTPCAgent()
 
 int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
                                         AliRawReader* rawReader,
-                                        AliRunLoader* /*runloader*/) const
+                                        AliRunLoader* runloader) const
 {
   // see header file for class documentation
   if (handler) {
@@ -105,6 +119,7 @@ int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
     int iMinPart=0;
     int iMaxPart=5;
     TString mergerInput;
+    TString sinkClusterInput;
     for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
       TString trackerInput;
       for (int part=iMinPart; part<=iMaxPart; part++) {
@@ -112,31 +127,43 @@ int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
 
        // digit publisher components
        publisher.Form("TPC-DP_%02d_%d", slice, part);
-       if (!rawReader) {
-         arg.Form("-slice %d -partition %d", slice, part);
-         handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
-       } else {
+       if (rawReader || !runloader) {
+         // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
+         // Alireconstruction: indicated by runloader==NULL, run always on raw data
          int ddlno=768;
          if (part>1) ddlno+=72+4*slice+(part-2);
          else ddlno+=2*slice+part;
          arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x -silent", ddlno, slice, slice, part, part);
          handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
+       } else {
+         arg.Form("-slice %d -partition %d", slice, part);
+         handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
        }
 
        // cluster finder components
        cf.Form("TPC-CF_%02d_%d", slice, part);
-       if (!rawReader) {
-         handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), "-timebins 446 -sorted");
+       arg="-release-memory";
+       if (!rawReader && runloader) {
+         arg+=" -do-mc";
+         handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), arg.Data());
        } else {
-         handler->CreateConfiguration(cf.Data(), "TPCClusterFinderDecoder", publisher.Data(), "-timebins 446");
+#ifndef HAVE_NOT_ALTRORAWSTREAMV3
+         handler->CreateConfiguration(cf.Data(), "TPCClusterFinder32Bit", publisher.Data(),arg.Data());
+#else
+         // using the AltroDecoder if the official V3 decoder is not
+         // available in the offline code
+         handler->CreateConfiguration(cf.Data(), "TPCClusterFinderDecoder", publisher.Data(), arg.Data());
+#endif 
        }
        if (trackerInput.Length()>0) trackerInput+=" ";
        trackerInput+=cf;
+       if (sinkClusterInput.Length()>0) sinkClusterInput+=" ";
+       sinkClusterInput+=cf;
       }
       TString tracker;
       // tracker finder components
       tracker.Form("TPC-TR_%02d", slice);
-      handler->CreateConfiguration(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
+      handler->CreateConfiguration(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");
 
       if (mergerInput.Length()>0) mergerInput+=" ";
       mergerInput+=tracker;
@@ -144,10 +171,21 @@ int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
     }
 
     // GlobalMerger component
-    handler->CreateConfiguration("TPC-globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
+    handler->CreateConfiguration("TPC-globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
 
     // the esd converter configuration
-    handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter"   , "TPC-globalmerger", "");
+    TString converterInput="TPC-globalmerger";
+    if (!rawReader && runloader) {
+      // propagate cluster info to the esd converter in order to fill the MC information
+      handler->CreateConfiguration("TPC-clustermc-info", "BlockFilter"   , sinkClusterInput.Data(), "-datatype 'CLMCINFO' 'TPC '");  
+      handler->CreateConfiguration("TPC-mcTrackMarker","TPCTrackMCMarker","TPC-globalmerger TPC-clustermc-info","" );
+      converterInput+=" ";
+      converterInput+="TPC-mcTrackMarker";
+    }
+    handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter"   , converterInput.Data(), "");
+
+    // cluster dump collection
+    handler->CreateConfiguration("TPC-clusters", "BlockFilter"   , sinkClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC '");
 
     /////////////////////////////////////////////////////////////////////////////////////
     //
@@ -173,7 +211,19 @@ int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
 
     // the esd converter configuration
     handler->CreateConfiguration("TPC-hltout-tracks-esd-converter", "TPCEsdConverter", "TPC-hltout-tracks-publisher", "");
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    //
+    // a kChain HLTOUT configuration for processing of {'CLUSTERS':'TPC '} data blocks
+    // stores the blocks in file HLT.TPC.Clusters.root in HOMER format
+
+    // publisher component
+    handler->CreateConfiguration("TPC-hltout-cluster-publisher", "AliHLTOUTPublisher"   , NULL, "");
+
+    // the HLTOUT component collects the blocks and stores the file
+    handler->CreateConfiguration("TPC-hltout-cluster-dump", "HLTOUT", "TPC-hltout-cluster-publisher", "-digitfile HLT.TPC.Clusters.root -rawout=off -links 2");
   }
+
   return 0;
 }
 
@@ -185,8 +235,9 @@ const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
     // reconstruction chains for AliRoot simulation
     // Note: run loader is only available while running embedded into
     // AliRoot simulation
-    if (runloader->GetLoader("TPCLoader") != NULL)
-      return "TPC-esd-converter";
+    //if (runloader->GetLoader("TPCLoader") != NULL)
+      //return "TPC-esd-converter TPC-clusters";
+      return "TPC-clusters";
   }
   return NULL;
 }
@@ -198,7 +249,7 @@ const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
   // actually, the TPC library has dependencies to Util and RCU
   // so the two has to be loaded anyhow before we get here
   //return "libAliHLTUtil.so libAliHLTRCU.so";
-  return NULL;
+  return "libAliHLTUtil.so";
 }
 
 int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
@@ -208,21 +259,27 @@ int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
 
   pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent);
   pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent);
-  pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
-  pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
-  pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
+//   pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
+//   pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
+//   pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
   pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
   pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
   pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
   pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
   pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
+  pHandler->AddComponent(new AliHLTTPCCAInputDataCompressorComponent);
   pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
+  pHandler->AddComponent(new AliHLTTPCCATrackerOutputConverter);
+  pHandler->AddComponent(new AliHLTTPCCAGlobalMergerComponent);
+  pHandler->AddComponent(new AliHLTTPCTrackMCMarkerComponent);
   pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
+  pHandler->AddComponent(new AliHLTTPCdEdxComponent);
   pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent);
   pHandler->AddComponent(new AliHLTTPCVertexFinderComponent);
   pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
   pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
   pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
+  pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinder32Bit));
   pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
   pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
   pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent);
@@ -237,10 +294,17 @@ int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
   pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
   pHandler->AddComponent(new AliHLTTPCNoiseMapComponent);
   pHandler->AddComponent(new AliHLTTPCHistogramHandlerComponent);
-  pHandler->AddComponent(new AliHLTTPCCalibTracksComponent);
+  //pHandler->AddComponent(new AliHLTTPCCalibTracksComponent);
   pHandler->AddComponent(new AliHLTTPCTrackHistoComponent);
   pHandler->AddComponent(new AliHLTTPCTrackDumpComponent);
   pHandler->AddComponent(new AliHLTTPCHWCFDataReverterComponent);
+  pHandler->AddComponent(new AliHLTTPCHWClusterTransformComponent);
+  pHandler->AddComponent(new AliHLTTPCCFComparisonComponent);
+//   pHandler->AddComponent(new AliHLTTPCCalibSeedMakerComponent);
+//   pHandler->AddComponent(new AliHLTTPCCalibTimeComponent);
+//   pHandler->AddComponent(new AliHLTTPCCalibTimeGainComponent);
+//   pHandler->AddComponent(new AliHLTTPCCalibrationComponent);
+  pHandler->AddComponent(new AliHLTTPCDataCheckerComponent);
 
   return 0;
 }
@@ -268,6 +332,12 @@ int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
     }
   }
 
+  // dump for {'CLUSTERS':'TPC '} blocks stored in a 'digit' file
+  if (dt==AliHLTTPCDefinitions::fgkClustersDataType) {
+      desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
+      return 1;
+  }
+
   // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
   if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
       desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
@@ -296,6 +366,13 @@ AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
     return fRawDataHandler;
   }
 
+  // dump for {'CLUSTERS':'TPC '}, stored in a file HLT.TPC.Clusters.root in HOMER format
+  if (dt==AliHLTTPCDefinitions::fgkClustersDataType) {
+    if (fClustersDataHandler==NULL)
+      fClustersDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-cluster-dump libHLTsim.so libAliHLTUtil.so");
+    return fClustersDataHandler;
+  }
+
   // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
   // in a kChain HLTOUT handler
   if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
@@ -327,6 +404,12 @@ int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
     delete fTracksegsDataHandler;
     fTracksegsDataHandler=NULL;
   }
+
+  if (pInstance==fClustersDataHandler) {
+    delete fClustersDataHandler;
+    fClustersDataHandler=NULL;
+  }
+
   return 0;
 }