]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/PartCorrBase/AliCaloTrackReader.cxx
PID selection based on simple lambda cut, returns photon or pi0 ID instead of neutral...
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCaloTrackReader.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 /* $Id:  $ */
16
17 //_________________________________________________________________________
18 // Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and 
19 // Central Barrel Tracking detectors (CTS).
20 // Not all MC particles/tracks/clusters are kept, some kinematical/fidutial restrictions are done.
21 // Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TRefArrays (PHOS, EMCAL, CTS)
22 //                 : AliCaloTrackMCReader: Fills Kinematics data in 3 TRefArrays (PHOS, EMCAL, CTS)
23 //                 : AliCaloTrackAODReader: Fills AOD data in 3 TRefArrays (PHOS, EMCAL, CTS) 
24 //                
25 //-- Author: Gustavo Conesa (LNF-INFN) 
26 //////////////////////////////////////////////////////////////////////////////
27
28
29 // --- ROOT system ---
30 #include <TRefArray.h>
31
32 //---- ANALYSIS system ----
33 #include "AliCaloTrackReader.h"
34 #include "AliFidutialCut.h"
35 #include "AliAODEvent.h"
36 #include "AliMCEvent.h"
37
38 ClassImp(AliCaloTrackReader)
39   
40   
41 //____________________________________________________________________________
42   AliCaloTrackReader::AliCaloTrackReader() : 
43     TObject(), fEventNumber(-1), fDataType(0), fDebug(0), 
44     fFidutialCut(0x0),
45     fCTSPtMin(0), fEMCALPtMin(0),fPHOSPtMin(0),
46     fAODCTS(new TRefArray()), fAODEMCAL(new TRefArray()), fAODPHOS(new TRefArray()),
47     fEMCALCells(0x0), fPHOSCells(0x0),
48     fInputEvent(0x0), fOutputEvent(0x0),fMC(0x0),
49     fFillCTS(0),fFillEMCAL(0),fFillPHOS(0),
50     fFillEMCALCells(0),fFillPHOSCells(0)
51 {
52   //Ctor
53   
54   //Initialize parameters
55   InitParameters();
56 }
57
58 //____________________________________________________________________________
59 AliCaloTrackReader::AliCaloTrackReader(const AliCaloTrackReader & g) :   
60   TObject(g), fEventNumber(g.fEventNumber), fDataType(g.fDataType), fDebug(g.fDebug),
61   fFidutialCut(g.fFidutialCut),
62   fCTSPtMin(g.fCTSPtMin), fEMCALPtMin(g.fEMCALPtMin),fPHOSPtMin(g.fPHOSPtMin), 
63   fAODCTS(new TRefArray(*g.fAODCTS)),  
64   fAODEMCAL(new TRefArray(*g.fAODEMCAL)),
65   fAODPHOS(new TRefArray(*g.fAODPHOS)),
66   fEMCALCells(new TNamed(*g.fEMCALCells)),
67   fPHOSCells(new TNamed(*g.fPHOSCells)),
68   fInputEvent(g.fInputEvent), fOutputEvent(g.fOutputEvent), fMC(g.fMC),
69   fFillCTS(g.fFillCTS),fFillEMCAL(g.fFillEMCAL),fFillPHOS(g.fFillPHOS),
70   fFillEMCALCells(g.fFillEMCALCells),fFillPHOSCells(g.fFillPHOSCells)
71 {
72   // cpy ctor
73   
74 }
75
76 //_________________________________________________________________________
77 AliCaloTrackReader & AliCaloTrackReader::operator = (const AliCaloTrackReader & source)
78 {
79   // assignment operator
80   
81   if(&source == this) return *this;
82   
83   fDataType    = source.fDataType ;
84   fDebug       = source.fDebug ;
85   fEventNumber = source.fEventNumber ;
86   fFidutialCut = source.fFidutialCut;
87   
88   fCTSPtMin   = source.fCTSPtMin ;
89   fEMCALPtMin = source.fEMCALPtMin ;
90   fPHOSPtMin  = source.fPHOSPtMin ; 
91   
92   fAODCTS     = new TRefArray(*source.fAODCTS) ;
93   fAODEMCAL   = new TRefArray(*source.fAODEMCAL) ;
94   fAODPHOS    = new TRefArray(*source.fAODPHOS) ;
95   fEMCALCells = new TNamed(*source.fEMCALCells) ;
96   fPHOSCells  = new TNamed(*source.fPHOSCells) ;
97
98   fInputEvent  = source.fInputEvent;
99   fOutputEvent = source.fOutputEvent;
100   fMC          = source.fMC;
101   
102   fFillCTS        = source.fFillCTS;
103   fFillEMCAL      = source.fFillEMCAL;
104   fFillPHOS       = source.fFillPHOS;
105   fFillEMCALCells = source.fFillEMCALCells;
106   fFillPHOSCells  = source.fFillPHOSCells;
107
108   return *this;
109   
110 }
111
112 //_________________________________
113 AliCaloTrackReader::~AliCaloTrackReader() {
114   //Dtor
115   
116   if(fFidutialCut) delete fFidutialCut ;
117   
118   if(fAODCTS){
119     fAODCTS->Clear() ; 
120     delete fAODCTS ;
121   }
122   
123   if(fAODEMCAL){
124     fAODEMCAL->Clear() ; 
125     delete fAODEMCAL ;
126   }
127   
128   if(fAODPHOS){
129     fAODPHOS->Clear() ; 
130     delete fAODPHOS ;
131   }
132   
133   if(fEMCALCells){
134     fEMCALCells->Clear() ; 
135     delete fEMCALCells ;
136   }
137   
138   if(fPHOSCells){
139     fPHOSCells->Clear() ; 
140     delete fPHOSCells ;
141   }
142
143   if(fInputEvent)  delete fInputEvent ;
144   if(fOutputEvent) delete fOutputEvent ;
145   if(fMC)          delete fMC ;
146 }
147
148
149 //____________________________________________________________________________
150 AliStack* AliCaloTrackReader::GetStack() const {
151   //Return pointer to stack
152   if(fMC)
153     return fMC->Stack();
154   else{
155     if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n"); 
156     return 0x0 ;
157   }
158 }
159
160 //____________________________________________________________________________
161 AliHeader* AliCaloTrackReader::GetHeader() const {
162   //Return pointer to header
163   if(fMC)
164     return fMC->Header();
165   else{
166     printf("AliCaloTrackReader::Header is not available\n"); 
167     return 0x0 ;
168   }
169 }
170 //____________________________________________________________________________
171 AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const {
172   //Return pointer to Generated event header
173   if(fMC)
174     return fMC->GenEventHeader();
175   else{
176     printf("AliCaloTrackReader::GenEventHeader is not available\n"); 
177     return 0x0 ;
178   }
179 }
180
181 //_______________________________________________________________
182 void AliCaloTrackReader::InitParameters()
183 {
184  
185   //Initialize the parameters of the analysis.
186   fDataType = kESD ;
187
188   fCTSPtMin   = 0.2 ;
189   fEMCALPtMin   = 0.5 ;
190   fPHOSPtMin   = 0.5 ;
191
192   fFillEMCAL = kTRUE;
193   fFillPHOS = kTRUE;
194   fFillCTS = kTRUE;
195   fFillEMCALCells = kFALSE;
196   fFillPHOSCells = kFALSE;
197
198   fFidutialCut = new AliFidutialCut();
199
200 }
201
202
203 //________________________________________________________________
204 void AliCaloTrackReader::Print(const Option_t * opt) const
205 {
206
207   //Print some relevant parameters set for the analysis
208   if(! opt)
209     return;
210
211   printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
212   printf("Data type      : %d\n", fDataType) ;
213   printf("CTS Min pT     : %2.1f GeV/c\n", fCTSPtMin) ;
214   printf("EMCAL Min pT   : %2.1f GeV/c\n", fEMCALPtMin) ;
215   printf("PHOS Min pT    : %2.1f GeV/c\n", fPHOSPtMin) ;
216   printf("Use CTS         =     %d\n", fFillCTS) ;
217   printf("Use EMCAL       =     %d\n", fFillEMCAL) ;
218   printf("Use PHOS        =     %d\n", fFillPHOS) ;
219   printf("Use EMCAL Cells =     %d\n", fFillEMCALCells) ;
220   printf("Use PHOS  Cells =     %d\n", fFillPHOSCells) ;
221   printf("    \n") ;
222
223
224 //___________________________________________________
225 void AliCaloTrackReader::FillInputEvent(Int_t iEntry) {
226   //Fill the event counter and input lists that are needed, called by the analysis maker.
227   
228   fEventNumber = iEntry;
229   if((fDataType != kAOD) && ((fOutputEvent->GetCaloClusters())->GetEntriesFast()!=0 ||(fOutputEvent->GetTracks())->GetEntriesFast()!=0)){
230     printf("ABORT: AliCaloTrackReader::AODCaloClusters or AODTracks already filled by the filter, do not use the ESD reader, use the AOD reader\n");
231     abort();
232   }
233   if(fFillCTS)   FillInputCTS();
234   if(fFillEMCAL) FillInputEMCAL();
235   if(fFillPHOS)  FillInputPHOS();
236   if(fFillEMCALCells) FillInputEMCALCells();
237   if(fFillPHOSCells)  FillInputPHOSCells();
238
239 }
240
241 //__________________________________________________
242 void AliCaloTrackReader::ResetLists() {
243   //  Reset lists, called by the analysis maker 
244
245   if(fAODCTS)   fAODCTS -> Clear();
246   if(fAODEMCAL) fAODEMCAL -> Clear();
247   if(fAODPHOS)  fAODPHOS -> Clear();
248   if(fEMCALCells) fEMCALCells -> Clear();
249   if(fPHOSCells)  fPHOSCells -> Clear();
250
251 }