]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/PartCorrBase/AliCaloTrackAODReader.cxx
161ad92e27f0f69d72efcf313e05141591149f80
[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 "AliAODCaloCluster.h"
34 #include "AliAODTrack.h"
35 #include "AliFidutialCut.h"
36
37 ClassImp(AliCaloTrackAODReader)
38
39 //____________________________________________________________________________
40 AliCaloTrackAODReader::AliCaloTrackAODReader() : 
41   AliCaloTrackReader()
42 {
43   //Default Ctor
44   
45   //Initialize parameters
46   fDataType=kAOD;
47   
48 }
49
50 //____________________________________________________________________________
51 AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) :   
52   AliCaloTrackReader(g)
53 {
54   // cpy ctor
55 }
56
57 //_________________________________________________________________________
58 //AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source)
59 //{
60 //  // assignment operator
61 //
62 //  if(&source == this) return *this;
63 //
64 //  return *this;
65 //
66 //}
67
68 //____________________________________________________________________________
69 void AliCaloTrackAODReader::FillInputCTS() {
70   //Return array with CTS tracks
71
72   Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
73   Bool_t first = kTRUE;
74   Double_t p[3];
75   
76   for (Int_t itrack =  0; itrack <  nTracks; itrack++) {////////////// track loop
77     AliAODTrack * track = ((AliAODEvent*)fInputEvent)->GetTrack(itrack) ; // retrieve track from esd
78     
79     //     //We want tracks fitted in the detectors:
80     //     ULong_t status=AliAODTrack::kTPCrefit;
81     //     status|=AliAODTrack::kITSrefit;
82     
83     //We want tracks whose PID bit is set:
84     //     ULong_t status =AliAODTrack::kITSpid;
85     //     status|=AliAODTrack::kTPCpid;
86     
87     //   if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set
88     
89     track->GetPxPyPz(p) ;
90     TLorentzVector momentum(p[0],p[1],p[2],0);
91     
92     if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){
93       
94       if(fDebug > 2 && momentum.Pt() > 0.1)printf("FillInputCTS():: Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
95                                                   momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
96       
97       if(first){
98         new (fAODCTS) TRefArray(TProcessID::GetProcessWithUID(track)); 
99         first=kFALSE;
100       }     
101       fAODCTS->Add(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   Bool_t first = kTRUE;
114   
115   //Get vertex for momentum calculation  
116   Double_t v[3] ; //vertex ;
117   GetVertex(v);
118   
119   //Loop to select clusters in fidutial cut and fill container with aodClusters
120   //Int_t naod = 0;
121   for (Int_t iclus =  0; iclus < ((AliAODEvent*)fInputEvent)->GetNCaloClusters(); iclus++) {
122     AliAODCaloCluster * clus = 0;
123     if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
124       if (clus->IsEMCALCluster()){
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           if(first){
134             new (fAODEMCAL) TRefArray(TProcessID::GetProcessWithUID(clus)); 
135             first=kFALSE;
136           }
137           fAODEMCAL->Add(clus); 
138         }//Pt and Fidutial cut passed.
139       }//EMCAL cluster
140     }// cluster exists
141   }//esd cluster loop
142   
143   if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntriesFast());
144
145 }
146
147 //____________________________________________________________________________
148 void AliCaloTrackAODReader::FillInputPHOS() {
149   //Return array with PHOS clusters in aod format
150
151    Bool_t first = kTRUE;
152   
153   //Get vertex for momentum calculation  
154   Double_t v[3] ; //vertex ;
155   GetVertex(v);
156
157   //Loop to select clusters in fidutial cut and fill container with aodClusters
158   //Int_t naod = 0;
159
160   for (Int_t iclus =  0; iclus < ((AliAODEvent*)fInputEvent)->GetNCaloClusters(); iclus++) {
161     AliAODCaloCluster * clus = 0;
162     if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
163       if (clus->IsPHOSCluster()){
164         TLorentzVector momentum ;
165         clus->GetMomentum(momentum, v);      
166         
167         if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){
168           
169           if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputPHOS():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
170                                                      momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
171           
172           if(first){
173             new (fAODPHOS) TRefArray(TProcessID::GetProcessWithUID(clus)); 
174             first=kFALSE;
175           }     
176           fAODPHOS->Add(clus);  
177         }//Pt and Fidutial cut passed.
178       }//PHOS cluster
179     }//cluster exists
180   }//esd cluster loop
181   
182   if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntriesFast());
183
184
185 }
186
187 //____________________________________________________________________________
188 void AliCaloTrackAODReader::FillInputEMCALCells() {
189   //Return array with EMCAL cells in aod format
190
191   fEMCALCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetEMCALCells(); 
192
193 }
194
195 //____________________________________________________________________________
196 void AliCaloTrackAODReader::FillInputPHOSCells() {
197   //Return array with PHOS cells in aod format
198
199   fPHOSCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetPHOSCells(); 
200
201 }
202
203 //____________________________________________________________________________
204 void AliCaloTrackAODReader::GetVertex(Double_t  v[3]) const {
205   //Return vertex position
206
207   v[0] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetX() ;//CHECK!!!
208   v[1] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetY() ;//CHECK!!!
209   v[2] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetZ() ;//CHECK!!!
210 }
211
212
213 //____________________________________________________________________________
214 void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent* aod, AliMCEvent* mc) {
215   // Connect the data pointers
216   // If input is AOD, do analysis with input, if not, do analysis with the output aod.
217   if(!strcmp(input->GetName(),"AliESDEvent"))   {
218     SetInputEvent(aod);
219     SetOutputEvent(aod);
220   }
221   else if(!strcmp(input->GetName(),"AliAODEvent")){
222     SetInputEvent(input);
223     SetOutputEvent(aod);
224   }
225   else{ 
226     printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - ABORT::Unknown data format: %s",input->GetName());
227     abort();
228   }
229   
230   SetMC(mc);
231   
232 }