]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRecPoint.cxx
Change fgkRpadW to 1.0 cm for new pad plane
[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.9  2001/12/05 14:36:47  hristov
19 The default constructor now creates no objects; destructor corrected (thanks to R.Brun).
20
21 Revision 1.8  2001/10/21 18:38:43  hristov
22 Several pointers were set to zero in the default constructors to avoid memory management problems
23
24 Revision 1.7  2000/11/30 07:12:49  alibrary
25 Introducing new Rndm and QA classes
26
27 Revision 1.6  2000/10/02 21:28:14  fca
28 Removal of useless dependecies via forward declarations
29
30 Revision 1.5  2000/07/11 18:24:59  fca
31 Coding convention corrections + few minor bug fixes
32
33 Revision 1.4  2000/05/16 08:30:02  fca
34 Using automatic streamer for c arrays
35
36 Revision 1.3  2000/03/20 14:22:25  fca
37 New version to support new PHOS code
38
39 Revision 1.2  2000/02/15 09:43:54  fca
40 Corrections
41 - a bug in the streamer (wrong size of the arrays)
42 - replace Read/WriteArray by Read/WriteFastArray (suggestion R.Brun)
43
44 Revision 1.1  1999/12/17 09:01:14  fca
45 Y.Schutz new classes for reconstruction
46
47 */
48
49 //-*-C++-*-
50 //_________________________________________________________________________
51 // Base Class for reconstructed space points 
52 // usually coming from the clusterisation algorithms
53 // run on the digits
54 //
55 //*-- Author : Yves Schutz  SUBATECH 
56 //////////////////////////////////////////////////////////////////////////////
57
58
59 // --- ROOT system ---
60
61 // --- Standard library ---
62
63 // --- AliRoot header files ---
64
65 #include "AliRecPoint.h"
66 #include "AliGeometry.h"
67 #include "AliDigitNew.h"
68
69 ClassImp(AliRecPoint)
70
71
72 //_______________________________________________________________________
73 AliRecPoint::AliRecPoint():
74   fAmp(0),
75   fGeom(0),
76   fIndexInList(-1), // to be set when the point is already stored
77   fLocPos(0,0,0),
78   fLocPosM(0),
79   fMaxDigit(100),
80   fMulDigit(0),
81   fMaxTrack(5),
82   fMulTrack(0),
83   fDigitsList(0),
84   fTracksList(0)
85 {
86   //
87   // default ctor  
88   //
89 }
90
91 //_______________________________________________________________________
92 AliRecPoint::AliRecPoint(const char * ):
93   fAmp(0),
94   fGeom(0),
95   fIndexInList(-1), // to be set when the point is already stored
96   fLocPos(0,0,0),
97   fLocPosM(new TMatrix(3,3)),
98   fMaxDigit(100),
99   fMulDigit(0),
100   fMaxTrack(5),
101   fMulTrack(0),
102   fDigitsList(new int[fMaxDigit]),
103   fTracksList(new int[fMaxTrack])
104 {
105   //
106   // Standard ctor  
107   //
108 }
109
110 //_______________________________________________________________________
111 AliRecPoint::AliRecPoint(const AliRecPoint& recp):
112   TObject(recp),
113   fAmp(0),
114   fGeom(0),
115   fIndexInList(-1), // to be set when the point is already stored
116   fLocPos(0,0,0),
117   fLocPosM(0),
118   fMaxDigit(100),
119   fMulDigit(0),
120   fMaxTrack(5),
121   fMulTrack(0),
122   fDigitsList(0),
123   fTracksList(0)
124 {
125   //
126   // Copy constructor
127   //
128   recp.Copy(*this);
129 }
130
131 //_______________________________________________________________________
132 AliRecPoint::~AliRecPoint()
133 {
134   // dtor
135   
136   delete fLocPosM ; 
137   delete [] fDigitsList ; 
138   delete [] fTracksList ;  
139   
140 }
141   
142 //_______________________________________________________________________
143 void AliRecPoint::AddDigit(AliDigitNew & digit)
144 {
145   // adds a digit to the digits list
146   // and accumulates the total amplitude and the multiplicity 
147   
148   
149   if ( fMulDigit >= fMaxDigit ) { // increase the size of the list 
150     int * tempo = new ( int[fMaxDigit*=2] ) ; 
151     
152     Int_t index ; 
153     
154     for ( index = 0 ; index < fMulDigit ; index++ )
155       tempo[index] = fDigitsList[index] ; 
156     
157     delete fDigitsList ; 
158     fDigitsList = tempo ; 
159   }
160   
161   fDigitsList[fMulDigit] = digit.GetIndexInList()  ; 
162   fMulDigit++ ; 
163   fAmp += digit.GetAmp() ; 
164 }
165
166 //_______________________________________________________________________
167 // void AliRecPoint::AddTrack(AliTrack & track)
168 // {
169 //   // adds a digit to the digits list
170 //   // and accumulates the total amplitude and the multiplicity 
171
172
173 //   if ( fMulTrack >= fMaxTrack ) { // increase the size of the list 
174 //     int * tempo = new int[fMaxTrack*=2] ; 
175 //     Int_t index ; 
176 //     for ( index = 0 ; index < fMulTrack ; index++ )
177 //       tempo[index] = fTracksList[index] ; 
178 //     delete fTracksList ; 
179 //     fTracksList = tempo ; 
180 //   }
181
182 //   fTracksList[fMulTrack++]=  (int) &Track  ; 
183 // }
184
185 //_______________________________________________________________________
186 void AliRecPoint::Copy(AliRecPoint& recp) const
187 {
188   //
189   // Copy *this onto pts
190   //
191   // Copy all first
192   if(this != &recp) {
193     ((TObject*) this)->Copy(dynamic_cast<TObject&>(recp));
194     recp.fAmp = fAmp;
195     recp.fGeom = fGeom;
196     recp.fIndexInList = fIndexInList;
197     recp.fLocPos = fLocPos;
198     recp.fLocPosM = new TMatrix(*fLocPosM);
199     recp.fMaxDigit = fMaxDigit;
200     recp.fMulDigit = fMulDigit;
201     recp.fMaxTrack = fMaxTrack;
202     recp.fMulTrack = fMulTrack;
203     
204     // Duplicate pointed objects
205     recp.fDigitsList = new Int_t[fMulDigit];
206     memcpy(recp.fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t));
207     recp.fTracksList = new Int_t[fMulTrack];
208     memcpy(recp.fTracksList,fTracksList,fMulTrack*sizeof(Int_t));
209   }
210 }
211
212 //_______________________________________________________________________
213 void AliRecPoint::GetCovarianceMatrix(TMatrix & mat) const
214 {
215   // returns the covariant matrix for the local position
216   
217   mat = *fLocPosM ; 
218
219 }
220
221 //____________________________________________________________________________
222 void AliRecPoint::GetLocalPosition(TVector3 & pos) const
223 {
224   // returns the position of the cluster in the local reference system of the sub-detector
225
226   pos = fLocPos;
227
228  
229 }
230
231 //____________________________________________________________________________
232 void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const
233 {
234   // returns the position of the cluster in the global reference system of ALICE
235   // and the uncertainty on this position
236   
237
238   fGeom->GetGlobal(this, gpos, gmat) ;
239  
240 }
241
242