]>
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 | ||
6ad0bfa0 | 18 | //_________________________________________________________________________ |
b2a60966 | 19 | // Implementation version v1 of the PHOS particle identifier |
7acf6008 | 20 | // Particle identification based on the |
148b2bba | 21 | // - RCPV: distance from CPV recpoint to EMCA recpoint. |
22 | // - TOF | |
23 | // - PCA: Principal Components Analysis.. | |
24 | // The identified particle has an identification number corresponding | |
25 | // to a 9 bits number: | |
26 | // -Bit 0 to 2: bit set if RCPV > fCpvEmcDistance (each bit corresponds | |
27 | // to a different efficiency-purity point of the photon identification) | |
28 | // -Bit 3 to 5: bit set if TOF < fTimeGate (each bit corresponds | |
29 | // to a different efficiency-purity point of the photon identification) | |
30 | // -Bit 6 to 9: bit set if Principal Components are | |
31 | // inside an ellipse defined by fX_center, fY_center, fA, fB, fAngle | |
32 | // (each bit corresponds to a different efficiency-purity point of the | |
33 | // photon identification) | |
9fa5f1d0 | 34 | // A calibrated energy is calculated. The energy of the reconstructed |
35 | // cluster is corrected with the formula A + B * E + C * E^2, whose parameters | |
36 | // where obtained thourgh the study of the reconstructed energy | |
37 | // distribution of monoenergetic photons. | |
38 | // | |
a4e98857 | 39 | // |
7acf6008 | 40 | // |
a4e98857 | 41 | // use case: |
f0a4c9e9 | 42 | // root [0] AliPHOSPIDv1 * p = new AliPHOSPIDv1("galice1.root","v1") |
a4e98857 | 43 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated |
148b2bba | 44 | // // reading headers from file galice1.root and create RecParticles with title v1 |
45 | // TrackSegments and RecPoints with title "v1" are used | |
7acf6008 | 46 | // // set file name for the branch RecParticles |
f0a4c9e9 | 47 | // root [1] p->ExecuteTask("deb all time") |
7acf6008 | 48 | // // available options |
49 | // // "deb" - prints # of reconstructed particles | |
50 | // // "deb all" - prints # and list of RecParticles | |
51 | // // "time" - prints benchmarking results | |
52 | // | |
f0a4c9e9 | 53 | // root [2] AliPHOSPIDv1 * p2 = new AliPHOSPIDv1("galice1.root","v1","v0") |
148b2bba | 54 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated |
55 | // // reading headers from file galice1.root and create RecParticles with title v1 | |
56 | // RecPoints and TrackSegments with title "v0" are used | |
f0a4c9e9 | 57 | // root [3] p2->ExecuteTask() |
58 | // | |
59 | // There are two possible principal files available to do the analysis. | |
9fa5f1d0 | 60 | // One for energy ranges from 0.5 to 5 GeV, and another |
61 | // one from 5 to 100 GeV. This files are automatically called in function | |
62 | // of the cluster energy. | |
f0a4c9e9 | 63 | |
7acf6008 | 64 | //*-- Author: Yves Schutz (SUBATECH) & Gines Martinez (SUBATECH) & |
148b2bba | 65 | // Gustavo Conesa April 2002 |
6ad0bfa0 | 66 | |
67 | // --- ROOT system --- | |
7acf6008 | 68 | #include "TROOT.h" |
69 | #include "TTree.h" | |
70 | #include "TFile.h" | |
71 | #include "TF2.h" | |
72 | #include "TFormula.h" | |
73 | #include "TCanvas.h" | |
74 | #include "TFolder.h" | |
75 | #include "TSystem.h" | |
76 | #include "TBenchmark.h" | |
148b2bba | 77 | #include "TMatrixD.h" |
78 | #include "TPrincipal.h" | |
79 | #include "TSystem.h" | |
80 | ||
6ad0bfa0 | 81 | // --- Standard library --- |
82 | ||
de9ec31b | 83 | #include <iostream.h> |
148b2bba | 84 | #include <fstream.h> |
7acf6008 | 85 | #include <iomanip.h> |
6ad0bfa0 | 86 | |
87 | // --- AliRoot header files --- | |
88 | ||
7acf6008 | 89 | #include "AliRun.h" |
90 | #include "AliGenerator.h" | |
91 | #include "AliPHOS.h" | |
26d4b141 | 92 | #include "AliPHOSPIDv1.h" |
7acf6008 | 93 | #include "AliPHOSClusterizerv1.h" |
6ad0bfa0 | 94 | #include "AliPHOSTrackSegment.h" |
7acf6008 | 95 | #include "AliPHOSTrackSegmentMakerv1.h" |
6ad0bfa0 | 96 | #include "AliPHOSRecParticle.h" |
7b7c1533 | 97 | #include "AliPHOSGeometry.h" |
98 | #include "AliPHOSGetter.h" | |
6ad0bfa0 | 99 | |
26d4b141 | 100 | ClassImp( AliPHOSPIDv1) |
6ad0bfa0 | 101 | |
1cb7c1ee | 102 | //____________________________________________________________________________ |
103 | AliPHOSPIDv1::AliPHOSPIDv1():AliPHOSPID() | |
104 | { | |
a4e98857 | 105 | // default ctor |
148b2bba | 106 | |
8d0f3f77 | 107 | InitParameters() ; |
92f521a9 | 108 | fDefaultInit = kTRUE ; |
109 | ||
7acf6008 | 110 | } |
111 | ||
112 | //____________________________________________________________________________ | |
148b2bba | 113 | AliPHOSPIDv1::AliPHOSPIDv1(const char * headerFile,const char * name, const char * from) : AliPHOSPID(headerFile, name) |
e0ed2e49 | 114 | |
115 | ||
7acf6008 | 116 | { |
a4e98857 | 117 | //ctor with the indication on where to look for the track segments |
7b7c1533 | 118 | |
8d0f3f77 | 119 | InitParameters() ; |
120 | ||
148b2bba | 121 | if ( from == 0 ) |
122 | fFrom = name ; | |
123 | else | |
124 | fFrom = from ; | |
8d0f3f77 | 125 | |
2bd5457f | 126 | Init() ; |
92f521a9 | 127 | fDefaultInit = kFALSE ; |
7acf6008 | 128 | |
129 | } | |
7b7c1533 | 130 | |
7acf6008 | 131 | //____________________________________________________________________________ |
132 | AliPHOSPIDv1::~AliPHOSPIDv1() | |
133 | { | |
79bb1b62 | 134 | // dtor |
92f521a9 | 135 | // fDefaultInit = kTRUE if PID created by default ctor (to get just the parameters) |
9fa5f1d0 | 136 | |
a496c46c | 137 | delete [] fX ; // Principal input |
148b2bba | 138 | delete [] fP ; // Principal components |
139 | delete fParameters ; // Matrix of Parameters | |
9fa5f1d0 | 140 | delete fParameters5 ; // Matrix of Parameters |
141 | delete fParameters100 ; // Matrix of Parameters | |
142 | ||
8d0f3f77 | 143 | |
92f521a9 | 144 | if (!fDefaultInit) { |
145 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; | |
146 | // remove the task from the folder list | |
147 | gime->RemoveTask("P",GetName()) ; | |
148 | TString name(GetName()) ; | |
149 | name.ReplaceAll("pid", "clu") ; | |
150 | gime->RemoveTask("C",name) ; | |
151 | ||
152 | // remove the data from the folder list | |
153 | name = GetName() ; | |
154 | name.Remove(name.Index(":")) ; | |
155 | gime->RemoveObjects("RE", name) ; // EMCARecPoints | |
156 | gime->RemoveObjects("RC", name) ; // CPVRecPoints | |
157 | gime->RemoveObjects("T", name) ; // TrackSegments | |
158 | gime->RemoveObjects("P", name) ; // RecParticles | |
159 | ||
160 | // Delete gAlice | |
161 | gime->CloseFile() ; | |
162 | ||
163 | fSplitFile = 0 ; | |
79bb1b62 | 164 | } |
7acf6008 | 165 | } |
2bd5457f | 166 | |
a496c46c | 167 | //____________________________________________________________________________ |
168 | const TString AliPHOSPIDv1::BranchName() const | |
169 | { | |
170 | TString branchName(GetName() ) ; | |
171 | branchName.Remove(branchName.Index(Version())-1) ; | |
172 | return branchName ; | |
173 | } | |
174 | ||
148b2bba | 175 | //____________________________________________________________________________ |
176 | void AliPHOSPIDv1::Init() | |
177 | { | |
178 | // Make all memory allocations that are not possible in default constructor | |
179 | // Add the PID task to the list of PHOS tasks | |
a496c46c | 180 | |
148b2bba | 181 | if ( strcmp(GetTitle(), "") == 0 ) |
182 | SetTitle("galice.root") ; | |
8d0f3f77 | 183 | |
148b2bba | 184 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), fFrom.Data()) ; |
185 | ||
a496c46c | 186 | gime->SetRecParticlesTitle(BranchName()) ; |
148b2bba | 187 | if ( gime == 0 ) { |
188 | cerr << "ERROR: AliPHOSPIDv1::Init -> Could not obtain the Getter object !" << endl ; | |
189 | return ; | |
190 | } | |
a496c46c | 191 | |
148b2bba | 192 | gime->PostPID(this) ; |
193 | // create a folder on the white board //YSAlice/WhiteBoard/RecParticles/PHOS/recparticlesName | |
a496c46c | 194 | gime->PostRecParticles(BranchName()) ; |
148b2bba | 195 | |
196 | } | |
8d0f3f77 | 197 | |
198 | //____________________________________________________________________________ | |
199 | void AliPHOSPIDv1::InitParameters() | |
200 | { | |
201 | fFrom = "" ; | |
202 | fHeaderFileName = GetTitle() ; | |
203 | TString name(GetName()) ; | |
204 | if (name.IsNull()) | |
205 | name = "Default" ; | |
206 | fTrackSegmentsTitle = name ; | |
207 | fRecPointsTitle = name ; | |
208 | fRecParticlesTitle = name ; | |
209 | name.Append(":") ; | |
210 | name.Append(Version()) ; | |
211 | SetName(name) ; | |
212 | fRecParticlesInRun = 0 ; | |
8d0f3f77 | 213 | fNEvent = 0 ; |
214 | fClusterizer = 0 ; | |
215 | fTSMaker = 0 ; | |
216 | fRecParticlesInRun = 0 ; | |
9fa5f1d0 | 217 | SetParameters() ; // fill the parameters matrix from parameters file |
8d0f3f77 | 218 | } |
219 | ||
69183710 | 220 | //____________________________________________________________________________ |
9fa5f1d0 | 221 | Double_t AliPHOSPIDv1::GetCpvtoEmcDistanceCut(const Float_t Cluster_En, const TString Eff_Pur) |
148b2bba | 222 | { |
223 | // Get CpvtoEmcDistanceCut parameter depending on the cluster energy and | |
224 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
225 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
226 | // EFFICIENCY by PURITY) | |
148b2bba | 227 | |
9fa5f1d0 | 228 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
f0a4c9e9 | 229 | |
9fa5f1d0 | 230 | GetAnalysisParameters(Cluster_En) ; |
231 | if((fClusterrcpv!= -1)&&(eff_pur != -1)) | |
232 | return (*fParameters)(fClusterrcpv,eff_pur) ; | |
233 | else | |
234 | return 0.0; | |
148b2bba | 235 | } |
236 | //____________________________________________________________________________ | |
237 | ||
9fa5f1d0 | 238 | Double_t AliPHOSPIDv1::GetTimeGate(const Float_t Cluster_En, const TString Eff_Pur) |
148b2bba | 239 | { |
240 | // Get TimeGate parameter depending on the cluster energy and | |
241 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
242 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
243 | // EFFICIENCY by PURITY) | |
9fa5f1d0 | 244 | |
f0a4c9e9 | 245 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
9fa5f1d0 | 246 | GetAnalysisParameters(Cluster_En) ; |
247 | ||
248 | if((fCluster!= -1)&&(eff_pur != -1)) | |
249 | return (*fParameters)(fCluster+3+fMatrixExtraRow,eff_pur) ; | |
250 | else | |
251 | return 0.0; | |
f0a4c9e9 | 252 | |
148b2bba | 253 | } |
254 | //_____________________________________________________________________________ | |
7acf6008 | 255 | Float_t AliPHOSPIDv1::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Option_t * Axis)const |
69183710 | 256 | { |
257 | // Calculates the distance between the EMC RecPoint and the PPSD RecPoint | |
148b2bba | 258 | |
7b7c1533 | 259 | const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ; |
69183710 | 260 | TVector3 vecEmc ; |
7acf6008 | 261 | TVector3 vecCpv ; |
148b2bba | 262 | if(cpv){ |
263 | emc->GetLocalPosition(vecEmc) ; | |
264 | cpv->GetLocalPosition(vecCpv) ; | |
265 | if(emc->GetPHOSMod() == cpv->GetPHOSMod()){ | |
266 | // Correct to difference in CPV and EMC position due to different distance to center. | |
267 | // we assume, that particle moves from center | |
268 | Float_t dCPV = geom->GetIPtoOuterCoverDistance(); | |
269 | Float_t dEMC = geom->GetIPtoCrystalSurface() ; | |
270 | dEMC = dEMC / dCPV ; | |
271 | vecCpv = dEMC * vecCpv - vecEmc ; | |
272 | if (Axis == "X") return vecCpv.X(); | |
273 | if (Axis == "Y") return vecCpv.Y(); | |
274 | if (Axis == "Z") return vecCpv.Z(); | |
275 | if (Axis == "R") return vecCpv.Mag(); | |
7acf6008 | 276 | } |
148b2bba | 277 | |
278 | return 100000000 ; | |
279 | } | |
7acf6008 | 280 | return 100000000 ; |
69183710 | 281 | } |
282 | ||
6ad0bfa0 | 283 | //____________________________________________________________________________ |
9fa5f1d0 | 284 | Double_t AliPHOSPIDv1::CalibratedEnergy(Float_t e){ |
285 | //It calibrates Energy depending on the recpoint energy. | |
286 | // The energy of the reconstructed | |
287 | // cluster is corrected with the formula A + B* E + C* E^2, whose parameters | |
288 | // where obtained through the study of the reconstructed energy | |
289 | // distribution of monoenergetic photons. | |
290 | Double_t enerec; | |
291 | enerec = fACalParameter + fBCalParameter * e+ fCCalParameter * e * e; | |
292 | return enerec ; | |
293 | ||
294 | } | |
295 | //____________________________________________________________________________ | |
296 | Int_t AliPHOSPIDv1::GetPrincipalSign(Double_t* P, Int_t cluster, Int_t eff_pur)const | |
148b2bba | 297 | { |
298 | //This method gives if the PCA of the particle are inside a defined ellipse | |
148b2bba | 299 | // Get the parameters that define the ellipse stored in the |
300 | // fParameters matrix. | |
301 | Double_t X_center = (*fParameters)(cluster+6,eff_pur) ; | |
302 | Double_t Y_center = (*fParameters)(cluster+9,eff_pur) ; | |
303 | Double_t A = (*fParameters)(cluster+12,eff_pur) ; | |
304 | Double_t B = (*fParameters)(cluster+15,eff_pur) ; | |
305 | Double_t Angle = (*fParameters)(cluster+18,eff_pur) ; | |
306 | ||
307 | Int_t prinsign; | |
308 | Double_t Dx = 0. ; | |
309 | Double_t Delta = 0. ; | |
310 | Double_t Y = 0. ; | |
311 | Double_t Y_1 = 0. ; | |
312 | Double_t Y_2 = 0. ; | |
313 | Double_t Pi = TMath::Pi() ; | |
314 | Double_t Cos_Theta = TMath::Cos(Pi*Angle/180.) ; | |
315 | Double_t Sin_Theta = TMath::Sin(Pi*Angle/180.) ; | |
316 | ||
317 | Dx = P[0] - X_center ; | |
9fa5f1d0 | 318 | Delta = 4.*A*A*B*B* (A*A*Cos_Theta*Cos_Theta |
148b2bba | 319 | + B*B*Sin_Theta*Sin_Theta - Dx*Dx) ; |
320 | if (Delta < 0.) | |
321 | {prinsign=0;} | |
322 | ||
323 | else if (Delta == 0.) | |
324 | { | |
325 | Y = Cos_Theta*Sin_Theta*(A*A - B*B)*Dx / | |
326 | (A*A*Cos_Theta*Cos_Theta + B*B*Sin_Theta*Sin_Theta) ; | |
327 | Y += Y_center ; | |
328 | if(P[1]==Y ) | |
329 | {prinsign=1;} | |
330 | else | |
331 | {prinsign=0;} | |
332 | } | |
333 | else | |
334 | { | |
335 | Y_1 = (Cos_Theta*Sin_Theta*(A*A - B*B) *Dx + | |
336 | TMath::Sqrt(Delta)/2.)/(A*A*Cos_Theta*Cos_Theta + | |
337 | B*B*Sin_Theta*Sin_Theta) ; | |
338 | Y_2 = (Cos_Theta*Sin_Theta*(A*A - B*B) *Dx - | |
339 | TMath::Sqrt(Delta)/2.)/(A*A*Cos_Theta*Cos_Theta | |
340 | + B*B*Sin_Theta*Sin_Theta) ; | |
341 | Y_1 += Y_center ; | |
342 | Y_2 += Y_center ; | |
343 | if ((P[1]<=Y_1) && (P[1]>=Y_2)) | |
344 | {prinsign=1;} | |
345 | else | |
346 | {prinsign=0;} | |
347 | } | |
348 | return prinsign; | |
349 | } | |
350 | ||
e0ed2e49 | 351 | //____________________________________________________________________________ |
352 | void AliPHOSPIDv1::SetEllipseParameters(Float_t Cluster_En, TString Eff_Pur, Float_t x, Float_t y,Float_t a, Float_t b,Float_t angle) | |
148b2bba | 353 | { |
354 | ||
355 | // Set all ellipse parameters depending on the cluster energy and | |
356 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
357 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
358 | // EFFICIENCY by PURITY) | |
e0ed2e49 | 359 | |
f0a4c9e9 | 360 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
9fa5f1d0 | 361 | GetAnalysisParameters(Cluster_En) ; |
362 | if((fCluster!= -1)&&(eff_pur != -1)){ | |
363 | (*fParameters)(fCluster+6 +fMatrixExtraRow,eff_pur) = x ; | |
364 | (*fParameters)(fCluster+9 +fMatrixExtraRow,eff_pur) = y ; | |
365 | (*fParameters)(fCluster+12+fMatrixExtraRow,eff_pur) = a ; | |
366 | (*fParameters)(fCluster+15+fMatrixExtraRow,eff_pur) = b ; | |
367 | (*fParameters)(fCluster+18+fMatrixExtraRow,eff_pur) = angle ; | |
148b2bba | 368 | } |
f0a4c9e9 | 369 | |
148b2bba | 370 | } |
371 | //__________________________________________________________________________ | |
372 | void AliPHOSPIDv1::SetEllipseXCenter(Float_t Cluster_En, TString Eff_Pur, Float_t x) | |
373 | { | |
374 | // Set the ellipse parameter x_center depending on the custer energy and | |
375 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
376 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
377 | // EFFICIENCY by PURITY) | |
f0a4c9e9 | 378 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
9fa5f1d0 | 379 | GetAnalysisParameters(Cluster_En) ; |
380 | if((fCluster!= -1)&&(eff_pur != -1)) | |
381 | (*fParameters)(fCluster+6+fMatrixExtraRow,eff_pur) = x ; | |
148b2bba | 382 | } |
383 | //_________________________________________________________________________ | |
384 | void AliPHOSPIDv1::SetEllipseYCenter(Float_t Cluster_En, TString Eff_Pur, Float_t y) | |
385 | { | |
386 | ||
387 | // Set the ellipse parameter y_center depending on the cluster energy and | |
388 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
389 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
390 | // EFFICIENCY by PURITY) | |
9fa5f1d0 | 391 | |
f0a4c9e9 | 392 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
9fa5f1d0 | 393 | GetAnalysisParameters(Cluster_En) ; |
394 | if((fCluster!= -1)&&(eff_pur != -1)) | |
395 | (*fParameters)(fCluster+9+fMatrixExtraRow,eff_pur) = y ; | |
148b2bba | 396 | } |
397 | //_________________________________________________________________________ | |
398 | void AliPHOSPIDv1::SetEllipseAParameter(Float_t Cluster_En, TString Eff_Pur, Float_t a) | |
399 | { | |
400 | // Set the ellipse parameter a depending on the cluster energy and | |
401 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
402 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
403 | // EFFICIENCY by PURITY) | |
f0a4c9e9 | 404 | |
f0a4c9e9 | 405 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
9fa5f1d0 | 406 | GetAnalysisParameters(Cluster_En) ; |
407 | if((fCluster!= -1)&&(eff_pur != -1)) | |
408 | (*fParameters)(fCluster+12+fMatrixExtraRow,eff_pur) = a ; | |
148b2bba | 409 | } |
410 | //________________________________________________________________________ | |
411 | void AliPHOSPIDv1::SetEllipseBParameter(Float_t Cluster_En, TString Eff_Pur, Float_t b) | |
412 | { | |
413 | // Set the ellipse parameter b depending on the cluster energy and | |
414 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
415 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
416 | // EFFICIENCY by PURITY) | |
148b2bba | 417 | |
f0a4c9e9 | 418 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
9fa5f1d0 | 419 | GetAnalysisParameters(Cluster_En) ; |
420 | if((fCluster!= -1)&&(eff_pur != -1)) | |
421 | (*fParameters)(fCluster+15+fMatrixExtraRow,eff_pur) = b ; | |
148b2bba | 422 | } |
423 | //________________________________________________________________________ | |
424 | void AliPHOSPIDv1::SetEllipseAngle(Float_t Cluster_En, TString Eff_Pur, Float_t angle) | |
425 | { | |
426 | ||
427 | // Set the ellipse parameter angle depending on the cluster energy and | |
428 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
429 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
430 | // EFFICIENCY by PURITY) | |
f0a4c9e9 | 431 | |
f0a4c9e9 | 432 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
9fa5f1d0 | 433 | GetAnalysisParameters(Cluster_En) ; |
434 | if((fCluster!= -1)&&(eff_pur != -1)) | |
435 | (*fParameters)(fCluster+18+fMatrixExtraRow,eff_pur) = angle ; | |
148b2bba | 436 | } |
437 | //_____________________________________________________________________________ | |
438 | void AliPHOSPIDv1::SetCpvtoEmcDistanceCut(Float_t Cluster_En, TString Eff_Pur, Float_t cut) | |
439 | { | |
440 | ||
441 | // Set the parameter Cpvto EmcDistanceCut depending on the cluster energy and | |
442 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
443 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
444 | // EFFICIENCY by PURITY) | |
445 | ||
92f521a9 | 446 | |
9fa5f1d0 | 447 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
448 | GetAnalysisParameters(Cluster_En) ; | |
449 | if((fClusterrcpv!= -1)&&(eff_pur != -1)) | |
450 | (*fParameters)(fClusterrcpv,eff_pur) = cut ; | |
f0a4c9e9 | 451 | } |
452 | //_____________________________________________________________________________ | |
453 | void AliPHOSPIDv1::SetTimeGate(Float_t Cluster_En, TString Eff_Pur, Float_t gate) | |
454 | { | |
a496c46c | 455 | |
f0a4c9e9 | 456 | // Set the parameter TimeGate depending on the cluster energy and |
457 | // Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
458 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing | |
459 | // EFFICIENCY by PURITY) | |
460 | ||
f0a4c9e9 | 461 | Int_t eff_pur = GetEffPurOption(Eff_Pur); |
9fa5f1d0 | 462 | GetAnalysisParameters(Cluster_En) ; |
463 | if((fCluster!= -1)&&(eff_pur != -1)) | |
464 | (*fParameters)(fCluster+3+fMatrixExtraRow,eff_pur) = gate ; | |
f0a4c9e9 | 465 | } |
a496c46c | 466 | //_____________________________________________________________________________ |
9fa5f1d0 | 467 | void AliPHOSPIDv1::SetParameters() |
468 | //TString OptFileName) | |
a496c46c | 469 | { |
470 | // PCA : To do the Principal Components Analysis it is necessary | |
471 | // the Principal file, which is opened here | |
472 | fX = new double[7]; // Data for the PCA | |
f0a4c9e9 | 473 | fP = new double[7]; // Eigenvalues of the PCA |
e0ed2e49 | 474 | |
f0a4c9e9 | 475 | |
9fa5f1d0 | 476 | // Set the principal and parameters files to be used |
477 | fFileName5 = "$ALICE_ROOT/PHOS/PCA8pa15_0.5-5.root" ; | |
478 | fFileNamePar5 = gSystem->ExpandPathName("$ALICE_ROOT/PHOS/Parameters_0.5_5.dat"); | |
479 | fFileName100 = "$ALICE_ROOT/PHOS/PCA8pa15_0.5-100.root" ; | |
480 | fFileNamePar100 = gSystem->ExpandPathName("$ALICE_ROOT/PHOS/Parameters_0.5_100.dat"); | |
481 | ||
482 | //SetPrincipalFileOptions(); | |
483 | //fOptFileName); | |
484 | TFile f5( fFileName5.Data(), "read" ) ; | |
485 | fPrincipal5 = dynamic_cast<TPrincipal*> (f5.Get("principal")) ; | |
486 | f5.Close() ; | |
487 | TFile f100( fFileName100.Data(), "read" ) ; | |
488 | fPrincipal100 = dynamic_cast<TPrincipal*> (f100.Get("principal")) ; | |
489 | f100.Close() ; | |
490 | TFile f( fFileName100.Data(), "read" ) ; | |
a496c46c | 491 | fPrincipal = dynamic_cast<TPrincipal*> (f.Get("principal")) ; |
492 | f.Close() ; | |
9fa5f1d0 | 493 | // Initialization of the Parameters matrix. In the File ParametersXX.dat |
494 | // are all the parameters. These are introduced in a matrix of 21x3 or 22x3 | |
495 | // elements (depending on the principal file 21 rows for 0.5-5 GeV and 22 | |
496 | // rows for 5-100). | |
a496c46c | 497 | // All the parameters defined in this file are, in order of row (there are |
9fa5f1d0 | 498 | // 3 rows per parameter): CpvtoEmcDistanceCut(if the principal file is 5-100 |
499 | // GeV then 4 rows), TimeGate and the ellipse parameters, X_center, Y_center, | |
f0a4c9e9 | 500 | // a, b, angle. Each row of a given parameter depends on the cluster energy range |
501 | // (wich depends on the chosen principal file) | |
9fa5f1d0 | 502 | // Each column designs the parameters for a point in the Efficiency-Purity |
f0a4c9e9 | 503 | // of the photon identification P1(96%,63%), P2(87%,0.88%) and P3(68%,94%) |
504 | // for the principal file from 0.5-5 GeV and for the other one P1(95%,79%), | |
505 | // P2(89%,90%) and P3(72%,96%) | |
506 | ||
a496c46c | 507 | |
9fa5f1d0 | 508 | fParameters5 = new TMatrixD(21,3) ; |
509 | fParameters100 = new TMatrixD(22,3) ; | |
510 | fParameters = new TMatrixD(22,3) ; | |
511 | ||
512 | ifstream paramFile5(fFileNamePar5, ios::in) ; | |
a496c46c | 513 | |
514 | Int_t i,j ; | |
515 | ||
9fa5f1d0 | 516 | for(i = 0; i< 21; i++){ |
a496c46c | 517 | for(j = 0; j< 3; j++){ |
9fa5f1d0 | 518 | paramFile5 >> (*fParameters5)(i,j) ; |
519 | } | |
520 | } | |
521 | paramFile5.close(); | |
522 | ||
523 | ifstream paramFile100(fFileNamePar100, ios::in) ; | |
524 | ||
525 | Int_t l,k ; | |
526 | ||
527 | for(l = 0; l< 22; l++){ | |
528 | for(k = 0; k< 3; k++){ | |
529 | paramFile100 >> (*fParameters100)(l,k) ; | |
530 | } | |
531 | } | |
532 | paramFile100.close(); | |
533 | ||
534 | ifstream paramFile(fFileNamePar100, ios::in) ; | |
535 | Int_t h,n; | |
536 | for(h = 0; h< 22; h++){ | |
537 | for(n = 0; n< 3; n++){ | |
538 | paramFile >> (*fParameters)(h,n) ; | |
a496c46c | 539 | } |
540 | } | |
9fa5f1d0 | 541 | paramFile.close(); |
542 | ||
543 | fCluster = -1; | |
544 | fClusterrcpv = -1; | |
545 | fMatrixExtraRow = 0; | |
546 | ||
547 | //Calibration parameters Encal = C * E^2 + B * E + A (E is the energy from cluster) | |
548 | fACalParameter = 0.0241 ; | |
549 | fBCalParameter = 1.0504 ; | |
550 | fCCalParameter = 0.000249 ; | |
551 | ||
f0a4c9e9 | 552 | // fParameters->Print(); |
a496c46c | 553 | } |
148b2bba | 554 | //_____________________________________________________________________________ |
9fa5f1d0 | 555 | void AliPHOSPIDv1::GetAnalysisParameters(Float_t Cluster_En) |
556 | { | |
557 | if(Cluster_En <= 5.){ | |
558 | fPrincipal = fPrincipal5; | |
559 | fParameters = fParameters5; | |
560 | fMatrixExtraRow = 0; | |
561 | GetClusterOption(Cluster_En,kFALSE) ; | |
562 | } | |
563 | else{ | |
564 | fPrincipal = fPrincipal100; | |
565 | fParameters = fParameters100; | |
566 | fMatrixExtraRow = 1; | |
567 | GetClusterOption(Cluster_En,kTRUE) ; | |
568 | } | |
569 | } | |
570 | ||
571 | //_____________________________________________________________________________ | |
572 | void AliPHOSPIDv1::GetClusterOption(const Float_t Cluster_En, const Bool_t range) | |
148b2bba | 573 | { |
574 | ||
f0a4c9e9 | 575 | // Gives the cluster energy range. |
9fa5f1d0 | 576 | // range = kFALSE Default analisys range from 0.5 to 5 GeV |
577 | // range = kTRUE analysis range from 0.5 to 100 GeV | |
578 | ||
f0a4c9e9 | 579 | |
9fa5f1d0 | 580 | //Int_t cluster = -1 ; |
f0a4c9e9 | 581 | |
9fa5f1d0 | 582 | if((range == kFALSE)){ |
583 | if((Cluster_En > 0.3)&&(Cluster_En <= 1.0)){ | |
584 | fCluster = 0 ; | |
585 | fClusterrcpv = 0 ; | |
586 | } | |
587 | if((Cluster_En > 1.0)&&(Cluster_En <= 2.0)){ | |
588 | fCluster = 1 ; | |
589 | fClusterrcpv = 1 ; | |
590 | } | |
591 | if( Cluster_En > 2.0){ | |
592 | fCluster = 2 ; | |
593 | fClusterrcpv = 2 ; | |
594 | } | |
f0a4c9e9 | 595 | } |
9fa5f1d0 | 596 | else if(range == kTRUE){ |
597 | if((Cluster_En > 0.5 )&&(Cluster_En <= 20.0)) fCluster = 0 ; | |
598 | if((Cluster_En > 20.0)&&(Cluster_En <= 50.0)) fCluster = 1 ; | |
599 | if( Cluster_En > 50.0) fCluster = 2 ; | |
600 | if((Cluster_En > 5.0 )&&(Cluster_En <= 10.0)) fClusterrcpv = 0 ; | |
601 | if((Cluster_En > 10.0)&&(Cluster_En <= 20.0)) fClusterrcpv = 1 ; | |
602 | if((Cluster_En > 20.0)&&(Cluster_En <= 30.0)) fClusterrcpv = 2 ; | |
603 | if( Cluster_En > 30.0) fClusterrcpv = 3 ; | |
f0a4c9e9 | 604 | } |
605 | else { | |
9fa5f1d0 | 606 | fCluster = -1 ; |
607 | fClusterrcpv = -1; | |
f0a4c9e9 | 608 | cout<<"Invalid Energy option"<<endl; |
609 | } | |
610 | ||
9fa5f1d0 | 611 | //return cluster; |
f0a4c9e9 | 612 | } |
613 | //____________________________________________________________________________ | |
614 | Int_t AliPHOSPIDv1::GetEffPurOption(const TString Eff_Pur) const | |
615 | { | |
616 | ||
617 | // Looks for the Purity-Efficiency point (possible options "HIGH EFFICIENCY" | |
148b2bba | 618 | // "MEDIUM EFFICIENCY" "LOW EFFICIENCY" and 3 more options changing |
619 | // EFFICIENCY by PURITY) | |
620 | ||
148b2bba | 621 | Int_t eff_pur = -1 ; |
622 | ||
f0a4c9e9 | 623 | if(Eff_Pur.Contains("HIGH EFFICIENCY") ||Eff_Pur.Contains("LOW PURITY") ) |
624 | eff_pur = 0 ; | |
625 | else if(Eff_Pur.Contains("MEDIUM EFFICIENCY") ||Eff_Pur.Contains("MEDIUM PURITY") ) | |
626 | eff_pur = 1 ; | |
627 | else if(Eff_Pur.Contains("LOW EFFICIENCY")||Eff_Pur.Contains("HIGH PURITY") ) | |
628 | eff_pur = 2 ; | |
148b2bba | 629 | else{ |
f0a4c9e9 | 630 | eff_pur = -1; |
631 | cout<<"Invalid Efficiency-Purity option"<<endl; | |
632 | cout<<"Possible options: HIGH EFFICIENCY = LOW PURITY"<<endl; | |
633 | cout<<" MEDIUM EFFICIENCY = MEDIUM PURITY"<<endl; | |
634 | cout<<" LOW EFFICIENCY = HIGH PURITY"<<endl; | |
148b2bba | 635 | } |
f0a4c9e9 | 636 | |
637 | return eff_pur; | |
638 | } | |
148b2bba | 639 | //____________________________________________________________________________ |
640 | ||
7acf6008 | 641 | void AliPHOSPIDv1::Exec(Option_t * option) |
6ad0bfa0 | 642 | { |
f035f6ce | 643 | //Steering method |
9688c1dd | 644 | |
bf8f1fbd | 645 | if( strcmp(GetName(), "")== 0 ) |
7acf6008 | 646 | Init() ; |
bf8f1fbd | 647 | |
648 | if(strstr(option,"tim")) | |
7acf6008 | 649 | gBenchmark->Start("PHOSPID"); |
bf8f1fbd | 650 | |
651 | if(strstr(option,"print")) { | |
7b7c1533 | 652 | Print("") ; |
653 | return ; | |
bf8f1fbd | 654 | } |
9688c1dd | 655 | |
148b2bba | 656 | //cout << gDirectory->GetName() << endl ; |
657 | ||
bf8f1fbd | 658 | gAlice->GetEvent(0) ; |
148b2bba | 659 | |
7b7c1533 | 660 | //check, if the branch with name of this" already exits? |
8d0f3f77 | 661 | if (gAlice->TreeR()) { |
662 | TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ; | |
663 | TIter next(lob) ; | |
664 | TBranch * branch = 0 ; | |
665 | Bool_t phospidfound = kFALSE, pidfound = kFALSE ; | |
666 | ||
667 | TString taskName(GetName()) ; | |
668 | taskName.Remove(taskName.Index(Version())-1) ; | |
669 | ||
670 | while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) { | |
671 | if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) | |
672 | phospidfound = kTRUE ; | |
673 | ||
674 | else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) | |
675 | pidfound = kTRUE ; | |
676 | } | |
7b7c1533 | 677 | |
8d0f3f77 | 678 | if ( phospidfound || pidfound ) { |
679 | cerr << "WARNING: AliPHOSPIDv1::Exec -> RecParticles and/or PIDtMaker branch with name " | |
680 | << taskName.Data() << " already exits" << endl ; | |
681 | return ; | |
682 | } | |
7b7c1533 | 683 | } |
9688c1dd | 684 | |
7b7c1533 | 685 | Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ; |
686 | Int_t ievent ; | |
148b2bba | 687 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; |
7b7c1533 | 688 | for(ievent = 0; ievent < nevents; ievent++){ |
a496c46c | 689 | gime->Event(ievent,"R") ; |
148b2bba | 690 | |
7acf6008 | 691 | MakeRecParticles() ; |
9688c1dd | 692 | |
7b7c1533 | 693 | WriteRecParticles(ievent); |
9688c1dd | 694 | |
7acf6008 | 695 | if(strstr(option,"deb")) |
696 | PrintRecParticles(option) ; | |
94de8339 | 697 | |
698 | //increment the total number of rec particles per run | |
a496c46c | 699 | fRecParticlesInRun += gime->RecParticles(BranchName())->GetEntriesFast() ; |
94de8339 | 700 | |
7acf6008 | 701 | } |
9688c1dd | 702 | |
7acf6008 | 703 | if(strstr(option,"tim")){ |
704 | gBenchmark->Stop("PHOSPID"); | |
705 | cout << "AliPHOSPID:" << endl ; | |
706 | cout << " took " << gBenchmark->GetCpuTime("PHOSPID") << " seconds for PID " | |
7b7c1533 | 707 | << gBenchmark->GetCpuTime("PHOSPID")/nevents << " seconds per event " << endl ; |
7acf6008 | 708 | cout << endl ; |
709 | } | |
9688c1dd | 710 | |
7b7c1533 | 711 | } |
712 | ||
7acf6008 | 713 | //____________________________________________________________________________ |
714 | void AliPHOSPIDv1::MakeRecParticles(){ | |
715 | ||
b2a60966 | 716 | // Makes a RecParticle out of a TrackSegment |
148b2bba | 717 | |
7b7c1533 | 718 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; |
148b2bba | 719 | TObjArray * emcRecPoints = gime->EmcRecPoints(fFrom) ; |
720 | TObjArray * cpvRecPoints = gime->CpvRecPoints(fFrom) ; | |
721 | TClonesArray * trackSegments = gime->TrackSegments(fFrom) ; | |
722 | if ( !emcRecPoints || !cpvRecPoints || !trackSegments ) { | |
723 | cerr << "ERROR: AliPHOSPIDv1::MakeRecParticles -> RecPoints or TrackSegments with name " | |
724 | << fFrom << " not found ! " << endl ; | |
725 | abort() ; | |
726 | } | |
a496c46c | 727 | TClonesArray * recParticles = gime->RecParticles(BranchName()) ; |
01a599c9 | 728 | recParticles->Clear(); |
148b2bba | 729 | |
730 | ||
7b7c1533 | 731 | TIter next(trackSegments) ; |
7acf6008 | 732 | AliPHOSTrackSegment * ts ; |
6ad0bfa0 | 733 | Int_t index = 0 ; |
09fc14a0 | 734 | AliPHOSRecParticle * rp ; |
7acf6008 | 735 | |
7acf6008 | 736 | while ( (ts = (AliPHOSTrackSegment *)next()) ) { |
fad3e5b9 | 737 | |
7b7c1533 | 738 | new( (*recParticles)[index] ) AliPHOSRecParticle() ; |
739 | rp = (AliPHOSRecParticle *)recParticles->At(index) ; | |
f0a4c9e9 | 740 | rp->SetTrackSegment(index) ; |
9688c1dd | 741 | rp->SetIndexInList(index) ; |
148b2bba | 742 | |
7acf6008 | 743 | AliPHOSEmcRecPoint * emc = 0 ; |
744 | if(ts->GetEmcIndex()>=0) | |
7b7c1533 | 745 | emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ; |
fad3e5b9 | 746 | |
7acf6008 | 747 | AliPHOSRecPoint * cpv = 0 ; |
748 | if(ts->GetCpvIndex()>=0) | |
7b7c1533 | 749 | cpv = (AliPHOSRecPoint *) cpvRecPoints->At(ts->GetCpvIndex()) ; |
fad3e5b9 | 750 | |
148b2bba | 751 | // Now set type (reconstructed) of the particle |
752 | ||
753 | // Choose the cluster energy range | |
9fa5f1d0 | 754 | |
755 | Float_t e = emc->GetEnergy() ; | |
756 | ||
757 | ||
758 | GetAnalysisParameters(e); | |
148b2bba | 759 | |
9fa5f1d0 | 760 | if((fCluster== -1)||(fClusterrcpv == -1)) continue ; |
761 | ||
762 | // Ellipse and rcpv cut in function of the cluster energy | |
763 | ||
148b2bba | 764 | // Loop of Efficiency-Purity (the 3 points of purity or efficiency are taken |
765 | // into account to set the particle identification) | |
766 | for(Int_t eff_pur = 0; eff_pur < 3 ; eff_pur++){ | |
f0a4c9e9 | 767 | |
f0a4c9e9 | 768 | Float_t lambda[2] ; |
f0a4c9e9 | 769 | emc->GetElipsAxis(lambda) ; |
9fa5f1d0 | 770 | Float_t time =emc->GetTime() ; |
f0a4c9e9 | 771 | |
9fa5f1d0 | 772 | if((lambda[0]>0.01) && (lambda[1]>0.01) && time > 0.){ |
773 | ||
774 | // Looking at the CPV detector. If RCPV greater than CpvEmcDistance, 1st, | |
775 | // 2nd or 3rd bit (depending on the efficiency-purity point )is set to 1 . | |
776 | ||
777 | if(GetDistance(emc, cpv, "R") > (*fParameters)(fClusterrcpv,eff_pur) ) | |
778 | rp->SetPIDBit(eff_pur) ; | |
779 | ||
780 | // Looking the TOF. If TOF smaller than gate, 4th, 5th or 6th | |
781 | // bit (depending on the efficiency-purity point )is set to 1 | |
782 | if(time< (*fParameters)(fCluster+3+fMatrixExtraRow,eff_pur)) | |
783 | rp->SetPIDBit(eff_pur+3) ; | |
784 | ||
785 | // Looking PCA. Define and calculate the data (X), introduce in the function | |
786 | // X2P that gives the components (P). | |
787 | Float_t Spher = 0. ; | |
788 | Float_t Emaxdtotal = 0. ; | |
789 | ||
790 | if((lambda[0]+lambda[1])!=0) Spher=fabs(lambda[0]-lambda[1])/(lambda[0]+lambda[1]); | |
791 | ||
792 | Emaxdtotal=emc->GetMaximalEnergy()/emc->GetEnergy(); | |
793 | ||
794 | fX[0] = lambda[0] ; | |
795 | fX[1] = lambda[1] ; | |
796 | fX[2] = emc->GetDispersion() ; | |
797 | fX[3] = Spher ; | |
798 | fX[4] = emc->GetMultiplicity() ; | |
799 | fX[5] = Emaxdtotal ; | |
800 | fX[6] = emc->GetCoreEnergy() ; | |
801 | ||
802 | fPrincipal->X2P(fX,fP); | |
803 | ||
804 | //If we are inside the ellipse, 7th, 8th or 9th | |
805 | // bit (depending on the efficiency-purity point )is set to 1 | |
806 | if(GetPrincipalSign(fP,fCluster+fMatrixExtraRow,eff_pur) == 1) | |
807 | rp->SetPIDBit(eff_pur+6) ; | |
808 | ||
809 | } | |
f0a4c9e9 | 810 | } |
148b2bba | 811 | |
9fa5f1d0 | 812 | //Set momentum, energy and other parameters |
813 | Float_t encal = CalibratedEnergy(e); | |
814 | TVector3 dir = GetMomentumDirection(emc,cpv) ; | |
815 | dir.SetMag(encal) ; | |
816 | rp->SetMomentum(dir.X(),dir.Y(),dir.Z(),encal) ; | |
817 | rp->SetCalcMass(0); | |
e0ed2e49 | 818 | rp->Name(); //If photon sets the particle pdg name to gamma |
e747b8da | 819 | rp->SetProductionVertex(0,0,0,0); |
820 | rp->SetFirstMother(-1); | |
821 | rp->SetLastMother(-1); | |
822 | rp->SetFirstDaughter(-1); | |
823 | rp->SetLastDaughter(-1); | |
824 | rp->SetPolarisation(0,0,0); | |
6ad0bfa0 | 825 | index++ ; |
826 | } | |
7acf6008 | 827 | |
6ad0bfa0 | 828 | } |
829 | ||
09fc14a0 | 830 | //____________________________________________________________________________ |
a496c46c | 831 | void AliPHOSPIDv1:: Print() |
09fc14a0 | 832 | { |
b2a60966 | 833 | // Print the parameters used for the particle type identification |
f035f6ce | 834 | cout << "=============== AliPHOSPID1 ================" << endl ; |
835 | cout << "Making PID "<< endl ; | |
836 | cout << " Headers file: " << fHeaderFileName.Data() << endl ; | |
837 | cout << " RecPoints branch title: " << fRecPointsTitle.Data() << endl ; | |
7b7c1533 | 838 | cout << " TrackSegments Branch title: " << fTrackSegmentsTitle.Data() << endl ; |
839 | cout << " RecParticles Branch title " << fRecParticlesTitle.Data() << endl; | |
9fa5f1d0 | 840 | |
841 | cout << " Pricipal analysis file from 0.5 to 5 " << fFileName5.Data() << endl; | |
842 | cout << " Name of parameters file "<<fFileNamePar5.Data() << endl ; | |
843 | cout << " Matrix of Parameters: "<<endl; | |
844 | cout << " 3 Columns [High Eff-Low Pur,Medium Eff-Pur, Low Eff-High Pur]"<<endl; | |
845 | cout << " 21 Rows, each 3 [ RCPV, TOF, X_Center, Y_Center, A, B, Angle ]"<<endl; | |
846 | fParameters5->Print() ; | |
847 | ||
848 | cout << " Pricipal analysis file from 5 to 100 " << fFileName100.Data() << endl; | |
849 | cout << " Name of parameters file "<<fFileNamePar100.Data() << endl ; | |
e0ed2e49 | 850 | cout << " Matrix of Parameters: "<<endl; |
851 | cout << " 3 Columns [High Eff-Low Pur,Medium Eff-Pur, Low Eff-High Pur]"<<endl; | |
9fa5f1d0 | 852 | cout << " 22 Rows, [ 4 RCPV, 3 TOF, 3 X_Center, 3 Y_Center, 3 A, 3 B, 3 Angle ]"<<endl; |
853 | fParameters100->Print() ; | |
854 | ||
855 | cout << " Energy Calibration Parameters A + B* E + C * E^2"<<endl; | |
856 | cout << " E is the energy from the cluster "<<endl; | |
857 | cout << " A = "<< fACalParameter << endl; | |
858 | cout << " B = "<< fBCalParameter << endl; | |
859 | cout << " C = "<< fCCalParameter << endl; | |
f035f6ce | 860 | cout << "============================================" << endl ; |
09fc14a0 | 861 | } |
862 | ||
7acf6008 | 863 | //____________________________________________________________________________ |
7b7c1533 | 864 | void AliPHOSPIDv1::WriteRecParticles(Int_t event) |
09fc14a0 | 865 | { |
7b7c1533 | 866 | |
867 | AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; | |
a496c46c | 868 | |
869 | TClonesArray * recParticles = gime->RecParticles(BranchName()) ; | |
bf8f1fbd | 870 | recParticles->Expand(recParticles->GetEntriesFast() ) ; |
8d0f3f77 | 871 | TTree * treeR = gAlice->TreeR() ; |
9688c1dd | 872 | |
8d0f3f77 | 873 | if (!treeR) |
874 | gAlice->MakeTree("R", fSplitFile); | |
875 | treeR = gAlice->TreeR() ; | |
7acf6008 | 876 | |
877 | //First rp | |
878 | Int_t bufferSize = 32000 ; | |
8d0f3f77 | 879 | TBranch * rpBranch = treeR->Branch("PHOSRP",&recParticles,bufferSize); |
bf8f1fbd | 880 | rpBranch->SetTitle(fRecParticlesTitle); |
8d0f3f77 | 881 | |
9688c1dd | 882 | |
7acf6008 | 883 | //second, pid |
884 | Int_t splitlevel = 0 ; | |
885 | AliPHOSPIDv1 * pid = this ; | |
8d0f3f77 | 886 | TBranch * pidBranch = treeR->Branch("AliPHOSPID","AliPHOSPIDv1",&pid,bufferSize,splitlevel); |
9688c1dd | 887 | pidBranch->SetTitle(fRecParticlesTitle.Data()); |
7acf6008 | 888 | |
761e34c0 | 889 | rpBranch->Fill() ; |
a496c46c | 890 | pidBranch->Fill() ; |
9688c1dd | 891 | |
8d0f3f77 | 892 | gAlice->TreeR()->AutoSave() ;// Write(0,kOverwrite) ; |
7b7c1533 | 893 | |
7acf6008 | 894 | } |
69183710 | 895 | |
7acf6008 | 896 | //____________________________________________________________________________ |
9688c1dd | 897 | TVector3 AliPHOSPIDv1::GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv)const |
7acf6008 | 898 | { |
899 | // Calculates the momentum direction: | |
900 | // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint | |
9688c1dd | 901 | // 2. if a EMC RecPoint and CPV RecPoint, direction is given by the line through the 2 recpoints |
902 | // However because of the poor position resolution of PPSD the direction is always taken as if we were | |
7acf6008 | 903 | // in case 1. |
904 | ||
905 | TVector3 dir(0,0,0) ; | |
906 | ||
907 | TVector3 emcglobalpos ; | |
908 | TMatrix dummy ; | |
909 | ||
910 | emc->GetGlobalPosition(emcglobalpos, dummy) ; | |
911 | ||
148b2bba | 912 | |
7acf6008 | 913 | dir = emcglobalpos ; |
914 | dir.SetZ( -dir.Z() ) ; // why ? | |
915 | dir.SetMag(1.) ; | |
916 | ||
917 | //account correction to the position of IP | |
918 | Float_t xo,yo,zo ; //Coordinates of the origin | |
919 | gAlice->Generator()->GetOrigin(xo,yo,zo) ; | |
920 | TVector3 origin(xo,yo,zo); | |
921 | dir = dir - origin ; | |
922 | ||
923 | return dir ; | |
924 | } | |
925 | //____________________________________________________________________________ | |
a4e98857 | 926 | void AliPHOSPIDv1::PrintRecParticles(Option_t * option) |
927 | { | |
dd5c4038 | 928 | // Print table of reconstructed particles |
929 | ||
7b7c1533 | 930 | AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; |
bf8f1fbd | 931 | |
a496c46c | 932 | TClonesArray * recParticles = gime->RecParticles(BranchName()) ; |
9688c1dd | 933 | |
01a599c9 | 934 | cout << "AliPHOSPIDv1: event "<<gAlice->GetEvNumber() << endl ; |
7b7c1533 | 935 | cout << " found " << recParticles->GetEntriesFast() << " RecParticles " << endl ; |
9688c1dd | 936 | |
7acf6008 | 937 | if(strstr(option,"all")) { // printing found TS |
938 | ||
e0ed2e49 | 939 | cout << " PARTICLE " |
7acf6008 | 940 | << " Index " << endl ; |
7acf6008 | 941 | |
942 | Int_t index ; | |
7b7c1533 | 943 | for (index = 0 ; index < recParticles->GetEntries() ; index++) { |
148b2bba | 944 | AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) recParticles->At(index) ; |
e0ed2e49 | 945 | |
946 | cout << setw(10) << rp->Name() << " " | |
947 | << setw(5) << rp->GetIndexInList() << " " <<endl; | |
948 | cout << "Type "<< rp->GetType() << endl; | |
7acf6008 | 949 | } |
950 | cout << "-------------------------------------------" << endl ; | |
951 | } | |
952 | ||
69183710 | 953 | } |
954 | ||
7acf6008 | 955 | |
956 |