]>
Commit | Line | Data |
---|---|---|
6ad0bfa0 | 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 | ||
b2a60966 | 16 | /* $Id$ */ |
17 | ||
702ab87e | 18 | /* History of cvs commits: |
19 | * | |
20 | * $Log$ | |
21 | */ | |
22 | ||
6ad0bfa0 | 23 | //_________________________________________________________________________ |
b2a60966 | 24 | // Implementation version v1 of the PHOS particle identifier |
7acf6008 | 25 | // Particle identification based on the |
148b2bba | 26 | // - RCPV: distance from CPV recpoint to EMCA recpoint. |
27 | // - TOF | |
28 | // - PCA: Principal Components Analysis.. | |
29 | // The identified particle has an identification number corresponding | |
30 | // to a 9 bits number: | |
bc0c084c | 31 | // -Bit 0 to 2: bit set if RCPV > CpvEmcDistance (each bit corresponds |
148b2bba | 32 | // to a different efficiency-purity point of the photon identification) |
bc0c084c | 33 | // -Bit 3 to 5: bit set if TOF < TimeGate (each bit corresponds |
148b2bba | 34 | // to a different efficiency-purity point of the photon identification) |
35 | // -Bit 6 to 9: bit set if Principal Components are | |
50739f15 | 36 | // inside an ellipse defined by the parameters a, b, c, x0 and y0. |
148b2bba | 37 | // (each bit corresponds to a different efficiency-purity point of the |
50739f15 | 38 | // photon identification) |
39 | // The PCA (Principal components analysis) needs a file that contains | |
40 | // a previous analysis of the correlations between the particles. This | |
bc0c084c | 41 | // file is $ALICE_ROOT/PHOS/PCA8pa15_0.5-100.root. Analysis done for |
50739f15 | 42 | // energies between 0.5 and 100 GeV. |
9fa5f1d0 | 43 | // A calibrated energy is calculated. The energy of the reconstructed |
50739f15 | 44 | // cluster is corrected with the formula A + B * E + C * E^2, whose |
bc0c084c | 45 | // parameters where obtained through the study of the reconstructed |
50739f15 | 46 | // energy distribution of monoenergetic photons. |
a4e98857 | 47 | // |
bc0c084c | 48 | // All the parameters (RCPV(2 rows-3 columns),TOF(1r-3c),PCA(5r-4c) |
50739f15 | 49 | // and calibration(1r-3c))are stored in a file called |
50 | // $ALICE_ROOT/PHOS/Parameters.dat. Each time that AliPHOSPIDv1 is | |
bc0c084c | 51 | // initialized, this parameters are copied to a Matrix (9,4), a |
50739f15 | 52 | // TMatrixD object. |
7acf6008 | 53 | // |
a4e98857 | 54 | // use case: |
50739f15 | 55 | // root [0] AliPHOSPIDv1 * p = new AliPHOSPIDv1("galice1.root") |
a4e98857 | 56 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated |
50739f15 | 57 | // // reading headers from file galice1.root and create RecParticles |
58 | // TrackSegments and RecPoints are used | |
59 | // // set file name for the branch RecParticles | |
f0a4c9e9 | 60 | // root [1] p->ExecuteTask("deb all time") |
50739f15 | 61 | // // available options |
62 | // // "deb" - prints # of reconstructed particles | |
63 | // // "deb all" - prints # and list of RecParticles | |
64 | // // "time" - prints benchmarking results | |
7acf6008 | 65 | // |
50739f15 | 66 | // root [2] AliPHOSPIDv1 * p2 = new AliPHOSPIDv1("galice1.root","v1",kTRUE) |
148b2bba | 67 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated |
50739f15 | 68 | // //Split mode. |
f0a4c9e9 | 69 | // root [3] p2->ExecuteTask() |
70 | // | |
50739f15 | 71 | |
f0a4c9e9 | 72 | |
7acf6008 | 73 | //*-- Author: Yves Schutz (SUBATECH) & Gines Martinez (SUBATECH) & |
148b2bba | 74 | // Gustavo Conesa April 2002 |
50739f15 | 75 | // PCA redesigned by Gustavo Conesa October 2002: |
76 | // The way of using the PCA has changed. Instead of 2 | |
77 | // files with the PCA, each one with different energy ranges | |
78 | // of application, we use the wide one (0.5-100 GeV), and instead | |
bc0c084c | 79 | // of fixing 3 ellipses for different ranges of energy, it has been |
50739f15 | 80 | // studied the dependency of the ellipses parameters with the |
81 | // energy, and they are implemented in the code as a funtion | |
82 | // of the energy. | |
83 | // | |
84 | // | |
85 | // | |
6ad0bfa0 | 86 | // --- ROOT system --- |
c947e71a | 87 | |
88 | ||
89 | // --- Standard library --- | |
acb5beb7 | 90 | #include "TFormula.h" |
7acf6008 | 91 | #include "TBenchmark.h" |
148b2bba | 92 | #include "TPrincipal.h" |
c947e71a | 93 | #include "TFile.h" |
e3817e5f | 94 | #include "TSystem.h" |
148b2bba | 95 | |
6ad0bfa0 | 96 | // --- AliRoot header files --- |
c947e71a | 97 | //#include "AliLog.h" |
7acf6008 | 98 | #include "AliGenerator.h" |
e3817e5f | 99 | #include "AliPHOS.h" |
26d4b141 | 100 | #include "AliPHOSPIDv1.h" |
7b7c1533 | 101 | #include "AliPHOSGetter.h" |
6ad0bfa0 | 102 | |
26d4b141 | 103 | ClassImp( AliPHOSPIDv1) |
6ad0bfa0 | 104 | |
1cb7c1ee | 105 | //____________________________________________________________________________ |
106 | AliPHOSPIDv1::AliPHOSPIDv1():AliPHOSPID() | |
107 | { | |
a4e98857 | 108 | // default ctor |
148b2bba | 109 | |
8d0f3f77 | 110 | InitParameters() ; |
92f521a9 | 111 | fDefaultInit = kTRUE ; |
7acf6008 | 112 | } |
113 | ||
581354c5 | 114 | //____________________________________________________________________________ |
88cb7938 | 115 | AliPHOSPIDv1::AliPHOSPIDv1(const AliPHOSPIDv1 & pid ):AliPHOSPID(pid) |
581354c5 | 116 | { |
386aef34 | 117 | // ctor |
581354c5 | 118 | InitParameters() ; |
581354c5 | 119 | Init() ; |
581354c5 | 120 | |
121 | } | |
122 | ||
7acf6008 | 123 | //____________________________________________________________________________ |
88cb7938 | 124 | AliPHOSPIDv1::AliPHOSPIDv1(const TString alirunFileName, const TString eventFolderName):AliPHOSPID(alirunFileName, eventFolderName) |
7acf6008 | 125 | { |
a4e98857 | 126 | //ctor with the indication on where to look for the track segments |
7b7c1533 | 127 | |
8d0f3f77 | 128 | InitParameters() ; |
2bd5457f | 129 | Init() ; |
92f521a9 | 130 | fDefaultInit = kFALSE ; |
7acf6008 | 131 | } |
7b7c1533 | 132 | |
7acf6008 | 133 | //____________________________________________________________________________ |
134 | AliPHOSPIDv1::~AliPHOSPIDv1() | |
135 | { | |
79bb1b62 | 136 | // dtor |
acb5beb7 | 137 | fPrincipalPhoton = 0; |
138 | fPrincipalPi0 = 0; | |
9fa5f1d0 | 139 | |
e3817e5f | 140 | delete [] fX ; // Principal input |
141 | delete [] fPPhoton ; // Photon Principal components | |
142 | delete [] fPPi0 ; // Pi0 Principal components | |
acb5beb7 | 143 | |
144 | delete fParameters; | |
145 | delete fTFphoton; | |
146 | delete fTFpiong; | |
147 | delete fTFkaong; | |
148 | delete fTFkaonl; | |
149 | delete fTFhhadrong; | |
150 | delete fTFhhadronl; | |
151 | delete fDFmuon; | |
7acf6008 | 152 | } |
a496c46c | 153 | //____________________________________________________________________________ |
154 | const TString AliPHOSPIDv1::BranchName() const | |
155 | { | |
88cb7938 | 156 | |
157 | return GetName() ; | |
a496c46c | 158 | } |
159 | ||
148b2bba | 160 | //____________________________________________________________________________ |
161 | void AliPHOSPIDv1::Init() | |
162 | { | |
163 | // Make all memory allocations that are not possible in default constructor | |
164 | // Add the PID task to the list of PHOS tasks | |
a496c46c | 165 | |
adcca1e6 | 166 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
167 | if(!gime) | |
168 | gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName.Data()) ; | |
88cb7938 | 169 | |
170 | if ( !gime->PID() ) | |
171 | gime->PostPID(this) ; | |
148b2bba | 172 | } |
8d0f3f77 | 173 | |
174 | //____________________________________________________________________________ | |
175 | void AliPHOSPIDv1::InitParameters() | |
176 | { | |
e3817e5f | 177 | // Initialize PID parameters |
adcca1e6 | 178 | fWrite = kTRUE ; |
8d0f3f77 | 179 | fRecParticlesInRun = 0 ; |
8d0f3f77 | 180 | fNEvent = 0 ; |
8d0f3f77 | 181 | fRecParticlesInRun = 0 ; |
35adb638 | 182 | fBayesian = kTRUE ; |
9fa5f1d0 | 183 | SetParameters() ; // fill the parameters matrix from parameters file |
eabde521 | 184 | SetEventRange(0,-1) ; |
35adb638 | 185 | |
cc1fe362 | 186 | // initialisation of response function parameters |
187 | // Tof | |
2924941c | 188 | |
189 | // // Photons | |
190 | // fTphoton[0] = 0.218 ; | |
191 | // fTphoton[1] = 1.55E-8 ; | |
192 | // fTphoton[2] = 5.05E-10 ; | |
193 | // fTFphoton = new TFormula("ToF response to photons" , "gaus") ; | |
194 | // fTFphoton->SetParameters( fTphoton[0], fTphoton[1], fTphoton[2]) ; | |
195 | ||
196 | // // Pions | |
197 | // //Gaus (0 to max probability) | |
198 | // fTpiong[0] = 0.0971 ; | |
199 | // fTpiong[1] = 1.58E-8 ; | |
200 | // fTpiong[2] = 5.69E-10 ; | |
201 | // fTFpiong = new TFormula("ToF response to pions" , "gaus") ; | |
202 | // fTFpiong->SetParameters( fTpiong[0], fTpiong[1], fTpiong[2]) ; | |
203 | ||
204 | // // Kaons | |
205 | // //Gaus (0 to max probability) | |
206 | // fTkaong[0] = 0.0542 ; | |
207 | // fTkaong[1] = 1.64E-8 ; | |
208 | // fTkaong[2] = 6.07E-10 ; | |
209 | // fTFkaong = new TFormula("ToF response to kaon" , "gaus") ; | |
210 | // fTFkaong->SetParameters( fTkaong[0], fTkaong[1], fTkaong[2]) ; | |
211 | // //Landau (max probability to inf) | |
212 | // fTkaonl[0] = 0.264 ; | |
213 | // fTkaonl[1] = 1.68E-8 ; | |
214 | // fTkaonl[2] = 4.10E-10 ; | |
215 | // fTFkaonl = new TFormula("ToF response to kaon" , "landau") ; | |
216 | // fTFkaonl->SetParameters( fTkaonl[0], fTkaonl[1], fTkaonl[2]) ; | |
217 | ||
218 | // //Heavy Hadrons | |
219 | // //Gaus (0 to max probability) | |
220 | // fThhadrong[0] = 0.0302 ; | |
221 | // fThhadrong[1] = 1.73E-8 ; | |
222 | // fThhadrong[2] = 9.52E-10 ; | |
223 | // fTFhhadrong = new TFormula("ToF response to heavy hadrons" , "gaus") ; | |
224 | // fTFhhadrong->SetParameters( fThhadrong[0], fThhadrong[1], fThhadrong[2]) ; | |
225 | // //Landau (max probability to inf) | |
226 | // fThhadronl[0] = 0.139 ; | |
227 | // fThhadronl[1] = 1.745E-8 ; | |
228 | // fThhadronl[2] = 1.00E-9 ; | |
229 | // fTFhhadronl = new TFormula("ToF response to heavy hadrons" , "landau") ; | |
230 | // fTFhhadronl->SetParameters( fThhadronl[0], fThhadronl[1], fThhadronl[2]) ; | |
231 | ||
cc1fe362 | 232 | // Photons |
2924941c | 233 | fTphoton[0] = 7.83E8 ; |
35adb638 | 234 | fTphoton[1] = 1.55E-8 ; |
2924941c | 235 | fTphoton[2] = 5.09E-10 ; |
35adb638 | 236 | fTFphoton = new TFormula("ToF response to photons" , "gaus") ; |
cc1fe362 | 237 | fTFphoton->SetParameters( fTphoton[0], fTphoton[1], fTphoton[2]) ; |
35adb638 | 238 | |
239 | // Pions | |
240 | //Gaus (0 to max probability) | |
2924941c | 241 | fTpiong[0] = 6.73E8 ; |
35adb638 | 242 | fTpiong[1] = 1.58E-8 ; |
2924941c | 243 | fTpiong[2] = 5.87E-10 ; |
35adb638 | 244 | fTFpiong = new TFormula("ToF response to pions" , "gaus") ; |
245 | fTFpiong->SetParameters( fTpiong[0], fTpiong[1], fTpiong[2]) ; | |
35adb638 | 246 | |
247 | // Kaons | |
248 | //Gaus (0 to max probability) | |
2924941c | 249 | fTkaong[0] = 3.93E8 ; |
35adb638 | 250 | fTkaong[1] = 1.64E-8 ; |
2924941c | 251 | fTkaong[2] = 6.07E-10 ; |
35adb638 | 252 | fTFkaong = new TFormula("ToF response to kaon" , "gaus") ; |
253 | fTFkaong->SetParameters( fTkaong[0], fTkaong[1], fTkaong[2]) ; | |
254 | //Landau (max probability to inf) | |
2924941c | 255 | fTkaonl[0] = 2.0E9 ; |
35adb638 | 256 | fTkaonl[1] = 1.68E-8 ; |
257 | fTkaonl[2] = 4.10E-10 ; | |
258 | fTFkaonl = new TFormula("ToF response to kaon" , "landau") ; | |
259 | fTFkaonl->SetParameters( fTkaonl[0], fTkaonl[1], fTkaonl[2]) ; | |
260 | ||
261 | //Heavy Hadrons | |
262 | //Gaus (0 to max probability) | |
2924941c | 263 | fThhadrong[0] = 2.02E8 ; |
35adb638 | 264 | fThhadrong[1] = 1.73E-8 ; |
265 | fThhadrong[2] = 9.52E-10 ; | |
266 | fTFhhadrong = new TFormula("ToF response to heavy hadrons" , "gaus") ; | |
267 | fTFhhadrong->SetParameters( fThhadrong[0], fThhadrong[1], fThhadrong[2]) ; | |
268 | //Landau (max probability to inf) | |
2924941c | 269 | fThhadronl[0] = 1.10E9 ; |
270 | fThhadronl[1] = 1.74E-8 ; | |
271 | fThhadronl[2] = 1.00E-9 ; | |
35adb638 | 272 | fTFhhadronl = new TFormula("ToF response to heavy hadrons" , "landau") ; |
273 | fTFhhadronl->SetParameters( fThhadronl[0], fThhadronl[1], fThhadronl[2]) ; | |
274 | ||
35adb638 | 275 | |
276 | ||
277 | // Shower shape: dispersion gaussian parameters | |
278 | // Photons | |
2924941c | 279 | |
280 | // fDphoton[0] = 4.62e-2; fDphoton[1] = 1.39e-2 ; fDphoton[2] = -3.80e-2;//constant | |
281 | // fDphoton[3] = 1.53 ; fDphoton[4] =-6.62e-2 ; fDphoton[5] = 0.339 ;//mean | |
282 | // fDphoton[6] = 6.89e-2; fDphoton[7] =-6.59e-2 ; fDphoton[8] = 0.194 ;//sigma | |
283 | ||
284 | // fDpi0[0] = 0.0586 ; fDpi0[1] = 1.06E-3 ; fDpi0[2] = 0. ;//constant | |
285 | // fDpi0[3] = 2.67 ; fDpi0[4] =-2.00E-2 ; fDpi0[5] = 9.37E-5 ;//mean | |
286 | // fDpi0[6] = 0.153 ; fDpi0[7] = 9.34E-4 ; fDpi0[8] =-1.49E-5 ;//sigma | |
287 | ||
288 | // fDhadron[0] = 1.61E-2 ; fDhadron[1] = 3.03E-3 ; fDhadron[2] = 1.01E-2 ;//constant | |
289 | // fDhadron[3] = 3.81 ; fDhadron[4] = 0.232 ; fDhadron[5] =-1.25 ;//mean | |
290 | // fDhadron[6] = 0.897 ; fDhadron[7] = 0.0987 ; fDhadron[8] =-0.534 ;//sigma | |
291 | ||
292 | fDphoton[0] = 1.5 ; fDphoton[1] = 0.49 ; fDphoton[2] =-1.7E-2 ;//constant | |
293 | fDphoton[3] = 1.5 ; fDphoton[4] = 4.0E-2 ; fDphoton[5] = 0.21 ;//mean | |
294 | fDphoton[6] = 4.8E-2 ; fDphoton[7] =-0.12 ; fDphoton[8] = 0.27 ;//sigma | |
295 | fDphoton[9] = 16.; //for E> fDphoton[9] parameters calculated at fDphoton[9] | |
296 | ||
297 | fDpi0[0] = 0.25 ; fDpi0[1] = 3.3E-2 ; fDpi0[2] =-1.0e-5 ;//constant | |
298 | fDpi0[3] = 1.50 ; fDpi0[4] = 398. ; fDpi0[5] = 12. ;//mean | |
299 | fDpi0[6] =-7.0E-2 ; fDpi0[7] =-524. ; fDpi0[8] = 22. ;//sigma | |
300 | fDpi0[9] = 110.; //for E> fDpi0[9] parameters calculated at fDpi0[9] | |
301 | ||
302 | fDhadron[0] = 6.5 ; fDhadron[1] =-5.3 ; fDhadron[2] = 1.5 ;//constant | |
303 | fDhadron[3] = 3.8 ; fDhadron[4] = 0.23 ; fDhadron[5] =-1.2 ;//mean | |
304 | fDhadron[6] = 0.88 ; fDhadron[7] = 9.3E-2 ; fDhadron[8] =-0.51 ;//sigma | |
305 | fDhadron[9] = 2.; //for E> fDhadron[9] parameters calculated at fDhadron[9] | |
306 | ||
307 | fDmuon[0] = 0.0631 ; | |
308 | fDmuon[1] = 1.4 ; | |
35adb638 | 309 | fDmuon[2] = 0.0557 ; |
310 | fDFmuon = new TFormula("Shower shape response to muons" , "landau") ; | |
311 | fDFmuon->SetParameters( fDmuon[0], fDmuon[1], fDmuon[2]) ; | |
312 | ||
35adb638 | 313 | |
c947e71a | 314 | // x(CPV-EMC) distance gaussian parameters |
315 | ||
2924941c | 316 | // fXelectron[0] = 8.06e-2 ; fXelectron[1] = 1.00e-2; fXelectron[2] =-5.14e-2;//constant |
317 | // fXelectron[3] = 0.202 ; fXelectron[4] = 8.15e-3; fXelectron[5] = 4.55 ;//mean | |
318 | // fXelectron[6] = 0.334 ; fXelectron[7] = 0.186 ; fXelectron[8] = 4.32e-2;//sigma | |
c947e71a | 319 | |
2924941c | 320 | // //charged hadrons gaus |
321 | // fXcharged[0] = 6.43e-3 ; fXcharged[1] =-4.19e-5; fXcharged[2] = 1.42e-3;//constant | |
322 | // fXcharged[3] = 2.75 ; fXcharged[4] =-0.40 ; fXcharged[5] = 1.68 ;//mean | |
323 | // fXcharged[6] = 3.135 ; fXcharged[7] =-9.41e-2; fXcharged[8] = 1.31e-2;//sigma | |
c947e71a | 324 | |
2924941c | 325 | // // z(CPV-EMC) distance gaussian parameters |
326 | ||
327 | // fZelectron[0] = 8.22e-2 ; fZelectron[1] = 5.11e-3; fZelectron[2] =-3.05e-2;//constant | |
328 | // fZelectron[3] = 3.09e-2 ; fZelectron[4] = 5.87e-2; fZelectron[5] =-9.49e-2;//mean | |
329 | // fZelectron[6] = 0.263 ; fZelectron[7] =-9.02e-3; fZelectron[8] = 0.151 ;//sigma | |
c947e71a | 330 | |
2924941c | 331 | // //charged hadrons gaus |
c947e71a | 332 | |
2924941c | 333 | // fZcharged[0] = 1.00e-2 ; fZcharged[1] = 2.82E-4 ; fZcharged[2] = 2.87E-3 ;//constant |
334 | // fZcharged[3] =-4.68e-2 ; fZcharged[4] =-9.21e-3 ; fZcharged[5] = 4.91e-2 ;//mean | |
335 | // fZcharged[6] = 1.425 ; fZcharged[7] =-5.90e-2 ; fZcharged[8] = 5.07e-2 ;//sigma | |
336 | ||
337 | ||
338 | fXelectron[0] =-1.6E-2 ; fXelectron[1] = 0.77 ; fXelectron[2] =-0.15 ;//constant | |
339 | fXelectron[3] = 0.35 ; fXelectron[4] = 0.25 ; fXelectron[5] = 4.12 ;//mean | |
340 | fXelectron[6] = 0.30 ; fXelectron[7] = 0.11 ; fXelectron[8] = 0.16 ;//sigma | |
341 | fXelectron[9] = 3.; //for E> fXelectron[9] parameters calculated at fXelectron[9] | |
342 | ||
c947e71a | 343 | //charged hadrons gaus |
2924941c | 344 | fXcharged[0] = 0.14 ; fXcharged[1] =-3.0E-2 ; fXcharged[2] = 0 ;//constant |
345 | fXcharged[3] = 1.4 ; fXcharged[4] =-9.3E-2 ; fXcharged[5] = 1.4 ;//mean | |
346 | fXcharged[6] = 5.7 ; fXcharged[7] = 0.27 ; fXcharged[8] =-1.8 ;//sigma | |
347 | fXcharged[9] = 1.2; //for E> fXcharged[9] parameters calculated at fXcharged[9] | |
348 | ||
349 | // z(CPV-EMC) distance gaussian parameters | |
c947e71a | 350 | |
2924941c | 351 | fZelectron[0] = 0.49 ; fZelectron[1] = 0.53 ; fZelectron[2] =-9.8E-2 ;//constant |
352 | fZelectron[3] = 2.8E-2 ; fZelectron[4] = 5.0E-2 ; fZelectron[5] =-8.2E-2 ;//mean | |
353 | fZelectron[6] = 0.25 ; fZelectron[7] =-1.7E-2 ; fZelectron[8] = 0.17 ;//sigma | |
354 | fZelectron[9] = 3.; //for E> fZelectron[9] parameters calculated at fZelectron[9] | |
355 | ||
356 | //charged hadrons gaus | |
c947e71a | 357 | |
2924941c | 358 | fZcharged[0] = 0.46 ; fZcharged[1] =-0.65 ; fZcharged[2] = 0.52 ;//constant |
359 | fZcharged[3] = 1.1E-2 ; fZcharged[4] = 0. ; fZcharged[5] = 0. ;//mean | |
360 | fZcharged[6] = 0.60 ; fZcharged[7] =-8.2E-2 ; fZcharged[8] = 0.45 ;//sigma | |
361 | fZcharged[9] = 1.2; //for E> fXcharged[9] parameters calculated at fXcharged[9] | |
362 | ||
fb7b51ad | 363 | //Threshold to differentiate between charged and neutral |
364 | fChargedNeutralThreshold = 1e-5; | |
2924941c | 365 | fTOFEnThreshold = 2; //Maximum energy to use TOF |
366 | fDispEnThreshold = 0.5; //Minimum energy to use shower shape | |
367 | fDispMultThreshold = 3; //Minimum multiplicity to use shower shape | |
fb7b51ad | 368 | |
369 | //Weight to hadrons recontructed energy | |
370 | ||
371 | fERecWeightPar[0] = 0.32 ; | |
372 | fERecWeightPar[1] = 3.8 ; | |
373 | fERecWeightPar[2] = 5.4E-3 ; | |
374 | fERecWeightPar[3] = 5.6E-2 ; | |
375 | fERecWeight = new TFormula("Weight for hadrons" , "[0]*exp(-x*[1])+[2]*exp(-x*[3])") ; | |
376 | fERecWeight ->SetParameters(fERecWeightPar[0],fERecWeightPar[1] ,fERecWeightPar[2] ,fERecWeightPar[3]) ; | |
377 | ||
378 | ||
304864ab | 379 | for (Int_t i =0; i< AliPID::kSPECIESN ; i++) |
35adb638 | 380 | fInitPID[i] = 1.; |
fb7b51ad | 381 | |
8d0f3f77 | 382 | } |
383 | ||
88cb7938 | 384 | //________________________________________________________________________ |
eabde521 | 385 | void AliPHOSPIDv1::Exec(Option_t *option) |
88cb7938 | 386 | { |
eabde521 | 387 | // Steering method to perform particle reconstruction and identification |
388 | // for the event range from fFirstEvent to fLastEvent. | |
389 | // This range is optionally set by SetEventRange(). | |
390 | // if fLastEvent=-1 (by default), then process events until the end. | |
61d3d6aa | 391 | |
88cb7938 | 392 | if(strstr(option,"tim")) |
393 | gBenchmark->Start("PHOSPID"); | |
394 | ||
395 | if(strstr(option,"print")) { | |
396 | Print() ; | |
397 | return ; | |
398 | } | |
399 | ||
400 | ||
adcca1e6 | 401 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
88cb7938 | 402 | |
71cee46d | 403 | if (fLastEvent == -1) |
404 | fLastEvent = gime->MaxEvent() - 1 ; | |
405 | else | |
406 | fLastEvent = TMath::Min(fLastEvent,gime->MaxEvent()); | |
eabde521 | 407 | Int_t nEvents = fLastEvent - fFirstEvent + 1; |
88cb7938 | 408 | |
71cee46d | 409 | Int_t ievent ; |
410 | for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) { | |
88cb7938 | 411 | gime->Event(ievent,"TR") ; |
412 | if(gime->TrackSegments() && //Skip events, where no track segments made | |
413 | gime->TrackSegments()->GetEntriesFast()) { | |
7fb46731 | 414 | |
88cb7938 | 415 | MakeRecParticles() ; |
35adb638 | 416 | |
417 | if(fBayesian) | |
418 | MakePID() ; | |
419 | ||
90cceaf6 | 420 | WriteRecParticles(); |
88cb7938 | 421 | if(strstr(option,"deb")) |
422 | PrintRecParticles(option) ; | |
423 | //increment the total number of rec particles per run | |
424 | fRecParticlesInRun += gime->RecParticles()->GetEntriesFast() ; | |
425 | } | |
426 | } | |
ff417097 | 427 | if(strstr(option,"deb")) |
428 | PrintRecParticles(option); | |
88cb7938 | 429 | if(strstr(option,"tim")){ |
430 | gBenchmark->Stop("PHOSPID"); | |
351dd634 | 431 | AliInfo(Form("took %f seconds for PID %f seconds per event", |
88cb7938 | 432 | gBenchmark->GetCpuTime("PHOSPID"), |
351dd634 | 433 | gBenchmark->GetCpuTime("PHOSPID")/nEvents)) ; |
88cb7938 | 434 | } |
adcca1e6 | 435 | if(fWrite) |
436 | Unload(); | |
88cb7938 | 437 | } |
438 | ||
35adb638 | 439 | //________________________________________________________________________ |
17323043 | 440 | Double_t AliPHOSPIDv1::GausF(Double_t x, Double_t y, Double_t * par) |
35adb638 | 441 | { |
c947e71a | 442 | //Given the energy x and the parameter y (tof, shower dispersion or cpv-emc distance), |
443 | //this method returns a density probability of this parameter, given by a gaussian | |
444 | //function whose parameters depend with the energy with a function: a/(x*x)+b/x+b | |
2924941c | 445 | //Float_t xorg = x; |
446 | if (x > par[9]) x = par[9]; | |
447 | ||
448 | //Double_t cnt = par[1] / (x*x) + par[2] / x + par[0] ; | |
449 | Double_t cnt = par[0] + par[1] * x + par[2] * x * x ; | |
35adb638 | 450 | Double_t mean = par[4] / (x*x) + par[5] / x + par[3] ; |
451 | Double_t sigma = par[7] / (x*x) + par[8] / x + par[6] ; | |
c947e71a | 452 | |
2924941c | 453 | // if(xorg > 30) |
454 | // cout<<"En_in = "<<xorg<<"; En_out = "<<x<<"; cnt = "<<cnt | |
455 | // <<"; mean = "<<mean<<"; sigma = "<<sigma<<endl; | |
456 | ||
35adb638 | 457 | // Double_t arg = - (y-mean) * (y-mean) / (2*sigma*sigma) ; |
458 | // return cnt * TMath::Exp(arg) ; | |
c947e71a | 459 | if(TMath::Abs(sigma) > 1.e-10){ |
acb5beb7 | 460 | return cnt*TMath::Gaus(y,mean,sigma); |
35adb638 | 461 | } |
462 | else | |
463 | return 0.; | |
c947e71a | 464 | |
35adb638 | 465 | } |
466 | //________________________________________________________________________ | |
17323043 | 467 | Double_t AliPHOSPIDv1::GausPol2(Double_t x, Double_t y, Double_t * par) |
35adb638 | 468 | { |
c947e71a | 469 | //Given the energy x and the parameter y (tof, shower dispersion or cpv-emc distance), |
470 | //this method returns a density probability of this parameter, given by a gaussian | |
471 | //function whose parameters depend with the energy like second order polinomial | |
472 | ||
35adb638 | 473 | Double_t cnt = par[0] + par[1] * x + par[2] * x * x ; |
474 | Double_t mean = par[3] + par[4] * x + par[5] * x * x ; | |
475 | Double_t sigma = par[6] + par[7] * x + par[8] * x * x ; | |
476 | ||
c947e71a | 477 | if(TMath::Abs(sigma) > 1.e-10){ |
acb5beb7 | 478 | return cnt*TMath::Gaus(y,mean,sigma); |
35adb638 | 479 | } |
480 | else | |
481 | return 0.; | |
c947e71a | 482 | |
483 | ||
484 | ||
35adb638 | 485 | } |
486 | ||
69183710 | 487 | //____________________________________________________________________________ |
e3817e5f | 488 | const TString AliPHOSPIDv1::GetFileNamePrincipal(TString particle) const |
148b2bba | 489 | { |
e3817e5f | 490 | //Get file name that contains the PCA for a particle ("photon or pi0") |
491 | particle.ToLower(); | |
492 | TString name; | |
351dd634 | 493 | if (particle=="photon") |
494 | name = fFileNamePrincipalPhoton ; | |
495 | else if (particle=="pi0" ) | |
496 | name = fFileNamePrincipalPi0 ; | |
497 | else | |
498 | AliError(Form("Wrong particle name: %s (choose from pi0/photon)\n", | |
499 | particle.Data())); | |
e3817e5f | 500 | return name; |
501 | } | |
bc0c084c | 502 | |
e3817e5f | 503 | //____________________________________________________________________________ |
fc7e2f43 | 504 | Float_t AliPHOSPIDv1::GetParameterCalibration(Int_t i) const |
e3817e5f | 505 | { |
506 | // Get the i-th parameter "Calibration" | |
507 | Float_t param = 0.; | |
351dd634 | 508 | if (i>2 || i<0) { |
509 | AliError(Form("Invalid parameter number: %d",i)); | |
510 | } else | |
e3817e5f | 511 | param = (*fParameters)(0,i); |
512 | return param; | |
513 | } | |
bc0c084c | 514 | |
88cb7938 | 515 | //____________________________________________________________________________ |
fc7e2f43 | 516 | Float_t AliPHOSPIDv1::GetCalibratedEnergy(Float_t e) const |
88cb7938 | 517 | { |
518 | // It calibrates Energy depending on the recpoint energy. | |
519 | // The energy of the reconstructed cluster is corrected with | |
520 | // the formula A + B* E + C* E^2, whose parameters where obtained | |
521 | // through the study of the reconstructed energy distribution of | |
522 | // monoenergetic photons. | |
523 | ||
524 | Float_t p[]={0.,0.,0.}; | |
525 | for (Int_t i=0; i<3; i++) p[i] = GetParameterCalibration(i); | |
526 | Float_t enerec = p[0] + p[1]*e + p[2]*e*e; | |
527 | return enerec ; | |
528 | ||
529 | } | |
530 | ||
e3817e5f | 531 | //____________________________________________________________________________ |
fc7e2f43 | 532 | Float_t AliPHOSPIDv1::GetParameterCpv2Emc(Int_t i, TString axis) const |
e3817e5f | 533 | { |
534 | // Get the i-th parameter "CPV-EMC distance" for the specified axis | |
535 | Float_t param = 0.; | |
351dd634 | 536 | if(i>2 || i<0) { |
537 | AliError(Form("Invalid parameter number: %d",i)); | |
538 | } else { | |
e3817e5f | 539 | axis.ToLower(); |
351dd634 | 540 | if (axis == "x") |
541 | param = (*fParameters)(1,i); | |
542 | else if (axis == "z") | |
543 | param = (*fParameters)(2,i); | |
544 | else { | |
545 | AliError(Form("Invalid axis name: %s",axis.Data())); | |
546 | } | |
e3817e5f | 547 | } |
548 | return param; | |
549 | } | |
550 | ||
551 | //____________________________________________________________________________ | |
fc7e2f43 | 552 | Float_t AliPHOSPIDv1::GetCpv2EmcDistanceCut(TString axis, Float_t e) const |
e3817e5f | 553 | { |
88cb7938 | 554 | // Get CpvtoEmcDistance Cut depending on the cluster energy, axis and |
555 | // Purity-Efficiency point | |
556 | ||
557 | axis.ToLower(); | |
558 | Float_t p[]={0.,0.,0.}; | |
559 | for (Int_t i=0; i<3; i++) p[i] = GetParameterCpv2Emc(i,axis); | |
560 | Float_t sig = p[0] + TMath::Exp(p[1] - p[2]*e); | |
561 | return sig; | |
e3817e5f | 562 | } |
563 | ||
88cb7938 | 564 | //____________________________________________________________________________ |
fc7e2f43 | 565 | Float_t AliPHOSPIDv1::GetEllipseParameter(TString particle, TString param, Float_t e) const |
88cb7938 | 566 | { |
567 | // Calculates the parameter param of the ellipse | |
e3817e5f | 568 | |
569 | particle.ToLower(); | |
570 | param. ToLower(); | |
88cb7938 | 571 | Float_t p[4]={0.,0.,0.,0.}; |
572 | Float_t value = 0.0; | |
573 | for (Int_t i=0; i<4; i++) p[i] = GetParameterToCalculateEllipse(particle,param,i); | |
574 | if (particle == "photon") { | |
575 | if (param.Contains("a")) e = TMath::Min((Double_t)e,70.); | |
576 | else if (param.Contains("b")) e = TMath::Min((Double_t)e,70.); | |
577 | else if (param.Contains("x0")) e = TMath::Max((Double_t)e,1.1); | |
578 | } | |
e3817e5f | 579 | |
443caba9 | 580 | if (particle == "photon") |
581 | value = p[0]/TMath::Sqrt(e) + p[1]*e + p[2]*e*e + p[3]; | |
582 | else if (particle == "pi0") | |
583 | value = p[0] + p[1]*e + p[2]*e*e; | |
584 | ||
88cb7938 | 585 | return value; |
e3817e5f | 586 | } |
587 | ||
588 | //_____________________________________________________________________________ | |
fc7e2f43 | 589 | Float_t AliPHOSPIDv1::GetParameterPhotonBoundary (Int_t i) const |
e3817e5f | 590 | { |
591 | // Get the parameter "i" to calculate the boundary on the moment M2x | |
592 | // for photons at high p_T | |
593 | Float_t param = 0; | |
351dd634 | 594 | if (i>3 || i<0) { |
595 | AliError(Form("Wrong parameter number: %d\n",i)); | |
596 | } else | |
e3817e5f | 597 | param = (*fParameters)(14,i) ; |
598 | return param; | |
148b2bba | 599 | } |
e3817e5f | 600 | |
148b2bba | 601 | //____________________________________________________________________________ |
fc7e2f43 | 602 | Float_t AliPHOSPIDv1::GetParameterPi0Boundary (Int_t i) const |
e3817e5f | 603 | { |
604 | // Get the parameter "i" to calculate the boundary on the moment M2x | |
605 | // for pi0 at high p_T | |
606 | Float_t param = 0; | |
351dd634 | 607 | if (i>2 || i<0) { |
608 | AliError(Form("Wrong parameter number: %d\n",i)); | |
609 | } else | |
e3817e5f | 610 | param = (*fParameters)(15,i) ; |
611 | return param; | |
612 | } | |
148b2bba | 613 | |
e3817e5f | 614 | //____________________________________________________________________________ |
fc7e2f43 | 615 | Float_t AliPHOSPIDv1::GetParameterTimeGate(Int_t i) const |
e3817e5f | 616 | { |
88cb7938 | 617 | // Get TimeGate parameter depending on Purity-Efficiency i: |
618 | // i=0 - Low purity, i=1 - Medium purity, i=2 - High purity | |
619 | Float_t param = 0.; | |
351dd634 | 620 | if(i>2 || i<0) { |
621 | AliError(Form("Invalid Efficiency-Purity choice %d",i)); | |
622 | } else | |
88cb7938 | 623 | param = (*fParameters)(3,i) ; |
624 | return param; | |
e3817e5f | 625 | } |
626 | ||
148b2bba | 627 | //_____________________________________________________________________________ |
fc7e2f43 | 628 | Float_t AliPHOSPIDv1::GetParameterToCalculateEllipse(TString particle, TString param, Int_t i) const |
88cb7938 | 629 | { |
630 | // Get the parameter "i" that is needed to calculate the ellipse | |
631 | // parameter "param" for the particle "particle" ("photon" or "pi0") | |
632 | ||
e3817e5f | 633 | particle.ToLower(); |
634 | param. ToLower(); | |
88cb7938 | 635 | Int_t offset = -1; |
351dd634 | 636 | if (particle == "photon") |
637 | offset=0; | |
638 | else if (particle == "pi0") | |
639 | offset=5; | |
e3817e5f | 640 | else |
351dd634 | 641 | AliError(Form("Wrong particle name: %s (choose from pi0/photon)\n", |
642 | particle.Data())); | |
88cb7938 | 643 | |
644 | Int_t p= -1; | |
645 | Float_t par = 0; | |
e3817e5f | 646 | |
647 | if (param.Contains("a")) p=4+offset; | |
648 | else if(param.Contains("b")) p=5+offset; | |
649 | else if(param.Contains("c")) p=6+offset; | |
650 | else if(param.Contains("x0"))p=7+offset; | |
651 | else if(param.Contains("y0"))p=8+offset; | |
12022e83 | 652 | |
351dd634 | 653 | if (i>4 || i<0) { |
654 | AliError(Form("No parameter with index %d", i)) ; | |
655 | } else if (p==-1) { | |
656 | AliError(Form("No parameter with name %s", param.Data() )) ; | |
657 | } else | |
88cb7938 | 658 | par = (*fParameters)(p,i) ; |
659 | ||
660 | return par; | |
12022e83 | 661 | } |
662 | ||
12022e83 | 663 | |
664 | //____________________________________________________________________________ | |
8d4608b5 | 665 | Float_t AliPHOSPIDv1::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSCpvRecPoint * cpv, Option_t * axis)const |
69183710 | 666 | { |
667 | // Calculates the distance between the EMC RecPoint and the PPSD RecPoint | |
148b2bba | 668 | |
88cb7938 | 669 | const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; |
69183710 | 670 | TVector3 vecEmc ; |
7acf6008 | 671 | TVector3 vecCpv ; |
148b2bba | 672 | if(cpv){ |
673 | emc->GetLocalPosition(vecEmc) ; | |
674 | cpv->GetLocalPosition(vecCpv) ; | |
2bb500e5 | 675 | |
148b2bba | 676 | if(emc->GetPHOSMod() == cpv->GetPHOSMod()){ |
677 | // Correct to difference in CPV and EMC position due to different distance to center. | |
678 | // we assume, that particle moves from center | |
679 | Float_t dCPV = geom->GetIPtoOuterCoverDistance(); | |
680 | Float_t dEMC = geom->GetIPtoCrystalSurface() ; | |
681 | dEMC = dEMC / dCPV ; | |
682 | vecCpv = dEMC * vecCpv - vecEmc ; | |
e3817e5f | 683 | if (axis == "X") return vecCpv.X(); |
684 | if (axis == "Y") return vecCpv.Y(); | |
685 | if (axis == "Z") return vecCpv.Z(); | |
686 | if (axis == "R") return vecCpv.Mag(); | |
687 | } | |
148b2bba | 688 | return 100000000 ; |
689 | } | |
7acf6008 | 690 | return 100000000 ; |
69183710 | 691 | } |
bc0c084c | 692 | //____________________________________________________________________________ |
8d4608b5 | 693 | Int_t AliPHOSPIDv1::GetCPVBit(AliPHOSEmcRecPoint * emc,AliPHOSCpvRecPoint * cpv, Int_t effPur, Float_t e) const |
bc0c084c | 694 | { |
c947e71a | 695 | //Calculates the pid bit for the CPV selection per each purity. |
e3817e5f | 696 | if(effPur>2 || effPur<0) |
351dd634 | 697 | AliError(Form("Invalid Efficiency-Purity choice %d",effPur)); |
bc0c084c | 698 | |
e3817e5f | 699 | Float_t sigX = GetCpv2EmcDistanceCut("X",e); |
700 | Float_t sigZ = GetCpv2EmcDistanceCut("Z",e); | |
bc0c084c | 701 | |
702 | Float_t deltaX = TMath::Abs(GetDistance(emc, cpv, "X")); | |
703 | Float_t deltaZ = TMath::Abs(GetDistance(emc, cpv, "Z")); | |
7fb46731 | 704 | //Info("GetCPVBit"," xdist %f, sigx %f, zdist %f, sigz %f",deltaX, sigX, deltaZ,sigZ) ; |
705 | ||
706 | //if(deltaX>sigX*(effPur+1)) | |
707 | //if((deltaX>sigX*(effPur+1)) || (deltaZ>sigZ*(effPur+1))) | |
708 | if((deltaX>sigX*(effPur+1)) && (deltaZ>sigZ*(effPur+1))) | |
bc0c084c | 709 | return 1;//Neutral |
710 | else | |
711 | return 0;//Charged | |
bc0c084c | 712 | } |
69183710 | 713 | |
6ad0bfa0 | 714 | //____________________________________________________________________________ |
fc7e2f43 | 715 | Int_t AliPHOSPIDv1::GetPrincipalBit(TString particle, const Double_t* p, Int_t effPur, Float_t e)const |
148b2bba | 716 | { |
50739f15 | 717 | //Is the particle inside de PCA ellipse? |
581354c5 | 718 | |
e3817e5f | 719 | particle.ToLower(); |
720 | Int_t prinbit = 0 ; | |
7fb46731 | 721 | Float_t a = GetEllipseParameter(particle,"a" , e); |
722 | Float_t b = GetEllipseParameter(particle,"b" , e); | |
723 | Float_t c = GetEllipseParameter(particle,"c" , e); | |
e3817e5f | 724 | Float_t x0 = GetEllipseParameter(particle,"x0", e); |
725 | Float_t y0 = GetEllipseParameter(particle,"y0", e); | |
726 | ||
727 | Float_t r = TMath::Power((p[0] - x0)/a,2) + | |
728 | TMath::Power((p[1] - y0)/b,2) + | |
729 | c*(p[0] - x0)*(p[1] - y0)/(a*b) ; | |
50739f15 | 730 | //3 different ellipses defined |
e3817e5f | 731 | if((effPur==2) && (r<1./2.)) prinbit= 1; |
732 | if((effPur==1) && (r<2. )) prinbit= 1; | |
733 | if((effPur==0) && (r<9./2.)) prinbit= 1; | |
50739f15 | 734 | |
581354c5 | 735 | if(r<0) |
351dd634 | 736 | AliError("Negative square?") ; |
1f0e7ccd | 737 | |
738 | return prinbit; | |
148b2bba | 739 | |
148b2bba | 740 | } |
1f0e7ccd | 741 | //____________________________________________________________________________ |
fc7e2f43 | 742 | Int_t AliPHOSPIDv1::GetHardPhotonBit(AliPHOSEmcRecPoint * emc) const |
1f0e7ccd | 743 | { |
e3817e5f | 744 | // Set bit for identified hard photons (E > 30 GeV) |
745 | // if the second moment M2x is below the boundary | |
746 | ||
747 | Float_t e = emc->GetEnergy(); | |
748 | if (e < 30.0) return 0; | |
749 | Float_t m2x = emc->GetM2x(); | |
750 | Float_t m2xBoundary = GetParameterPhotonBoundary(0) * | |
751 | TMath::Exp(-TMath::Power(e-GetParameterPhotonBoundary(1),2)/2.0/ | |
752 | TMath::Power(GetParameterPhotonBoundary(2),2)) + | |
753 | GetParameterPhotonBoundary(3); | |
351dd634 | 754 | AliDebug(1, Form("GetHardPhotonBit","E=%f, m2x=%f, boundary=%f", |
755 | e,m2x,m2xBoundary)); | |
e3817e5f | 756 | if (m2x < m2xBoundary) |
757 | return 1;// A hard photon | |
758 | else | |
759 | return 0;// Not a hard photon | |
1f0e7ccd | 760 | } |
92f521a9 | 761 | |
e3817e5f | 762 | //____________________________________________________________________________ |
fc7e2f43 | 763 | Int_t AliPHOSPIDv1::GetHardPi0Bit(AliPHOSEmcRecPoint * emc) const |
e3817e5f | 764 | { |
765 | // Set bit for identified hard pi0 (E > 30 GeV) | |
766 | // if the second moment M2x is above the boundary | |
767 | ||
768 | Float_t e = emc->GetEnergy(); | |
769 | if (e < 30.0) return 0; | |
770 | Float_t m2x = emc->GetM2x(); | |
771 | Float_t m2xBoundary = GetParameterPi0Boundary(0) + | |
772 | e * GetParameterPi0Boundary(1); | |
351dd634 | 773 | AliDebug(1,Form("E=%f, m2x=%f, boundary=%f",e,m2x,m2xBoundary)); |
e3817e5f | 774 | if (m2x > m2xBoundary) |
775 | return 1;// A hard pi0 | |
bc0c084c | 776 | else |
e3817e5f | 777 | return 0;// Not a hard pi0 |
f0a4c9e9 | 778 | } |
e3817e5f | 779 | |
780 | //____________________________________________________________________________ | |
8d4608b5 | 781 | TVector3 AliPHOSPIDv1::GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * )const |
88cb7938 | 782 | { |
783 | // Calculates the momentum direction: | |
784 | // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint | |
785 | // 2. if a EMC RecPoint and CPV RecPoint, direction is given by the line through the 2 recpoints | |
786 | // However because of the poor position resolution of PPSD the direction is always taken as if we were | |
787 | // in case 1. | |
f0a4c9e9 | 788 | |
88cb7938 | 789 | TVector3 dir(0,0,0) ; |
88cb7938 | 790 | TMatrix dummy ; |
bf8f1fbd | 791 | |
fb7b51ad | 792 | emc->GetGlobalPosition(dir, dummy) ; |
e3817e5f | 793 | |
88cb7938 | 794 | //account correction to the position of IP |
795 | Float_t xo,yo,zo ; //Coordinates of the origin | |
7fb46731 | 796 | if(gAlice && gAlice->GetMCApp() && gAlice->Generator()){ |
adcca1e6 | 797 | gAlice->Generator()->GetOrigin(xo,yo,zo) ; |
7fb46731 | 798 | } |
adcca1e6 | 799 | else{ |
800 | xo=yo=zo=0.; | |
801 | } | |
88cb7938 | 802 | TVector3 origin(xo,yo,zo); |
803 | dir = dir - origin ; | |
7fb46731 | 804 | dir.SetMag(1.) ; |
e3817e5f | 805 | |
88cb7938 | 806 | return dir ; |
7b7c1533 | 807 | } |
808 | ||
35adb638 | 809 | //________________________________________________________________________ |
17323043 | 810 | Double_t AliPHOSPIDv1::LandauF(Double_t x, Double_t y, Double_t * par) |
35adb638 | 811 | { |
c947e71a | 812 | //Given the energy x and the parameter y (tof, shower dispersion or cpv-emc distance), |
813 | //this method returns a density probability of this parameter, given by a landau | |
814 | //function whose parameters depend with the energy with a function: a/(x*x)+b/x+b | |
815 | ||
2924941c | 816 | if (x > par[9]) x = par[9]; |
817 | ||
818 | //Double_t cnt = par[1] / (x*x) + par[2] / x + par[0] ; | |
819 | Double_t cnt = par[0] + par[1] * x + par[2] * x * x ; | |
35adb638 | 820 | Double_t mean = par[4] / (x*x) + par[5] / x + par[3] ; |
821 | Double_t sigma = par[7] / (x*x) + par[8] / x + par[6] ; | |
c947e71a | 822 | |
823 | if(TMath::Abs(sigma) > 1.e-10){ | |
acb5beb7 | 824 | return cnt*TMath::Landau(y,mean,sigma); |
35adb638 | 825 | } |
826 | else | |
827 | return 0.; | |
828 | ||
829 | } | |
830 | //________________________________________________________________________ | |
17323043 | 831 | Double_t AliPHOSPIDv1::LandauPol2(Double_t x, Double_t y, Double_t * par) |
35adb638 | 832 | { |
c947e71a | 833 | |
834 | //Given the energy x and the parameter y (tof, shower dispersion or cpv-emc distance), | |
835 | //this method returns a density probability of this parameter, given by a landau | |
836 | //function whose parameters depend with the energy like second order polinomial | |
837 | ||
35adb638 | 838 | Double_t cnt = par[2] * (x*x) + par[1] * x + par[0] ; |
c947e71a | 839 | Double_t mean = par[5] * (x*x) + par[4] * x + par[3] ; |
840 | Double_t sigma = par[8] * (x*x) + par[7] * x + par[6] ; | |
35adb638 | 841 | |
c947e71a | 842 | if(TMath::Abs(sigma) > 1.e-10){ |
acb5beb7 | 843 | return cnt*TMath::Landau(y,mean,sigma); |
35adb638 | 844 | } |
845 | else | |
846 | return 0.; | |
c947e71a | 847 | |
848 | ||
35adb638 | 849 | } |
850 | // //________________________________________________________________________ | |
851 | // Double_t AliPHOSPIDv1::ChargedHadronDistProb(Double_t x, Double_t y, Double_t * parg, Double_t * parl) | |
852 | // { | |
853 | // Double_t cnt = 0.0 ; | |
854 | // Double_t mean = 0.0 ; | |
855 | // Double_t sigma = 0.0 ; | |
856 | // Double_t arg = 0.0 ; | |
857 | // if (y < parl[4] / (x*x) + parl[5] / x + parl[3]){ | |
858 | // cnt = parg[1] / (x*x) + parg[2] / x + parg[0] ; | |
859 | // mean = parg[4] / (x*x) + parg[5] / x + parg[3] ; | |
860 | // sigma = parg[7] / (x*x) + parg[8] / x + parg[6] ; | |
861 | // TF1 * f = new TF1("gaus","gaus",0.,100.); | |
862 | // f->SetParameters(cnt,mean,sigma); | |
863 | // arg = f->Eval(y) ; | |
864 | // } | |
865 | // else{ | |
866 | // cnt = parl[1] / (x*x) + parl[2] / x + parl[0] ; | |
867 | // mean = parl[4] / (x*x) + parl[5] / x + parl[3] ; | |
868 | // sigma = parl[7] / (x*x) + parl[8] / x + parl[6] ; | |
869 | // TF1 * f = new TF1("landau","landau",0.,100.); | |
870 | // f->SetParameters(cnt,mean,sigma); | |
871 | // arg = f->Eval(y) ; | |
872 | // } | |
873 | // // Double_t mean = par[3] + par[4] * x + par[5] * x * x ; | |
874 | // // Double_t sigma = par[6] + par[7] * x + par[8] * x * x ; | |
875 | ||
876 | // //Double_t arg = -(y-mean)*(y-mean)/(2*sigma*sigma) ; | |
877 | // //return cnt * TMath::Exp(arg) ; | |
878 | ||
879 | // return arg; | |
880 | ||
881 | // } | |
2cc71c1e | 882 | //____________________________________________________________________________ |
883 | void AliPHOSPIDv1::MakePID() | |
884 | { | |
885 | // construct the PID weight from a Bayesian Method | |
c947e71a | 886 | |
304864ab | 887 | const Int_t kSPECIES = AliPID::kSPECIESN ; |
7fb46731 | 888 | |
889 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; | |
890 | ||
891 | Int_t nparticles = gime->RecParticles()->GetEntriesFast() ; | |
892 | ||
7fb46731 | 893 | TObjArray * emcRecPoints = gime->EmcRecPoints() ; |
894 | TObjArray * cpvRecPoints = gime->CpvRecPoints() ; | |
895 | TClonesArray * trackSegments = gime->TrackSegments() ; | |
896 | if ( !emcRecPoints || !cpvRecPoints || !trackSegments ) { | |
897 | AliFatal("RecPoints or TrackSegments not found !") ; | |
898 | } | |
899 | TIter next(trackSegments) ; | |
900 | AliPHOSTrackSegment * ts ; | |
901 | Int_t index = 0 ; | |
902 | ||
35adb638 | 903 | Double_t * stof[kSPECIES] ; |
904 | Double_t * sdp [kSPECIES] ; | |
905 | Double_t * scpv[kSPECIES] ; | |
fb7b51ad | 906 | Double_t * sw [kSPECIES] ; |
35adb638 | 907 | //Info("MakePID","Begin MakePID"); |
908 | ||
909 | for (Int_t i =0; i< kSPECIES; i++){ | |
910 | stof[i] = new Double_t[nparticles] ; | |
911 | sdp [i] = new Double_t[nparticles] ; | |
912 | scpv[i] = new Double_t[nparticles] ; | |
fb7b51ad | 913 | sw [i] = new Double_t[nparticles] ; |
35adb638 | 914 | } |
915 | ||
7fb46731 | 916 | |
917 | while ( (ts = (AliPHOSTrackSegment *)next()) ) { | |
918 | ||
919 | //cout<<">>>>>> Bayesian Index "<<index<<endl; | |
920 | ||
921 | AliPHOSEmcRecPoint * emc = 0 ; | |
922 | if(ts->GetEmcIndex()>=0) | |
923 | emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ; | |
924 | ||
925 | AliPHOSCpvRecPoint * cpv = 0 ; | |
926 | if(ts->GetCpvIndex()>=0) | |
927 | cpv = (AliPHOSCpvRecPoint *) cpvRecPoints->At(ts->GetCpvIndex()) ; | |
cc1fe362 | 928 | |
7fb46731 | 929 | // Int_t track = 0 ; |
930 | // track = ts->GetTrackIndex() ; //TPC tracks ? | |
cc1fe362 | 931 | |
7fb46731 | 932 | if (!emc) { |
933 | AliFatal(Form("-> emc(%d) = %d", ts->GetEmcIndex(), emc )) ; | |
934 | } | |
c947e71a | 935 | |
2924941c | 936 | |
7fb46731 | 937 | // ############Tof############################# |
c947e71a | 938 | |
7fb46731 | 939 | // Info("MakePID", "TOF"); |
fb7b51ad | 940 | Float_t en = emc->GetEnergy(); |
7fb46731 | 941 | Double_t time = emc->GetTime() ; |
942 | // cout<<">>>>>>>Energy "<<en<<"Time "<<time<<endl; | |
fb7b51ad | 943 | |
35adb638 | 944 | // now get the signals probability |
945 | // s(pid) in the Bayesian formulation | |
cc1fe362 | 946 | |
304864ab | 947 | stof[AliPID::kPhoton][index] = 1.; |
948 | stof[AliPID::kElectron][index] = 1.; | |
304864ab | 949 | stof[AliPID::kEleCon][index] = 1.; |
7fb46731 | 950 | //We assing the same prob to charged hadrons, sum is 1 |
951 | stof[AliPID::kPion][index] = 1./3.; | |
952 | stof[AliPID::kKaon][index] = 1./3.; | |
953 | stof[AliPID::kProton][index] = 1./3.; | |
954 | //We assing the same prob to neutral hadrons, sum is 1 | |
955 | stof[AliPID::kNeutron][index] = 1./2.; | |
956 | stof[AliPID::kKaon0][index] = 1./2.; | |
304864ab | 957 | stof[AliPID::kMuon][index] = 1.; |
2924941c | 958 | |
959 | if(en < fTOFEnThreshold) { | |
7fb46731 | 960 | |
961 | Double_t pTofPion = fTFpiong ->Eval(time) ; //gaus distribution | |
962 | Double_t pTofKaon = 0; | |
963 | ||
35adb638 | 964 | if(time < fTkaonl[1]) |
fb7b51ad | 965 | pTofKaon = fTFkaong ->Eval(time) ; //gaus distribution |
35adb638 | 966 | else |
fb7b51ad | 967 | pTofKaon = fTFkaonl ->Eval(time) ; //landau distribution |
7fb46731 | 968 | |
969 | Double_t pTofNucleon = 0; | |
970 | ||
35adb638 | 971 | if(time < fThhadronl[1]) |
7fb46731 | 972 | pTofNucleon = fTFhhadrong ->Eval(time) ; //gaus distribution |
35adb638 | 973 | else |
7fb46731 | 974 | pTofNucleon = fTFhhadronl ->Eval(time) ; //landau distribution |
7fb46731 | 975 | //We assing the same prob to neutral hadrons, sum is the average prob |
fb7b51ad | 976 | Double_t pTofNeHadron = (pTofKaon + pTofNucleon)/2. ; |
977 | //We assing the same prob to charged hadrons, sum is the average prob | |
978 | Double_t pTofChHadron = (pTofPion + pTofKaon + pTofNucleon)/3. ; | |
7fb46731 | 979 | |
fb7b51ad | 980 | stof[AliPID::kPhoton][index] = fTFphoton ->Eval(time) ; |
981 | //gaus distribution | |
982 | stof[AliPID::kEleCon][index] = stof[AliPID::kPhoton][index] ; | |
983 | //a conversion electron has the photon ToF | |
304864ab | 984 | stof[AliPID::kMuon][index] = stof[AliPID::kPhoton][index] ; |
7fb46731 | 985 | |
fb7b51ad | 986 | stof[AliPID::kElectron][index] = pTofPion ; |
7fb46731 | 987 | |
988 | stof[AliPID::kPion][index] = pTofChHadron ; | |
989 | stof[AliPID::kKaon][index] = pTofChHadron ; | |
990 | stof[AliPID::kProton][index] = pTofChHadron ; | |
991 | ||
992 | stof[AliPID::kKaon0][index] = pTofNeHadron ; | |
993 | stof[AliPID::kNeutron][index] = pTofNeHadron ; | |
cc1fe362 | 994 | } |
c947e71a | 995 | |
996 | // Info("MakePID", "Dispersion"); | |
cc1fe362 | 997 | |
7fb46731 | 998 | // ###########Shower shape: Dispersion#################### |
35adb638 | 999 | Float_t dispersion = emc->GetDispersion(); |
1000 | //dispersion is not well defined if the cluster is only in few crystals | |
cc1fe362 | 1001 | |
304864ab | 1002 | sdp[AliPID::kPhoton][index] = 1. ; |
1003 | sdp[AliPID::kElectron][index] = 1. ; | |
1004 | sdp[AliPID::kPion][index] = 1. ; | |
1005 | sdp[AliPID::kKaon][index] = 1. ; | |
1006 | sdp[AliPID::kProton][index] = 1. ; | |
1007 | sdp[AliPID::kNeutron][index] = 1. ; | |
1008 | sdp[AliPID::kEleCon][index] = 1. ; | |
1009 | sdp[AliPID::kKaon0][index] = 1. ; | |
1010 | sdp[AliPID::kMuon][index] = 1. ; | |
c947e71a | 1011 | |
2924941c | 1012 | if(en > fDispEnThreshold && emc->GetMultiplicity() > fDispMultThreshold){ |
7fb46731 | 1013 | sdp[AliPID::kPhoton][index] = GausF(en , dispersion, fDphoton) ; |
304864ab | 1014 | sdp[AliPID::kElectron][index] = sdp[AliPID::kPhoton][index] ; |
1015 | sdp[AliPID::kPion][index] = LandauF(en , dispersion, fDhadron ) ; | |
1016 | sdp[AliPID::kKaon][index] = sdp[AliPID::kPion][index] ; | |
1017 | sdp[AliPID::kProton][index] = sdp[AliPID::kPion][index] ; | |
1018 | sdp[AliPID::kNeutron][index] = sdp[AliPID::kPion][index] ; | |
1019 | sdp[AliPID::kEleCon][index] = sdp[AliPID::kPhoton][index]; | |
1020 | sdp[AliPID::kKaon0][index] = sdp[AliPID::kPion][index] ; | |
fb7b51ad | 1021 | sdp[AliPID::kMuon][index] = fDFmuon ->Eval(dispersion) ; |
1022 | //landau distribution | |
35adb638 | 1023 | } |
cc1fe362 | 1024 | |
7fb46731 | 1025 | // Info("MakePID","multiplicity %d, dispersion %f", emc->GetMultiplicity(), dispersion); |
1026 | // Info("MakePID","ss: photon %f, hadron %f ", sdp[AliPID::kPhoton][index], sdp[AliPID::kPion][index]); | |
c947e71a | 1027 | // cout<<">>>>>multiplicity "<<emc->GetMultiplicity()<<", dispersion "<< dispersion<<endl ; |
304864ab | 1028 | // cout<<"<<<<<ss: photon "<<sdp[AliPID::kPhoton][index]<<", hadron "<<sdp[AliPID::kPion][index]<<endl; |
c947e71a | 1029 | |
7fb46731 | 1030 | //########## CPV-EMC Distance####################### |
1031 | // Info("MakePID", "Distance"); | |
fb7b51ad | 1032 | |
7fb46731 | 1033 | Float_t x = TMath::Abs(GetDistance(emc, cpv, "X")) ; |
1034 | Float_t z = GetDistance(emc, cpv, "Z") ; | |
fb7b51ad | 1035 | |
7fb46731 | 1036 | Double_t pcpv = 0 ; |
c947e71a | 1037 | Double_t pcpvneutral = 0. ; |
7fb46731 | 1038 | |
1039 | Double_t elprobx = GausF(en , x, fXelectron) ; | |
1040 | Double_t elprobz = GausF(en , z, fZelectron) ; | |
1041 | Double_t chprobx = GausF(en , x, fXcharged) ; | |
1042 | Double_t chprobz = GausF(en , z, fZcharged) ; | |
c947e71a | 1043 | Double_t pcpvelectron = elprobx * elprobz; |
1044 | Double_t pcpvcharged = chprobx * chprobz; | |
7fb46731 | 1045 | |
1046 | // cout<<">>>>energy "<<en<<endl; | |
c947e71a | 1047 | // cout<<">>>>electron : x "<<x<<" xprob "<<elprobx<<" z "<<z<<" zprob "<<elprobz<<endl; |
1048 | // cout<<">>>>hadron : x "<<x<<" xprob "<<chprobx<<" z "<<z<<" zprob "<<chprobz<<endl; | |
1049 | // cout<<">>>>electron : px*pz "<<pcpvelectron <<" hadron: px*pz "<<pcpvcharged<<endl; | |
1050 | ||
2924941c | 1051 | // Is neutral or charged? |
35adb638 | 1052 | if(pcpvelectron >= pcpvcharged) |
1053 | pcpv = pcpvelectron ; | |
1054 | else | |
1055 | pcpv = pcpvcharged ; | |
1056 | ||
fb7b51ad | 1057 | if(pcpv < fChargedNeutralThreshold) |
35adb638 | 1058 | { |
1059 | pcpvneutral = 1. ; | |
1060 | pcpvcharged = 0. ; | |
1061 | pcpvelectron = 0. ; | |
1062 | } | |
c947e71a | 1063 | // else |
1064 | // cout<<">>>>>>>>>>>CHARGED>>>>>>>>>>>"<<endl; | |
35adb638 | 1065 | |
304864ab | 1066 | scpv[AliPID::kPion][index] = pcpvcharged ; |
1067 | scpv[AliPID::kKaon][index] = pcpvcharged ; | |
1068 | scpv[AliPID::kProton][index] = pcpvcharged ; | |
7fb46731 | 1069 | |
1070 | scpv[AliPID::kMuon][index] = pcpvelectron ; | |
304864ab | 1071 | scpv[AliPID::kElectron][index] = pcpvelectron ; |
304864ab | 1072 | scpv[AliPID::kEleCon][index] = pcpvelectron ; |
7fb46731 | 1073 | |
1074 | scpv[AliPID::kPhoton][index] = pcpvneutral ; | |
1075 | scpv[AliPID::kNeutron][index] = pcpvneutral ; | |
304864ab | 1076 | scpv[AliPID::kKaon0][index] = pcpvneutral ; |
7fb46731 | 1077 | |
35adb638 | 1078 | |
1079 | // Info("MakePID", "CPV passed"); | |
c947e71a | 1080 | |
7fb46731 | 1081 | //############## Pi0 ############################# |
304864ab | 1082 | stof[AliPID::kPi0][index] = 0. ; |
1083 | scpv[AliPID::kPi0][index] = 0. ; | |
1084 | sdp [AliPID::kPi0][index] = 0. ; | |
c947e71a | 1085 | |
35adb638 | 1086 | if(en > 30.){ |
1087 | // pi0 are detected via decay photon | |
2924941c | 1088 | stof[AliPID::kPi0][index] = stof[AliPID::kPhoton][index]; |
304864ab | 1089 | scpv[AliPID::kPi0][index] = pcpvneutral ; |
2924941c | 1090 | if(emc->GetMultiplicity() > fDispMultThreshold) |
1091 | sdp [AliPID::kPi0][index] = GausF(en , dispersion, fDpi0) ; | |
1092 | //sdp [AliPID::kPi0][index] = GausPol2(en , dispersion, fDpi0) ; | |
1093 | // cout<<"E = "<<en<<" GeV; disp = "<<dispersion<<"; mult = " | |
1094 | // <<emc->GetMultiplicity()<<endl; | |
1095 | // cout<<"PDF: photon = "<<sdp [AliPID::kPhoton][index]<<"; pi0 = " | |
1096 | // <<sdp [AliPID::kPi0][index]<<endl; | |
35adb638 | 1097 | } |
1098 | ||
2924941c | 1099 | |
7fb46731 | 1100 | |
2924941c | 1101 | |
7fb46731 | 1102 | //############## muon ############################# |
1103 | ||
35adb638 | 1104 | if(en > 0.5){ |
1105 | //Muons deposit few energy | |
304864ab | 1106 | scpv[AliPID::kMuon][index] = 0 ; |
1107 | stof[AliPID::kMuon][index] = 0 ; | |
1108 | sdp [AliPID::kMuon][index] = 0 ; | |
c947e71a | 1109 | } |
1110 | ||
fb7b51ad | 1111 | //Weight to apply to hadrons due to energy reconstruction |
1112 | ||
1113 | Float_t weight = fERecWeight ->Eval(en) ; | |
1114 | ||
1115 | sw[AliPID::kPhoton][index] = 1. ; | |
1116 | sw[AliPID::kElectron][index] = 1. ; | |
1117 | sw[AliPID::kPion][index] = weight ; | |
1118 | sw[AliPID::kKaon][index] = weight ; | |
1119 | sw[AliPID::kProton][index] = weight ; | |
1120 | sw[AliPID::kNeutron][index] = weight ; | |
1121 | sw[AliPID::kEleCon][index] = 1. ; | |
1122 | sw[AliPID::kKaon0][index] = weight ; | |
1123 | sw[AliPID::kMuon][index] = weight ; | |
1124 | sw[AliPID::kPi0][index] = 1. ; | |
1125 | ||
7fb46731 | 1126 | // if(en > 0.5){ |
1127 | // cout<<"######################################################"<<endl; | |
1128 | // //cout<<"MakePID: energy "<<en<<", tof "<<time<<", distance "<<distance<<", dispersion "<<dispersion<<endl ; | |
1129 | // cout<<"MakePID: energy "<<en<<", tof "<<time<<", dispersion "<<dispersion<<", x "<<x<<", z "<<z<<endl ; | |
1130 | // cout<<">>>>>multiplicity "<<emc->GetMultiplicity()<<endl; | |
1131 | // cout<<">>>>electron : xprob "<<elprobx<<" zprob "<<elprobz<<endl; | |
1132 | // cout<<">>>>hadron : xprob "<<chprobx<<" zprob "<<chprobz<<endl; | |
1133 | // cout<<">>>>electron : px*pz "<<pcpvelectron <<" hadron: px*pz "<<pcpvcharged<<endl; | |
c947e71a | 1134 | |
2924941c | 1135 | // cout<<"Photon , pid "<< fInitPID[AliPID::kPhoton]<<" tof "<<stof[AliPID::kPhoton][index] |
1136 | // <<", cpv "<<scpv[AliPID::kPhoton][index]<<", ss "<<sdp[AliPID::kPhoton][index]<<endl; | |
7fb46731 | 1137 | // cout<<"EleCon , pid "<< fInitPID[AliPID::kEleCon]<<", tof "<<stof[AliPID::kEleCon][index] |
1138 | // <<", cpv "<<scpv[AliPID::kEleCon][index]<<" ss "<<sdp[AliPID::kEleCon][index]<<endl; | |
1139 | // cout<<"Electron , pid "<< fInitPID[AliPID::kElectron]<<", tof "<<stof[AliPID::kElectron][index] | |
1140 | // <<", cpv "<<scpv[AliPID::kElectron][index]<<" ss "<<sdp[AliPID::kElectron][index]<<endl; | |
1141 | // cout<<"Muon , pid "<< fInitPID[AliPID::kMuon]<<", tof "<<stof[AliPID::kMuon][index] | |
1142 | // <<", cpv "<<scpv[AliPID::kMuon][index]<<" ss "<<sdp[AliPID::kMuon][index]<<endl; | |
2924941c | 1143 | // cout<<"Pi0 , pid "<< fInitPID[AliPID::kPi0]<<", tof "<<stof[AliPID::kPi0][index] |
1144 | // <<", cpv "<<scpv[AliPID::kPi0][index]<<" ss "<<sdp[AliPID::kPi0][index]<<endl; | |
7fb46731 | 1145 | // cout<<"Pion , pid "<< fInitPID[AliPID::kPion]<<", tof "<<stof[AliPID::kPion][index] |
1146 | // <<", cpv "<<scpv[AliPID::kPion][index]<<" ss "<<sdp[AliPID::kPion][index]<<endl; | |
1147 | // cout<<"Kaon0 , pid "<< fInitPID[AliPID::kKaon0]<<", tof "<<stof[AliPID::kKaon0][index] | |
1148 | // <<", cpv "<<scpv[AliPID::kKaon0][index]<<" ss "<<sdp[AliPID::kKaon0][index]<<endl; | |
1149 | // cout<<"Kaon , pid "<< fInitPID[AliPID::kKaon]<<", tof "<<stof[AliPID::kKaon][index] | |
1150 | // <<", cpv "<<scpv[AliPID::kKaon][index]<<" ss "<<sdp[AliPID::kKaon][index]<<endl; | |
1151 | // cout<<"Neutron , pid "<< fInitPID[AliPID::kNeutron]<<", tof "<<stof[AliPID::kNeutron][index] | |
1152 | // <<", cpv "<<scpv[AliPID::kNeutron][index]<<" ss "<<sdp[AliPID::kNeutron][index]<<endl; | |
1153 | // cout<<"Proton , pid "<< fInitPID[AliPID::kProton]<<", tof "<<stof[AliPID::kProton][index] | |
1154 | // <<", cpv "<<scpv[AliPID::kProton][index]<<" ss "<<sdp[AliPID::kProton][index]<<endl; | |
1155 | // cout<<"######################################################"<<endl; | |
1156 | // } | |
1157 | index++; | |
cc1fe362 | 1158 | } |
35adb638 | 1159 | |
1160 | //for (index = 0 ; index < kSPECIES ; index++) | |
1161 | // pid[index] /= nparticles ; | |
1162 | ||
7fb46731 | 1163 | |
35adb638 | 1164 | // Info("MakePID", "Total Probability calculation"); |
1165 | ||
cc1fe362 | 1166 | for(index = 0 ; index < nparticles ; index ++) { |
2924941c | 1167 | |
1168 | AliPHOSRecParticle * recpar = gime->RecParticle(index) ; | |
1169 | ||
1170 | //Conversion electron? | |
1171 | ||
1172 | if(recpar->IsEleCon()){ | |
1173 | fInitPID[AliPID::kEleCon] = 1. ; | |
1174 | fInitPID[AliPID::kPhoton] = 0. ; | |
1175 | fInitPID[AliPID::kElectron] = 0. ; | |
1176 | } | |
1177 | else{ | |
1178 | fInitPID[AliPID::kEleCon] = 0. ; | |
1179 | fInitPID[AliPID::kPhoton] = 1. ; | |
1180 | fInitPID[AliPID::kElectron] = 1. ; | |
1181 | } | |
1182 | // fInitPID[AliPID::kEleCon] = 0. ; | |
1183 | ||
1184 | ||
cc1fe362 | 1185 | // calculates the Bayesian weight |
7fb46731 | 1186 | |
cc1fe362 | 1187 | Int_t jndex ; |
1188 | Double_t wn = 0.0 ; | |
1189 | for (jndex = 0 ; jndex < kSPECIES ; jndex++) | |
2924941c | 1190 | wn += stof[jndex][index] * sdp[jndex][index] * scpv[jndex][index] * |
1191 | sw[jndex][index] * fInitPID[jndex] ; | |
1192 | ||
7fb46731 | 1193 | // cout<<"*************wn "<<wn<<endl; |
e74ea0e9 | 1194 | if (TMath::Abs(wn)>0) |
1195 | for (jndex = 0 ; jndex < kSPECIES ; jndex++) { | |
35adb638 | 1196 | //cout<<"jndex "<<jndex<<" wn "<<wn<<" SetPID * wn" |
1197 | //<<stof[jndex][index] * sdp[jndex][index] * pid[jndex] << endl; | |
1198 | //cout<<" tof "<<stof[jndex][index] << " disp " <<sdp[jndex][index] << " pid "<< fInitPID[jndex] << endl; | |
2924941c | 1199 | // if(jndex == AliPID::kPi0 || jndex == AliPID::kPhoton){ |
1200 | // cout<<"Particle "<<jndex<<" final prob * wn " | |
1201 | // <<stof[jndex][index] * sdp[jndex][index] * scpv[jndex][index] * | |
1202 | // fInitPID[jndex] <<" wn "<< wn<<endl; | |
1203 | // cout<<"pid "<< fInitPID[jndex]<<", tof "<<stof[jndex][index] | |
1204 | // <<", cpv "<<scpv[jndex][index]<<" ss "<<sdp[jndex][index]<<endl; | |
1205 | // } | |
1206 | recpar->SetPID(jndex, stof[jndex][index] * sdp[jndex][index] * | |
1207 | sw[jndex][index] * scpv[jndex][index] * | |
1208 | fInitPID[jndex] / wn) ; | |
e74ea0e9 | 1209 | } |
2cc71c1e | 1210 | } |
35adb638 | 1211 | // Info("MakePID", "Delete"); |
1212 | ||
2924941c | 1213 | for (Int_t i =0; i< kSPECIES; i++){ |
1214 | delete [] stof[i]; | |
1215 | delete [] sdp [i]; | |
1216 | delete [] scpv[i]; | |
1217 | delete [] sw [i]; | |
1218 | } | |
35adb638 | 1219 | // Info("MakePID","End MakePID"); |
2cc71c1e | 1220 | } |
1221 | ||
7acf6008 | 1222 | //____________________________________________________________________________ |
e3817e5f | 1223 | void AliPHOSPIDv1::MakeRecParticles() |
1224 | { | |
b2a60966 | 1225 | // Makes a RecParticle out of a TrackSegment |
148b2bba | 1226 | |
88cb7938 | 1227 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
fbf811ec | 1228 | TObjArray * emcRecPoints = gime->EmcRecPoints() ; |
1229 | TObjArray * cpvRecPoints = gime->CpvRecPoints() ; | |
1230 | TClonesArray * trackSegments = gime->TrackSegments() ; | |
148b2bba | 1231 | if ( !emcRecPoints || !cpvRecPoints || !trackSegments ) { |
351dd634 | 1232 | AliFatal("RecPoints or TrackSegments not found !") ; |
148b2bba | 1233 | } |
fbf811ec | 1234 | TClonesArray * recParticles = gime->RecParticles() ; |
01a599c9 | 1235 | recParticles->Clear(); |
148b2bba | 1236 | |
7b7c1533 | 1237 | TIter next(trackSegments) ; |
7acf6008 | 1238 | AliPHOSTrackSegment * ts ; |
6ad0bfa0 | 1239 | Int_t index = 0 ; |
09fc14a0 | 1240 | AliPHOSRecParticle * rp ; |
7acf6008 | 1241 | while ( (ts = (AliPHOSTrackSegment *)next()) ) { |
7fb46731 | 1242 | // cout<<">>>>>>>>>>>>>>>PCA Index "<<index<<endl; |
7b7c1533 | 1243 | new( (*recParticles)[index] ) AliPHOSRecParticle() ; |
1244 | rp = (AliPHOSRecParticle *)recParticles->At(index) ; | |
f0a4c9e9 | 1245 | rp->SetTrackSegment(index) ; |
9688c1dd | 1246 | rp->SetIndexInList(index) ; |
148b2bba | 1247 | |
7acf6008 | 1248 | AliPHOSEmcRecPoint * emc = 0 ; |
1249 | if(ts->GetEmcIndex()>=0) | |
7b7c1533 | 1250 | emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ; |
fad3e5b9 | 1251 | |
8d4608b5 | 1252 | AliPHOSCpvRecPoint * cpv = 0 ; |
7acf6008 | 1253 | if(ts->GetCpvIndex()>=0) |
8d4608b5 | 1254 | cpv = (AliPHOSCpvRecPoint *) cpvRecPoints->At(ts->GetCpvIndex()) ; |
fad3e5b9 | 1255 | |
bd76890a | 1256 | Int_t track = 0 ; |
1257 | track = ts->GetTrackIndex() ; | |
1258 | ||
148b2bba | 1259 | // Now set type (reconstructed) of the particle |
1260 | ||
1261 | // Choose the cluster energy range | |
9fa5f1d0 | 1262 | |
fbf811ec | 1263 | if (!emc) { |
351dd634 | 1264 | AliFatal(Form("-> emc(%d) = %d", ts->GetEmcIndex(), emc )) ; |
fbf811ec | 1265 | } |
50739f15 | 1266 | |
e3817e5f | 1267 | Float_t e = emc->GetEnergy() ; |
bc0c084c | 1268 | |
6f969528 | 1269 | Float_t lambda[2] ; |
1270 | emc->GetElipsAxis(lambda) ; | |
50739f15 | 1271 | |
1272 | if((lambda[0]>0.01) && (lambda[1]>0.01)){ | |
1273 | // Looking PCA. Define and calculate the data (X), | |
bc0c084c | 1274 | // introduce in the function X2P that gives the components (P). |
1275 | ||
c947e71a | 1276 | Float_t spher = 0. ; |
1277 | Float_t emaxdtotal = 0. ; | |
50739f15 | 1278 | |
bc0c084c | 1279 | if((lambda[0]+lambda[1])!=0) |
c947e71a | 1280 | spher=fabs(lambda[0]-lambda[1])/(lambda[0]+lambda[1]); |
50739f15 | 1281 | |
c947e71a | 1282 | emaxdtotal=emc->GetMaximalEnergy()/emc->GetEnergy(); |
50739f15 | 1283 | |
1284 | fX[0] = lambda[0] ; | |
1285 | fX[1] = lambda[1] ; | |
1286 | fX[2] = emc->GetDispersion() ; | |
c947e71a | 1287 | fX[3] = spher ; |
50739f15 | 1288 | fX[4] = emc->GetMultiplicity() ; |
c947e71a | 1289 | fX[5] = emaxdtotal ; |
50739f15 | 1290 | fX[6] = emc->GetCoreEnergy() ; |
1291 | ||
e3817e5f | 1292 | fPrincipalPhoton->X2P(fX,fPPhoton); |
1293 | fPrincipalPi0 ->X2P(fX,fPPi0); | |
1f0e7ccd | 1294 | |
50739f15 | 1295 | } |
1296 | else{ | |
e3817e5f | 1297 | fPPhoton[0]=-100.0; //We do not accept clusters with |
1298 | fPPhoton[1]=-100.0; //one cell as a photon-like | |
1299 | fPPi0[0] =-100.0; | |
1300 | fPPi0[1] =-100.0; | |
50739f15 | 1301 | } |
1302 | ||
2cc71c1e | 1303 | Float_t time = emc->GetTime() ; |
1304 | rp->SetTof(time) ; | |
9fa5f1d0 | 1305 | |
bc0c084c | 1306 | // Loop of Efficiency-Purity (the 3 points of purity or efficiency |
1307 | // are taken into account to set the particle identification) | |
e3817e5f | 1308 | for(Int_t effPur = 0; effPur < 3 ; effPur++){ |
50739f15 | 1309 | |
bc0c084c | 1310 | // Looking at the CPV detector. If RCPV greater than CpvEmcDistance, |
1311 | // 1st,2nd or 3rd bit (depending on the efficiency-purity point ) | |
1312 | // is set to 1 | |
35adb638 | 1313 | if(GetCPVBit(emc, cpv, effPur,e) == 1 ){ |
e3817e5f | 1314 | rp->SetPIDBit(effPur) ; |
35adb638 | 1315 | //cout<<"CPV bit "<<effPur<<endl; |
1316 | } | |
50739f15 | 1317 | // Looking the TOF. If TOF smaller than gate, 4th, 5th or 6th |
1318 | // bit (depending on the efficiency-purity point )is set to 1 | |
2cc71c1e | 1319 | if(time< (*fParameters)(3,effPur)) |
e3817e5f | 1320 | rp->SetPIDBit(effPur+3) ; |
2cc71c1e | 1321 | |
e3817e5f | 1322 | //Photon PCA |
50739f15 | 1323 | //If we are inside the ellipse, 7th, 8th or 9th |
1324 | // bit (depending on the efficiency-purity point )is set to 1 | |
e3817e5f | 1325 | if(GetPrincipalBit("photon",fPPhoton,effPur,e) == 1) |
1326 | rp->SetPIDBit(effPur+6) ; | |
1f0e7ccd | 1327 | |
e3817e5f | 1328 | //Pi0 PCA |
1f0e7ccd | 1329 | //If we are inside the ellipse, 10th, 11th or 12th |
1330 | // bit (depending on the efficiency-purity point )is set to 1 | |
e3817e5f | 1331 | if(GetPrincipalBit("pi0" ,fPPi0 ,effPur,e) == 1) |
1332 | rp->SetPIDBit(effPur+9) ; | |
f0a4c9e9 | 1333 | } |
e3817e5f | 1334 | if(GetHardPhotonBit(emc)) |
1335 | rp->SetPIDBit(12) ; | |
1336 | if(GetHardPi0Bit (emc)) | |
1337 | rp->SetPIDBit(13) ; | |
1f0e7ccd | 1338 | |
bd76890a | 1339 | if(track >= 0) |
1340 | rp->SetPIDBit(14) ; | |
1341 | ||
9fa5f1d0 | 1342 | //Set momentum, energy and other parameters |
50739f15 | 1343 | Float_t encal = GetCalibratedEnergy(e); |
9fa5f1d0 | 1344 | TVector3 dir = GetMomentumDirection(emc,cpv) ; |
1345 | dir.SetMag(encal) ; | |
1346 | rp->SetMomentum(dir.X(),dir.Y(),dir.Z(),encal) ; | |
1347 | rp->SetCalcMass(0); | |
e0ed2e49 | 1348 | rp->Name(); //If photon sets the particle pdg name to gamma |
e747b8da | 1349 | rp->SetProductionVertex(0,0,0,0); |
1350 | rp->SetFirstMother(-1); | |
1351 | rp->SetLastMother(-1); | |
1352 | rp->SetFirstDaughter(-1); | |
1353 | rp->SetLastDaughter(-1); | |
1354 | rp->SetPolarisation(0,0,0); | |
d956e9b7 | 1355 | //Set the position in global coordinate system from the RecPoint |
1356 | AliPHOSGeometry * geom = gime->PHOSGeometry() ; | |
1357 | AliPHOSTrackSegment * ts = gime->TrackSegment(rp->GetPHOSTSIndex()) ; | |
1358 | AliPHOSEmcRecPoint * erp = gime->EmcRecPoint(ts->GetEmcIndex()) ; | |
1359 | TVector3 pos ; | |
1360 | geom->GetGlobal(erp, pos) ; | |
1361 | rp->SetPos(pos); | |
6ad0bfa0 | 1362 | index++ ; |
1363 | } | |
6ad0bfa0 | 1364 | } |
e3817e5f | 1365 | |
09fc14a0 | 1366 | //____________________________________________________________________________ |
702ab87e | 1367 | void AliPHOSPIDv1::Print(const Option_t *) const |
09fc14a0 | 1368 | { |
b2a60966 | 1369 | // Print the parameters used for the particle type identification |
bc0c084c | 1370 | |
351dd634 | 1371 | AliInfo("=============== AliPHOSPIDv1 ================") ; |
88cb7938 | 1372 | printf("Making PID\n") ; |
1373 | printf(" Pricipal analysis file from 0.5 to 100 %s\n", fFileNamePrincipalPhoton.Data() ) ; | |
1374 | printf(" Name of parameters file %s\n", fFileNameParameters.Data() ) ; | |
1375 | printf(" Matrix of Parameters: 14x4\n") ; | |
1376 | printf(" Energy Calibration 1x3 [3 parametres to calibrate energy: A + B* E + C * E^2]\n") ; | |
1377 | printf(" RCPV 2x3 rows x and z, columns function cut parameters\n") ; | |
1378 | printf(" TOF 1x3 [High Eff-Low Pur,Medium Eff-Pur, Low Eff-High Pur]\n") ; | |
1379 | printf(" PCA 5x4 [5 ellipse parametres and 4 parametres to calculate them: A/Sqrt(E) + B* E + C * E^2 + D]\n") ; | |
1380 | Printf(" Pi0 PCA 5x3 [5 ellipse parametres and 3 parametres to calculate them: A + B* E + C * E^2]\n") ; | |
50739f15 | 1381 | fParameters->Print() ; |
09fc14a0 | 1382 | } |
1383 | ||
a496c46c | 1384 | |
69183710 | 1385 | |
7acf6008 | 1386 | //____________________________________________________________________________ |
a4e98857 | 1387 | void AliPHOSPIDv1::PrintRecParticles(Option_t * option) |
1388 | { | |
dd5c4038 | 1389 | // Print table of reconstructed particles |
1390 | ||
88cb7938 | 1391 | AliPHOSGetter *gime = AliPHOSGetter::Instance() ; |
bf8f1fbd | 1392 | |
88cb7938 | 1393 | TClonesArray * recParticles = gime->RecParticles() ; |
21cd0c07 | 1394 | |
1395 | TString message ; | |
3bf72d32 | 1396 | message = "\nevent " ; |
1397 | message += gAlice->GetEvNumber() ; | |
1398 | message += " found " ; | |
1399 | message += recParticles->GetEntriesFast(); | |
1400 | message += " RecParticles\n" ; | |
1401 | ||
7acf6008 | 1402 | if(strstr(option,"all")) { // printing found TS |
3bf72d32 | 1403 | message += "\n PARTICLE Index \n" ; |
7acf6008 | 1404 | |
1405 | Int_t index ; | |
7b7c1533 | 1406 | for (index = 0 ; index < recParticles->GetEntries() ; index++) { |
21cd0c07 | 1407 | AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) recParticles->At(index) ; |
3bf72d32 | 1408 | message += "\n" ; |
1409 | message += rp->Name().Data() ; | |
1410 | message += " " ; | |
1411 | message += rp->GetIndexInList() ; | |
1412 | message += " " ; | |
1413 | message += rp->GetType() ; | |
7acf6008 | 1414 | } |
3bf72d32 | 1415 | } |
351dd634 | 1416 | AliInfo(message.Data() ) ; |
69183710 | 1417 | } |
88cb7938 | 1418 | |
1419 | //____________________________________________________________________________ | |
1420 | void AliPHOSPIDv1::SetParameters() | |
1421 | { | |
1422 | // PCA : To do the Principal Components Analysis it is necessary | |
1423 | // the Principal file, which is opened here | |
1424 | fX = new double[7]; // Data for the PCA | |
1425 | fPPhoton = new double[7]; // Eigenvalues of the PCA | |
1426 | fPPi0 = new double[7]; // Eigenvalues of the Pi0 PCA | |
1427 | ||
1428 | // Read photon principals from the photon file | |
1429 | ||
1430 | fFileNamePrincipalPhoton = "$ALICE_ROOT/PHOS/PCA8pa15_0.5-100.root" ; | |
1431 | TFile f( fFileNamePrincipalPhoton.Data(), "read" ) ; | |
1432 | fPrincipalPhoton = dynamic_cast<TPrincipal*> (f.Get("principal")) ; | |
1433 | f.Close() ; | |
1434 | ||
1435 | // Read pi0 principals from the pi0 file | |
1436 | ||
1437 | fFileNamePrincipalPi0 = "$ALICE_ROOT/PHOS/PCA_pi0_40-120.root" ; | |
1438 | TFile fPi0( fFileNamePrincipalPi0.Data(), "read" ) ; | |
1439 | fPrincipalPi0 = dynamic_cast<TPrincipal*> (fPi0.Get("principal")) ; | |
1440 | fPi0.Close() ; | |
1441 | ||
1442 | // Open parameters file and initialization of the Parameters matrix. | |
1443 | // In the File Parameters.dat are all the parameters. These are introduced | |
1444 | // in a matrix of 16x4 | |
1445 | // | |
1446 | // All the parameters defined in this file are, in order of row: | |
1447 | // line 0 : calibration | |
1448 | // lines 1,2 : CPV rectangular cat for X and Z | |
1449 | // line 3 : TOF cut | |
1450 | // lines 4-8 : parameters to calculate photon PCA ellipse | |
1451 | // lines 9-13: parameters to calculate pi0 PCA ellipse | |
1452 | // lines 14-15: parameters to calculate border for high-pt photons and pi0 | |
1453 | ||
1454 | fFileNameParameters = gSystem->ExpandPathName("$ALICE_ROOT/PHOS/Parameters.dat"); | |
1455 | fParameters = new TMatrix(16,4) ; | |
c947e71a | 1456 | const Int_t kMaxLeng=255; |
1457 | char string[kMaxLeng]; | |
88cb7938 | 1458 | |
1459 | // Open a text file with PID parameters | |
1460 | FILE *fd = fopen(fFileNameParameters.Data(),"r"); | |
1461 | if (!fd) | |
351dd634 | 1462 | AliFatal(Form("File %s with a PID parameters cannot be opened\n", |
1463 | fFileNameParameters.Data())); | |
88cb7938 | 1464 | |
1465 | Int_t i=0; | |
1466 | // Read parameter file line-by-line and skip empty line and comments | |
c947e71a | 1467 | while (fgets(string,kMaxLeng,fd) != NULL) { |
88cb7938 | 1468 | if (string[0] == '\n' ) continue; |
1469 | if (string[0] == '!' ) continue; | |
1470 | sscanf(string, "%f %f %f %f", | |
1471 | &(*fParameters)(i,0), &(*fParameters)(i,1), | |
1472 | &(*fParameters)(i,2), &(*fParameters)(i,3)); | |
1473 | i++; | |
351dd634 | 1474 | AliDebug(1, Form("SetParameters", "line %d: %s",i,string)); |
88cb7938 | 1475 | } |
1476 | fclose(fd); | |
1477 | } | |
1478 | ||
1479 | //____________________________________________________________________________ | |
1480 | void AliPHOSPIDv1::SetParameterCalibration(Int_t i,Float_t param) | |
1481 | { | |
1482 | // Set parameter "Calibration" i to a value param | |
351dd634 | 1483 | if(i>2 || i<0) { |
1484 | AliError(Form("Invalid parameter number: %d",i)); | |
1485 | } else | |
88cb7938 | 1486 | (*fParameters)(0,i) = param ; |
1487 | } | |
1488 | ||
1489 | //____________________________________________________________________________ | |
1490 | void AliPHOSPIDv1::SetParameterCpv2Emc(Int_t i, TString axis, Float_t cut) | |
1491 | { | |
1492 | // Set the parameters to calculate Cpv-to-Emc Distance Cut depending on | |
1493 | // Purity-Efficiency point i | |
1494 | ||
351dd634 | 1495 | if(i>2 || i<0) { |
1496 | AliError(Form("Invalid parameter number: %d",i)); | |
1497 | } else { | |
88cb7938 | 1498 | axis.ToLower(); |
1499 | if (axis == "x") (*fParameters)(1,i) = cut; | |
1500 | else if (axis == "z") (*fParameters)(2,i) = cut; | |
351dd634 | 1501 | else { |
1502 | AliError(Form("Invalid axis name: %s",axis.Data())); | |
1503 | } | |
88cb7938 | 1504 | } |
1505 | } | |
1506 | ||
1507 | //____________________________________________________________________________ | |
1508 | void AliPHOSPIDv1::SetParameterPhotonBoundary(Int_t i,Float_t param) | |
1509 | { | |
1510 | // Set parameter "Hard photon boundary" i to a value param | |
351dd634 | 1511 | if(i>4 || i<0) { |
1512 | AliError(Form("Invalid parameter number: %d",i)); | |
1513 | } else | |
88cb7938 | 1514 | (*fParameters)(14,i) = param ; |
1515 | } | |
1516 | ||
1517 | //____________________________________________________________________________ | |
1518 | void AliPHOSPIDv1::SetParameterPi0Boundary(Int_t i,Float_t param) | |
1519 | { | |
1520 | // Set parameter "Hard pi0 boundary" i to a value param | |
351dd634 | 1521 | if(i>1 || i<0) { |
1522 | AliError(Form("Invalid parameter number: %d",i)); | |
1523 | } else | |
88cb7938 | 1524 | (*fParameters)(15,i) = param ; |
1525 | } | |
1526 | ||
1527 | //_____________________________________________________________________________ | |
1528 | void AliPHOSPIDv1::SetParameterTimeGate(Int_t i, Float_t gate) | |
1529 | { | |
1530 | // Set the parameter TimeGate depending on Purity-Efficiency point i | |
351dd634 | 1531 | if (i>2 || i<0) { |
1532 | AliError(Form("Invalid Efficiency-Purity choice %d",i)); | |
1533 | } else | |
88cb7938 | 1534 | (*fParameters)(3,i)= gate ; |
1535 | } | |
1536 | ||
1537 | //_____________________________________________________________________________ | |
1538 | void AliPHOSPIDv1::SetParameterToCalculateEllipse(TString particle, TString param, Int_t i, Float_t par) | |
1539 | { | |
1540 | // Set the parameter "i" that is needed to calculate the ellipse | |
1541 | // parameter "param" for a particle "particle" | |
1542 | ||
1543 | particle.ToLower(); | |
1544 | param. ToLower(); | |
1545 | Int_t p= -1; | |
1546 | Int_t offset=0; | |
1547 | ||
1548 | if (particle == "photon") offset=0; | |
1549 | else if (particle == "pi0") offset=5; | |
1550 | else | |
351dd634 | 1551 | AliError(Form("Wrong particle name: %s (choose from pi0/photon)\n", |
1552 | particle.Data())); | |
88cb7938 | 1553 | |
1554 | if (param.Contains("a")) p=4+offset; | |
1555 | else if(param.Contains("b")) p=5+offset; | |
1556 | else if(param.Contains("c")) p=6+offset; | |
1557 | else if(param.Contains("x0"))p=7+offset; | |
1558 | else if(param.Contains("y0"))p=8+offset; | |
351dd634 | 1559 | if((i>4)||(i<0)) { |
1560 | AliError(Form("No parameter with index %d", i)) ; | |
1561 | } else if(p==-1) { | |
1562 | AliError(Form("No parameter with name %s", param.Data() )) ; | |
1563 | } else | |
88cb7938 | 1564 | (*fParameters)(p,i) = par ; |
1565 | } | |
1566 | ||
1567 | //____________________________________________________________________________ | |
1568 | void AliPHOSPIDv1::Unload() | |
1569 | { | |
c947e71a | 1570 | //Unloads RecPoints, Tracks and RecParticles |
88cb7938 | 1571 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
1572 | gime->PhosLoader()->UnloadRecPoints() ; | |
1573 | gime->PhosLoader()->UnloadTracks() ; | |
1574 | gime->PhosLoader()->UnloadRecParticles() ; | |
1575 | } | |
1576 | ||
1577 | //____________________________________________________________________________ | |
90cceaf6 | 1578 | void AliPHOSPIDv1::WriteRecParticles() |
88cb7938 | 1579 | { |
c947e71a | 1580 | //It writes reconstructed particles and pid to file |
1581 | ||
88cb7938 | 1582 | AliPHOSGetter *gime = AliPHOSGetter::Instance() ; |
1583 | ||
1584 | TClonesArray * recParticles = gime->RecParticles() ; | |
1585 | recParticles->Expand(recParticles->GetEntriesFast() ) ; | |
adcca1e6 | 1586 | if(fWrite){ |
1587 | TTree * treeP = gime->TreeP(); | |
1588 | ||
1589 | //First rp | |
1590 | Int_t bufferSize = 32000 ; | |
1591 | TBranch * rpBranch = treeP->Branch("PHOSRP",&recParticles,bufferSize); | |
1592 | rpBranch->SetTitle(BranchName()); | |
1593 | ||
1594 | rpBranch->Fill() ; | |
1595 | ||
1596 | gime->WriteRecParticles("OVERWRITE"); | |
1597 | gime->WritePID("OVERWRITE"); | |
1598 | } | |
88cb7938 | 1599 | } |
1600 | ||
35adb638 | 1601 | |
1602 | //_______________________________________________________________________ | |
1603 | void AliPHOSPIDv1::SetInitPID(const Double_t *p) { | |
1604 | // Sets values for the initial population of each particle type | |
304864ab | 1605 | for (Int_t i=0; i<AliPID::kSPECIESN; i++) fInitPID[i] = p[i]; |
35adb638 | 1606 | } |
1607 | //_______________________________________________________________________ | |
1608 | void AliPHOSPIDv1::GetInitPID(Double_t *p) const { | |
1609 | // Gets values for the initial population of each particle type | |
304864ab | 1610 | for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i] = fInitPID[i]; |
35adb638 | 1611 | } |