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 new((*fAODCTS)[naod++]) AliAODTrack(*track);
109 }//Pt and Fidutial cut passed.
112 if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntries());
115 //____________________________________________________________________________
116 void AliCaloTrackAODReader::FillInputEMCAL() {
117 //Return array with EMCAL clusters in aod format
119 fAODEMCAL = new TClonesArray("AliAODCaloCluster",0);
120 TRefArray * caloClusters = new TRefArray();
121 fAOD->GetEMCALClusters(caloClusters);
123 //Get vertex for momentum calculation
124 Double_t v[3] ; //vertex ;
127 //Loop to select clusters in fidutial cut and fill container with aodClusters
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);
134 if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){
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());
139 new((*fAODEMCAL)[naod++]) AliAODCaloCluster(*clus);
141 }//Pt and Fidutial cut passed.
144 if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntries());
148 //____________________________________________________________________________
149 void AliCaloTrackAODReader::FillInputPHOS() {
150 //Return array with PHOS clusters in aod format
152 fAODPHOS = new TClonesArray("AliAODCaloCluster",0);
153 TRefArray * caloClusters = new TRefArray();
154 fAOD->GetPHOSClusters(caloClusters);
156 //Get vertex for momentum calculation
157 Double_t v[3] ; //vertex ;
160 //Loop to select clusters in fidutial cut and fill container with aodClusters
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);
168 if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){
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());
173 new((*fAODPHOS)[naod++]) AliAODCaloCluster(*clus);
175 }//Pt and Fidutial cut passed.
178 if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntries());
183 //____________________________________________________________________________
184 void AliCaloTrackAODReader::FillInputEMCALCells() {
185 //Return array with EMCAL cells in aod format
187 fEMCALCells = (TNamed*) fAOD->GetEMCALCells();
191 //____________________________________________________________________________
192 void AliCaloTrackAODReader::FillInputPHOSCells() {
193 //Return array with PHOS cells in aod format
195 fPHOSCells = (TNamed*) fAOD->GetPHOSCells();
199 //____________________________________________________________________________
200 void AliCaloTrackAODReader::GetVertex(Double_t v[3]) {
201 //Return vertex position
203 v[0]=fAOD->GetVertex(0)->GetX() ;//CHECK!!!
204 v[1]=fAOD->GetVertex(0)->GetY() ;//CHECK!!!
205 v[2]=fAOD->GetVertex(0)->GetZ() ;//CHECK!!!
209 //____________________________________________________________________________
210 void AliCaloTrackAODReader::SetInputEvent(TObject* input, TObject* aod, TObject* mc) {
211 // Connect the data pointers
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()));
218 SetMC((AliMCEvent*) mc);