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