]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/AliCaloTrackReader.cxx
Warnings potentially serious in compilation fixed
[u/mrichter/AliRoot.git] / PWG4 / 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 /* History of cvs commits:
18  *
19  * $Log$
20  *
21  *
22  */
23
24 //_________________________________________________________________________
25 // Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and 
26 // Central Barrel Tracking detectors (CTS).
27 // Not all MC particles/tracks/clusters are kept, some kinematical/fidutial restrictions are done.
28 // Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TClonesArrays (PHOS, EMCAL, CTS)
29 //                 : AliCaloTrackMCReader: Fills Kinematics data in 3 TClonesArrays (PHOS, EMCAL, CTS)
30 //                 : AliCaloTrackAODReader: Fills AOD data in 3 TClonesArrays (PHOS, EMCAL, CTS) 
31 //                
32 //-- Author: Gustavo Conesa (LNF-INFN) 
33 //////////////////////////////////////////////////////////////////////////////
34
35
36 // --- ROOT system ---
37 #include <TMath.h>
38 #include <TLorentzVector.h>
39 #include <TString.h>
40
41 //---- ANALYSIS system ----
42 #include "AliCaloTrackReader.h"
43 #include "AliLog.h"
44 #include "AliStack.h"  
45 #include "AliHeader.h"  
46 #include "AliGenEventHeader.h"  
47
48 ClassImp(AliCaloTrackReader)
49   
50   
51 //____________________________________________________________________________
52   AliCaloTrackReader::AliCaloTrackReader() : 
53     TObject(), fDataType(0), fDebug(0), fFidutialCut(0x0),
54     fCTSPtMin(0), fEMCALPtMin(0),fPHOSPtMin(0),
55     fAODCTS(0x0), fAODEMCAL(0x0), fAODPHOS(0x0),
56     fEMCALCells(0x0), fPHOSCells(0x0),
57     fESD(0x0), fAOD(0x0),fMC(0x0),
58     fFillCTS(0),fFillEMCAL(0),fFillPHOS(0),
59     fFillEMCALCells(0),fFillPHOSCells(0)
60 {
61   //Ctor
62   
63   //Initialize parameters
64   InitParameters();
65 }
66
67 //____________________________________________________________________________
68 AliCaloTrackReader::AliCaloTrackReader(const AliCaloTrackReader & g) :   
69   TObject(g), fDataType(g.fDataType), fDebug(g.fDebug),fFidutialCut(g.fFidutialCut),
70   fCTSPtMin(g.fCTSPtMin), fEMCALPtMin(g.fEMCALPtMin),fPHOSPtMin(g.fPHOSPtMin), 
71   fAODCTS(new TClonesArray(*g.fAODCTS)),  
72   fAODEMCAL(new TClonesArray(*g.fAODEMCAL)),
73   fAODPHOS(new TClonesArray(*g.fAODPHOS)),
74   fEMCALCells(new TNamed(*g.fEMCALCells)),
75   fPHOSCells(new TNamed(*g.fPHOSCells)),
76   fESD(g.fESD), fAOD(g.fAOD), fMC(g.fMC),
77   fFillCTS(g.fFillCTS),fFillEMCAL(g.fFillEMCAL),fFillPHOS(g.fFillPHOS),
78   fFillEMCALCells(g.fFillEMCALCells),fFillPHOSCells(g.fFillPHOSCells)
79 {
80   // cpy ctor
81   
82 }
83
84 //_________________________________________________________________________
85 AliCaloTrackReader & AliCaloTrackReader::operator = (const AliCaloTrackReader & source)
86 {
87   // assignment operator
88   
89   if(&source == this) return *this;
90   
91   fDataType = source.fDataType ;
92   fDebug = source.fDebug ;
93   
94   fFidutialCut = source.fFidutialCut;
95   
96   fCTSPtMin = source.fCTSPtMin ;
97   fEMCALPtMin = source.fEMCALPtMin ;
98   fPHOSPtMin = source.fPHOSPtMin ; 
99   
100   fAODCTS = new TClonesArray(*source.fAODCTS) ;
101   fAODEMCAL = new TClonesArray(*source.fAODEMCAL) ;
102   fAODPHOS = new TClonesArray(*source.fAODPHOS) ;
103   fEMCALCells = new TNamed(*source.fEMCALCells) ;
104   fPHOSCells = new TNamed(*source.fPHOSCells) ;
105
106   fESD = source.fESD;
107   fAOD= source.fAOD;
108   fMC = source.fMC;
109   
110   fFillCTS = source.fFillCTS;
111   fFillEMCAL = source.fFillEMCAL;
112   fFillPHOS = source.fFillPHOS;
113   fFillEMCALCells = source.fFillEMCALCells;
114   fFillPHOSCells = source.fFillPHOSCells;
115
116   return *this;
117   
118 }
119
120 //_________________________________
121 AliCaloTrackReader::~AliCaloTrackReader() {
122   //Dtor
123   
124   if(fFidutialCut) delete fFidutialCut ;
125   
126   if(fAODCTS){
127     fAODCTS->Clear() ; 
128     delete fAODCTS ;
129   }
130   
131   if(fAODEMCAL){
132     fAODEMCAL->Clear() ; 
133     delete fAODEMCAL ;
134   }
135   
136   if(fAODPHOS){
137     fAODPHOS->Clear() ; 
138     delete fAODPHOS ;
139   }
140   
141   if(fEMCALCells){
142     fEMCALCells->Clear() ; 
143     delete fEMCALCells ;
144   }
145   
146   if(fPHOSCells){
147     fPHOSCells->Clear() ; 
148     delete fPHOSCells ;
149   }
150
151   if(fESD) delete fESD ;
152   if(fAOD) delete fAOD ;
153   if(fMC) delete fMC ;
154 }
155
156 //____________________________________________________________________________
157 AliStack* AliCaloTrackReader::GetStack() const {
158   //Return pointer to stack
159   if(fMC)
160     return fMC->Stack();
161   else{
162     printf("stack is not available"); 
163     return 0x0 ;
164   }
165 }
166
167 //____________________________________________________________________________
168 AliHeader* AliCaloTrackReader::GetHeader() const {
169   //Return pointer to header
170   if(fMC)
171     return fMC->Header();
172   else{
173     printf("header is not available"); 
174     return 0x0 ;
175   }
176 }
177 //____________________________________________________________________________
178 AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const {
179   //Return pointer to Generated event header
180   if(fMC)
181     return fMC->GenEventHeader();
182   else{
183     printf("GenEventHeader is not available"); 
184     return 0x0 ;
185   }
186 }
187
188 //_______________________________________________________________
189 void AliCaloTrackReader::InitParameters()
190 {
191  
192   //Initialize the parameters of the analysis.
193   fDataType = kESD ;
194
195   fCTSPtMin   = 0.2 ;
196   fEMCALPtMin   = 0.5 ;
197   fPHOSPtMin   = 0.5 ;
198
199   fFillEMCAL = kTRUE;
200   fFillPHOS = kTRUE;
201   fFillCTS = kTRUE;
202   fFillEMCALCells = kFALSE;
203   fFillPHOSCells = kFALSE;
204
205   fFidutialCut = new AliFidutialCut();
206
207 }
208
209
210 //________________________________________________________________
211 void AliCaloTrackReader::Print(const Option_t * opt) const
212 {
213
214   //Print some relevant parameters set for the analysis
215   if(! opt)
216     return;
217
218   printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
219   printf("Data type      : %d\n", fDataType) ;
220   printf("CTS Min pT     : %2.1f GeV/c\n", fCTSPtMin) ;
221   printf("EMCAL Min pT   : %2.1f GeV/c\n", fEMCALPtMin) ;
222   printf("PHOS Min pT    : %2.1f GeV/c\n", fPHOSPtMin) ;
223   printf("Use CTS         =     %d\n", fFillCTS) ;
224   printf("Use EMCAL       =     %d\n", fFillEMCAL) ;
225   printf("Use PHOS        =     %d\n", fFillPHOS) ;
226   printf("Use EMCAL Cells =     %d\n", fFillEMCALCells) ;
227   printf("Use PHOS  Cells =     %d\n", fFillPHOSCells) ;
228   printf("    \n") ;
229
230
231 //___________________________________________________
232 void AliCaloTrackReader::FillInputEvent() {
233   //Fill the input lists that are needed, called by the analysis maker.
234
235   if(fFillCTS) FillInputCTS();
236   if(fFillEMCAL) FillInputEMCAL();
237   if(fFillPHOS) FillInputPHOS();
238   if(fFillEMCALCells) FillInputEMCALCells();
239   if(fFillPHOSCells) FillInputPHOSCells();
240
241 }
242
243 //__________________________________________________
244 void AliCaloTrackReader::ResetLists() {
245   //  Reset lists, called by the analysis maker 
246
247   if(fAODCTS) fAODCTS -> Clear();
248   if(fAODEMCAL) fAODEMCAL -> Clear();
249   if(fAODPHOS) fAODPHOS -> Clear();
250   if(fEMCALCells) fEMCALCells -> Clear();
251   if(fPHOSCells) fPHOSCells -> Clear();
252
253 }