]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TRD/AliHLTTRDClusterizerComponent.cxx
extending trigger agent and it's HLTOUT handler
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDClusterizerComponent.cxx
index 9a38587e89e7438f7119aaba36c7f22e49343c98..09e88dfcc34a36b2c325590a668f586e35683e43 100644 (file)
@@ -63,10 +63,13 @@ using namespace std;
 #include <cerrno>
 #include <string>
 
+#include "AliTRDrawStream.h"
+#include "AliTRDrawFastStream.h"
+
 ClassImp(AliHLTTRDClusterizerComponent)
    
-AliHLTTRDClusterizerComponent::AliHLTTRDClusterizerComponent():
-  AliHLTProcessor(),
+AliHLTTRDClusterizerComponent::AliHLTTRDClusterizerComponent()
+: AliHLTProcessor(),
   fOutputPercentage(500),
   fOutputConst(0),
   fClusterizer(NULL),
@@ -79,7 +82,8 @@ AliHLTTRDClusterizerComponent::AliHLTTRDClusterizerComponent():
   fyPosMethod(1),
   fgeometryFileName(""),
   fProcessTracklets(kFALSE),
-  fHLTstreamer(kFALSE)
+  fHLTstreamer(kTRUE),
+  fTC(kFALSE)
 {
   // Default constructor
 
@@ -102,10 +106,10 @@ void AliHLTTRDClusterizerComponent::GetInputDataTypes( vector<AliHLTComponent_Da
 {
   // Get the list of input data
   list.clear(); // We do not have any requirements for our input data type(s).
-  list.push_back( (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD) );
+  list.push_back(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD);
 }
 
-AliHLTComponent_DataType AliHLTTRDClusterizerComponent::GetOutputDataType()
+AliHLTComponentDataType AliHLTTRDClusterizerComponent::GetOutputDataType()
 {
   // Get the output data type
   return kAliHLTMultipleDataType;
@@ -169,7 +173,7 @@ int AliHLTTRDClusterizerComponent::DoInit( int argc, const char** argv )
 
   if(fReconstructor->IsProcessingTracklets())
     fOutputConst = fClusterizer->GetTrMemBlockSize();
-  
+
   return iResult;
 }
 
@@ -270,10 +274,10 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD
       fMemReader->SetEquipmentID( id ); 
       
       fClusterizer->SetMemBlock(outputPtr+offset);
-      Bool_t iclustered = fClusterizer->Raw2ClustersChamber(fMemReader);
-      if (iclustered == kTRUE)
+      Bool_t bclustered = fClusterizer->Raw2ClustersChamber(fMemReader);
+      if(bclustered)
        {
-         HLTDebug( "Clustered successfully");
+         HLTDebug("Clustered successfully");
        }
       else
        {
@@ -281,9 +285,6 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD
          return -1;
        }
 
-      // put the tree into output
-      //fcTree->Print();
-      
       AliHLTUInt32_t addedSize;
       if(fReconstructor->IsProcessingTracklets()){
        addedSize = fClusterizer->GetAddedTrSize();
@@ -306,15 +307,18 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD
          bd.fSpecification = block.fSpecification;
          bd.fDataType = AliHLTTRDDefinitions::fgkMCMtrackletDataType;
          outputBlocks.push_back( bd );
-         HLTDebug( "BD fPtr 0x%x, fOffset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec);
+         HLTDebug( "BD ptr 0x%x, offset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec);
        }
        offset = totalSize;
       }
 
       addedSize = fClusterizer->GetAddedClSize();
       if (addedSize > 0){
-       // Using low-level interface 
-       // with interface classes
+       
+       Int_t* nTimeBins = (Int_t*)(outputPtr+offset+fClusterizer->GetAddedClSize());
+       *nTimeBins = fClusterizer->GetNTimeBins();
+       addedSize += sizeof(*nTimeBins);
+
        totalSize += addedSize;
        if ( totalSize > size )
          {
@@ -322,7 +326,7 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD
                     totalSize, size );
            return EMSGSIZE;
          }
-               
+
        // Fill block 
        AliHLTComponentBlockData bd;
        FillBlockData( bd );
@@ -331,12 +335,12 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD
        bd.fSpecification = block.fSpecification;
        bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType;
        outputBlocks.push_back( bd );
-       HLTDebug( "BD fPtr 0x%x, fOffset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec);
+       HLTDebug( "BD ptr 0x%x, offset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec);
        offset = totalSize;
-             
       }
-      else 
+      else{
        HLTDebug("Array of clusters is empty!");
+      }
     }
   fReconstructor->SetClusters(0x0);
 
@@ -385,46 +389,56 @@ int AliHLTTRDClusterizerComponent::Configure(const char* arguments){
        fgeometryFileName=((TObjString*)pTokens->At(i))->GetString();
        continue;
       } 
-      if (argument.CompareTo("-lowflux")==0) {
+      else if (argument.CompareTo("-lowflux")==0) {
        fRecoParamType = 0;
        HLTInfo("Low flux reconstruction selected");
        continue;
       }
-      if (argument.CompareTo("-highflux")==0) {
+      else if (argument.CompareTo("-highflux")==0) {
        fRecoParamType = 1;
        HLTInfo("High flux reconstruction selected");
        continue;
       }
-      if (argument.CompareTo("-cosmics")==0) {
+      else if (argument.CompareTo("-cosmics")==0) {
        fRecoParamType = 2;
        HLTInfo("Cosmics reconstruction selected");
        continue;
       }
-      if (argument.CompareTo("-simulation")==0) {
+      else if (argument.CompareTo("-simulation")==0) {
        fRecoDataType = 0;
        HLTInfo("Awaiting simulated data");
        continue;
       }
-      if (argument.CompareTo("-experiment")==0) {
+      else if (argument.CompareTo("-experiment")==0) {
        fRecoDataType = 1;
        HLTInfo("Awaiting real data");
        continue;
       }
-      if (argument.CompareTo("-processTracklets")==0) {
+      else if (argument.CompareTo("-processTracklets")==0) {
        fProcessTracklets = kTRUE;
-       HLTInfo("Processing L1 Tracklets");
+       HLTInfo("Writing L1 tracklets to output");
        continue;
       }
-      if (argument.CompareTo("-noZS")==0) {
+      else if (argument.CompareTo("-noZS")==0) {
        fOutputPercentage = 100;
        HLTInfo("Awaiting non zero surpressed data");
        continue;
       }
-      if (argument.CompareTo("-faststreamer")==0) {
+      else if (argument.CompareTo("-faststreamer")==0) {
        fHLTstreamer = kTRUE;
        HLTInfo("Useing fast raw streamer");
        continue;
       }
+      else if (argument.CompareTo("-nofaststreamer")==0) {
+       fHLTstreamer = kFALSE;
+       HLTInfo("Don't use fast raw streamer");
+       continue;
+      }
+      else if (argument.CompareTo("-tailcancellation")==0) {
+       fTC = kTRUE;
+       HLTInfo("Useing tailcancellation");
+       continue;
+      }
       else if (argument.CompareTo("-rawver")==0) {
        if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
        HLTInfo("Raw data version is: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
@@ -452,7 +466,7 @@ int AliHLTTRDClusterizerComponent::Configure(const char* arguments){
          break;
        }
        continue;
-      } 
+      }
       
       else {
        HLTError("unknown argument: %s", argument.Data());
@@ -497,26 +511,13 @@ int AliHLTTRDClusterizerComponent::SetParams()
       HLTError("Could not load geometry");
       return -EINVAL;
     }
+    HLTInfo("Applying Alignment from CDB object");
+    AliGeomManager::ApplyAlignObjsFromCDB("TRD");
   }
   else{
     HLTInfo("Geometry Already Loaded!");
   }
 
-  TString recoOptions="hlt,!cw,sl_cl_0";
-
-  switch(fRecoDataType){
-  case 0: recoOptions += ",tc"; break;
-  case 1: recoOptions += ",!tc"; break;
-  }
-  switch(fyPosMethod){
-  case 0: recoOptions += ",!gs,!lut"; break;
-  case 1: recoOptions += ",!gs,lut"; break;
-  case 2: recoOptions += ",gs,!lut"; break;
-  }
-  if(fProcessTracklets) recoOptions += ",tp";
-  else  recoOptions += ",!tp";
-
-
   if (fRecoParamType == 0)
     {
       HLTDebug("Low flux params init.");
@@ -541,8 +542,32 @@ int AliHLTTRDClusterizerComponent::SetParams()
       return -EINVAL;
     }
 
+  // backward compatibility to AliTRDrecoParam < r34995
+# ifndef HAVE_NOT_ALITRDRECOPARAM_r34995
+#   define AliTRDRecoParamSetTailCancelation(b) fRecoParam->SetTailCancelation(b)
+#   define AliTRDRecoParamSetGAUS(b) fRecoParam->SetGAUS(b)
+#   define AliTRDRecoParamSetLUT(b) fRecoParam->SetLUT(b)
+# else
+#   define AliTRDRecoParamSetTailCancelation(b) fRecoParam->SetTailCancelation()
+#   define AliTRDRecoParamSetGAUS(b) fRecoParam->SetGAUS()
+#   define AliTRDRecoParamSetLUT(b) fRecoParam->SetLUT()
+# endif
+
+  if(fTC){AliTRDRecoParamSetTailCancelation(kTRUE); HLTDebug("Enableing Tail Cancelation"); }
+  else{AliTRDRecoParamSetTailCancelation(kFALSE); HLTDebug("Enableing Tail Cancelation"); }
+
+  switch(fyPosMethod){
+  case 0: AliTRDRecoParamSetGAUS(kFALSE); AliTRDRecoParamSetLUT(kFALSE); break;
+  case 1: AliTRDRecoParamSetGAUS(kFALSE); AliTRDRecoParamSetLUT(kTRUE); break;
+  case 2: AliTRDRecoParamSetGAUS(kTRUE); AliTRDRecoParamSetLUT(kFALSE); break;
+  }
+
+  fRecoParam->SetStreamLevel(AliTRDrecoParam::kClusterizer, 0);
   fReconstructor->SetRecoParam(fRecoParam);
-  fReconstructor->SetStreamLevel(0, AliTRDReconstructor::kClusterizer);
+
+  TString recoOptions="hlt,!cw";
+  if(fProcessTracklets) recoOptions += ",tp";
+  else  recoOptions += ",!tp";
 
   HLTDebug("Reconstructor options are: %s",recoOptions.Data());
   fReconstructor->SetOption(recoOptions.Data());