The direction of z was reversed in GetMomentumDirection ... nobody remembers why.
[u/mrichter/AliRoot.git] / PHOS / AnaESD.C
CommitLineData
12391a12 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 **************************************************************************/
15/* $Id$ */
16//_________________________________________________________________________
17// Macros analyzing the ESD file
18// Use Case :
19// root> .L AnaESD.C++
20// root> ana() --> prints the objects stored in ESD
21//
22// author : Yves Schutz (CERN/SUBATECH)
23// February 2004
24//_________________________________________________________________________
e82c1b8f 25#if !defined(__CINT__) || defined(__MAKECINT__)
baf5b427 26#include "TFile.h"
c7f69b3a 27#include "TMath.h"
baf5b427 28#include "AliPHOSGetter.h"
2631352f 29#include "AliPHOSGeometry.h"
baf5b427 30#include "Riostream.h"
31#include "AliESD.h"
c7f69b3a 32#include "AliESDtrack.h"
1d13ffb1 33#include "AliESDCaloTrack.h"
34#include "AliEMCALRecParticle.h"
35#include "AliPHOSRecParticle.h"
c7f69b3a 36#include "AliKalmanTrack.h"
e82c1b8f 37#endif
baf5b427 38
39void Ana()
40{
41 AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ;
42 Int_t nEvent = gime->MaxEvent() ;
43 Int_t event ;
1d13ffb1 44 AliESD * esd = 0 ;
baf5b427 45 for (event = 0 ; event < nEvent; event++) {
46 esd = gime->ESD(event) ;
1d13ffb1 47 esd->Print();
48 Int_t index ;
c7f69b3a 49 // Calorimeter tracks
1d13ffb1 50 AliESDCaloTrack * ct ;
51 AliPHOSRecParticle * pp ;
c7f69b3a 52 AliEMCALRecParticle * ep ;
1d13ffb1 53 for (index = 0 ; index < esd->GetNumberOfCaloTracks() ; index++) {
54 ct = esd->GetCaloTrack(index) ;
55 pp = dynamic_cast<AliPHOSRecParticle*>(ct->GetRecParticle()) ;
56 ep = dynamic_cast<AliEMCALRecParticle*>(ct->GetRecParticle()) ;
c7f69b3a 57 if (pp) {
58 TVector3 pos = pp->GetPos() ;
2631352f 59 cout << "PHOS particle # " << index << " pos ("
60 << pos.X() << ", " << pos.Y() << ", " <<pos.Z() << ") : (" << pos.Eta()
61 << ", " << pos.Phi()*TMath::RadToDeg() << ") : "
62 << TMath::Sqrt(pos.X()*pos.X() + pos.Y()*pos.Y() ) << endl ;
63 Int_t n ;
64 Double_t z,x ;
65 gime->PHOSGeometry()->ImpactOnEmc(pos.Theta(), pos.Phi(), n, z, x) ;
66 if (n)
67 cout << "Matching: " << n << " " << z << " " << x << endl ;
c7f69b3a 68 }
69 if(ep) {
70 TVector3 pos = ep->GetPos() ;
2631352f 71 //cout << "EMCAL particle # " << index << " pos " <<
72 // TMath::Sqrt(pos.X()*pos.X() + pos.Y()*pos.Y() ) << endl ;
c7f69b3a 73 }
74 }
75 //Charged tracks from central tracking
76 AliESDtrack * cp ;
77 for (index = 0 ; index < esd->GetNumberOfTracks() ; index++) {
78 cp = esd->GetTrack(index) ;
80427b5a 79 Double_t xyzAtPHOS[3] ;
80 cp->GetOuterXYZ(xyzAtPHOS) ;
81 // check if the track reaches PHOS
82 if ( (xyzAtPHOS[0] + xyzAtPHOS[1] + xyzAtPHOS[2]) == 0.)
c7f69b3a 83 continue;
80427b5a 84 // the next check are only if we want high quality tracks
85 // ULong_t status = cp->GetStatus() ;
86 // if ((status & AliESDtrack::kTRDput)==0)
87 // continue;
88 // if ((status & AliESDtrack::kTRDStop)!=0)
89 // continue;
c7f69b3a 90
91 // Gets the Global coordinate of the track at the entrance of PHOS
80427b5a 92
2631352f 93 TVector3 poscp(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2]) ;
94 cout << "Charged particle # " << index << " pos ("
95 << poscp.X() << ", " << poscp.Y() << ", " <<poscp.Z() << ") : (" << poscp.Eta()
96 << ", " << poscp.Phi()*TMath::RadToDeg() << ") : "
97 << TMath::Sqrt(poscp.X()*poscp.X() + poscp.Y()*poscp.Y() ) << endl ;
98 Int_t n ;
99 Double_t z,x ;
100 gime->PHOSGeometry()->ImpactOnEmc(poscp.Theta(), poscp.Phi(), n, z, x) ;
101 if (n)
102 cout << "Matching: " << n << " " << z << " " << x << endl ;
c7f69b3a 103 // Does the matching with PHOS/EMCAL
104// for (index = 0 ; index < esd->GetNumberOfCaloTracks() ; index++) {
105// ct = esd->GetCaloTrack(index) ;
106// pp = dynamic_cast<AliPHOSRecParticle*>(ct->GetRecParticle()) ;
107// ep = dynamic_cast<AliEMCALRecParticle*>(ct->GetRecParticle()) ;
108// if (pp) {
109// TVector3 pos = pp->GetPos() ;
110// }
111// }
1d13ffb1 112 }
baf5b427 113 }
114}