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