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 **************************************************************************/
16 //_________________________________________________________________________
17 // Implementation version 1 of algorithm class to construct PHOS track segments
18 // Associates EMC and PPSD clusters
19 // Unfolds the EMC cluster
21 //*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH)
24 // --- ROOT system ---
26 #include "TObjArray.h"
27 #include "TClonesArray.h"
28 #include "TObjectTable.h"
30 // --- Standard library ---
34 // --- AliRoot header files ---
36 #include "AliPHOSTrackSegmentMakerv1.h"
37 #include "AliPHOSIndexToObject.h"
38 #include "AliPHOSTrackSegment.h"
39 #include "AliPHOSLink.h"
40 #include "AliPHOSv0.h"
43 extern void UnfoldingChiSquare(Int_t &nPar, Double_t *Grad, Double_t & fret, Double_t *x, Int_t iflag) ;
45 ClassImp( AliPHOSTrackSegmentMakerv1)
48 //____________________________________________________________________________
49 AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1() : AliPHOSTrackSegmentMaker()
54 //clusters are sorted in "rows" and "columns" of width geom->GetCrystalSize(0),
55 fDelta = fR0 + fGeom->GetCrystalSize(0) ;
56 if(!gMinuit) gMinuit = new TMinuit(100) ;
60 //____________________________________________________________________________
61 AliPHOSTrackSegmentMakerv1::~AliPHOSTrackSegmentMakerv1()
69 //____________________________________________________________________________
70 Bool_t AliPHOSTrackSegmentMakerv1::FindFit(AliPHOSEmcRecPoint * emcRP, int * maxAt, Float_t * maxAtEnergy,
71 Int_t nPar, Float_t * fitparameters)
73 // Calls TMinuit to fit the energy distribution of a cluster with several maxima
75 gMinuit->SetPrintLevel(-1) ; // No Printout
76 gMinuit->SetFCN(UnfoldingChiSquare) ; // To set the address of the minimization function
77 gMinuit->SetObjectFit(emcRP) ; // To tranfer pointer to UnfoldingChiSquare
79 // filling initial values for fit parameters
80 AliPHOSDigit * digit ;
84 Int_t nDigits = (Int_t) nPar / 3 ;
89 for(iDigit = 0; iDigit < nDigits; iDigit++){
90 digit = (AliPHOSDigit *) maxAt[iDigit];
95 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
96 fGeom->RelPosInModule(relid, x, z) ;
98 Float_t energy = maxAtEnergy[iDigit] ;
100 gMinuit->mnparm(index, "x", x, 0.1, 0, 0, ierflg) ;
103 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : x = " << x << endl ;
106 gMinuit->mnparm(index, "z", z, 0.1, 0, 0, ierflg) ;
109 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : z = " << z << endl ;
112 gMinuit->mnparm(index, "Energy", energy , 0.05*energy, 0., 4.*energy, ierflg) ;
115 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : energy = " << energy << endl ;
120 Double_t p0 = 0.1 ; // "Tolerance" Evaluation stops when EDM = 0.0001*p0 ; The number of function call slightly
125 gMinuit->mnexcm("SET STR", &p2, 0, ierflg) ; // force TMinuit to reduce function calls
126 gMinuit->mnexcm("SET GRA", &p1, 1, ierflg) ; // force TMinuit to use my gradient
127 gMinuit->SetMaxIterations(5);
128 gMinuit->mnexcm("SET NOW", &p2 , 0, ierflg) ; // No Warnings
130 gMinuit->mnexcm("MIGRAD", &p0, 0, ierflg) ; // minimize
132 if(ierflg == 4){ // Minimum not found
133 cout << "PHOS Unfolding> Fit not converged, cluster abandoned "<< endl ;
136 for(index = 0; index < nPar; index++){
139 gMinuit->GetParameter(index, val, err) ; // Returns value and error of parameter index
140 fitparameters[index] = val ;
147 //____________________________________________________________________________
148 void AliPHOSTrackSegmentMakerv1::FillOneModule(AliPHOSRecPoint::RecPointsList * emcIn,
150 AliPHOSRecPoint::RecPointsList * ppsdIn,
152 TArrayI * ppsdOutLow,
155 Int_t & ppsdStopedAt)
157 // Fill xxxOut arrays with clusters from one PHOS module
159 AliPHOSEmcRecPoint * emcRecPoint ;
160 AliPHOSPpsdRecPoint * ppsdRecPoint ;
163 Int_t nEmcUnfolded = emcIn->GetEntries() ;
164 emcOut->Set(nEmcUnfolded);
166 for(index = emcStopedAt; index < nEmcUnfolded; index++){
168 emcRecPoint = (AliPHOSEmcRecPoint *) emcIn->At(index) ;
170 if(emcRecPoint->GetPHOSMod() != phosmod )
173 emcOut->AddAt(emcRecPoint->GetIndexInList(),inEmcOut) ;
176 emcOut->Set(inEmcOut) ;
178 emcStopedAt = index ;
180 ppsdOutLow->Set(ppsdIn->GetEntries()) ;
181 ppsdOutUp->Set(ppsdIn->GetEntries()) ;
184 for(index = ppsdStopedAt; index < ppsdIn->GetEntries(); index++){
185 ppsdRecPoint = (AliPHOSPpsdRecPoint *) ppsdIn->At(index) ;
186 if(ppsdRecPoint->GetPHOSMod() != phosmod )
188 if(phosmod <= fGeom->GetNCPVModules()) //in CPV
189 ppsdOutUp->AddAt(index,inPpsdUp++) ;
191 if(ppsdRecPoint->GetUp() )
192 ppsdOutUp->AddAt(index,inPpsdUp++) ;
194 ppsdOutLow->AddAt(index,inPpsdLow++) ;
197 ppsdOutLow->Set(inPpsdLow);
198 ppsdOutUp->Set(inPpsdUp);
199 ppsdStopedAt = index ;
202 //____________________________________________________________________________
203 Float_t AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * emcclu,AliPHOSPpsdRecPoint * PpsdClu, Bool_t &toofar)
205 // Calculates the distance between the EMC RecPoint and the PPSD RecPoint
212 emcclu->GetLocalPosition(vecEmc) ;
213 PpsdClu->GetLocalPosition(vecPpsd) ;
214 if(emcclu->GetPHOSMod() == PpsdClu->GetPHOSMod()){
215 // if(vecPpsd.X() >= vecEmc.X() - fDelta ){
216 // if(vecPpsd.Z() >= vecEmc.Z() - fDelta ){
217 // Correct to difference in CPV and EMC position due to different distance to center.
218 // we assume, that particle moves from center
219 Float_t dCPV = fGeom->GetIPtoOuterCoverDistance();
220 Float_t dEMC = fGeom->GetIPtoCrystalSurface() ;
222 vecPpsd = dEMC * vecPpsd - vecEmc ;
224 // } // if zPpsd >= zEmc - fDelta
226 //} // if xPpsd >= xEmc - fDelta
239 //____________________________________________________________________________
240 void AliPHOSTrackSegmentMakerv1::MakeLinks(TArrayI * emcRecPoints, TArrayI * ppsdRecPointsUp,
241 TArrayI * ppsdRecPointsLow, TClonesArray * linklowArray,
242 TClonesArray *linkupArray)
244 // Finds distances (links) between all EMC and PPSD clusters, which are not further apart from each other than fR0
247 AliPHOSPpsdRecPoint * ppsdlow ;
248 AliPHOSPpsdRecPoint * ppsdup ;
249 AliPHOSEmcRecPoint * emcclu ;
256 for(iEmcRP = 0; iEmcRP < emcRecPoints->GetSize(); iEmcRP++ ) {
257 emcclu = (AliPHOSEmcRecPoint *) fPlease->GimeRecPoint(emcRecPoints->At(iEmcRP),"emc") ;
262 for(iPpsdLow = 0; iPpsdLow < ppsdRecPointsLow->GetSize();iPpsdLow++ ) {
264 ppsdlow = (AliPHOSPpsdRecPoint *) fPlease->GimeRecPoint(ppsdRecPointsLow->At(iPpsdLow),"ppsd") ;
265 Float_t r = GetDistanceInPHOSPlane(emcclu, ppsdlow, toofar) ;
270 new( (*linklowArray)[iLinkLow++]) AliPHOSLink(r, iEmcRP, iPpsdLow) ;
275 for(iPpsdUp = 0; iPpsdUp < ppsdRecPointsUp->GetSize();iPpsdUp++ ) {
277 ppsdup = (AliPHOSPpsdRecPoint *)fPlease->GimeRecPoint(ppsdRecPointsUp->At(iPpsdUp),"ppsd") ;
278 Float_t r = GetDistanceInPHOSPlane(emcclu, ppsdup, toofar) ;
283 new( (*linkupArray)[iLinkUp++]) AliPHOSLink(r, iEmcRP, iPpsdUp) ;
288 linklowArray->Sort() ; //first links with smallest distances
289 linkupArray->Sort() ;
292 //____________________________________________________________________________
293 void AliPHOSTrackSegmentMakerv1::MakePairs(TArrayI * emcRecPoints,
294 TArrayI * ppsdRecPointsUp,
295 TArrayI * ppsdRecPointsLow,
296 TClonesArray * linklowArray,
297 TClonesArray * linkupArray,
298 AliPHOSTrackSegment::TrackSegmentsList * trsl)
301 // Finds the smallest links and makes pairs of PPSD and EMC clusters with smallest distance
303 TIter nextLow(linklowArray) ;
304 TIter nextUp(linkupArray) ;
306 AliPHOSLink * linkLow ;
307 AliPHOSLink * linkUp ;
313 AliPHOSPpsdRecPoint * nullpointer = 0 ;
316 while ( (linkLow = (AliPHOSLink *)nextLow() ) ){
318 emc = emcRecPoints->At(linkLow->GetEmc()) ;
319 ppsdLow = ppsdRecPointsLow->At(linkLow->GetPpsd()) ;
321 if( (emc >= 0) && (ppsdLow >= 0) ){ // RecPoints not removed yet
323 new( (*trsl)[fNTrackSegments] ) AliPHOSTrackSegment((AliPHOSEmcRecPoint *)fPlease->GimeRecPoint(emc,"emc"),
325 (AliPHOSPpsdRecPoint *)fPlease->GimeRecPoint(ppsdLow,"ppsd") ) ;
326 ((AliPHOSTrackSegment* )trsl->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
327 //replace index of emc to negative and shifted index of TS
328 emcRecPoints->AddAt(-2 - fNTrackSegments,linkLow->GetEmc()) ;
329 //replace index of PPSD Low to negative and shifted index of TS
330 ppsdRecPointsLow->AddAt(-2 - fNTrackSegments,linkLow->GetPpsd()) ;
336 while ( (linkUp = (AliPHOSLink *)nextUp() ) ){
337 emc = emcRecPoints->At(linkUp->GetEmc()) ;
338 if(emc != -1){ //without ppsd Up yet
340 ppsdUp = ppsdRecPointsUp->At(linkUp->GetPpsd()) ;
341 if(ppsdUp >= 0){ //ppsdUp still exist
343 if(emc >= 0){ //without ppsd Low => create new TS
345 fNTrackSegments = trsl->GetEntries() ;
346 new( (*trsl)[fNTrackSegments] ) AliPHOSTrackSegment((AliPHOSEmcRecPoint *) fPlease->GimeRecPoint(emc,"emc"),
347 (AliPHOSPpsdRecPoint *)fPlease->GimeRecPoint(ppsdUp,"ppsd"),
349 ((AliPHOSTrackSegment *) trsl->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
352 else{ // append ppsd Up to existing TS
353 ((AliPHOSTrackSegment *)trsl->At(-2-emc))->SetPpsdUpRecPoint((AliPHOSPpsdRecPoint *)fPlease->GimeRecPoint(ppsdUp,"ppsd"));
356 emcRecPoints->AddAt(-1,linkUp->GetEmc()) ; //Mark that PPSD Up found
357 //replace index of PPSD Up to negative and shifted index of TS
358 ppsdRecPointsUp->AddAt(-2 - fNTrackSegments,linkUp->GetPpsd()) ;
359 } //if ppsdUp still exist
364 for(iEmcRP = 0; iEmcRP <emcRecPoints->GetSize() ; iEmcRP++ ){
365 emc = emcRecPoints->At(iEmcRP) ;
369 new( (*trsl)[fNTrackSegments] ) AliPHOSTrackSegment((AliPHOSEmcRecPoint *) fPlease->GimeRecPoint(emc,"emc"),
370 nullpointer, nullpointer ) ;
371 ((AliPHOSTrackSegment *) trsl->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
379 //____________________________________________________________________________
380 void AliPHOSTrackSegmentMakerv1::MakeTrackSegments(DigitsList * dl,
381 AliPHOSRecPoint::RecPointsList * emcl,
382 AliPHOSRecPoint::RecPointsList * ppsdl,
383 AliPHOSTrackSegment::TrackSegmentsList * trsl)
385 // Makes the track segments out of the list of EMC and PPSD Recpoints and stores them in a list
387 Int_t emcStopedAt = 0 ;
388 Int_t ppsdStopedAt = 0 ;
390 fNTrackSegments = 0 ;
392 TArrayI * emcRecPoints = new TArrayI(1000) ; // these arrays keep indexes
393 TArrayI * ppsdRecPointsUp = new TArrayI(1000) ; // of RecPoints, which are
394 TArrayI * ppsdRecPointsLow = new TArrayI(1000) ; // kept in TClonesArray's emcl, ppsdl, cpv
396 TClonesArray * linklowArray = new TClonesArray("AliPHOSLink", 1000);
397 TClonesArray * linkupArray = new TClonesArray("AliPHOSLink", 1000);
400 UnfoldAll(dl, emcl) ; // Unfolds all EMC clusters
401 UnfoldAll(dl, ppsdl) ; // Unfolds all CPV clusters
405 while(phosmod <= fGeom->GetNModules() ){
407 FillOneModule(emcl, emcRecPoints, ppsdl, ppsdRecPointsUp, ppsdRecPointsLow, phosmod, emcStopedAt, ppsdStopedAt) ;
409 MakeLinks(emcRecPoints, ppsdRecPointsUp, ppsdRecPointsLow, linklowArray, linkupArray) ;
411 MakePairs(emcRecPoints, ppsdRecPointsUp, ppsdRecPointsLow, linklowArray, linkupArray, trsl) ;
413 emcRecPoints->Reset() ;
415 ppsdRecPointsUp->Reset() ;
417 ppsdRecPointsLow->Reset() ;
419 linkupArray->Clear() ;
421 linklowArray->Clear() ;
426 delete emcRecPoints ;
429 delete ppsdRecPointsUp ;
430 ppsdRecPointsUp = 0 ;
432 delete ppsdRecPointsLow ;
433 ppsdRecPointsLow = 0 ;
438 delete linklowArray ;
442 //____________________________________________________________________________
443 void AliPHOSTrackSegmentMakerv1::MakeTrackSegmentsCPV(DigitsList * dl,
444 AliPHOSRecPoint::RecPointsList * emcl,
445 AliPHOSRecPoint::RecPointsList * cpvl)
447 // Unfold clusters in EMC and CPV and refill reconstructed point lists emcl and ppsdl
448 // Yuri Kharlov. 19 October 2000
450 fNTrackSegments = 0 ;
452 TArrayI * emcRecPoints = new TArrayI(1000) ; // these arrays keep indexes
453 TArrayI * cpvRecPoints = new TArrayI(1000) ; // of RecPoints, which are kept in emcl and ppsdl
456 UnfoldAll(dl, emcl) ; // Unfolds all EMC clusters
457 UnfoldAll(dl, cpvl) ; // Unfolds all CPV clusters
460 // Int_t phosmod = 1 ;
461 // Int_t emcStopedAt = 0 ;
462 // Int_t cpvStopedAt = 0 ;
463 // while(phosmod <= fGeom->GetNModules() ){
464 // FillOneModule(emcl, emcRecPoints, ppsdl, cpvRecPoints, phosmod, emcStopedAt, cpvStopedAt) ;
465 // emcRecPoints->Reset() ;
466 // cpvRecPoints->Reset() ;
470 delete emcRecPoints ; emcRecPoints = 0 ;
471 delete cpvRecPoints ; cpvRecPoints = 0 ;
474 //____________________________________________________________________________
475 Double_t AliPHOSTrackSegmentMakerv1::ShowerShape(Double_t r)
477 // Shape of the shower (see PHOS TDR)
478 // If you change this function, change also the gradien evaluation in ChiSquare()
480 Double_t r4 = r*r*r*r ;
481 Double_t r295 = TMath::Power(r, 2.95) ;
482 Double_t shape = TMath::Exp( -r4 * (1. / (2.32 + 0.26 * r4) + 0.0316 / (1 + 0.0652 * r295) ) ) ;
486 //____________________________________________________________________________
487 void AliPHOSTrackSegmentMakerv1::UnfoldAll(DigitsList * dl, AliPHOSRecPoint::RecPointsList * emcIn)
489 // Performs unfolding of all EMC/CPV but NOT ppsd clusters, sorts them and resets indexes in RecPoints
491 AliPHOSEmcRecPoint * emcRecPoint ;
493 Int_t nEmcUnfolded = emcIn->GetEntries() ;
495 Int_t nModulesToUnfold ;
497 if(emcIn->GetEntries() > 0){
499 if(((AliPHOSRecPoint *)emcIn->At(0))->IsEmc())
500 nModulesToUnfold = fGeom->GetNModules() ;
502 nModulesToUnfold = fGeom->GetNCPVModules() ;
504 for(index = 0 ; index < nEmcUnfolded; index++){
506 emcRecPoint = (AliPHOSEmcRecPoint *) emcIn->At(index) ;
507 if(emcRecPoint->GetPHOSMod()> nModulesToUnfold)
510 Int_t nMultipl = emcRecPoint->GetMultiplicity() ;
511 Int_t * maxAt = new Int_t[nMultipl] ;
512 Float_t * maxAtEnergy = new Float_t[nMultipl] ;
513 Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy) ;
515 if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0
516 UnfoldClusters(dl, emcIn, emcRecPoint, nMax, maxAt, maxAtEnergy) ;
517 emcIn->Remove(emcRecPoint);
524 delete[] maxAtEnergy ;
525 } //Unfolding finished
529 // to set index to new and correct index of old RecPoints
530 for( index = 0 ; index < emcIn->GetEntries() ; index++){
532 ((AliPHOSEmcRecPoint *) emcIn->At(index))->SetIndexInList(index) ;
540 //____________________________________________________________________________
541 void AliPHOSTrackSegmentMakerv1::UnfoldClusters(DigitsList * dl,
542 AliPHOSRecPoint::RecPointsList * emcIn,
543 AliPHOSEmcRecPoint * iniEmc,
546 Float_t * maxAtEnergy)
548 // Performs the unfolding of a cluster with nMax overlapping showers
549 // This is time consuming (use the (Un)SetUnfolFlag() )
551 Int_t nPar = 3 * nMax ;
552 Float_t * fitparameters = new Float_t[nPar] ;
555 Bool_t rv = FindFit(iniEmc, maxAt, maxAtEnergy, nPar, fitparameters) ;
557 // Fit failed, return and remove cluster
558 delete[] fitparameters ;
566 Int_t nDigits = iniEmc->GetMultiplicity() ;
572 Float_t * efit = new Float_t[nDigits] ;
576 AliPHOSDigit * digit ;
577 AliPHOSEmcRecPoint * emcRP ;
578 Int_t * emcDigits = iniEmc->GetDigitsList() ;
579 Float_t * emcEnergies = iniEmc->GetEnergiesList() ;
581 Int_t iRecPoint = emcIn->GetEntries() ;
583 for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
584 digit = fPlease->GimeDigit( emcDigits[iDigit] ) ;
585 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
586 fGeom->RelPosInModule(relid, xDigit, zDigit) ;
590 while(iparam < nPar ){
591 xpar = fitparameters[iparam] ;
592 zpar = fitparameters[iparam+1] ;
593 epar = fitparameters[iparam+2] ;
595 distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
596 distance = TMath::Sqrt(distance) ;
597 efit[iDigit] += epar * AliPHOSTrackSegmentMakerv1::ShowerShape(distance) ;
605 while(iparam < nPar ){
606 xpar = fitparameters[iparam] ;
607 zpar = fitparameters[iparam+1] ;
608 epar = fitparameters[iparam+2] ;
611 if(iRecPoint >= emcIn->GetSize())
612 emcIn->Expand(2*iRecPoint) ;
613 (*emcIn)[iRecPoint] = new AliPHOSEmcRecPoint( iniEmc->GetLogWeightCut(), iniEmc->GetLocMaxCut() ) ;
615 emcRP = (AliPHOSEmcRecPoint *) emcIn->At(iRecPoint);
618 for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
619 digit = fPlease->GimeDigit( emcDigits[iDigit] ) ;
620 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
621 fGeom->RelPosInModule(relid, xDigit, zDigit) ;
622 distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
623 distance = TMath::Sqrt(distance) ;
624 ratio = epar * AliPHOSTrackSegmentMakerv1::ShowerShape(distance) / efit[iDigit] ;
625 eDigit = emcEnergies[iDigit] * ratio ;
626 emcRP->AddDigit( *digit, eDigit ) ;
631 delete[] fitparameters ;
636 //______________________________________________________________________________
637 void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)
639 // Calculates th Chi square for the cluster unfolding minimization
640 // Number of parameters, Gradient, Chi squared, parameters, what to do
642 AliPHOSEmcRecPoint * emcRP = (AliPHOSEmcRecPoint *) gMinuit->GetObjectFit() ; // EmcRecPoint to fit
644 Int_t * emcDigits = emcRP->GetDigitsList() ;
646 Int_t nOfDigits = emcRP->GetDigitsMultiplicity() ;
648 Float_t * emcEnergies = emcRP->GetEnergiesList() ;
650 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
652 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
658 for(iparam = 0 ; iparam < nPar ; iparam++)
659 Grad[iparam] = 0 ; // Will evaluate gradient
663 AliPHOSDigit * digit ;
666 for( iDigit = 0 ; iDigit < nOfDigits ; iDigit++) {
668 digit = please->GimeDigit( emcDigits[iDigit] ) ;
674 geom->AbsToRelNumbering(digit->GetId(), relid) ;
676 geom->RelPosInModule(relid, xDigit, zDigit) ;
678 if(iflag == 2){ // calculate gradient
681 while(iParam < nPar ){
682 Double_t distance = (xDigit - x[iParam]) * (xDigit - x[iParam]) ;
684 distance += (zDigit - x[iParam]) * (zDigit - x[iParam]) ;
685 distance = TMath::Sqrt( distance ) ;
687 efit += x[iParam] * AliPHOSTrackSegmentMakerv1::ShowerShape(distance) ;
690 Double_t sum = 2. * (efit - emcEnergies[iDigit]) / emcEnergies[iDigit] ; // Here we assume, that sigma = sqrt(E)
692 while(iParam < nPar ){
693 Double_t xpar = x[iParam] ;
694 Double_t zpar = x[iParam+1] ;
695 Double_t epar = x[iParam+2] ;
696 Double_t dr = TMath::Sqrt( (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) );
697 Double_t shape = sum * AliPHOSTrackSegmentMakerv1::ShowerShape(dr) ;
698 Double_t r4 = dr*dr*dr*dr ;
699 Double_t r295 = TMath::Power(dr,2.95) ;
700 Double_t deriv =-4. * dr*dr * ( 2.32 / ( (2.32 + 0.26 * r4) * (2.32 + 0.26 * r4) ) +
701 0.0316 * (1. + 0.0171 * r295) / ( ( 1. + 0.0652 * r295) * (1. + 0.0652 * r295) ) ) ;
703 Grad[iParam] += epar * shape * deriv * (xpar - xDigit) ; // Derivative over x
705 Grad[iParam] += epar * shape * deriv * (zpar - zDigit) ; // Derivative over z
707 Grad[iParam] += shape ; // Derivative over energy
714 while(iparam < nPar ){
715 Double_t xpar = x[iparam] ;
716 Double_t zpar = x[iparam+1] ;
717 Double_t epar = x[iparam+2] ;
719 Double_t distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
720 distance = TMath::Sqrt(distance) ;
721 efit += epar * AliPHOSTrackSegmentMakerv1::ShowerShape(distance) ;
724 fret += (efit-emcEnergies[iDigit])*(efit-emcEnergies[iDigit])/emcEnergies[iDigit] ;
725 // Here we assume, that sigma = sqrt(E)