]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AnaESD.C
623e5fac4b5c0fe1c90f695f616428c690d5c86d
[u/mrichter/AliRoot.git] / PHOS / AnaESD.C
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 //_________________________________________________________________________
25 #include "TFile.h"
26 #include "TMath.h"
27 #include "AliPHOSGetter.h"
28 #include "AliPHOSGeometry.h"
29 #include "Riostream.h"
30 #include "AliESD.h"
31 #include "AliESDtrack.h"
32 #include "AliESDCaloTrack.h"
33 #include "AliEMCALRecParticle.h"
34 #include "AliPHOSRecParticle.h"
35 #include "AliKalmanTrack.h"
36
37 void Ana() 
38 {
39   AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ; 
40   Int_t nEvent = gime->MaxEvent() ;  
41   Int_t event ; 
42   AliESD * esd = 0 ;
43   for (event = 0 ; event < nEvent; event++) {
44     esd = gime->ESD(event) ; 
45     esd->Print();  
46     Int_t index ;
47     // Calorimeter tracks 
48     AliESDCaloTrack * ct ; 
49     AliPHOSRecParticle * pp ; 
50     AliEMCALRecParticle * ep ; 
51     for (index = 0 ; index < esd->GetNumberOfCaloTracks() ; index++) {
52       ct = esd->GetCaloTrack(index) ;
53       pp = dynamic_cast<AliPHOSRecParticle*>(ct->GetRecParticle()) ; 
54       ep = dynamic_cast<AliEMCALRecParticle*>(ct->GetRecParticle()) ; 
55       if (pp) { 
56         TVector3 pos = pp->GetPos() ;
57         cout << "PHOS particle # " << index << " pos (" 
58              << pos.X() << ", " << pos.Y() << ", " <<pos.Z() << ") : (" << pos.Eta() 
59              << ", " << pos.Phi()*TMath::RadToDeg() << ") : " 
60              << TMath::Sqrt(pos.X()*pos.X() + pos.Y()*pos.Y() ) << endl ; 
61         Int_t n ; 
62         Double_t z,x ; 
63         gime->PHOSGeometry()->ImpactOnEmc(pos.Theta(), pos.Phi(), n, z, x) ; 
64         if (n) 
65           cout << "Matching: " << n << " " << z << " " << x << endl ; 
66       }
67       if(ep) { 
68         TVector3 pos = ep->GetPos() ;
69         //cout << "EMCAL particle # " << index << " pos " << 
70         //  TMath::Sqrt(pos.X()*pos.X() + pos.Y()*pos.Y() ) << endl ; 
71       }
72     }
73     //Charged tracks from central tracking
74     AliESDtrack * cp ; 
75     for (index = 0 ; index < esd->GetNumberOfTracks() ; index++) {
76       cp = esd->GetTrack(index) ;
77       Double_t xyzAtPHOS[3] ; 
78       cp->GetOuterXYZ(xyzAtPHOS) ; 
79       // check if the track reaches PHOS
80       if ( (xyzAtPHOS[0] +  xyzAtPHOS[1] + xyzAtPHOS[2]) == 0.)
81         continue;
82       // the next check are only if we want high quality tracks 
83       //       ULong_t status = cp->GetStatus() ;  
84       //       if ((status & AliESDtrack::kTRDput)==0) 
85       //        continue;
86       //       if ((status & AliESDtrack::kTRDStop)!=0) 
87       //        continue;
88
89       // Gets the Global coordinate of the track at the entrance of PHOS 
90      
91       TVector3 poscp(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2]) ; 
92       cout << "Charged particle # " << index << " pos (" 
93            << poscp.X() << ", " << poscp.Y() << ", " <<poscp.Z() << ") : (" << poscp.Eta() 
94            << ", " << poscp.Phi()*TMath::RadToDeg() << ") : " 
95            << TMath::Sqrt(poscp.X()*poscp.X() + poscp.Y()*poscp.Y() ) << endl ;
96       Int_t n ;
97       Double_t z,x ; 
98       gime->PHOSGeometry()->ImpactOnEmc(poscp.Theta(), poscp.Phi(), n, z, x) ; 
99       if (n) 
100         cout << "Matching: " << n << " " << z << " " << x << endl ; 
101       // Does the matching with PHOS/EMCAL
102 //       for (index = 0 ; index < esd->GetNumberOfCaloTracks() ; index++) {
103 //      ct = esd->GetCaloTrack(index) ;
104 //      pp = dynamic_cast<AliPHOSRecParticle*>(ct->GetRecParticle()) ; 
105 //      ep = dynamic_cast<AliEMCALRecParticle*>(ct->GetRecParticle()) ; 
106 //      if (pp) {
107 //        TVector3 pos = pp->GetPos() ; 
108 //      }
109 //       }
110     }
111   }
112 }