]>
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 | ||
b2a60966 | 16 | /* $Id$ */ |
17 | ||
d15a28e7 | 18 | //_________________________________________________________________________ |
b2a60966 | 19 | // RecPoint implementation for PHOS-EMC |
20 | // An EmcRecPoint is a cluster of digits | |
baef0810 | 21 | //*-- |
b2a60966 | 22 | //*-- Author: Dmitri Peressounko (RRC KI & SUBATECH) |
23 | ||
d15a28e7 | 24 | |
25 | // --- ROOT system --- | |
9f616d61 | 26 | #include "TPad.h" |
27 | #include "TH2.h" | |
d15a28e7 | 28 | #include "TMath.h" |
9f616d61 | 29 | #include "TCanvas.h" |
d15a28e7 | 30 | |
31 | // --- Standard library --- | |
32 | ||
de9ec31b | 33 | #include <iostream.h> |
d15a28e7 | 34 | |
35 | // --- AliRoot header files --- | |
36 | ||
7932f811 | 37 | #include "AliGenerator.h" |
d15a28e7 | 38 | #include "AliPHOSGeometry.h" |
39 | #include "AliPHOSEmcRecPoint.h" | |
40 | #include "AliRun.h" | |
41 | ||
42 | ClassImp(AliPHOSEmcRecPoint) | |
43 | ||
44 | //____________________________________________________________________________ | |
7932f811 | 45 | AliPHOSEmcRecPoint::AliPHOSEmcRecPoint() : AliPHOSRecPoint() |
d15a28e7 | 46 | { |
47 | // ctor | |
48 | ||
49 | fMulDigit = 0 ; | |
50 | fAmp = 0. ; | |
7932f811 | 51 | fCoreEnergy = 0 ; |
52 | fEnergyList = 0 ; | |
ad8cfaf4 | 53 | fGeom = AliPHOSGeometry::GetInstance() ; |
d15a28e7 | 54 | fLocPos.SetX(1000000.) ; //Local position should be evaluated |
69183710 | 55 | |
83974468 | 56 | } |
57 | ||
58 | //____________________________________________________________________________ | |
59 | AliPHOSEmcRecPoint::~AliPHOSEmcRecPoint() | |
60 | { | |
88714635 | 61 | // dtor |
a4e98857 | 62 | |
83974468 | 63 | if ( fEnergyList ) |
64 | delete[] fEnergyList ; | |
d15a28e7 | 65 | } |
66 | ||
d15a28e7 | 67 | //____________________________________________________________________________ |
83974468 | 68 | void AliPHOSEmcRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy) |
d15a28e7 | 69 | { |
b2a60966 | 70 | // Adds a digit to the RecPoint |
a4e98857 | 71 | // and accumulates the total amplitude and the multiplicity |
d15a28e7 | 72 | |
7932f811 | 73 | if(fEnergyList == 0) |
74 | fEnergyList = new Float_t[fMaxDigit]; | |
75 | ||
d15a28e7 | 76 | if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists |
9f616d61 | 77 | fMaxDigit*=2 ; |
83974468 | 78 | Int_t * tempo = new ( Int_t[fMaxDigit] ) ; |
9f616d61 | 79 | Float_t * tempoE = new ( Float_t[fMaxDigit] ) ; |
80 | ||
81 | Int_t index ; | |
d15a28e7 | 82 | for ( index = 0 ; index < fMulDigit ; index++ ){ |
83974468 | 83 | tempo[index] = fDigitsList[index] ; |
d15a28e7 | 84 | tempoE[index] = fEnergyList[index] ; |
85 | } | |
86 | ||
9f616d61 | 87 | delete [] fDigitsList ; |
83974468 | 88 | fDigitsList = new ( Int_t[fMaxDigit] ) ; |
9f616d61 | 89 | |
90 | delete [] fEnergyList ; | |
91 | fEnergyList = new ( Float_t[fMaxDigit] ) ; | |
92 | ||
93 | for ( index = 0 ; index < fMulDigit ; index++ ){ | |
94 | fDigitsList[index] = tempo[index] ; | |
95 | fEnergyList[index] = tempoE[index] ; | |
96 | } | |
97 | ||
98 | delete [] tempo ; | |
99 | delete [] tempoE ; | |
100 | } // if | |
d15a28e7 | 101 | |
83974468 | 102 | fDigitsList[fMulDigit] = digit.GetIndexInList() ; |
103 | fEnergyList[fMulDigit] = Energy ; | |
104 | fMulDigit++ ; | |
d15a28e7 | 105 | fAmp += Energy ; |
7932f811 | 106 | |
107 | EvalPHOSMod(&digit) ; | |
d15a28e7 | 108 | } |
109 | ||
110 | //____________________________________________________________________________ | |
ad8cfaf4 | 111 | Bool_t AliPHOSEmcRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const |
d15a28e7 | 112 | { |
a4e98857 | 113 | // Tells if (true) or not (false) two digits are neighbors |
d15a28e7 | 114 | |
115 | Bool_t aren = kFALSE ; | |
116 | ||
92862013 | 117 | AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; |
d15a28e7 | 118 | Int_t relid1[4] ; |
92862013 | 119 | phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ; |
d15a28e7 | 120 | |
121 | Int_t relid2[4] ; | |
92862013 | 122 | phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ; |
d15a28e7 | 123 | |
92862013 | 124 | Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ; |
125 | Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ; | |
d15a28e7 | 126 | |
92862013 | 127 | if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0)) |
d15a28e7 | 128 | aren = kTRUE ; |
129 | ||
130 | return aren ; | |
131 | } | |
132 | ||
133 | //____________________________________________________________________________ | |
2a941f4e | 134 | Int_t AliPHOSEmcRecPoint::Compare(const TObject * obj) const |
d15a28e7 | 135 | { |
b2a60966 | 136 | // Compares two RecPoints according to their position in the PHOS modules |
137 | ||
7932f811 | 138 | Float_t delta = 1 ; //Width of "Sorting row". If you changibg this |
139 | //value (what is senseless) change as vell delta in | |
140 | //AliPHOSTrackSegmentMakerv* and other RecPoints... | |
d15a28e7 | 141 | Int_t rv ; |
142 | ||
143 | AliPHOSEmcRecPoint * clu = (AliPHOSEmcRecPoint *)obj ; | |
144 | ||
145 | ||
ad8cfaf4 | 146 | Int_t phosmod1 = GetPHOSMod() ; |
92862013 | 147 | Int_t phosmod2 = clu->GetPHOSMod() ; |
d15a28e7 | 148 | |
92862013 | 149 | TVector3 locpos1; |
7932f811 | 150 | GetLocalPosition(locpos1) ; |
92862013 | 151 | TVector3 locpos2; |
152 | clu->GetLocalPosition(locpos2) ; | |
d15a28e7 | 153 | |
92862013 | 154 | if(phosmod1 == phosmod2 ) { |
7932f811 | 155 | Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ; |
d15a28e7 | 156 | if (rowdif> 0) |
7932f811 | 157 | rv = 1 ; |
d15a28e7 | 158 | else if(rowdif < 0) |
7932f811 | 159 | rv = -1 ; |
92862013 | 160 | else if(locpos1.Z()>locpos2.Z()) |
d15a28e7 | 161 | rv = -1 ; |
162 | else | |
163 | rv = 1 ; | |
164 | } | |
165 | ||
166 | else { | |
92862013 | 167 | if(phosmod1 < phosmod2 ) |
d15a28e7 | 168 | rv = -1 ; |
169 | else | |
170 | rv = 1 ; | |
171 | } | |
172 | ||
173 | return rv ; | |
174 | } | |
175 | ||
9f616d61 | 176 | //______________________________________________________________________________ |
baef0810 | 177 | void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const |
9f616d61 | 178 | { |
7932f811 | 179 | // Commented by Dmitri Peressounko: there is no possibility to ensure, |
180 | // that AliPHOSIndexToObject keeps the correct information. | |
181 | ||
182 | // // Execute action corresponding to one event | |
183 | // // This member function is called when a AliPHOSRecPoint is clicked with the locator | |
184 | // // | |
185 | // // If Left button is clicked on AliPHOSRecPoint, the digits are switched on | |
186 | // // and switched off when the mouse button is released. | |
187 | // // | |
9f616d61 | 188 | |
7932f811 | 189 | // // static Int_t pxold, pyold; |
9f616d61 | 190 | |
7932f811 | 191 | // AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ; |
9f616d61 | 192 | |
7932f811 | 193 | // static TGraph * digitgraph = 0 ; |
83974468 | 194 | |
7932f811 | 195 | // if (!gPad->IsEditable()) return; |
83974468 | 196 | |
7932f811 | 197 | // TH2F * histo = 0 ; |
198 | // TCanvas * histocanvas ; | |
83974468 | 199 | |
7932f811 | 200 | // switch (event) { |
83974468 | 201 | |
7932f811 | 202 | // case kButton1Down: { |
203 | // AliPHOSDigit * digit ; | |
204 | // AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; | |
205 | // Int_t iDigit; | |
206 | // Int_t relid[4] ; | |
83974468 | 207 | |
7932f811 | 208 | // const Int_t kMulDigit = AliPHOSEmcRecPoint::GetDigitsMultiplicity() ; |
209 | // Float_t * xi = new Float_t[kMulDigit] ; | |
210 | // Float_t * zi = new Float_t[kMulDigit] ; | |
83974468 | 211 | |
7932f811 | 212 | // // create the histogram for the single cluster |
213 | // // 1. gets histogram boundaries | |
214 | // Float_t ximax = -999. ; | |
215 | // Float_t zimax = -999. ; | |
216 | // Float_t ximin = 999. ; | |
217 | // Float_t zimin = 999. ; | |
83974468 | 218 | |
7932f811 | 219 | // for(iDigit=0; iDigit<kMulDigit; iDigit++) { |
220 | // digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[iDigit]) ) ; | |
221 | // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
222 | // phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]); | |
223 | // if ( xi[iDigit] > ximax ) | |
224 | // ximax = xi[iDigit] ; | |
225 | // if ( xi[iDigit] < ximin ) | |
226 | // ximin = xi[iDigit] ; | |
227 | // if ( zi[iDigit] > zimax ) | |
228 | // zimax = zi[iDigit] ; | |
229 | // if ( zi[iDigit] < zimin ) | |
230 | // zimin = zi[iDigit] ; | |
231 | // } | |
232 | // ximax += phosgeom->GetCrystalSize(0) / 2. ; | |
233 | // zimax += phosgeom->GetCrystalSize(2) / 2. ; | |
234 | // ximin -= phosgeom->GetCrystalSize(0) / 2. ; | |
235 | // zimin -= phosgeom->GetCrystalSize(2) / 2. ; | |
236 | // Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ; | |
237 | // Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ; | |
83974468 | 238 | |
7932f811 | 239 | // // 2. gets the histogram title |
83974468 | 240 | |
7932f811 | 241 | // Text_t title[100] ; |
242 | // sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ; | |
83974468 | 243 | |
7932f811 | 244 | // if (!histo) { |
245 | // delete histo ; | |
246 | // histo = 0 ; | |
247 | // } | |
248 | // histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ; | |
83974468 | 249 | |
7932f811 | 250 | // Float_t x, z ; |
251 | // for(iDigit=0; iDigit<kMulDigit; iDigit++) { | |
252 | // digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[iDigit]) ) ; | |
253 | // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
254 | // phosgeom->RelPosInModule(relid, x, z); | |
255 | // histo->Fill(x, z, fEnergyList[iDigit] ) ; | |
256 | // } | |
83974468 | 257 | |
7932f811 | 258 | // if (!digitgraph) { |
259 | // digitgraph = new TGraph(kMulDigit,xi,zi); | |
260 | // digitgraph-> SetMarkerStyle(5) ; | |
261 | // digitgraph-> SetMarkerSize(1.) ; | |
262 | // digitgraph-> SetMarkerColor(1) ; | |
263 | // digitgraph-> Paint("P") ; | |
264 | // } | |
83974468 | 265 | |
7932f811 | 266 | // Print() ; |
267 | // histocanvas = new TCanvas("cluster", "a single cluster", 600, 500) ; | |
268 | // histocanvas->Draw() ; | |
269 | // histo->Draw("lego1") ; | |
83974468 | 270 | |
7932f811 | 271 | // delete[] xi ; |
272 | // delete[] zi ; | |
83974468 | 273 | |
7932f811 | 274 | // break; |
275 | // } | |
83974468 | 276 | |
7932f811 | 277 | // case kButton1Up: |
278 | // if (digitgraph) { | |
279 | // delete digitgraph ; | |
280 | // digitgraph = 0 ; | |
281 | // } | |
282 | // break; | |
9f616d61 | 283 | |
7932f811 | 284 | // } |
9f616d61 | 285 | } |
286 | ||
d15a28e7 | 287 | //____________________________________________________________________________ |
7932f811 | 288 | void AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits) |
d15a28e7 | 289 | { |
b2a60966 | 290 | // Calculates the dispersion of the shower at the origine of the RecPoint |
291 | ||
92862013 | 292 | Float_t d = 0 ; |
d15a28e7 | 293 | Float_t wtot = 0 ; |
294 | ||
92862013 | 295 | TVector3 locpos; |
296 | GetLocalPosition(locpos); | |
297 | Float_t x = locpos.X() ; | |
298 | Float_t z = locpos.Z() ; | |
d15a28e7 | 299 | |
300 | AliPHOSDigit * digit ; | |
92862013 | 301 | AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; |
d15a28e7 | 302 | |
303 | Int_t iDigit; | |
88714635 | 304 | for(iDigit=0; iDigit < fMulDigit; iDigit++) { |
7932f811 | 305 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; |
d15a28e7 | 306 | Int_t relid[4] ; |
307 | Float_t xi ; | |
308 | Float_t zi ; | |
92862013 | 309 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; |
310 | phosgeom->RelPosInModule(relid, xi, zi); | |
7932f811 | 311 | Float_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ; |
92862013 | 312 | d += w*((xi-x)*(xi-x) + (zi-z)*(zi-z) ) ; |
d15a28e7 | 313 | wtot+=w ; |
314 | } | |
315 | ||
7932f811 | 316 | |
92862013 | 317 | d /= wtot ; |
d15a28e7 | 318 | |
7932f811 | 319 | fDispersion = TMath::Sqrt(d) ; |
d15a28e7 | 320 | } |
fad3e5b9 | 321 | //______________________________________________________________________________ |
7932f811 | 322 | void AliPHOSEmcRecPoint::EvalCoreEnergy(TClonesArray * digits) |
fad3e5b9 | 323 | { |
a4e98857 | 324 | // This function calculates energy in the core, |
325 | // i.e. within a radius rad = 3cm around the center. Beyond this radius | |
326 | // in accordance with shower profile the energy deposition | |
fad3e5b9 | 327 | // should be less than 2% |
328 | ||
fad3e5b9 | 329 | Float_t coreRadius = 3 ; |
330 | ||
331 | TVector3 locpos; | |
332 | GetLocalPosition(locpos); | |
333 | Float_t x = locpos.X() ; | |
334 | Float_t z = locpos.Z() ; | |
335 | ||
336 | AliPHOSDigit * digit ; | |
337 | AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; | |
338 | ||
339 | Int_t iDigit; | |
340 | for(iDigit=0; iDigit < fMulDigit; iDigit++) { | |
7932f811 | 341 | digit = (AliPHOSDigit *) ( digits->At(fDigitsList[iDigit]) ) ; |
fad3e5b9 | 342 | Int_t relid[4] ; |
343 | Float_t xi ; | |
344 | Float_t zi ; | |
345 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
346 | phosgeom->RelPosInModule(relid, xi, zi); | |
347 | Float_t distance = TMath::Sqrt((xi-x)*(xi-x)+(zi-z)*(zi-z)) ; | |
348 | if(distance < coreRadius) | |
7932f811 | 349 | fCoreEnergy += fEnergyList[iDigit] ; |
fad3e5b9 | 350 | } |
351 | ||
fad3e5b9 | 352 | } |
d15a28e7 | 353 | |
354 | //____________________________________________________________________________ | |
7932f811 | 355 | void AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits) |
d15a28e7 | 356 | { |
b2a60966 | 357 | // Calculates the axis of the shower ellipsoid |
83974468 | 358 | |
e8dbb96e | 359 | Double_t wtot = 0. ; |
360 | Double_t x = 0.; | |
361 | Double_t z = 0.; | |
362 | Double_t dxx = 0.; | |
363 | Double_t dzz = 0.; | |
364 | Double_t dxz = 0.; | |
d15a28e7 | 365 | |
366 | AliPHOSDigit * digit ; | |
92862013 | 367 | AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; |
d15a28e7 | 368 | Int_t iDigit; |
369 | ||
370 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
7932f811 | 371 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; |
d15a28e7 | 372 | Int_t relid[4] ; |
373 | Float_t xi ; | |
374 | Float_t zi ; | |
92862013 | 375 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; |
376 | phosgeom->RelPosInModule(relid, xi, zi); | |
7932f811 | 377 | Double_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ; |
92862013 | 378 | dxx += w * xi * xi ; |
d15a28e7 | 379 | x += w * xi ; |
92862013 | 380 | dzz += w * zi * zi ; |
d15a28e7 | 381 | z += w * zi ; |
92862013 | 382 | dxz += w * xi * zi ; |
d15a28e7 | 383 | wtot += w ; |
384 | } | |
92862013 | 385 | dxx /= wtot ; |
d15a28e7 | 386 | x /= wtot ; |
92862013 | 387 | dxx -= x * x ; |
388 | dzz /= wtot ; | |
d15a28e7 | 389 | z /= wtot ; |
92862013 | 390 | dzz -= z * z ; |
391 | dxz /= wtot ; | |
392 | dxz -= x * z ; | |
d15a28e7 | 393 | |
69183710 | 394 | // //Apply correction due to non-perpendicular incidence |
395 | // Double_t CosX ; | |
396 | // Double_t CosZ ; | |
397 | // Double_t DistanceToIP= (Double_t ) ((AliPHOSGeometry *) fGeom)->GetIPtoCrystalSurface() ; | |
398 | ||
399 | // CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ; | |
400 | // CosZ = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+z*z) ; | |
401 | ||
402 | // dxx = dxx/(CosX*CosX) ; | |
403 | // dzz = dzz/(CosZ*CosZ) ; | |
404 | // dxz = dxz/(CosX*CosZ) ; | |
405 | ||
406 | ||
7932f811 | 407 | fLambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ; |
408 | if(fLambda[0] > 0) | |
409 | fLambda[0] = TMath::Sqrt(fLambda[0]) ; | |
e8dbb96e | 410 | |
7932f811 | 411 | fLambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ; |
412 | if(fLambda[1] > 0) //To avoid exception if numerical errors lead to negative lambda. | |
413 | fLambda[1] = TMath::Sqrt(fLambda[1]) ; | |
e8dbb96e | 414 | else |
7932f811 | 415 | fLambda[1]= 0. ; |
d15a28e7 | 416 | } |
417 | ||
b2a60966 | 418 | //____________________________________________________________________________ |
7932f811 | 419 | void AliPHOSEmcRecPoint::EvalAll(Float_t logWeight, TClonesArray * digits ) |
ad8cfaf4 | 420 | { |
baef0810 | 421 | // Evaluates all shower parameters |
422 | ||
7932f811 | 423 | AliPHOSRecPoint::EvalAll(logWeight,digits) ; |
424 | EvalLocalPosition(logWeight, digits) ; | |
425 | EvalElipsAxis(logWeight, digits) ; | |
426 | EvalDispersion(logWeight, digits) ; | |
427 | EvalCoreEnergy(digits); | |
ad8cfaf4 | 428 | } |
429 | //____________________________________________________________________________ | |
7932f811 | 430 | void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TClonesArray * digits) |
b2a60966 | 431 | { |
432 | // Calculates the center of gravity in the local PHOS-module coordinates | |
b2a60966 | 433 | Float_t wtot = 0. ; |
434 | ||
435 | Int_t relid[4] ; | |
436 | ||
437 | Float_t x = 0. ; | |
438 | Float_t z = 0. ; | |
439 | ||
440 | AliPHOSDigit * digit ; | |
441 | ||
442 | AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; | |
443 | ||
444 | Int_t iDigit; | |
445 | ||
b2a60966 | 446 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { |
7932f811 | 447 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; |
b2a60966 | 448 | |
449 | Float_t xi ; | |
450 | Float_t zi ; | |
451 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
452 | phosgeom->RelPosInModule(relid, xi, zi); | |
7932f811 | 453 | Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ; |
b2a60966 | 454 | x += xi * w ; |
455 | z += zi * w ; | |
456 | wtot += w ; | |
b2a60966 | 457 | |
9ce1a8d9 | 458 | } |
69183710 | 459 | |
460 | x /= wtot ; | |
461 | z /= wtot ; | |
ad8cfaf4 | 462 | |
463 | // Correction for the depth of the shower starting point (TDR p 127) | |
464 | Float_t para = 0.925 ; | |
465 | Float_t parb = 6.52 ; | |
466 | ||
1b799736 | 467 | Float_t xo,yo,zo ; //Coordinates of the origin |
468 | gAlice->Generator()->GetOrigin(xo,yo,zo) ; | |
469 | ||
5830e1d9 | 470 | Float_t phi = phosgeom->GetPHOSAngle(relid[0]) ; |
1b799736 | 471 | |
472 | //Transform to the local ref.frame | |
473 | Float_t xoL,yoL ; | |
474 | xoL = xo*TMath::Cos(phi)-yo*TMath::Sin(phi) ; | |
475 | yoL = xo*TMath::Sin(phi)+yo*TMath::Cos(phi) ; | |
476 | ||
477 | Float_t radius = TMath::Sqrt((xoL-x)*(xoL-x)+ | |
5830e1d9 | 478 | (phosgeom->GetIPtoCrystalSurface()-yoL)*(phosgeom->GetIPtoCrystalSurface()-yoL)+ |
479 | (zo-z)*(zo-z)); | |
1b799736 | 480 | |
481 | Float_t incidencephi = TMath::ATan((x-xoL ) / radius) ; | |
482 | Float_t incidencetheta = TMath::ATan((z-zo) / radius) ; | |
ad8cfaf4 | 483 | |
484 | Float_t depthx = ( para * TMath::Log(fAmp) + parb ) * TMath::Sin(incidencephi) ; | |
485 | Float_t depthz = ( para * TMath::Log(fAmp) + parb ) * TMath::Sin(incidencetheta) ; | |
486 | ||
487 | ||
488 | fLocPos.SetX(x - depthx) ; | |
b2a60966 | 489 | fLocPos.SetY(0.) ; |
ad8cfaf4 | 490 | fLocPos.SetZ(z - depthz) ; |
b2a60966 | 491 | |
bc68d12c | 492 | fLocPosM = 0 ; |
b2a60966 | 493 | } |
494 | ||
d15a28e7 | 495 | //____________________________________________________________________________ |
ad8cfaf4 | 496 | Float_t AliPHOSEmcRecPoint::GetMaximalEnergy(void) const |
d15a28e7 | 497 | { |
b2a60966 | 498 | // Finds the maximum energy in the cluster |
499 | ||
d15a28e7 | 500 | Float_t menergy = 0. ; |
501 | ||
502 | Int_t iDigit; | |
503 | ||
504 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
505 | ||
506 | if(fEnergyList[iDigit] > menergy) | |
507 | menergy = fEnergyList[iDigit] ; | |
508 | } | |
509 | return menergy ; | |
510 | } | |
511 | ||
512 | //____________________________________________________________________________ | |
ad8cfaf4 | 513 | Int_t AliPHOSEmcRecPoint::GetMultiplicityAtLevel(const Float_t H) const |
d15a28e7 | 514 | { |
b2a60966 | 515 | // Calculates the multiplicity of digits with energy larger than H*energy |
516 | ||
d15a28e7 | 517 | Int_t multipl = 0 ; |
518 | Int_t iDigit ; | |
519 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
520 | ||
521 | if(fEnergyList[iDigit] > H * fAmp) | |
522 | multipl++ ; | |
523 | } | |
524 | return multipl ; | |
525 | } | |
526 | ||
527 | //____________________________________________________________________________ | |
7932f811 | 528 | Int_t AliPHOSEmcRecPoint::GetNumberOfLocalMax(Int_t * maxAt, Float_t * maxAtEnergy, |
529 | Float_t locMaxCut,TClonesArray * digits) const | |
d15a28e7 | 530 | { |
b2a60966 | 531 | // Calculates the number of local maxima in the cluster using fLocalMaxCut as the minimum |
a4e98857 | 532 | // energy difference between two local maxima |
b2a60966 | 533 | |
d15a28e7 | 534 | AliPHOSDigit * digit ; |
535 | AliPHOSDigit * digitN ; | |
536 | ||
537 | ||
538 | Int_t iDigitN ; | |
539 | Int_t iDigit ; | |
540 | ||
7932f811 | 541 | for(iDigit = 0; iDigit < fMulDigit; iDigit++) |
542 | maxAt[iDigit] = (Int_t) digits->At(fDigitsList[iDigit]) ; | |
543 | ||
d15a28e7 | 544 | |
6ad0bfa0 | 545 | for(iDigit = 0 ; iDigit < fMulDigit; iDigit++) { |
9f616d61 | 546 | if(maxAt[iDigit] != -1) { |
547 | digit = (AliPHOSDigit *) maxAt[iDigit] ; | |
83974468 | 548 | |
6ad0bfa0 | 549 | for(iDigitN = 0; iDigitN < fMulDigit; iDigitN++) { |
7932f811 | 550 | digitN = (AliPHOSDigit *) digits->At(fDigitsList[iDigitN]) ; |
d15a28e7 | 551 | |
9f616d61 | 552 | if ( AreNeighbours(digit, digitN) ) { |
d15a28e7 | 553 | if (fEnergyList[iDigit] > fEnergyList[iDigitN] ) { |
554 | maxAt[iDigitN] = -1 ; | |
6ad0bfa0 | 555 | // but may be digit too is not local max ? |
7932f811 | 556 | if(fEnergyList[iDigit] < fEnergyList[iDigitN] + locMaxCut) |
d15a28e7 | 557 | maxAt[iDigit] = -1 ; |
558 | } | |
559 | else { | |
560 | maxAt[iDigit] = -1 ; | |
6ad0bfa0 | 561 | // but may be digitN too is not local max ? |
7932f811 | 562 | if(fEnergyList[iDigit] > fEnergyList[iDigitN] - locMaxCut) |
d15a28e7 | 563 | maxAt[iDigitN] = -1 ; |
564 | } | |
565 | } // if Areneighbours | |
566 | } // while digitN | |
567 | } // slot not empty | |
568 | } // while digit | |
569 | ||
570 | iDigitN = 0 ; | |
6ad0bfa0 | 571 | for(iDigit = 0; iDigit < fMulDigit; iDigit++) { |
d15a28e7 | 572 | if(maxAt[iDigit] != -1){ |
573 | maxAt[iDigitN] = maxAt[iDigit] ; | |
9f616d61 | 574 | maxAtEnergy[iDigitN] = fEnergyList[iDigit] ; |
575 | iDigitN++ ; | |
d15a28e7 | 576 | } |
577 | } | |
578 | return iDigitN ; | |
579 | } | |
580 | ||
d15a28e7 | 581 | |
d15a28e7 | 582 | |
583 | //____________________________________________________________________________ | |
584 | void AliPHOSEmcRecPoint::Print(Option_t * option) | |
585 | { | |
b2a60966 | 586 | // Print the list of digits belonging to the cluster |
587 | ||
d15a28e7 | 588 | cout << "AliPHOSEmcRecPoint: " << endl ; |
589 | ||
d15a28e7 | 590 | Int_t iDigit; |
7932f811 | 591 | cout << " digits # = " ; |
592 | for(iDigit=0; iDigit<fMulDigit; iDigit++) | |
593 | cout << fDigitsList[iDigit] << " " ; | |
594 | cout << endl ; | |
595 | ||
596 | cout << " Energies = " ; | |
597 | for(iDigit=0; iDigit<fMulDigit; iDigit++) | |
598 | cout << fEnergyList[iDigit] << " "; | |
599 | cout << endl ; | |
83974468 | 600 | |
bc68d12c | 601 | cout << " Primaries " ; |
602 | for(iDigit = 0;iDigit < fMulTrack; iDigit++) | |
603 | cout << fTracksList[iDigit] << " " << endl ; | |
604 | ||
d15a28e7 | 605 | cout << " Multiplicity = " << fMulDigit << endl ; |
606 | cout << " Cluster Energy = " << fAmp << endl ; | |
bc68d12c | 607 | cout << " Number of primaries " << fMulTrack << endl ; |
83974468 | 608 | cout << " Stored at position " << GetIndexInList() << endl ; |
609 | ||
d15a28e7 | 610 | } |
88714635 | 611 | |
7932f811 | 612 |