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