]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCGlobalMergerComponent.cxx
cleanup (Gaute)
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCGlobalMergerComponent.cxx
index d25266aaa05c3853cce0d83e46198e81b7b6dde5..81f1fa1c7dd7cdbf078f8134ee9cd3ecb46409a7 100644 (file)
@@ -1,11 +1,12 @@
 // $Id$
 
 /**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
  *                                                                        *
- * Authors: Matthias Richter <Matthias.Richter@ift.uib.no>                *
- *          Timm Steinbeck <timm@kip.uni-heidelberg.de>                   *
- *          for The ALICE Off-line Project.                               *
+ * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+ *                  Timm Steinbeck <timm@kip.uni-heidelberg.de>           *
+ *                  for The ALICE HLT Project.                            *
  *                                                                        *
  * Permission to use, copy, modify and distribute this software and its   *
  * documentation strictly for non-commercial purposes is hereby granted   *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// a TPC sector tracker processing component for the HLT                     //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
+/** @file   AliHLTTPCGlobalMergerComponent.cxx
+    @author Timm Steinbeck, Matthias Richter
+    @date   
+    @brief  HLT TPC global merger component.
+*/
 
 #if __GNUC__== 3
 using namespace std;
 #endif
 
 #include "AliHLTTPCGlobalMergerComponent.h"
-#include "AliL3Transform.h"
-#include "AliL3GlobalMerger.h"
-#include "AliL3Vertex.h"
-#include "AliL3VertexData.h"
-#include "AliL3TrackSegmentData.h"
-#include "AliL3TrackArray.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCGlobalMerger.h"
+#include "AliHLTTPCVertex.h"
+#include "AliHLTTPCVertexData.h"
+#include "AliHLTTPCTrackSegmentData.h"
+#include "AliHLTTPCTrackArray.h"
 #include "AliHLTTPCTrackletDataFormat.h"
-#include "AliL3SpacePointData.h"
+#include "AliHLTTPCSpacePointData.h"
 #include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCDefinitions.h"
 #include <stdlib.h>
 #include <errno.h>
 
@@ -45,37 +47,64 @@ AliHLTTPCGlobalMergerComponent gAliHLTTPCGlobalMergerComponent;
 ClassImp(AliHLTTPCGlobalMergerComponent)
 
 AliHLTTPCGlobalMergerComponent::AliHLTTPCGlobalMergerComponent()
-    {
-    fGlobalMerger = NULL;
-    fVertex = NULL;
-    }
+  :
+  fGlobalMerger(NULL),
+  fVertex(NULL)
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTTPCGlobalMergerComponent::AliHLTTPCGlobalMergerComponent(const AliHLTTPCGlobalMergerComponent&)
+  :
+  fGlobalMerger(NULL),
+  fVertex(NULL)
+{
+  // see header file for class documentation
+  HLTFatal("copy constructor untested");
+}
+
+AliHLTTPCGlobalMergerComponent& AliHLTTPCGlobalMergerComponent::operator=(const AliHLTTPCGlobalMergerComponent&)
+{ 
+  // see header file for class documentation
+  HLTFatal("assignment operator untested");
+  return *this;
+}
 
 AliHLTTPCGlobalMergerComponent::~AliHLTTPCGlobalMergerComponent()
-    {
-    }
+{
+  // see header file for class documentation
+}
 
 // Public functions to implement AliHLTComponent's interface.
 // These functions are required for the registration process
 
 const char* AliHLTTPCGlobalMergerComponent::GetComponentID()
     {
+  // see header file for class documentation
     return "TPCGlobalMerger";
     }
 
-void AliHLTTPCGlobalMergerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
+void AliHLTTPCGlobalMergerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
     {
+  // see header file for class documentation
     list.clear();
-    list.push_back( AliHLTTPCDefinitions::gkTrackSegmentsDataType );
-    list.push_back( AliHLTTPCDefinitions::gkVertexDataType );
+    list.push_back( AliHLTTPCDefinitions::fgkTrackSegmentsDataType );
+    list.push_back( AliHLTTPCDefinitions::fgkVertexDataType );
     }
 
-AliHLTComponent_DataType AliHLTTPCGlobalMergerComponent::GetOutputDataType()
+AliHLTComponentDataType AliHLTTPCGlobalMergerComponent::GetOutputDataType()
     {
-    return AliHLTTPCDefinitions::gkTrackSegmentsDataType;
+  // see header file for class documentation
+    return AliHLTTPCDefinitions::fgkTracksDataType;
     }
 
 void AliHLTTPCGlobalMergerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
     {
+  // see header file for class documentation
     // XXX TODO: Find more realistic values.
     constBase = 0;
     inputMultiplier = 1.0;
@@ -83,26 +112,30 @@ void AliHLTTPCGlobalMergerComponent::GetOutputDataSize( unsigned long& constBase
 
 AliHLTComponent* AliHLTTPCGlobalMergerComponent::Spawn()
     {
+  // see header file for class documentation
     return new AliHLTTPCGlobalMergerComponent;
     }
 
 void AliHLTTPCGlobalMergerComponent::SetMergerParameters(Double_t maxy,Double_t maxz,Double_t maxkappa,Double_t maxpsi,Double_t maxtgl)
     {
+  // see header file for class documentation
     fGlobalMerger->SetParameter( maxy, maxz, maxkappa, maxpsi, maxtgl );
     }
 
 int AliHLTTPCGlobalMergerComponent::DoInit( int argc, const char** argv )
     {
+  // see header file for class documentation
     if ( fGlobalMerger || fVertex )
        return EINPROGRESS;
-    fGlobalMerger = new AliL3GlobalMerger();
-    fVertex = new AliL3Vertex();
+    fGlobalMerger = new AliHLTTPCGlobalMerger();
+    fVertex = new AliHLTTPCVertex();
     SetMergerParameters();
     return 0;
     }
 
 int AliHLTTPCGlobalMergerComponent::DoDeinit()
     {
+  // see header file for class documentation
     if ( fGlobalMerger )
        delete fGlobalMerger;
     fGlobalMerger = NULL;
@@ -112,12 +145,13 @@ int AliHLTTPCGlobalMergerComponent::DoDeinit()
     return 0;
     }
 
-int AliHLTTPCGlobalMergerComponent::DoEvent( const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks, 
-                                             AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr, 
-                                             AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks )
+int AliHLTTPCGlobalMergerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
+                                             AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
+                                             AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
     {
-    const AliHLTComponent_BlockData* iter = NULL;
-    const AliHLTComponent_BlockData* lastVertexBlock = NULL;
+  // see header file for class documentation
+    const AliHLTComponentBlockData* iter = NULL;
+    const AliHLTComponentBlockData* lastVertexBlock = NULL;
     unsigned long ndx;
 
     std::vector<SliceData> slices;
@@ -144,7 +178,7 @@ int AliHLTTPCGlobalMergerComponent::DoEvent( const AliHLTComponent_EventData& ev
                break;
            sdIter++;
            }
-       if ( sdIter->fSlice>slice || sdIter==sdEnd )
+       if ( sdIter==sdEnd || sdIter->fSlice>slice )
            {
            if ( sdIter == sdEnd )
                maxSlice = slice;
@@ -160,7 +194,7 @@ int AliHLTTPCGlobalMergerComponent::DoEvent( const AliHLTComponent_EventData& ev
            }
        if ( sdIter->fSlice == slice )
            {
-           if ( iter->fDataType == AliHLTTPCDefinitions::gkTrackSegmentsDataType )
+           if ( iter->fDataType == AliHLTTPCDefinitions::fgkTrackSegmentsDataType )
                {
                if ( !sdIter->fTrackletBlock )
                    {
@@ -174,7 +208,7 @@ int AliHLTTPCGlobalMergerComponent::DoEvent( const AliHLTComponent_EventData& ev
                             slice, evtData.fEventID, evtData.fEventID, sdIter->fTrackletBlockIndex, ndx );
                    }
                }
-           if ( iter->fDataType == AliHLTTPCDefinitions::gkVertexDataType )
+           if ( iter->fDataType == AliHLTTPCDefinitions::fgkVertexDataType )
                {
                lastVertexBlock = iter;
                if ( !sdIter->fVertexBlock )
@@ -192,44 +226,55 @@ int AliHLTTPCGlobalMergerComponent::DoEvent( const AliHLTComponent_EventData& ev
            }
        }
 
-    fGlobalMerger->Setup( minSlice, maxSlice );
+    //fGlobalMerger->Setup( minSlice, maxSlice );
+    fGlobalMerger->Setup( 0, 35 );
 
     if ( !lastVertexBlock )
        {
-       Logging( kHLTLogError, "HLT::GlobalMerger::DoEvent", "No vertex data block",
+       Logging( kHLTLogInfo, "HLT::GlobalMerger::DoEvent", "No vertex data block",
                 "No vertex data block found  for event  0x%08lX (%lu).", evtData.fEventID, evtData.fEventID );
        fVertex->SetZero();
        }
     else
-       fVertex->Read( (AliL3VertexData*)( lastVertexBlock->fPtr ) );
+       fVertex->Read( (AliHLTTPCVertexData*)( lastVertexBlock->fPtr ) );
 
     // Add all tracks into the merger
     sdIter = slices.begin();
     sdEnd = slices.end();
+    int lastSlice = -1;
     while ( sdIter != sdEnd )
        {
        if ( sdIter->fVertexBlock )
            {
-           fVertex->Read( (AliL3VertexData*)( sdIter->fVertexBlock->fPtr ) );
+           fVertex->Read( (AliHLTTPCVertexData*)( sdIter->fVertexBlock->fPtr ) );
            fGlobalMerger->SetVertex( fVertex );
            }
-       inPtr = (AliHLTTPCTrackletData*)( sdIter->fTrackletBlock->fPtr );
-       if ( !inPtr )
+       for ( int slNr=lastSlice+1; slNr<=sdIter->fSlice; slNr++ )
+           fGlobalMerger->InitSlice( slNr );
+        if ( sdIter->fTrackletBlock )
            {
-           Logging( kHLTLogError, "HLT::GlobalMerger::DoEvent", "No track data block",
-                    "No track data block found  for event  0x%08lX (%lu).", evtData.fEventID, evtData.fEventID );
+           inPtr = (AliHLTTPCTrackletData*)( sdIter->fTrackletBlock->fPtr );
+           if ( !inPtr )
+                 {
+                 Logging( kHLTLogError, "HLT::GlobalMerger::DoEvent", "No track data block",
+                          "No track data block found  for event  0x%08lX (%lu).", evtData.fEventID, evtData.fEventID );
+                 }
+           else
+               {
+               //fGlobalMerger->InitSlice( sdIter->fSlice );
+               fGlobalMerger->FillTracks( inPtr->fTrackletCnt, inPtr->fTracklets );
+               } 
            }
-       else
-           {
-           fGlobalMerger->InitSlice( sdIter->fSlice );
-           fGlobalMerger->FillTracks( inPtr->fTrackletCnt, inPtr->fTracklets );
-           }
-       
+       lastSlice = sdIter->fSlice;
        sdIter++;
        }
+    for ( int slNr=lastSlice+1; slNr<=35; slNr++ )
+        fGlobalMerger->InitSlice( slNr );
+    
 
     // Now we can really merge
     fGlobalMerger->Merge();
+    fGlobalMerger->AddAllTracks();
 
     UInt_t ntracks0=0;
     outPtr = (AliHLTTPCTrackletData*)(outputPtr);
@@ -239,7 +284,7 @@ int AliHLTTPCGlobalMergerComponent::DoEvent( const AliHLTComponent_EventData& ev
 
     tSize += sizeof(AliHLTTPCTrackletData);
 
-    AliHLTComponent_BlockData bd;
+    AliHLTComponentBlockData bd;
     FillBlockData( bd );
     bd.fOffset = 0;
     bd.fSize = tSize;