]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/PartCorrBase/AliCaloTrackAODReader.cxx
74a5f60612684594c7bff4e1e983ac8bdf4e50a8
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCaloTrackAODReader.cxx
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 //_________________________________________________________________________
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 //#include "Riostream.h"
29
30 //---- ANALYSIS system ----
31 #include "AliCaloTrackAODReader.h" 
32 #include "AliAODEvent.h"
33 #include "AliAODVertex.h"
34 #include "AliAODCaloCluster.h"
35 #include "AliAODCaloCluster.h"
36 #include "AliAODTrack.h"
37 #include "AliMCEvent.h"
38 #include "AliLog.h"
39
40 ClassImp(AliCaloTrackAODReader)
41
42 //____________________________________________________________________________
43 AliCaloTrackAODReader::AliCaloTrackAODReader() : 
44   AliCaloTrackReader()
45 {
46   //Default Ctor
47   
48   //Initialize parameters
49   fDataType=kAOD;
50   
51 }
52
53 //____________________________________________________________________________
54 AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) :   
55   AliCaloTrackReader(g)
56 {
57   // cpy ctor
58 }
59
60 //_________________________________________________________________________
61 //AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source)
62 //{
63 //  // assignment operator
64 //
65 //  if(&source == this) return *this;
66 //
67 //  return *this;
68 //
69 //}
70
71 //____________________________________________________________________________
72 void 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       
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->GetEntriesFast());
107 }
108
109 //____________________________________________________________________________
110 void AliCaloTrackAODReader::FillInputEMCAL() {
111   //Return array with EMCAL clusters in aod format
112
113    fAODEMCAL = new TClonesArray("AliAODCaloCluster",0);
114    TRefArray * caloClusters = new TRefArray();
115    fAOD->GetEMCALClusters(caloClusters);
116
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;
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);      
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
133       new((*fAODEMCAL)[naod++]) AliAODCaloCluster(*clus);
134
135     }//Pt and Fidutial cut passed.
136   }//esd cluster loop
137   
138   if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntriesFast());
139
140 }
141
142 //____________________________________________________________________________
143 void AliCaloTrackAODReader::FillInputPHOS() {
144   //Return array with PHOS clusters in aod format
145
146   fAODPHOS = new TClonesArray("AliAODCaloCluster",0);
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->GetEntriesFast(); 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
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->GetEntriesFast());
173
174
175 }
176
177 //____________________________________________________________________________
178 void AliCaloTrackAODReader::FillInputEMCALCells() {
179   //Return array with EMCAL cells in aod format
180
181   fEMCALCells = (TNamed*) fAOD->GetEMCALCells(); 
182
183 }
184
185 //____________________________________________________________________________
186 void AliCaloTrackAODReader::FillInputPHOSCells() {
187   //Return array with PHOS cells in aod format
188
189   fPHOSCells = (TNamed*) fAOD->GetPHOSCells(); 
190
191 }
192
193 //____________________________________________________________________________
194 void AliCaloTrackAODReader::GetVertex(Double_t  v[3]) const {
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 //____________________________________________________________________________
204 void AliCaloTrackAODReader::SetInputEvent(TObject* input, TObject* aod, TObject* mc) {
205   // Connect the data pointers
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   
212   SetMC((AliMCEvent*) mc);
213
214 }