]>
Commit | Line | Data |
---|---|---|
d15a28e7 | 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 | // RecPoint in the PHOS PPSD: a list of AliPHOSDigit's | |
18 | //*-- Author : Yves Schutz SUBATECH | |
19 | ////////////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | // --- ROOT system --- | |
22 | ||
23 | // --- Standard library --- | |
24 | ||
25 | #include <iostream.h> | |
26 | ||
27 | // --- AliRoot header files --- | |
28 | ||
29 | #include "AliPHOSGeometry.h" | |
30 | #include "AliPHOSPpsdRecPoint.h" | |
31 | #include "AliRun.h" | |
32 | ||
33 | ClassImp(AliPHOSPpsdRecPoint) | |
34 | ||
35 | //____________________________________________________________________________ | |
36 | AliPHOSPpsdRecPoint::AliPHOSPpsdRecPoint(void) | |
37 | { | |
38 | fMulDigit = 0 ; | |
39 | AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ; | |
40 | fDelta = geom->GetCrystalSize(0) ; | |
41 | fLocPos.SetX(1000000.) ; //Local position should be evaluated | |
42 | } | |
43 | ||
44 | //____________________________________________________________________________ | |
45 | AliPHOSPpsdRecPoint::~AliPHOSPpsdRecPoint(void) // dtor | |
46 | { | |
47 | delete fDigitsList ; | |
48 | } | |
49 | ||
50 | //____________________________________________________________________________ | |
51 | void AliPHOSPpsdRecPoint::AddDigit(AliDigitNew & digit, Float_t Energy) | |
52 | { | |
53 | // adds a digit to the digits list | |
54 | // and accumulates the total amplitude and the multiplicity | |
55 | ||
56 | ||
57 | if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists | |
58 | int * tempo = new ( int[fMaxDigit*=2] ) ; | |
59 | Int_t index ; | |
60 | ||
61 | for ( index = 0 ; index < fMulDigit ; index++ ) | |
62 | tempo[index] = fDigitsList[index] ; | |
63 | ||
64 | delete fDigitsList ; | |
65 | fDigitsList = tempo ; | |
66 | } | |
67 | ||
68 | fDigitsList[fMulDigit++] = (int) &digit ; | |
69 | fAmp += Energy ; | |
70 | } | |
71 | ||
72 | ||
73 | ||
74 | ||
75 | //____________________________________________________________________________ | |
76 | Int_t AliPHOSPpsdRecPoint::Compare(TObject * obj) | |
77 | { | |
78 | Int_t rv ; | |
79 | ||
80 | AliPHOSPpsdRecPoint * clu = (AliPHOSPpsdRecPoint *)obj ; | |
81 | ||
82 | ||
83 | Float_t x1 , z1 ; | |
84 | Float_t x2 , z2 ; | |
85 | ||
86 | Int_t PhosMod1 ; | |
87 | Int_t PhosMod2 ; | |
88 | ||
89 | Int_t up1 ; | |
90 | Int_t up2 ; | |
91 | ||
92 | if(GetUp()) // upper layer | |
93 | up1 = 0 ; | |
94 | else // lower layer | |
95 | up1 = 1 ; | |
96 | ||
97 | if(clu->GetUp()) // upper layer | |
98 | up2 = 0 ; | |
99 | else // lower layer | |
100 | up2 = 1 ; | |
101 | ||
102 | TVector3 PosLoc ; | |
103 | this->GetLocalPosition(PosLoc) ; | |
104 | x1 = PosLoc.X() ; | |
105 | z1 = PosLoc.Z() ; | |
106 | PhosMod1 = this->GetPHOSMod(); | |
107 | clu->GetLocalPosition(PosLoc) ; | |
108 | x2 = PosLoc.X() ; | |
109 | z2 = PosLoc.Z() ; | |
110 | PhosMod2 = clu->GetPHOSMod(); | |
111 | ||
112 | if(PhosMod1 == PhosMod2 ) { | |
113 | ||
114 | if(up1 == up2 ){ | |
115 | Int_t rowdif = (Int_t)TMath::Ceil(x1/fDelta) - (Int_t) TMath::Ceil(x2/fDelta) ; | |
116 | ||
117 | if (rowdif> 0) | |
118 | rv = -1 ; | |
119 | else if(rowdif < 0) | |
120 | rv = 1 ; | |
121 | else if(z1>z2) | |
122 | rv = -1 ; | |
123 | else | |
124 | rv = 1 ; | |
125 | } | |
126 | ||
127 | else { | |
128 | ||
129 | if(up1 < up2 ) // Upper level first (up = True or False, True > False) | |
130 | rv = 1 ; | |
131 | else | |
132 | rv = - 1 ; | |
133 | } | |
134 | ||
135 | } // if PhosMod1 == PhosMod2 | |
136 | ||
137 | else { | |
138 | ||
139 | if(PhosMod1 < PhosMod2 ) | |
140 | rv = -1 ; | |
141 | else | |
142 | rv = 1 ; | |
143 | ||
144 | } | |
145 | ||
146 | return rv ; | |
147 | } | |
148 | ||
149 | //____________________________________________________________________________ | |
150 | void AliPHOSPpsdRecPoint::GetLocalPosition(TVector3 &LPos){ | |
151 | ||
152 | if( fLocPos.X() < 1000000.) { //allready evaluated | |
153 | LPos = fLocPos ; | |
154 | return ; | |
155 | } | |
156 | ||
157 | Int_t relid[4] ; | |
158 | ||
159 | Float_t x = 0. ; | |
160 | Float_t z = 0. ; | |
161 | ||
162 | AliPHOSGeometry * PHOSGeom = (AliPHOSGeometry *) fGeom ; | |
163 | ||
164 | AliPHOSDigit * digit ; | |
165 | Int_t iDigit; | |
166 | ||
167 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
168 | digit = (AliPHOSDigit *) fDigitsList[iDigit]; | |
169 | ||
170 | Float_t xi ; | |
171 | Float_t zi ; | |
172 | PHOSGeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
173 | PHOSGeom->RelPosInModule(relid, xi, zi); | |
174 | x += xi ; | |
175 | z += zi ; | |
176 | } | |
177 | ||
178 | x /= fMulDigit ; | |
179 | z /= fMulDigit ; | |
180 | ||
181 | fLocPos.SetX(x) ; | |
182 | fLocPos.SetY(0.) ; | |
183 | fLocPos.SetZ(z) ; | |
184 | ||
185 | LPos = fLocPos ; | |
186 | } | |
187 | ||
188 | //____________________________________________________________________________ | |
189 | Bool_t AliPHOSPpsdRecPoint::GetUp() | |
190 | { | |
191 | Int_t relid[4] ; | |
192 | ||
193 | AliPHOSGeometry * PHOSGeom = (AliPHOSGeometry *) fGeom ; | |
194 | ||
195 | AliPHOSDigit *digit = (AliPHOSDigit *)fDigitsList[0] ; | |
196 | ||
197 | PHOSGeom->AbsToRelNumbering(digit->GetId(),relid); | |
198 | Bool_t up ; | |
199 | ||
200 | if((Int_t)TMath::Ceil((Float_t)relid[1]/ | |
201 | (PHOSGeom->GetNumberOfModulesPhi()*PHOSGeom->GetNumberOfModulesZ())-0.0001 ) > 1) | |
202 | up = kFALSE ; | |
203 | else | |
204 | up = kTRUE ; | |
205 | ||
206 | return up ; | |
207 | } | |
208 | ||
209 | //____________________________________________________________________________ | |
210 | void AliPHOSPpsdRecPoint::Print(Option_t * option) | |
211 | { | |
212 | cout << "AliPHOSPpsdRecPoint: " << endl ; | |
213 | ||
214 | AliPHOSDigit * digit ; | |
215 | ||
216 | Int_t iDigit; | |
217 | ||
218 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
219 | digit = (AliPHOSDigit *) fDigitsList[iDigit]; | |
220 | cout << " digit Id = " << digit->GetId() | |
221 | << " digit Energy = " << digit->GetAmp() << endl ; | |
222 | } | |
223 | cout << " Multiplicity = " << fMulDigit << endl ; | |
224 | } | |
225 | ||
226 | ||
227 | // //____________________________________________________________________________ | |
228 | // AliPHOSPpsdRecPoint& AliPHOSPpsdRecPoint::operator = (AliPHOSPpsdRecPoint Clu) | |
229 | // { | |
230 | // int* DL = Clu.GetDigitsList() ; | |
231 | ||
232 | // if(fDigitsList) | |
233 | // delete fDigitsList ; | |
234 | ||
235 | // AliPHOSDigit * digit ; | |
236 | ||
237 | // Int_t iDigit; | |
238 | ||
239 | // for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
240 | // digit = (AliPHOSDigit *) DL[iDigit]; | |
241 | // AddDigit(*digit) ; | |
242 | // } | |
243 | ||
244 | // fDelta = Clu.GetDelta() ; | |
245 | // delete DL ; | |
246 | ||
247 | // fAmp = Clu.GetEnergy() ; | |
248 | // fGeom = Clu.GetGeom() ; | |
249 | // TVector3 LocPos; | |
250 | // Clu.GetLocalPosition(LocPos) ; | |
251 | // fLocPos = LocPos; | |
252 | // fMulDigit = Clu.GetMultiplicity() ; | |
253 | // fMaxDigit = Clu.GetMaximumMultiplicity() ; | |
254 | // fPHOSMod = Clu.GetPHOSMod() ; | |
255 | ||
256 | ||
257 | // return *this ; | |
258 | // } |