]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSAnalyze.cxx
DisplayRecPoint threshold is added for digit 2D histo and clusterizing parameters...
[u/mrichter/AliRoot.git] / PHOS / AliPHOSAnalyze.cxx
CommitLineData
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
16//_________________________________________________________________________
17// Algorythm class to analyze PHOS events
18//*-- Y. Schutz : SUBATECH
19//////////////////////////////////////////////////////////////////////////////
20
21// --- ROOT system ---
22
92862013 23#include "TFile.h"
24#include "TH1.h"
25#include "TPad.h"
6ad0bfa0 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
92862013 35#include <iostream>
36#include <cstdio>
37
6ad0bfa0 38// --- AliRoot header files ---
39
40#include "AliRun.h"
41#include "AliPHOSAnalyze.h"
42#include "AliPHOSClusterizerv1.h"
43#include "AliPHOSTrackSegmentMakerv1.h"
26d4b141 44#include "AliPHOSPIDv1.h"
6ad0bfa0 45#include "AliPHOSReconstructioner.h"
46#include "AliPHOSDigit.h"
47#include "AliPHOSTrackSegment.h"
48#include "AliPHOSRecParticle.h"
49
50ClassImp(AliPHOSAnalyze)
51
52
53//____________________________________________________________________________
54 AliPHOSAnalyze::AliPHOSAnalyze()
55{
56 // ctor
57
58 fRootFile = 0 ;
59}
60
61//____________________________________________________________________________
62AliPHOSAnalyze::AliPHOSAnalyze(Text_t * name)
63{
64 // ctor
65
92862013 66 Bool_t ok = OpenRootFile(name) ;
67 if ( !ok ) {
6ad0bfa0 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//____________________________________________________________________________
79AliPHOSAnalyze::~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
26d4b141 93 delete fPID ;
94 fPID = 0 ;
6ad0bfa0 95
96 delete fRec ;
97 fRec = 0 ;
98
99 delete fTrs ;
100 fTrs = 0 ;
101
102}
103
104//____________________________________________________________________________
105void AliPHOSAnalyze::AnalyzeOneEvent(Int_t evt)
106{
92862013 107 Bool_t ok = Init(evt) ;
6ad0bfa0 108
92862013 109 if ( ok ) {
6ad0bfa0 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 ;
92862013 124 } // ok
6ad0bfa0 125 else
126 cout << "AnalyzeOneEvent > filed to process event # " << evt << endl ;
127
128}
129
92862013 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;
6a3f1304 147 Int_t relid[4] ;
92862013 148 AliPHOSDigit * digit ;
149 AliPHOSEmcRecPoint * emc ;
150 AliPHOSPpsdRecPoint * ppsd ;
38f8ae6d 151 // AliPHOSTrackSegment * tracksegment ;
152 AliPHOSRecParticle * recparticle;
92862013 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) ;
3fc07a80 159 fClu->SetEmcClusteringThreshold(0.50) ;
92862013 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
6727be7e 165 fTrs = new AliPHOSTrackSegmentMakerv1() ;
3fc07a80 166 fTrs->UnsetUnfoldFlag() ;
26d4b141 167 //========== Creates the particle identifier
168 fPID = new AliPHOSPIDv1() ;
6a3f1304 169 fPID->SetShowerProfileCuts(0.3, 1.8, 0.3, 1.8 ) ;
09fc14a0 170 fPID->Print() ;
92862013 171 //========== Creates the Reconstructioner
26d4b141 172 fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
92862013 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
38f8ae6d 221 TIter nextRecParticle(fPHOS->RecParticles() ) ;
222 while((recparticle = (AliPHOSRecParticle *)nextRecParticle()))
92862013 223 {
38f8ae6d 224 if ( recparticle->GetPHOSTrackSegment()->GetPHOSMod() == module )
92862013 225 {
38f8ae6d 226 cout << "Particle type is " << recparticle->GetType() << endl ;
227 switch(recparticle->GetType())
92862013 228 {
09fc14a0 229 case kGAMMA:
38f8ae6d 230 fhPhotonEnergy->Fill(recparticle->Energy() ) ;
09fc14a0 231 //fhPhotonPositionX->Fill(recpart. ) ;
232 //fhPhotonPositionY->Fill(recpart. ) ;
38f8ae6d 233 cout << "PHOTON" << endl;
92862013 234 break;
09fc14a0 235 case kELECTRON:
38f8ae6d 236 fhElectronEnergy->Fill(recparticle->Energy() ) ;
09fc14a0 237 //fhElectronPositionX->Fill(recpart. ) ;
238 //fhElectronPositionY->Fill(recpart. ) ;
38f8ae6d 239 cout << "ELECTRON" << endl;
92862013 240 break;
b9bbdad1 241 case kNEUTRALHADRON:
38f8ae6d 242 fhNeutralHadronEnergy->Fill(recparticle->Energy() ) ;
b9bbdad1 243 //fhNeutralHadronPositionX->Fill(recpart. ) ;
244 //fhNeutralHadronPositionY->Fill(recpart. ) ;
38f8ae6d 245 cout << "NEUTRAl HADRON" << endl;
b9bbdad1 246 break ;
247 case kNEUTRALEM:
38f8ae6d 248 fhNeutralEMEnergy->Fill(recparticle->Energy() ) ;
b9bbdad1 249 //fhNeutralEMPositionX->Fill(recpart. ) ;
250 //fhNeutralEMPositionY->Fill(recpart. ) ;
251 //cout << "NEUTRAL EM" << endl;
92862013 252 break ;
0dd37dda 253 case kCHARGEDHADRON:
38f8ae6d 254 fhChargedHadronEnergy->Fill(recparticle->Energy() ) ;
09fc14a0 255 //fhChargedHadronPositionX->Fill(recpart. ) ;
256 //fhChargedHadronPositionY->Fill(recpart. ) ;
38f8ae6d 257 cout << "CHARGED HADRON" << endl;
92862013 258 break ;
c1d256cb 259 case kGAMMAHADRON:
260 fhPhotonHadronEnergy->Fill(recparticle->Energy() ) ;
261 //fhPhotonHadronPositionX->Fill(recpart. ) ;
262 //fhPhotonHadronPositionY->Fill(recpart. ) ;
263 cout << "PHOTON HADRON" << endl;
264 break ;
92862013 265 }
266 }
267 }
26d4b141 268 // Deleting fClu, fTrs, fPID et fRec
92862013 269 fClu->Delete();
270 fTrs->Delete();
26d4b141 271 fPID->Delete();
92862013 272 fRec->Delete();
273
274 } // endfor
275 SavingHistograms();
276 } // endif
277} // endfunction
278
279
280//____________________________________________________________________________
281void AliPHOSAnalyze::BookingHistograms()
282{
b9bbdad1 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.);
c1d256cb 310 fhPhotonHadronEnergy = new TH1F("hPhotonHadronEnergy","hPhotonHadronEnergy",500,-80. , 80.);
b9bbdad1 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.);
09fc14a0 315 fhChargedHadronPositionX = new TH1F("hChargedHadronPositionX","hChargedHadronPositionX",500,-80. , 80.);
c1d256cb 316 fhPhotonHadronPositionX = new TH1F("hPhotonHadronPositionX","hPhotonHadronPositionX",500,-80. , 80.);
b9bbdad1 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.);
09fc14a0 321 fhChargedHadronPositionY = new TH1F("hChargedHadronPositionY","hChargedHadronPositionY",500,-80. , 80.);
c1d256cb 322 fhPhotonHadronPositionY = new TH1F("hPhotonHadronPositionY","hPhotonHadronPositionY",500,-80. , 80.);
92862013 323
3fc07a80 324
92862013 325}
6ad0bfa0 326//____________________________________________________________________________
327Bool_t AliPHOSAnalyze::Init(Int_t evt)
328{
329
92862013 330 Bool_t ok = kTRUE ;
6ad0bfa0 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 ;
92862013 338 Bool_t ok = OpenRootFile(name) ;
339 if ( !ok )
6ad0bfa0 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() );
92862013 350 } // else !ok
6ad0bfa0 351 } // if fRootFile
352
92862013 353 if ( ok ) {
6ad0bfa0 354
355 //========== Create the Clusterizer
356
357 fClu = new AliPHOSClusterizerv1() ;
92862013 358 fClu->SetEmcEnergyThreshold(0.025) ;
3fc07a80 359 fClu->SetEmcClusteringThreshold(0.50) ;
92862013 360 fClu->SetPpsdEnergyThreshold (0.0000002) ;
361 fClu->SetPpsdClusteringThreshold(0.0000001) ;
6ad0bfa0 362 fClu->SetLocalMaxCut(0.03) ;
92862013 363 fClu->SetCalibrationParameters(0., 0.00000001) ;
6ad0bfa0 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
26d4b141 372 //========== Creates the particle identifier
6ad0bfa0 373
26d4b141 374 fPID = new AliPHOSPIDv1() ;
375 cout << "AnalyzeOneEvent > using particle identifier " << fPID->GetName() << endl ;
6ad0bfa0 376
377 //========== Creates the Reconstructioner
378
26d4b141 379 fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
6ad0bfa0 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
92862013 395 } // ok
6ad0bfa0 396
92862013 397 return ok ;
6ad0bfa0 398}
399
92862013 400
6ad0bfa0 401//____________________________________________________________________________
92862013 402void AliPHOSAnalyze::DisplayKineEvent(Int_t evt)
6ad0bfa0 403{
404 if (evt == -999)
405 evt = fEvt ;
406
92862013 407 Int_t module ;
6ad0bfa0 408 cout << "DisplayKineEvent > which module (1-5, -1: all) ? " ;
92862013 409 cin >> module ; cout << module << endl ;
6ad0bfa0 410
92862013 411 Int_t testparticle ;
6ad0bfa0 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 " ;
92862013 417 cin >> testparticle ; cout << testparticle << endl ;
6ad0bfa0 418
92862013 419 Text_t histoname[80] ;
420 sprintf(histoname,"Event %d: Incident particles in module %d", evt, module) ;
6ad0bfa0 421
92862013 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) ;
6ad0bfa0 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
92862013 436 TH2F * histoparticle = new TH2F("histoparticle", histoname,
6ad0bfa0 437 pdim, pm, pM, tdim, tm, tM) ;
92862013 438 histoparticle->SetStats(kFALSE) ;
6ad0bfa0 439
440 // Get pointers to Alice Particle TClonesArray
441
92862013 442 TParticle * particle;
443 TClonesArray * particlearray = gAlice->Particles();
6ad0bfa0 444
92862013 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) ;
6ad0bfa0 448
449 // get the KINE Tree
450
92862013 451 TTree * kine = gAlice->TreeK() ;
452 Stat_t nParticles = kine->GetEntries() ;
453 cout << "DisplayKineEvent > events in kine " << nParticles << endl ;
6ad0bfa0 454
455 // loop over particles
456
92862013 457 Double_t kRADDEG = 180. / TMath::Pi() ;
6ad0bfa0 458 Int_t index1 ;
459 Int_t nparticlein = 0 ;
92862013 460 for (index1 = 0 ; index1 < nParticles ; index1++){
461 Int_t nparticle = particlearray->GetEntriesFast() ;
6ad0bfa0 462 Int_t index2 ;
463 for( index2 = 0 ; index2 < nparticle ; index2++) {
92862013 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() ;
6ad0bfa0 469 Int_t mod ;
470 Double_t x, z ;
92862013 471 fGeom->ImpactOnEmc(theta, phi, mod, z, x) ;
472 if ( mod == module ) {
6ad0bfa0 473 nparticlein++ ;
92862013 474 histoparticle->Fill(phi*kRADDEG, theta*kRADDEG, particle->Energy() ) ;
6ad0bfa0 475 }
476 }
477 }
478 }
92862013 479 kinecanvas->Draw() ;
480 histoparticle->Draw("color") ;
481 TPaveText * pavetext = new TPaveText(294, 100, 300, 101);
6ad0bfa0 482 Text_t text[40] ;
483 sprintf(text, "Particles: %d ", nparticlein) ;
92862013 484 pavetext->AddText(text) ;
485 pavetext->Draw() ;
486 kinecanvas->Update();
6ad0bfa0 487
488}
489//____________________________________________________________________________
490void AliPHOSAnalyze::DisplayRecParticles()
491{
492 if (fEvt == -999) {
15605d3c 493 cout << "DisplayRecParticles > Analyze an event first ... (y/n) " ;
6ad0bfa0 494 Text_t answer[1] ;
495 cin >> answer ; cout << answer ;
496 if ( answer == "y" )
497 AnalyzeOneEvent() ;
498 }
499 if (fEvt != -999) {
500
92862013 501 Int_t module ;
15605d3c 502 cout << "DisplayRecParticles > which module (1-5, -1: all) ? " ;
92862013 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) ;
6ad0bfa0 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 ;
92862013 515 TH2F * histoRparticle = new TH2F("histoRparticle", histoname,
6ad0bfa0 516 pdim, pm, pM, tdim, tm, tM) ;
92862013 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) ;
6ad0bfa0 521 RecParticlesList * rpl = fPHOS->RecParticles() ;
92862013 522 Int_t nRecParticles = rpl->GetEntries() ;
523 Int_t nRecParticlesInModule = 0 ;
6ad0bfa0 524 TIter nextRecPart(rpl) ;
525 AliPHOSRecParticle * rp ;
92862013 526 cout << "DisplayRecParticles > " << nRecParticles << " reconstructed particles " << endl ;
527 Double_t kRADDEG = 180. / TMath::Pi() ;
6ad0bfa0 528 while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) {
529 AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ;
92862013 530 if ( ts->GetPHOSMod() == module ) {
531 nRecParticlesInModule++ ;
532 Double_t theta = rp->Theta() * kRADDEG ;
533 Double_t phi = rp->Phi() * kRADDEG ;
6ad0bfa0 534 Double_t energy = rp->Energy() ;
92862013 535 histoRparticle->Fill(phi, theta, energy) ;
6ad0bfa0 536 }
537 }
92862013 538 histoRparticle->Draw("color") ;
15605d3c 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
6ad0bfa0 547 Text_t text[80] ;
92862013 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() ;
6ad0bfa0 553 }
554}
555
556//____________________________________________________________________________
557void 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
92862013 568 Int_t module ;
6ad0bfa0 569 cout << "DisplayRecPoints > which module (1-5, -1: all) ? " ;
92862013 570 cin >> module ; cout << module << endl ;
6ad0bfa0 571
92862013 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() ;
6ad0bfa0 576
92862013 577 //=========== Creating 2d-histogram of the PHOS module
6ad0bfa0 578 // a little bit junkie but is used to test Geom functinalities
579
92862013 580 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
6ad0bfa0 581
92862013 582 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM);
6ad0bfa0 583 // convert angles into coordinates local to the EMC module of interest
584
92862013 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,
6ad0bfa0 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()) ;
92862013 605 Float_t energy, y, z;
606 Float_t etot=0.;
607 Int_t relid[4]; Int_t nDigits = 0 ;
6ad0bfa0 608 AliPHOSDigit * digit ;
6ad0bfa0 609 while((digit = (AliPHOSDigit *)next()))
610 {
92862013 611 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
612 if (relid[0] == module)
3fc07a80 613 {
614 if (energy > 0.025 ){
92862013 615 nDigits++ ;
616 energy = fClu->Calibrate(digit->GetAmp()) ;
617 etot += energy ;
3fc07a80 618 fGeom->RelPosInModule(relid,y,z) ;
619 hModule->Fill(y, z, energy) ;
620 }
6ad0bfa0 621 }
622 }
92862013 623 cout <<"DrawRecPoints > Found in module "
624 << module << " " << nDigits << " digits with total energy " << etot << endl ;
6ad0bfa0 625 hModule->Draw("col2") ;
626
92862013 627 //=========== Cluster in module
6ad0bfa0 628
92862013 629 TClonesArray * emcRP = fPHOS->EmcClusters() ;
630 etot = 0.;
631 Int_t totalnClusters = 0 ;
632 Int_t nClusters = 0 ;
633 TIter nextemc(emcRP) ;
6ad0bfa0 634 AliPHOSEmcRecPoint * emc ;
635 while((emc = (AliPHOSEmcRecPoint *)nextemc()))
636 {
3fc07a80 637 // Int_t numberofprimaries ;
638 // Int_t * primariesarray = new Int_t[10] ;
639 // emc->GetPrimaries(numberofprimaries, primariesarray) ;
92862013 640 totalnClusters++ ;
641 if ( emc->GetPHOSMod() == module )
6ad0bfa0 642 {
92862013 643 nClusters++ ;
644 energy = emc->GetTotalEnergy() ;
645 etot+= energy ;
26d4b141 646 emc->Draw("M") ;
6ad0bfa0 647 }
648 }
92862013 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 ;
6ad0bfa0 652
92862013 653 TPaveText * pavetext = new TPaveText(22, 80, 83, 90);
6ad0bfa0 654 Text_t text[40] ;
92862013 655 sprintf(text, "digits: %d; clusters: %d", nDigits, nClusters) ;
656 pavetext->AddText(text) ;
657 pavetext->Draw() ;
658 modulecanvas->Update();
6ad0bfa0 659
92862013 660 //=========== Cluster in module PPSD Down
6ad0bfa0 661
92862013 662 TClonesArray * ppsdRP = fPHOS->PpsdClusters() ;
663 etot = 0.;
664 TIter nextPpsd(ppsdRP) ;
665 AliPHOSPpsdRecPoint * ppsd ;
666 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
6ad0bfa0 667 {
92862013 668 totalnClusters++ ;
669 if ( ppsd->GetPHOSMod() == module )
6ad0bfa0 670 {
92862013 671 nClusters++ ;
672 energy = ppsd->GetEnergy() ;
673 etot+=energy ;
674 if (!ppsd->GetUp()) ppsd->Draw("P") ;
6ad0bfa0 675 }
676 }
92862013 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 ;
6ad0bfa0 680
92862013 681 //=========== Cluster in module PPSD Up
6ad0bfa0 682
92862013 683 ppsdRP = fPHOS->PpsdClusters() ;
684 etot = 0.;
685 TIter nextPpsdUp(ppsdRP) ;
686 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsdUp()))
6ad0bfa0 687 {
92862013 688 totalnClusters++ ;
689 if ( ppsd->GetPHOSMod() == module )
6ad0bfa0 690 {
92862013 691 nClusters++ ;
692 energy = ppsd->GetEnergy() ;
693 etot+=energy ;
694 if (ppsd->GetUp()) ppsd->Draw("P") ;
6ad0bfa0 695 }
696 }
92862013 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 ;
6ad0bfa0 700
701 } // if !-999
702}
703
704//____________________________________________________________________________
705void 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
92862013 716 Int_t module ;
6ad0bfa0 717 cout << "DisplayTrackSegments > which module (1-5, -1: all) ? " ;
92862013 718 cin >> module ; cout << module << endl ;
719 //=========== Creating 2d-histogram of the PHOS module
6ad0bfa0 720 // a little bit junkie but is used to test Geom functinalities
721
92862013 722 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
6ad0bfa0 723
92862013 724 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM);
6ad0bfa0 725 // convert angles into coordinates local to the EMC module of interest
726
92862013 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,
6ad0bfa0 741 xdim, xmin, xMax, zdim, zmin, zMax) ;
92862013 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() ;
6ad0bfa0 747
748 TrackSegmentsList * trsegl = fPHOS->TrackSegments() ;
749 AliPHOSTrackSegment * trseg ;
750
92862013 751 Int_t nTrackSegments = trsegl->GetEntries() ;
6ad0bfa0 752 Int_t index ;
92862013 753 Float_t etot = 0 ;
754 Int_t nTrackSegmentsInModule = 0 ;
755 for(index = 0; index < nTrackSegments ; index++){
6ad0bfa0 756 trseg = (AliPHOSTrackSegment * )trsegl->At(index) ;
92862013 757 etot+= trseg->GetEnergy() ;
758 if ( trseg->GetPHOSMod() == module ) {
759 nTrackSegmentsInModule++ ;
6ad0bfa0 760 trseg->Draw("P");
761 }
762 }
763 Text_t text[80] ;
92862013 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 ;
6ad0bfa0 770
771 }
772}
773//____________________________________________________________________________
774Bool_t AliPHOSAnalyze::OpenRootFile(Text_t * name)
775{
776 fRootFile = new TFile(name) ;
777 return fRootFile->IsOpen() ;
778}
92862013 779//____________________________________________________________________________
780void AliPHOSAnalyze::SavingHistograms()
781{
3862b681 782 Text_t outputname[80] ;// = fRootFile->GetName();
783 sprintf(outputname,"%s.analyzed",fRootFile->GetName());
784 TFile output(outputname,"RECREATE");
92862013 785 output.cd();
b9bbdad1 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() ;
c1d256cb 830 if (fhPhotonHadronEnergy)
831 fhPhotonHadronEnergy->Write() ;
832 if (fhPhotonHadronPositionX)
833 fhPhotonHadronPositionX->Write() ;
834 if (fhPhotonHadronPositionY)
835 fhPhotonHadronPositionX->Write() ;
92862013 836
837 output.Write();
838 output.Close();
839}