]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/AliCaloTrackAODReader.cxx
fixing r27675: adding missing files
[u/mrichter/AliRoot.git] / PWG4 / AliCaloTrackAODReader.cxx
CommitLineData
d92b41ad 1
2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16/* $Id: $ */
17
d92b41ad 18//_________________________________________________________________________
19// Class for reading data (AODs) in order to do prompt gamma
20// or other particle identification and correlations
21//
22//
23//*-- Author: Gustavo Conesa (LNF-INFN)
24//////////////////////////////////////////////////////////////////////////////
25
26
27// --- ROOT system ---
28
29//---- ANALYSIS system ----
30#include "AliCaloTrackAODReader.h"
31#include "AliAODEvent.h"
32#include "AliAODVertex.h"
33#include "AliAODCaloCluster.h"
34#include "AliAODCaloCluster.h"
35#include "AliAODTrack.h"
36#include "AliMCEvent.h"
37#include "AliLog.h"
38#include "Riostream.h"
39
40ClassImp(AliCaloTrackAODReader)
41
42//____________________________________________________________________________
43AliCaloTrackAODReader::AliCaloTrackAODReader() :
44 AliCaloTrackReader()
45{
46 //Default Ctor
47
48 //Initialize parameters
49 fDataType=kAOD;
50
51}
52
53//____________________________________________________________________________
54AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) :
55 AliCaloTrackReader(g)
56{
57 // cpy ctor
58}
59
60//_________________________________________________________________________
61AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source)
62{
63 // assignment operator
64
65 if(&source == this) return *this;
66
67 return *this;
68
69}
70
71//____________________________________________________________________________
72void AliCaloTrackAODReader::FillInputCTS() {
73 //Return array with CTS tracks
74 fAODCTS = new TClonesArray("AliAODTrack",0);
75
76 Int_t nTracks = fAOD->GetNumberOfTracks() ;
77 Int_t naod = 0;
78 Double_t p[3];
79
80 for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop
81 AliAODTrack * track = fAOD->GetTrack(itrack) ; // retrieve track from esd
82
83 // //We want tracks fitted in the detectors:
84 // ULong_t status=AliAODTrack::kTPCrefit;
85 // status|=AliAODTrack::kITSrefit;
86
87 //We want tracks whose PID bit is set:
88 // ULong_t status =AliAODTrack::kITSpid;
89 // status|=AliAODTrack::kTPCpid;
90
91 // if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set
92
93 track->GetPxPyPz(p) ;
94 TLorentzVector momentum(p[0],p[1],p[2],0);
95
96 if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){
97
98 if(fDebug > 2 && momentum.Pt() > 0.1)printf("FillInputCTS():: Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
99 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
100
d92b41ad 101 new((*fAODCTS)[naod++]) AliAODTrack(*track);
102
103 }//Pt and Fidutial cut passed.
104 //}// track status
105 }// track loop
106 if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntries());
107}
108
109//____________________________________________________________________________
110void AliCaloTrackAODReader::FillInputEMCAL() {
111 //Return array with EMCAL clusters in aod format
933d8b1e 112
d92b41ad 113 fAODEMCAL = new TClonesArray("AliAODCaloCluster",0);
933d8b1e 114 TRefArray * caloClusters = new TRefArray();
115 fAOD->GetEMCALClusters(caloClusters);
d92b41ad 116
d92b41ad 117 //Get vertex for momentum calculation
118 Double_t v[3] ; //vertex ;
119 GetVertex(v);
120
121 //Loop to select clusters in fidutial cut and fill container with aodClusters
122 Int_t naod = 0;
d92b41ad 123 for (Int_t iclus = 0; iclus < caloClusters->GetEntries(); iclus++) {
124 AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ;
125 TLorentzVector momentum ;
126 clus->GetMomentum(momentum, v);
127
128 if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){
129
130 if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputEMCAL():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
131 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
132
7b9130b0 133 new((*fAODEMCAL)[naod++]) AliAODCaloCluster(*clus);
d92b41ad 134
135 }//Pt and Fidutial cut passed.
136 }//esd cluster loop
137
138 if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntries());
139
140}
141
142//____________________________________________________________________________
143void AliCaloTrackAODReader::FillInputPHOS() {
144 //Return array with PHOS clusters in aod format
d92b41ad 145
933d8b1e 146 fAODPHOS = new TClonesArray("AliAODCaloCluster",0);
d92b41ad 147 TRefArray * caloClusters = new TRefArray();
148 fAOD->GetPHOSClusters(caloClusters);
149
150 //Get vertex for momentum calculation
151 Double_t v[3] ; //vertex ;
152 GetVertex(v);
153
154 //Loop to select clusters in fidutial cut and fill container with aodClusters
155 Int_t naod = 0;
156
157 for (Int_t iclus = 0; iclus < caloClusters->GetEntries(); iclus++) {
158 AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ;
159 TLorentzVector momentum ;
160 clus->GetMomentum(momentum, v);
161
162 if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){
163
164 if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputPHOS():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
165 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
166
d92b41ad 167 new((*fAODPHOS)[naod++]) AliAODCaloCluster(*clus);
168
169 }//Pt and Fidutial cut passed.
170 }//esd cluster loop
171
172 if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntries());
173
174
175}
176
177//____________________________________________________________________________
178void AliCaloTrackAODReader::FillInputEMCALCells() {
179 //Return array with EMCAL cells in aod format
180
181 fEMCALCells = (TNamed*) fAOD->GetEMCALCells();
182
183}
184
185//____________________________________________________________________________
186void AliCaloTrackAODReader::FillInputPHOSCells() {
187 //Return array with PHOS cells in aod format
188
189 fPHOSCells = (TNamed*) fAOD->GetPHOSCells();
190
191}
192
193//____________________________________________________________________________
194void AliCaloTrackAODReader::GetVertex(Double_t v[3]) {
195 //Return vertex position
196
197 v[0]=fAOD->GetVertex(0)->GetX() ;//CHECK!!!
198 v[1]=fAOD->GetVertex(0)->GetY() ;//CHECK!!!
199 v[2]=fAOD->GetVertex(0)->GetZ() ;//CHECK!!!
200}
201
202
203//____________________________________________________________________________
933d8b1e 204void AliCaloTrackAODReader::SetInputEvent(TObject* input, TObject* aod, TObject* mc) {
d92b41ad 205 // Connect the data pointers
933d8b1e 206
207 //If input is AOD, do analysis with input, if not, do analysis with the output aod.
208 if(!strcmp(input->GetName(),"AliESDEvent")) SetAOD((AliAODEvent*) aod);
209 else if(!strcmp(input->GetName(),"AliAODEvent")) SetAOD((AliAODEvent*) input);
210 else AliFatal(Form("Unknown data format: %s",input->GetName()));
211
d92b41ad 212 SetMC((AliMCEvent*) mc);
933d8b1e 213
d92b41ad 214}