]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
Compilation warnings
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterFinderComponent.cxx
index b860ad46de120277fd058633bfe617d153cdf41e..2880d8c16de317bb022d3be5376861b5bfc7a6b8 100644 (file)
@@ -27,9 +27,7 @@
 using namespace std;
 #endif
 #include "AliHLTTPCClusterFinderComponent.h"
-#include "AliHLTTPCDigitReaderPacked.h"
 #include "AliHLTTPCDigitReaderUnpacked.h"
-#include "AliHLTTPCDigitReaderDecoder.h"
 #include "AliHLTTPCDigitReader32Bit.h"
 #include "AliHLTTPCClusterFinder.h"
 #include "AliHLTTPCSpacePointData.h"
@@ -37,13 +35,17 @@ 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 "AliHLTTPCCAInputDataCompressorComponent.h"
-#include "AliHLTTPCCADef.h"
+#include "AliTPCTransform.h"
+#include "AliHLTTPCClusterMCData.h"
+
+//#include "AliHLTTPCCAInputDataCompressorComponent.h"
+//#include "AliHLTTPCCADef.h"
 
 #include <cstdlib>
 #include <cerrno>
@@ -54,22 +56,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),
@@ -81,7 +80,9 @@ AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
   fFirstTimeBin(-1),
   fLastTimeBin(-1),
   fDoMC(kFALSE),
-  fReleaseMemory( kFALSE )
+  fReleaseMemory( kFALSE ),
+  fPublishRawClusters(kFALSE),
+  fBenchmark("TPCClusterFinder")
 {
   // see header file for class documentation
   // or
@@ -129,15 +130,11 @@ void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentD
   // see header file for class documentation
   list.clear(); 
   switch(fModeSwitch){
-  case kClusterFinderPacked:
-    list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
-    break;
   case kClusterFinderUnpacked:          
     list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );     
     break;
-  case kClusterFinderDecoder:
-    list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
-    break;
+  case kClusterFinderDecoder: // deprecated, falling back to 32bit reader
+  case kClusterFinderPacked: // deprecated, falling back to 32bit reader
   case kClusterFinder32Bit:
     list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
     break;
@@ -157,7 +154,7 @@ int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeL
   tgtList.clear();
   tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
   tgtList.push_back(kAliHLTDataTypeHwAddr16);
-  tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
+  //tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
   return tgtList.size();
 }
 
@@ -167,15 +164,11 @@ void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBas
   // XXX TODO: Find more realistic values.  
   constBase = 0;
   switch(fModeSwitch){
-  case kClusterFinderPacked:
-    inputMultiplier = (6 * 0.4);
-    break;
   case kClusterFinderUnpacked:
     inputMultiplier = 0.4;
     break;
-  case kClusterFinderDecoder:
-    inputMultiplier = (6 * 0.4);
-    break;
+  case kClusterFinderDecoder: // deprecated, falling back to 32bit reader
+  case kClusterFinderPacked: // deprecated, falling back to 32bit reader
   case kClusterFinder32Bit:
     inputMultiplier = (6 * 0.4);
     break;
@@ -198,9 +191,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.");
@@ -220,24 +218,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)
@@ -277,23 +275,21 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
 
   // Choose reader
   if (fModeSwitch==kClusterFinderPacked) {
-      HLTDebug("using AliHLTTPCDigitReaderPacked");
-      fReader = new AliHLTTPCDigitReaderPacked();
-      if(fUnsorted==1){        fReader->SetUnsorted(kTRUE); }
-      fClusterFinder->SetReader(fReader);
+      HLTWarning("AliHLTTPCDigitReaderPacked is deprecated, falling back to AliHLTTPCDigitReader32Bit");
+  }
+  else if(fModeSwitch==kClusterFinderDecoder){
+    HLTWarning("AliHLTTPCDigitReaderPacked is deprecated, falling back to AliHLTTPCDigitReader32Bit");
   }
-  else if(fModeSwitch==kClusterFinderUnpacked){         
+  
+  if(fModeSwitch==kClusterFinderUnpacked){      
     HLTDebug("using AliHLTTPCDigitReaderUnpacked");     
     fReader = new AliHLTTPCDigitReaderUnpacked();       
     if(fUnsorted==1){  fReader->SetUnsorted(kTRUE); }
     fClusterFinder->SetReader(fReader);
   } 
-  else if(fModeSwitch==kClusterFinderDecoder){
-    HLTDebug("using AliHLTTPCDigitReaderDecoder");
-    fReader = new AliHLTTPCDigitReaderDecoder();
-    fClusterFinder->SetReader(fReader);
-  }
-  else if(fModeSwitch==kClusterFinder32Bit){
+  else if(fModeSwitch==kClusterFinder32Bit ||
+         fModeSwitch==kClusterFinderPacked ||
+         fModeSwitch==kClusterFinderDecoder){
     HLTDebug("using AliHLTTPCDigitReader32Bit");
     fReader = new AliHLTTPCDigitReader32Bit();
     fClusterFinder->SetReader(fReader);
@@ -322,6 +318,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;
 }
@@ -349,6 +348,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.");
@@ -361,6 +369,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;
@@ -399,15 +410,7 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
                 DataType2Text( iter->fDataType).c_str(), 
                 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
 
-       if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType &&
-           GetEventCount()<2) {
-         HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!",
-                    DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
-                    DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
-         }
-
-       if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) &&
-            iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
+       if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC)) continue;
 
       }
       else if(fModeSwitch==1){
@@ -420,6 +423,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
 
       }
 
+      fBenchmark.AddInput(iter->fSize);
+
       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
       patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
 
@@ -432,9 +437,12 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
 
       maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
 
+      fClusterFinder->SetFillRawClusters(fPublishRawClusters);
       fClusterFinder->InitSlice( slice, patch, maxPoints );
       fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
        
+      fBenchmark.Start(1);
+
       if(fUnsorted){
        if(fGetActivePads){
          fClusterFinder->SetDoPadSelection(kTRUE);
@@ -452,6 +460,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        fClusterFinder->Read(iter->fPtr, iter->fSize );
        fClusterFinder->ProcessDigits();
       }
+      fBenchmark.Stop(1);
+
       fReader->Reset();
 
       realPoints = fClusterFinder->GetNumberOfClusters();
@@ -470,7 +480,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;
@@ -498,9 +510,11 @@ 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;       
@@ -531,29 +545,47 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        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);
-       Int_t nMCInfo = fClusterFinder->FillOutputMCInfo(outputMCInfo, maxNumberOfClusterMCInfo);
-       
-       AliHLTComponentBlockData bdMCInfo;
-       FillBlockData( bdMCInfo );
-       bdMCInfo.fOffset = tSize ;
-       bdMCInfo.fSize = nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
-       bdMCInfo.fSpecification = iter->fSpecification;
-       bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
-       outputBlocks.push_back( bdMCInfo );
-       
-       tSize+=nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
+       Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize-sizeof(AliHLTTPCClusterMCData))/sizeof(AliHLTTPCClusterMCLabel)-1);
+       if( maxNumberOfClusterMCInfo>0 ){
+         AliHLTTPCClusterMCData* outputMCInfo= (AliHLTTPCClusterMCData*)(outputPtr+tSize);
+         outputMCInfo->fCount = fClusterFinder->FillOutputMCInfo(outputMCInfo->fLabels, maxNumberOfClusterMCInfo);
+         
+         AliHLTComponentBlockData bdMCInfo;
+         FillBlockData( bdMCInfo );
+         bdMCInfo.fOffset = tSize;
+         bdMCInfo.fSize = sizeof(AliHLTTPCClusterMCData)+outputMCInfo->fCount*sizeof(AliHLTTPCClusterMCLabel);
+         bdMCInfo.fSpecification = iter->fSpecification;
+         bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
+         outputBlocks.push_back( bdMCInfo );
+         fBenchmark.AddOutput(bdMCInfo.fSize);
+         tSize+=bdMCInfo.fSize;
+       }
+      }
 
+      if (fPublishRawClusters) {
+       AliHLTTPCRawClusterData* outputRaw= (AliHLTTPCRawClusterData*)(outputPtr+tSize);
+       outputRaw->fCount = fClusterFinder->FillOutputRaw(outputRaw->fClusters, size-tSize);
+
+       AliHLTComponentBlockData bdRawClusters;
+       FillBlockData( bdRawClusters );
+       bdRawClusters.fOffset = tSize;
+       bdRawClusters.fSize = sizeof(AliHLTTPCRawClusterData)+outputRaw->fCount*sizeof(AliHLTTPCRawCluster);
+       bdRawClusters.fSpecification = iter->fSpecification;
+       bdRawClusters.fDataType = AliHLTTPCDefinitions::fgkRawClustersDataType;
+       outputBlocks.push_back( bdRawClusters );
+       fBenchmark.AddOutput(bdRawClusters.fSize);
+       tSize+=bdRawClusters.fSize;
       }
     }
 
   if (iResult>=0)
     size = tSize;
 
+  fBenchmark.Stop(0);  
+  HLTInfo(fBenchmark.GetStatistics());
   return iResult;
 }
 
@@ -657,6 +689,11 @@ int AliHLTTPCClusterFinderComponent::ScanConfigurationArgument(int argc, const c
     HLTDebug("Setting fReleaseMemory to true.");
     return 1;
   }
+  if (argument.CompareTo("-publish-raw")==0) {
+    fPublishRawClusters=kTRUE;
+    fClusterFinder->SetFillRawClusters(fPublishRawClusters);
+    return 1;
+  }
 
   if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
     if(argument.CompareTo("activepads" )==0){
@@ -722,25 +759,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;
@@ -902,3 +929,53 @@ 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
+  switch(fModeSwitch){
+  case kClusterFinderPacked:
+    // deprecated but kept for a short while to support porting to release
+    targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderPacked"),   new TObjString("component arguments, empty at the moment"));
+    break;
+  case kClusterFinderUnpacked:
+    targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderUnpacked"), new TObjString("component arguments, empty at the moment"));
+    break;
+  case kClusterFinderDecoder:
+    // deprecated but kept for a short while to support porting to release
+    targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderDecoder"),  new TObjString("component arguments, empty at the moment"));
+    break;
+  case kClusterFinder32Bit: 
+    targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinder32Bit"),    new TObjString("component arguments, empty at the moment"));
+    break;
+  }
+  
+  // 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"));
+}