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