]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliFlatTPCseed.h
Merge branch 'master_patch'
[u/mrichter/AliRoot.git] / HLT / global / AliFlatTPCseed.h
1 #ifndef ALIFLATTPCSEED_H
2 #define ALIFLATTPCSEED_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               *
6  * Primary Authors : Sergey Gorbunov, Jochen Thaeder, Chiara Zampolli     */
7
8 /*
9  * See implementation file for documentation
10  */
11
12
13 #include "Rtypes.h"
14
15 #include "AliFlatTPCCluster.h"
16 #include "AliVfriendTrack.h"
17 #include "AliVMisc.h"
18 #include "AliFlatExternalTrackParam.h"
19 #include "AliTPCseed.h"
20
21 class AliESDtrack;
22 class AliESDfriendTrack;
23 class AliExternalTrackParam;
24
25 class AliFlatTPCseed  
26 {
27  public:
28
29   // --------------------------------------------------------------------------------
30   // -- Constructor / Destructors
31   AliFlatTPCseed();
32   ~AliFlatTPCseed() {}
33  
34   // constructor and method for reinitialisation of virtual table  
35   AliFlatTPCseed( AliVConstructorReinitialisationFlag );
36   void Reinitialize() { new (this) AliFlatTPCseed( AliVReinitialize ); }
37
38   // -- Getters 
39
40   void GetTPCseed( AliTPCseed *p ) const;
41
42   Int_t GetLabel() const { return fLabel; }
43   Int_t GetNClusters() const { return fNTPCClusters; }
44
45   const AliFlatTPCCluster *GetClusters() const { return reinterpret_cast< const AliFlatTPCCluster* >( fContent ); }
46   AliFlatTPCCluster *GetClustersNonConst(){ return reinterpret_cast< AliFlatTPCCluster* >( fContent ); }
47
48   // -- Set methods
49  
50   void Reset();
51
52   void SetFromTPCseed( const AliTPCseed *p );
53
54   void SetExternalTrackParam( const AliExternalTrackParam* p ){ fParam.SetExternalTrackParam(  p ); }
55
56   void SetLabel( Int_t lab ){ fLabel=lab; }
57
58   void AddCluster( const AliTPCclusterMI *cl, const AliTPCTrackerPoint *p ){
59                 if(cl){
60                         GetClustersNonConst()[fNTPCClusters++].SetTPCCluster( cl, p );
61                         fContentSize+=sizeof(AliFlatTPCCluster);
62                 }
63         }
64
65
66   // --------------------------------------------------------------------------------
67   // -- Size methods
68
69   static size_t EstimateSize(){
70     return sizeof(AliFlatTPCseed) + 160*sizeof(AliFlatTPCCluster);
71   }
72
73   size_t GetSize() const { return fContent -  reinterpret_cast<const Byte_t*>(this) + fContentSize; }
74
75  private: 
76
77   AliFlatTPCseed(const AliFlatTPCseed &);
78   AliFlatTPCseed& operator=(const AliFlatTPCseed& ); 
79
80   // --------------------------------------------------------------------------------
81
82   ULong64_t fContentSize;                      // Size of this object
83   
84   // --------------------------------------------------------------------------------
85   
86   AliFlatExternalTrackParam fParam;
87   Int_t fLabel;
88   Int_t fNTPCClusters;
89   Byte_t fContent[1];                  // Variale size object, which contains all data
90
91 };
92
93 inline AliFlatTPCseed::AliFlatTPCseed()
94   :
95   fContentSize(0),
96   fParam(),
97   fLabel(-1),
98   fNTPCClusters(0)
99 {
100   // constructor
101   fContent[0]=0;
102 }
103
104 #pragma GCC diagnostic ignored "-Weffc++" 
105 inline AliFlatTPCseed::AliFlatTPCseed( AliVConstructorReinitialisationFlag  )
106 {
107   // reinitialise vtable
108   fParam.Reinitialize();
109   AliFlatTPCCluster *clusters = reinterpret_cast< AliFlatTPCCluster* >( fContent );  
110   for( Int_t ic=0; ic<fNTPCClusters; ic++ ){
111     clusters[ic].Reinitialize();
112   }
113 }
114 #pragma GCC diagnostic warning "-Weffc++" 
115
116
117 inline void AliFlatTPCseed::Reset()
118 {
119   // Reset
120   fContentSize = 0;
121   fNTPCClusters = 0;
122   fLabel=-1;
123 }
124
125 #endif