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