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__)
31 #include "AliPHOSGetter.h"
32 #include "AliPHOSGeometry.h"
33 #include "Riostream.h"
35 #include "AliESDtrack.h"
36 #include "AliESDCaloTrack.h"
37 #include "AliEMCALRecParticle.h"
38 #include "AliPHOSRecParticle.h"
39 #include "AliKalmanTrack.h"
40 #include "AliPHOSGridFile.h"
43 Bool_t AnaESD(TString filename) ;
44 void Match(AliESDtrack * ct, AliESDtrack * cp, Double_t * dist) ;
47 //__________________________________________________________________________
48 Bool_t Ana(const TString type = "per5", const Int_t run = 1, const Int_t nOfEvt = 1)
50 // Analyzes data from the AliEn data catalog
52 // Data Challenge identification
53 const TString kYear("2004") ;
54 const TString kProd("02") ;
55 const TString kVers("V4.01.Rev.00") ;
57 // get the LFN file name in the Grid catalogue ;
59 if (!lfn.IsConnected())
61 lfn.SetPath(kYear, kProd, kVers, type) ;
64 //loop over the events
66 for (nevt = 0 ; nevt < nOfEvt ; nevt++) {
69 TString fileName = lfn.GetLFN() ;
71 if (fileName.IsNull()) {
76 printf(">>>>>>>>>>>> Processing %s-%s/%s/%s : run # %d event # %d \n",
77 kYear.Data(), kProd.Data(), kVers.Data(), type.Data(), run, evt) ;
83 //__________________________________________________________________________
84 Bool_t AnaESD(TString fileName)
86 // Analyze ESD from file fileName
87 // calo track histograms ;
89 TFile * out = new TFile("AOD.root", "RECREATE") ;
90 TH1D * hCaloEnergyA = 0 ;
91 TH1D * hCaloEnergyE = 0 ;
92 TH1D * hCaloEnergyG = 0 ;
93 TH1D * hCaloEnergyP = 0 ;
98 AliPHOSGetter * gime = AliPHOSGetter::Instance(fileName) ;
100 Int_t nEvent = gime->MaxEvent() ;
103 for (event = 0 ; event < nEvent; event++) {
104 cout << "AnaESD : Processing event # " << event << endl ;
105 esd = gime->ESD(event) ;
110 // Calorimeter tracks
113 for (caloindex = 0 ; caloindex < esd->GetNumberOfTracks() ; caloindex++) {
114 // get the tracks and check if it is from PHOS
115 ct = esd->GetTrack(caloindex) ;
118 Double_t energy = ct->GetPHOSsignal() ;
119 // check if CPV bit is set (see AliPHOSFastRecParticle)
120 Double_t type[AliESDtrack::kSPECIES+4] ;
121 ct->GetPHOSpid(type) ;
123 if ( (type[AliESDtrack::kElectron] == 1.0) || (type[AliESDtrack::kPhoton] == 1.0) ) {
126 hCaloEnergyA = new TH1D("CaloEnergyA", "Energy in calorimeter Electron/Photon like", 500, 0., 50.) ;
128 hCaloEnergyA->Fill(energy) ;
131 if ( type[AliESDtrack::kElectron] == 1.0 ) {
134 hCaloEnergyE = new TH1D("CaloEnergyE", "Energy in calorimeter Electron like", 500, 0., 50.) ;
136 hCaloEnergyE->Fill(energy) ;
139 if ( type[AliESDtrack::kPhoton] == 1.0 ) {
142 hCaloEnergyG = new TH1D("CaloEnergyG", "Energy in calorimeter Gamma like", 500, 0., 50.) ;
144 hCaloEnergyG->Fill(energy) ;
147 if ( type[AliESDtrack::kPi0] == 1.0 ) {
150 hCaloEnergyP = new TH1D("CaloEnergyP", "Energy in calorimeter Pi0 like", 500, 0., 100.) ;
152 hCaloEnergyP->Fill(energy) ;
157 for (cpindex = 0 ; cpindex < esd->GetNumberOfTracks() ; cpindex++) {
158 // get the charged tracks from central tracking
159 cp = esd->GetTrack(cpindex) ;
162 Match(ct, cp, dist) ;
163 if (!heta && !hphi) {
164 heta = new TH1D("Correta", "neutral-charged correlation in eta" , 100, 0., 360.) ;
165 hphi = new TH1D("Corrphi", "neutral-charged correlation in phi" , 100, 0., 360.) ;
167 heta->Fill(dist[1]) ;
168 hphi->Fill(dist[2]) ;
172 TBrowser * bs = new TBrowser("Root Memory Bowser", gROOT->FindObjectAny("AOD.root") ) ;
178 //__________________________________________________________________________
179 void Match(AliESDtrack * ct, AliESDtrack * cp, Double_t * dist)
181 // Calculates the distance (x,z) between the particle detected by PHOS and
182 // the charged particle reconstructed by the global tracking
186 // Double_t phZ, phX ;
188 // if (ct->IsPHOS()) { // it is a PHOS particle
189 // Double_t cpTheta, cpPhi ;
190 // Double_t phTheta, phPhi ;
191 // cpTheta = cpPhi = phTheta = phPhi = 0. ;
192 // // cout << "PHOS particle # " << " pos ("
193 // // << pp->GetPos().X() << ", " << pp->GetPos().Y() << ", " << pp->GetPos().Z() << ")" << endl ;
195 // AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
196 // gime->PHOSGeometry()->ImpactOnEmc(*pp, phN, phZ, phX) ;
197 // Double_t xyzAtPHOS[3] ;
198 // cp->GetOuterXYZ(xyzAtPHOS) ;
199 // if ( (xyzAtPHOS[0] + xyzAtPHOS[1] + xyzAtPHOS[2]) != 0.) { //it has reached PHOS
200 // //the next check are only if we want high quality tracks
201 // // ULong_t status = cp->GetStatus() ;
202 // // if ((status & AliESDtrack::kTRDput)==0)
203 // // do not continue;
204 // // if ((status & AliESDtrack::kTRDStop)!=0)
205 // // do not continue;
206 // // cout << "Charged particle # " << " pos ("
207 // // << xyzAtPHOS[0] << ", " << xyzAtPHOS[1] << ", " << xyzAtPHOS[2] << ")" << endl ;
208 // TVector3 poscp(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2]) ;
210 // Double_t cpZ,cpX ;
211 // gime->PHOSGeometry()->ImpactOnEmc(poscp, cpN, cpZ, cpX) ;
212 // if (cpN) {// we are inside the PHOS acceptance
213 // // cout << "Charged Matching 1: " << cpN << " " << cpZ << " " << cpX << endl ;
214 // // cout << "Charged Matching 2: " << phN << " " << phZ << " " << phX << endl ;
215 // dist[0] = TMath::Sqrt( (cpZ-phZ)*(cpZ-phZ) + (cpX-phX)*(cpX-phX)) ;
217 // phTheta = pp->Theta() ;
218 // phPhi = pp->Phi() ;
220 // tempo.SetMomentum(xyzAtPHOS[0], xyzAtPHOS[1], xyzAtPHOS[2], 0.) ;
221 // cpTheta = tempo.Theta() ;
222 // cpPhi = tempo.Phi() ;
223 // //cout << phTheta << " " << phPhi << " " << endl
224 // //cout << cpTheta << " " << cpPhi-phPhi << " " << endl ;
226 // dist[1] = (phTheta - cpTheta)*TMath::RadToDeg() ;
227 // dist[2] = (phPhi - cpPhi)*TMath::RadToDeg() ;
231 // //cout << "EMCAL particle # " << endl ;