]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/AliCaloTrackAODReader.cxx
New more general analysis implemention for particle identification and correlation...
[u/mrichter/AliRoot.git] / PWG4 / 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 /* 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
46 ClassImp(AliCaloTrackAODReader)
47
48 //____________________________________________________________________________
49 AliCaloTrackAODReader::AliCaloTrackAODReader() : 
50   AliCaloTrackReader()
51 {
52   //Default Ctor
53   
54   //Initialize parameters
55   fDataType=kAOD;
56   
57 }
58
59 //____________________________________________________________________________
60 AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) :   
61   AliCaloTrackReader(g)
62 {
63   // cpy ctor
64 }
65
66 //_________________________________________________________________________
67 AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source)
68 {
69   // assignment operator
70
71   if(&source == this) return *this;
72
73   return *this;
74
75 }
76
77 //____________________________________________________________________________
78 void 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       
107       //      AliAODTrack *newtrack =
108       new((*fAODCTS)[naod++])  AliAODTrack(*track);
109       
110     }//Pt and Fidutial cut passed. 
111     //}// track status
112   }// track loop
113   if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntries());
114 }
115
116 //____________________________________________________________________________
117 void AliCaloTrackAODReader::FillInputEMCAL() {
118   //Return array with EMCAL clusters in aod format
119    fAODEMCAL = new TClonesArray("AliAODCaloCluster",0);
120
121   TRefArray * caloClusters = new TRefArray();
122   fAOD->GetEMCALClusters(caloClusters);
123   
124   //Get vertex for momentum calculation  
125   Double_t v[3] ; //vertex ;
126   GetVertex(v);
127
128   //Loop to select clusters in fidutial cut and fill container with aodClusters
129   Int_t naod = 0;
130
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);      
135     
136     if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){
137     
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());
140
141       //AliAODCaloCluster *caloCluster = 
142       new((*fAODPHOS)[naod++]) AliAODCaloCluster(*clus);
143
144     }//Pt and Fidutial cut passed.
145   }//esd cluster loop
146   
147   if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntries());
148
149 }
150
151 //____________________________________________________________________________
152 void AliCaloTrackAODReader::FillInputPHOS() {
153   //Return array with PHOS clusters in aod format
154   fAODPHOS = new TClonesArray("AliAODCaloCluster",0);
155
156   TRefArray * caloClusters = new TRefArray();
157   fAOD->GetPHOSClusters(caloClusters);
158
159   //Get vertex for momentum calculation  
160   Double_t v[3] ; //vertex ;
161   GetVertex(v);
162
163   //Loop to select clusters in fidutial cut and fill container with aodClusters
164   Int_t naod = 0;
165
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);      
170     
171     if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){
172       
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());
175
176       //      AliAODCaloCluster *caloCluster = 
177       new((*fAODPHOS)[naod++])  AliAODCaloCluster(*clus);
178       
179     }//Pt and Fidutial cut passed.
180   }//esd cluster loop
181   
182   if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntries());
183
184
185 }
186
187 //____________________________________________________________________________
188 void AliCaloTrackAODReader::FillInputEMCALCells() {
189   //Return array with EMCAL cells in aod format
190
191   fEMCALCells = (TNamed*) fAOD->GetEMCALCells(); 
192
193 }
194
195 //____________________________________________________________________________
196 void AliCaloTrackAODReader::FillInputPHOSCells() {
197   //Return array with PHOS cells in aod format
198
199   fPHOSCells = (TNamed*) fAOD->GetPHOSCells(); 
200
201 }
202
203 //____________________________________________________________________________
204 void AliCaloTrackAODReader::GetVertex(Double_t  v[3]) {
205   //Return vertex position
206
207   v[0]=fAOD->GetVertex(0)->GetX() ;//CHECK!!!
208   v[1]=fAOD->GetVertex(0)->GetY() ;//CHECK!!!
209   v[2]=fAOD->GetVertex(0)->GetZ() ;//CHECK!!!
210 }
211
212
213 //____________________________________________________________________________
214 void AliCaloTrackAODReader::SetInputEvent(TObject* aod, TObject* /*aod*/, TObject* mc) {
215   // Connect the data pointers
216   SetAOD((AliAODEvent*) aod);
217   SetMC((AliMCEvent*) mc);
218 }