]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AnaESD.C
Updating
[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 "Riostream.h"
29 #include "AliESD.h"
30 #include "AliESDtrack.h"
31 #include "AliESDCaloTrack.h"
32 #include "AliEMCALRecParticle.h"
33 #include "AliPHOSRecParticle.h"
34 #include "AliKalmanTrack.h"
35
36 void Ana() 
37 {
38   AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ; 
39   Int_t nEvent = gime->MaxEvent() ;  
40   Int_t event ; 
41   AliESD * esd = 0 ;
42   for (event = 0 ; event < nEvent; event++) {
43     esd = gime->ESD(event) ; 
44     esd->Print();  
45     Int_t index ;
46     // Calorimeter tracks 
47     AliESDCaloTrack * ct ; 
48     AliPHOSRecParticle * pp ; 
49     AliEMCALRecParticle * ep ; 
50     for (index = 0 ; index < esd->GetNumberOfCaloTracks() ; index++) {
51       ct = esd->GetCaloTrack(index) ;
52       pp = dynamic_cast<AliPHOSRecParticle*>(ct->GetRecParticle()) ; 
53       ep = dynamic_cast<AliEMCALRecParticle*>(ct->GetRecParticle()) ; 
54       if (pp) { 
55         TVector3 pos = pp->GetPos() ;
56         cout << "PHOS particle # " << index << " pos " << 
57           TMath::Sqrt(pos.X()*pos.X() + pos.Y()*pos.Y() + pos.Z()*pos.Z() ) << endl ; 
58       }
59       if(ep) { 
60         TVector3 pos = ep->GetPos() ;
61         cout << "EMCAL particle # " << index << " pos " << 
62           TMath::Sqrt(pos.X()*pos.X() + pos.Y()*pos.Y() + pos.Z()*pos.Z() ) << endl ; 
63       }
64     }
65     //Charged tracks from central tracking
66     AliESDtrack * cp ; 
67     for (index = 0 ; index < esd->GetNumberOfTracks() ; index++) {
68       cp = esd->GetTrack(index) ;
69       ULong_t status = cp->GetStatus() ; 
70
71       // check if the tracks comes out of TRD
72       if ((status & AliESDtrack::kTRDout)==0) 
73         continue;
74       if ((status & AliESDtrack::kTRDStop)!=0) 
75         continue;
76
77       // Gets the Global coordinate of the track at the entrance of PHOS 
78       Double_t xyzAtPHOS[3] ; 
79       cp->GetOuterXYZ(xyzAtPHOS) ; 
80       // cout << xyzAtPHOS[0] << " " << xyzAtPHOS[1] << " "<< xyzAtPHOS[2]  << endl ; 
81       //cout << TMath::Sqrt(xyzAtPHOS[0]*xyzAtPHOS[0] + xyzAtPHOS[1]*xyzAtPHOS[1] + xyzAtPHOS[2]*xyzAtPHOS[2]) << endl ;  
82      
83       // Does the matching with PHOS/EMCAL
84 //       for (index = 0 ; index < esd->GetNumberOfCaloTracks() ; index++) {
85 //      ct = esd->GetCaloTrack(index) ;
86 //      pp = dynamic_cast<AliPHOSRecParticle*>(ct->GetRecParticle()) ; 
87 //      ep = dynamic_cast<AliEMCALRecParticle*>(ct->GetRecParticle()) ; 
88 //      if (pp) {
89 //        TVector3 pos = pp->GetPos() ; 
90 //      }
91 //       }
92     }
93   }
94 }