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 //_________________________________________________________________________
19 // Class for reading data (AODs) in order to do prompt gamma
20 // or other particle identification and correlations
23 //*-- Author: Gustavo Conesa (LNF-INFN)
24 //////////////////////////////////////////////////////////////////////////////
27 // --- ROOT system ---
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"
38 #include "Riostream.h"
40 ClassImp(AliCaloTrackAODReader)
42 //____________________________________________________________________________
43 AliCaloTrackAODReader::AliCaloTrackAODReader() :
48 //Initialize parameters
53 //____________________________________________________________________________
54 AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) :
60 //_________________________________________________________________________
61 AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source)
63 // assignment operator
65 if(&source == this) return *this;
71 //____________________________________________________________________________
72 void AliCaloTrackAODReader::FillInputCTS() {
73 //Return array with CTS tracks
74 fAODCTS = new TClonesArray("AliAODTrack",0);
76 Int_t nTracks = fAOD->GetNumberOfTracks() ;
80 for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop
81 AliAODTrack * track = fAOD->GetTrack(itrack) ; // retrieve track from esd
83 // //We want tracks fitted in the detectors:
84 // ULong_t status=AliAODTrack::kTPCrefit;
85 // status|=AliAODTrack::kITSrefit;
87 //We want tracks whose PID bit is set:
88 // ULong_t status =AliAODTrack::kITSpid;
89 // status|=AliAODTrack::kTPCpid;
91 // if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set
94 TLorentzVector momentum(p[0],p[1],p[2],0);
96 if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){
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());
101 new((*fAODCTS)[naod++]) AliAODTrack(*track);
103 }//Pt and Fidutial cut passed.
106 if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntriesFast());
109 //____________________________________________________________________________
110 void AliCaloTrackAODReader::FillInputEMCAL() {
111 //Return array with EMCAL clusters in aod format
113 fAODEMCAL = new TClonesArray("AliAODCaloCluster",0);
114 TRefArray * caloClusters = new TRefArray();
115 fAOD->GetEMCALClusters(caloClusters);
117 //Get vertex for momentum calculation
118 Double_t v[3] ; //vertex ;
121 //Loop to select clusters in fidutial cut and fill container with aodClusters
123 for (Int_t iclus = 0; iclus < caloClusters->GetEntriesFast(); iclus++) {
124 AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ;
125 TLorentzVector momentum ;
126 clus->GetMomentum(momentum, v);
128 if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){
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());
133 new((*fAODEMCAL)[naod++]) AliAODCaloCluster(*clus);
135 }//Pt and Fidutial cut passed.
138 if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntriesFast());
142 //____________________________________________________________________________
143 void AliCaloTrackAODReader::FillInputPHOS() {
144 //Return array with PHOS clusters in aod format
146 fAODPHOS = new TClonesArray("AliAODCaloCluster",0);
147 TRefArray * caloClusters = new TRefArray();
148 fAOD->GetPHOSClusters(caloClusters);
150 //Get vertex for momentum calculation
151 Double_t v[3] ; //vertex ;
154 //Loop to select clusters in fidutial cut and fill container with aodClusters
157 for (Int_t iclus = 0; iclus < caloClusters->GetEntriesFast(); iclus++) {
158 AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ;
159 TLorentzVector momentum ;
160 clus->GetMomentum(momentum, v);
162 if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){
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());
167 new((*fAODPHOS)[naod++]) AliAODCaloCluster(*clus);
169 }//Pt and Fidutial cut passed.
172 if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntriesFast());
177 //____________________________________________________________________________
178 void AliCaloTrackAODReader::FillInputEMCALCells() {
179 //Return array with EMCAL cells in aod format
181 fEMCALCells = (TNamed*) fAOD->GetEMCALCells();
185 //____________________________________________________________________________
186 void AliCaloTrackAODReader::FillInputPHOSCells() {
187 //Return array with PHOS cells in aod format
189 fPHOSCells = (TNamed*) fAOD->GetPHOSCells();
193 //____________________________________________________________________________
194 void AliCaloTrackAODReader::GetVertex(Double_t v[3]) {
195 //Return vertex position
197 v[0]=fAOD->GetVertex(0)->GetX() ;//CHECK!!!
198 v[1]=fAOD->GetVertex(0)->GetY() ;//CHECK!!!
199 v[2]=fAOD->GetVertex(0)->GetZ() ;//CHECK!!!
203 //____________________________________________________________________________
204 void AliCaloTrackAODReader::SetInputEvent(TObject* input, TObject* aod, TObject* mc) {
205 // Connect the data pointers
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()));
212 SetMC((AliMCEvent*) mc);