]>
Commit | Line | Data |
---|---|---|
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 | //_________________________________________________________________________ | |
17 | // Algorythm class to analyze PHOS events | |
18 | //*-- Y. Schutz : SUBATECH | |
19 | ////////////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | // --- ROOT system --- | |
22 | ||
23 | #include "TFile.h" | |
24 | #include "TH1.h" | |
25 | #include "TPad.h" | |
26 | #include "TH2.h" | |
27 | #include "TParticle.h" | |
28 | #include "TClonesArray.h" | |
29 | #include "TTree.h" | |
30 | #include "TMath.h" | |
31 | #include "TCanvas.h" | |
32 | ||
33 | // --- Standard library --- | |
34 | ||
35 | #include <iostream> | |
36 | #include <cstdio> | |
37 | ||
38 | // --- AliRoot header files --- | |
39 | ||
40 | #include "AliRun.h" | |
41 | #include "AliPHOSAnalyze.h" | |
42 | #include "AliPHOSClusterizerv1.h" | |
43 | #include "AliPHOSTrackSegmentMakerv1.h" | |
44 | #include "AliPHOSPIDv1.h" | |
45 | #include "AliPHOSReconstructioner.h" | |
46 | #include "AliPHOSDigit.h" | |
47 | #include "AliPHOSTrackSegment.h" | |
48 | #include "AliPHOSRecParticle.h" | |
49 | ||
50 | ClassImp(AliPHOSAnalyze) | |
51 | ||
52 | ||
53 | //____________________________________________________________________________ | |
54 | AliPHOSAnalyze::AliPHOSAnalyze() | |
55 | { | |
56 | // ctor | |
57 | ||
58 | fRootFile = 0 ; | |
59 | } | |
60 | ||
61 | //____________________________________________________________________________ | |
62 | AliPHOSAnalyze::AliPHOSAnalyze(Text_t * name) | |
63 | { | |
64 | // ctor | |
65 | ||
66 | Bool_t ok = OpenRootFile(name) ; | |
67 | if ( !ok ) { | |
68 | cout << " AliPHOSAnalyze > Error opening " << name << endl ; | |
69 | } | |
70 | else { | |
71 | gAlice = (AliRun*) fRootFile->Get("gAlice"); | |
72 | fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; | |
73 | fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ) ; | |
74 | fEvt = -999 ; | |
75 | } | |
76 | } | |
77 | ||
78 | //____________________________________________________________________________ | |
79 | AliPHOSAnalyze::~AliPHOSAnalyze() | |
80 | { | |
81 | // dtor | |
82 | ||
83 | fRootFile->Close() ; | |
84 | delete fRootFile ; | |
85 | fRootFile = 0 ; | |
86 | ||
87 | delete fPHOS ; | |
88 | fPHOS = 0 ; | |
89 | ||
90 | delete fClu ; | |
91 | fClu = 0 ; | |
92 | ||
93 | delete fPID ; | |
94 | fPID = 0 ; | |
95 | ||
96 | delete fRec ; | |
97 | fRec = 0 ; | |
98 | ||
99 | delete fTrs ; | |
100 | fTrs = 0 ; | |
101 | ||
102 | } | |
103 | ||
104 | //____________________________________________________________________________ | |
105 | void AliPHOSAnalyze::AnalyzeOneEvent(Int_t evt) | |
106 | { | |
107 | Bool_t ok = Init(evt) ; | |
108 | ||
109 | if ( ok ) { | |
110 | //=========== Get the number of entries in the Digits array | |
111 | ||
112 | Int_t nId = fPHOS->Digits()->GetEntries(); | |
113 | printf("AnalyzeOneEvent > Number of entries in the Digit array is %d \n",nId); | |
114 | ||
115 | //=========== Do the reconstruction | |
116 | ||
117 | cout << "AnalyzeOneEvent > Found " << nId << " digits in PHOS" << endl ; | |
118 | ||
119 | fPHOS->Reconstruction(fRec); | |
120 | ||
121 | // =========== End of reconstruction | |
122 | ||
123 | cout << "AnalyzeOneEvent > event # " << fEvt << " processed" << endl ; | |
124 | } // ok | |
125 | else | |
126 | cout << "AnalyzeOneEvent > filed to process event # " << evt << endl ; | |
127 | ||
128 | } | |
129 | ||
130 | //____________________________________________________________________________ | |
131 | void AliPHOSAnalyze::AnalyzeManyEvents(Int_t Nevents, Int_t module) // analyzes many events | |
132 | { | |
133 | ||
134 | if ( fRootFile == 0 ) | |
135 | cout << "AnalyzeManyEvents > " << "Root File not openned" << endl ; | |
136 | else | |
137 | { | |
138 | //========== Get AliRun object from file | |
139 | gAlice = (AliRun*) fRootFile->Get("gAlice") ; | |
140 | //=========== Get the PHOS object and associated geometry from the file | |
141 | fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; | |
142 | fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ); | |
143 | //========== Booking Histograms | |
144 | cout << "AnalyzeManyEvents > " << "Booking Histograms" << endl ; | |
145 | BookingHistograms(); | |
146 | Int_t ievent; | |
147 | Int_t relid[4] ; | |
148 | AliPHOSDigit * digit ; | |
149 | AliPHOSEmcRecPoint * emc ; | |
150 | AliPHOSPpsdRecPoint * ppsd ; | |
151 | // AliPHOSTrackSegment * tracksegment ; | |
152 | AliPHOSRecParticle * recparticle; | |
153 | for ( ievent=0; ievent<Nevents; ievent++) | |
154 | { | |
155 | if (ievent==0) cout << "AnalyzeManyEvents > " << "Starting Analyzing " << endl ; | |
156 | //========== Create the Clusterizer | |
157 | fClu = new AliPHOSClusterizerv1() ; | |
158 | fClu->SetEmcEnergyThreshold(0.025) ; | |
159 | fClu->SetEmcClusteringThreshold(0.50) ; | |
160 | fClu->SetPpsdEnergyThreshold (0.0000002) ; | |
161 | fClu->SetPpsdClusteringThreshold(0.0000001) ; | |
162 | fClu->SetLocalMaxCut(0.03) ; | |
163 | fClu->SetCalibrationParameters(0., 0.00000001) ; | |
164 | //========== Creates the track segment maker | |
165 | fTrs = new AliPHOSTrackSegmentMakerv1() ; | |
166 | fTrs->UnsetUnfoldFlag() ; | |
167 | //========== Creates the particle identifier | |
168 | fPID = new AliPHOSPIDv1() ; | |
169 | fPID->SetShowerProfileCuts(0.3, 1.8, 0.3, 1.8 ) ; | |
170 | fPID->Print() ; | |
171 | //========== Creates the Reconstructioner | |
172 | fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ; | |
173 | //========== Event Number | |
174 | if ( ( log10(ievent+1) - (Int_t)(log10(ievent+1)) ) == 0. ) cout << "AnalyzeManyEvents > " << "Event is " << ievent << endl ; | |
175 | //=========== Connects the various Tree's for evt | |
176 | gAlice->GetEvent(ievent); | |
177 | //=========== Gets the Digit TTree | |
178 | gAlice->TreeD()->GetEvent(0) ; | |
179 | //=========== Gets the number of entries in the Digits array | |
180 | TIter nextdigit(fPHOS->Digits()) ; | |
181 | while( ( digit = (AliPHOSDigit *)nextdigit() ) ) | |
182 | { | |
183 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
184 | if (fClu->IsInEmc(digit)) fhEmcDigit->Fill(fClu->Calibrate(digit->GetAmp())) ; | |
185 | else | |
186 | { | |
187 | if (relid[1]<17) fhVetoDigit->Fill(fClu->Calibrate(digit->GetAmp())); | |
188 | if (relid[1]>16) fhConvertorDigit->Fill(fClu->Calibrate(digit->GetAmp())); | |
189 | } | |
190 | } | |
191 | //=========== Do the reconstruction | |
192 | fPHOS->Reconstruction(fRec); | |
193 | //=========== Cluster in module | |
194 | TIter nextEmc(fPHOS->EmcClusters() ) ; | |
195 | while((emc = (AliPHOSEmcRecPoint *)nextEmc())) | |
196 | { | |
197 | if ( emc->GetPHOSMod() == module ) | |
198 | { | |
199 | fhEmcCluster->Fill( emc->GetTotalEnergy() ); | |
200 | TIter nextPpsd( fPHOS->PpsdClusters()) ; | |
201 | while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd())) | |
202 | { | |
203 | if ( ppsd->GetPHOSMod() == module ) | |
204 | { | |
205 | if (!ppsd->GetUp()) fhConvertorEmc->Fill(emc->GetTotalEnergy(),ppsd->GetTotalEnergy()) ; | |
206 | } | |
207 | } | |
208 | } | |
209 | } | |
210 | //=========== Cluster in module PPSD Down | |
211 | TIter nextPpsd(fPHOS->PpsdClusters() ) ; | |
212 | while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd())) | |
213 | { | |
214 | if ( ppsd->GetPHOSMod() == module ) | |
215 | { | |
216 | if (!ppsd->GetUp()) fhConvertorCluster->Fill(ppsd->GetTotalEnergy()) ; | |
217 | if (ppsd->GetUp()) fhVetoCluster ->Fill(ppsd->GetTotalEnergy()) ; | |
218 | } | |
219 | } | |
220 | //========== TRackSegments in the event | |
221 | TIter nextRecParticle(fPHOS->RecParticles() ) ; | |
222 | while((recparticle = (AliPHOSRecParticle *)nextRecParticle())) | |
223 | { | |
224 | if ( recparticle->GetPHOSTrackSegment()->GetPHOSMod() == module ) | |
225 | { | |
226 | cout << "Particle type is " << recparticle->GetType() << endl ; | |
227 | switch(recparticle->GetType()) | |
228 | { | |
229 | case kGAMMA: | |
230 | fhPhotonEnergy->Fill(recparticle->Energy() ) ; | |
231 | //fhPhotonPositionX->Fill(recpart. ) ; | |
232 | //fhPhotonPositionY->Fill(recpart. ) ; | |
233 | cout << "PHOTON" << endl; | |
234 | break; | |
235 | case kELECTRON: | |
236 | fhElectronEnergy->Fill(recparticle->Energy() ) ; | |
237 | //fhElectronPositionX->Fill(recpart. ) ; | |
238 | //fhElectronPositionY->Fill(recpart. ) ; | |
239 | cout << "ELECTRON" << endl; | |
240 | break; | |
241 | case kNEUTRALHADRON: | |
242 | fhNeutralHadronEnergy->Fill(recparticle->Energy() ) ; | |
243 | //fhNeutralHadronPositionX->Fill(recpart. ) ; | |
244 | //fhNeutralHadronPositionY->Fill(recpart. ) ; | |
245 | cout << "NEUTRAl HADRON" << endl; | |
246 | break ; | |
247 | case kNEUTRALEM: | |
248 | fhNeutralEMEnergy->Fill(recparticle->Energy() ) ; | |
249 | //fhNeutralEMPositionX->Fill(recpart. ) ; | |
250 | //fhNeutralEMPositionY->Fill(recpart. ) ; | |
251 | //cout << "NEUTRAL EM" << endl; | |
252 | break ; | |
253 | case kCHARGEDHADRON: | |
254 | fhChargedHadronEnergy->Fill(recparticle->Energy() ) ; | |
255 | //fhChargedHadronPositionX->Fill(recpart. ) ; | |
256 | //fhChargedHadronPositionY->Fill(recpart. ) ; | |
257 | cout << "CHARGED HADRON" << endl; | |
258 | break ; | |
259 | case kGAMMAHADRON: | |
260 | fhPhotonHadronEnergy->Fill(recparticle->Energy() ) ; | |
261 | //fhPhotonHadronPositionX->Fill(recpart. ) ; | |
262 | //fhPhotonHadronPositionY->Fill(recpart. ) ; | |
263 | cout << "PHOTON HADRON" << endl; | |
264 | break ; | |
265 | } | |
266 | } | |
267 | } | |
268 | // Deleting fClu, fTrs, fPID et fRec | |
269 | fClu->Delete(); | |
270 | fTrs->Delete(); | |
271 | fPID->Delete(); | |
272 | fRec->Delete(); | |
273 | ||
274 | } // endfor | |
275 | SavingHistograms(); | |
276 | } // endif | |
277 | } // endfunction | |
278 | ||
279 | ||
280 | //____________________________________________________________________________ | |
281 | void AliPHOSAnalyze::BookingHistograms() | |
282 | { | |
283 | if (fhEmcDigit ) | |
284 | delete fhEmcDigit ; | |
285 | if (fhVetoDigit ) | |
286 | delete fhVetoDigit ; | |
287 | if (fhConvertorDigit ) | |
288 | delete fhConvertorDigit ; | |
289 | if (fhEmcCluster ) | |
290 | delete fhEmcCluster ; | |
291 | if (fhVetoCluster ) | |
292 | delete fhVetoCluster ; | |
293 | if (fhConvertorCluster ) | |
294 | delete fhConvertorCluster ; | |
295 | if (fhConvertorEmc ) | |
296 | delete fhConvertorEmc ; | |
297 | ||
298 | fhEmcDigit = new TH1F("hEmcDigit", "hEmcDigit", 1000, 0. , 25.); | |
299 | fhVetoDigit = new TH1F("hVetoDigit", "hVetoDigit", 500, 0. , 3.e-5); | |
300 | fhConvertorDigit = new TH1F("hConvertorDigit","hConvertorDigit", 500, 0. , 3.e-5); | |
301 | fhEmcCluster = new TH1F("hEmcCluster", "hEmcCluster", 1000, 0. , 30.); | |
302 | fhVetoCluster = new TH1F("hVetoCluster", "hVetoCluster", 500, 0. , 3.e-5); | |
303 | fhConvertorCluster = new TH1F("hConvertorCluster","hConvertorCluster",500, 0. , 3.e-5); | |
304 | fhConvertorEmc = new TH2F("hConvertorEmc", "hConvertorEmc", 200, 1. , 3., 200, 0., 3.e-5); | |
305 | fhPhotonEnergy = new TH1F("hPhotonEnergy", "hPhotonEnergy", 1000, 0. , 30.); | |
306 | fhElectronEnergy = new TH1F("hElectronEnergy","hElectronEnergy", 1000, 0. , 30.); | |
307 | fhNeutralHadronEnergy = new TH1F("hNeutralHadronEnergy", "hNeutralHadronEnergy", 1000, 0. , 30.); | |
308 | fhNeutralEMEnergy = new TH1F("hNeutralEMEnergy", "hNeutralEMEnergy", 1000, 0. , 30.); | |
309 | fhChargedHadronEnergy = new TH1F("hChargedHadronEnergy", "hChargedHadronEnergy", 1000, 0. , 30.); | |
310 | fhPhotonHadronEnergy = new TH1F("hPhotonHadronEnergy","hPhotonHadronEnergy",500,-80. , 80.); | |
311 | fhPhotonPositionX = new TH1F("hPhotonPositionX","hPhotonPositionX", 500,-80. , 80.); | |
312 | fhElectronPositionX = new TH1F("hElectronPositionX","hElectronPositionX",500,-80. , 80.); | |
313 | fhNeutralHadronPositionX = new TH1F("hNeutralHadronPositionX","hNeutralHadronPositionX",500,-80. , 80.); | |
314 | fhNeutralEMPositionX = new TH1F("hNeutralEMPositionX","hNeutralEMPositionX",500,-80. , 80.); | |
315 | fhChargedHadronPositionX = new TH1F("hChargedHadronPositionX","hChargedHadronPositionX",500,-80. , 80.); | |
316 | fhPhotonHadronPositionX = new TH1F("hPhotonHadronPositionX","hPhotonHadronPositionX",500,-80. , 80.); | |
317 | fhPhotonPositionY = new TH1F("hPhotonPositionY","hPhotonPositionY", 500,-80. , 80.); | |
318 | fhElectronPositionY = new TH1F("hElectronPositionY","hElectronPositionY",500,-80. , 80.); | |
319 | fhNeutralHadronPositionY = new TH1F("hNeutralHadronPositionY","hNeutralHadronPositionY",500,-80. , 80.); | |
320 | fhNeutralEMPositionY = new TH1F("hNeutralEMPositionY","hNeutralEMPositionY",500,-80. , 80.); | |
321 | fhChargedHadronPositionY = new TH1F("hChargedHadronPositionY","hChargedHadronPositionY",500,-80. , 80.); | |
322 | fhPhotonHadronPositionY = new TH1F("hPhotonHadronPositionY","hPhotonHadronPositionY",500,-80. , 80.); | |
323 | ||
324 | ||
325 | } | |
326 | //____________________________________________________________________________ | |
327 | Bool_t AliPHOSAnalyze::Init(Int_t evt) | |
328 | { | |
329 | ||
330 | Bool_t ok = kTRUE ; | |
331 | ||
332 | //========== Open galice root file | |
333 | ||
334 | if ( fRootFile == 0 ) { | |
335 | Text_t * name = new Text_t[80] ; | |
336 | cout << "AnalyzeOneEvent > Enter file root file name : " ; | |
337 | cin >> name ; | |
338 | Bool_t ok = OpenRootFile(name) ; | |
339 | if ( !ok ) | |
340 | cout << " AliPHOSAnalyze > Error opening " << name << endl ; | |
341 | else { | |
342 | //========== Get AliRun object from file | |
343 | ||
344 | gAlice = (AliRun*) fRootFile->Get("gAlice") ; | |
345 | ||
346 | //=========== Get the PHOS object and associated geometry from the file | |
347 | ||
348 | fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; | |
349 | fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ); | |
350 | } // else !ok | |
351 | } // if fRootFile | |
352 | ||
353 | if ( ok ) { | |
354 | ||
355 | //========== Create the Clusterizer | |
356 | ||
357 | fClu = new AliPHOSClusterizerv1() ; | |
358 | fClu->SetEmcEnergyThreshold(0.025) ; | |
359 | fClu->SetEmcClusteringThreshold(0.50) ; | |
360 | fClu->SetPpsdEnergyThreshold (0.0000002) ; | |
361 | fClu->SetPpsdClusteringThreshold(0.0000001) ; | |
362 | fClu->SetLocalMaxCut(0.03) ; | |
363 | fClu->SetCalibrationParameters(0., 0.00000001) ; | |
364 | cout << "AnalyzeOneEvent > using clusterizer " << fClu->GetName() << endl ; | |
365 | fClu->PrintParameters() ; | |
366 | ||
367 | //========== Creates the track segment maker | |
368 | ||
369 | fTrs = new AliPHOSTrackSegmentMakerv1() ; | |
370 | cout << "AnalyzeOneEvent > using tack segment maker " << fTrs->GetName() << endl ; | |
371 | ||
372 | //========== Creates the particle identifier | |
373 | ||
374 | fPID = new AliPHOSPIDv1() ; | |
375 | cout << "AnalyzeOneEvent > using particle identifier " << fPID->GetName() << endl ; | |
376 | ||
377 | //========== Creates the Reconstructioner | |
378 | ||
379 | fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ; | |
380 | ||
381 | //=========== Connect the various Tree's for evt | |
382 | ||
383 | if ( evt == -999 ) { | |
384 | cout << "AnalyzeOneEvent > Enter event number : " ; | |
385 | cin >> evt ; | |
386 | cout << evt << endl ; | |
387 | } | |
388 | fEvt = evt ; | |
389 | gAlice->GetEvent(evt); | |
390 | ||
391 | //=========== Get the Digit TTree | |
392 | ||
393 | gAlice->TreeD()->GetEvent(0) ; | |
394 | ||
395 | } // ok | |
396 | ||
397 | return ok ; | |
398 | } | |
399 | ||
400 | ||
401 | //____________________________________________________________________________ | |
402 | void AliPHOSAnalyze::DisplayKineEvent(Int_t evt) | |
403 | { | |
404 | if (evt == -999) | |
405 | evt = fEvt ; | |
406 | ||
407 | Int_t module ; | |
408 | cout << "DisplayKineEvent > which module (1-5, -1: all) ? " ; | |
409 | cin >> module ; cout << module << endl ; | |
410 | ||
411 | Int_t testparticle ; | |
412 | cout << " 22 : PHOTON " << endl | |
413 | << " (-)11 : (POSITRON)ELECTRON " << endl | |
414 | << " (-)2112 : (ANTI)NEUTRON " << endl | |
415 | << " -999 : Everything else " << endl ; | |
416 | cout << "DisplayKineEvent > enter PDG particle code to display " ; | |
417 | cin >> testparticle ; cout << testparticle << endl ; | |
418 | ||
419 | Text_t histoname[80] ; | |
420 | sprintf(histoname,"Event %d: Incident particles in module %d", evt, module) ; | |
421 | ||
422 | Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module | |
423 | fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, kDegre) ; | |
424 | ||
425 | Double_t theta, phi ; | |
426 | fGeom->EmcXtalCoverage(theta, phi, kDegre) ; | |
427 | ||
428 | Int_t tdim = (Int_t)( (tM - tm) / theta ) ; | |
429 | Int_t pdim = (Int_t)( (pM - pm) / phi ) ; | |
430 | ||
431 | tm -= theta ; | |
432 | tM += theta ; | |
433 | pm -= phi ; | |
434 | pM += phi ; | |
435 | ||
436 | TH2F * histoparticle = new TH2F("histoparticle", histoname, | |
437 | pdim, pm, pM, tdim, tm, tM) ; | |
438 | histoparticle->SetStats(kFALSE) ; | |
439 | ||
440 | // Get pointers to Alice Particle TClonesArray | |
441 | ||
442 | TParticle * particle; | |
443 | TClonesArray * particlearray = gAlice->Particles(); | |
444 | ||
445 | Text_t canvasname[80]; | |
446 | sprintf(canvasname,"Particles incident in PHOS/EMC module # %d",module) ; | |
447 | TCanvas * kinecanvas = new TCanvas("kinecanvas", canvasname, 650, 500) ; | |
448 | ||
449 | // get the KINE Tree | |
450 | ||
451 | TTree * kine = gAlice->TreeK() ; | |
452 | Stat_t nParticles = kine->GetEntries() ; | |
453 | cout << "DisplayKineEvent > events in kine " << nParticles << endl ; | |
454 | ||
455 | // loop over particles | |
456 | ||
457 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
458 | Int_t index1 ; | |
459 | Int_t nparticlein = 0 ; | |
460 | for (index1 = 0 ; index1 < nParticles ; index1++){ | |
461 | Int_t nparticle = particlearray->GetEntriesFast() ; | |
462 | Int_t index2 ; | |
463 | for( index2 = 0 ; index2 < nparticle ; index2++) { | |
464 | particle = (TParticle*)particlearray->UncheckedAt(index2) ; | |
465 | Int_t particletype = particle->GetPdgCode() ; | |
466 | if (testparticle == -999 || testparticle == particletype) { | |
467 | Double_t phi = particle->Phi() ; | |
468 | Double_t theta = particle->Theta() ; | |
469 | Int_t mod ; | |
470 | Double_t x, z ; | |
471 | fGeom->ImpactOnEmc(theta, phi, mod, z, x) ; | |
472 | if ( mod == module ) { | |
473 | nparticlein++ ; | |
474 | histoparticle->Fill(phi*kRADDEG, theta*kRADDEG, particle->Energy() ) ; | |
475 | } | |
476 | } | |
477 | } | |
478 | } | |
479 | kinecanvas->Draw() ; | |
480 | histoparticle->Draw("color") ; | |
481 | TPaveText * pavetext = new TPaveText(294, 100, 300, 101); | |
482 | Text_t text[40] ; | |
483 | sprintf(text, "Particles: %d ", nparticlein) ; | |
484 | pavetext->AddText(text) ; | |
485 | pavetext->Draw() ; | |
486 | kinecanvas->Update(); | |
487 | ||
488 | } | |
489 | //____________________________________________________________________________ | |
490 | void AliPHOSAnalyze::DisplayRecParticles() | |
491 | { | |
492 | if (fEvt == -999) { | |
493 | cout << "DisplayRecParticles > Analyze an event first ... (y/n) " ; | |
494 | Text_t answer[1] ; | |
495 | cin >> answer ; cout << answer ; | |
496 | if ( answer == "y" ) | |
497 | AnalyzeOneEvent() ; | |
498 | } | |
499 | if (fEvt != -999) { | |
500 | ||
501 | Int_t module ; | |
502 | cout << "DisplayRecParticles > which module (1-5, -1: all) ? " ; | |
503 | cin >> module ; cout << module << endl ; | |
504 | Text_t histoname[80] ; | |
505 | sprintf(histoname,"Event %d: Reconstructed particles in module %d", fEvt, module) ; | |
506 | Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module | |
507 | fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, kDegre) ; | |
508 | Double_t theta, phi ; | |
509 | fGeom->EmcXtalCoverage(theta, phi, kDegre) ; | |
510 | Int_t tdim = (Int_t)( (tM - tm) / theta ) ; | |
511 | Int_t pdim = (Int_t)( (pM - pm) / phi ) ; | |
512 | tm -= theta ; | |
513 | tM += theta ; | |
514 | pm -= phi ; | |
515 | TH2F * histoRparticle = new TH2F("histoRparticle", histoname, | |
516 | pdim, pm, pM, tdim, tm, tM) ; | |
517 | histoRparticle->SetStats(kFALSE) ; | |
518 | Text_t canvasname[80] ; | |
519 | sprintf(canvasname, "Reconstructed particles in PHOSmodule # %d", module) ; | |
520 | TCanvas * rparticlecanvas = new TCanvas("RparticleCanvas", canvasname, 650, 500) ; | |
521 | RecParticlesList * rpl = fPHOS->RecParticles() ; | |
522 | Int_t nRecParticles = rpl->GetEntries() ; | |
523 | Int_t nRecParticlesInModule = 0 ; | |
524 | TIter nextRecPart(rpl) ; | |
525 | AliPHOSRecParticle * rp ; | |
526 | cout << "DisplayRecParticles > " << nRecParticles << " reconstructed particles " << endl ; | |
527 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
528 | while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) { | |
529 | AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ; | |
530 | if ( ts->GetPHOSMod() == module ) { | |
531 | nRecParticlesInModule++ ; | |
532 | Double_t theta = rp->Theta() * kRADDEG ; | |
533 | Double_t phi = rp->Phi() * kRADDEG ; | |
534 | Double_t energy = rp->Energy() ; | |
535 | histoRparticle->Fill(phi, theta, energy) ; | |
536 | } | |
537 | } | |
538 | histoRparticle->Draw("color") ; | |
539 | ||
540 | nextRecPart.Reset() ; | |
541 | while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) { | |
542 | AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ; | |
543 | if ( ts->GetPHOSMod() == module ) | |
544 | rp->Draw("P") ; | |
545 | } | |
546 | ||
547 | Text_t text[80] ; | |
548 | sprintf(text, "reconstructed particles: %d", nRecParticlesInModule) ; | |
549 | TPaveText * pavetext = new TPaveText(292, 100, 300, 101); | |
550 | pavetext->AddText(text) ; | |
551 | pavetext->Draw() ; | |
552 | rparticlecanvas->Update() ; | |
553 | } | |
554 | } | |
555 | ||
556 | //____________________________________________________________________________ | |
557 | void AliPHOSAnalyze::DisplayRecPoints() | |
558 | { | |
559 | if (fEvt == -999) { | |
560 | cout << "DisplayRecPoints > Analyze an event first ... (y/n) " ; | |
561 | Text_t answer[1] ; | |
562 | cin >> answer ; cout << answer ; | |
563 | if ( answer == "y" ) | |
564 | AnalyzeOneEvent() ; | |
565 | } | |
566 | if (fEvt != -999) { | |
567 | ||
568 | Int_t module ; | |
569 | cout << "DisplayRecPoints > which module (1-5, -1: all) ? " ; | |
570 | cin >> module ; cout << module << endl ; | |
571 | ||
572 | Text_t canvasname[80]; | |
573 | sprintf(canvasname,"Digits in PHOS/EMC module # %d",module) ; | |
574 | TCanvas * modulecanvas = new TCanvas("module", canvasname, 650, 500) ; | |
575 | modulecanvas->Draw() ; | |
576 | ||
577 | //=========== Creating 2d-histogram of the PHOS module | |
578 | // a little bit junkie but is used to test Geom functinalities | |
579 | ||
580 | Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module | |
581 | ||
582 | fGeom->EmcModuleCoverage(module, tm, tM, pm, pM); | |
583 | // convert angles into coordinates local to the EMC module of interest | |
584 | ||
585 | Int_t emcModuleNumber ; | |
586 | Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module | |
587 | Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module | |
588 | fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ; | |
589 | fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ; | |
590 | Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ; | |
591 | Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ; | |
592 | Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ; | |
593 | Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ; | |
594 | Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ; | |
595 | Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ; | |
596 | Text_t histoname[80]; | |
597 | sprintf(histoname,"Event %d: Digits and RecPoints in module %d", fEvt, module) ; | |
598 | TH2F * hModule = new TH2F("HistoReconstructed", histoname, | |
599 | xdim, xmin, xMax, zdim, zmin, zMax) ; | |
600 | hModule->SetMaximum(2.0); | |
601 | hModule->SetMinimum(0.0); | |
602 | hModule->SetStats(kFALSE); | |
603 | ||
604 | TIter next(fPHOS->Digits()) ; | |
605 | Float_t energy, y, z; | |
606 | Float_t etot=0.; | |
607 | Int_t relid[4]; Int_t nDigits = 0 ; | |
608 | AliPHOSDigit * digit ; | |
609 | while((digit = (AliPHOSDigit *)next())) | |
610 | { | |
611 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
612 | if (relid[0] == module) | |
613 | { | |
614 | if (energy > 0.025 ){ | |
615 | nDigits++ ; | |
616 | energy = fClu->Calibrate(digit->GetAmp()) ; | |
617 | etot += energy ; | |
618 | fGeom->RelPosInModule(relid,y,z) ; | |
619 | hModule->Fill(y, z, energy) ; | |
620 | } | |
621 | } | |
622 | } | |
623 | cout <<"DrawRecPoints > Found in module " | |
624 | << module << " " << nDigits << " digits with total energy " << etot << endl ; | |
625 | hModule->Draw("col2") ; | |
626 | ||
627 | //=========== Cluster in module | |
628 | ||
629 | TClonesArray * emcRP = fPHOS->EmcClusters() ; | |
630 | etot = 0.; | |
631 | Int_t totalnClusters = 0 ; | |
632 | Int_t nClusters = 0 ; | |
633 | TIter nextemc(emcRP) ; | |
634 | AliPHOSEmcRecPoint * emc ; | |
635 | while((emc = (AliPHOSEmcRecPoint *)nextemc())) | |
636 | { | |
637 | // Int_t numberofprimaries ; | |
638 | // Int_t * primariesarray = new Int_t[10] ; | |
639 | // emc->GetPrimaries(numberofprimaries, primariesarray) ; | |
640 | totalnClusters++ ; | |
641 | if ( emc->GetPHOSMod() == module ) | |
642 | { | |
643 | nClusters++ ; | |
644 | energy = emc->GetTotalEnergy() ; | |
645 | etot+= energy ; | |
646 | emc->Draw("M") ; | |
647 | } | |
648 | } | |
649 | cout << "DrawRecPoints > Found " << totalnClusters << " EMC Clusters in PHOS" << endl ; | |
650 | cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " EMC Clusters " << endl ; | |
651 | cout << "DrawRecPoints > total energy " << etot << endl ; | |
652 | ||
653 | TPaveText * pavetext = new TPaveText(22, 80, 83, 90); | |
654 | Text_t text[40] ; | |
655 | sprintf(text, "digits: %d; clusters: %d", nDigits, nClusters) ; | |
656 | pavetext->AddText(text) ; | |
657 | pavetext->Draw() ; | |
658 | modulecanvas->Update(); | |
659 | ||
660 | //=========== Cluster in module PPSD Down | |
661 | ||
662 | TClonesArray * ppsdRP = fPHOS->PpsdClusters() ; | |
663 | etot = 0.; | |
664 | TIter nextPpsd(ppsdRP) ; | |
665 | AliPHOSPpsdRecPoint * ppsd ; | |
666 | while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd())) | |
667 | { | |
668 | totalnClusters++ ; | |
669 | if ( ppsd->GetPHOSMod() == module ) | |
670 | { | |
671 | nClusters++ ; | |
672 | energy = ppsd->GetEnergy() ; | |
673 | etot+=energy ; | |
674 | if (!ppsd->GetUp()) ppsd->Draw("P") ; | |
675 | } | |
676 | } | |
677 | cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Down Clusters in PHOS" << endl ; | |
678 | cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Down Clusters " << endl ; | |
679 | cout << "DrawRecPoints > total energy " << etot << endl ; | |
680 | ||
681 | //=========== Cluster in module PPSD Up | |
682 | ||
683 | ppsdRP = fPHOS->PpsdClusters() ; | |
684 | etot = 0.; | |
685 | TIter nextPpsdUp(ppsdRP) ; | |
686 | while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsdUp())) | |
687 | { | |
688 | totalnClusters++ ; | |
689 | if ( ppsd->GetPHOSMod() == module ) | |
690 | { | |
691 | nClusters++ ; | |
692 | energy = ppsd->GetEnergy() ; | |
693 | etot+=energy ; | |
694 | if (ppsd->GetUp()) ppsd->Draw("P") ; | |
695 | } | |
696 | } | |
697 | cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Up Clusters in PHOS" << endl ; | |
698 | cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Up Clusters " << endl ; | |
699 | cout << "DrawRecPoints > total energy " << etot << endl ; | |
700 | ||
701 | } // if !-999 | |
702 | } | |
703 | ||
704 | //____________________________________________________________________________ | |
705 | void AliPHOSAnalyze::DisplayTrackSegments() | |
706 | { | |
707 | if (fEvt == -999) { | |
708 | cout << "DisplayTrackSegments > Analyze an event first ... (y/n) " ; | |
709 | Text_t answer[1] ; | |
710 | cin >> answer ; cout << answer ; | |
711 | if ( answer == "y" ) | |
712 | AnalyzeOneEvent() ; | |
713 | } | |
714 | if (fEvt != -999) { | |
715 | ||
716 | Int_t module ; | |
717 | cout << "DisplayTrackSegments > which module (1-5, -1: all) ? " ; | |
718 | cin >> module ; cout << module << endl ; | |
719 | //=========== Creating 2d-histogram of the PHOS module | |
720 | // a little bit junkie but is used to test Geom functinalities | |
721 | ||
722 | Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module | |
723 | ||
724 | fGeom->EmcModuleCoverage(module, tm, tM, pm, pM); | |
725 | // convert angles into coordinates local to the EMC module of interest | |
726 | ||
727 | Int_t emcModuleNumber ; | |
728 | Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module | |
729 | Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module | |
730 | fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ; | |
731 | fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ; | |
732 | Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ; | |
733 | Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ; | |
734 | Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ; | |
735 | Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ; | |
736 | Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ; | |
737 | Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ; | |
738 | Text_t histoname[80]; | |
739 | sprintf(histoname,"Event %d: Track Segments in module %d", fEvt, module) ; | |
740 | TH2F * histotrack = new TH2F("histotrack", histoname, | |
741 | xdim, xmin, xMax, zdim, zmin, zMax) ; | |
742 | histotrack->SetStats(kFALSE); | |
743 | Text_t canvasname[80]; | |
744 | sprintf(canvasname,"Track segments in PHOS/EMC-PPSD module # %d", module) ; | |
745 | TCanvas * trackcanvas = new TCanvas("TrackSegmentCanvas", canvasname, 650, 500) ; | |
746 | histotrack->Draw() ; | |
747 | ||
748 | TrackSegmentsList * trsegl = fPHOS->TrackSegments() ; | |
749 | AliPHOSTrackSegment * trseg ; | |
750 | ||
751 | Int_t nTrackSegments = trsegl->GetEntries() ; | |
752 | Int_t index ; | |
753 | Float_t etot = 0 ; | |
754 | Int_t nTrackSegmentsInModule = 0 ; | |
755 | for(index = 0; index < nTrackSegments ; index++){ | |
756 | trseg = (AliPHOSTrackSegment * )trsegl->At(index) ; | |
757 | etot+= trseg->GetEnergy() ; | |
758 | if ( trseg->GetPHOSMod() == module ) { | |
759 | nTrackSegmentsInModule++ ; | |
760 | trseg->Draw("P"); | |
761 | } | |
762 | } | |
763 | Text_t text[80] ; | |
764 | sprintf(text, "track segments: %d", nTrackSegmentsInModule) ; | |
765 | TPaveText * pavetext = new TPaveText(22, 80, 83, 90); | |
766 | pavetext->AddText(text) ; | |
767 | pavetext->Draw() ; | |
768 | trackcanvas->Update() ; | |
769 | cout << "DisplayTrackSegments > Found " << trsegl->GetEntries() << " Track segments with total energy "<< etot << endl ; | |
770 | ||
771 | } | |
772 | } | |
773 | //____________________________________________________________________________ | |
774 | Bool_t AliPHOSAnalyze::OpenRootFile(Text_t * name) | |
775 | { | |
776 | fRootFile = new TFile(name) ; | |
777 | return fRootFile->IsOpen() ; | |
778 | } | |
779 | //____________________________________________________________________________ | |
780 | void AliPHOSAnalyze::SavingHistograms() | |
781 | { | |
782 | Text_t outputname[80] ;// = fRootFile->GetName(); | |
783 | sprintf(outputname,"%s.analyzed",fRootFile->GetName()); | |
784 | TFile output(outputname,"RECREATE"); | |
785 | output.cd(); | |
786 | if (fhEmcDigit ) | |
787 | fhEmcDigit->Write() ; | |
788 | if (fhVetoDigit ) | |
789 | fhVetoDigit->Write() ; | |
790 | if (fhConvertorDigit ) | |
791 | fhConvertorDigit->Write() ; | |
792 | if (fhEmcCluster ) | |
793 | fhEmcCluster->Write() ; | |
794 | if (fhVetoCluster ) | |
795 | fhVetoCluster->Write() ; | |
796 | if (fhConvertorCluster ) | |
797 | fhConvertorCluster->Write() ; | |
798 | if (fhConvertorEmc ) | |
799 | fhConvertorEmc->Write() ; | |
800 | if (fhPhotonEnergy) | |
801 | fhPhotonEnergy->Write() ; | |
802 | if (fhPhotonPositionX) | |
803 | fhPhotonPositionX->Write() ; | |
804 | if (fhPhotonPositionY) | |
805 | fhPhotonPositionX->Write() ; | |
806 | if (fhElectronEnergy) | |
807 | fhElectronEnergy->Write() ; | |
808 | if (fhElectronPositionX) | |
809 | fhElectronPositionX->Write() ; | |
810 | if (fhElectronPositionY) | |
811 | fhElectronPositionX->Write() ; | |
812 | if (fhNeutralHadronEnergy) | |
813 | fhNeutralHadronEnergy->Write() ; | |
814 | if (fhNeutralHadronPositionX) | |
815 | fhNeutralHadronPositionX->Write() ; | |
816 | if (fhNeutralHadronPositionY) | |
817 | fhNeutralHadronPositionX->Write() ; | |
818 | if (fhNeutralEMEnergy) | |
819 | fhNeutralEMEnergy->Write() ; | |
820 | if (fhNeutralEMPositionX) | |
821 | fhNeutralEMPositionX->Write() ; | |
822 | if (fhNeutralEMPositionY) | |
823 | fhNeutralEMPositionX->Write() ; | |
824 | if (fhChargedHadronEnergy) | |
825 | fhChargedHadronEnergy->Write() ; | |
826 | if (fhChargedHadronPositionX) | |
827 | fhChargedHadronPositionX->Write() ; | |
828 | if (fhChargedHadronPositionY) | |
829 | fhChargedHadronPositionX->Write() ; | |
830 | if (fhPhotonHadronEnergy) | |
831 | fhPhotonHadronEnergy->Write() ; | |
832 | if (fhPhotonHadronPositionX) | |
833 | fhPhotonHadronPositionX->Write() ; | |
834 | if (fhPhotonHadronPositionY) | |
835 | fhPhotonHadronPositionX->Write() ; | |
836 | ||
837 | output.Write(); | |
838 | output.Close(); | |
839 | } |