]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
Update from Timo: Initialisation of AliGeomManager added
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterFinderComponent.cxx
index e72abcd742427672c7d47cfc6ebe856349df0ad9..59567d6a29ca3396ec34a47bbae8b5cbe97dc6a4 100644 (file)
@@ -42,6 +42,8 @@ using namespace std;
 #include "AliTPCcalibDB.h"
 #include "AliTPCCalPad.h"
 #include "AliTPCParam.h"
+//#include "AliHLTTPCCAInputDataCompressorComponent.h"
+//#include "AliHLTTPCCADef.h"
 
 #include <cstdlib>
 #include <cerrno>
@@ -52,6 +54,7 @@ using namespace std;
 #include "AliCDBManager.h"
 #include "AliCDBStorage.h"
 #include "TGeoGlobalMagField.h"
+#include "AliGeomManager.h"
 
 #include <sys/time.h>
 
@@ -79,7 +82,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 +159,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 +200,11 @@ 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;
   }
+  calib->SetRun(GetRunNo());
+  calib->UpdateRunInformations(GetRunNo());
   AliTPCCalPad * time0TPC = calib->GetPadTime0(); 
   if(!time0TPC){
     HLTError("OCDB entry TPC/Calib/PadTime0 (AliTPCcalibDB::GetPadTime0()) is not available.");
@@ -215,6 +222,11 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
     HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF");
     return -ENODEV;
   }
+  calib->SetExBField(GetBz());
+
+  if(!AliGeomManager::GetGeometry()){
+    AliGeomManager::LoadGeometry();
+  }
 
   fClusterFinder = new AliHLTTPCClusterFinder();
 
@@ -318,6 +330,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;
 }
@@ -345,6 +360,12 @@ 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);
+    
 
   if(fReader == NULL){
     HLTFatal("Digit reader not initialized, skipping HLT TPC cluster reconstruction.");
@@ -357,6 +378,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;
@@ -416,6 +440,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
 
       }
 
+      fBenchmark.AddInput(iter->fSize);
+
       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
       patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
 
@@ -431,6 +457,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);
@@ -448,6 +476,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        fClusterFinder->Read(iter->fPtr, iter->fSize );
        fClusterFinder->ProcessDigits();
       }
+      fBenchmark.Stop(1);
+
       fReader->Reset();
 
       realPoints = fClusterFinder->GetNumberOfClusters();
@@ -466,7 +496,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;
@@ -494,9 +526,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);
@@ -509,7 +575,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);
 
       }
@@ -518,6 +585,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
   if (iResult>=0)
     size = tSize;
 
+  fBenchmark.Stop(0);  
+  HLTInfo(fBenchmark.GetStatistics());
   return iResult;
 }
 
@@ -535,14 +604,6 @@ int AliHLTTPCClusterFinderComponent::ScanConfigurationArgument(int argc, const c
     return 2;
   }
 
-  AliTPCcalibDB*  calib=AliTPCcalibDB::Instance();
-  if(!calib){
-    HLTError("CalibDB not availible");
-  } else {
-    calib->SetExBField(GetBz());
-    HLTInfo("SolenoidBz is set to %f in the calibDB", GetBz());
-  }
-
   if (argument.CompareTo("-update-calibdb")==0 || argument.CompareTo("-update-transform")==0 ){
     if(fClusterFinder->UpdateCalibDB()){
       HLTDebug("CalibDB and offline transform successfully updated.");
@@ -874,3 +935,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"));
+}