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