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