]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AnaESD.C
In the dtor call the current getter rather than passing the filename.
[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"
d6faca62 28#include "TH1D.h"
baf5b427 29#include "AliPHOSGetter.h"
2631352f 30#include "AliPHOSGeometry.h"
baf5b427 31#include "Riostream.h"
32#include "AliESD.h"
c7f69b3a 33#include "AliESDtrack.h"
1d13ffb1 34#include "AliESDCaloTrack.h"
35#include "AliEMCALRecParticle.h"
36#include "AliPHOSRecParticle.h"
c7f69b3a 37#include "AliKalmanTrack.h"
e82c1b8f 38#endif
baf5b427 39
03b531f2 40void Match(TParticle * pp, AliESDtrack * cp, Double_t * dist) ;
41TH1D * heta = new TH1D("heta", "Eta correlation", 100, 0., 360.) ;
42TH1D * hphi = new TH1D("hphi", "Phi correlation", 100, 0., 360.) ;
d6faca62 43
03b531f2 44
baf5b427 45void Ana()
d6faca62 46{
03b531f2 47 Double_t dist[3] ;
baf5b427 48 AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ;
49 Int_t nEvent = gime->MaxEvent() ;
50 Int_t event ;
1d13ffb1 51 AliESD * esd = 0 ;
baf5b427 52 for (event = 0 ; event < nEvent; event++) {
53 esd = gime->ESD(event) ;
d6faca62 54 //esd->Print();
55 Int_t caloindex ;
c7f69b3a 56 // Calorimeter tracks
1d13ffb1 57 AliESDCaloTrack * ct ;
d6faca62 58 for (caloindex = 0 ; caloindex < esd->GetNumberOfCaloTracks() ; caloindex++) {
59 // get the calorimeter type of particles (PHOS or EMCAL)
60 ct = esd->GetCaloTrack(caloindex) ;
61 TParticle * part = ct->GetRecParticle() ;
62
63 AliESDtrack * cp ;
64 Int_t cpindex ;
65 for (cpindex = 0 ; cpindex < esd->GetNumberOfTracks() ; cpindex++) {
66 // get the charged tracks from central tracking
67 cp = esd->GetTrack(cpindex) ;
03b531f2 68 Match(part, cp, dist) ;
c7f69b3a 69 }
03b531f2 70 heta->Fill( dist[1] ) ;
71 hphi->Fill( dist[2] ) ;
c7f69b3a 72 }
d6faca62 73 }
03b531f2 74 heta->Draw() ;
75 //hphi->Draw() ;
d6faca62 76}
03b531f2 77
78void Match(TParticle * part, AliESDtrack * cp, Double_t * dist)
d6faca62 79{
80 // Calculates the distance (x,z) between the particle detected by PHOS and
81 // the charged particle reconstructed by the global tracking
82
d6faca62 83
84 AliPHOSRecParticle * pp = dynamic_cast<AliPHOSRecParticle*>(part) ;
85 AliEMCALRecParticle * ep = dynamic_cast<AliEMCALRecParticle*>(part) ;
86
87 Int_t phN ;
88 Double_t phZ, phX ;
89
90 if (pp) { // it is a PHOS particle
03b531f2 91 Double_t cpTheta, cpPhi ;
92 Double_t phTheta, phPhi ;
93 cpTheta = cpPhi = phTheta = phPhi = 0. ;
94 // cout << "PHOS particle # " << " pos ("
95 // << pp->GetPos().X() << ", " << pp->GetPos().Y() << ", " << pp->GetPos().Z() << ")" << endl ;
d6faca62 96
97 AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
98 gime->PHOSGeometry()->ImpactOnEmc(*pp, phN, phZ, phX) ;
99 Double_t xyzAtPHOS[3] ;
100 cp->GetOuterXYZ(xyzAtPHOS) ;
101 if ( (xyzAtPHOS[0] + xyzAtPHOS[1] + xyzAtPHOS[2]) != 0.) { //it has reached PHOS
102 //the next check are only if we want high quality tracks
80427b5a 103 // ULong_t status = cp->GetStatus() ;
104 // if ((status & AliESDtrack::kTRDput)==0)
d6faca62 105 // do not continue;
80427b5a 106 // if ((status & AliESDtrack::kTRDStop)!=0)
d6faca62 107 // do not continue;
03b531f2 108 // cout << "Charged particle # " << " pos ("
109 // << xyzAtPHOS[0] << ", " << xyzAtPHOS[1] << ", " << xyzAtPHOS[2] << ")" << endl ;
d6faca62 110 TVector3 poscp(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2]) ;
111 Int_t cpN ;
112 Double_t cpZ,cpX ;
113 gime->PHOSGeometry()->ImpactOnEmc(poscp, cpN, cpZ, cpX) ;
114 if (cpN) {// we are inside the PHOS acceptance
03b531f2 115 // cout << "Charged Matching 1: " << cpN << " " << cpZ << " " << cpX << endl ;
116 // cout << "Charged Matching 2: " << phN << " " << phZ << " " << phX << endl ;
117 dist[0] = TMath::Sqrt( (cpZ-phZ)*(cpZ-phZ) + (cpX-phX)*(cpX-phX)) ;
d6faca62 118 }
03b531f2 119 phTheta = pp->Theta() ;
120 phPhi = pp->Phi() ;
d6faca62 121 TParticle tempo ;
122 tempo.SetMomentum(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2], 0.) ;
03b531f2 123 cpTheta = tempo.Theta() ;
124 cpPhi = tempo.Phi() ;
d6faca62 125 //cout << phTheta << " " << phPhi << " " << endl
126 //cout << cpTheta << " " << cpPhi-phPhi << " " << endl ;
1d13ffb1 127 }
03b531f2 128 dist[1] = (phTheta - cpTheta)*TMath::RadToDeg() ;
129 dist[2] = (phPhi - cpPhi)*TMath::RadToDeg() ;
baf5b427 130 }
d6faca62 131
132 if (ep) {
133 //cout << "EMCAL particle # " << endl ;
134 }
baf5b427 135}
d6faca62 136