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