- // continue;
-
- // Gets the Global coordinate of the track at the entrance of PHOS
-
- TVector3 poscp(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2]) ;
- cout << "Charged particle # " << index << " pos ("
- << poscp.X() << ", " << poscp.Y() << ", " <<poscp.Z() << ") : (" << poscp.Eta()
- << ", " << poscp.Phi()*TMath::RadToDeg() << ") : "
- << TMath::Sqrt(poscp.X()*poscp.X() + poscp.Y()*poscp.Y() ) << endl ;
- Int_t n ;
- Double_t z,x ;
- gime->PHOSGeometry()->ImpactOnEmc(poscp.Theta(), poscp.Phi(), n, z, x) ;
- if (n)
- cout << "Matching: " << n << " " << z << " " << x << endl ;
- // Does the matching with PHOS/EMCAL
-// for (index = 0 ; index < esd->GetNumberOfCaloTracks() ; index++) {
-// ct = esd->GetCaloTrack(index) ;
-// pp = dynamic_cast<AliPHOSRecParticle*>(ct->GetRecParticle()) ;
-// ep = dynamic_cast<AliEMCALRecParticle*>(ct->GetRecParticle()) ;
-// if (pp) {
-// TVector3 pos = pp->GetPos() ;
-// }
-// }
+ // do not continue;
+// cout << "Charged particle # " << " pos ("
+// << xyzAtPHOS[0] << ", " << xyzAtPHOS[1] << ", " << xyzAtPHOS[2] << ")" << endl ;
+ TVector3 poscp(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2]) ;
+ Int_t cpN ;
+ Double_t cpZ,cpX ;
+ gime->PHOSGeometry()->ImpactOnEmc(poscp, cpN, cpZ, cpX) ;
+ if (cpN) {// we are inside the PHOS acceptance
+// cout << "Charged Matching 1: " << cpN << " " << cpZ << " " << cpX << endl ;
+// cout << "Charged Matching 2: " << phN << " " << phZ << " " << phX << endl ;
+ dist = TMath::Sqrt( (cpZ-phZ)*(cpZ-phZ) + (cpX-phX)*(cpX-phX)) ;
+ }
+ Double_t phTheta = pp->Theta() ;
+ Double_t phPhi = pp->Phi() ;
+ TParticle tempo ;
+ tempo.SetMomentum(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2], 0.) ;
+ Double_t cpTheta = tempo.Theta() ;
+ Double_t cpPhi = tempo.Phi() ;
+ //cout << phTheta << " " << phPhi << " " << endl
+ //cout << cpTheta << " " << cpPhi-phPhi << " " << endl ;
+ heta->Fill( (phTheta - cpTheta)*TMath::RadToDeg() ) ;
+ hphi->Fill( (phPhi - cpPhi)*TMath::RadToDeg() ) ;