]>
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 |
21 | // - CPV information, | |
a4e98857 | 22 | // - Preshower information (in MIXT or GPS2 geometries) |
7acf6008 | 23 | // - shower width. |
a4e98857 | 24 | // |
25 | // CPV or Preshower clusters should be closer in PHOS plane than fCpvEmcDistance (in cm). | |
26 | // This parameter can be set by method SetCpvtoEmcDistanceCut(Float_t cut) | |
7acf6008 | 27 | // |
28 | // One can set desirable ID method by the function SetIdentificationMethod(option). | |
a4e98857 | 29 | // Presently the following options can be used together or separately : |
7acf6008 | 30 | // - "disp": use dispersion cut on shower width |
31 | // (width can be set by method SetDispersionCut(Float_t cut) | |
a4e98857 | 32 | // - "ell" : use cut on the axis of the ellipse, drawn around shower |
7acf6008 | 33 | // (this cut can be changed by SetShowerProfileCut(char* formula), |
34 | // where formula - any function of two variables f(lambda[0],lambda[1]). | |
35 | // Shower is considered as EM if f() > 0 ) | |
36 | // One can visualize current cuts calling method PlotDispersionCuts(). | |
37 | // | |
a4e98857 | 38 | // use case: |
39 | // root [0] AliPHOSPIDv1 * p1 = new AliPHOSPIDv1("galice.root") | |
40 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated | |
41 | // root [1] p1->SetIdentificationMethod("disp ellipse") | |
42 | // root [2] p1->ExecuteTask() | |
43 | // root [3] AliPHOSPIDv1 * p2 = new AliPHOSPIDv1("galice1.root","ts1") | |
44 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated | |
7acf6008 | 45 | // // reading headers from file galice1.root and TrackSegments |
46 | // // with title "ts1" | |
a4e98857 | 47 | // root [4] p2->SetRecParticlesBranch("rp1") |
7acf6008 | 48 | // // set file name for the branch RecParticles |
a4e98857 | 49 | // root [5] p2->ExecuteTask("deb all time") |
7acf6008 | 50 | // // available options |
51 | // // "deb" - prints # of reconstructed particles | |
52 | // // "deb all" - prints # and list of RecParticles | |
53 | // // "time" - prints benchmarking results | |
54 | // | |
55 | //*-- Author: Yves Schutz (SUBATECH) & Gines Martinez (SUBATECH) & | |
56 | // Dmitri Peressounko (SUBATECH & Kurchatov Institute) | |
9688c1dd | 57 | // Completely redesined by Dmitri Peressounko, March 2001 |
6ad0bfa0 | 58 | |
59 | // --- ROOT system --- | |
7acf6008 | 60 | #include "TROOT.h" |
61 | #include "TTree.h" | |
62 | #include "TFile.h" | |
63 | #include "TF2.h" | |
64 | #include "TFormula.h" | |
65 | #include "TCanvas.h" | |
66 | #include "TFolder.h" | |
67 | #include "TSystem.h" | |
68 | #include "TBenchmark.h" | |
6ad0bfa0 | 69 | // --- Standard library --- |
70 | ||
de9ec31b | 71 | #include <iostream.h> |
7acf6008 | 72 | #include <iomanip.h> |
6ad0bfa0 | 73 | |
74 | // --- AliRoot header files --- | |
75 | ||
7acf6008 | 76 | #include "AliRun.h" |
77 | #include "AliGenerator.h" | |
78 | #include "AliPHOS.h" | |
26d4b141 | 79 | #include "AliPHOSPIDv1.h" |
7acf6008 | 80 | #include "AliPHOSClusterizerv1.h" |
6ad0bfa0 | 81 | #include "AliPHOSTrackSegment.h" |
7acf6008 | 82 | #include "AliPHOSTrackSegmentMakerv1.h" |
6ad0bfa0 | 83 | #include "AliPHOSRecParticle.h" |
7b7c1533 | 84 | #include "AliPHOSGeometry.h" |
85 | #include "AliPHOSGetter.h" | |
6ad0bfa0 | 86 | |
26d4b141 | 87 | ClassImp( AliPHOSPIDv1) |
6ad0bfa0 | 88 | |
1cb7c1ee | 89 | //____________________________________________________________________________ |
90 | AliPHOSPIDv1::AliPHOSPIDv1():AliPHOSPID() | |
91 | { | |
a4e98857 | 92 | // default ctor |
7b7c1533 | 93 | fFormula = 0 ; |
94 | fDispersion = 0. ; | |
95 | fCpvEmcDistance = 0 ; | |
9688c1dd | 96 | fTimeGate = 2.e-9 ; |
7b7c1533 | 97 | fHeaderFileName = "" ; |
98 | fTrackSegmentsTitle= "" ; | |
99 | fRecPointsTitle = "" ; | |
100 | fRecParticlesTitle = "" ; | |
9688c1dd | 101 | fIDOptions = "dis time" ; |
2b60655b | 102 | fRecParticlesInRun = 0 ; |
7acf6008 | 103 | } |
104 | ||
105 | //____________________________________________________________________________ | |
7b7c1533 | 106 | AliPHOSPIDv1::AliPHOSPIDv1(const char * headerFile,const char * name) : AliPHOSPID(headerFile, name) |
7acf6008 | 107 | { |
a4e98857 | 108 | //ctor with the indication on where to look for the track segments |
dd5c4038 | 109 | |
7b7c1533 | 110 | fFormula = new TFormula("LambdaCuts","(x>1)*(x<2.5)*(y>0)*(y<x)") ; |
111 | fDispersion = 2.0 ; | |
112 | fCpvEmcDistance = 3.0 ; | |
9688c1dd | 113 | fTimeGate = 2.e-9 ; |
7b7c1533 | 114 | |
115 | fHeaderFileName = GetTitle() ; | |
116 | fTrackSegmentsTitle = GetName() ; | |
117 | fRecPointsTitle = GetName() ; | |
118 | fRecParticlesTitle = GetName() ; | |
9688c1dd | 119 | fIDOptions = "dis time" ; |
120 | ||
7b7c1533 | 121 | TString tempo(GetName()) ; |
bf8f1fbd | 122 | tempo.Append(":") ; |
7b7c1533 | 123 | tempo.Append(Version()) ; |
bf8f1fbd | 124 | SetName(tempo) ; |
2b60655b | 125 | fRecParticlesInRun = 0 ; |
9688c1dd | 126 | |
2bd5457f | 127 | Init() ; |
7acf6008 | 128 | |
129 | } | |
7b7c1533 | 130 | |
7acf6008 | 131 | //____________________________________________________________________________ |
132 | AliPHOSPIDv1::~AliPHOSPIDv1() | |
133 | { | |
9688c1dd | 134 | if(fTrackSegments) fTrackSegments->Delete() ; |
135 | if(fEmcRecPoints) fEmcRecPoints->Delete() ; | |
136 | if(fCpvRecPoints) fCpvRecPoints->Delete() ; | |
137 | if(fRecParticles) fRecParticles->Delete() ; | |
7acf6008 | 138 | } |
2bd5457f | 139 | |
7b7c1533 | 140 | |
69183710 | 141 | //____________________________________________________________________________ |
7acf6008 | 142 | Float_t AliPHOSPIDv1::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Option_t * Axis)const |
69183710 | 143 | { |
144 | // Calculates the distance between the EMC RecPoint and the PPSD RecPoint | |
145 | ||
7b7c1533 | 146 | const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ; |
69183710 | 147 | TVector3 vecEmc ; |
7acf6008 | 148 | TVector3 vecCpv ; |
149 | ||
150 | emc->GetLocalPosition(vecEmc) ; | |
151 | cpv->GetLocalPosition(vecCpv) ; | |
152 | if(emc->GetPHOSMod() == cpv->GetPHOSMod()){ | |
153 | ||
154 | // Correct to difference in CPV and EMC position due to different distance to center. | |
155 | // we assume, that particle moves from center | |
7b7c1533 | 156 | Float_t dCPV = geom->GetIPtoOuterCoverDistance(); |
157 | Float_t dEMC = geom->GetIPtoCrystalSurface() ; | |
7acf6008 | 158 | dEMC = dEMC / dCPV ; |
159 | vecCpv = dEMC * vecCpv - vecEmc ; | |
160 | if (Axis == "X") return vecCpv.X(); | |
161 | if (Axis == "Y") return vecCpv.Y(); | |
162 | if (Axis == "Z") return vecCpv.Z(); | |
163 | if (Axis == "R") return vecCpv.Mag(); | |
164 | } | |
165 | ||
166 | return 100000000 ; | |
69183710 | 167 | } |
168 | ||
6ad0bfa0 | 169 | //____________________________________________________________________________ |
7acf6008 | 170 | void AliPHOSPIDv1::Exec(Option_t * option) |
6ad0bfa0 | 171 | { |
f035f6ce | 172 | //Steering method |
9688c1dd | 173 | |
bf8f1fbd | 174 | if( strcmp(GetName(), "")== 0 ) |
7acf6008 | 175 | Init() ; |
bf8f1fbd | 176 | |
177 | if(strstr(option,"tim")) | |
7acf6008 | 178 | gBenchmark->Start("PHOSPID"); |
bf8f1fbd | 179 | |
180 | if(strstr(option,"print")) { | |
7b7c1533 | 181 | Print("") ; |
182 | return ; | |
bf8f1fbd | 183 | } |
9688c1dd | 184 | |
bf8f1fbd | 185 | gAlice->GetEvent(0) ; |
7b7c1533 | 186 | //check, if the branch with name of this" already exits? |
187 | TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ; | |
188 | TIter next(lob) ; | |
189 | TBranch * branch = 0 ; | |
190 | Bool_t phospidfound = kFALSE, pidfound = kFALSE ; | |
191 | ||
192 | TString taskName(GetName()) ; | |
bf8f1fbd | 193 | taskName.Remove(taskName.Index(Version())-1) ; |
9688c1dd | 194 | |
7b7c1533 | 195 | while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) { |
196 | if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) | |
197 | phospidfound = kTRUE ; | |
198 | ||
199 | else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) | |
200 | pidfound = kTRUE ; | |
201 | } | |
9688c1dd | 202 | |
7b7c1533 | 203 | if ( phospidfound || pidfound ) { |
204 | cerr << "WARNING: AliPHOSPIDv1::Exec -> RecParticles and/or PIDtMaker branch with name " | |
205 | << taskName.Data() << " already exits" << endl ; | |
206 | return ; | |
207 | } | |
bf8f1fbd | 208 | |
7b7c1533 | 209 | Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ; |
210 | Int_t ievent ; | |
bf8f1fbd | 211 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; |
212 | ||
7b7c1533 | 213 | for(ievent = 0; ievent < nevents; ievent++){ |
bf8f1fbd | 214 | gime->Event(ievent,"R") ; |
9688c1dd | 215 | |
7acf6008 | 216 | MakeRecParticles() ; |
9688c1dd | 217 | |
7b7c1533 | 218 | WriteRecParticles(ievent); |
9688c1dd | 219 | |
7acf6008 | 220 | if(strstr(option,"deb")) |
221 | PrintRecParticles(option) ; | |
222 | } | |
9688c1dd | 223 | |
7acf6008 | 224 | if(strstr(option,"tim")){ |
225 | gBenchmark->Stop("PHOSPID"); | |
226 | cout << "AliPHOSPID:" << endl ; | |
227 | cout << " took " << gBenchmark->GetCpuTime("PHOSPID") << " seconds for PID " | |
7b7c1533 | 228 | << gBenchmark->GetCpuTime("PHOSPID")/nevents << " seconds per event " << endl ; |
7acf6008 | 229 | cout << endl ; |
230 | } | |
9688c1dd | 231 | |
7acf6008 | 232 | } |
7b7c1533 | 233 | //____________________________________________________________________________ |
234 | void AliPHOSPIDv1::Init() | |
235 | { | |
236 | // Make all memory allocations that are not possible in default constructor | |
237 | // Add the PID task to the list of PHOS tasks | |
238 | ||
239 | if ( strcmp(GetTitle(), "") == 0 ) | |
240 | SetTitle("galice.root") ; | |
241 | ||
242 | TString taskName(GetName()) ; | |
bf8f1fbd | 243 | taskName.Remove(taskName.Index(Version())-1) ; |
244 | ||
7b7c1533 | 245 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), taskName.Data()) ; |
246 | if ( gime == 0 ) { | |
247 | cerr << "ERROR: AliPHOSPIDv1::Init -> Could not obtain the Getter object !" << endl ; | |
248 | return ; | |
249 | } | |
250 | ||
bf8f1fbd | 251 | gime->PostPID(this) ; |
7b7c1533 | 252 | // create a folder on the white board //YSAlice/WhiteBoard/RecParticles/PHOS/recparticlesName |
bf8f1fbd | 253 | gime->PostRecParticles(taskName.Data() ) ; |
7b7c1533 | 254 | |
255 | } | |
256 | ||
7acf6008 | 257 | //____________________________________________________________________________ |
258 | void AliPHOSPIDv1::MakeRecParticles(){ | |
259 | ||
b2a60966 | 260 | // Makes a RecParticle out of a TrackSegment |
bf8f1fbd | 261 | TString taskName(GetName()) ; |
262 | taskName.Remove(taskName.Index(Version())-1) ; | |
6ad0bfa0 | 263 | |
7b7c1533 | 264 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; |
bf8f1fbd | 265 | TObjArray * emcRecPoints = gime->EmcRecPoints(taskName) ; |
266 | TObjArray * cpvRecPoints = gime->CpvRecPoints(taskName) ; | |
267 | TClonesArray * trackSegments = gime->TrackSegments(taskName) ; | |
268 | TClonesArray * recParticles = gime->RecParticles(taskName) ; | |
01a599c9 | 269 | recParticles->Clear(); |
bf8f1fbd | 270 | |
7b7c1533 | 271 | TIter next(trackSegments) ; |
7acf6008 | 272 | AliPHOSTrackSegment * ts ; |
6ad0bfa0 | 273 | Int_t index = 0 ; |
09fc14a0 | 274 | AliPHOSRecParticle * rp ; |
7acf6008 | 275 | |
276 | Bool_t ellips = fIDOptions.Contains("ell",TString::kIgnoreCase ) ; | |
277 | Bool_t disp = fIDOptions.Contains("dis",TString::kIgnoreCase ) ; | |
9688c1dd | 278 | Bool_t time = fIDOptions.Contains("tim",TString::kIgnoreCase ) ; |
7acf6008 | 279 | |
280 | while ( (ts = (AliPHOSTrackSegment *)next()) ) { | |
fad3e5b9 | 281 | |
7b7c1533 | 282 | new( (*recParticles)[index] ) AliPHOSRecParticle() ; |
283 | rp = (AliPHOSRecParticle *)recParticles->At(index) ; | |
7acf6008 | 284 | rp->SetTraskSegment(index) ; |
9688c1dd | 285 | rp->SetIndexInList(index) ; |
f035f6ce | 286 | |
7acf6008 | 287 | AliPHOSEmcRecPoint * emc = 0 ; |
288 | if(ts->GetEmcIndex()>=0) | |
7b7c1533 | 289 | emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ; |
fad3e5b9 | 290 | |
7acf6008 | 291 | AliPHOSRecPoint * cpv = 0 ; |
292 | if(ts->GetCpvIndex()>=0) | |
7b7c1533 | 293 | cpv = (AliPHOSRecPoint *) cpvRecPoints->At(ts->GetCpvIndex()) ; |
fad3e5b9 | 294 | |
7acf6008 | 295 | //set momentum and energy first |
296 | Float_t e = emc->GetEnergy() ; | |
9688c1dd | 297 | TVector3 dir = GetMomentumDirection(emc,cpv) ; |
7acf6008 | 298 | dir.SetMag(e) ; |
299 | ||
300 | rp->SetMomentum(dir.X(),dir.Y(),dir.Z(),e) ; | |
301 | rp->SetCalcMass(0); | |
302 | ||
303 | //now set type (reconstructed) of the particle | |
304 | Int_t showerprofile = 0; // 0 narrow and 1 wide | |
fad3e5b9 | 305 | |
7acf6008 | 306 | if(ellips){ |
307 | Float_t lambda[2] ; | |
308 | emc->GetElipsAxis(lambda) ; | |
309 | if(fFormula->Eval(lambda[0],lambda[1]) <= 0 ) | |
310 | showerprofile = 1 ; // not narrow | |
1cb7c1ee | 311 | } |
fad3e5b9 | 312 | |
7acf6008 | 313 | if(disp) |
314 | if(emc->GetDispersion() > fDispersion ) | |
315 | showerprofile = 1 ; // not narrow | |
316 | ||
9688c1dd | 317 | Int_t slow = 0 ; |
318 | if(time) | |
319 | if(emc->GetTime() > fTimeGate ) | |
320 | slow = 0 ; | |
321 | ||
7acf6008 | 322 | // Looking at the CPV detector |
323 | Int_t cpvdetector= 0 ; //1 hit and 0 no hit | |
324 | if(cpv) | |
325 | if(GetDistance(emc, cpv, "R") < fCpvEmcDistance) | |
326 | cpvdetector = 1 ; | |
327 | ||
9688c1dd | 328 | Int_t type = showerprofile + 2 * slow + 4 * cpvdetector ; |
329 | rp->SetType(type) ; | |
6ad0bfa0 | 330 | index++ ; |
331 | } | |
7acf6008 | 332 | |
6ad0bfa0 | 333 | } |
334 | ||
09fc14a0 | 335 | //____________________________________________________________________________ |
7acf6008 | 336 | void AliPHOSPIDv1:: Print(Option_t * option) const |
09fc14a0 | 337 | { |
b2a60966 | 338 | // Print the parameters used for the particle type identification |
f035f6ce | 339 | cout << "=============== AliPHOSPID1 ================" << endl ; |
340 | cout << "Making PID "<< endl ; | |
341 | cout << " Headers file: " << fHeaderFileName.Data() << endl ; | |
342 | cout << " RecPoints branch title: " << fRecPointsTitle.Data() << endl ; | |
7b7c1533 | 343 | cout << " TrackSegments Branch title: " << fTrackSegmentsTitle.Data() << endl ; |
344 | cout << " RecParticles Branch title " << fRecParticlesTitle.Data() << endl; | |
f035f6ce | 345 | cout << "with parameters: " << endl ; |
9688c1dd | 346 | cout << " Maximal EMC - CPV distance (cm) " << fCpvEmcDistance << endl ; |
f035f6ce | 347 | if(fIDOptions.Contains("dis",TString::kIgnoreCase )) |
9688c1dd | 348 | cout << " dispersion cut " << fDispersion << endl ; |
f035f6ce | 349 | if(fIDOptions.Contains("ell",TString::kIgnoreCase )){ |
9688c1dd | 350 | cout << " Eliptic cuts function: " << endl ; |
f035f6ce | 351 | cout << fFormula->GetTitle() << endl ; |
352 | } | |
9688c1dd | 353 | if(fIDOptions.Contains("tim",TString::kIgnoreCase )) |
354 | cout << " Time Gate uzed: " << fTimeGate << endl ; | |
f035f6ce | 355 | cout << "============================================" << endl ; |
09fc14a0 | 356 | } |
357 | ||
358 | //____________________________________________________________________________ | |
a4e98857 | 359 | void AliPHOSPIDv1::SetShowerProfileCut(char * formula) |
360 | { | |
7acf6008 | 361 | //set shape of the cut on the axis of ellipce, drown around shouer |
362 | //shower considered "narrow" if Formula(lambda[0],lambda[1]) > 0. | |
363 | if(fFormula) | |
364 | delete fFormula; | |
f035f6ce | 365 | fFormula = new TFormula("Lambda Cut",formula) ; |
7acf6008 | 366 | } |
367 | //____________________________________________________________________________ | |
7b7c1533 | 368 | void AliPHOSPIDv1::WriteRecParticles(Int_t event) |
09fc14a0 | 369 | { |
7b7c1533 | 370 | |
371 | AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; | |
bf8f1fbd | 372 | TString taskName(GetName()) ; |
373 | taskName.Remove(taskName.Index(Version())-1) ; | |
374 | TClonesArray * recParticles = gime->RecParticles(taskName) ; | |
375 | recParticles->Expand(recParticles->GetEntriesFast() ) ; | |
9688c1dd | 376 | |
7b7c1533 | 377 | //Make branch in TreeR for RecParticles |
7acf6008 | 378 | char * filename = 0; |
379 | if(gSystem->Getenv("CONFIG_SPLIT_FILE")!=0){ //generating file name | |
380 | filename = new char[strlen(gAlice->GetBaseFile())+20] ; | |
381 | sprintf(filename,"%s/PHOS.Reco.root",gAlice->GetBaseFile()) ; | |
382 | } | |
bf8f1fbd | 383 | |
7acf6008 | 384 | TDirectory *cwd = gDirectory; |
385 | ||
386 | //First rp | |
387 | Int_t bufferSize = 32000 ; | |
7b7c1533 | 388 | TBranch * rpBranch = gAlice->TreeR()->Branch("PHOSRP",&recParticles,bufferSize); |
bf8f1fbd | 389 | rpBranch->SetTitle(fRecParticlesTitle); |
7acf6008 | 390 | if (filename) { |
391 | rpBranch->SetFile(filename); | |
392 | TIter next( rpBranch->GetListOfBranches()); | |
761e34c0 | 393 | TBranch * sb ; |
394 | while ((sb=(TBranch*)next())) { | |
395 | sb->SetFile(filename); | |
7acf6008 | 396 | } |
397 | cwd->cd(); | |
398 | } | |
9688c1dd | 399 | |
7acf6008 | 400 | //second, pid |
401 | Int_t splitlevel = 0 ; | |
402 | AliPHOSPIDv1 * pid = this ; | |
7b7c1533 | 403 | TBranch * pidBranch = gAlice->TreeR()->Branch("AliPHOSPID","AliPHOSPIDv1",&pid,bufferSize,splitlevel); |
9688c1dd | 404 | pidBranch->SetTitle(fRecParticlesTitle.Data()); |
7acf6008 | 405 | if (filename) { |
406 | pidBranch->SetFile(filename); | |
407 | TIter next( pidBranch->GetListOfBranches()); | |
761e34c0 | 408 | TBranch * sb ; |
409 | while ((sb=(TBranch*)next())) { | |
410 | sb->SetFile(filename); | |
7acf6008 | 411 | } |
412 | cwd->cd(); | |
413 | } | |
414 | ||
761e34c0 | 415 | rpBranch->Fill() ; |
416 | pidBranch->Fill() ; | |
9688c1dd | 417 | |
7acf6008 | 418 | gAlice->TreeR()->Write(0,kOverwrite) ; |
419 | ||
420 | } | |
7b7c1533 | 421 | |
69183710 | 422 | //____________________________________________________________________________ |
7acf6008 | 423 | void AliPHOSPIDv1::PlotDispersionCuts()const |
69183710 | 424 | { |
a4e98857 | 425 | // produces a plot of the dispersion cut |
426 | TCanvas* lambdas = new TCanvas("lambdas","Cuts on the ellipse axis",200,10,700,500); | |
dd5c4038 | 427 | |
7acf6008 | 428 | if(fIDOptions.Contains("ell",TString::kIgnoreCase ) ){ |
429 | TF2 * ell = new TF2("Elliptic Cuts",fFormula->GetName(),0,3,0,3) ; | |
430 | ell->SetMinimum(0.0000001) ; | |
431 | ell->SetMaximum(0.001) ; | |
432 | ell->SetLineStyle(1) ; | |
433 | ell->SetLineWidth(2) ; | |
434 | ell->Draw() ; | |
435 | } | |
436 | ||
437 | if( fIDOptions.Contains("dis",TString::kIgnoreCase ) ){ | |
438 | TF2 * dsp = new TF2("dispersion","(y<x)*(x*x+y*y < [0]*[0])",0,3,0,3) ; | |
439 | dsp->SetParameter(0,fDispersion) ; | |
440 | dsp->SetMinimum(0.0000001) ; | |
441 | dsp->SetMaximum(0.001) ; | |
442 | dsp->SetLineStyle(1) ; | |
443 | dsp->SetLineColor(2) ; | |
444 | dsp->SetLineWidth(2) ; | |
445 | dsp->SetNpx(200) ; | |
446 | dsp->SetNpy(200) ; | |
447 | if(fIDOptions.Contains("ell",TString::kIgnoreCase ) ) | |
448 | dsp->Draw("same") ; | |
449 | else | |
450 | dsp->Draw() ; | |
451 | } | |
452 | lambdas->Update(); | |
453 | } | |
69183710 | 454 | |
7acf6008 | 455 | //____________________________________________________________________________ |
9688c1dd | 456 | TVector3 AliPHOSPIDv1::GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv)const |
7acf6008 | 457 | { |
458 | // Calculates the momentum direction: | |
459 | // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint | |
9688c1dd | 460 | // 2. if a EMC RecPoint and CPV RecPoint, direction is given by the line through the 2 recpoints |
461 | // However because of the poor position resolution of PPSD the direction is always taken as if we were | |
7acf6008 | 462 | // in case 1. |
463 | ||
464 | TVector3 dir(0,0,0) ; | |
465 | ||
466 | TVector3 emcglobalpos ; | |
467 | TMatrix dummy ; | |
468 | ||
469 | emc->GetGlobalPosition(emcglobalpos, dummy) ; | |
470 | ||
69183710 | 471 | |
a4e98857 | 472 | // The following commented code becomes valid once the PPSD provides |
7acf6008 | 473 | // a reasonable position resolution, at least as good as EMC ! |
474 | // TVector3 ppsdlglobalpos ; | |
475 | // TVector3 ppsduglobalpos ; | |
476 | // if( fPpsdLowRecPoint ){ // certainly a photon that has concerted | |
477 | // fPpsdLowRecPoint->GetGlobalPosition(ppsdlglobalpos, mdummy) ; | |
478 | // dir = emcglobalpos - ppsdlglobalpos ; | |
479 | // if( fPpsdUpRecPoint ){ // not looks like a charged | |
480 | // fPpsdUpRecPoint->GetGlobalPosition(ppsduglobalpos, mdummy) ; | |
481 | // dir = ( dir + emcglobalpos - ppsduglobalpos ) * 0.5 ; | |
482 | // } | |
483 | // } | |
484 | // else { // looks like a neutral | |
485 | // dir = emcglobalpos ; | |
486 | // } | |
487 | ||
488 | dir = emcglobalpos ; | |
489 | dir.SetZ( -dir.Z() ) ; // why ? | |
490 | dir.SetMag(1.) ; | |
491 | ||
492 | //account correction to the position of IP | |
493 | Float_t xo,yo,zo ; //Coordinates of the origin | |
494 | gAlice->Generator()->GetOrigin(xo,yo,zo) ; | |
495 | TVector3 origin(xo,yo,zo); | |
496 | dir = dir - origin ; | |
497 | ||
498 | return dir ; | |
499 | } | |
500 | //____________________________________________________________________________ | |
a4e98857 | 501 | void AliPHOSPIDv1::PrintRecParticles(Option_t * option) |
502 | { | |
dd5c4038 | 503 | // Print table of reconstructed particles |
504 | ||
7b7c1533 | 505 | AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; |
bf8f1fbd | 506 | |
507 | TString taskName(GetName()) ; | |
508 | taskName.Remove(taskName.Index(Version())-1) ; | |
509 | TClonesArray * recParticles = gime->RecParticles(taskName) ; | |
9688c1dd | 510 | |
01a599c9 | 511 | cout << "AliPHOSPIDv1: event "<<gAlice->GetEvNumber() << endl ; |
7b7c1533 | 512 | cout << " found " << recParticles->GetEntriesFast() << " RecParticles " << endl ; |
7acf6008 | 513 | |
2b60655b | 514 | fRecParticlesInRun += recParticles->GetEntriesFast() ; |
9688c1dd | 515 | |
7acf6008 | 516 | if(strstr(option,"all")) { // printing found TS |
517 | ||
518 | cout << " PARTICLE " | |
519 | << " Index " << endl ; | |
520 | // << " X " | |
521 | // << " Y " | |
522 | // << " Z " | |
523 | // << " # of primaries " | |
524 | // << " Primaries list " << endl; | |
525 | ||
526 | Int_t index ; | |
7b7c1533 | 527 | for (index = 0 ; index < recParticles->GetEntries() ; index++) { |
528 | AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) recParticles->At(index) ; | |
7acf6008 | 529 | |
530 | Text_t particle[11]; | |
531 | switch(rp->GetType()) { | |
9688c1dd | 532 | case AliPHOSFastRecParticle::kNEUTRALEMFAST: |
533 | strcpy( particle, "NEUTRAL EM FAST"); | |
7acf6008 | 534 | break; |
9688c1dd | 535 | case AliPHOSFastRecParticle::kNEUTRALHAFAST: |
536 | strcpy(particle, "NEUTRAL HA FAST"); | |
7acf6008 | 537 | break; |
9688c1dd | 538 | case AliPHOSFastRecParticle::kNEUTRALEMSLOW: |
539 | strcpy(particle, "NEUTRAL EM SLOW"); | |
7acf6008 | 540 | break ; |
9688c1dd | 541 | case AliPHOSFastRecParticle::kNEUTRALHASLOW: |
542 | strcpy(particle, "NEUTRAL HA SLOW"); | |
7acf6008 | 543 | break ; |
9688c1dd | 544 | case AliPHOSFastRecParticle::kCHARGEDEMFAST: |
545 | strcpy(particle, "CHARGED EM FAST") ; | |
7acf6008 | 546 | break ; |
9688c1dd | 547 | case AliPHOSFastRecParticle::kCHARGEDHAFAST: |
548 | strcpy(particle, "CHARGED HA FAST") ; | |
7acf6008 | 549 | break ; |
9688c1dd | 550 | case AliPHOSFastRecParticle::kCHARGEDEMSLOW: |
551 | strcpy(particle, "CHARGEDEMSLOW") ; | |
7acf6008 | 552 | break ; |
9688c1dd | 553 | case AliPHOSFastRecParticle::kCHARGEDHASLOW: |
554 | strcpy(particle, "CHARGED HA SLOW") ; | |
7acf6008 | 555 | break ; |
556 | } | |
557 | ||
558 | // Int_t * primaries; | |
559 | // Int_t nprimaries; | |
560 | // primaries = rp->GetPrimaries(nprimaries); | |
561 | ||
9688c1dd | 562 | cout << setw(10) << particle << " " |
563 | << setw(5) << rp->GetIndexInList() << " " ; | |
7acf6008 | 564 | // << setw(4) << nprimaries << " "; |
565 | // for (Int_t iprimary=0; iprimary<nprimaries; iprimary++) | |
566 | // cout << setw(4) << primaries[iprimary] << " "; | |
567 | cout << endl; | |
568 | } | |
569 | cout << "-------------------------------------------" << endl ; | |
570 | } | |
571 | ||
69183710 | 572 | } |
573 | ||
7acf6008 | 574 | |
575 |