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