2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /* History of cvs commits:
24 //_________________________________________________________________________
25 // Class for reading data (AODs) in order to do prompt gamma
26 // or other particle identification and correlations
29 //*-- Author: Gustavo Conesa (LNF-INFN)
30 //////////////////////////////////////////////////////////////////////////////
33 // --- ROOT system ---
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"
44 #include "Riostream.h"
46 ClassImp(AliCaloTrackAODReader)
48 //____________________________________________________________________________
49 AliCaloTrackAODReader::AliCaloTrackAODReader() :
54 //Initialize parameters
59 //____________________________________________________________________________
60 AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) :
66 //_________________________________________________________________________
67 AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source)
69 // assignment operator
71 if(&source == this) return *this;
77 //____________________________________________________________________________
78 void AliCaloTrackAODReader::FillInputCTS() {
79 //Return array with CTS tracks
80 fAODCTS = new TClonesArray("AliAODTrack",0);
82 Int_t nTracks = fAOD->GetNumberOfTracks() ;
86 for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop
87 AliAODTrack * track = fAOD->GetTrack(itrack) ; // retrieve track from esd
89 // //We want tracks fitted in the detectors:
90 // ULong_t status=AliAODTrack::kTPCrefit;
91 // status|=AliAODTrack::kITSrefit;
93 //We want tracks whose PID bit is set:
94 // ULong_t status =AliAODTrack::kITSpid;
95 // status|=AliAODTrack::kTPCpid;
97 // if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set
100 TLorentzVector momentum(p[0],p[1],p[2],0);
102 if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){
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());
107 // AliAODTrack *newtrack =
108 new((*fAODCTS)[naod++]) AliAODTrack(*track);
110 }//Pt and Fidutial cut passed.
113 if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntries());
116 //____________________________________________________________________________
117 void AliCaloTrackAODReader::FillInputEMCAL() {
118 //Return array with EMCAL clusters in aod format
119 fAODEMCAL = new TClonesArray("AliAODCaloCluster",0);
121 TRefArray * caloClusters = new TRefArray();
122 fAOD->GetEMCALClusters(caloClusters);
124 //Get vertex for momentum calculation
125 Double_t v[3] ; //vertex ;
128 //Loop to select clusters in fidutial cut and fill container with aodClusters
131 for (Int_t iclus = 0; iclus < caloClusters->GetEntries(); iclus++) {
132 AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ;
133 TLorentzVector momentum ;
134 clus->GetMomentum(momentum, v);
136 if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){
138 if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputEMCAL():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
139 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
141 //AliAODCaloCluster *caloCluster =
142 new((*fAODPHOS)[naod++]) AliAODCaloCluster(*clus);
144 }//Pt and Fidutial cut passed.
147 if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntries());
151 //____________________________________________________________________________
152 void AliCaloTrackAODReader::FillInputPHOS() {
153 //Return array with PHOS clusters in aod format
154 fAODPHOS = new TClonesArray("AliAODCaloCluster",0);
156 TRefArray * caloClusters = new TRefArray();
157 fAOD->GetPHOSClusters(caloClusters);
159 //Get vertex for momentum calculation
160 Double_t v[3] ; //vertex ;
163 //Loop to select clusters in fidutial cut and fill container with aodClusters
166 for (Int_t iclus = 0; iclus < caloClusters->GetEntries(); iclus++) {
167 AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ;
168 TLorentzVector momentum ;
169 clus->GetMomentum(momentum, v);
171 if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){
173 if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputPHOS():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
174 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
176 // AliAODCaloCluster *caloCluster =
177 new((*fAODPHOS)[naod++]) AliAODCaloCluster(*clus);
179 }//Pt and Fidutial cut passed.
182 if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntries());
187 //____________________________________________________________________________
188 void AliCaloTrackAODReader::FillInputEMCALCells() {
189 //Return array with EMCAL cells in aod format
191 fEMCALCells = (TNamed*) fAOD->GetEMCALCells();
195 //____________________________________________________________________________
196 void AliCaloTrackAODReader::FillInputPHOSCells() {
197 //Return array with PHOS cells in aod format
199 fPHOSCells = (TNamed*) fAOD->GetPHOSCells();
203 //____________________________________________________________________________
204 void AliCaloTrackAODReader::GetVertex(Double_t v[3]) {
205 //Return vertex position
207 v[0]=fAOD->GetVertex(0)->GetX() ;//CHECK!!!
208 v[1]=fAOD->GetVertex(0)->GetY() ;//CHECK!!!
209 v[2]=fAOD->GetVertex(0)->GetZ() ;//CHECK!!!
213 //____________________________________________________________________________
214 void AliCaloTrackAODReader::SetInputEvent(TObject* aod, TObject* /*aod*/, TObject* mc) {
215 // Connect the data pointers
216 SetAOD((AliAODEvent*) aod);
217 SetMC((AliMCEvent*) mc);