]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCASliceOutput.h
05a2a6267d37f66db42d18059079dd88437483fc
[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 #include "AliHLTTPCCASliceTrack.h"
16
17 /**
18  * @class AliHLTTPCCASliceOutput
19  *
20  * AliHLTTPCCASliceOutput class is used to store the output of AliHLTTPCCATracker{Component}
21  * and transport the output to AliHLTTPCCAGBMerger{Component}
22  *
23  * The class contains all the necessary information about TPC tracks, reconstructed in one slice.
24  * This includes the reconstructed track parameters and some compressed information 
25  * about the assigned clusters: clusterId, position and amplitude.
26  *
27  */
28 class AliHLTTPCCASliceOutput
29 {
30  public:
31
32   GPUhd() Int_t NTracks()                    const { return fNTracks;              }
33   GPUhd() Int_t NTrackClusters()             const { return fNTrackClusters;       }
34
35   GPUhd() const AliHLTTPCCASliceTrack &Track( Int_t i ) const { return fTracks[i]; }
36   GPUhd() UInt_t   ClusterIDrc     ( Int_t i )  const { return fClusterIDrc[i]; }
37   GPUhd() UShort_t ClusterPackedYZ ( Int_t i )  const { return fClusterPackedYZ[i]; }
38   GPUhd() UChar_t  ClusterPackedAmp( Int_t i )  const { return fClusterPackedAmp[i]; }
39   GPUhd() float2   ClusterUnpackedYZ ( Int_t i )  const { return fClusterUnpackedYZ[i]; }
40   GPUhd() float    ClusterUnpackedX  ( Int_t i )  const { return fClusterUnpackedX[i]; }
41
42   GPUhd() static Int_t EstimateSize( Int_t nOfTracks, Int_t nOfTrackClusters );
43   GPUhd() void SetPointers();
44
45   GPUhd() void SetNTracks       ( Int_t v )  { fNTracks = v;        }
46   GPUhd() void SetNTrackClusters( Int_t v )  { fNTrackClusters = v; }
47
48   GPUhd() void SetTrack( Int_t i, const AliHLTTPCCASliceTrack &v ) {  fTracks[i] = v; }
49   GPUhd() void SetClusterIDrc( Int_t i, UInt_t v ) {  fClusterIDrc[i] = v; }
50   GPUhd() void SetClusterPackedYZ( Int_t i, UShort_t v ) {  fClusterPackedYZ[i] = v; }
51   GPUhd() void SetClusterPackedAmp( Int_t i, UChar_t v ) {  fClusterPackedAmp[i] = v; }
52   GPUhd() void SetClusterUnpackedYZ( Int_t i, float2 v ) {  fClusterUnpackedYZ[i] = v; }
53   GPUhd() void SetClusterUnpackedX( Int_t i, float v ) {  fClusterUnpackedX[i] = v; }
54
55  private:
56
57   AliHLTTPCCASliceOutput( const AliHLTTPCCASliceOutput& )
58     : fNTracks(0),fNTrackClusters(0),fTracks(0),fClusterIDrc(0), fClusterPackedYZ(0),fClusterUnpackedYZ(0),fClusterUnpackedX(0),fClusterPackedAmp(0){}
59
60   const AliHLTTPCCASliceOutput& operator=( const AliHLTTPCCASliceOutput& ) const { return *this; }
61
62   Int_t fNTracks;                 // number of reconstructed tracks
63   Int_t fNTrackClusters;          // total number of track clusters
64   AliHLTTPCCASliceTrack *fTracks; // pointer to reconstructed tracks
65   UInt_t   *fClusterIDrc;         // pointer to cluster IDs ( packed IRow and ICluster)
66   UShort_t *fClusterPackedYZ;     // pointer to packed cluster YZ coordinates 
67   float2   *fClusterUnpackedYZ;   // pointer to cluster coordinates (temporary data, for debug proposes)
68   float    *fClusterUnpackedX;   // pointer to cluster coordinates (temporary data, for debug proposes)
69   UChar_t  *fClusterPackedAmp;    // pointer to packed cluster amplitudes
70
71 };
72
73
74
75 GPUhd() inline Int_t AliHLTTPCCASliceOutput::EstimateSize( Int_t nOfTracks, Int_t nOfTrackClusters )
76 {
77   // calculate the amount of memory [bytes] needed for the event
78
79   const Int_t kClusterDataSize = sizeof(UInt_t) + sizeof(UShort_t) + sizeof(float2) + sizeof(float)+ sizeof(UChar_t);
80
81   return sizeof(AliHLTTPCCASliceOutput) + sizeof(AliHLTTPCCASliceTrack)*nOfTracks + kClusterDataSize*nOfTrackClusters;
82 }
83
84
85 GPUhd() inline void AliHLTTPCCASliceOutput::SetPointers()
86 {
87   // set all pointers
88
89   fTracks            = (AliHLTTPCCASliceTrack*)((&fClusterPackedAmp)+1);
90   fClusterUnpackedYZ = (float2*)  ( fTracks   + fNTracks );
91   fClusterUnpackedX  = (float*)   ( fClusterUnpackedYZ + fNTrackClusters );
92   fClusterIDrc       = (UInt_t*)  ( fClusterUnpackedX  + fNTrackClusters );
93   fClusterPackedYZ   = (UShort_t*)( fClusterIDrc       + fNTrackClusters );
94   fClusterPackedAmp  = (UChar_t*) ( fClusterPackedYZ + fNTrackClusters );
95 }
96
97 #endif