]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCASliceOutput.h
data transport between the tracker and the merger is optimized
[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 #include <cstdlib>
15 #include "AliHLTTPCCASliceTrack.h"
16 //Obsolete
17 #include "AliHLTTPCCAOutTrack.h"
18
19 /**
20  * @class AliHLTTPCCASliceOutput
21  *
22  * AliHLTTPCCASliceOutput class is used to store the output of AliHLTTPCCATracker{Component}
23  * and transport the output to AliHLTTPCCAGBMerger{Component}
24  *
25  * The class contains all the necessary information about TPC tracks, reconstructed in one slice.
26  * This includes the reconstructed track parameters and some compressed information
27  * about the assigned clusters: clusterId, position and amplitude.
28  *
29  */
30 class AliHLTTPCCASliceOutput
31 {
32   public:
33
34         struct outputControlStruct
35         {
36                 outputControlStruct() : fObsoleteOutput( 1 ), fDefaultOutput( 1 ), fOutputPtr( NULL ), fOutputMaxSize ( 0 ) {}
37                 int fObsoleteOutput;    //Enable Obsolete Output
38                 int fDefaultOutput;             //Enable Default Output
39                 char* fOutputPtr;               //Pointer to Output Space, NULL to allocate output space
40                 int fOutputMaxSize;             //Max Size of Output Data if Pointer to output space is given
41         };
42
43     GPUhd() int NTracks()                    const { return fNTracks;              }
44     GPUhd() int NTrackClusters()             const { return fNTrackClusters;       }
45
46     GPUhd() const AliHLTTPCCASliceTrack &Track( int i ) const { return fTracks[i]; }
47     GPUhd() unsigned char   ClusterRow     ( int i )  const { return fClusterRow[i]; }
48     GPUhd()  int   ClusterId     ( int i )  const { return fClusterId[i]; }
49     GPUhd() float2   ClusterUnpackedYZ ( int i )  const { return fClusterUnpackedYZ[i]; }
50     GPUhd() float    ClusterUnpackedX  ( int i )  const { return fClusterUnpackedX[i]; }
51
52     GPUhd() static int EstimateSize( int nOfTracks, int nOfTrackClusters );
53     void SetPointers(int nTracks = -1, int nTrackClusters = -1, const outputControlStruct* outputControl = NULL);
54         static void Allocate(AliHLTTPCCASliceOutput* &ptrOutput, int nTracks, int nTrackHits, outputControlStruct* outputControl);
55
56     GPUhd() void SetNTracks       ( int v )  { fNTracks = v;        }
57     GPUhd() void SetNTrackClusters( int v )  { fNTrackClusters = v; }
58
59     GPUhd() void SetTrack( int i, const AliHLTTPCCASliceTrack &v ) {  fTracks[i] = v; }
60     GPUhd() void SetClusterRow( int i, unsigned char v ) {  fClusterRow[i] = v; }
61     GPUhd() void SetClusterId( int i, int v ) {  fClusterId[i] = v; }
62     GPUhd() void SetClusterUnpackedYZ( int i, float2 v ) {  fClusterUnpackedYZ[i] = v; }
63     GPUhd() void SetClusterUnpackedX( int i, float v ) {  fClusterUnpackedX[i] = v; }
64
65         GPUhd() size_t OutputMemorySize() const { return(fMemorySize); }
66
67         //Obsolete Output
68
69     GPUhd()  int NOutTracks() const { return(fNOutTracks); }
70         GPUhd()  void SetNOutTracks(int val) { fNOutTracks = val; }
71     GPUhd()  AliHLTTPCCAOutTrack *OutTracks() const { return  fOutTracks; }
72     GPUhd()  const AliHLTTPCCAOutTrack &OutTrack( int index ) const { return fOutTracks[index]; }
73     GPUhd()  int NOutTrackHits() const { return  fNOutTrackHits; }
74         GPUhd()  void SetNOutTrackHits(int val) { fNOutTrackHits = val; }
75     GPUhd()  void SetOutTrackHit(int n, int val) { fOutTrackHits[n] = val; }
76     GPUhd()  int OutTrackHit( int i ) const { return  fOutTrackHits[i]; }
77
78   private:
79     AliHLTTPCCASliceOutput()
80         : fNTracks( 0 ), fNTrackClusters( 0 ), fTracks( 0 ),  fClusterId( 0 ), fClusterRow( 0 ), fClusterUnpackedYZ( 0 ), fClusterUnpackedX( 0 ),
81                 fMemorySize( 0 ), fNOutTracks(0), fNOutTrackHits(0), fOutTracks(0), fOutTrackHits(0) {}
82
83         ~AliHLTTPCCASliceOutput() {}
84     const AliHLTTPCCASliceOutput& operator=( const AliHLTTPCCASliceOutput& ) const { return *this; }
85     AliHLTTPCCASliceOutput( const AliHLTTPCCASliceOutput& );
86
87         GPUh() void SetMemorySize(size_t val) { fMemorySize = val; }
88
89     int fNTracks;                   // number of reconstructed tracks
90     int fNTrackClusters;            // total number of track clusters
91     AliHLTTPCCASliceTrack *fTracks; // pointer to reconstructed tracks
92     int   *fClusterId;              // pointer to cluster Id's ( packed slice, patch, cluster )
93     UChar_t  *fClusterRow;     // pointer to cluster row numbers
94     float2   *fClusterUnpackedYZ;    // pointer to cluster coordinates (temporary data, for debug proposes)
95     float    *fClusterUnpackedX;     // pointer to cluster coordinates (temporary data, for debug proposes)
96         size_t fMemorySize;                             // Amount of memory really used
97
98     // obsolete output
99
100         int fNOutTracks;
101         int fNOutTrackHits;
102     AliHLTTPCCAOutTrack *fOutTracks; // output array of the reconstructed tracks
103     int *fOutTrackHits;  // output array of ID's of the reconstructed hits
104
105         //Must be last element of this class, user has to make sure to allocate anough memory consecutive to class memory!
106         //This way the whole Slice Output is one consecutive Memory Segment
107     char fMemory[1]; // the memory where the pointers above point into
108
109 };
110
111 #endif