]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRecPoint.cxx
Corrections
[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.1  1999/12/17 09:01:14  fca
19 Y.Schutz new classes for reconstruction
20
21 */
22
23 //-*-C++-*-
24 //_________________________________________________________________________
25 // Base Class of Cluster (empty cxx needed by Root)
26 //*-- Author : Yves Schutz  SUBATECH 
27 //////////////////////////////////////////////////////////////////////////////
28
29 // --- ROOT system ---
30
31 #include "TObjArray.h"
32
33 // --- Standard library ---
34
35 // --- AliRoot header files ---
36
37 #include "AliRecPoint.h"
38
39 ClassImp(AliRecPoint)
40
41
42 //____________________________________________________________________________
43 AliRecPoint::AliRecPoint()
44 {
45   // ctor  
46   fAmp = 0.0 ; 
47   
48   fLocPos.SetXYZ(0., 0., 0.) ;
49   fLocPosM = new TMatrix(3,3) ;
50   fMaxDigit = 100 ; 
51   fMulDigit = 0 ; 
52   fDigitsList = new int[fMaxDigit]; ; 
53   fMaxTrack = 5 ; 
54   fMulTrack = 0 ; 
55   fTracksList = new int[fMaxTrack]; ; 
56 }
57
58 //____________________________________________________________________________
59 AliRecPoint::~AliRecPoint()
60 {
61   // dtor
62   
63   delete fLocPosM ; 
64   if ( fDigitsList )    
65     delete fDigitsList ; 
66   if ( fTracksList )    
67     delete fTracksList ;  
68   
69 }
70   
71 //____________________________________________________________________________
72 void AliRecPoint::AddDigit(AliDigitNew & digit)
73 {
74   // adds a digit to the digits list
75   // and accumulates the total amplitude and the multiplicity 
76   
77   
78   if ( fMulDigit >= fMaxDigit ) { // increase the size of the list 
79     int * tempo = new ( int[fMaxDigit*=2] ) ; 
80     
81     Int_t index ; 
82     
83     for ( index = 0 ; index < fMulDigit ; index++ )
84       tempo[index] = fDigitsList[index] ; 
85     
86     delete fDigitsList ; 
87     fDigitsList = tempo ; 
88   }
89   
90   fDigitsList[fMulDigit++]=  (int) &digit  ; 
91   fAmp += digit.GetAmp() ; 
92 }
93
94 //____________________________________________________________________________
95 // void AliRecPoint::AddTrack(AliTrack & track)
96 // {
97 //   // adds a digit to the digits list
98 //   // and accumulates the total amplitude and the multiplicity 
99
100
101 //   if ( fMulTrack >= fMaxTrack ) { // increase the size of the list 
102 //     int * tempo = new int[fMaxTrack*=2] ; 
103 //     Int_t index ; 
104 //     for ( index = 0 ; index < fMulTrack ; index++ )
105 //       tempo[index] = fTracksList[index] ; 
106 //     delete fTracksList ; 
107 //     fTracksList = tempo ; 
108 //   }
109
110 //   fTracksList[fMulTrack++]=  (int) &Track  ; 
111 // }
112
113 //____________________________________________________________________________
114 void AliRecPoint::GetCovarianceMatrix(TMatrix & mat)
115 {
116   // returns the covariant matrix for the local position
117   
118   mat = *fLocPosM ; 
119
120 }
121
122 //____________________________________________________________________________
123 void AliRecPoint::GetLocalPosition(TVector3 & pos)
124 {
125   // returns the position of the cluster in the local reference system of the sub-detector
126
127   pos = fLocPos;
128
129  
130 }
131
132 //____________________________________________________________________________
133 void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat)
134 {
135   // returns the position of the cluster in the global reference system of ALICE
136   // and the uncertainty on this position
137   
138
139   fGeom->GetGlobal(this, gpos, gmat) ;
140  
141 }
142
143 //______________________________________________________________________________
144 void AliRecPoint::Streamer(TBuffer &R__b)
145 {
146    // Stream an object of class AliRecPoint.
147
148    if (R__b.IsReading()) {
149       Version_t R__v = R__b.ReadVersion(); if (R__v) { }
150       TObject::Streamer(R__b);
151       R__b >> fAmp;
152       R__b >> fMulDigit;
153       fDigitsList = new Int_t[fMulDigit] ; 
154       R__b.ReadFastArray(fDigitsList, fMulDigit);
155       R__b >> fGeom;
156       fLocPos.Streamer(R__b);
157       R__b >> fLocPosM;
158       R__b >> fMulTrack;
159       fTracksList = new Int_t[fMulTrack] ; 
160       R__b.ReadFastArray(fTracksList, fMulTrack);
161    } else {
162       R__b.WriteVersion(AliRecPoint::IsA());
163       TObject::Streamer(R__b);
164       R__b << fAmp;
165       R__b << fMulDigit;
166       R__b.WriteFastArray(fDigitsList, fMulDigit);
167       R__b << fGeom;
168       fLocPos.Streamer(R__b);
169       R__b << fLocPosM;
170       R__b << fMulTrack;
171       R__b.WriteFastArray(fTracksList, fMulTrack);
172    }
173 }