]>
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 --- | |
9f616d61 | 22 | #include "TPad.h" |
d15a28e7 | 23 | // --- Standard library --- |
24 | ||
9f616d61 | 25 | #include <iostream> |
26 | #include <cassert> | |
d15a28e7 | 27 | |
28 | // --- AliRoot header files --- | |
29 | ||
30 | #include "AliPHOSGeometry.h" | |
31 | #include "AliPHOSPpsdRecPoint.h" | |
32 | #include "AliRun.h" | |
33 | ||
34 | ClassImp(AliPHOSPpsdRecPoint) | |
35 | ||
36 | //____________________________________________________________________________ | |
37 | AliPHOSPpsdRecPoint::AliPHOSPpsdRecPoint(void) | |
38 | { | |
39 | fMulDigit = 0 ; | |
40 | AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ; | |
41 | fDelta = geom->GetCrystalSize(0) ; | |
42 | fLocPos.SetX(1000000.) ; //Local position should be evaluated | |
43 | } | |
44 | ||
45 | //____________________________________________________________________________ | |
46 | AliPHOSPpsdRecPoint::~AliPHOSPpsdRecPoint(void) // dtor | |
47 | { | |
9f616d61 | 48 | //dtor |
d15a28e7 | 49 | } |
50 | ||
51 | //____________________________________________________________________________ | |
52 | void AliPHOSPpsdRecPoint::AddDigit(AliDigitNew & digit, Float_t Energy) | |
53 | { | |
54 | // adds a digit to the digits list | |
55 | // and accumulates the total amplitude and the multiplicity | |
56 | ||
57 | ||
58 | if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists | |
9f616d61 | 59 | fMaxDigit*=2 ; |
60 | int * tempo = new ( int[fMaxDigit] ) ; | |
d15a28e7 | 61 | Int_t index ; |
62 | ||
63 | for ( index = 0 ; index < fMulDigit ; index++ ) | |
64 | tempo[index] = fDigitsList[index] ; | |
65 | ||
9f616d61 | 66 | delete [] fDigitsList ; |
67 | fDigitsList = new ( int[fMaxDigit] ) ; | |
68 | ||
69 | for ( index = 0 ; index < fMulDigit ; index++ ) | |
70 | fDigitsList[index] = tempo[index] ; | |
71 | ||
72 | delete [] tempo ; | |
d15a28e7 | 73 | } |
9f616d61 | 74 | |
d15a28e7 | 75 | fDigitsList[fMulDigit++] = (int) &digit ; |
76 | fAmp += Energy ; | |
77 | } | |
78 | ||
79 | ||
80 | ||
81 | ||
82 | //____________________________________________________________________________ | |
83 | Int_t AliPHOSPpsdRecPoint::Compare(TObject * obj) | |
84 | { | |
85 | Int_t rv ; | |
86 | ||
87 | AliPHOSPpsdRecPoint * clu = (AliPHOSPpsdRecPoint *)obj ; | |
88 | ||
89 | ||
90 | Float_t x1 , z1 ; | |
91 | Float_t x2 , z2 ; | |
92 | ||
92862013 | 93 | Int_t phosmod1 ; |
94 | Int_t phosmod2 ; | |
d15a28e7 | 95 | |
96 | Int_t up1 ; | |
97 | Int_t up2 ; | |
98 | ||
99 | if(GetUp()) // upper layer | |
100 | up1 = 0 ; | |
101 | else // lower layer | |
102 | up1 = 1 ; | |
103 | ||
104 | if(clu->GetUp()) // upper layer | |
105 | up2 = 0 ; | |
106 | else // lower layer | |
107 | up2 = 1 ; | |
108 | ||
92862013 | 109 | TVector3 posloc ; |
110 | this->GetLocalPosition(posloc) ; | |
111 | x1 = posloc.X() ; | |
112 | z1 = posloc.Z() ; | |
113 | phosmod1 = this->GetPHOSMod(); | |
114 | clu->GetLocalPosition(posloc) ; | |
115 | x2 = posloc.X() ; | |
116 | z2 = posloc.Z() ; | |
117 | phosmod2 = clu->GetPHOSMod(); | |
118 | ||
119 | if(phosmod1 == phosmod2 ) { | |
d15a28e7 | 120 | |
121 | if(up1 == up2 ){ | |
122 | Int_t rowdif = (Int_t)TMath::Ceil(x1/fDelta) - (Int_t) TMath::Ceil(x2/fDelta) ; | |
123 | ||
124 | if (rowdif> 0) | |
125 | rv = -1 ; | |
126 | else if(rowdif < 0) | |
127 | rv = 1 ; | |
128 | else if(z1>z2) | |
129 | rv = -1 ; | |
130 | else | |
131 | rv = 1 ; | |
132 | } | |
133 | ||
134 | else { | |
135 | ||
136 | if(up1 < up2 ) // Upper level first (up = True or False, True > False) | |
137 | rv = 1 ; | |
138 | else | |
139 | rv = - 1 ; | |
140 | } | |
141 | ||
92862013 | 142 | } // if phosmod1 == phosmod2 |
d15a28e7 | 143 | |
144 | else { | |
145 | ||
92862013 | 146 | if(phosmod1 < phosmod2 ) |
d15a28e7 | 147 | rv = -1 ; |
148 | else | |
149 | rv = 1 ; | |
150 | ||
151 | } | |
152 | ||
153 | return rv ; | |
154 | } | |
155 | ||
156 | //____________________________________________________________________________ | |
157 | void AliPHOSPpsdRecPoint::GetLocalPosition(TVector3 &LPos){ | |
158 | ||
159 | if( fLocPos.X() < 1000000.) { //allready evaluated | |
160 | LPos = fLocPos ; | |
161 | return ; | |
162 | } | |
163 | ||
164 | Int_t relid[4] ; | |
165 | ||
166 | Float_t x = 0. ; | |
167 | Float_t z = 0. ; | |
168 | ||
92862013 | 169 | AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; |
d15a28e7 | 170 | |
171 | AliPHOSDigit * digit ; | |
172 | Int_t iDigit; | |
173 | ||
6ad0bfa0 | 174 | for(iDigit = 0; iDigit < fMulDigit; iDigit++) { |
d15a28e7 | 175 | digit = (AliPHOSDigit *) fDigitsList[iDigit]; |
176 | ||
177 | Float_t xi ; | |
178 | Float_t zi ; | |
92862013 | 179 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; |
180 | phosgeom->RelPosInModule(relid, xi, zi); | |
d15a28e7 | 181 | x += xi ; |
182 | z += zi ; | |
183 | } | |
184 | ||
6ad0bfa0 | 185 | x /= fMulDigit ; |
186 | z /= fMulDigit ; | |
d15a28e7 | 187 | |
188 | fLocPos.SetX(x) ; | |
189 | fLocPos.SetY(0.) ; | |
190 | fLocPos.SetZ(z) ; | |
191 | ||
192 | LPos = fLocPos ; | |
6ad0bfa0 | 193 | |
d15a28e7 | 194 | } |
195 | ||
196 | //____________________________________________________________________________ | |
197 | Bool_t AliPHOSPpsdRecPoint::GetUp() | |
198 | { | |
199 | Int_t relid[4] ; | |
200 | ||
92862013 | 201 | AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; |
d15a28e7 | 202 | |
203 | AliPHOSDigit *digit = (AliPHOSDigit *)fDigitsList[0] ; | |
204 | ||
92862013 | 205 | phosgeom->AbsToRelNumbering(digit->GetId(),relid); |
d15a28e7 | 206 | Bool_t up ; |
207 | ||
208 | if((Int_t)TMath::Ceil((Float_t)relid[1]/ | |
92862013 | 209 | (phosgeom->GetNumberOfModulesPhi()*phosgeom->GetNumberOfModulesZ())-0.0001 ) > 1) |
d15a28e7 | 210 | up = kFALSE ; |
211 | else | |
212 | up = kTRUE ; | |
213 | ||
214 | return up ; | |
215 | } | |
9f616d61 | 216 | //______________________________________________________________________________ |
217 | void AliPHOSPpsdRecPoint::Paint(Option_t *) | |
218 | { | |
219 | //*-*-*-*-*-*-*-*-*-*-*Paint this ALiRecPoint as a TMarker with its current attributes*-*-*-*-*-*-* | |
220 | //*-* ============================================= | |
221 | TVector3 pos(0.,0.,0.) ; | |
222 | GetLocalPosition(pos) ; | |
223 | Coord_t x = pos.X() ; | |
224 | Coord_t y = pos.Z() ; | |
92862013 | 225 | Color_t markercolor = 1 ; |
226 | Size_t markersize = 1. ; | |
227 | Style_t markerstyle = 2 ; | |
9f616d61 | 228 | if (GetUp()) |
92862013 | 229 | markerstyle = 3 ; |
9f616d61 | 230 | |
231 | if (!gPad->IsBatch()) { | |
92862013 | 232 | gVirtualX->SetMarkerColor(markercolor); |
233 | gVirtualX->SetMarkerSize (markersize); | |
234 | gVirtualX->SetMarkerStyle(markerstyle); | |
9f616d61 | 235 | } |
92862013 | 236 | gPad->SetAttMarkerPS(markercolor,markerstyle,markersize); |
9f616d61 | 237 | gPad->PaintPolyMarker(1,&x,&y,""); |
238 | ||
239 | ||
240 | } | |
d15a28e7 | 241 | |
242 | //____________________________________________________________________________ | |
243 | void AliPHOSPpsdRecPoint::Print(Option_t * option) | |
244 | { | |
245 | cout << "AliPHOSPpsdRecPoint: " << endl ; | |
246 | ||
247 | AliPHOSDigit * digit ; | |
d15a28e7 | 248 | Int_t iDigit; |
92862013 | 249 | AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; |
9f616d61 | 250 | |
251 | Float_t xi ; | |
252 | Float_t zi ; | |
253 | Int_t relid[4] ; | |
d15a28e7 | 254 | |
255 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
256 | digit = (AliPHOSDigit *) fDigitsList[iDigit]; | |
92862013 | 257 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; |
258 | phosgeom->RelPosInModule(relid, xi, zi); | |
9f616d61 | 259 | cout << " Id = " << digit->GetId() ; |
260 | cout << " Phos mod = " << relid[0] ; | |
261 | cout << " PPSD mod = " << relid[1] ; | |
262 | cout << " x = " << xi ; | |
263 | cout << " z = " << zi ; | |
264 | cout << " Energy = " << digit->GetAmp() << endl ; | |
d15a28e7 | 265 | } |
266 | cout << " Multiplicity = " << fMulDigit << endl ; | |
267 | } | |
268 | ||
269 | ||
270 | // //____________________________________________________________________________ | |
271 | // AliPHOSPpsdRecPoint& AliPHOSPpsdRecPoint::operator = (AliPHOSPpsdRecPoint Clu) | |
272 | // { | |
273 | // int* DL = Clu.GetDigitsList() ; | |
274 | ||
275 | // if(fDigitsList) | |
276 | // delete fDigitsList ; | |
277 | ||
278 | // AliPHOSDigit * digit ; | |
279 | ||
280 | // Int_t iDigit; | |
281 | ||
282 | // for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
283 | // digit = (AliPHOSDigit *) DL[iDigit]; | |
284 | // AddDigit(*digit) ; | |
285 | // } | |
286 | ||
287 | // fDelta = Clu.GetDelta() ; | |
288 | // delete DL ; | |
289 | ||
290 | // fAmp = Clu.GetEnergy() ; | |
291 | // fGeom = Clu.GetGeom() ; | |
292 | // TVector3 LocPos; | |
293 | // Clu.GetLocalPosition(LocPos) ; | |
294 | // fLocPos = LocPos; | |
295 | // fMulDigit = Clu.GetMultiplicity() ; | |
296 | // fMaxDigit = Clu.GetMaximumMultiplicity() ; | |
297 | // fPHOSMod = Clu.GetPHOSMod() ; | |
298 | ||
299 | ||
300 | // return *this ; | |
301 | // } |