]>
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 | ||
702ab87e | 18 | /* History of cvs commits: |
19 | * | |
20 | * $Log$ | |
c307c629 | 21 | * Revision 1.58 2007/04/16 09:03:37 kharlov |
22 | * Incedent angle correction fixed | |
23 | * | |
753b19cd | 24 | * Revision 1.57 2007/04/05 10:18:58 policheh |
25 | * Introduced distance to nearest bad crystal. | |
26 | * | |
dce76bbb | 27 | * Revision 1.56 2007/03/06 06:47:28 kharlov |
28 | * DP:Possibility to use actual vertex position added | |
29 | * | |
91daaf24 | 30 | * Revision 1.55 2007/01/19 20:31:19 kharlov |
31 | * Improved formatting for Print() | |
32 | * | |
6f766ada | 33 | * Revision 1.54 2006/08/28 10:01:56 kharlov |
34 | * Effective C++ warnings fixed (Timur Pocheptsov) | |
35 | * | |
3663622c | 36 | * Revision 1.53 2005/12/20 14:28:47 hristov |
37 | * Additional protection | |
38 | * | |
f33a3764 | 39 | * Revision 1.52 2005/05/28 14:19:04 schutz |
40 | * Compilation warnings fixed by T.P. | |
41 | * | |
702ab87e | 42 | */ |
43 | ||
d15a28e7 | 44 | //_________________________________________________________________________ |
b2a60966 | 45 | // RecPoint implementation for PHOS-EMC |
46 | // An EmcRecPoint is a cluster of digits | |
baef0810 | 47 | //*-- |
b2a60966 | 48 | //*-- Author: Dmitri Peressounko (RRC KI & SUBATECH) |
49 | ||
d15a28e7 | 50 | |
51 | // --- ROOT system --- | |
9f616d61 | 52 | #include "TH2.h" |
d15a28e7 | 53 | #include "TMath.h" |
9f616d61 | 54 | #include "TCanvas.h" |
55fe9d13 | 55 | #include "TGraph.h" |
d15a28e7 | 56 | |
57 | // --- Standard library --- | |
58 | ||
d15a28e7 | 59 | // --- AliRoot header files --- |
351dd634 | 60 | #include "AliLog.h" |
e957fea8 | 61 | #include "AliPHOSLoader.h" |
88cb7938 | 62 | #include "AliGenerator.h" |
d15a28e7 | 63 | #include "AliPHOSGeometry.h" |
e957fea8 | 64 | #include "AliPHOSDigit.h" |
d15a28e7 | 65 | #include "AliPHOSEmcRecPoint.h" |
e957fea8 | 66 | |
d15a28e7 | 67 | ClassImp(AliPHOSEmcRecPoint) |
68 | ||
69 | //____________________________________________________________________________ | |
3663622c | 70 | AliPHOSEmcRecPoint::AliPHOSEmcRecPoint() : |
71 | AliPHOSRecPoint(), | |
72 | fCoreEnergy(0.), fDispersion(0.), | |
73 | fEnergyList(0), fTime(-1.), fNExMax(0), | |
74 | fM2x(0.), fM2z(0.), fM3x(0.), fM4z(0.), | |
dce76bbb | 75 | fPhixe(0.), fDistToBadCrystal(-1),fDebug(0) |
d15a28e7 | 76 | { |
77 | // ctor | |
d15a28e7 | 78 | fMulDigit = 0 ; |
79 | fAmp = 0. ; | |
a6eedfad | 80 | fLocPos.SetX(1000000.) ; //Local position should be evaluated |
83974468 | 81 | } |
82 | ||
73a68ccb | 83 | //____________________________________________________________________________ |
3663622c | 84 | AliPHOSEmcRecPoint::AliPHOSEmcRecPoint(const char * opt) : |
85 | AliPHOSRecPoint(opt), | |
86 | fCoreEnergy(0.), fDispersion(0.), | |
87 | fEnergyList(0), fTime(-1.), fNExMax(0), | |
88 | fM2x(0.), fM2z(0.), fM3x(0.), fM4z(0.), | |
dce76bbb | 89 | fPhixe(0.), fDistToBadCrystal(-1), fDebug(0) |
73a68ccb | 90 | { |
91 | // ctor | |
73a68ccb | 92 | fMulDigit = 0 ; |
93 | fAmp = 0. ; | |
73a68ccb | 94 | fLocPos.SetX(1000000.) ; //Local position should be evaluated |
73a68ccb | 95 | } |
96 | ||
55fe9d13 | 97 | //____________________________________________________________________________ |
3663622c | 98 | AliPHOSEmcRecPoint::AliPHOSEmcRecPoint(const AliPHOSEmcRecPoint & rp) : |
99 | AliPHOSRecPoint(rp), | |
100 | fCoreEnergy(rp.fCoreEnergy), fDispersion(rp.fDispersion), | |
101 | fEnergyList(0), fTime(rp.fTime), fNExMax(rp.fNExMax), | |
102 | fM2x(rp.fM2x), fM2z(rp.fM2z), fM3x(rp.fM3x), fM4z(rp.fM4z), | |
dce76bbb | 103 | fPhixe(rp.fPhixe), fDistToBadCrystal(rp.fDistToBadCrystal), fDebug(rp.fDebug) |
55fe9d13 | 104 | { |
105 | // cpy ctor | |
55fe9d13 | 106 | fMulDigit = rp.fMulDigit ; |
107 | fAmp = rp.fAmp ; | |
55fe9d13 | 108 | fEnergyList = new Float_t[rp.fMulDigit] ; |
109 | Int_t index ; | |
110 | for(index = 0 ; index < fMulDigit ; index++) | |
111 | fEnergyList[index] = rp.fEnergyList[index] ; | |
55fe9d13 | 112 | } |
113 | ||
83974468 | 114 | //____________________________________________________________________________ |
115 | AliPHOSEmcRecPoint::~AliPHOSEmcRecPoint() | |
116 | { | |
88714635 | 117 | // dtor |
83974468 | 118 | if ( fEnergyList ) |
119 | delete[] fEnergyList ; | |
d15a28e7 | 120 | } |
121 | ||
d15a28e7 | 122 | //____________________________________________________________________________ |
83974468 | 123 | void AliPHOSEmcRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy) |
d15a28e7 | 124 | { |
b2a60966 | 125 | // Adds a digit to the RecPoint |
a4e98857 | 126 | // and accumulates the total amplitude and the multiplicity |
d15a28e7 | 127 | |
7932f811 | 128 | if(fEnergyList == 0) |
129 | fEnergyList = new Float_t[fMaxDigit]; | |
130 | ||
d15a28e7 | 131 | if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists |
9f616d61 | 132 | fMaxDigit*=2 ; |
0fbb8738 | 133 | Int_t * tempo = new Int_t[fMaxDigit]; |
134 | Float_t * tempoE = new Float_t[fMaxDigit]; | |
9f616d61 | 135 | |
136 | Int_t index ; | |
d15a28e7 | 137 | for ( index = 0 ; index < fMulDigit ; index++ ){ |
83974468 | 138 | tempo[index] = fDigitsList[index] ; |
d15a28e7 | 139 | tempoE[index] = fEnergyList[index] ; |
140 | } | |
141 | ||
9f616d61 | 142 | delete [] fDigitsList ; |
0fbb8738 | 143 | fDigitsList = new Int_t[fMaxDigit]; |
9f616d61 | 144 | |
145 | delete [] fEnergyList ; | |
0fbb8738 | 146 | fEnergyList = new Float_t[fMaxDigit]; |
9f616d61 | 147 | |
148 | for ( index = 0 ; index < fMulDigit ; index++ ){ | |
149 | fDigitsList[index] = tempo[index] ; | |
150 | fEnergyList[index] = tempoE[index] ; | |
151 | } | |
152 | ||
153 | delete [] tempo ; | |
154 | delete [] tempoE ; | |
155 | } // if | |
d15a28e7 | 156 | |
83974468 | 157 | fDigitsList[fMulDigit] = digit.GetIndexInList() ; |
158 | fEnergyList[fMulDigit] = Energy ; | |
159 | fMulDigit++ ; | |
d15a28e7 | 160 | fAmp += Energy ; |
7932f811 | 161 | |
162 | EvalPHOSMod(&digit) ; | |
d15a28e7 | 163 | } |
164 | ||
165 | //____________________________________________________________________________ | |
ad8cfaf4 | 166 | Bool_t AliPHOSEmcRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const |
d15a28e7 | 167 | { |
a4e98857 | 168 | // Tells if (true) or not (false) two digits are neighbors |
d15a28e7 | 169 | |
170 | Bool_t aren = kFALSE ; | |
171 | ||
686b771f | 172 | AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ; |
7b7c1533 | 173 | |
d15a28e7 | 174 | Int_t relid1[4] ; |
92862013 | 175 | phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ; |
d15a28e7 | 176 | |
177 | Int_t relid2[4] ; | |
92862013 | 178 | phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ; |
d15a28e7 | 179 | |
92862013 | 180 | Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ; |
181 | Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ; | |
d15a28e7 | 182 | |
92862013 | 183 | if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0)) |
d15a28e7 | 184 | aren = kTRUE ; |
185 | ||
186 | return aren ; | |
187 | } | |
188 | ||
189 | //____________________________________________________________________________ | |
2a941f4e | 190 | Int_t AliPHOSEmcRecPoint::Compare(const TObject * obj) const |
d15a28e7 | 191 | { |
b2a60966 | 192 | // Compares two RecPoints according to their position in the PHOS modules |
686b771f | 193 | |
194 | const Float_t delta = 1 ; //Width of "Sorting row". If you changibg this | |
7932f811 | 195 | //value (what is senseless) change as vell delta in |
196 | //AliPHOSTrackSegmentMakerv* and other RecPoints... | |
d15a28e7 | 197 | Int_t rv ; |
198 | ||
199 | AliPHOSEmcRecPoint * clu = (AliPHOSEmcRecPoint *)obj ; | |
200 | ||
201 | ||
ad8cfaf4 | 202 | Int_t phosmod1 = GetPHOSMod() ; |
92862013 | 203 | Int_t phosmod2 = clu->GetPHOSMod() ; |
d15a28e7 | 204 | |
92862013 | 205 | TVector3 locpos1; |
7932f811 | 206 | GetLocalPosition(locpos1) ; |
92862013 | 207 | TVector3 locpos2; |
208 | clu->GetLocalPosition(locpos2) ; | |
d15a28e7 | 209 | |
92862013 | 210 | if(phosmod1 == phosmod2 ) { |
7932f811 | 211 | Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ; |
d15a28e7 | 212 | if (rowdif> 0) |
7932f811 | 213 | rv = 1 ; |
d15a28e7 | 214 | else if(rowdif < 0) |
7932f811 | 215 | rv = -1 ; |
92862013 | 216 | else if(locpos1.Z()>locpos2.Z()) |
d15a28e7 | 217 | rv = -1 ; |
218 | else | |
219 | rv = 1 ; | |
220 | } | |
221 | ||
222 | else { | |
92862013 | 223 | if(phosmod1 < phosmod2 ) |
d15a28e7 | 224 | rv = -1 ; |
225 | else | |
226 | rv = 1 ; | |
227 | } | |
228 | ||
229 | return rv ; | |
230 | } | |
9f616d61 | 231 | //______________________________________________________________________________ |
702ab87e | 232 | void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) /*const*/ |
9f616d61 | 233 | { |
9f616d61 | 234 | |
9688c1dd | 235 | // Execute action corresponding to one event |
236 | // This member function is called when a AliPHOSRecPoint is clicked with the locator | |
237 | // | |
238 | // If Left button is clicked on AliPHOSRecPoint, the digits are switched on | |
239 | // and switched off when the mouse button is released. | |
240 | ||
88cb7938 | 241 | |
686b771f | 242 | AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance(); |
83974468 | 243 | |
9688c1dd | 244 | static TGraph * digitgraph = 0 ; |
83974468 | 245 | |
9688c1dd | 246 | if (!gPad->IsEditable()) return; |
83974468 | 247 | |
9688c1dd | 248 | TH2F * histo = 0 ; |
249 | TCanvas * histocanvas ; | |
250 | ||
88cb7938 | 251 | |
252 | //try to get run loader from default event folder | |
e191bb57 | 253 | AliRunLoader* rn = AliRunLoader::GetRunLoader(AliConfig::GetDefaultEventFolderName()); |
88cb7938 | 254 | if (rn == 0x0) |
255 | { | |
351dd634 | 256 | AliError(Form("Cannot find Run Loader in Default Event Folder")); |
88cb7938 | 257 | return; |
258 | } | |
259 | AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(rn->GetLoader("PHOSLoader")); | |
260 | if (gime == 0x0) | |
261 | { | |
351dd634 | 262 | AliError(Form("Cannot find PHOS Loader from Run Loader")); |
88cb7938 | 263 | return; |
264 | } | |
265 | ||
266 | ||
afa51c4e | 267 | const TClonesArray * digits = gime->Digits() ; |
9688c1dd | 268 | |
269 | switch (event) { | |
83974468 | 270 | |
9688c1dd | 271 | case kButton1Down: { |
272 | AliPHOSDigit * digit ; | |
273 | Int_t iDigit; | |
274 | Int_t relid[4] ; | |
83974468 | 275 | |
9688c1dd | 276 | const Int_t kMulDigit = AliPHOSEmcRecPoint::GetDigitsMultiplicity() ; |
277 | Float_t * xi = new Float_t[kMulDigit] ; | |
278 | Float_t * zi = new Float_t[kMulDigit] ; | |
83974468 | 279 | |
9688c1dd | 280 | // create the histogram for the single cluster |
281 | // 1. gets histogram boundaries | |
282 | Float_t ximax = -999. ; | |
283 | Float_t zimax = -999. ; | |
284 | Float_t ximin = 999. ; | |
285 | Float_t zimin = 999. ; | |
83974468 | 286 | |
9688c1dd | 287 | for(iDigit=0; iDigit<kMulDigit; iDigit++) { |
288 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; | |
289 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
290 | phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]); | |
291 | if ( xi[iDigit] > ximax ) | |
292 | ximax = xi[iDigit] ; | |
293 | if ( xi[iDigit] < ximin ) | |
294 | ximin = xi[iDigit] ; | |
295 | if ( zi[iDigit] > zimax ) | |
296 | zimax = zi[iDigit] ; | |
297 | if ( zi[iDigit] < zimin ) | |
298 | zimin = zi[iDigit] ; | |
299 | } | |
300 | ximax += phosgeom->GetCrystalSize(0) / 2. ; | |
301 | zimax += phosgeom->GetCrystalSize(2) / 2. ; | |
302 | ximin -= phosgeom->GetCrystalSize(0) / 2. ; | |
303 | zimin -= phosgeom->GetCrystalSize(2) / 2. ; | |
304 | Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ; | |
305 | Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ; | |
83974468 | 306 | |
9688c1dd | 307 | // 2. gets the histogram title |
83974468 | 308 | |
9688c1dd | 309 | Text_t title[100] ; |
310 | sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ; | |
83974468 | 311 | |
9688c1dd | 312 | if (!histo) { |
313 | delete histo ; | |
314 | histo = 0 ; | |
315 | } | |
316 | histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ; | |
83974468 | 317 | |
9688c1dd | 318 | Float_t x, z ; |
319 | for(iDigit=0; iDigit<kMulDigit; iDigit++) { | |
320 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; | |
321 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
322 | phosgeom->RelPosInModule(relid, x, z); | |
323 | histo->Fill(x, z, fEnergyList[iDigit] ) ; | |
324 | } | |
83974468 | 325 | |
9688c1dd | 326 | if (!digitgraph) { |
327 | digitgraph = new TGraph(kMulDigit,xi,zi); | |
328 | digitgraph-> SetMarkerStyle(5) ; | |
329 | digitgraph-> SetMarkerSize(1.) ; | |
330 | digitgraph-> SetMarkerColor(1) ; | |
331 | digitgraph-> Paint("P") ; | |
332 | } | |
83974468 | 333 | |
9688c1dd | 334 | // Print() ; |
335 | histocanvas = new TCanvas("cluster", "a single cluster", 600, 500) ; | |
336 | histocanvas->Draw() ; | |
337 | histo->Draw("lego1") ; | |
83974468 | 338 | |
9688c1dd | 339 | delete[] xi ; |
340 | delete[] zi ; | |
83974468 | 341 | |
9688c1dd | 342 | break; |
343 | } | |
83974468 | 344 | |
9688c1dd | 345 | case kButton1Up: |
346 | if (digitgraph) { | |
347 | delete digitgraph ; | |
348 | digitgraph = 0 ; | |
349 | } | |
350 | break; | |
9f616d61 | 351 | |
9688c1dd | 352 | } |
9f616d61 | 353 | } |
354 | ||
d15a28e7 | 355 | //____________________________________________________________________________ |
91daaf24 | 356 | void AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits, TVector3 &vInc) |
d15a28e7 | 357 | { |
b2a60966 | 358 | // Calculates the dispersion of the shower at the origine of the RecPoint |
91daaf24 | 359 | //DP: should we correct dispersion for non-perpendicular hit???????? |
360 | ||
e5b16749 | 361 | Float_t d = 0. ; |
362 | Float_t wtot = 0. ; | |
d15a28e7 | 363 | |
d084d50d | 364 | Float_t x = 0.; |
365 | Float_t z = 0.; | |
d15a28e7 | 366 | |
367 | AliPHOSDigit * digit ; | |
7b7c1533 | 368 | |
686b771f | 369 | AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance(); |
e5b16749 | 370 | |
371 | // Calculates the center of gravity in the local PHOS-module coordinates | |
372 | ||
d15a28e7 | 373 | Int_t iDigit; |
e5b16749 | 374 | |
375 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
376 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; | |
377 | Int_t relid[4] ; | |
378 | Float_t xi ; | |
379 | Float_t zi ; | |
380 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
381 | phosgeom->RelPosInModule(relid, xi, zi); | |
f33a3764 | 382 | if (fAmp>0 && fEnergyList[iDigit]>0) { |
383 | Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ; | |
384 | x += xi * w ; | |
385 | z += zi * w ; | |
386 | wtot += w ; | |
387 | } | |
388 | else | |
389 | AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp)); | |
e5b16749 | 390 | } |
f33a3764 | 391 | if (wtot>0) { |
392 | x /= wtot ; | |
393 | z /= wtot ; | |
394 | } | |
395 | else | |
396 | AliError(Form("Wrong weight %f\n", wtot)); | |
e5b16749 | 397 | |
398 | ||
399 | // Calculates the dispersion in coordinates | |
400 | wtot = 0.; | |
88714635 | 401 | for(iDigit=0; iDigit < fMulDigit; iDigit++) { |
7932f811 | 402 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; |
d15a28e7 | 403 | Int_t relid[4] ; |
404 | Float_t xi ; | |
405 | Float_t zi ; | |
92862013 | 406 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; |
407 | phosgeom->RelPosInModule(relid, xi, zi); | |
f33a3764 | 408 | if (fAmp>0 && fEnergyList[iDigit]>0) { |
409 | Float_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ; | |
410 | d += w*((xi-x)*(xi-x) + (zi-z)*(zi-z) ) ; | |
411 | wtot+=w ; | |
412 | } | |
413 | else | |
414 | AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp)); | |
d15a28e7 | 415 | } |
e5b16749 | 416 | |
7932f811 | 417 | |
f33a3764 | 418 | if (wtot>0) { |
419 | d /= wtot ; | |
420 | } | |
421 | else | |
422 | AliError(Form("Wrong weight %f\n", wtot)); | |
d15a28e7 | 423 | |
f33a3764 | 424 | fDispersion = 0; |
425 | if (d>=0) | |
426 | fDispersion = TMath::Sqrt(d) ; | |
91daaf24 | 427 | |
c63c49e9 | 428 | |
d15a28e7 | 429 | } |
fad3e5b9 | 430 | //______________________________________________________________________________ |
e5b16749 | 431 | void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits) |
fad3e5b9 | 432 | { |
a4e98857 | 433 | // This function calculates energy in the core, |
434 | // i.e. within a radius rad = 3cm around the center. Beyond this radius | |
435 | // in accordance with shower profile the energy deposition | |
fad3e5b9 | 436 | // should be less than 2% |
91daaf24 | 437 | //DP: non-perpendicular incidence?????????????? |
fad3e5b9 | 438 | |
fad3e5b9 | 439 | Float_t coreRadius = 3 ; |
440 | ||
e5b16749 | 441 | Float_t x = 0 ; |
442 | Float_t z = 0 ; | |
fad3e5b9 | 443 | |
444 | AliPHOSDigit * digit ; | |
7b7c1533 | 445 | |
686b771f | 446 | AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance(); |
88cb7938 | 447 | |
fad3e5b9 | 448 | Int_t iDigit; |
e5b16749 | 449 | |
450 | // Calculates the center of gravity in the local PHOS-module coordinates | |
451 | Float_t wtot = 0; | |
452 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
453 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; | |
454 | Int_t relid[4] ; | |
455 | Float_t xi ; | |
456 | Float_t zi ; | |
457 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
458 | phosgeom->RelPosInModule(relid, xi, zi); | |
f33a3764 | 459 | if (fAmp>0 && fEnergyList[iDigit]>0) { |
460 | Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ; | |
461 | x += xi * w ; | |
462 | z += zi * w ; | |
463 | wtot += w ; | |
464 | } | |
465 | else | |
466 | AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp)); | |
e5b16749 | 467 | } |
f33a3764 | 468 | if (wtot>0) { |
469 | x /= wtot ; | |
470 | z /= wtot ; | |
471 | } | |
472 | else | |
473 | AliError(Form("Wrong weight %f\n", wtot)); | |
e5b16749 | 474 | |
475 | ||
fad3e5b9 | 476 | for(iDigit=0; iDigit < fMulDigit; iDigit++) { |
7932f811 | 477 | digit = (AliPHOSDigit *) ( digits->At(fDigitsList[iDigit]) ) ; |
fad3e5b9 | 478 | Int_t relid[4] ; |
479 | Float_t xi ; | |
480 | Float_t zi ; | |
481 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
482 | phosgeom->RelPosInModule(relid, xi, zi); | |
483 | Float_t distance = TMath::Sqrt((xi-x)*(xi-x)+(zi-z)*(zi-z)) ; | |
484 | if(distance < coreRadius) | |
7932f811 | 485 | fCoreEnergy += fEnergyList[iDigit] ; |
fad3e5b9 | 486 | } |
487 | ||
91daaf24 | 488 | |
fad3e5b9 | 489 | } |
d15a28e7 | 490 | |
491 | //____________________________________________________________________________ | |
91daaf24 | 492 | void AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits, TVector3 &vInc) |
d15a28e7 | 493 | { |
b2a60966 | 494 | // Calculates the axis of the shower ellipsoid |
83974468 | 495 | |
e8dbb96e | 496 | Double_t wtot = 0. ; |
497 | Double_t x = 0.; | |
498 | Double_t z = 0.; | |
499 | Double_t dxx = 0.; | |
500 | Double_t dzz = 0.; | |
501 | Double_t dxz = 0.; | |
d15a28e7 | 502 | |
503 | AliPHOSDigit * digit ; | |
7b7c1533 | 504 | |
686b771f | 505 | AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance(); |
7b7c1533 | 506 | |
d15a28e7 | 507 | Int_t iDigit; |
508 | ||
e5b16749 | 509 | |
d15a28e7 | 510 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { |
7932f811 | 511 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; |
d15a28e7 | 512 | Int_t relid[4] ; |
513 | Float_t xi ; | |
514 | Float_t zi ; | |
92862013 | 515 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; |
516 | phosgeom->RelPosInModule(relid, xi, zi); | |
f33a3764 | 517 | if (fAmp>0 && fEnergyList[iDigit]>0) { |
518 | Double_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ; | |
519 | dxx += w * xi * xi ; | |
520 | x += w * xi ; | |
521 | dzz += w * zi * zi ; | |
522 | z += w * zi ; | |
523 | dxz += w * xi * zi ; | |
524 | wtot += w ; | |
525 | } | |
526 | else | |
527 | AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp)); | |
d15a28e7 | 528 | } |
f33a3764 | 529 | if (wtot>0) { |
530 | dxx /= wtot ; | |
531 | x /= wtot ; | |
532 | dxx -= x * x ; | |
533 | dzz /= wtot ; | |
534 | z /= wtot ; | |
535 | dzz -= z * z ; | |
536 | dxz /= wtot ; | |
537 | dxz -= x * z ; | |
d15a28e7 | 538 | |
69183710 | 539 | // //Apply correction due to non-perpendicular incidence |
540 | // Double_t CosX ; | |
541 | // Double_t CosZ ; | |
88cb7938 | 542 | // AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
7b7c1533 | 543 | // AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry(); |
91daaf24 | 544 | // Double_t DistanceToIP= (Double_t ) phosgeom->GetIPtoCrystalSurface() ; |
69183710 | 545 | |
546 | // CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ; | |
547 | // CosZ = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+z*z) ; | |
548 | ||
549 | // dxx = dxx/(CosX*CosX) ; | |
550 | // dzz = dzz/(CosZ*CosZ) ; | |
551 | // dxz = dxz/(CosX*CosZ) ; | |
552 | ||
553 | ||
f33a3764 | 554 | fLambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ; |
555 | if(fLambda[0] > 0) | |
556 | fLambda[0] = TMath::Sqrt(fLambda[0]) ; | |
e8dbb96e | 557 | |
f33a3764 | 558 | fLambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ; |
559 | if(fLambda[1] > 0) //To avoid exception if numerical errors lead to negative lambda. | |
560 | fLambda[1] = TMath::Sqrt(fLambda[1]) ; | |
561 | else | |
562 | fLambda[1]= 0. ; | |
563 | } | |
564 | else { | |
565 | AliError(Form("Wrong weight %f\n", wtot)); | |
566 | fLambda[0]=fLambda[1]=0.; | |
567 | } | |
d15a28e7 | 568 | } |
569 | ||
ce2a9a95 | 570 | //____________________________________________________________________________ |
91daaf24 | 571 | void AliPHOSEmcRecPoint::EvalMoments(Float_t logWeight,TClonesArray * digits, TVector3 &vInc) |
ce2a9a95 | 572 | { |
573 | // Calculate the shower moments in the eigen reference system | |
574 | // M2x, M2z, M3x, M4z | |
575 | // Calculate the angle between the shower position vector and the eigen vector | |
576 | ||
577 | Double_t wtot = 0. ; | |
578 | Double_t x = 0.; | |
579 | Double_t z = 0.; | |
580 | Double_t dxx = 0.; | |
581 | Double_t dzz = 0.; | |
582 | Double_t dxz = 0.; | |
583 | Double_t lambda0=0, lambda1=0; | |
584 | ||
585 | AliPHOSDigit * digit ; | |
586 | ||
686b771f | 587 | AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ; |
ce2a9a95 | 588 | |
589 | Int_t iDigit; | |
590 | ||
591 | // 1) Find covariance matrix elements: | |
592 | // || dxx dxz || | |
593 | // || dxz dzz || | |
594 | ||
595 | Float_t xi ; | |
596 | Float_t zi ; | |
597 | Int_t relid[4] ; | |
598 | Double_t w; | |
599 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
600 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; | |
601 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
602 | phosgeom->RelPosInModule(relid, xi, zi); | |
f33a3764 | 603 | if (fAmp>0 && fEnergyList[iDigit]>0) { |
604 | w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ; | |
605 | x += w * xi ; | |
606 | z += w * zi ; | |
607 | dxx += w * xi * xi ; | |
608 | dzz += w * zi * zi ; | |
609 | dxz += w * xi * zi ; | |
610 | wtot += w ; | |
611 | } | |
612 | else | |
613 | AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp)); | |
614 | ||
ce2a9a95 | 615 | } |
f33a3764 | 616 | if (wtot>0) { |
617 | x /= wtot ; | |
618 | z /= wtot ; | |
619 | dxx /= wtot ; | |
620 | dzz /= wtot ; | |
621 | dxz /= wtot ; | |
622 | dxx -= x * x ; | |
623 | dzz -= z * z ; | |
624 | dxz -= x * z ; | |
ce2a9a95 | 625 | |
626 | // 2) Find covariance matrix eigen values lambda0 and lambda1 | |
627 | ||
f33a3764 | 628 | lambda0 = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ; |
629 | lambda1 = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ; | |
630 | } | |
631 | else { | |
632 | AliError(Form("Wrong weight %f\n", wtot)); | |
633 | lambda0=lambda1=0.; | |
634 | } | |
ce2a9a95 | 635 | |
636 | // 3) Find covariance matrix eigen vectors e0 and e1 | |
637 | ||
638 | TVector2 e0,e1; | |
639 | if (dxz != 0) | |
640 | e0.Set(1.,(lambda0-dxx)/dxz); | |
641 | else | |
642 | e0.Set(0.,1.); | |
643 | ||
644 | e0 = e0.Unit(); | |
645 | e1.Set(-e0.Y(),e0.X()); | |
646 | ||
647 | // 4) Rotate cluster tensor from (x,z) to (e0,e1) system | |
648 | // and calculate moments M3x and M4z | |
649 | ||
650 | Float_t cosPhi = e0.X(); | |
651 | Float_t sinPhi = e0.Y(); | |
652 | ||
653 | Float_t xiPHOS ; | |
654 | Float_t ziPHOS ; | |
655 | Double_t dx3, dz3, dz4; | |
656 | wtot = 0.; | |
657 | x = 0.; | |
658 | z = 0.; | |
659 | dxx = 0.; | |
660 | dzz = 0.; | |
661 | dxz = 0.; | |
662 | dx3 = 0.; | |
663 | dz3 = 0.; | |
664 | dz4 = 0.; | |
665 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
666 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; | |
667 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
668 | phosgeom->RelPosInModule(relid, xiPHOS, ziPHOS); | |
669 | xi = xiPHOS*cosPhi + ziPHOS*sinPhi; | |
670 | zi = ziPHOS*cosPhi - xiPHOS*sinPhi; | |
f33a3764 | 671 | if (fAmp>0 && fEnergyList[iDigit]>0) { |
672 | w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ; | |
673 | x += w * xi ; | |
674 | z += w * zi ; | |
675 | dxx += w * xi * xi ; | |
676 | dzz += w * zi * zi ; | |
677 | dxz += w * xi * zi ; | |
678 | dx3 += w * xi * xi * xi; | |
679 | dz3 += w * zi * zi * zi ; | |
680 | dz4 += w * zi * zi * zi * zi ; | |
681 | wtot += w ; | |
682 | } | |
683 | else | |
684 | AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp)); | |
ce2a9a95 | 685 | } |
f33a3764 | 686 | if (wtot>0) { |
687 | x /= wtot ; | |
688 | z /= wtot ; | |
689 | dxx /= wtot ; | |
690 | dzz /= wtot ; | |
691 | dxz /= wtot ; | |
692 | dx3 /= wtot ; | |
693 | dz3 /= wtot ; | |
694 | dz4 /= wtot ; | |
695 | dx3 += -3*dxx*x + 2*x*x*x; | |
696 | dz4 += -4*dz3*z + 6*dzz*z*z -3*z*z*z*z; | |
697 | dxx -= x * x ; | |
698 | dzz -= z * z ; | |
699 | dxz -= x * z ; | |
700 | } | |
701 | else | |
702 | AliError(Form("Wrong weight %f\n", wtot)); | |
ce2a9a95 | 703 | |
704 | // 5) Find an angle between cluster center vector and eigen vector e0 | |
705 | ||
f33a3764 | 706 | Float_t phi = 0; |
707 | if ( (x*x+z*z) > 0 ) | |
708 | phi = TMath::ACos ((x*e0.X() + z*e0.Y()) / sqrt(x*x + z*z)); | |
ce2a9a95 | 709 | |
710 | fM2x = lambda0; | |
711 | fM2z = lambda1; | |
712 | fM3x = dx3; | |
713 | fM4z = dz4; | |
714 | fPhixe = phi; | |
715 | ||
716 | } | |
c307c629 | 717 | //______________________________________________________________________________ |
718 | void AliPHOSEmcRecPoint::EvalPrimaries(TClonesArray * digits) | |
719 | { | |
720 | // Constructs the list of primary particles (tracks) which have contributed to this RecPoint | |
721 | ||
722 | AliPHOSDigit * digit ; | |
723 | Int_t * tempo = new Int_t[fMaxTrack] ; | |
724 | ||
725 | //First find digit with maximal energy deposition and copy its primaries | |
726 | Float_t emax=0.; | |
727 | Int_t imaxDigit=0; | |
728 | for(Int_t id=0; id<GetDigitsMultiplicity(); id++){ | |
729 | if(emax<fEnergyList[id]) | |
730 | imaxDigit=id ; | |
731 | } | |
732 | digit = dynamic_cast<AliPHOSDigit *>(digits->At( fDigitsList[imaxDigit] )) ; | |
733 | Int_t nprimaries = digit->GetNprimary() ; | |
734 | if ( nprimaries > fMaxTrack ) { | |
735 | fMulTrack = - 1 ; | |
736 | Error("EvalPrimaries", "GetNprimaries ERROR > increase fMaxTrack" ) ; | |
737 | nprimaries = fMaxTrack; //skip the rest | |
738 | } | |
739 | for(fMulTrack=1; fMulTrack<=nprimaries ; fMulTrack++){ | |
740 | tempo[fMulTrack-1] = digit->GetPrimary(fMulTrack) ; | |
741 | } | |
742 | ||
743 | //Now add other digits contributions | |
744 | for (Int_t index = 0 ; index < GetDigitsMultiplicity() ; index++ ) { // all digits | |
745 | if(index==imaxDigit) //already in | |
746 | continue ; | |
747 | digit = dynamic_cast<AliPHOSDigit *>(digits->At( fDigitsList[index] )) ; | |
748 | nprimaries = digit->GetNprimary() ; | |
749 | for(Int_t ipr=0; ipr<nprimaries; ipr++){ | |
750 | Int_t iprimary = digit->GetPrimary(ipr+1) ; | |
751 | Bool_t notIn=1 ; | |
752 | for(Int_t kndex = 0 ; (kndex < fMulTrack)&& notIn ; kndex++ ) { //check if not already stored | |
753 | if(iprimary == tempo[kndex]){ | |
754 | notIn = kFALSE ; | |
755 | } | |
756 | } | |
757 | if(notIn){ | |
758 | if(fMulTrack<fMaxTrack){ | |
759 | tempo[fMulTrack]=iprimary ; | |
760 | fMulTrack++ ; | |
761 | } | |
762 | else{ | |
763 | Error("EvalPrimaries", "GetNprimaries ERROR > increase fMaxTrack!!!" ) ; | |
764 | break ; | |
765 | } | |
766 | } | |
767 | } | |
768 | } // all digits | |
769 | ||
770 | if(fMulTrack > 0){ | |
771 | if(fTracksList)delete [] fTracksList; | |
772 | fTracksList = new Int_t[fMulTrack] ; | |
773 | } | |
774 | for(Int_t index = 0; index < fMulTrack; index++) | |
775 | fTracksList[index] = tempo[index] ; | |
776 | ||
777 | delete [] tempo ; | |
778 | ||
779 | } | |
780 | ||
b2a60966 | 781 | //____________________________________________________________________________ |
7932f811 | 782 | void AliPHOSEmcRecPoint::EvalAll(Float_t logWeight, TClonesArray * digits ) |
ad8cfaf4 | 783 | { |
e5b16749 | 784 | EvalCoreEnergy(logWeight, digits); |
a6eedfad | 785 | EvalTime(digits) ; |
c307c629 | 786 | EvalPrimaries(digits) ; |
e957fea8 | 787 | AliPHOSRecPoint::EvalAll(digits) ; |
ad8cfaf4 | 788 | } |
789 | //____________________________________________________________________________ | |
91daaf24 | 790 | void AliPHOSEmcRecPoint::EvalAll(Float_t logWeight, TVector3 &vtx, TClonesArray * digits ) |
791 | { | |
792 | // Evaluates all shower parameters | |
793 | TVector3 vInc ; | |
794 | EvalLocalPosition(logWeight, vtx, digits,vInc) ; | |
795 | EvalElipsAxis(logWeight, digits, vInc) ; //they are evaluated with momenta | |
796 | EvalMoments(logWeight, digits, vInc) ; | |
797 | EvalDispersion(logWeight, digits, vInc) ; | |
798 | } | |
799 | //____________________________________________________________________________ | |
800 | void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TVector3 &vtx, TClonesArray * digits, TVector3 &vInc) | |
b2a60966 | 801 | { |
802 | // Calculates the center of gravity in the local PHOS-module coordinates | |
b2a60966 | 803 | Float_t wtot = 0. ; |
804 | ||
805 | Int_t relid[4] ; | |
806 | ||
807 | Float_t x = 0. ; | |
808 | Float_t z = 0. ; | |
809 | ||
810 | AliPHOSDigit * digit ; | |
811 | ||
686b771f | 812 | AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ; |
b2a60966 | 813 | |
814 | Int_t iDigit; | |
815 | ||
b2a60966 | 816 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { |
7932f811 | 817 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; |
b2a60966 | 818 | |
819 | Float_t xi ; | |
820 | Float_t zi ; | |
821 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
822 | phosgeom->RelPosInModule(relid, xi, zi); | |
f33a3764 | 823 | if (fAmp>0 && fEnergyList[iDigit]>0) { |
824 | Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ; | |
825 | x += xi * w ; | |
826 | z += zi * w ; | |
827 | wtot += w ; | |
828 | } | |
829 | else | |
830 | AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp)); | |
9ce1a8d9 | 831 | } |
f33a3764 | 832 | if (wtot>0) { |
833 | x /= wtot ; | |
834 | z /= wtot ; | |
835 | } | |
836 | else | |
837 | AliError(Form("Wrong weight %f\n", wtot)); | |
ad8cfaf4 | 838 | |
839 | // Correction for the depth of the shower starting point (TDR p 127) | |
840 | Float_t para = 0.925 ; | |
841 | Float_t parb = 6.52 ; | |
842 | ||
91daaf24 | 843 | phosgeom->GetIncidentVector(vtx,GetPHOSMod(),x,z,vInc) ; |
1b799736 | 844 | |
f33a3764 | 845 | Float_t depthx = 0.; |
846 | Float_t depthz = 0.; | |
91daaf24 | 847 | if (fAmp>0&&vInc.Y()!=0.) { |
753b19cd | 848 | depthx = ( para * TMath::Log(fAmp) + parb ) * vInc.X()/TMath::Abs(vInc.Y()) ; |
849 | depthz = ( para * TMath::Log(fAmp) + parb ) * vInc.Z()/TMath::Abs(vInc.Y()) ; | |
f33a3764 | 850 | } |
851 | else | |
852 | AliError(Form("Wrong amplitude %f\n", fAmp)); | |
ad8cfaf4 | 853 | |
854 | fLocPos.SetX(x - depthx) ; | |
b2a60966 | 855 | fLocPos.SetY(0.) ; |
ad8cfaf4 | 856 | fLocPos.SetZ(z - depthz) ; |
b2a60966 | 857 | |
a6eedfad | 858 | fLocPosM = 0 ; |
b2a60966 | 859 | } |
860 | ||
d15a28e7 | 861 | //____________________________________________________________________________ |
ad8cfaf4 | 862 | Float_t AliPHOSEmcRecPoint::GetMaximalEnergy(void) const |
d15a28e7 | 863 | { |
b2a60966 | 864 | // Finds the maximum energy in the cluster |
865 | ||
d15a28e7 | 866 | Float_t menergy = 0. ; |
867 | ||
868 | Int_t iDigit; | |
869 | ||
870 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
871 | ||
872 | if(fEnergyList[iDigit] > menergy) | |
873 | menergy = fEnergyList[iDigit] ; | |
874 | } | |
875 | return menergy ; | |
876 | } | |
877 | ||
878 | //____________________________________________________________________________ | |
fc7e2f43 | 879 | Int_t AliPHOSEmcRecPoint::GetMultiplicityAtLevel(Float_t H) const |
d15a28e7 | 880 | { |
b2a60966 | 881 | // Calculates the multiplicity of digits with energy larger than H*energy |
882 | ||
d15a28e7 | 883 | Int_t multipl = 0 ; |
884 | Int_t iDigit ; | |
885 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
886 | ||
887 | if(fEnergyList[iDigit] > H * fAmp) | |
888 | multipl++ ; | |
889 | } | |
890 | return multipl ; | |
891 | } | |
892 | ||
893 | //____________________________________________________________________________ | |
a0636361 | 894 | Int_t AliPHOSEmcRecPoint::GetNumberOfLocalMax( AliPHOSDigit ** maxAt, Float_t * maxAtEnergy, |
7932f811 | 895 | Float_t locMaxCut,TClonesArray * digits) const |
d15a28e7 | 896 | { |
b2a60966 | 897 | // Calculates the number of local maxima in the cluster using fLocalMaxCut as the minimum |
a4e98857 | 898 | // energy difference between two local maxima |
b2a60966 | 899 | |
d15a28e7 | 900 | AliPHOSDigit * digit ; |
901 | AliPHOSDigit * digitN ; | |
902 | ||
903 | ||
904 | Int_t iDigitN ; | |
905 | Int_t iDigit ; | |
906 | ||
7932f811 | 907 | for(iDigit = 0; iDigit < fMulDigit; iDigit++) |
a0636361 | 908 | maxAt[iDigit] = (AliPHOSDigit*) digits->At(fDigitsList[iDigit]) ; |
7932f811 | 909 | |
d15a28e7 | 910 | |
6ad0bfa0 | 911 | for(iDigit = 0 ; iDigit < fMulDigit; iDigit++) { |
a0636361 | 912 | if(maxAt[iDigit]) { |
913 | digit = maxAt[iDigit] ; | |
83974468 | 914 | |
6ad0bfa0 | 915 | for(iDigitN = 0; iDigitN < fMulDigit; iDigitN++) { |
686b771f | 916 | if(iDigit == iDigitN) |
917 | continue ; | |
918 | ||
7932f811 | 919 | digitN = (AliPHOSDigit *) digits->At(fDigitsList[iDigitN]) ; |
d15a28e7 | 920 | |
9f616d61 | 921 | if ( AreNeighbours(digit, digitN) ) { |
d15a28e7 | 922 | if (fEnergyList[iDigit] > fEnergyList[iDigitN] ) { |
a0636361 | 923 | maxAt[iDigitN] = 0 ; |
6ad0bfa0 | 924 | // but may be digit too is not local max ? |
7932f811 | 925 | if(fEnergyList[iDigit] < fEnergyList[iDigitN] + locMaxCut) |
a0636361 | 926 | maxAt[iDigit] = 0 ; |
d15a28e7 | 927 | } |
928 | else { | |
a0636361 | 929 | maxAt[iDigit] = 0 ; |
6ad0bfa0 | 930 | // but may be digitN too is not local max ? |
7932f811 | 931 | if(fEnergyList[iDigit] > fEnergyList[iDigitN] - locMaxCut) |
a0636361 | 932 | maxAt[iDigitN] = 0 ; |
d15a28e7 | 933 | } |
934 | } // if Areneighbours | |
935 | } // while digitN | |
936 | } // slot not empty | |
937 | } // while digit | |
938 | ||
939 | iDigitN = 0 ; | |
6ad0bfa0 | 940 | for(iDigit = 0; iDigit < fMulDigit; iDigit++) { |
a0636361 | 941 | if(maxAt[iDigit]){ |
d15a28e7 | 942 | maxAt[iDigitN] = maxAt[iDigit] ; |
9f616d61 | 943 | maxAtEnergy[iDigitN] = fEnergyList[iDigit] ; |
944 | iDigitN++ ; | |
d15a28e7 | 945 | } |
946 | } | |
947 | return iDigitN ; | |
948 | } | |
9688c1dd | 949 | //____________________________________________________________________________ |
0bc3b8ed | 950 | void AliPHOSEmcRecPoint::EvalTime(TClonesArray * digits) |
951 | { | |
952 | // Define a rec.point time as a time in the cell with the maximum energy | |
953 | ||
9688c1dd | 954 | Float_t maxE = 0; |
955 | Int_t maxAt = 0; | |
956 | for(Int_t idig=0; idig < fMulDigit; idig++){ | |
957 | if(fEnergyList[idig] > maxE){ | |
958 | maxE = fEnergyList[idig] ; | |
959 | maxAt = idig; | |
960 | } | |
961 | } | |
962 | fTime = ((AliPHOSDigit*) digits->At(fDigitsList[maxAt]))->GetTime() ; | |
963 | ||
964 | } | |
d15a28e7 | 965 | //____________________________________________________________________________ |
092b50ba | 966 | void AliPHOSEmcRecPoint::Purify(Float_t threshold){ |
967 | //Removes digits below threshold | |
968 | ||
0fbb8738 | 969 | Int_t * tempo = new Int_t[fMaxDigit]; |
970 | Float_t * tempoE = new Float_t[fMaxDigit]; | |
092b50ba | 971 | |
972 | Int_t mult = 0 ; | |
973 | for(Int_t iDigit=0;iDigit< fMulDigit ;iDigit++){ | |
974 | if(fEnergyList[iDigit] > threshold){ | |
975 | tempo[mult] = fDigitsList[iDigit] ; | |
976 | tempoE[mult] = fEnergyList[iDigit] ; | |
977 | mult++ ; | |
978 | } | |
979 | } | |
980 | ||
981 | fMulDigit = mult ; | |
982 | delete [] fDigitsList ; | |
983 | delete [] fEnergyList ; | |
0fbb8738 | 984 | fDigitsList = new Int_t[fMulDigit]; |
985 | fEnergyList = new Float_t[fMulDigit]; | |
092b50ba | 986 | |
0458aa58 | 987 | fAmp = 0.; //Recalculate total energy |
092b50ba | 988 | for(Int_t iDigit=0;iDigit< fMulDigit ;iDigit++){ |
0458aa58 | 989 | fDigitsList[iDigit] = tempo[iDigit]; |
990 | fEnergyList[iDigit] = tempoE[iDigit] ; | |
991 | fAmp+=tempoE[iDigit]; | |
092b50ba | 992 | } |
993 | ||
994 | delete [] tempo ; | |
995 | delete [] tempoE ; | |
996 | ||
997 | } | |
998 | //____________________________________________________________________________ | |
a8c47ab6 | 999 | void AliPHOSEmcRecPoint::Print(Option_t *) const |
d15a28e7 | 1000 | { |
b2a60966 | 1001 | // Print the list of digits belonging to the cluster |
1002 | ||
21cd0c07 | 1003 | TString message ; |
1004 | message = "AliPHOSEmcRecPoint:\n" ; | |
6f766ada | 1005 | message += "Digit multiplicity = %d" ; |
1006 | message += ", cluster Energy = %f" ; | |
1007 | message += ", number of primaries = %d" ; | |
1008 | message += ", rec.point index = %d \n" ; | |
1009 | printf(message.Data(), fMulDigit, fAmp, fMulTrack,GetIndexInList() ) ; | |
d15a28e7 | 1010 | |
d15a28e7 | 1011 | Int_t iDigit; |
6f766ada | 1012 | printf(" digits ids = ") ; |
7932f811 | 1013 | for(iDigit=0; iDigit<fMulDigit; iDigit++) |
53ad38d8 | 1014 | printf(" %d ", fDigitsList[iDigit] ) ; |
7932f811 | 1015 | |
6f766ada | 1016 | printf("\n digit energies = ") ; |
7932f811 | 1017 | for(iDigit=0; iDigit<fMulDigit; iDigit++) |
53ad38d8 | 1018 | printf(" %f ", fEnergyList[iDigit] ) ; |
6f766ada | 1019 | |
1020 | printf("\n digit primaries ") ; | |
1021 | if (fMulTrack<1) printf("... no primaries"); | |
bc68d12c | 1022 | for(iDigit = 0;iDigit < fMulTrack; iDigit++) |
53ad38d8 | 1023 | printf(" %d ", fTracksList[iDigit]) ; |
1024 | printf("\n") ; | |
6f766ada | 1025 | |
d15a28e7 | 1026 | } |
88714635 | 1027 | |
7932f811 | 1028 |