]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALReconstructor.cxx
Rongrong: 1. All the extrapolation methods are implemented in AliEMCALTracker; 2...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALReconstructor.cxx
index 84c14a3e1040a4548ff0b71ef9fc92de1366a24a..15d62ba7a801d830f12169c1084717d07bb34613 100644 (file)
@@ -1,4 +1,5 @@
 /**************************************************************************
+#/eliza17/alice/esdfiles/data/2011/LHC11a/000146805/ESDs/pass2_without_SDD/11000146805038.550/root_archive.zip#AliESDs.root
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
@@ -48,6 +49,7 @@
 #include "AliEMCALClusterizerNxN.h"
 #include "AliEMCALRecPoint.h"
 #include "AliEMCALPID.h"
+#include "AliEMCALTracker.h"
 #include "AliRawReader.h"
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
@@ -698,6 +700,9 @@ Bool_t AliEMCALReconstructor::CalculateResidual(AliESDtrack *track, AliESDCaloCl
 
   // If the esdFriend is available, use the TPCOuter point as the starting point of extrapolation
   // Otherwise use the TPCInner point
+
+  dEta = -999, dPhi = -999;
+
   AliExternalTrackParam *trkParam = 0;
   const AliESDfriendTrack*  friendTrack = track->GetFriendTrack();
   if(friendTrack && friendTrack->GetTPCOut())
@@ -706,34 +711,8 @@ Bool_t AliEMCALReconstructor::CalculateResidual(AliESDtrack *track, AliESDCaloCl
     trkParam = const_cast<AliExternalTrackParam*>(track->GetInnerParam());
   if(!trkParam) return kFALSE;
 
-  //Perform extrapolation
-  Double_t trkPos[3];
-  Float_t  clsPos[3];
-
   AliExternalTrackParam trkParamTmp (*trkParam);
-  cluster->GetPosition(clsPos);
-  TVector3 vec(clsPos[0],clsPos[1],clsPos[2]);
-  Double_t alpha =  ((int)(vec.Phi()*TMath::RadToDeg()/20)+0.5)*20*TMath::DegToRad();
-  //Rotate to proper local coordinate
-  vec.RotateZ(-alpha); 
-  trkParamTmp.Rotate(alpha); 
-  //extrapolation is done here
-  if(!AliTrackerBase::PropagateTrackToBxByBz(&trkParamTmp, vec.X(), track->GetMass(), GetRecParam()->GetExtrapolateStep(), kFALSE, 0.8, -1)) 
-    return kFALSE; 
-
-  //Calculate the residuals
-  trkParamTmp.GetXYZ(trkPos); 
-   
-  TVector3 clsPosVec(clsPos[0],clsPos[1],clsPos[2]);
-  TVector3 trkPosVec(trkPos[0],trkPos[1],trkPos[2]);
-      
-  Double_t clsPhi = clsPosVec.Phi();
-  if(clsPhi<0) clsPhi+=2*TMath::Pi();
-  Double_t trkPhi = trkPosVec.Phi();
-  if(trkPhi<0) trkPhi+=2*TMath::Pi();
-
-  dPhi = clsPhi-trkPhi;
-  dEta = clsPosVec.Eta()-trkPosVec.Eta();
+  if(!AliEMCALTracker::ExtrapolateTrackToCluster(&trkParamTmp, cluster, track->GetMass(), GetRecParam()->GetExtrapolateStep(), dEta, dPhi)) return kFALSE;
 
   return kTRUE;
 }