1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //_________________________________________________________________________
17 // Macros analyzing the ESD file
19 // root> .L AnaESD.C++
20 // root> ana() --> prints the objects stored in ESD
22 // author : Yves Schutz (CERN/SUBATECH)
24 //_________________________________________________________________________
25 #if !defined(__CINT__) || defined(__MAKECINT__)
29 #include "AliPHOSGetter.h"
30 #include "AliPHOSGeometry.h"
31 #include "Riostream.h"
33 #include "AliESDtrack.h"
34 #include "AliESDCaloTrack.h"
35 #include "AliEMCALRecParticle.h"
36 #include "AliPHOSRecParticle.h"
37 #include "AliKalmanTrack.h"
40 Double_t Match(TParticle * pp, AliESDtrack * cp) ;
41 TH1D * heta = new TH1D("heta", "Eta correlation", 100, -2., 2.) ;
42 TH1D * hphi = new TH1D("hphi", "Phi correlation", 360, 0., 360.) ;
46 AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ;
47 Int_t nEvent = gime->MaxEvent() ;
50 for (event = 0 ; event < nEvent; event++) {
51 esd = gime->ESD(event) ;
55 AliESDCaloTrack * ct ;
56 for (caloindex = 0 ; caloindex < esd->GetNumberOfCaloTracks() ; caloindex++) {
57 // get the calorimeter type of particles (PHOS or EMCAL)
58 ct = esd->GetCaloTrack(caloindex) ;
59 TParticle * part = ct->GetRecParticle() ;
63 for (cpindex = 0 ; cpindex < esd->GetNumberOfTracks() ; cpindex++) {
64 // get the charged tracks from central tracking
65 cp = esd->GetTrack(cpindex) ;
66 Double_t dist = Match(part, cp) ;
69 cout << "================ Distance = " << dist << endl ;
76 Double_t Match(TParticle * part, AliESDtrack * cp)
78 // Calculates the distance (x,z) between the particle detected by PHOS and
79 // the charged particle reconstructed by the global tracking
81 Double_t dist = 99999. ;
83 AliPHOSRecParticle * pp = dynamic_cast<AliPHOSRecParticle*>(part) ;
84 AliEMCALRecParticle * ep = dynamic_cast<AliEMCALRecParticle*>(part) ;
89 if (pp) { // it is a PHOS particle
91 // cout << "PHOS particle # " << " pos ("
92 // << pp->GetPos().X() << ", " << pp->GetPos().Y() << ", " << pp->GetPos().Z() << ")" << endl ;
94 AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
95 gime->PHOSGeometry()->ImpactOnEmc(*pp, phN, phZ, phX) ;
96 Double_t xyzAtPHOS[3] ;
97 cp->GetOuterXYZ(xyzAtPHOS) ;
98 if ( (xyzAtPHOS[0] + xyzAtPHOS[1] + xyzAtPHOS[2]) != 0.) { //it has reached PHOS
99 //the next check are only if we want high quality tracks
100 // ULong_t status = cp->GetStatus() ;
101 // if ((status & AliESDtrack::kTRDput)==0)
103 // if ((status & AliESDtrack::kTRDStop)!=0)
105 // cout << "Charged particle # " << " pos ("
106 // << xyzAtPHOS[0] << ", " << xyzAtPHOS[1] << ", " << xyzAtPHOS[2] << ")" << endl ;
107 TVector3 poscp(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2]) ;
110 gime->PHOSGeometry()->ImpactOnEmc(poscp, cpN, cpZ, cpX) ;
111 if (cpN) {// we are inside the PHOS acceptance
112 // cout << "Charged Matching 1: " << cpN << " " << cpZ << " " << cpX << endl ;
113 // cout << "Charged Matching 2: " << phN << " " << phZ << " " << phX << endl ;
114 dist = TMath::Sqrt( (cpZ-phZ)*(cpZ-phZ) + (cpX-phX)*(cpX-phX)) ;
116 Double_t phTheta = pp->Theta() ;
117 Double_t phPhi = pp->Phi() ;
119 tempo.SetMomentum(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2], 0.) ;
120 Double_t cpTheta = tempo.Theta() ;
121 Double_t cpPhi = tempo.Phi() ;
122 //cout << phTheta << " " << phPhi << " " << endl
123 //cout << cpTheta << " " << cpPhi-phPhi << " " << endl ;
124 heta->Fill( (phTheta - cpTheta)*TMath::RadToDeg() ) ;
125 hphi->Fill( (phPhi - cpPhi)*TMath::RadToDeg() ) ;
130 //cout << "EMCAL particle # " << endl ;