]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRecPoint.cxx
update info about cvs installation using cvs account
[u/mrichter/AliRoot.git] / STEER / AliRecPoint.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.4  2000/05/16 08:30:02  fca
19 Using automatic streamer for c arrays
20
21 Revision 1.3  2000/03/20 14:22:25  fca
22 New version to support new PHOS code
23
24 Revision 1.2  2000/02/15 09:43:54  fca
25 Corrections
26 - a bug in the streamer (wrong size of the arrays)
27 - replace Read/WriteArray by Read/WriteFastArray (suggestion R.Brun)
28
29 Revision 1.1  1999/12/17 09:01:14  fca
30 Y.Schutz new classes for reconstruction
31
32 */
33
34 //-*-C++-*-
35 //_________________________________________________________________________
36 // Base Class of Cluster (empty cxx needed by Root)
37 //*-- Author : Yves Schutz  SUBATECH 
38 //////////////////////////////////////////////////////////////////////////////
39
40 // --- ROOT system ---
41
42 #include "TObjArray.h"
43
44 // --- Standard library ---
45
46 // --- AliRoot header files ---
47
48 #include "AliRecPoint.h"
49
50 ClassImp(AliRecPoint)
51
52
53 //____________________________________________________________________________
54 AliRecPoint::AliRecPoint()
55 {
56   // ctor  
57   fAmp = 0.0 ; 
58   
59   fLocPos.SetXYZ(0., 0., 0.) ;
60   fLocPosM     = new TMatrix(3,3) ;
61   fMaxDigit    = 100 ; 
62   fMulDigit    = 0 ; 
63   fDigitsList  = new int[fMaxDigit]; ; 
64   fMaxTrack    = 5 ; 
65   fMulTrack    = 0 ; 
66   fTracksList  = new int[fMaxTrack]; ; 
67   fIndexInList = -1 ; // to be set when the point is already stored
68 }
69
70 //____________________________________________________________________________
71 AliRecPoint::AliRecPoint(const AliRecPoint& recp)
72 {
73   //
74   // Copy constructor
75   //
76   recp.Copy(*this);
77 }
78
79 //____________________________________________________________________________
80 AliRecPoint::~AliRecPoint()
81 {
82   // dtor
83   
84   delete fLocPosM ; 
85   if ( fDigitsList )    
86     delete fDigitsList ; 
87   if ( fTracksList )    
88     delete fTracksList ;  
89   
90 }
91   
92 //____________________________________________________________________________
93 void AliRecPoint::AddDigit(AliDigitNew & digit)
94 {
95   // adds a digit to the digits list
96   // and accumulates the total amplitude and the multiplicity 
97   
98   
99   if ( fMulDigit >= fMaxDigit ) { // increase the size of the list 
100     int * tempo = new ( int[fMaxDigit*=2] ) ; 
101     
102     Int_t index ; 
103     
104     for ( index = 0 ; index < fMulDigit ; index++ )
105       tempo[index] = fDigitsList[index] ; 
106     
107     delete fDigitsList ; 
108     fDigitsList = tempo ; 
109   }
110   
111   fDigitsList[fMulDigit] = digit.GetIndexInList()  ; 
112   fMulDigit++ ; 
113   fAmp += digit.GetAmp() ; 
114 }
115
116 //____________________________________________________________________________
117 // void AliRecPoint::AddTrack(AliTrack & track)
118 // {
119 //   // adds a digit to the digits list
120 //   // and accumulates the total amplitude and the multiplicity 
121
122
123 //   if ( fMulTrack >= fMaxTrack ) { // increase the size of the list 
124 //     int * tempo = new int[fMaxTrack*=2] ; 
125 //     Int_t index ; 
126 //     for ( index = 0 ; index < fMulTrack ; index++ )
127 //       tempo[index] = fTracksList[index] ; 
128 //     delete fTracksList ; 
129 //     fTracksList = tempo ; 
130 //   }
131
132 //   fTracksList[fMulTrack++]=  (int) &Track  ; 
133 // }
134
135 //____________________________________________________________________________
136 void AliRecPoint::Copy(AliRecPoint& recp) const
137 {
138   //
139   // Copy *this onto pts
140   //
141   // Copy all first
142   if(this != &recp) {
143     ((TObject*) this)->Copy((TObject&)recp);
144     recp.fAmp = fAmp;
145     recp.fGeom = fGeom;
146     recp.fIndexInList = fIndexInList;
147     recp.fLocPos = fLocPos;
148     recp.fLocPosM = new TMatrix(*fLocPosM);
149     recp.fMaxDigit = fMaxDigit;
150     recp.fMulDigit = fMulDigit;
151     recp.fMaxTrack = fMaxTrack;
152     recp.fMulTrack = fMulTrack;
153     
154     // Duplicate pointed objects
155     recp.fDigitsList = new Int_t[fMulDigit];
156     memcpy(recp.fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t));
157     recp.fTracksList = new Int_t[fMulTrack];
158     memcpy(recp.fTracksList,fTracksList,fMulTrack*sizeof(Int_t));
159   }
160 }
161
162 //____________________________________________________________________________
163 void AliRecPoint::GetCovarianceMatrix(TMatrix & mat)
164 {
165   // returns the covariant matrix for the local position
166   
167   mat = *fLocPosM ; 
168
169 }
170
171 //____________________________________________________________________________
172 void AliRecPoint::GetLocalPosition(TVector3 & pos)
173 {
174   // returns the position of the cluster in the local reference system of the sub-detector
175
176   pos = fLocPos;
177
178  
179 }
180
181 //____________________________________________________________________________
182 AliRecPoint & AliRecPoint::operator= (const AliRecPoint &recp)
183 {
184   recp.Copy(*this);
185   return (*this);
186 }
187
188
189 //____________________________________________________________________________
190 void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat)
191 {
192   // returns the position of the cluster in the global reference system of ALICE
193   // and the uncertainty on this position
194   
195
196   fGeom->GetGlobal(this, gpos, gmat) ;
197  
198 }
199
200