1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // Algorythm class to analyze PHOSv0 events:
20 // Construct histograms and displays them.
21 // Use the macro EditorBar.C for best access to the functionnalities
23 //*-- Author: Y. Schutz (SUBATECH)
24 //////////////////////////////////////////////////////////////////////////////
26 // --- ROOT system ---
32 #include "TParticle.h"
33 #include "TClonesArray.h"
38 // --- Standard library ---
43 // --- AliRoot header files ---
46 #include "AliPHOSAnalyze.h"
47 #include "AliPHOSClusterizerv1.h"
48 #include "AliPHOSTrackSegmentMakerv1.h"
49 #include "AliPHOSPIDv1.h"
50 #include "AliPHOSReconstructioner.h"
51 #include "AliPHOSDigit.h"
52 #include "AliPHOSTrackSegment.h"
53 #include "AliPHOSRecParticle.h"
55 ClassImp(AliPHOSAnalyze)
58 //____________________________________________________________________________
59 AliPHOSAnalyze::AliPHOSAnalyze()
61 // default ctor (useless)
66 //____________________________________________________________________________
67 AliPHOSAnalyze::AliPHOSAnalyze(Text_t * name)
69 // ctor: analyze events from root file: name
71 Bool_t ok = OpenRootFile(name) ;
73 cout << " AliPHOSAnalyze > Error opening " << name << endl ;
76 gAlice = (AliRun*) fRootFile->Get("gAlice");
77 fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
78 fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ) ;
83 //____________________________________________________________________________
84 AliPHOSAnalyze::~AliPHOSAnalyze()
109 //____________________________________________________________________________
110 void AliPHOSAnalyze::AnalyzeOneEvent(Int_t evt)
112 // analyze one single event with id=evt
116 Bool_t ok = Init(evt) ;
119 //=========== Get the number of entries in the Digits array
121 Int_t nId = fPHOS->Digits()->GetEntries();
122 printf("AnalyzeOneEvent > Number of entries in the Digit array is %d \n",nId);
124 //=========== Do the reconstruction
126 cout << "AnalyzeOneEvent > Found " << nId << " digits in PHOS" << endl ;
129 fPHOS->Reconstruction(fRec);
131 // =========== End of reconstruction
133 // =========== Write the root file
137 // =========== Finish
139 cout << "AnalyzeOneEvent > event # " << fEvt << " processed" << endl ;
142 cout << "AnalyzeOneEvent > filed to process event # " << evt << endl ;
144 ts.Stop() ; cout << "CPU time = " << ts.CpuTime() << endl ;
145 cout << "Real time = " << ts.RealTime() << endl ;
148 //____________________________________________________________________________
149 void AliPHOSAnalyze::AnalyzeManyEvents(Int_t Nevents, Int_t module)
151 // analyzes Nevents events in a single PHOS module
153 if ( fRootFile == 0 )
154 cout << "AnalyzeManyEvents > " << "Root File not openned" << endl ;
157 //========== Get AliRun object from file
158 gAlice = (AliRun*) fRootFile->Get("gAlice") ;
159 //=========== Get the PHOS object and associated geometry from the file
160 fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
161 fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
162 //========== Booking Histograms
163 cout << "AnalyzeManyEvents > " << "Booking Histograms" << endl ;
167 AliPHOSDigit * digit ;
168 AliPHOSEmcRecPoint * emc ;
169 AliPHOSPpsdRecPoint * ppsd ;
170 // AliPHOSTrackSegment * tracksegment ;
171 AliPHOSRecParticle * recparticle;
172 for ( ievent=0; ievent<Nevents; ievent++)
174 if (ievent==0) cout << "AnalyzeManyEvents > " << "Starting Analyzing " << endl ;
175 //========== Create the Clusterizer
176 fClu = new AliPHOSClusterizerv1() ;
177 fClu->SetEmcEnergyThreshold(0.025) ;
178 fClu->SetEmcClusteringThreshold(0.50) ;
179 fClu->SetPpsdEnergyThreshold (0.0000002) ;
180 fClu->SetPpsdClusteringThreshold(0.0000001) ;
181 fClu->SetLocalMaxCut(0.03) ;
182 fClu->SetCalibrationParameters(0., 0.00000001) ;
183 //========== Creates the track segment maker
184 fTrs = new AliPHOSTrackSegmentMakerv1() ;
185 fTrs->UnsetUnfoldFlag() ;
186 //========== Creates the particle identifier
187 fPID = new AliPHOSPIDv1() ;
188 fPID->SetShowerProfileCuts(0.3, 1.8, 0.3, 1.8 ) ;
190 //========== Creates the Reconstructioner
191 fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
192 //========== Event Number>
193 if ( ( log10((Float_t)(ievent+1)) - (Int_t)(log10((Float_t)(ievent+1))) ) == 0. )
194 cout << "AnalyzeManyEvents > " << "Event is " << ievent << endl ;
195 //=========== Connects the various Tree's for evt
196 gAlice->GetEvent(ievent);
197 //=========== Gets the Digit TTree
198 gAlice->TreeD()->GetEvent(0) ;
199 //=========== Gets the number of entries in the Digits array
200 TIter nextdigit(fPHOS->Digits()) ;
201 while( ( digit = (AliPHOSDigit *)nextdigit() ) )
203 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
204 if (fClu->IsInEmc(digit)) fhEmcDigit->Fill(fClu->Calibrate(digit->GetAmp())) ;
207 if (relid[1]<17) fhVetoDigit->Fill(fClu->Calibrate(digit->GetAmp()));
208 if (relid[1]>16) fhConvertorDigit->Fill(fClu->Calibrate(digit->GetAmp()));
211 //=========== Do the reconstruction
212 fPHOS->Reconstruction(fRec);
213 //=========== Cluster in module
214 TIter nextEmc(fPHOS->EmcClusters() ) ;
215 while((emc = (AliPHOSEmcRecPoint *)nextEmc()))
217 if ( emc->GetPHOSMod() == module )
219 fhEmcCluster->Fill( emc->GetTotalEnergy() );
220 TIter nextPpsd( fPHOS->PpsdClusters()) ;
221 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
223 if ( ppsd->GetPHOSMod() == module )
225 if (!ppsd->GetUp()) fhConvertorEmc->Fill(emc->GetTotalEnergy(),ppsd->GetTotalEnergy()) ;
230 //=========== Cluster in module PPSD Down
231 TIter nextPpsd(fPHOS->PpsdClusters() ) ;
232 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
234 if ( ppsd->GetPHOSMod() == module )
236 if (!ppsd->GetUp()) fhConvertorCluster->Fill(ppsd->GetTotalEnergy()) ;
237 if (ppsd->GetUp()) fhVetoCluster ->Fill(ppsd->GetTotalEnergy()) ;
240 //========== TRackSegments in the event
241 TIter nextRecParticle(fPHOS->RecParticles() ) ;
242 while((recparticle = (AliPHOSRecParticle *)nextRecParticle()))
244 if ( recparticle->GetPHOSTrackSegment()->GetPHOSMod() == module )
246 cout << "Particle type is " << recparticle->GetType() << endl ;
247 Int_t numberofprimaries = 0 ;
248 Int_t * listofprimaries = recparticle->GetPrimaries(numberofprimaries) ;
249 cout << "Number of primaries = " << numberofprimaries << endl ;
251 for ( index = 0 ; index < numberofprimaries ; index++)
252 cout << " primary # " << index << " = " << listofprimaries[index] << endl ;
253 switch(recparticle->GetType())
256 fhPhotonEnergy->Fill(recparticle->Energy() ) ;
257 //fhPhotonPositionX->Fill(recpart. ) ;
258 //fhPhotonPositionY->Fill(recpart. ) ;
259 cout << "PHOTON" << endl;
262 fhElectronEnergy->Fill(recparticle->Energy() ) ;
263 //fhElectronPositionX->Fill(recpart. ) ;
264 //fhElectronPositionY->Fill(recpart. ) ;
265 cout << "ELECTRON" << endl;
268 fhNeutralHadronEnergy->Fill(recparticle->Energy() ) ;
269 //fhNeutralHadronPositionX->Fill(recpart. ) ;
270 //fhNeutralHadronPositionY->Fill(recpart. ) ;
271 cout << "NEUTRAl HADRON" << endl;
274 fhNeutralEMEnergy->Fill(recparticle->Energy() ) ;
275 //fhNeutralEMPositionX->Fill(recpart. ) ;
276 //fhNeutralEMPositionY->Fill(recpart. ) ;
277 //cout << "NEUTRAL EM" << endl;
280 fhChargedHadronEnergy->Fill(recparticle->Energy() ) ;
281 //fhChargedHadronPositionX->Fill(recpart. ) ;
282 //fhChargedHadronPositionY->Fill(recpart. ) ;
283 cout << "CHARGED HADRON" << endl;
286 fhPhotonHadronEnergy->Fill(recparticle->Energy() ) ;
287 //fhPhotonHadronPositionX->Fill(recpart. ) ;
288 //fhPhotonHadronPositionY->Fill(recpart. ) ;
289 cout << "PHOTON HADRON" << endl;
294 // Deleting fClu, fTrs, fPID et fRec
306 //____________________________________________________________________________
307 void AliPHOSAnalyze::BookingHistograms()
309 // Books the histograms where the results of the analysis are stored (to be changed)
315 if (fhConvertorDigit )
316 delete fhConvertorDigit ;
318 delete fhEmcCluster ;
320 delete fhVetoCluster ;
321 if (fhConvertorCluster )
322 delete fhConvertorCluster ;
324 delete fhConvertorEmc ;
326 fhEmcDigit = new TH1F("hEmcDigit", "hEmcDigit", 1000, 0. , 25.);
327 fhVetoDigit = new TH1F("hVetoDigit", "hVetoDigit", 500, 0. , 3.e-5);
328 fhConvertorDigit = new TH1F("hConvertorDigit","hConvertorDigit", 500, 0. , 3.e-5);
329 fhEmcCluster = new TH1F("hEmcCluster", "hEmcCluster", 1000, 0. , 30.);
330 fhVetoCluster = new TH1F("hVetoCluster", "hVetoCluster", 500, 0. , 3.e-5);
331 fhConvertorCluster = new TH1F("hConvertorCluster","hConvertorCluster",500, 0. , 3.e-5);
332 fhConvertorEmc = new TH2F("hConvertorEmc", "hConvertorEmc", 200, 1. , 3., 200, 0., 3.e-5);
333 fhPhotonEnergy = new TH1F("hPhotonEnergy", "hPhotonEnergy", 1000, 0. , 30.);
334 fhElectronEnergy = new TH1F("hElectronEnergy","hElectronEnergy", 1000, 0. , 30.);
335 fhNeutralHadronEnergy = new TH1F("hNeutralHadronEnergy", "hNeutralHadronEnergy", 1000, 0. , 30.);
336 fhNeutralEMEnergy = new TH1F("hNeutralEMEnergy", "hNeutralEMEnergy", 1000, 0. , 30.);
337 fhChargedHadronEnergy = new TH1F("hChargedHadronEnergy", "hChargedHadronEnergy", 1000, 0. , 30.);
338 fhPhotonHadronEnergy = new TH1F("hPhotonHadronEnergy","hPhotonHadronEnergy",500,-80. , 80.);
339 fhPhotonPositionX = new TH1F("hPhotonPositionX","hPhotonPositionX", 500,-80. , 80.);
340 fhElectronPositionX = new TH1F("hElectronPositionX","hElectronPositionX",500,-80. , 80.);
341 fhNeutralHadronPositionX = new TH1F("hNeutralHadronPositionX","hNeutralHadronPositionX",500,-80. , 80.);
342 fhNeutralEMPositionX = new TH1F("hNeutralEMPositionX","hNeutralEMPositionX",500,-80. , 80.);
343 fhChargedHadronPositionX = new TH1F("hChargedHadronPositionX","hChargedHadronPositionX",500,-80. , 80.);
344 fhPhotonHadronPositionX = new TH1F("hPhotonHadronPositionX","hPhotonHadronPositionX",500,-80. , 80.);
345 fhPhotonPositionY = new TH1F("hPhotonPositionY","hPhotonPositionY", 500,-80. , 80.);
346 fhElectronPositionY = new TH1F("hElectronPositionY","hElectronPositionY",500,-80. , 80.);
347 fhNeutralHadronPositionY = new TH1F("hNeutralHadronPositionY","hNeutralHadronPositionY",500,-80. , 80.);
348 fhNeutralEMPositionY = new TH1F("hNeutralEMPositionY","hNeutralEMPositionY",500,-80. , 80.);
349 fhChargedHadronPositionY = new TH1F("hChargedHadronPositionY","hChargedHadronPositionY",500,-80. , 80.);
350 fhPhotonHadronPositionY = new TH1F("hPhotonHadronPositionY","hPhotonHadronPositionY",500,-80. , 80.);
354 //____________________________________________________________________________
355 Bool_t AliPHOSAnalyze::Init(Int_t evt)
357 // Do a few initializations: open the root file
358 // get the AliRun object
359 // defines the clusterizer, tracksegment maker and particle identifier
360 // sets the associated parameters
364 //========== Open galice root file
366 if ( fRootFile == 0 ) {
367 Text_t * name = new Text_t[80] ;
368 cout << "AnalyzeOneEvent > Enter file root file name : " ;
370 Bool_t ok = OpenRootFile(name) ;
372 cout << " AliPHOSAnalyze > Error opening " << name << endl ;
374 //========== Get AliRun object from file
376 gAlice = (AliRun*) fRootFile->Get("gAlice") ;
378 //=========== Get the PHOS object and associated geometry from the file
380 fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
381 fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
387 //========== Create the Clusterizer
389 fClu = new AliPHOSClusterizerv1() ;
390 fClu->SetEmcEnergyThreshold(0.030) ;
391 fClu->SetEmcClusteringThreshold(1.0) ;
392 fClu->SetPpsdEnergyThreshold (0.0000002) ;
393 fClu->SetPpsdClusteringThreshold(0.0000001) ;
394 fClu->SetLocalMaxCut(0.03) ;
395 fClu->SetCalibrationParameters(0., 0.00000001) ;
396 cout << "AnalyzeOneEvent > using clusterizer " << fClu->GetName() << endl ;
397 fClu->PrintParameters() ;
399 //========== Creates the track segment maker
401 fTrs = new AliPHOSTrackSegmentMakerv1() ;
402 cout << "AnalyzeOneEvent > using tack segment maker " << fTrs->GetName() << endl ;
403 fTrs->UnsetUnfoldFlag() ;
405 //========== Creates the particle identifier
407 fPID = new AliPHOSPIDv1() ;
408 cout << "AnalyzeOneEvent > using particle identifier " << fPID->GetName() << endl ;
410 //========== Creates the Reconstructioner
412 fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
414 //=========== Connect the various Tree's for evt
417 cout << "AnalyzeOneEvent > Enter event number : " ;
419 cout << evt << endl ;
422 gAlice->GetEvent(evt);
424 //=========== Get the Digit TTree
426 gAlice->TreeD()->GetEvent(0) ;
434 //____________________________________________________________________________
435 void AliPHOSAnalyze::DisplayKineEvent(Int_t evt)
437 // Display particles from the Kine Tree in global Alice (theta, phi) coordinates.
438 // One PHOS module at the time.
439 // The particle type can be selected.
445 cout << "DisplayKineEvent > which module (1-5, -1: all) ? " ;
446 cin >> module ; cout << module << endl ;
449 cout << " 22 : PHOTON " << endl
450 << " (-)11 : (POSITRON)ELECTRON " << endl
451 << " (-)2112 : (ANTI)NEUTRON " << endl
452 << " -999 : Everything else " << endl ;
453 cout << "DisplayKineEvent > enter PDG particle code to display " ;
454 cin >> testparticle ; cout << testparticle << endl ;
456 Text_t histoname[80] ;
457 sprintf(histoname,"Event %d: Incident particles in module %d", evt, module) ;
459 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
460 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, kDegre) ;
462 Double_t theta, phi ;
463 fGeom->EmcXtalCoverage(theta, phi, kDegre) ;
465 Int_t tdim = (Int_t)( (tM - tm) / theta ) ;
466 Int_t pdim = (Int_t)( (pM - pm) / phi ) ;
473 TH2F * histoparticle = new TH2F("histoparticle", histoname,
474 pdim, pm, pM, tdim, tm, tM) ;
475 histoparticle->SetStats(kFALSE) ;
477 // Get pointers to Alice Particle TClonesArray
479 TParticle * particle;
480 TClonesArray * particlearray = gAlice->Particles();
482 Text_t canvasname[80];
483 sprintf(canvasname,"Particles incident in PHOS/EMC module # %d",module) ;
484 TCanvas * kinecanvas = new TCanvas("kinecanvas", canvasname, 650, 500) ;
488 TTree * kine = gAlice->TreeK() ;
489 Stat_t nParticles = kine->GetEntries() ;
490 cout << "DisplayKineEvent > events in kine " << nParticles << endl ;
492 // loop over particles
494 Double_t kRADDEG = 180. / TMath::Pi() ;
496 Int_t nparticlein = 0 ;
497 for (index1 = 0 ; index1 < nParticles ; index1++){
498 Int_t nparticle = particlearray->GetEntriesFast() ;
500 for( index2 = 0 ; index2 < nparticle ; index2++) {
501 particle = (TParticle*)particlearray->UncheckedAt(index2) ;
502 Int_t particletype = particle->GetPdgCode() ;
503 if (testparticle == -999 || testparticle == particletype) {
504 Double_t phi = particle->Phi() ;
505 Double_t theta = particle->Theta() ;
508 fGeom->ImpactOnEmc(theta, phi, mod, z, x) ;
509 if ( mod == module ) {
511 if (particle->Energy() > fClu->GetEmcClusteringThreshold() )
512 histoparticle->Fill(phi*kRADDEG, theta*kRADDEG, particle->Energy() ) ;
518 histoparticle->Draw("color") ;
519 TPaveText * pavetext = new TPaveText(294, 100, 300, 101);
521 sprintf(text, "Particles: %d ", nparticlein) ;
522 pavetext->AddText(text) ;
524 kinecanvas->Update();
527 //____________________________________________________________________________
528 void AliPHOSAnalyze::DisplayRecParticles()
530 // Display reconstructed particles in global Alice(theta, phi) coordinates.
531 // One PHOS module at the time.
532 // Click on symbols indicate the reconstructed particle type.
535 cout << "DisplayRecParticles > Analyze an event first ... (y/n) " ;
537 cin >> answer ; cout << answer ;
544 cout << "DisplayRecParticles > which module (1-5, -1: all) ? " ;
545 cin >> module ; cout << module << endl ;
546 Text_t histoname[80] ;
547 sprintf(histoname,"Event %d: Reconstructed particles in module %d", fEvt, module) ;
548 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
549 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, kDegre) ;
550 Double_t theta, phi ;
551 fGeom->EmcXtalCoverage(theta, phi, kDegre) ;
552 Int_t tdim = (Int_t)( (tM - tm) / theta ) ;
553 Int_t pdim = (Int_t)( (pM - pm) / phi ) ;
557 TH2F * histoRparticle = new TH2F("histoRparticle", histoname,
558 pdim, pm, pM, tdim, tm, tM) ;
559 histoRparticle->SetStats(kFALSE) ;
560 Text_t canvasname[80] ;
561 sprintf(canvasname, "Reconstructed particles in PHOSmodule # %d", module) ;
562 TCanvas * rparticlecanvas = new TCanvas("RparticleCanvas", canvasname, 650, 500) ;
563 RecParticlesList * rpl = fPHOS->RecParticles() ;
564 Int_t nRecParticles = rpl->GetEntries() ;
565 Int_t nRecParticlesInModule = 0 ;
566 TIter nextRecPart(rpl) ;
567 AliPHOSRecParticle * rp ;
568 cout << "DisplayRecParticles > " << nRecParticles << " reconstructed particles " << endl ;
569 Double_t kRADDEG = 180. / TMath::Pi() ;
570 while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) {
571 AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ;
572 if ( ts->GetPHOSMod() == module ) {
573 Int_t numberofprimaries = 0 ;
574 Int_t * listofprimaries = rp->GetPrimaries(numberofprimaries) ;
575 cout << "Number of primaries = " << numberofprimaries << endl ;
577 for ( index = 0 ; index < numberofprimaries ; index++)
578 cout << " primary # " << index << " = " << listofprimaries[index] << endl ;
580 nRecParticlesInModule++ ;
581 Double_t theta = rp->Theta() * kRADDEG ;
582 Double_t phi = rp->Phi() * kRADDEG ;
583 Double_t energy = rp->Energy() ;
584 histoRparticle->Fill(phi, theta, energy) ;
587 histoRparticle->Draw("color") ;
589 nextRecPart.Reset() ;
590 while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) {
591 AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ;
592 if ( ts->GetPHOSMod() == module )
597 sprintf(text, "reconstructed particles: %d", nRecParticlesInModule) ;
598 TPaveText * pavetext = new TPaveText(292, 100, 300, 101);
599 pavetext->AddText(text) ;
601 rparticlecanvas->Update() ;
605 //____________________________________________________________________________
606 void AliPHOSAnalyze::DisplayRecPoints()
608 // Display reconstructed points in local PHOS-module (x, z) coordinates.
609 // One PHOS module at the time.
610 // Click on symbols displays the EMC cluster, or PPSD information.
613 cout << "DisplayRecPoints > Analyze an event first ... (y/n) " ;
615 cin >> answer ; cout << answer ;
622 cout << "DisplayRecPoints > which module (1-5, -1: all) ? " ;
623 cin >> module ; cout << module << endl ;
625 Text_t canvasname[80];
626 sprintf(canvasname,"Digits in PHOS/EMC module # %d",module) ;
627 TCanvas * modulecanvas = new TCanvas("module", canvasname, 650, 500) ;
628 modulecanvas->Draw() ;
630 //=========== Creating 2d-histogram of the PHOS module
631 // a little bit junkie but is used to test Geom functinalities
633 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
635 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM);
636 // convert angles into coordinates local to the EMC module of interest
638 Int_t emcModuleNumber ;
639 Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module
640 Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module
641 fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ;
642 fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ;
643 Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ;
644 Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ;
645 Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ;
646 Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ;
647 Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ;
648 Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ;
649 Text_t histoname[80];
650 sprintf(histoname,"Event %d: Digits and RecPoints in module %d", fEvt, module) ;
651 TH2F * hModule = new TH2F("HistoReconstructed", histoname,
652 xdim, xmin, xMax, zdim, zmin, zMax) ;
653 hModule->SetMaximum(2.0);
654 hModule->SetMinimum(0.0);
655 hModule->SetStats(kFALSE);
657 TIter next(fPHOS->Digits()) ;
658 Float_t energy, y, z;
660 Int_t relid[4]; Int_t nDigits = 0 ;
661 AliPHOSDigit * digit ;
663 // Making 2D histogram of the EMC module
664 while((digit = (AliPHOSDigit *)next()))
666 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
667 if (relid[0] == module && relid[1] == 0)
669 energy = fClu->Calibrate(digit->GetAmp()) ;
670 cout << "Energy is " << energy << " and threshold is " << fClu->GetEmcEnergyThreshold() << endl;
671 if (energy > fClu->GetEmcEnergyThreshold() ){
674 fGeom->RelPosInModule(relid,y,z) ;
675 hModule->Fill(y, z, energy) ;
679 cout <<"DrawRecPoints > Found in module "
680 << module << " " << nDigits << " digits with total energy " << etot << endl ;
681 hModule->Draw("col2") ;
683 //=========== Cluster in module
685 TClonesArray * emcRP = fPHOS->EmcClusters() ;
687 Int_t totalnClusters = 0 ;
688 Int_t nClusters = 0 ;
689 TIter nextemc(emcRP) ;
690 AliPHOSEmcRecPoint * emc ;
691 while((emc = (AliPHOSEmcRecPoint *)nextemc()))
693 // Int_t numberofprimaries ;
694 // Int_t * primariesarray = new Int_t[10] ;
695 // emc->GetPrimaries(numberofprimaries, primariesarray) ;
697 if ( emc->GetPHOSMod() == module )
700 energy = emc->GetTotalEnergy() ;
705 cout << "DrawRecPoints > Found " << totalnClusters << " EMC Clusters in PHOS" << endl ;
706 cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " EMC Clusters " << endl ;
707 cout << "DrawRecPoints > total energy " << etot << endl ;
709 TPaveText * pavetext = new TPaveText(22, 80, 83, 90);
711 sprintf(text, "digits: %d; clusters: %d", nDigits, nClusters) ;
712 pavetext->AddText(text) ;
714 modulecanvas->Update();
716 //=========== Cluster in module PPSD Down
718 TClonesArray * ppsdRP = fPHOS->PpsdClusters() ;
720 TIter nextPpsd(ppsdRP) ;
721 AliPHOSPpsdRecPoint * ppsd ;
722 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
725 if ( ppsd->GetPHOSMod() == module )
728 energy = ppsd->GetEnergy() ;
730 if (!ppsd->GetUp()) ppsd->Draw("P") ;
733 cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Down Clusters in PHOS" << endl ;
734 cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Down Clusters " << endl ;
735 cout << "DrawRecPoints > total energy " << etot << endl ;
737 //=========== Cluster in module PPSD Up
739 ppsdRP = fPHOS->PpsdClusters() ;
741 TIter nextPpsdUp(ppsdRP) ;
742 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsdUp()))
745 if ( ppsd->GetPHOSMod() == module )
748 energy = ppsd->GetEnergy() ;
750 if (ppsd->GetUp()) ppsd->Draw("P") ;
753 cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Up Clusters in PHOS" << endl ;
754 cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Up Clusters " << endl ;
755 cout << "DrawRecPoints > total energy " << etot << endl ;
760 //____________________________________________________________________________
761 void AliPHOSAnalyze::DisplayTrackSegments()
763 // Display track segments in local PHOS-module (x, z) coordinates.
764 // One PHOS module at the time.
765 // One symbol per PHOS subsystem: EMC, upper PPSD, lower PPSD.
768 cout << "DisplayTrackSegments > Analyze an event first ... (y/n) " ;
770 cin >> answer ; cout << answer ;
777 cout << "DisplayTrackSegments > which module (1-5, -1: all) ? " ;
778 cin >> module ; cout << module << endl ;
779 //=========== Creating 2d-histogram of the PHOS module
780 // a little bit junkie but is used to test Geom functinalities
782 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
784 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM);
785 // convert angles into coordinates local to the EMC module of interest
787 Int_t emcModuleNumber ;
788 Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module
789 Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module
790 fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ;
791 fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ;
792 Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ;
793 Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ;
794 Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ;
795 Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ;
796 Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ;
797 Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ;
798 Text_t histoname[80];
799 sprintf(histoname,"Event %d: Track Segments in module %d", fEvt, module) ;
800 TH2F * histotrack = new TH2F("histotrack", histoname,
801 xdim, xmin, xMax, zdim, zmin, zMax) ;
802 histotrack->SetStats(kFALSE);
803 Text_t canvasname[80];
804 sprintf(canvasname,"Track segments in PHOS/EMC-PPSD module # %d", module) ;
805 TCanvas * trackcanvas = new TCanvas("TrackSegmentCanvas", canvasname, 650, 500) ;
808 TrackSegmentsList * trsegl = fPHOS->TrackSegments() ;
809 AliPHOSTrackSegment * trseg ;
811 Int_t nTrackSegments = trsegl->GetEntries() ;
814 Int_t nTrackSegmentsInModule = 0 ;
815 for(index = 0; index < nTrackSegments ; index++){
816 trseg = (AliPHOSTrackSegment * )trsegl->At(index) ;
817 etot+= trseg->GetEnergy() ;
818 if ( trseg->GetPHOSMod() == module ) {
819 nTrackSegmentsInModule++ ;
824 sprintf(text, "track segments: %d", nTrackSegmentsInModule) ;
825 TPaveText * pavetext = new TPaveText(22, 80, 83, 90);
826 pavetext->AddText(text) ;
828 trackcanvas->Update() ;
829 cout << "DisplayTrackSegments > Found " << trsegl->GetEntries() << " Track segments with total energy "<< etot << endl ;
833 //____________________________________________________________________________
834 Bool_t AliPHOSAnalyze::OpenRootFile(Text_t * name)
836 // Open the root file named "name"
838 fRootFile = new TFile(name, "update") ;
839 return fRootFile->IsOpen() ;
841 //____________________________________________________________________________
842 void AliPHOSAnalyze::SavingHistograms()
844 // Saves the histograms in a root file named "name.analyzed"
846 Text_t outputname[80] ;
847 sprintf(outputname,"%s.analyzed",fRootFile->GetName());
848 TFile output(outputname,"RECREATE");
851 fhEmcDigit->Write() ;
853 fhVetoDigit->Write() ;
854 if (fhConvertorDigit )
855 fhConvertorDigit->Write() ;
857 fhEmcCluster->Write() ;
859 fhVetoCluster->Write() ;
860 if (fhConvertorCluster )
861 fhConvertorCluster->Write() ;
863 fhConvertorEmc->Write() ;
865 fhPhotonEnergy->Write() ;
866 if (fhPhotonPositionX)
867 fhPhotonPositionX->Write() ;
868 if (fhPhotonPositionY)
869 fhPhotonPositionX->Write() ;
870 if (fhElectronEnergy)
871 fhElectronEnergy->Write() ;
872 if (fhElectronPositionX)
873 fhElectronPositionX->Write() ;
874 if (fhElectronPositionY)
875 fhElectronPositionX->Write() ;
876 if (fhNeutralHadronEnergy)
877 fhNeutralHadronEnergy->Write() ;
878 if (fhNeutralHadronPositionX)
879 fhNeutralHadronPositionX->Write() ;
880 if (fhNeutralHadronPositionY)
881 fhNeutralHadronPositionX->Write() ;
882 if (fhNeutralEMEnergy)
883 fhNeutralEMEnergy->Write() ;
884 if (fhNeutralEMPositionX)
885 fhNeutralEMPositionX->Write() ;
886 if (fhNeutralEMPositionY)
887 fhNeutralEMPositionX->Write() ;
888 if (fhChargedHadronEnergy)
889 fhChargedHadronEnergy->Write() ;
890 if (fhChargedHadronPositionX)
891 fhChargedHadronPositionX->Write() ;
892 if (fhChargedHadronPositionY)
893 fhChargedHadronPositionX->Write() ;
894 if (fhPhotonHadronEnergy)
895 fhPhotonHadronEnergy->Write() ;
896 if (fhPhotonHadronPositionX)
897 fhPhotonHadronPositionX->Write() ;
898 if (fhPhotonHadronPositionY)
899 fhPhotonHadronPositionX->Write() ;