]>
Commit | Line | Data |
---|---|---|
89308175 | 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 | **************************************************************************/ | |
89308175 | 15 | |
3010c308 | 16 | /* $Id$ */ |
17 | ||
89308175 | 18 | //*-- Author: Boris Polichtchouk, IHEP |
19 | ////////////////////////////////////////////////////////////////////////////// | |
20 | // Reconstructed point operations for the Clusterization class for IHEP reconstruction. | |
21 | // Performs clusterization (collects neighbouring active cells) | |
22 | // It differs from AliPHOSClusterizerv1 in neighbour definition only | |
23 | ||
cbd576a6 | 24 | // ---- ROOT system --- |
3010c308 | 25 | #include <TMath.h> |
26 | #include <TDirectory.h> | |
27 | #include <TBranch.h> | |
28 | #include <TTree.h> | |
29 | #include <TROOT.h> | |
30 | #include <TFolder.h> | |
cbd576a6 | 31 | |
32 | // --- AliRoot header files --- | |
351dd634 | 33 | #include "AliLog.h" |
88cb7938 | 34 | #include "AliConfig.h" |
e957fea8 | 35 | #include "AliPHOSDigit.h" |
88cb7938 | 36 | #include "AliPHOSClusterizer.h" |
cbd576a6 | 37 | #include "AliPHOSEvalRecPoint.h" |
38 | #include "AliRun.h" | |
88cb7938 | 39 | #include "AliPHOSLoader.h" |
cbd576a6 | 40 | #include "AliPHOSRecCpvManager.h" |
41 | #include "AliPHOSRecEmcManager.h" | |
42 | #include "AliPHOSDigitizer.h" | |
e957fea8 | 43 | #include "AliPHOSGeometry.h" |
cbd576a6 | 44 | |
45 | // --- Standard library --- | |
cbd576a6 | 46 | |
47 | ||
48 | ClassImp(AliPHOSEvalRecPoint) | |
49 | ||
3f7dbdb7 | 50 | AliPHOSEvalRecPoint::AliPHOSEvalRecPoint() : |
51 | fIsEmc(kFALSE), | |
52 | fIsCpv(kTRUE), | |
53 | fParent(-333), | |
54 | fChi2Dof(-111), | |
55 | fEventFolderName(AliConfig::GetDefaultEventFolderName()) | |
cbd576a6 | 56 | { |
89308175 | 57 | // default ctor |
cbd576a6 | 58 | } |
59 | ||
3f7dbdb7 | 60 | AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent) : |
61 | fIsEmc(kFALSE), | |
62 | fIsCpv(kFALSE), | |
63 | fParent(-333), | |
64 | fChi2Dof(-111), | |
65 | fEventFolderName("") | |
cbd576a6 | 66 | { |
89308175 | 67 | // ctor |
cbd576a6 | 68 | fParent=-333; |
69 | fChi2Dof=-111; | |
70 | ||
71 | // fParent=parent; | |
72 | TObjArray* wPool = (TObjArray*)GetWorkingPool(); | |
73 | if(!wPool) { | |
e957fea8 | 74 | Fatal("ctor", "Couldn't find working pool") ; |
cbd576a6 | 75 | } |
76 | ||
77 | fParent = wPool->IndexOf((TObject*)parent); | |
78 | fChi2Dof = parent->Chi2Dof(); | |
79 | ||
80 | if(cpv) { | |
81 | fIsEmc = kFALSE; | |
82 | fIsCpv = kTRUE; | |
83 | } | |
84 | else { | |
85 | fIsEmc = kTRUE; | |
86 | fIsCpv = kFALSE; | |
87 | } | |
88 | ||
89 | // Add itself to working pool | |
90 | AddToWorkingPool((TObject*)this); | |
91 | ||
92 | } | |
93 | ||
43fbaae1 | 94 | AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) : |
95 | fIsEmc(kFALSE), | |
96 | fIsCpv(kFALSE), | |
97 | fParent(-333), | |
98 | fChi2Dof(-111), | |
99 | fEventFolderName(AliConfig::GetDefaultEventFolderName()) | |
cbd576a6 | 100 | { |
89308175 | 101 | // ctor |
cbd576a6 | 102 | AliPHOSEmcRecPoint* rp=0; |
103 | ||
88cb7938 | 104 | AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); |
cbd576a6 | 105 | |
106 | if(cpv) { | |
88cb7938 | 107 | rp = (AliPHOSCpvRecPoint*)fLoader->CpvRecPoints()->At(i); |
cbd576a6 | 108 | fIsEmc = kFALSE; |
109 | fIsCpv = kTRUE; | |
110 | } | |
111 | else { | |
88cb7938 | 112 | rp = (AliPHOSEmcRecPoint*)fLoader->EmcRecPoints()->At(i); |
cbd576a6 | 113 | fIsEmc = kTRUE; |
114 | fIsCpv = kFALSE; | |
115 | } | |
116 | ||
89308175 | 117 | Int_t* digits = rp->GetDigitsList(); |
118 | Float_t* energies = rp->GetEnergiesList(); | |
cbd576a6 | 119 | Int_t nDigits = rp->GetMultiplicity(); |
120 | ||
121 | for(Int_t iDigit=0; iDigit<nDigits; iDigit++) { | |
89308175 | 122 | AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); |
123 | Float_t eDigit = energies[iDigit]; | |
cbd576a6 | 124 | this->AddDigit(*digit,eDigit); |
125 | } | |
126 | ||
127 | TVector3 locpos; | |
128 | rp->GetLocalPosition(locpos); | |
129 | fLocPos = locpos; | |
130 | ||
131 | // Add itself to working pool | |
132 | AddToWorkingPool((TObject*)this); | |
133 | ||
134 | } | |
135 | ||
136 | AliPHOSClusterizer* AliPHOSEvalRecPoint::GetClusterizer() | |
137 | { | |
89308175 | 138 | // returns clusterizer task |
cbd576a6 | 139 | TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice"); |
140 | TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP"); | |
141 | AliPHOSClusterizer* clu = (AliPHOSClusterizer*)wPoolF->FindObject("PHOS:clu-v1"); | |
142 | if(!clu) { | |
e957fea8 | 143 | Fatal("GetClusterizer", "Couldn't find Clusterizer") ; |
cbd576a6 | 144 | } |
145 | ||
146 | return clu; | |
147 | } | |
148 | ||
149 | Bool_t AliPHOSEvalRecPoint::TooClose(AliPHOSRecPoint* pt) const | |
150 | { | |
89308175 | 151 | // check if a rec.point pt is too close to this one |
152 | TVector3 herPos; | |
153 | TVector3 myPos; | |
154 | pt->GetLocalPosition(herPos); | |
155 | this->GetLocalPosition(myPos); | |
156 | Float_t dx = herPos.X() - myPos.X(); | |
157 | Float_t dz = herPos.Z() - myPos.Z(); | |
cbd576a6 | 158 | Float_t dr = TMath::Sqrt(dx*dx + dz*dz); |
159 | ||
160 | if(dr<GetReconstructionManager()->MergeGammasMinDistanceCut()) | |
161 | return kTRUE; | |
162 | else | |
163 | return kFALSE; | |
164 | ||
165 | } | |
166 | ||
167 | Bool_t AliPHOSEvalRecPoint::NeedToSplit() const | |
168 | { | |
89308175 | 169 | // rec.point needs to be split |
cbd576a6 | 170 | return kFALSE; |
171 | } | |
172 | ||
173 | void AliPHOSEvalRecPoint::DeleteParent() | |
174 | { | |
89308175 | 175 | // delete parent |
cbd576a6 | 176 | fParent=-333; |
177 | } | |
178 | ||
179 | void AliPHOSEvalRecPoint::UpdateWorkingPool() | |
180 | { | |
89308175 | 181 | // update pool of rec.points |
c9eeb00e | 182 | Int_t i; //loop variable |
cbd576a6 | 183 | |
c9eeb00e | 184 | for(i=0; i<this->InWorkingPool(); i++) { |
cbd576a6 | 185 | AliPHOSEvalRecPoint* parent = (AliPHOSEvalRecPoint*)GetFromWorkingPool(i); |
186 | TObjArray children; | |
187 | Int_t nChild = parent->HasChild(children); | |
188 | for(Int_t iChild=0; iChild<nChild; iChild++) | |
189 | { | |
89308175 | 190 | ((AliPHOSEvalRecPoint*)children.At(iChild))->DeleteParent(); |
cbd576a6 | 191 | } |
192 | ||
193 | if(nChild) { | |
194 | RemoveFromWorkingPool(parent); | |
195 | delete parent; | |
196 | } | |
197 | ||
198 | } | |
199 | ||
c9eeb00e | 200 | for(i=0; i<this->InWorkingPool(); i++) { |
cbd576a6 | 201 | AliPHOSEvalRecPoint* weak = (AliPHOSEvalRecPoint*)GetFromWorkingPool(i); |
202 | if (weak->KillWeakPoint()) delete weak; | |
203 | } | |
204 | ||
c9eeb00e | 205 | for(i=0; i<this->InWorkingPool(); i++) { |
cbd576a6 | 206 | AliPHOSEvalRecPoint* close = (AliPHOSEvalRecPoint*)GetFromWorkingPool(i); |
207 | close->MergeClosePoint(); | |
208 | } | |
209 | ||
c9eeb00e | 210 | for(i=0; i<this->InWorkingPool(); i++) |
cbd576a6 | 211 | ((AliPHOSEvalRecPoint*)AliPHOSEvalRecPoint::GetFromWorkingPool(i))->SetIndexInList(i); |
212 | ||
213 | } | |
214 | ||
215 | Int_t AliPHOSEvalRecPoint::HasChild(TObjArray& children) | |
216 | { | |
89308175 | 217 | // returns the number of children |
cbd576a6 | 218 | for(Int_t iChild=0; iChild<InWorkingPool(); iChild++) |
219 | { | |
220 | AliPHOSEvalRecPoint* child = (AliPHOSEvalRecPoint*)GetFromWorkingPool(iChild); | |
221 | TObject* parent = (TObject*)child->Parent(); | |
222 | TObject* me = (TObject*)this; | |
223 | if(parent==me) children.Add(child); | |
224 | } | |
225 | ||
226 | return children.GetEntries(); | |
227 | } | |
228 | ||
229 | void AliPHOSEvalRecPoint::Init() | |
230 | { | |
89308175 | 231 | // initialization |
cbd576a6 | 232 | AliPHOSClusterizer* clusterizer = GetClusterizer(); |
233 | if(!clusterizer) { | |
e957fea8 | 234 | Fatal("Init", "Cannot get clusterizer") ; |
cbd576a6 | 235 | } |
236 | ||
88cb7938 | 237 | TClonesArray* digits = AliPHOSLoader::GetPHOSLoader(fEventFolderName)->Digits(); |
89308175 | 238 | Float_t logWeight=0; |
cbd576a6 | 239 | |
240 | if(this->IsEmc()) { | |
89308175 | 241 | logWeight = clusterizer->GetEmcLogWeight(); |
cbd576a6 | 242 | } |
243 | else { | |
89308175 | 244 | logWeight = clusterizer->GetCpvLogWeight(); |
cbd576a6 | 245 | } |
246 | ||
89308175 | 247 | EvalLocalPosition(logWeight,digits); // evaluate initial position |
cbd576a6 | 248 | } |
249 | ||
250 | ||
251 | void AliPHOSEvalRecPoint::MakeJob() | |
252 | { | |
253 | // Reconstruction algoritm implementation. | |
254 | ||
255 | AliPHOSRecManager* recMng = GetReconstructionManager(); | |
256 | ||
257 | Init(); | |
258 | ||
259 | UnfoldLocalMaxima(); | |
260 | ||
261 | TObjArray children; | |
262 | Int_t nChild = HasChild(children); | |
263 | ||
264 | if(!nChild) { | |
265 | EvaluatePosition(); | |
266 | if(Chi2Dof()>recMng->OneGamChisqCut()) SplitMergedShowers(); | |
267 | } | |
268 | ||
269 | for(Int_t iChild=0; iChild<nChild; iChild++) { | |
270 | AliPHOSEvalRecPoint* child = (AliPHOSEvalRecPoint*)children.At(iChild); | |
271 | child->EvaluatePosition(); | |
272 | ||
273 | if(child->Chi2Dof()>recMng->OneGamChisqCut()) | |
274 | child->SplitMergedShowers(); | |
275 | } | |
276 | ||
277 | } | |
278 | ||
279 | void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2) | |
280 | { | |
281 | //Compute start values for two gamma fit algorithm. | |
282 | // gamma1[0], gamma1[1], gamma1[2] are Energy,x,z of the reconstructed "gammas". | |
283 | ||
284 | ||
285 | TVector3 lpos; // start point choosing. | |
286 | GetLocalPosition(lpos); | |
287 | Float_t xx = lpos.Z(); | |
288 | Float_t yy = lpos.X(); | |
89308175 | 289 | Float_t e = GetEnergy(); |
cbd576a6 | 290 | |
351dd634 | 291 | AliInfo(Form("(x,z,e)[old] = (%f, %f, %f)", yy, xx, e)) ; |
cbd576a6 | 292 | |
89308175 | 293 | // xx = XY(xx/e); |
294 | // yy = XY(yy/e); | |
cbd576a6 | 295 | |
296 | ||
297 | Float_t eDigit ; | |
298 | AliPHOSDigit * digit ; | |
299 | Int_t nDigits = GetMultiplicity(); | |
89308175 | 300 | Int_t * digits = GetDigitsList(); |
301 | Float_t * energies = GetEnergiesList(); | |
cbd576a6 | 302 | |
303 | Float_t ix ; | |
304 | Float_t iy ; | |
305 | Int_t relid[4] ; | |
306 | ||
307 | Float_t exx = 0; | |
308 | Float_t eyy = 0; | |
309 | Float_t exy = 0; | |
310 | Float_t sqr; | |
311 | Float_t cos2fi = 1.; | |
312 | ||
88cb7938 | 313 | AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); |
314 | const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); | |
cbd576a6 | 315 | |
c9eeb00e | 316 | Int_t iDigit; //loop variable |
317 | ||
318 | for(iDigit = 0 ; iDigit < nDigits ; iDigit ++) | |
cbd576a6 | 319 | { |
89308175 | 320 | digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); |
321 | eDigit = energies[iDigit]; | |
cbd576a6 | 322 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; |
323 | fGeom->RelPosInModule(relid, iy, ix); | |
324 | ||
325 | Float_t dx = ix - xx; | |
326 | Float_t dy = iy - yy; | |
327 | exx += eDigit*dx*dx; | |
328 | eyy += eDigit*dy*dy; | |
329 | exy += eDigit*dx*dy; | |
330 | ||
331 | } | |
332 | ||
333 | sqr = TMath::Sqrt(4.*exy*exy + (exx-eyy)*(exx-eyy)); | |
334 | Float_t euu = (exx+eyy+sqr)/2.; | |
335 | if(sqr>1.e-10) cos2fi = (exx - eyy)/sqr; | |
336 | Float_t cosfi = TMath::Sqrt((1.+cos2fi)/2.); | |
337 | Float_t sinfi = TMath::Sqrt((1.-cos2fi)/2.); | |
338 | if(exy<0) sinfi = -sinfi; | |
339 | ||
340 | Float_t eu3 = 0; | |
c9eeb00e | 341 | for(iDigit = 0 ; iDigit < nDigits ; iDigit ++) |
cbd576a6 | 342 | { |
89308175 | 343 | digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); |
344 | eDigit = energies[iDigit]; | |
cbd576a6 | 345 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; |
346 | fGeom->RelPosInModule(relid, iy, ix); | |
347 | ||
348 | Float_t dx = ix - xx; | |
349 | Float_t dy = iy - yy; | |
350 | Float_t du = dx*cosfi + dy*sinfi; | |
351 | eu3 += eDigit*du*du*du; | |
352 | } | |
353 | ||
89308175 | 354 | Float_t c = e*eu3*eu3/(euu*euu*euu)/2.; |
cbd576a6 | 355 | Float_t sign = 1.; |
356 | if(eu3<0) sign = -1.; | |
357 | Float_t r = 1.+ c + sign*TMath::Sqrt(2.*c + c*c); | |
358 | Float_t u = 0; | |
359 | if(TMath::Abs(r-1.)>0.1) u = eu3/euu*(r+1.)/(r-1.); | |
89308175 | 360 | if(TMath::Abs(r-1.)<0.1) u = TMath::Sqrt(sqr/e/r)*(1.+r); |
cbd576a6 | 361 | |
89308175 | 362 | Float_t e2c = e/(1.+r); |
363 | Float_t e1c = e-e2c; | |
cbd576a6 | 364 | Float_t u1 = -u/(1.+r); |
365 | Float_t u2 = u+u1; | |
366 | ||
367 | Float_t x1c = xx+u1*cosfi; | |
368 | Float_t y1c = yy+u1*sinfi; | |
369 | Float_t x2c = xx+u2*cosfi; | |
370 | Float_t y2c = yy+u2*sinfi; | |
371 | ||
372 | // printf("e1c -> %f\n",e1c); | |
373 | // printf("x1c -> %f\n",x1c); | |
374 | // printf("y1c -> %f\n",y1c); | |
375 | // printf("e2c -> %f\n",e2c); | |
376 | // printf("x2c -> %f\n",x2c); | |
377 | // printf("y2c -> %f\n",y2c); | |
378 | ||
379 | gamma1[0] = e1c; | |
380 | gamma1[1] = y1c; | |
381 | gamma1[2] = x1c; | |
382 | ||
383 | gamma2[0] = e2c; | |
384 | gamma2[1] = y2c; | |
385 | gamma2[2] = x2c; | |
386 | ||
387 | } | |
388 | ||
389 | void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2) | |
390 | { | |
391 | //Fitting algorithm for the two very closed gammas | |
392 | //that merged into the cluster with one maximum. | |
393 | // Starting points gamma1 and gamma2 must be provided before ( see InitTwoGam) | |
394 | //Set chisquare of the fit. | |
395 | ||
396 | ||
397 | Float_t st0 = GetReconstructionManager()->TwoGamInitialStep(); | |
398 | Float_t chmin = GetReconstructionManager()->TwoGamChisqMin(); | |
399 | Float_t emin = GetReconstructionManager()->TwoGamEmin(); | |
400 | Float_t stpmin = GetReconstructionManager()->TwoGamStepMin(); | |
89308175 | 401 | Int_t nIter = GetReconstructionManager()->TwoGamNumOfIterations(); // Number of iterations. |
cbd576a6 | 402 | |
403 | Float_t chisq = 100.; //Initial chisquare. | |
404 | ||
405 | Int_t nadc = GetMultiplicity(); | |
406 | if(nadc<3) | |
407 | fChi2Dof= -111.; | |
408 | ||
409 | Int_t dof = nadc - 5; | |
410 | if(dof<1) dof=1; | |
411 | Float_t chstop = chmin*dof; | |
412 | ||
413 | Float_t ch = 1.e+20; | |
414 | Float_t st = st0; | |
415 | Float_t grx1 = 0.; | |
416 | Float_t gry1 = 0.; | |
417 | Float_t grx2 = 0.; | |
418 | Float_t gry2 = 0.; | |
419 | Float_t gre = 0.; | |
420 | Float_t gr = 1.; | |
421 | Float_t ee1=0,xx1=0,yy1=0,ee2=0,xx2=0,yy2=0,cosi; | |
422 | ||
423 | Float_t e1c = gamma1[0]; | |
424 | Float_t y1c = gamma1[1]; | |
425 | Float_t x1c = gamma1[2]; | |
426 | ||
427 | Float_t e2c = gamma2[0]; | |
428 | Float_t y2c = gamma2[1]; | |
429 | Float_t x2c = gamma2[2]; | |
430 | ||
89308175 | 431 | Float_t e = GetEnergy(); |
cbd576a6 | 432 | |
433 | Float_t eDigit ; | |
434 | AliPHOSDigit * digit ; | |
435 | Int_t nDigits = GetMultiplicity(); | |
89308175 | 436 | Int_t * digits = GetDigitsList(); |
437 | Float_t * energies = GetEnergiesList(); | |
cbd576a6 | 438 | |
439 | Float_t ix ; | |
440 | Float_t iy ; | |
441 | Int_t relid[4] ; | |
442 | ||
88cb7938 | 443 | AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); |
444 | const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); | |
cbd576a6 | 445 | |
89308175 | 446 | for(Int_t iter=0; iter<nIter; iter++) |
cbd576a6 | 447 | { |
448 | Float_t chisqc = 0.; | |
449 | Float_t grx1c = 0.; | |
450 | Float_t gry1c = 0.; | |
451 | Float_t grx2c = 0.; | |
452 | Float_t gry2c = 0.; | |
453 | Float_t grec = 0.; | |
454 | ||
455 | for(Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++) | |
456 | { | |
89308175 | 457 | digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); |
458 | eDigit = energies[iDigit]; | |
cbd576a6 | 459 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; |
460 | fGeom->RelPosInModule(relid, iy, ix); | |
461 | ||
462 | Float_t a1,gx1,gy1; | |
463 | Float_t a2,gx2,gy2; | |
464 | ||
465 | Float_t dx1 = x1c - ix; | |
466 | Float_t dy1 = y1c - iy; | |
351dd634 | 467 | |
cbd576a6 | 468 | GetReconstructionManager()->AG(e1c,dx1,dy1,a1,gx1,gy1); |
469 | ||
470 | Float_t dx2 = x2c - ix; | |
471 | Float_t dy2 = y2c - iy; | |
351dd634 | 472 | |
cbd576a6 | 473 | GetReconstructionManager()->AG(e2c,dx2,dy2,a2,gx2,gy2); |
474 | ||
89308175 | 475 | Float_t a = a1+a2; |
476 | // Float_t D = Const*a*(1. - a/e); | |
cbd576a6 | 477 | // if(D<0) D=0; |
478 | ||
479 | // // D = 9.; // ???? | |
480 | ||
89308175 | 481 | // Float_t da = a - eDigit; |
cbd576a6 | 482 | // chisqc += da*da/D; |
483 | // Float_t dd = da/D; | |
89308175 | 484 | // dd = dd*(2.-dd*Const*(1.-2.*a/e)); |
cbd576a6 | 485 | |
486 | Float_t dd; | |
89308175 | 487 | chisqc += GetReconstructionManager()->TwoGamChi2(a,eDigit,e,dd); |
cbd576a6 | 488 | |
489 | grx1c += gx1*dd; | |
490 | gry1c += gy1*dd; | |
491 | grx2c += gx2*dd; | |
492 | gry2c += gy2*dd; | |
89308175 | 493 | grec += (a1/e1c - a2/e2c)*e*dd; |
cbd576a6 | 494 | |
495 | } | |
496 | ||
497 | Float_t grc = TMath::Sqrt(grx1c*grx1c + gry1c*gry1c + grx2c*grx2c + gry2c*gry2c); | |
498 | if(grc<1.e-10) grc=1.e-10; | |
499 | ||
500 | Float_t sc = 1. + chisqc/ch; | |
501 | st = st/sc; | |
502 | ||
503 | if(chisqc>ch) | |
504 | goto loop20; | |
505 | cosi = (grx1*grx1c + gry1*gry1c + grx2*grx2c + gry2*gry2c + gre*grec)/gr/grc; | |
506 | st = st*sc/(1.4 - cosi); | |
507 | ||
508 | ee1 = e1c; | |
509 | xx1 = x1c; | |
510 | yy1 = y1c; | |
511 | ee2 = e2c; | |
512 | xx2 = x2c; | |
513 | yy2 = y2c; | |
514 | ||
515 | ch = chisqc; | |
516 | ||
517 | if(ch<chstop) | |
518 | goto loop101; | |
519 | ||
520 | grx1 = grx1c; | |
521 | gry1 = gry1c; | |
522 | grx2 = grx2c; | |
523 | gry2 = gry2c; | |
524 | gre = grec; | |
525 | gr = grc; | |
526 | ||
527 | loop20: ; | |
528 | Float_t step = st*gr; | |
529 | ||
351dd634 | 530 | AliInfo(Form("Iteration %d dof %d chisq/dof %f chstop/dof %f step %d stpmin %d", |
531 | iter, dof, ch/dof, chstop/dof, step, stpmin)) ; | |
cbd576a6 | 532 | |
533 | ||
534 | if(step<stpmin) | |
535 | goto loop101; | |
536 | ||
89308175 | 537 | Float_t de = st*gre*e; |
cbd576a6 | 538 | e1c = ee1 - de; |
539 | e2c = ee2 + de; | |
540 | ||
541 | if( (e1c>emin) && (e2c>emin) ) | |
542 | goto loop25; | |
543 | st = st/2.; | |
544 | goto loop20; | |
545 | ||
546 | loop25: ; | |
547 | x1c = xx1 - st*grx1; | |
548 | y1c = yy1 - st*gry1; | |
549 | x2c = xx2 - st*grx2; | |
550 | y2c = yy2 - st*gry2; | |
551 | ||
552 | ||
553 | } | |
554 | ||
555 | loop101: | |
556 | ||
557 | // if(ch>chisq*(nadc-2)-delch) | |
558 | // return ch/dof; | |
559 | ||
560 | chisq = ch/dof; | |
561 | gamma1[0] = ee1; | |
562 | gamma1[1] = yy1; | |
563 | gamma1[2] = xx1; | |
564 | ||
565 | gamma2[0] = ee2; | |
566 | gamma2[1] = yy2; | |
567 | gamma2[2] = xx2; | |
568 | ||
89308175 | 569 | Float_t x1New = yy1; |
570 | Float_t z1New = xx1; | |
571 | Float_t e1New = ee1; | |
572 | Float_t x2New = yy2; | |
573 | Float_t z2New = xx2; | |
574 | Float_t e2New = ee2; | |
cbd576a6 | 575 | |
21cd0c07 | 576 | TString message ; |
89308175 | 577 | message = " (x,z,e)[1 fit] = (%f, %f, %f)\n" ; |
578 | message = " (x,z,e)[2 fit] = (%f, %f, %f)\n" ; | |
351dd634 | 579 | AliInfo(Form(message.Data(), |
89308175 | 580 | x1New, z1New, e1New, |
351dd634 | 581 | x2New, z2New, e2New)) ; |
cbd576a6 | 582 | |
583 | fChi2Dof = chisq; | |
584 | ||
585 | } | |
586 | ||
587 | void AliPHOSEvalRecPoint::UnfoldTwoMergedPoints(Float_t* gamma1, Float_t* gamma2) | |
588 | { | |
589 | //Unfold TWO merged rec. points in the case when cluster has only one maximum, | |
590 | //but it's fitting to the one gamma shower is too bad. | |
591 | // Use TwoGam() to estimate the positions and energies of merged points. | |
592 | ||
593 | ||
89308175 | 594 | Int_t nMax = 2; |
cbd576a6 | 595 | Float_t* gamma; |
596 | ||
89308175 | 597 | Int_t* digits = GetDigitsList(); |
cbd576a6 | 598 | Int_t nDigits = GetMultiplicity(); |
89308175 | 599 | Float_t* energies = GetEnergiesList(); |
cbd576a6 | 600 | Float_t* eFit = new Float_t[nDigits]; |
601 | ||
88cb7938 | 602 | AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); |
603 | const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); | |
cbd576a6 | 604 | |
605 | for(Int_t iDigit=0; iDigit<nDigits; iDigit++) | |
606 | { | |
89308175 | 607 | AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); |
cbd576a6 | 608 | Int_t relid[4] ; |
609 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
610 | Float_t x,z; | |
611 | fGeom->RelPosInModule(relid, x, z); | |
612 | ||
613 | Float_t gain = 0.; | |
89308175 | 614 | for(Int_t iMax=0; iMax<nMax; iMax++) |
cbd576a6 | 615 | { |
616 | if(iMax==0) | |
617 | gamma = gamma1; | |
618 | else | |
619 | gamma = gamma2; | |
620 | ||
621 | Float_t eMax = gamma[0]; | |
622 | Float_t xMax = gamma[1]; | |
623 | Float_t zMax = gamma[2]; | |
624 | ||
625 | Float_t dx = xMax - x; | |
626 | Float_t dz = zMax - z; | |
89308175 | 627 | Float_t amp,gx,gy; |
628 | GetReconstructionManager()->AG(eMax,dz,dx,amp,gx,gy); | |
629 | gain += amp; | |
cbd576a6 | 630 | } |
631 | ||
632 | eFit[iDigit] = gain; | |
633 | } | |
634 | ||
635 | ||
89308175 | 636 | for( Int_t iMax=0; iMax<nMax; iMax++) |
cbd576a6 | 637 | { |
638 | if(iMax==0) | |
639 | gamma = gamma1; | |
640 | else | |
641 | gamma = gamma2; | |
642 | ||
643 | Float_t eMax = gamma[0]; | |
644 | Float_t xMax = gamma[1]; | |
645 | Float_t zMax = gamma[2]; | |
646 | ||
647 | AliPHOSEvalRecPoint* newRP = new AliPHOSEvalRecPoint(IsCPV(),this); | |
648 | TVector3 newpos(xMax,0,zMax); | |
649 | newRP->SetLocalPosition(newpos); | |
650 | ||
651 | for( Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++) | |
652 | { | |
89308175 | 653 | AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); |
654 | Float_t eDigit = energies[iDigit]; | |
cbd576a6 | 655 | Int_t relid[4] ; |
656 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
657 | Float_t ix,iz; | |
658 | fGeom->RelPosInModule(relid, ix, iz); | |
659 | ||
660 | Float_t dx = xMax - ix; | |
661 | Float_t dz = zMax - iz; | |
89308175 | 662 | Float_t singleShowerGain,gxMax,gyMax; |
663 | GetReconstructionManager()->AG(eMax,dz,dx,singleShowerGain,gxMax,gyMax); | |
664 | Float_t totalGain = eFit[iDigit]; | |
665 | Float_t ratio = singleShowerGain/totalGain; | |
cbd576a6 | 666 | eDigit = eDigit*ratio; |
667 | newRP->AddDigit(*digit,eDigit); | |
668 | } | |
351dd634 | 669 | AliInfo(Form("======= Split: daughter rec point %d =================", |
670 | iMax)) ; | |
e957fea8 | 671 | newRP->Print(); |
cbd576a6 | 672 | |
673 | } | |
674 | ||
675 | delete[] eFit; | |
cbd576a6 | 676 | |
677 | ||
678 | } | |
679 | ||
680 | ||
681 | void AliPHOSEvalRecPoint::EvaluatePosition() | |
682 | { | |
683 | // One gamma fit algorithm. | |
684 | // Set chisq/dof of the fit. | |
685 | // gamma1[0], gamma1[1], gamma1[2] are Energy,x,z of the reconstructed gamma, respectively. | |
686 | ||
687 | Int_t nDigits = GetMultiplicity(); | |
688 | if(nDigits<2) | |
689 | return; | |
690 | ||
89308175 | 691 | Int_t nIter = GetReconstructionManager()->OneGamNumOfIterations(); // number of iterations |
692 | Float_t st0 = GetReconstructionManager()->OneGamInitialStep(); // initial step | |
693 | // const Float_t stpMin = 0.005; | |
694 | Float_t stpMin = GetReconstructionManager()->OneGamStepMin(); | |
cbd576a6 | 695 | Float_t chmin = GetReconstructionManager()->OneGamChisqMin(); |
696 | ||
697 | TVector3 locpos; | |
698 | AliPHOSDigit* digit; | |
699 | Float_t eDigit; | |
700 | Int_t relid[4] ; | |
701 | Float_t ix, iy; | |
702 | ||
703 | GetLocalPosition(locpos); | |
89308175 | 704 | Float_t e = GetEnergy(); |
cbd576a6 | 705 | Float_t xc = locpos.Z(); |
706 | Float_t yc = locpos.X(); | |
707 | Float_t dx,dy,gx,gy,grxc,gryc; | |
89308175 | 708 | Float_t st = st0; |
cbd576a6 | 709 | Float_t chisq = 1.e+20; |
710 | Float_t gr = 1.; | |
711 | Float_t grx = 0.; | |
712 | Float_t gry = 0.; | |
713 | Int_t dof = GetMultiplicity() - 2; | |
714 | if(dof<1) | |
715 | dof = 1; | |
716 | Float_t chstop = chmin*dof; | |
717 | Float_t cosi,x1=0,y1=0; | |
718 | Float_t chisqc; | |
719 | ||
88cb7938 | 720 | AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); |
721 | const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); | |
cbd576a6 | 722 | |
89308175 | 723 | for(Int_t iter=0; iter<nIter; iter++) |
cbd576a6 | 724 | { |
725 | ||
726 | chisqc = 0.; | |
727 | grxc = 0.; | |
728 | gryc = 0.; | |
729 | for(Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++) | |
730 | { | |
731 | ||
89308175 | 732 | Float_t* energies = GetEnergiesList(); |
733 | Int_t* digits = GetDigitsList(); | |
734 | digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); | |
735 | eDigit = energies[iDigit]; | |
cbd576a6 | 736 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; |
737 | fGeom->RelPosInModule(relid, iy, ix); | |
738 | ||
739 | dx = xc - ix; | |
740 | dy = yc - iy; | |
741 | ||
742 | if(!dx) dx=dy; | |
743 | if(!dy) dy=dx; | |
744 | ||
89308175 | 745 | Float_t a; |
746 | GetReconstructionManager()->AG(e,dx,dy,a,gx,gy); | |
cbd576a6 | 747 | Float_t dd; |
351dd634 | 748 | AliInfo(Form(" (ix iy xc yc dx dy) %f %f %f %f %f %f", |
749 | ix, iy, xc, yc, dx, dy)) ; | |
89308175 | 750 | Float_t chi2dg = GetReconstructionManager()->OneGamChi2(a,eDigit,e,dd); |
cbd576a6 | 751 | |
752 | // Exclude digit with too large chisquare. | |
753 | if(chi2dg > 10) { continue; } | |
754 | ||
755 | chisqc += chi2dg; | |
756 | grxc += gx*dd; | |
757 | gryc += gy*dd; | |
758 | ||
759 | } | |
760 | ||
761 | Float_t grc = TMath::Sqrt(grxc*grxc + gryc*gryc); | |
762 | if(grc<1.e-10) grc=1.e-10; | |
763 | Float_t sc = 1. + chisqc/chisq; | |
351dd634 | 764 | AliInfo(Form(" chisq: %f", chisq)) ; |
cbd576a6 | 765 | st = st/sc; |
766 | if(chisqc>chisq) | |
767 | goto loop20; | |
768 | cosi = (grx*grxc + gry*gryc)/gr/grc; | |
769 | st = st*sc/(1.4 - cosi); | |
770 | x1 = xc; | |
771 | y1 = yc; | |
772 | grx = grxc; | |
773 | gry = gryc; | |
774 | gr = grc; | |
775 | chisq = chisqc; | |
776 | ||
777 | if(chisq<chstop) | |
778 | goto loop101; | |
779 | ||
780 | loop20: ; | |
781 | Float_t step = st*gr; | |
782 | ||
351dd634 | 783 | AliInfo(Form(" Iteration %d dof %d chisq/dof %f chstop/dof %f step %d stpMin %d", |
784 | iter, dof, chisq/dof, chisq/dof, chstop/dof, step, stpMin)) ; | |
cbd576a6 | 785 | |
786 | ||
89308175 | 787 | if(step<stpMin) |
cbd576a6 | 788 | goto loop101; |
789 | ||
790 | if(step>1.) | |
791 | st = 1./gr; | |
792 | xc = x1 - st*grx; | |
793 | yc = y1 - st*gry; | |
794 | } | |
795 | ||
796 | ||
797 | loop101: | |
798 | chisq = chisq/dof; | |
799 | // if(chisq>Chsqcut) | |
800 | // { | |
801 | // // TwoGam(); | |
802 | // } | |
803 | ||
804 | Float_t gamma1[3]; | |
89308175 | 805 | gamma1[0] = e; |
cbd576a6 | 806 | gamma1[1] = y1; |
807 | gamma1[2] = x1; | |
808 | ||
809 | TVector3 newpos(gamma1[1],0,gamma1[2]); | |
810 | //SetLocalPosition(newpos); | |
811 | ||
812 | fLocPos=newpos; | |
89308175 | 813 | fAmp=e; |
cbd576a6 | 814 | |
815 | // TVector3 pos; | |
816 | // RP->GetLocalPosition(pos); | |
cbd576a6 | 817 | |
818 | ||
cbd576a6 | 819 | |
820 | fChi2Dof = chisq; | |
821 | ||
822 | } | |
823 | ||
824 | ||
825 | Bool_t AliPHOSEvalRecPoint::KillWeakPoint() | |
826 | { | |
827 | // Remove this point from further procession | |
828 | // if it's energy is too small. | |
829 | ||
89308175 | 830 | Float_t thr0 = GetReconstructionManager()->KillGamMinEnergy(); |
cbd576a6 | 831 | |
89308175 | 832 | if(GetEnergy()<thr0) { |
351dd634 | 833 | AliInfo(Form("+++++++ Killing this rec point ++++++++++")) ; |
cbd576a6 | 834 | RemoveFromWorkingPool(this); |
835 | return kTRUE; | |
836 | } | |
837 | ||
838 | return kFALSE; | |
839 | } | |
840 | ||
841 | ||
842 | void AliPHOSEvalRecPoint::SplitMergedShowers() | |
843 | { | |
844 | // Split two very close rec. points. | |
845 | ||
846 | if(GetMultiplicity()<2) | |
847 | return; | |
848 | ||
849 | Float_t gamma1[3]; | |
850 | Float_t gamma2[3]; | |
851 | ||
852 | InitTwoGam(gamma1,gamma2); // start points for fit | |
853 | TwoGam(gamma1,gamma2); // evaluate the positions and energies | |
854 | UnfoldTwoMergedPoints(gamma1,gamma2); // make the job | |
855 | ||
856 | } | |
857 | ||
858 | ||
859 | void AliPHOSEvalRecPoint::MergeClosePoint() | |
860 | { | |
89308175 | 861 | // merge rec.points if they are too close |
88cb7938 | 862 | AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); |
863 | // AliPHOSDigitizer* digitizer = fLoader->Digitizer(); | |
cbd576a6 | 864 | // Float_t fPedestal = digitizer->GetPedestal(); // YVK 30.09.2001 |
865 | // Float_t fSlope = digitizer->GetSlope(); | |
866 | ||
867 | for (Int_t i=0;i<InWorkingPool(); i++) | |
868 | { | |
869 | TObject* obj = GetFromWorkingPool(i); | |
366ed113 | 870 | if(!((TObject*)this)->IsEqual(obj)) |
cbd576a6 | 871 | { |
872 | AliPHOSRecPoint* rp = (AliPHOSRecPoint*)obj; | |
873 | if(GetPHOSMod() == rp->GetPHOSMod()) | |
874 | { | |
875 | if(TooClose(rp)) | |
876 | { | |
351dd634 | 877 | AliInfo(Form("+++++++ Merging point 1: ++++++")) ; |
e957fea8 | 878 | this->Print(); |
351dd634 | 879 | AliInfo(Form("+++++++ and point 2: ++++++++++")) ; |
e957fea8 | 880 | ((AliPHOSEvalRecPoint*)rp)->Print(); |
cbd576a6 | 881 | |
882 | //merge two rec. points | |
883 | TVector3 lpos1; | |
884 | TVector3 lpos2; | |
885 | this->GetLocalPosition(lpos1); | |
886 | rp->GetLocalPosition(lpos2); | |
887 | ||
89308175 | 888 | Int_t* digits = rp->GetDigitsList(); |
cbd576a6 | 889 | Float_t dE = rp->GetEnergy()/(rp->GetEnergy()+this->GetEnergy()); |
89308175 | 890 | Float_t newX = lpos1.X()*dE + lpos2.X()*(1.-dE); |
891 | Float_t newZ = lpos1.Z()*dE + lpos2.Z()*(1.-dE); | |
892 | Float_t newE = rp->GetEnergy()+this->GetEnergy(); | |
893 | Float_t* energies = ((AliPHOSEmcRecPoint*)rp)->GetEnergiesList(); | |
cbd576a6 | 894 | |
895 | for(Int_t iDigit=0; iDigit<rp->GetDigitsMultiplicity(); iDigit++) | |
896 | { | |
89308175 | 897 | AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At(digits[iDigit]); |
898 | Float_t eDigit = energies[iDigit]; | |
cbd576a6 | 899 | this->AddDigit(*digit,eDigit); |
900 | } | |
901 | ||
89308175 | 902 | TVector3 newpos(newX,0,newZ); |
cbd576a6 | 903 | fLocPos = newpos; |
89308175 | 904 | fAmp = newE; |
cbd576a6 | 905 | RemoveFromWorkingPool(rp); |
906 | delete rp; | |
907 | ||
351dd634 | 908 | AliInfo(Form("++++++ Resulting point: ++++++++")) ; |
e957fea8 | 909 | this->Print(); |
cbd576a6 | 910 | |
911 | break; | |
912 | } | |
913 | } | |
914 | } | |
915 | } | |
916 | ||
917 | } | |
918 | ||
919 | Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima() | |
920 | { | |
921 | // Make unfolding in the reconstruction point with several local maxima. | |
922 | // Return the number of local maxima. | |
923 | ||
924 | // if multiplicity less then 2 - nothing to unfold | |
925 | if(GetMultiplicity()<2) return 1; | |
926 | ||
a0636361 | 927 | AliPHOSDigit * maxAt[1000]; |
cbd576a6 | 928 | Float_t maxAtEnergy[1000]; |
89308175 | 929 | Float_t locMaxCut, logWeight; |
cbd576a6 | 930 | Int_t relid[4] ; |
931 | Float_t xMax; | |
932 | Float_t zMax; | |
933 | ||
cbd576a6 | 934 | AliPHOSClusterizer* clusterizer = GetClusterizer(); |
935 | if(!clusterizer) { | |
351dd634 | 936 | AliFatal(Form("Cannot get clusterizer")) ; |
cbd576a6 | 937 | } |
938 | ||
939 | if(this->IsEmc()) { | |
89308175 | 940 | locMaxCut = clusterizer->GetEmcLocalMaxCut(); |
941 | logWeight = clusterizer->GetEmcLogWeight(); | |
cbd576a6 | 942 | } |
943 | else { | |
89308175 | 944 | locMaxCut = clusterizer->GetCpvLocalMaxCut(); |
945 | logWeight = clusterizer->GetCpvLogWeight(); | |
cbd576a6 | 946 | } |
947 | ||
88cb7938 | 948 | AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName); |
949 | const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry(); | |
950 | TClonesArray* digits = fLoader->Digits(); | |
cbd576a6 | 951 | |
952 | // if number of local maxima less then 2 - nothing to unfold | |
89308175 | 953 | Int_t nMax = GetNumberOfLocalMax(maxAt,maxAtEnergy,locMaxCut,digits); |
954 | if(nMax<2) return nMax; | |
cbd576a6 | 955 | |
89308175 | 956 | Int_t* digitsList = GetDigitsList(); |
cbd576a6 | 957 | Int_t nDigits = GetMultiplicity(); |
89308175 | 958 | Float_t* energies = GetEnergiesList(); |
cbd576a6 | 959 | Float_t* eFit = new Float_t[nDigits]; |
960 | ||
c9eeb00e | 961 | Int_t iDigit; //loop variable |
962 | ||
963 | for(iDigit=0; iDigit<nDigits; iDigit++) | |
cbd576a6 | 964 | { |
965 | eFit[iDigit] = 0.; | |
966 | } | |
967 | ||
c9eeb00e | 968 | for(iDigit=0; iDigit<nDigits; iDigit++) |
cbd576a6 | 969 | { |
970 | ||
89308175 | 971 | AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digitsList[iDigit] ); |
cbd576a6 | 972 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; |
973 | Float_t x,z; | |
974 | fGeom->RelPosInModule(relid, x, z); | |
975 | ||
89308175 | 976 | for(Int_t iMax=0; iMax<nMax; iMax++) |
cbd576a6 | 977 | { |
a0636361 | 978 | AliPHOSDigit* digitMax = maxAt[iMax]; |
cbd576a6 | 979 | Float_t eMax = maxAtEnergy[iMax]; |
980 | fGeom->AbsToRelNumbering(digitMax->GetId(), relid) ; | |
981 | fGeom->RelPosInModule(relid, xMax, zMax); | |
982 | Float_t dx = xMax - x; | |
983 | Float_t dz = zMax - z; | |
89308175 | 984 | Float_t amp,gx,gy; |
985 | GetReconstructionManager()->AG(eMax,dz,dx,amp,gx,gy); | |
986 | // amp = amp + 0.5; | |
987 | eFit[iDigit] += amp; | |
cbd576a6 | 988 | } |
989 | } | |
990 | ||
991 | ||
89308175 | 992 | for(Int_t iMax=0; iMax<nMax; iMax++) |
cbd576a6 | 993 | { |
a0636361 | 994 | AliPHOSDigit* digitMax = maxAt[iMax]; |
cbd576a6 | 995 | fGeom->AbsToRelNumbering(digitMax->GetId(), relid) ; |
996 | fGeom->RelPosInModule(relid, xMax, zMax); | |
997 | Float_t eMax = maxAtEnergy[iMax]; | |
998 | ||
999 | AliPHOSEvalRecPoint* newRP = new AliPHOSEvalRecPoint(IsCPV(),this); | |
1000 | newRP->AddDigit(*digitMax,maxAtEnergy[iMax]); | |
1001 | ||
1002 | //Neighbous ( matrix 3x3 around the local maximum) | |
1003 | for(Int_t iDigit=0; iDigit<nDigits; iDigit++) | |
1004 | { | |
89308175 | 1005 | AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digitsList[iDigit] ); |
1006 | Float_t eDigit = energies[iDigit]; | |
cbd576a6 | 1007 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; |
1008 | Float_t ix,iz; | |
1009 | fGeom->RelPosInModule(relid, ix, iz); | |
1010 | ||
1011 | if(AreNeighbours(digitMax,digit)) | |
1012 | { | |
1013 | Float_t dx = xMax - ix; | |
1014 | Float_t dz = zMax - iz; | |
89308175 | 1015 | Float_t singleShowerGain,gxMax,gyMax; |
1016 | GetReconstructionManager()->AG(eMax,dz,dx,singleShowerGain,gxMax,gyMax); | |
1017 | Float_t totalGain = eFit[iDigit]; | |
1018 | Float_t ratio = singleShowerGain/totalGain; | |
351dd634 | 1019 | AliInfo(Form(" ratio -> %f", ratio)) ; |
cbd576a6 | 1020 | eDigit = eDigit*ratio; |
1021 | newRP->AddDigit(*digit,eDigit); | |
1022 | } | |
1023 | } | |
1024 | ||
89308175 | 1025 | newRP->EvalLocalPosition(logWeight,digits); |
351dd634 | 1026 | AliInfo(Form("======= Unfold: daughter rec point %d =================", |
1027 | iMax)) ; | |
e957fea8 | 1028 | newRP->Print(); |
cbd576a6 | 1029 | } |
1030 | ||
1031 | // RemoveFromWorkingPool(this); | |
1032 | ||
1033 | delete[] eFit; | |
cbd576a6 | 1034 | |
89308175 | 1035 | return nMax; |
cbd576a6 | 1036 | |
1037 | } | |
1038 | ||
e957fea8 | 1039 | void AliPHOSEvalRecPoint::PrintPoint() |
cbd576a6 | 1040 | { |
89308175 | 1041 | // print rec.point to stdout |
e957fea8 | 1042 | AliPHOSCpvRecPoint::Print(); |
cbd576a6 | 1043 | |
1044 | TVector3 lpos; | |
1045 | GetLocalPosition(lpos); | |
1046 | ||
21cd0c07 | 1047 | TString message ; |
1048 | message = " Chi2/dof = %f" ; | |
1049 | message += " Local (x,z) = (%f, %f) in module %d" ; | |
351dd634 | 1050 | AliInfo(Form(message.Data(), Chi2Dof(), lpos.X(), lpos.Z(), GetPHOSMod())) ; |
21cd0c07 | 1051 | |
cbd576a6 | 1052 | } |
1053 | ||
1054 | AliPHOSRecManager* AliPHOSEvalRecPoint::GetReconstructionManager() const | |
1055 | { | |
89308175 | 1056 | // returns reconstruction manager |
cbd576a6 | 1057 | TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice"); |
1058 | TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP"); | |
1059 | AliPHOSRecManager* recMng = (AliPHOSRecManager*)wPoolF->FindObject("AliPHOSRecManager"); | |
1060 | if(!recMng) { | |
351dd634 | 1061 | AliFatal(Form("Couldn't find Reconstruction Manager")) ; |
cbd576a6 | 1062 | } |
1063 | ||
1064 | return recMng; | |
1065 | } | |
1066 | ||
1067 | ||
1068 | AliPHOSRecPoint* AliPHOSEvalRecPoint::Parent() | |
1069 | { | |
89308175 | 1070 | // returns a parent |
cbd576a6 | 1071 | if(fParent<0) return NULL; |
1072 | else | |
1073 | return (AliPHOSRecPoint*)GetFromWorkingPool(fParent); | |
1074 | // return fParent; | |
1075 | } | |
1076 | ||
1077 | Float_t AliPHOSEvalRecPoint::Chi2Dof() const | |
1078 | { | |
89308175 | 1079 | // returns a chi^2 per degree of freedom |
cbd576a6 | 1080 | return fChi2Dof; |
1081 | } | |
1082 | ||
1083 | const TObject* AliPHOSEvalRecPoint::GetWorkingPool() | |
1084 | { | |
89308175 | 1085 | // returns a pool of rec.points |
cbd576a6 | 1086 | TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice"); |
1087 | TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP"); | |
1088 | TObject* wPool = wPoolF->FindObject("SmartPoints"); | |
1089 | if(!wPool) { | |
351dd634 | 1090 | AliFatal(Form("Couldn't find Working Pool")) ; |
cbd576a6 | 1091 | } |
1092 | ||
1093 | return wPool; | |
1094 | } | |
1095 | ||
1096 | void AliPHOSEvalRecPoint::AddToWorkingPool(TObject* obj) | |
1097 | { | |
89308175 | 1098 | // add a rec.point to a pool |
cbd576a6 | 1099 | ((TObjArray*)GetWorkingPool())->Add(obj); |
1100 | } | |
1101 | ||
1102 | TObject* AliPHOSEvalRecPoint::GetFromWorkingPool(Int_t i) | |
1103 | { | |
89308175 | 1104 | // return a rec.point from a pool at an index i |
cbd576a6 | 1105 | // return fWorkingPool->At(i); |
1106 | return ((TObjArray*)GetWorkingPool())->At(i); | |
1107 | } | |
1108 | ||
1109 | Int_t AliPHOSEvalRecPoint::InWorkingPool() | |
1110 | { | |
89308175 | 1111 | // return the number of rec.points in a pool |
cbd576a6 | 1112 | return ((TObjArray*)GetWorkingPool())->GetEntries(); |
1113 | } | |
1114 | ||
1115 | void AliPHOSEvalRecPoint::RemoveFromWorkingPool(TObject* obj) | |
1116 | { | |
89308175 | 1117 | // remove a rec.point from a pool |
cbd576a6 | 1118 | ((TObjArray*)GetWorkingPool())->Remove(obj); |
1119 | ((TObjArray*)GetWorkingPool())->Compress(); | |
1120 | } | |
1121 | ||
1122 | void AliPHOSEvalRecPoint::PrintWorkingPool() | |
1123 | { | |
89308175 | 1124 | // print pool of rec.points to stdout |
e957fea8 | 1125 | ((TObjArray*)GetWorkingPool())->Print(); |
cbd576a6 | 1126 | } |