]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCASliceOutput.h
Update master to aliroot
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCASliceOutput.h
1 //-*- Mode: C++ -*-
2 // ************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project        *
4 // ALICE Experiment at CERN, All rights reserved.                         *
5 // See cxx source for full Copyright notice                               *
6 //                                                                        *
7 //*************************************************************************
8
9
10 #ifndef ALIHLTTPCCASLICEOUTPUT_H
11 #define ALIHLTTPCCASLICEOUTPUT_H
12
13 #include "AliHLTTPCCADef.h"
14
15 #if !defined(__OPENCL__) || defined(HLTCA_HOSTCODE)
16
17 #include <cstdlib>
18 #ifndef HLTCA_GPUCODE
19 #include "AliHLTTPCCASliceOutTrack.h"
20 #else
21 class AliHLTTPCCASliceOutTrack;
22 #endif
23 #else
24 #define NULL 0
25 #endif
26
27
28 /**
29  * @class AliHLTTPCCASliceOutput
30  *
31  * AliHLTTPCCASliceOutput class is used to store the output of AliHLTTPCCATracker{Component}
32  * and transport the output to AliHLTTPCCAGBMerger{Component}
33  *
34  * The class contains all the necessary information about TPC tracks, reconstructed in one slice.
35  * This includes the reconstructed track parameters and some compressed information
36  * about the assigned clusters: clusterId, position and amplitude.
37  *
38  */
39 class AliHLTTPCCASliceOutput
40 {
41   public:
42
43   struct outputControlStruct
44   {
45     outputControlStruct() :  fOutputPtr( NULL ), fOutputMaxSize ( 0 ), fEndOfSpace(0) {}
46     char* volatile fOutputPtr;          //Pointer to Output Space, NULL to allocate output space
47     volatile int fOutputMaxSize;                //Max Size of Output Data if Pointer to output space is given
48     bool fEndOfSpace; // end of space flag 
49   };
50
51 #if !defined(__OPENCL__) || defined(HLTCA_HOSTCODE)
52   GPUhd() int NTracks()                    const { return fNTracks;              }
53   GPUhd() int NLocalTracks()               const { return fNLocalTracks;         }
54   GPUhd() int NTrackClusters()             const { return fNTrackClusters;       }  
55 #ifndef HLTCA_GPUCODE
56   GPUhd() const AliHLTTPCCASliceOutTrack *GetFirstTrack() const { return fMemory; }
57   GPUhd() AliHLTTPCCASliceOutTrack *FirstTrack(){ return fMemory; }
58 #endif
59   GPUhd() size_t Size() const { return(fMemorySize); }
60
61   static int EstimateSize( int nOfTracks, int nOfTrackClusters );
62   static void Allocate(AliHLTTPCCASliceOutput* &ptrOutput, int nTracks, int nTrackHits, outputControlStruct* outputControl);
63
64   GPUhd() void SetNTracks       ( int v )  { fNTracks = v;        }
65   GPUhd() void SetNLocalTracks  ( int v )  { fNLocalTracks = v;   }
66   GPUhd() void SetNTrackClusters( int v )  { fNTrackClusters = v; }
67
68   private:
69
70   AliHLTTPCCASliceOutput()
71     : fNTracks( 0 ), fNLocalTracks( 0 ), fNTrackClusters( 0 ), fMemorySize( 0 ){}
72   
73   ~AliHLTTPCCASliceOutput() {}
74   AliHLTTPCCASliceOutput( const AliHLTTPCCASliceOutput& );
75   AliHLTTPCCASliceOutput& operator=( const AliHLTTPCCASliceOutput& ) { return *this; }
76
77   GPUh() void SetMemorySize(size_t val) { fMemorySize = val; }
78
79   int fNTracks;                   // number of reconstructed tracks
80   int fNLocalTracks;
81   int fNTrackClusters;            // total number of track clusters
82   size_t fMemorySize;           // Amount of memory really used
83
84   //Must be last element of this class, user has to make sure to allocate anough memory consecutive to class memory!
85   //This way the whole Slice Output is one consecutive Memory Segment
86
87 #ifndef HLTCA_GPUCODE
88   AliHLTTPCCASliceOutTrack fMemory[0]; // the memory where the pointers above point into
89 #endif
90 #endif
91
92 };
93 #endif