]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
minor update of documentation
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterFinderComponent.cxx
index a44fa7883054f3a678bd39592202ad12df2f3b8d..9a7a58f3a401446a3747d6544abeeffa5c1d9780 100644 (file)
@@ -37,11 +37,16 @@ using namespace std;
 #include "AliHLTTPCTransform.h"
 #include "AliHLTTPCClusters.h"
 #include "AliHLTTPCDefinitions.h"
+#include "AliGRPObject.h"
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
 #include "AliTPCcalibDB.h"
 #include "AliTPCCalPad.h"
 #include "AliTPCParam.h"
+#include "AliTPCTransform.h"
+
+//#include "AliHLTTPCCAInputDataCompressorComponent.h"
+//#include "AliHLTTPCCADef.h"
 
 #include <cstdlib>
 #include <cerrno>
@@ -52,22 +57,19 @@ using namespace std;
 #include "AliCDBManager.h"
 #include "AliCDBStorage.h"
 #include "TGeoGlobalMagField.h"
+#include "AliGeomManager.h"
 
 #include <sys/time.h>
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCClusterFinderComponent)
 
-const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryPacked="HLT/ConfigTPC/TPCClusterFinderPacked";
-const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryUnpacked="HLT/ConfigTPC/TPCClusterFinderUnpacked";
-const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryDecoder="HLT/ConfigTPC/TPCClusterFinderDecoder";
-const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntry32Bit="HLT/ConfigTPC/TPCClusterFinder32Bit";
-
 AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
   :
   fClusterFinder(NULL),
   fReader(NULL),
   fDeconvTime(kFALSE),
+  fTS(0),
   fDeconvPad(kFALSE),
   fClusterDeconv(false),
   fXYClusterError(-1),
@@ -79,7 +81,8 @@ AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
   fFirstTimeBin(-1),
   fLastTimeBin(-1),
   fDoMC(kFALSE),
-  fReleaseMemory( kFALSE )
+  fReleaseMemory( kFALSE ),
+  fBenchmark("TPCClusterFinder")
 {
   // see header file for class documentation
   // or
@@ -155,6 +158,7 @@ int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeL
   tgtList.clear();
   tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
   tgtList.push_back(kAliHLTDataTypeHwAddr16);
+  //tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
   return tgtList.size();
 }
 
@@ -195,9 +199,14 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
   AliTPCcalibDB*  calib=AliTPCcalibDB::Instance();  
   //
   if(!calib){
-    HLTError("AliTPCcalibCD does not exist");
+    HLTError("AliTPCcalibDB does not exist");
     return -ENOENT;
   }
+
+  fTS = calib->GetTransform();
+
+  calib->SetRun(GetRunNo());
+  calib->UpdateRunInformations(GetRunNo());
   AliTPCCalPad * time0TPC = calib->GetPadTime0(); 
   if(!time0TPC){
     HLTError("OCDB entry TPC/Calib/PadTime0 (AliTPCcalibDB::GetPadTime0()) is not available.");
@@ -217,24 +226,24 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
   }
   calib->SetExBField(GetBz());
 
+  if(!AliGeomManager::GetGeometry()){
+    AliGeomManager::LoadGeometry();
+  }
+
   fClusterFinder = new AliHLTTPCClusterFinder();
 
+  TObject* pOCDBEntry=LoadAndExtractOCDBObject("GRP/GRP/Data");
+  AliGRPObject* pGRP=pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
+  TString beamType;
+  if (pGRP) {
+    beamType=pGRP->GetBeamType();
+  }
+
   // first configure the default
   int iResult = 0;
-  switch(fModeSwitch){
-  case kClusterFinderPacked:
-    iResult=ConfigureFromCDBTObjString(fgkOCDBEntryPacked);
-    break;
-  case kClusterFinderUnpacked:          
-    iResult=ConfigureFromCDBTObjString(fgkOCDBEntryUnpacked);
-    break;
-  case kClusterFinderDecoder:
-    iResult=ConfigureFromCDBTObjString(fgkOCDBEntryDecoder);
-    break;
-  case kClusterFinder32Bit:
-    iResult=ConfigureFromCDBTObjString(fgkOCDBEntry32Bit);
-    break;
-  }
+  TString cdbPath="HLT/ConfigTPC/";
+  cdbPath+=GetComponentID();
+  iResult=ConfigureFromCDBTObjString(cdbPath, beamType.Data());
 
   // configure from the command line parameters if specified
   if (iResult>=0 && argc>0)
@@ -319,6 +328,9 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
   if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){
     fClusterFinder->SetLastTimeBin(fLastTimeBin);
   }
+  fBenchmark.Reset();
+  fBenchmark.SetTimer(0,"total");
+  fBenchmark.SetTimer(1,"reco");
 
   return iResult;
 }
@@ -346,6 +358,15 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
 {
   // see header file for class documentation
   int iResult=0;
+  //SG!!!
+  //fDeconvTime = kTRUE;
+  //fClusterFinder->SetDeconvTime(fDeconvTime);
+  // fDeconvPad = kTRUE;
+  //fClusterFinder->SetDeconvPad(fDeconvPad);
+    
+  
+  fTS->SetCurrentTimeStamp(GetTimeStamp());
+  //fTS->SetCurrentTimeStamp(0);
 
   if(fReader == NULL){
     HLTFatal("Digit reader not initialized, skipping HLT TPC cluster reconstruction.");
@@ -358,6 +379,9 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
     return 0;
   }
 
+  fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
+
   //  == init iter (pointer to datablock)
   const AliHLTComponentBlockData* iter = NULL;
   unsigned long ndx;
@@ -417,6 +441,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
 
       }
 
+      fBenchmark.AddInput(iter->fSize);
+
       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
       patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
 
@@ -432,6 +458,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       fClusterFinder->InitSlice( slice, patch, maxPoints );
       fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
        
+      fBenchmark.Start(1);
+
       if(fUnsorted){
        if(fGetActivePads){
          fClusterFinder->SetDoPadSelection(kTRUE);
@@ -449,6 +477,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        fClusterFinder->Read(iter->fPtr, iter->fSize );
        fClusterFinder->ProcessDigits();
       }
+      fBenchmark.Stop(1);
+
       fReader->Reset();
 
       realPoints = fClusterFinder->GetNumberOfClusters();
@@ -467,7 +497,9 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       bd.fSpecification = iter->fSpecification;
       bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
       outputBlocks.push_back( bd );
-       
+
+      fBenchmark.AddOutput(bd.fSize);
+
       tSize += mysize;
       outBPtr += mysize;
       outPtr = (AliHLTTPCClusterData*)outBPtr;
@@ -495,9 +527,43 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        bdHW.fDataType = kAliHLTDataTypeHwAddr16;
        outputBlocks.push_back( bdHW );
        
+       fBenchmark.AddOutput(bdHW.fSize);
        tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
       }
 
+      /*
+      { // compressed output for the CA tracker        
+
+       AliHLTUInt32_t dSize = 0;       
+
+       int ret = AliHLTTPCCAInputDataCompressorComponent::Compress(  (AliHLTTPCClusterData*)( outputPtr + bd.fOffset ),
+                                                                     size - tSize,
+                                                                     outputPtr+tSize,
+                                                                     dSize );
+       
+       if ( ret!=0 || tSize + dSize > size )
+         {
+           Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", 
+                    "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
+                    tSize + dSize, size );
+           iResult=-ENOSPC;
+           break;
+         }
+       
+       AliHLTComponentBlockData bdCompressed;
+       FillBlockData( bdCompressed );
+       bdCompressed.fOffset = tSize ;
+       bdCompressed.fSize = dSize;
+       bdCompressed.fSpecification = iter->fSpecification;
+       bdCompressed.fDataType = AliHLTTPCCADefinitions::fgkCompressedInputDataType;
+       outputBlocks.push_back( bdCompressed );
+       
+       tSize += dSize;
+       outBPtr += dSize;
+       outPtr = (AliHLTTPCClusterData*)outBPtr;        
+      }
+      */
+
       if(fDoMC){
        Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize)/sizeof(AliHLTTPCClusterFinder::ClusterMCInfo)-1);
        AliHLTTPCClusterFinder::ClusterMCInfo* outputMCInfo= (AliHLTTPCClusterFinder::ClusterMCInfo*)(outputPtr+tSize);
@@ -510,7 +576,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        bdMCInfo.fSpecification = iter->fSpecification;
        bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
        outputBlocks.push_back( bdMCInfo );
-       
+       fBenchmark.AddOutput(bdMCInfo.fSize);
+
        tSize+=nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
 
       }
@@ -519,6 +586,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
   if (iResult>=0)
     size = tSize;
 
+  fBenchmark.Stop(0);  
+  HLTInfo(fBenchmark.GetStatistics());
   return iResult;
 }
 
@@ -687,25 +756,15 @@ int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const cha
 {  
   // see header file for class documentation
 
-  const char* entry=cdbEntry;
-  if (!entry || entry[0]==0){
-    switch(fModeSwitch){
-    case kClusterFinderPacked:
-      entry=fgkOCDBEntryPacked;
-      break;
-    case kClusterFinderUnpacked:        
-      entry=fgkOCDBEntryUnpacked;
-      break;
-    case kClusterFinderDecoder:
-      entry=fgkOCDBEntryDecoder;
-      break;
-    case kClusterFinder32Bit:
-      entry=fgkOCDBEntry32Bit;
-      break;
-    }
+  TString cdbPath;
+  if (cdbEntry) {
+    cdbPath=cdbEntry;
+  } else {
+    cdbPath="HLT/ConfigTPC/";
+    cdbPath+=GetComponentID();
   }
 
-  return ConfigureFromCDBTObjString(entry);
+  return ConfigureFromCDBTObjString(cdbPath.Data());
 
   /*
   int iResult=0;
@@ -867,3 +926,41 @@ int AliHLTTPCClusterFinderComponent::Configure(const char* arguments){
   return iResult;
 }
 
+void AliHLTTPCClusterFinderComponent::GetOCDBObjectDescription( TMap* const targetMap){
+// Get a list of OCDB object description needed for the particular component
+  
+  if (!targetMap) return;
+  
+  // OCDB entries for component arguments
+  targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinder32Bit"),    new TObjString("component arguments, empty at the moment"));
+  targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderPacked"),   new TObjString("component arguments, empty at the moment"));
+  targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderUnpacked"), new TObjString("component arguments, empty at the moment"));
+  targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderDecoder"),  new TObjString("component arguments, empty at the moment"));
+  
+  // OCDB entries to be fetched by the TAXI (access via the AliTPCcalibDB class)
+  targetMap->Add(new TObjString("TPC/Calib/Parameters"),    new TObjString("unknown content"));
+  targetMap->Add(new TObjString("TPC/Calib/TimeDrift"),     new TObjString("drift velocity calibration"));
+  targetMap->Add(new TObjString("TPC/Calib/Temperature"),   new TObjString("temperature map"));
+  targetMap->Add(new TObjString("TPC/Calib/PadGainFactor"), new TObjString("gain factor pad by pad"));
+  targetMap->Add(new TObjString("TPC/Calib/ClusterParam"),  new TObjString("cluster parameters"));
+  
+  // OCDB entries needed to be fetched by the Pendolino
+  targetMap->Add(new TObjString("TPC/Calib/AltroConfig"), new TObjString("contains the altro config, e.g. info about the L0 trigger timing"));
+  targetMap->Add(new TObjString("GRP/CTP/CTPtiming"),     new TObjString("content used in the cluster coordinate transformation in relation to the L0 trigger timing"));
+
+  // OCDB entries necessary for replaying data on the HLT cluster
+  targetMap->Add(new TObjString("GRP/GRP/Data"), new TObjString("contains magnetic field info"));  
+  // OCDB entries needed to suppress fatals/errors/warnings during reconstruction
+  targetMap->Add(new TObjString("TPC/Calib/PadTime0"),    new TObjString("time0 offset pad by pad"));
+  targetMap->Add(new TObjString("TPC/Calib/PadNoise"),    new TObjString("pad noise values"));
+  targetMap->Add(new TObjString("TPC/Calib/Pedestals"),   new TObjString("pedestal info"));
+  targetMap->Add(new TObjString("TPC/Calib/Pulser"),      new TObjString("pulser info"));
+  targetMap->Add(new TObjString("TPC/Calib/CE"),          new TObjString("CE laser calibration result"));
+  targetMap->Add(new TObjString("TPC/Calib/Raw"),         new TObjString("unknown content"));
+  targetMap->Add(new TObjString("TPC/Calib/QA"),          new TObjString("not important"));
+  targetMap->Add(new TObjString("TPC/Calib/Mapping"),     new TObjString("unknown content"));
+  targetMap->Add(new TObjString("TPC/Calib/Goofie"),      new TObjString("Goofie values, not used at the moment (05.03.2010)"));
+  targetMap->Add(new TObjString("TPC/Calib/HighVoltage"), new TObjString("high voltage values, not used"));
+  targetMap->Add(new TObjString("TPC/Calib/Ref"),         new TObjString("unknown content"));
+}