1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // Implementation version 1 of algorithm class to construct PHOS track segments
20 // Associates EMC and PPSD clusters
21 // Unfolds the EMC cluster
23 //*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH)
26 // --- ROOT system ---
28 #include "TObjArray.h"
29 #include "TClonesArray.h"
30 #include "TObjectTable.h"
32 // --- Standard library ---
36 // --- AliRoot header files ---
38 #include "AliPHOSTrackSegmentMakerv1.h"
39 #include "AliPHOSIndexToObject.h"
40 #include "AliPHOSTrackSegment.h"
41 #include "AliPHOSLink.h"
42 #include "AliPHOSv0.h"
45 extern void UnfoldingChiSquare(Int_t &nPar, Double_t *Grad, Double_t & fret, Double_t *x, Int_t iflag) ;
47 ClassImp( AliPHOSTrackSegmentMakerv1)
50 //____________________________________________________________________________
51 AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1() : AliPHOSTrackSegmentMaker()
56 //clusters are sorted in "rows" and "columns" of width geom->GetCrystalSize(0),
57 fDelta = fR0 + fGeom->GetCrystalSize(0) ;
58 if(!gMinuit) gMinuit = new TMinuit(100) ;
62 //____________________________________________________________________________
63 AliPHOSTrackSegmentMakerv1::~AliPHOSTrackSegmentMakerv1()
71 //____________________________________________________________________________
72 Bool_t AliPHOSTrackSegmentMakerv1::FindFit(AliPHOSEmcRecPoint * emcRP, int * maxAt, Float_t * maxAtEnergy,
73 Int_t nPar, Float_t * fitparameters)
75 // Calls TMinuit to fit the energy distribution of a cluster with several maxima
77 gMinuit->SetPrintLevel(-1) ; // No Printout
78 gMinuit->SetFCN(UnfoldingChiSquare) ; // To set the address of the minimization function
79 gMinuit->SetObjectFit(emcRP) ; // To tranfer pointer to UnfoldingChiSquare
81 // filling initial values for fit parameters
82 AliPHOSDigit * digit ;
86 Int_t nDigits = (Int_t) nPar / 3 ;
91 for(iDigit = 0; iDigit < nDigits; iDigit++){
92 digit = (AliPHOSDigit *) maxAt[iDigit];
97 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
98 fGeom->RelPosInModule(relid, x, z) ;
100 Float_t energy = maxAtEnergy[iDigit] ;
102 gMinuit->mnparm(index, "x", x, 0.1, 0, 0, ierflg) ;
105 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : x = " << x << endl ;
108 gMinuit->mnparm(index, "z", z, 0.1, 0, 0, ierflg) ;
111 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : z = " << z << endl ;
114 gMinuit->mnparm(index, "Energy", energy , 0.05*energy, 0., 4.*energy, ierflg) ;
117 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : energy = " << energy << endl ;
122 Double_t p0 = 0.1 ; // "Tolerance" Evaluation stops when EDM = 0.0001*p0 ; The number of function call slightly
127 gMinuit->mnexcm("SET STR", &p2, 0, ierflg) ; // force TMinuit to reduce function calls
128 gMinuit->mnexcm("SET GRA", &p1, 1, ierflg) ; // force TMinuit to use my gradient
129 gMinuit->SetMaxIterations(5);
130 gMinuit->mnexcm("SET NOW", &p2 , 0, ierflg) ; // No Warnings
132 gMinuit->mnexcm("MIGRAD", &p0, 0, ierflg) ; // minimize
134 if(ierflg == 4){ // Minimum not found
135 cout << "PHOS Unfolding> Fit not converged, cluster abandoned "<< endl ;
138 for(index = 0; index < nPar; index++){
141 gMinuit->GetParameter(index, val, err) ; // Returns value and error of parameter index
142 fitparameters[index] = val ;
149 //____________________________________________________________________________
150 void AliPHOSTrackSegmentMakerv1::FillOneModule(AliPHOSRecPoint::RecPointsList * emcIn,
152 AliPHOSRecPoint::RecPointsList * ppsdIn,
154 TArrayI * ppsdOutLow,
157 Int_t & ppsdStopedAt)
159 // Fill xxxOut arrays with clusters from one PHOS module
161 AliPHOSEmcRecPoint * emcRecPoint ;
162 AliPHOSPpsdRecPoint * ppsdRecPoint ;
165 Int_t nEmcUnfolded = emcIn->GetEntries() ;
166 emcOut->Set(nEmcUnfolded);
168 for(index = emcStopedAt; index < nEmcUnfolded; index++){
170 emcRecPoint = (AliPHOSEmcRecPoint *) emcIn->At(index) ;
172 if(emcRecPoint->GetPHOSMod() != phosmod )
175 emcOut->AddAt(emcRecPoint->GetIndexInList(),inEmcOut) ;
178 emcOut->Set(inEmcOut) ;
180 emcStopedAt = index ;
182 ppsdOutLow->Set(ppsdIn->GetEntries()) ;
183 ppsdOutUp->Set(ppsdIn->GetEntries()) ;
186 for(index = ppsdStopedAt; index < ppsdIn->GetEntries(); index++){
187 ppsdRecPoint = (AliPHOSPpsdRecPoint *) ppsdIn->At(index) ;
188 if(ppsdRecPoint->GetPHOSMod() != phosmod )
190 if(phosmod <= fGeom->GetNCPVModules()) //in CPV
191 ppsdOutUp->AddAt(index,inPpsdUp++) ;
193 if(ppsdRecPoint->GetUp() )
194 ppsdOutUp->AddAt(index,inPpsdUp++) ;
196 ppsdOutLow->AddAt(index,inPpsdLow++) ;
199 ppsdOutLow->Set(inPpsdLow);
200 ppsdOutUp->Set(inPpsdUp);
201 ppsdStopedAt = index ;
204 //____________________________________________________________________________
205 Float_t AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * emcclu,AliPHOSPpsdRecPoint * PpsdClu, Bool_t &toofar)
207 // Calculates the distance between the EMC RecPoint and the PPSD RecPoint
214 emcclu->GetLocalPosition(vecEmc) ;
215 PpsdClu->GetLocalPosition(vecPpsd) ;
216 if(emcclu->GetPHOSMod() == PpsdClu->GetPHOSMod()){
217 // if(vecPpsd.X() >= vecEmc.X() - fDelta ){
218 // if(vecPpsd.Z() >= vecEmc.Z() - fDelta ){
219 // Correct to difference in CPV and EMC position due to different distance to center.
220 // we assume, that particle moves from center
221 Float_t dCPV = fGeom->GetIPtoOuterCoverDistance();
222 Float_t dEMC = fGeom->GetIPtoCrystalSurface() ;
224 vecPpsd = dEMC * vecPpsd - vecEmc ;
226 // } // if zPpsd >= zEmc - fDelta
228 //} // if xPpsd >= xEmc - fDelta
241 //____________________________________________________________________________
242 void AliPHOSTrackSegmentMakerv1::MakeLinks(TArrayI * emcRecPoints, TArrayI * ppsdRecPointsUp,
243 TArrayI * ppsdRecPointsLow, TClonesArray * linklowArray,
244 TClonesArray *linkupArray)
246 // Finds distances (links) between all EMC and PPSD clusters, which are not further apart from each other than fR0
249 AliPHOSPpsdRecPoint * ppsdlow ;
250 AliPHOSPpsdRecPoint * ppsdup ;
251 AliPHOSEmcRecPoint * emcclu ;
258 for(iEmcRP = 0; iEmcRP < emcRecPoints->GetSize(); iEmcRP++ ) {
259 emcclu = (AliPHOSEmcRecPoint *) fPlease->GimeRecPoint(emcRecPoints->At(iEmcRP),"emc") ;
264 for(iPpsdLow = 0; iPpsdLow < ppsdRecPointsLow->GetSize();iPpsdLow++ ) {
266 ppsdlow = (AliPHOSPpsdRecPoint *) fPlease->GimeRecPoint(ppsdRecPointsLow->At(iPpsdLow),"ppsd") ;
267 Float_t r = GetDistanceInPHOSPlane(emcclu, ppsdlow, toofar) ;
272 new( (*linklowArray)[iLinkLow++]) AliPHOSLink(r, iEmcRP, iPpsdLow) ;
277 for(iPpsdUp = 0; iPpsdUp < ppsdRecPointsUp->GetSize();iPpsdUp++ ) {
279 ppsdup = (AliPHOSPpsdRecPoint *)fPlease->GimeRecPoint(ppsdRecPointsUp->At(iPpsdUp),"ppsd") ;
280 Float_t r = GetDistanceInPHOSPlane(emcclu, ppsdup, toofar) ;
285 new( (*linkupArray)[iLinkUp++]) AliPHOSLink(r, iEmcRP, iPpsdUp) ;
290 linklowArray->Sort() ; //first links with smallest distances
291 linkupArray->Sort() ;
294 //____________________________________________________________________________
295 void AliPHOSTrackSegmentMakerv1::MakePairs(TArrayI * emcRecPoints,
296 TArrayI * ppsdRecPointsUp,
297 TArrayI * ppsdRecPointsLow,
298 TClonesArray * linklowArray,
299 TClonesArray * linkupArray,
300 AliPHOSTrackSegment::TrackSegmentsList * trsl)
303 // Finds the smallest links and makes pairs of PPSD and EMC clusters with smallest distance
305 TIter nextLow(linklowArray) ;
306 TIter nextUp(linkupArray) ;
308 AliPHOSLink * linkLow ;
309 AliPHOSLink * linkUp ;
315 AliPHOSPpsdRecPoint * nullpointer = 0 ;
318 while ( (linkLow = (AliPHOSLink *)nextLow() ) ){
320 emc = emcRecPoints->At(linkLow->GetEmc()) ;
321 ppsdLow = ppsdRecPointsLow->At(linkLow->GetPpsd()) ;
323 if( (emc >= 0) && (ppsdLow >= 0) ){ // RecPoints not removed yet
325 new( (*trsl)[fNTrackSegments] ) AliPHOSTrackSegment((AliPHOSEmcRecPoint *)fPlease->GimeRecPoint(emc,"emc"),
327 (AliPHOSPpsdRecPoint *)fPlease->GimeRecPoint(ppsdLow,"ppsd") ) ;
328 ((AliPHOSTrackSegment* )trsl->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
329 //replace index of emc to negative and shifted index of TS
330 emcRecPoints->AddAt(-2 - fNTrackSegments,linkLow->GetEmc()) ;
331 //replace index of PPSD Low to negative and shifted index of TS
332 ppsdRecPointsLow->AddAt(-2 - fNTrackSegments,linkLow->GetPpsd()) ;
338 while ( (linkUp = (AliPHOSLink *)nextUp() ) ){
339 emc = emcRecPoints->At(linkUp->GetEmc()) ;
340 if(emc != -1){ //without ppsd Up yet
342 ppsdUp = ppsdRecPointsUp->At(linkUp->GetPpsd()) ;
343 if(ppsdUp >= 0){ //ppsdUp still exist
345 if(emc >= 0){ //without ppsd Low => create new TS
347 fNTrackSegments = trsl->GetEntries() ;
348 new( (*trsl)[fNTrackSegments] ) AliPHOSTrackSegment((AliPHOSEmcRecPoint *) fPlease->GimeRecPoint(emc,"emc"),
349 (AliPHOSPpsdRecPoint *)fPlease->GimeRecPoint(ppsdUp,"ppsd"),
351 ((AliPHOSTrackSegment *) trsl->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
354 else{ // append ppsd Up to existing TS
355 ((AliPHOSTrackSegment *)trsl->At(-2-emc))->SetPpsdUpRecPoint((AliPHOSPpsdRecPoint *)fPlease->GimeRecPoint(ppsdUp,"ppsd"));
358 emcRecPoints->AddAt(-1,linkUp->GetEmc()) ; //Mark that PPSD Up found
359 //replace index of PPSD Up to negative and shifted index of TS
360 ppsdRecPointsUp->AddAt(-2 - fNTrackSegments,linkUp->GetPpsd()) ;
361 } //if ppsdUp still exist
366 for(iEmcRP = 0; iEmcRP <emcRecPoints->GetSize() ; iEmcRP++ ){
367 emc = emcRecPoints->At(iEmcRP) ;
371 new( (*trsl)[fNTrackSegments] ) AliPHOSTrackSegment((AliPHOSEmcRecPoint *) fPlease->GimeRecPoint(emc,"emc"),
372 nullpointer, nullpointer ) ;
373 ((AliPHOSTrackSegment *) trsl->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
381 //____________________________________________________________________________
382 void AliPHOSTrackSegmentMakerv1::MakeTrackSegments(DigitsList * dl,
383 AliPHOSRecPoint::RecPointsList * emcl,
384 AliPHOSRecPoint::RecPointsList * ppsdl,
385 AliPHOSTrackSegment::TrackSegmentsList * trsl)
387 // Makes the track segments out of the list of EMC and PPSD Recpoints and stores them in a list
389 Int_t emcStopedAt = 0 ;
390 Int_t ppsdStopedAt = 0 ;
392 fNTrackSegments = 0 ;
394 TArrayI * emcRecPoints = new TArrayI(1000) ; // these arrays keep indexes
395 TArrayI * ppsdRecPointsUp = new TArrayI(1000) ; // of RecPoints, which are
396 TArrayI * ppsdRecPointsLow = new TArrayI(1000) ; // kept in TClonesArray's emcl, ppsdl, cpv
398 TClonesArray * linklowArray = new TClonesArray("AliPHOSLink", 1000);
399 TClonesArray * linkupArray = new TClonesArray("AliPHOSLink", 1000);
402 UnfoldAll(dl, emcl) ; // Unfolds all EMC clusters
403 UnfoldAll(dl, ppsdl) ; // Unfolds all CPV clusters
407 while(phosmod <= fGeom->GetNModules() ){
409 FillOneModule(emcl, emcRecPoints, ppsdl, ppsdRecPointsUp, ppsdRecPointsLow, phosmod, emcStopedAt, ppsdStopedAt) ;
411 MakeLinks(emcRecPoints, ppsdRecPointsUp, ppsdRecPointsLow, linklowArray, linkupArray) ;
413 MakePairs(emcRecPoints, ppsdRecPointsUp, ppsdRecPointsLow, linklowArray, linkupArray, trsl) ;
415 emcRecPoints->Reset() ;
417 ppsdRecPointsUp->Reset() ;
419 ppsdRecPointsLow->Reset() ;
421 linkupArray->Clear() ;
423 linklowArray->Clear() ;
428 delete emcRecPoints ;
431 delete ppsdRecPointsUp ;
432 ppsdRecPointsUp = 0 ;
434 delete ppsdRecPointsLow ;
435 ppsdRecPointsLow = 0 ;
440 delete linklowArray ;
444 //____________________________________________________________________________
445 void AliPHOSTrackSegmentMakerv1::MakeTrackSegmentsCPV(DigitsList * dl,
446 AliPHOSRecPoint::RecPointsList * emcl,
447 AliPHOSRecPoint::RecPointsList * cpvl)
449 // Unfold clusters in EMC and CPV and refill reconstructed point lists emcl and ppsdl
450 // Yuri Kharlov. 19 October 2000
452 fNTrackSegments = 0 ;
454 TArrayI * emcRecPoints = new TArrayI(1000) ; // these arrays keep indexes
455 TArrayI * cpvRecPoints = new TArrayI(1000) ; // of RecPoints, which are kept in emcl and ppsdl
458 UnfoldAll(dl, emcl) ; // Unfolds all EMC clusters
459 UnfoldAll(dl, cpvl) ; // Unfolds all CPV clusters
462 // Int_t phosmod = 1 ;
463 // Int_t emcStopedAt = 0 ;
464 // Int_t cpvStopedAt = 0 ;
465 // while(phosmod <= fGeom->GetNModules() ){
466 // FillOneModule(emcl, emcRecPoints, ppsdl, cpvRecPoints, phosmod, emcStopedAt, cpvStopedAt) ;
467 // emcRecPoints->Reset() ;
468 // cpvRecPoints->Reset() ;
472 delete emcRecPoints ; emcRecPoints = 0 ;
473 delete cpvRecPoints ; cpvRecPoints = 0 ;
476 //____________________________________________________________________________
477 Double_t AliPHOSTrackSegmentMakerv1::ShowerShape(Double_t r)
479 // Shape of the shower (see PHOS TDR)
480 // If you change this function, change also the gradien evaluation in ChiSquare()
482 Double_t r4 = r*r*r*r ;
483 Double_t r295 = TMath::Power(r, 2.95) ;
484 Double_t shape = TMath::Exp( -r4 * (1. / (2.32 + 0.26 * r4) + 0.0316 / (1 + 0.0652 * r295) ) ) ;
488 //____________________________________________________________________________
489 void AliPHOSTrackSegmentMakerv1::UnfoldAll(DigitsList * dl, AliPHOSRecPoint::RecPointsList * emcIn)
491 // Performs unfolding of all EMC/CPV but NOT ppsd clusters, sorts them and resets indexes in RecPoints
493 AliPHOSEmcRecPoint * emcRecPoint ;
495 Int_t nEmcUnfolded = emcIn->GetEntries() ;
497 Int_t nModulesToUnfold ;
499 if(emcIn->GetEntries() > 0){
501 if(((AliPHOSRecPoint *)emcIn->At(0))->IsEmc())
502 nModulesToUnfold = fGeom->GetNModules() ;
504 nModulesToUnfold = fGeom->GetNCPVModules() ;
506 for(index = 0 ; index < nEmcUnfolded; index++){
508 emcRecPoint = (AliPHOSEmcRecPoint *) emcIn->At(index) ;
509 if(emcRecPoint->GetPHOSMod()> nModulesToUnfold)
512 Int_t nMultipl = emcRecPoint->GetMultiplicity() ;
513 Int_t * maxAt = new Int_t[nMultipl] ;
514 Float_t * maxAtEnergy = new Float_t[nMultipl] ;
515 Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy) ;
517 if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0
518 UnfoldClusters(dl, emcIn, emcRecPoint, nMax, maxAt, maxAtEnergy) ;
519 emcIn->Remove(emcRecPoint);
526 delete[] maxAtEnergy ;
527 } //Unfolding finished
531 // to set index to new and correct index of old RecPoints
532 for( index = 0 ; index < emcIn->GetEntries() ; index++){
534 ((AliPHOSEmcRecPoint *) emcIn->At(index))->SetIndexInList(index) ;
542 //____________________________________________________________________________
543 void AliPHOSTrackSegmentMakerv1::UnfoldClusters(DigitsList * dl,
544 AliPHOSRecPoint::RecPointsList * emcIn,
545 AliPHOSEmcRecPoint * iniEmc,
548 Float_t * maxAtEnergy)
550 // Performs the unfolding of a cluster with nMax overlapping showers
551 // This is time consuming (use the (Un)SetUnfolFlag() )
553 Int_t nPar = 3 * nMax ;
554 Float_t * fitparameters = new Float_t[nPar] ;
557 Bool_t rv = FindFit(iniEmc, maxAt, maxAtEnergy, nPar, fitparameters) ;
559 // Fit failed, return and remove cluster
560 delete[] fitparameters ;
568 Int_t nDigits = iniEmc->GetMultiplicity() ;
574 Float_t * efit = new Float_t[nDigits] ;
578 AliPHOSDigit * digit ;
579 AliPHOSEmcRecPoint * emcRP ;
580 Int_t * emcDigits = iniEmc->GetDigitsList() ;
581 Float_t * emcEnergies = iniEmc->GetEnergiesList() ;
583 Int_t iRecPoint = emcIn->GetEntries() ;
585 for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
586 digit = fPlease->GimeDigit( emcDigits[iDigit] ) ;
587 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
588 fGeom->RelPosInModule(relid, xDigit, zDigit) ;
592 while(iparam < nPar ){
593 xpar = fitparameters[iparam] ;
594 zpar = fitparameters[iparam+1] ;
595 epar = fitparameters[iparam+2] ;
597 distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
598 distance = TMath::Sqrt(distance) ;
599 efit[iDigit] += epar * AliPHOSTrackSegmentMakerv1::ShowerShape(distance) ;
607 while(iparam < nPar ){
608 xpar = fitparameters[iparam] ;
609 zpar = fitparameters[iparam+1] ;
610 epar = fitparameters[iparam+2] ;
613 if(iRecPoint >= emcIn->GetSize())
614 emcIn->Expand(2*iRecPoint) ;
615 (*emcIn)[iRecPoint] = new AliPHOSEmcRecPoint( iniEmc->GetLogWeightCut(), iniEmc->GetLocMaxCut() ) ;
617 emcRP = (AliPHOSEmcRecPoint *) emcIn->At(iRecPoint);
620 for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
621 digit = fPlease->GimeDigit( emcDigits[iDigit] ) ;
622 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
623 fGeom->RelPosInModule(relid, xDigit, zDigit) ;
624 distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
625 distance = TMath::Sqrt(distance) ;
626 ratio = epar * AliPHOSTrackSegmentMakerv1::ShowerShape(distance) / efit[iDigit] ;
627 eDigit = emcEnergies[iDigit] * ratio ;
628 emcRP->AddDigit( *digit, eDigit ) ;
633 delete[] fitparameters ;
638 //______________________________________________________________________________
639 void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)
641 // Calculates th Chi square for the cluster unfolding minimization
642 // Number of parameters, Gradient, Chi squared, parameters, what to do
644 AliPHOSEmcRecPoint * emcRP = (AliPHOSEmcRecPoint *) gMinuit->GetObjectFit() ; // EmcRecPoint to fit
646 Int_t * emcDigits = emcRP->GetDigitsList() ;
648 Int_t nOfDigits = emcRP->GetDigitsMultiplicity() ;
650 Float_t * emcEnergies = emcRP->GetEnergiesList() ;
652 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
654 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
660 for(iparam = 0 ; iparam < nPar ; iparam++)
661 Grad[iparam] = 0 ; // Will evaluate gradient
665 AliPHOSDigit * digit ;
668 for( iDigit = 0 ; iDigit < nOfDigits ; iDigit++) {
670 digit = please->GimeDigit( emcDigits[iDigit] ) ;
676 geom->AbsToRelNumbering(digit->GetId(), relid) ;
678 geom->RelPosInModule(relid, xDigit, zDigit) ;
680 if(iflag == 2){ // calculate gradient
683 while(iParam < nPar ){
684 Double_t distance = (xDigit - x[iParam]) * (xDigit - x[iParam]) ;
686 distance += (zDigit - x[iParam]) * (zDigit - x[iParam]) ;
687 distance = TMath::Sqrt( distance ) ;
689 efit += x[iParam] * AliPHOSTrackSegmentMakerv1::ShowerShape(distance) ;
692 Double_t sum = 2. * (efit - emcEnergies[iDigit]) / emcEnergies[iDigit] ; // Here we assume, that sigma = sqrt(E)
694 while(iParam < nPar ){
695 Double_t xpar = x[iParam] ;
696 Double_t zpar = x[iParam+1] ;
697 Double_t epar = x[iParam+2] ;
698 Double_t dr = TMath::Sqrt( (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) );
699 Double_t shape = sum * AliPHOSTrackSegmentMakerv1::ShowerShape(dr) ;
700 Double_t r4 = dr*dr*dr*dr ;
701 Double_t r295 = TMath::Power(dr,2.95) ;
702 Double_t deriv =-4. * dr*dr * ( 2.32 / ( (2.32 + 0.26 * r4) * (2.32 + 0.26 * r4) ) +
703 0.0316 * (1. + 0.0171 * r295) / ( ( 1. + 0.0652 * r295) * (1. + 0.0652 * r295) ) ) ;
705 Grad[iParam] += epar * shape * deriv * (xpar - xDigit) ; // Derivative over x
707 Grad[iParam] += epar * shape * deriv * (zpar - zDigit) ; // Derivative over z
709 Grad[iParam] += shape ; // Derivative over energy
716 while(iparam < nPar ){
717 Double_t xpar = x[iparam] ;
718 Double_t zpar = x[iparam+1] ;
719 Double_t epar = x[iparam+2] ;
721 Double_t distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
722 distance = TMath::Sqrt(distance) ;
723 efit += epar * AliPHOSTrackSegmentMakerv1::ShowerShape(distance) ;
726 fret += (efit-emcEnergies[iDigit])*(efit-emcEnergies[iDigit])/emcEnergies[iDigit] ;
727 // Here we assume, that sigma = sqrt(E)