]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/AliGammaReader.cxx
Preprocessor with new DA
[u/mrichter/AliRoot.git] / PWG4 / AliGammaReader.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  * Revision 1.2  2007/08/17 12:40:04  schutz
21  * New analysis classes by Gustavo Conesa
22  *
23  * Revision 1.1.2.1  2007/07/26 10:32:09  schutz
24  * new analysis classes in the the new analysis framework
25  *
26  *
27  */
28
29 //_________________________________________________________________________
30 // Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and 
31 // Central Barrel Tracking detectors.
32 // Not all MC particles/tracks/clusters are kept, some kinematical restrictions are done.
33 // Mother class of : AliGammaDataReader: Fills ESD data in 3 TClonesArrays (PHOS, EMCAL, CTS)
34 //                 : AliGammaMCReader: Fills Kinematics data in 3 TClonesArrays (PHOS, EMCAL, CTS)
35 //                 : AliGammaMCDataReader: Fills ESD data in 3 TClonesArrays (PHOS, EMCAL, CTS) 
36 //                             and MC data in other 3 TClonesArray
37 //*-- Author: Gustavo Conesa (LNF-INFN) 
38 //////////////////////////////////////////////////////////////////////////////
39
40
41 // --- ROOT system ---
42 #include <TFormula.h>
43 #include <TMath.h>
44
45 //---- ANALYSIS system ----
46 #include "AliGammaReader.h"
47
48 ClassImp(AliGammaReader)
49
50
51 //____________________________________________________________________________
52 AliGammaReader::AliGammaReader() : 
53   TObject(), fDataType(0),
54   fSwitchOnEMCAL(0),  fSwitchOnPHOS(0),  fSwitchOnCTS(0),
55   fCTSEtaCut(0.), fEMCALEtaCut(0.), fPHOSEtaCut(0.),
56   fNeutralPtCut(0.), fChargedPtCut(0.),
57   fEMCALIPDistance(0.),   fPHOSIPDistance(0.), 
58   fEMCALMinAngle(0.),   fPHOSMinAngle(0.), 
59   fEMCALPID(0),fPHOSPID(0),
60   fEMCALPhotonWeight(0.), fEMCALPi0Weight(0.),  fEMCALElectronWeight(0.),  
61   fEMCALChargeWeight(0.),fEMCALNeutralWeight(0.),
62   fPHOSPhotonWeight(0.), fPHOSPi0Weight(0.),  fPHOSElectronWeight(0.), 
63   fPHOSChargeWeight(0.) , fPHOSNeutralWeight(0.) ,
64   fPHOSWeightFormula(0), fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0) 
65 {
66   //Ctor
67
68   fPhiEMCALCut[0]=0.;
69   fPhiEMCALCut[1]=0.;
70   fPhiPHOSCut[0]=0.;
71   fPhiPHOSCut[1]=0.;
72  
73   //Initialize parameters
74   InitParameters();
75 }
76
77 //____________________________________________________________________________
78 AliGammaReader::AliGammaReader(const AliGammaReader & g) :   
79   TObject(g), fDataType(g.fDataType),
80   fSwitchOnEMCAL(g.fSwitchOnEMCAL),  fSwitchOnPHOS(g.fSwitchOnPHOS),  fSwitchOnCTS(g.fSwitchOnCTS),
81   fCTSEtaCut(g.fCTSEtaCut),  fEMCALEtaCut(g.fEMCALEtaCut),  fPHOSEtaCut(g.fPHOSEtaCut),
82   fNeutralPtCut(g.fNeutralPtCut), fChargedPtCut(g.fChargedPtCut),
83   fEMCALIPDistance(g.fEMCALIPDistance),  fPHOSIPDistance(g.fPHOSIPDistance),  
84   fEMCALMinAngle(g.fEMCALMinAngle),  fPHOSMinAngle(g.fPHOSMinAngle), 
85   fEMCALPID(g.fEMCALPID), 
86   fPHOSPID(g.fPHOSPID),
87   fEMCALPhotonWeight(g.fEMCALPhotonWeight), 
88   fEMCALPi0Weight(g.fEMCALPi0Weight), 
89   fEMCALElectronWeight(g.fEMCALElectronWeight), 
90   fEMCALChargeWeight(g.fEMCALChargeWeight), 
91   fEMCALNeutralWeight(g.fEMCALNeutralWeight), 
92   fPHOSPhotonWeight(g.fPHOSPhotonWeight),
93   fPHOSPi0Weight(g.fPHOSPi0Weight),
94   fPHOSElectronWeight(g.fPHOSElectronWeight), 
95   fPHOSChargeWeight(g.fPHOSChargeWeight),
96   fPHOSNeutralWeight(g.fPHOSNeutralWeight),
97   fPHOSWeightFormula(g.fPHOSWeightFormula), 
98   fPHOSPhotonWeightFormula(g.fPHOSPhotonWeightFormula), 
99   fPHOSPi0WeightFormula(g.fPHOSPi0WeightFormula) 
100 {
101   // cpy ctor
102
103   fPhiEMCALCut[0]=g.fPhiEMCALCut[0];
104   fPhiEMCALCut[1]=g.fPhiEMCALCut[1];
105   fPhiPHOSCut[0]=g.fPhiPHOSCut[0];
106   fPhiPHOSCut[1]=g.fPhiPHOSCut[1];
107 }
108
109 //_________________________________________________________________________
110 AliGammaReader & AliGammaReader::operator = (const AliGammaReader & source)
111 {
112   // assignment operator
113
114   if(&source == this) return *this;
115
116   fDataType = source.fDataType ;
117
118   fSwitchOnEMCAL = source.fSwitchOnEMCAL;  
119   fSwitchOnPHOS = source.fSwitchOnPHOS;
120   fSwitchOnCTS = source.fSwitchOnCTS;
121
122   fCTSEtaCut = source.fCTSEtaCut;  
123   fEMCALEtaCut = source.fEMCALEtaCut;  
124   fPHOSEtaCut = source.fPHOSEtaCut;
125   fNeutralPtCut = source.fNeutralPtCut;
126   fChargedPtCut = source.fChargedPtCut; 
127
128   fPhiEMCALCut[0]=source.fPhiEMCALCut[0];
129   fPhiEMCALCut[1]=source.fPhiEMCALCut[1];
130   fPhiPHOSCut[0]=source.fPhiPHOSCut[0];
131   fPhiPHOSCut[1]=source.fPhiPHOSCut[1];
132
133   fEMCALIPDistance = source.fEMCALIPDistance; 
134   fPHOSIPDistance = source.fPHOSIPDistance; 
135   fEMCALMinAngle = source.fEMCALMinAngle; 
136   fPHOSMinAngle = source.fPHOSMinAngle; 
137
138   fEMCALPID = source.fEMCALPID ;
139   fPHOSPID = source.fPHOSPID ;
140
141   fEMCALPhotonWeight = source. fEMCALPhotonWeight ;
142   fEMCALPi0Weight = source.fEMCALPi0Weight ;
143   fEMCALElectronWeight = source.fEMCALElectronWeight; 
144   fEMCALChargeWeight = source.fEMCALChargeWeight;
145   fEMCALNeutralWeight = source.fEMCALNeutralWeight;
146
147   fPHOSPhotonWeight = source.fPHOSPhotonWeight ;
148   fPHOSPi0Weight = source.fPHOSPi0Weight ;
149   fPHOSElectronWeight = source.fPHOSElectronWeight; 
150   fPHOSChargeWeight = source.fPHOSChargeWeight;
151   fPHOSNeutralWeight = source.fPHOSNeutralWeight;
152
153   fPHOSWeightFormula       = source.fPHOSWeightFormula; 
154   fPHOSPhotonWeightFormula = source.fPHOSPhotonWeightFormula; 
155   fPHOSPi0WeightFormula    = source.fPHOSPi0WeightFormula;
156
157
158   return *this;
159
160 }
161
162 //_______________________________________________________________
163 void AliGammaReader::InitParameters()
164 {
165  
166   //Initialize the parameters of the analysis.
167   fDataType = kData ;
168
169   fSwitchOnEMCAL = kTRUE ;  
170   fSwitchOnPHOS = kTRUE ;
171   fSwitchOnCTS = kTRUE ;
172
173   fCTSEtaCut         = 0.7 ;  
174   fEMCALEtaCut         = 0.7 ;  
175   fPHOSEtaCut         = 0.12 ;
176   fPhiEMCALCut[0] = 80 *TMath::DegToRad();
177   fPhiEMCALCut[1] = 190*TMath::DegToRad();
178   fPhiPHOSCut[0] = 220. *TMath::DegToRad();
179   fPhiPHOSCut[1] = 320.*TMath::DegToRad();
180   fNeutralPtCut   = 0.5 ;
181   fChargedPtCut   = 0.5 ;
182
183   fEMCALMinAngle    =   2.5 * TMath::DegToRad() ;  
184   fPHOSMinAngle    = 0.45 * TMath::DegToRad() ; //3.6 ;
185   fEMCALIPDistance    = 450. ;//cm  
186   fPHOSIPDistance    = 445. ;//cm 460 (EMCA) - 15 (CPV)
187
188   //pid, only for ESD data
189   fEMCALPID = kFALSE;
190   fPHOSPID = kFALSE;
191
192   fEMCALPhotonWeight = 0.8 ;
193   fEMCALPi0Weight = 0.5 ;
194   fEMCALElectronWeight = 0.8 ;
195   fEMCALChargeWeight = 0.5 ;
196   fEMCALNeutralWeight = 0.5 ;
197
198   fPHOSPhotonWeight = 0.75 ;
199   fPHOSPi0Weight = 0.8 ;
200   fPHOSElectronWeight = 0.5 ;
201   fPHOSChargeWeight = 0.5 ;
202   fPHOSNeutralWeight = 0.5 ;
203
204   //Formula to set the PID weight threshold for photon or pi0
205   fPHOSWeightFormula = kTRUE;
206   fPHOSPhotonWeightFormula = 
207     new TFormula("photonWeight","0.98*(x<40)+ 0.68*(x>=100)+(x>=40 && x<100)*(0.98+x*(6e-3)-x*x*(2e-04)+x*x*x*(1.1e-06))");
208   fPHOSPi0WeightFormula = 
209     new TFormula("pi0Weight","0.98*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))");
210
211 }
212
213
214 //________________________________________________________________
215 void AliGammaReader::Print(const Option_t * opt) const
216 {
217
218   //Print some relevant parameters set for the analysis
219   if(! opt)
220     return;
221
222   Info("Print", "%s %s", GetName(), GetTitle() ) ;
223   printf("Data type           : %d\n", fDataType) ;
224
225   printf(" EMCAL on?          : %d\n", fSwitchOnEMCAL) ;
226   printf(" PHOS on?          : %d\n", fSwitchOnPHOS) ;
227   printf(" CTS on?          : %d\n", fSwitchOnCTS) ;
228
229   printf("CTS Eta cut           : %f\n", fCTSEtaCut) ;
230   printf("EMCAL Eta cut           : %f\n", fEMCALEtaCut) ;
231   printf("PHOS Eta cut           : %f\n", fPHOSEtaCut) ;
232   printf("Phi EMCAL cut           : [%f, %f]\n", fPhiEMCALCut[0],fPhiEMCALCut[1]) ;
233   printf("Phi PHOS cut           : [%f, %f]\n", fPhiPHOSCut[0],fPhiPHOSCut[1]) ;
234   printf("pT neutral cut           : %f GeV/c\n", fNeutralPtCut) ;
235   printf("pT charged cut           : %f GeV/c\n", fChargedPtCut) ;
236
237   if(fDataType == kMC || fDataType == kMCData){
238     printf("IP distance to PHOS         : %f\n", fPHOSIPDistance) ;
239     printf("IP distance to EMCAL         : %f\n", fEMCALIPDistance) ;
240     printf("Min gamma decay aperture angle in PHOS         : %f\n", fPHOSMinAngle) ;
241     printf("Min gamma decay aperture angle in EMCAL         : %f\n", fEMCALMinAngle) ;
242   }
243   
244   if(fDataType != kMC){
245     printf("PHOS PID on?               =     %d\n",  fPHOSPID) ; 
246     printf("EMCAL PID  on?         =     %d\n",  fEMCALPID) ;
247     printf("PHOS PID weight , photon %f, pi0 %f, e %f, charge %f, neutral %f \n",  
248            fPHOSPhotonWeight,  fPHOSPi0Weight, 
249            fPHOSElectronWeight,  fPHOSChargeWeight,   fPHOSNeutralWeight) ; 
250     printf("EMCAL PID weight, photon %f, pi0 %f, e %f, charge %f, neutral %f\n",   
251            fEMCALPhotonWeight,  fEMCALPi0Weight, 
252            fEMCALElectronWeight,  fEMCALChargeWeight,  fEMCALNeutralWeight) ; 
253     
254     printf("PHOS Parametrized weight on?               =     %d\n",  fPHOSWeightFormula) ; 
255     if(fPHOSWeightFormula){
256       printf(">>>>>>>>>>> Photon weight formula<<<<<<<<<<<<\n");
257       fPHOSPhotonWeightFormula->Print();
258       printf(">>>>>>>>>>> Pi0    weight formula<<<<<<<<<<<<\n");
259       fPHOSPhotonWeightFormula->Print();
260     }
261   }
262
263
264
265