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