]>
Commit | Line | Data |
---|---|---|
b91d88dc | 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 | ||
16 | /* $Id$ */ | |
17 | ||
702ab87e | 18 | /* History of cvs commits: |
19 | * | |
20 | * $Log$ | |
3f7dbdb7 | 21 | * Revision 1.13 2005/05/28 14:19:04 schutz |
22 | * Compilation warnings fixed by T.P. | |
23 | * | |
702ab87e | 24 | */ |
25 | ||
b91d88dc | 26 | //_________________________________________________________________________ |
27 | // Implementation version v0 of the PHOS particle identifier | |
28 | // Particle identification based on the | |
29 | // - CPV information, | |
30 | // - Preshower information (in MIXT or GPS2 geometries) | |
31 | // - shower width. | |
32 | // | |
33 | // CPV or Preshower clusters should be closer in PHOS plane than fCpvEmcDistance (in cm). | |
34 | // This parameter can be set by method SetCpvtoEmcDistanceCut(Float_t cut) | |
35 | // | |
36 | // One can set desirable ID method by the function SetIdentificationMethod(option). | |
37 | // Presently the following options can be used together or separately : | |
38 | // - "disp": use dispersion cut on shower width | |
39 | // (width can be set by method SetDispersionCut(Float_t cut) | |
40 | // - "ell" : use cut on the axis of the ellipse, drawn around shower | |
41 | // (this cut can be changed by SetShowerProfileCut(char* formula), | |
42 | // where formula - any function of two variables f(lambda[0],lambda[1]). | |
43 | // Shower is considered as EM if f() > 0 ) | |
44 | // One can visualize current cuts calling method PlotDispersionCuts(). | |
45 | // | |
46 | // use case: | |
47 | // root [0] AliPHOSPIDv0 * p1 = new AliPHOSPIDv0("galice.root") | |
48 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated | |
49 | // root [1] p1->SetIdentificationMethod("disp ellipse") | |
50 | // root [2] p1->ExecuteTask() | |
51 | // root [3] AliPHOSPIDv0 * p2 = new AliPHOSPIDv0("galice1.root","ts1") | |
52 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated | |
53 | // // reading headers from file galice1.root and TrackSegments | |
54 | // // with title "ts1" | |
55 | // root [4] p2->SetRecParticlesBranch("rp1") | |
56 | // // set file name for the branch RecParticles | |
57 | // root [5] p2->ExecuteTask("deb all time") | |
58 | // // available options | |
59 | // // "deb" - prints # of reconstructed particles | |
60 | // // "deb all" - prints # and list of RecParticles | |
61 | // // "time" - prints benchmarking results | |
62 | // | |
63 | //*-- Author: Yves Schutz (SUBATECH) & Gines Martinez (SUBATECH) & | |
64 | // Dmitri Peressounko (SUBATECH & Kurchatov Institute) | |
65 | // Completely redesined by Dmitri Peressounko, March 2001 | |
66 | ||
67 | // --- ROOT system --- | |
b91d88dc | 68 | #include "TTree.h" |
b91d88dc | 69 | #include "TF2.h" |
70 | #include "TFormula.h" | |
71 | #include "TCanvas.h" | |
7f78a025 | 72 | |
b91d88dc | 73 | #include "TBenchmark.h" |
74 | // --- Standard library --- | |
75 | ||
b91d88dc | 76 | // --- AliRoot header files --- |
351dd634 | 77 | #include "AliLog.h" |
88cb7938 | 78 | #include "AliRun.h" |
b91d88dc | 79 | #include "AliGenerator.h" |
b91d88dc | 80 | #include "AliPHOSPIDv0.h" |
e957fea8 | 81 | #include "AliPHOSEmcRecPoint.h" |
b91d88dc | 82 | #include "AliPHOSTrackSegment.h" |
b91d88dc | 83 | #include "AliPHOSRecParticle.h" |
84 | #include "AliPHOSGeometry.h" | |
88cb7938 | 85 | #include "AliPHOSLoader.h" |
b91d88dc | 86 | |
87 | ClassImp( AliPHOSPIDv0) | |
88 | ||
89 | //____________________________________________________________________________ | |
3f7dbdb7 | 90 | AliPHOSPIDv0::AliPHOSPIDv0(): |
91 | fTrackSegmentsTitle(""), | |
92 | fRecPointsTitle(""), | |
93 | fRecParticlesTitle(""), | |
94 | fIDOptions("dis time"), | |
95 | fNEvent(0), | |
96 | fClusterizer(0), | |
97 | fTSMaker(0), | |
98 | fFormula(0), | |
99 | fDispersion(0.f), | |
100 | fCpvEmcDistance(0.f), | |
101 | fTimeGate(2.e-9f), | |
102 | fRecParticlesInRun(0) | |
b91d88dc | 103 | { |
104 | // default ctor | |
3f7dbdb7 | 105 | fEventFolderName = ""; |
b91d88dc | 106 | } |
107 | ||
108 | //____________________________________________________________________________ | |
3f7dbdb7 | 109 | AliPHOSPIDv0::AliPHOSPIDv0(const char * evFolderName,const char * name) : |
110 | AliPHOSPID(evFolderName, name), | |
111 | fTrackSegmentsTitle(GetName()), | |
112 | fRecPointsTitle(GetName()), | |
113 | fRecParticlesTitle(GetName()), | |
114 | fIDOptions("dis time"), | |
115 | fNEvent(0), | |
116 | fClusterizer(0), | |
117 | fTSMaker(0), | |
118 | fFormula(new TFormula("LambdaCuts","(x>1)*(x<2.5)*(y>0)*(y<x)")), | |
119 | fDispersion(2.f), | |
120 | fCpvEmcDistance(3.f), | |
121 | fTimeGate(2.e-9f), | |
122 | fRecParticlesInRun(0) | |
b91d88dc | 123 | { |
124 | //ctor with the indication on where to look for the track segments | |
3f7dbdb7 | 125 | fEventFolderName = GetTitle() ; |
b91d88dc | 126 | Init() ; |
3f7dbdb7 | 127 | } |
b91d88dc | 128 | |
3f7dbdb7 | 129 | //____________________________________________________________________________ |
130 | AliPHOSPIDv0::AliPHOSPIDv0(const AliPHOSPIDv0 & rhs) : | |
131 | AliPHOSPID(rhs), | |
132 | fTrackSegmentsTitle(rhs.fTrackSegmentsTitle), | |
133 | fRecPointsTitle(rhs.fRecPointsTitle), | |
134 | fRecParticlesTitle(rhs.fRecParticlesTitle), | |
135 | fIDOptions(rhs.fIDOptions), | |
136 | fNEvent(rhs.fNEvent), | |
137 | fClusterizer(rhs.fClusterizer), | |
138 | fTSMaker(rhs.fTSMaker), | |
139 | fFormula(rhs.fFormula), | |
140 | fDispersion(rhs.fDispersion), | |
141 | fCpvEmcDistance(rhs.fCpvEmcDistance), | |
142 | fTimeGate(rhs.fTimeGate), | |
143 | fRecParticlesInRun(rhs.fRecParticlesInRun) | |
144 | { | |
145 | //Copy ctor, the same as compiler-generated, possibly wrong if | |
146 | //someone implements dtor correctly. | |
147 | } | |
148 | ||
149 | //____________________________________________________________________________ | |
150 | AliPHOSPIDv0 & AliPHOSPIDv0::operator = (const AliPHOSPIDv0 & rhs) | |
151 | { | |
152 | //Copy-assignment, emulates compiler generated, possibly wrong. | |
153 | AliPHOSPID::operator = (rhs); | |
154 | fTrackSegmentsTitle = rhs.fTrackSegmentsTitle; | |
155 | fRecPointsTitle = rhs.fRecPointsTitle; | |
156 | fRecParticlesTitle = rhs.fRecParticlesTitle; | |
157 | fIDOptions = rhs.fIDOptions; | |
158 | fNEvent = rhs.fNEvent; | |
159 | fClusterizer = rhs.fClusterizer; | |
160 | fTSMaker = rhs.fTSMaker; | |
161 | fFormula = rhs.fFormula; | |
162 | fDispersion = rhs.fDispersion; | |
163 | fCpvEmcDistance = rhs.fCpvEmcDistance; | |
164 | fTimeGate = rhs.fTimeGate; | |
165 | fRecParticlesInRun = rhs.fRecParticlesInRun; | |
166 | ||
167 | return *this; | |
b91d88dc | 168 | } |
169 | ||
170 | //____________________________________________________________________________ | |
171 | AliPHOSPIDv0::~AliPHOSPIDv0() | |
3f7dbdb7 | 172 | { |
173 | //Empty dtor, fFormula leaks | |
b91d88dc | 174 | } |
175 | ||
b91d88dc | 176 | //____________________________________________________________________________ |
177 | Float_t AliPHOSPIDv0::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Option_t * Axis)const | |
178 | { | |
179 | // Calculates the distance between the EMC RecPoint and the PPSD RecPoint | |
180 | ||
88cb7938 | 181 | const AliPHOSGeometry * geom = AliPHOSLoader::GetPHOSGeometry() ; |
b91d88dc | 182 | TVector3 vecEmc ; |
183 | TVector3 vecCpv ; | |
184 | ||
185 | emc->GetLocalPosition(vecEmc) ; | |
186 | cpv->GetLocalPosition(vecCpv) ; | |
187 | if(emc->GetPHOSMod() == cpv->GetPHOSMod()){ | |
188 | ||
189 | // Correct to difference in CPV and EMC position due to different distance to center. | |
190 | // we assume, that particle moves from center | |
191 | Float_t dCPV = geom->GetIPtoOuterCoverDistance(); | |
192 | Float_t dEMC = geom->GetIPtoCrystalSurface() ; | |
193 | dEMC = dEMC / dCPV ; | |
194 | vecCpv = dEMC * vecCpv - vecEmc ; | |
195 | if (Axis == "X") return vecCpv.X(); | |
196 | if (Axis == "Y") return vecCpv.Y(); | |
197 | if (Axis == "Z") return vecCpv.Z(); | |
198 | if (Axis == "R") return vecCpv.Mag(); | |
199 | } | |
200 | ||
201 | return 100000000 ; | |
202 | } | |
203 | ||
204 | //____________________________________________________________________________ | |
205 | void AliPHOSPIDv0::Exec(Option_t * option) | |
206 | { | |
207 | //Steering method | |
208 | ||
209 | if( strcmp(GetName(), "")== 0 ) | |
210 | Init() ; | |
211 | ||
212 | if(strstr(option,"tim")) | |
213 | gBenchmark->Start("PHOSPID"); | |
214 | ||
215 | if(strstr(option,"print")) { | |
88cb7938 | 216 | Print() ; |
b91d88dc | 217 | return ; |
218 | } | |
219 | ||
88cb7938 | 220 | AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); |
221 | if(runget == 0x0) | |
222 | { | |
351dd634 | 223 | AliError(Form("Can not find run getter in event folder \"%s\"", |
224 | GetTitle())); | |
88cb7938 | 225 | return; |
226 | } | |
227 | ||
228 | AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader")); | |
229 | if ( gime == 0 ) | |
230 | { | |
351dd634 | 231 | AliError("Could not obtain the Loader object !"); |
88cb7938 | 232 | return ; |
233 | } | |
234 | ||
fbf811ec | 235 | if(gime->BranchExists("RecParticles") ) |
236 | return ; | |
237 | ||
b91d88dc | 238 | |
88cb7938 | 239 | Int_t nevents = runget->GetNumberOfEvents() ; //(Int_t) gAlice->TreeE()->GetEntries() ; |
b91d88dc | 240 | |
b91d88dc | 241 | Int_t ievent ; |
b91d88dc | 242 | |
243 | for(ievent = 0; ievent < nevents; ievent++){ | |
88cb7938 | 244 | runget->GetEvent(ievent); |
351dd634 | 245 | AliInfo(Form("event %d %d %d", |
246 | ievent, gime->EmcRecPoints(), | |
247 | gime->TrackSegments())) ; | |
b91d88dc | 248 | MakeRecParticles() ; |
249 | ||
88cb7938 | 250 | WriteRecParticles(); |
b91d88dc | 251 | |
252 | if(strstr(option,"deb")) | |
253 | PrintRecParticles(option) ; | |
254 | ||
255 | //increment the total number of rec particles per run | |
256 | fRecParticlesInRun += gime->RecParticles()->GetEntriesFast() ; | |
257 | ||
258 | } | |
259 | ||
260 | if(strstr(option,"tim")){ | |
261 | gBenchmark->Stop("PHOSPID"); | |
351dd634 | 262 | AliInfo(Form("took %f seconds for PID %f seconds per event", |
263 | gBenchmark->GetCpuTime("PHOSPID"), | |
264 | gBenchmark->GetCpuTime("PHOSPID")/nevents)) ; | |
b91d88dc | 265 | } |
266 | ||
267 | } | |
268 | //____________________________________________________________________________ | |
269 | void AliPHOSPIDv0::Init() | |
270 | { | |
271 | // Make all memory allocations that are not possible in default constructor | |
272 | // Add the PID task to the list of PHOS tasks | |
273 | ||
88cb7938 | 274 | AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); |
275 | if(runget == 0x0) | |
276 | { | |
351dd634 | 277 | AliError(Form("Can not find run getter in event folder \"%s\"", |
278 | GetTitle())); | |
88cb7938 | 279 | return; |
280 | } | |
b91d88dc | 281 | |
88cb7938 | 282 | AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader")); |
283 | if ( gime == 0 ) | |
284 | { | |
351dd634 | 285 | AliError("Could not obtain the Loader object !"); |
88cb7938 | 286 | return ; |
287 | } | |
b91d88dc | 288 | |
88cb7938 | 289 | gime->PostPID(this); |
290 | gime->LoadRecParticles("UPDATE"); | |
b91d88dc | 291 | |
292 | } | |
293 | ||
294 | //____________________________________________________________________________ | |
7f78a025 | 295 | void AliPHOSPIDv0::MakeRecParticles() |
296 | { | |
297 | // Reconstructs the particles from the tracksegments | |
b91d88dc | 298 | |
b91d88dc | 299 | TString taskName(GetName()) ; |
300 | taskName.Remove(taskName.Index(Version())-1) ; | |
301 | ||
88cb7938 | 302 | AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); |
303 | if(runget == 0x0) | |
304 | { | |
351dd634 | 305 | AliError(Form("Can not find run getter in event folder \"%s\"", |
306 | GetTitle())); | |
88cb7938 | 307 | return; |
308 | } | |
309 | ||
310 | AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader")); | |
311 | if ( gime == 0 ) | |
312 | { | |
351dd634 | 313 | AliError("Could not obtain the Loader object !"); |
88cb7938 | 314 | return ; |
315 | } | |
316 | ||
317 | TObjArray * emcRecPoints = gime->EmcRecPoints() ; | |
318 | TObjArray * cpvRecPoints = gime->CpvRecPoints() ; | |
319 | TClonesArray * trackSegments = gime->TrackSegments() ; | |
320 | TClonesArray * recParticles = gime->RecParticles() ; | |
321 | ||
b91d88dc | 322 | recParticles->Clear(); |
323 | ||
324 | TIter next(trackSegments) ; | |
325 | AliPHOSTrackSegment * ts ; | |
326 | Int_t index = 0 ; | |
327 | AliPHOSRecParticle * rp ; | |
328 | ||
329 | Bool_t ellips = fIDOptions.Contains("ell",TString::kIgnoreCase ) ; | |
330 | Bool_t disp = fIDOptions.Contains("dis",TString::kIgnoreCase ) ; | |
331 | Bool_t time = fIDOptions.Contains("tim",TString::kIgnoreCase ) ; | |
332 | ||
333 | while ( (ts = (AliPHOSTrackSegment *)next()) ) { | |
334 | ||
335 | new( (*recParticles)[index] ) AliPHOSRecParticle() ; | |
336 | rp = (AliPHOSRecParticle *)recParticles->At(index) ; | |
a278df55 | 337 | rp->SetTrackSegment(index) ; |
b91d88dc | 338 | rp->SetIndexInList(index) ; |
339 | ||
340 | AliPHOSEmcRecPoint * emc = 0 ; | |
341 | if(ts->GetEmcIndex()>=0) | |
342 | emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ; | |
343 | ||
344 | AliPHOSRecPoint * cpv = 0 ; | |
345 | if(ts->GetCpvIndex()>=0) | |
346 | cpv = (AliPHOSRecPoint *) cpvRecPoints->At(ts->GetCpvIndex()) ; | |
347 | ||
348 | //set momentum and energy first | |
349 | Float_t e = emc->GetEnergy() ; | |
350 | TVector3 dir = GetMomentumDirection(emc,cpv) ; | |
351 | dir.SetMag(e) ; | |
352 | ||
353 | rp->SetMomentum(dir.X(),dir.Y(),dir.Z(),e) ; | |
354 | rp->SetCalcMass(0); | |
355 | ||
356 | //now set type (reconstructed) of the particle | |
357 | Int_t showerprofile = 0; // 0 narrow and 1 wide | |
358 | ||
359 | if(ellips){ | |
360 | Float_t lambda[2] ; | |
361 | emc->GetElipsAxis(lambda) ; | |
362 | if(fFormula->Eval(lambda[0],lambda[1]) <= 0 ) | |
363 | showerprofile = 1 ; // not narrow | |
364 | } | |
365 | ||
366 | if(disp) | |
367 | if(emc->GetDispersion() > fDispersion ) | |
368 | showerprofile = 1 ; // not narrow | |
369 | ||
370 | Int_t slow = 0 ; | |
371 | if(time) | |
372 | if(emc->GetTime() > fTimeGate ) | |
373 | slow = 0 ; | |
374 | ||
375 | // Looking at the CPV detector | |
376 | Int_t cpvdetector= 0 ; //1 hit and 0 no hit | |
377 | if(cpv) | |
378 | if(GetDistance(emc, cpv, "R") < fCpvEmcDistance) | |
379 | cpvdetector = 1 ; | |
380 | ||
381 | Int_t type = showerprofile + 2 * slow + 4 * cpvdetector ; | |
382 | rp->SetType(type) ; | |
383 | rp->SetProductionVertex(0,0,0,0); | |
384 | rp->SetFirstMother(-1); | |
385 | rp->SetLastMother(-1); | |
386 | rp->SetFirstDaughter(-1); | |
387 | rp->SetLastDaughter(-1); | |
388 | rp->SetPolarisation(0,0,0); | |
389 | index++ ; | |
390 | } | |
391 | ||
392 | } | |
393 | ||
394 | //____________________________________________________________________________ | |
702ab87e | 395 | void AliPHOSPIDv0:: Print(const Option_t *) const |
b91d88dc | 396 | { |
397 | // Print the parameters used for the particle type identification | |
21cd0c07 | 398 | TString message ; |
88cb7938 | 399 | message = "=============== AliPHOSPIDv0 ================\n" ; |
21cd0c07 | 400 | message += "Making PID\n" ; |
401 | message += " Headers file: %s\n" ; | |
402 | message += " RecPoints branch title: %s\n" ; | |
403 | message += " TrackSegments Branch title: %s\n" ; | |
404 | message += " RecParticles Branch title %s\n" ; | |
405 | message += "with parameters:\n" ; | |
406 | message += " Maximal EMC - CPV distance (cm) %f\n" ; | |
351dd634 | 407 | AliInfo(Form( message.Data(), |
88cb7938 | 408 | GetTitle(), |
21cd0c07 | 409 | fRecPointsTitle.Data(), |
410 | fTrackSegmentsTitle.Data(), | |
411 | fRecParticlesTitle.Data(), | |
351dd634 | 412 | fCpvEmcDistance )); |
21cd0c07 | 413 | |
414 | if(fIDOptions.Contains("dis",TString::kIgnoreCase )) | |
351dd634 | 415 | AliInfo(Form(" dispersion cut %f", fDispersion )) ; |
21cd0c07 | 416 | if(fIDOptions.Contains("ell",TString::kIgnoreCase )) |
351dd634 | 417 | AliInfo(Form(" Eliptic cuts function: %s", |
418 | fFormula->GetTitle() )) ; | |
21cd0c07 | 419 | if(fIDOptions.Contains("tim",TString::kIgnoreCase )) |
351dd634 | 420 | AliInfo(Form(" Time Gate used: %f", fTimeGate)) ; |
b91d88dc | 421 | } |
422 | ||
423 | //____________________________________________________________________________ | |
8e8eae84 | 424 | void AliPHOSPIDv0::SetShowerProfileCut(const char * formula) |
b91d88dc | 425 | { |
426 | //set shape of the cut on the axis of ellipce, drown around shouer | |
427 | //shower considered "narrow" if Formula(lambda[0],lambda[1]) > 0. | |
428 | if(fFormula) | |
429 | delete fFormula; | |
430 | fFormula = new TFormula("Lambda Cut",formula) ; | |
431 | } | |
432 | //____________________________________________________________________________ | |
88cb7938 | 433 | void AliPHOSPIDv0::WriteRecParticles() |
b91d88dc | 434 | { |
7f78a025 | 435 | // Saves the reconstructed particles too a file |
b91d88dc | 436 | |
88cb7938 | 437 | AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); |
438 | if(runget == 0x0) | |
439 | { | |
351dd634 | 440 | AliError(Form("Can not find run getter in event folder \"%s\"", |
441 | GetTitle())); | |
88cb7938 | 442 | return; |
443 | } | |
444 | ||
445 | AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader")); | |
446 | if ( gime == 0 ) | |
447 | { | |
351dd634 | 448 | AliError("Could not obtain the Loader object !"); |
88cb7938 | 449 | return ; |
450 | } | |
451 | ||
452 | TClonesArray * recParticles = gime->RecParticles() ; | |
b91d88dc | 453 | recParticles->Expand(recParticles->GetEntriesFast() ) ; |
454 | ||
88cb7938 | 455 | TTree * treeR = gime->TreeR(); |
b91d88dc | 456 | |
fbf811ec | 457 | if(!treeR){ |
88cb7938 | 458 | gime->MakeTree("R"); |
459 | treeR = gime->TreeR() ; | |
fbf811ec | 460 | } |
b91d88dc | 461 | |
462 | //First rp | |
463 | Int_t bufferSize = 32000 ; | |
fbf811ec | 464 | TBranch * rpBranch = treeR->Branch("PHOSRP",&recParticles,bufferSize); |
b91d88dc | 465 | rpBranch->SetTitle(fRecParticlesTitle); |
b91d88dc | 466 | |
467 | //second, pid | |
468 | Int_t splitlevel = 0 ; | |
469 | AliPHOSPIDv0 * pid = this ; | |
fbf811ec | 470 | TBranch * pidBranch = treeR->Branch("AliPHOSPID","AliPHOSPIDv0",&pid,bufferSize,splitlevel); |
b91d88dc | 471 | pidBranch->SetTitle(fRecParticlesTitle.Data()); |
b91d88dc | 472 | |
473 | rpBranch->Fill() ; | |
474 | pidBranch->Fill() ; | |
88cb7938 | 475 | |
476 | gime->WriteRecParticles("OVERWRITE"); | |
477 | gime->WritePID("OVERWRITE"); | |
478 | ||
b91d88dc | 479 | } |
480 | ||
481 | //____________________________________________________________________________ | |
482 | void AliPHOSPIDv0::PlotDispersionCuts()const | |
483 | { | |
484 | // produces a plot of the dispersion cut | |
485 | TCanvas* lambdas = new TCanvas("lambdas","Cuts on the ellipse axis",200,10,700,500); | |
486 | ||
487 | if(fIDOptions.Contains("ell",TString::kIgnoreCase ) ){ | |
488 | TF2 * ell = new TF2("Elliptic Cuts",fFormula->GetName(),0,3,0,3) ; | |
489 | ell->SetMinimum(0.0000001) ; | |
490 | ell->SetMaximum(0.001) ; | |
491 | ell->SetLineStyle(1) ; | |
492 | ell->SetLineWidth(2) ; | |
493 | ell->Draw() ; | |
494 | } | |
495 | ||
496 | if( fIDOptions.Contains("dis",TString::kIgnoreCase ) ){ | |
497 | TF2 * dsp = new TF2("dispersion","(y<x)*(x*x+y*y < [0]*[0])",0,3,0,3) ; | |
498 | dsp->SetParameter(0,fDispersion) ; | |
499 | dsp->SetMinimum(0.0000001) ; | |
500 | dsp->SetMaximum(0.001) ; | |
501 | dsp->SetLineStyle(1) ; | |
502 | dsp->SetLineColor(2) ; | |
503 | dsp->SetLineWidth(2) ; | |
504 | dsp->SetNpx(200) ; | |
505 | dsp->SetNpy(200) ; | |
506 | if(fIDOptions.Contains("ell",TString::kIgnoreCase ) ) | |
507 | dsp->Draw("same") ; | |
508 | else | |
509 | dsp->Draw() ; | |
510 | } | |
511 | lambdas->Update(); | |
512 | } | |
513 | ||
514 | //____________________________________________________________________________ | |
8f2a3661 | 515 | TVector3 AliPHOSPIDv0::GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * )const |
b91d88dc | 516 | { |
517 | // Calculates the momentum direction: | |
518 | // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint | |
519 | // 2. if a EMC RecPoint and CPV RecPoint, direction is given by the line through the 2 recpoints | |
520 | // However because of the poor position resolution of PPSD the direction is always taken as if we were | |
521 | // in case 1. | |
522 | ||
523 | TVector3 dir(0,0,0) ; | |
524 | ||
525 | TVector3 emcglobalpos ; | |
526 | TMatrix dummy ; | |
527 | ||
528 | emc->GetGlobalPosition(emcglobalpos, dummy) ; | |
529 | ||
530 | ||
531 | // The following commented code becomes valid once the PPSD provides | |
532 | // a reasonable position resolution, at least as good as EMC ! | |
533 | // TVector3 ppsdlglobalpos ; | |
534 | // TVector3 ppsduglobalpos ; | |
535 | // if( fPpsdLowRecPoint ){ // certainly a photon that has concerted | |
536 | // fPpsdLowRecPoint->GetGlobalPosition(ppsdlglobalpos, mdummy) ; | |
537 | // dir = emcglobalpos - ppsdlglobalpos ; | |
538 | // if( fPpsdUpRecPoint ){ // not looks like a charged | |
539 | // fPpsdUpRecPoint->GetGlobalPosition(ppsduglobalpos, mdummy) ; | |
540 | // dir = ( dir + emcglobalpos - ppsduglobalpos ) * 0.5 ; | |
541 | // } | |
542 | // } | |
543 | // else { // looks like a neutral | |
544 | // dir = emcglobalpos ; | |
545 | // } | |
546 | ||
547 | dir = emcglobalpos ; | |
548 | dir.SetZ( -dir.Z() ) ; // why ? | |
549 | dir.SetMag(1.) ; | |
550 | ||
551 | //account correction to the position of IP | |
552 | Float_t xo,yo,zo ; //Coordinates of the origin | |
553 | gAlice->Generator()->GetOrigin(xo,yo,zo) ; | |
554 | TVector3 origin(xo,yo,zo); | |
555 | dir = dir - origin ; | |
556 | ||
557 | return dir ; | |
558 | } | |
559 | //____________________________________________________________________________ | |
560 | void AliPHOSPIDv0::PrintRecParticles(Option_t * option) | |
561 | { | |
562 | // Print table of reconstructed particles | |
563 | ||
88cb7938 | 564 | AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle()); |
565 | if(runget == 0x0) | |
566 | { | |
351dd634 | 567 | AliError(Form("Can not find run getter in event folder \"%s\"", |
568 | GetTitle())); | |
88cb7938 | 569 | return; |
570 | } | |
571 | ||
572 | AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader")); | |
573 | if ( gime == 0 ) | |
574 | { | |
351dd634 | 575 | AliError("Could not obtain the Loader object !"); |
88cb7938 | 576 | return ; |
577 | } | |
b91d88dc | 578 | |
579 | TString taskName(GetName()) ; | |
580 | taskName.Remove(taskName.Index(Version())-1) ; | |
88cb7938 | 581 | TClonesArray * recParticles = gime->RecParticles() ; |
b91d88dc | 582 | |
21cd0c07 | 583 | TString message ; |
584 | message = "event %d\n" ; | |
585 | message += " found %d RecParticles\n" ; | |
351dd634 | 586 | AliInfo(Form(message.Data(), |
587 | gAlice->GetEvNumber(), recParticles->GetEntriesFast() )) ; | |
21cd0c07 | 588 | |
b91d88dc | 589 | if(strstr(option,"all")) { // printing found TS |
351dd634 | 590 | AliInfo(" PARTICLE Index" ) ; |
88cb7938 | 591 | |
b91d88dc | 592 | Int_t index ; |
593 | for (index = 0 ; index < recParticles->GetEntries() ; index++) { | |
594 | AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) recParticles->At(index) ; | |
595 | ||
596 | Text_t particle[11]; | |
597 | switch(rp->GetType()) { | |
598 | case AliPHOSFastRecParticle::kNEUTRALEMFAST: | |
599 | strcpy( particle, "NEUTRAL EM FAST"); | |
600 | break; | |
601 | case AliPHOSFastRecParticle::kNEUTRALHAFAST: | |
602 | strcpy(particle, "NEUTRAL HA FAST"); | |
603 | break; | |
604 | case AliPHOSFastRecParticle::kNEUTRALEMSLOW: | |
605 | strcpy(particle, "NEUTRAL EM SLOW"); | |
606 | break ; | |
607 | case AliPHOSFastRecParticle::kNEUTRALHASLOW: | |
608 | strcpy(particle, "NEUTRAL HA SLOW"); | |
609 | break ; | |
610 | case AliPHOSFastRecParticle::kCHARGEDEMFAST: | |
611 | strcpy(particle, "CHARGED EM FAST") ; | |
612 | break ; | |
613 | case AliPHOSFastRecParticle::kCHARGEDHAFAST: | |
614 | strcpy(particle, "CHARGED HA FAST") ; | |
615 | break ; | |
616 | case AliPHOSFastRecParticle::kCHARGEDEMSLOW: | |
617 | strcpy(particle, "CHARGEDEMSLOW") ; | |
618 | break ; | |
619 | case AliPHOSFastRecParticle::kCHARGEDHASLOW: | |
620 | strcpy(particle, "CHARGED HA SLOW") ; | |
621 | break ; | |
622 | } | |
623 | ||
624 | // Int_t * primaries; | |
625 | // Int_t nprimaries; | |
626 | // primaries = rp->GetPrimaries(nprimaries); | |
627 | ||
351dd634 | 628 | AliInfo(Form(" %s %d", |
629 | particle, rp->GetIndexInList())) ; | |
b91d88dc | 630 | } |
21cd0c07 | 631 | } |
b91d88dc | 632 | } |
633 | ||
634 | ||
635 |