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) & Gines Martinez (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"
54 #include "AliPHOSIndexToObject.h"
56 ClassImp(AliPHOSAnalyze)
59 //____________________________________________________________________________
60 AliPHOSAnalyze::AliPHOSAnalyze()
62 // default ctor (useless)
67 //____________________________________________________________________________
68 AliPHOSAnalyze::AliPHOSAnalyze(Text_t * name)
70 // ctor: analyze events from root file "name"
72 Bool_t ok = OpenRootFile(name) ;
74 cout << " AliPHOSAnalyze > Error opening " << name << endl ;
77 gAlice = (AliRun*) fRootFile->Get("gAlice");
78 fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
79 fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ) ;
84 //____________________________________________________________________________
85 AliPHOSAnalyze::~AliPHOSAnalyze()
89 if (fRootFile->IsOpen() )
111 //____________________________________________________________________________
112 void AliPHOSAnalyze::AnalyzeOneEvent(Int_t evt)
114 // analyze one single event with id=evt
118 Bool_t ok = Init(evt) ;
121 //=========== Get the number of entries in the Digits array
123 Int_t nId = fPHOS->Digits()->GetEntries();
124 printf("AnalyzeOneEvent > Number of entries in the Digit array is %d \n",nId);
126 //=========== Do the reconstruction
128 cout << "AnalyzeOneEvent > Found " << nId << " digits in PHOS" << endl ;
131 fPHOS->Reconstruction(fRec);
133 // =========== End of reconstruction
135 // =========== Write the root file
139 // =========== Finish
141 cout << "AnalyzeOneEvent > event # " << fEvt << " processed" << endl ;
144 cout << "AnalyzeOneEvent > filed to process event # " << evt << endl ;
146 ts.Stop() ; cout << "CPU time = " << ts.CpuTime() << endl ;
147 cout << "Real time = " << ts.RealTime() << endl ;
150 //____________________________________________________________________________
151 void AliPHOSAnalyze::AnalyzeManyEvents(Int_t Nevents, Int_t module)
153 // analyzes Nevents events in a single PHOS module
155 if ( fRootFile == 0 )
156 cout << "AnalyzeManyEvents > " << "Root File not openned" << endl ;
159 //========== Get AliRun object from file
160 gAlice = (AliRun*) fRootFile->Get("gAlice") ;
161 //=========== Get the PHOS object and associated geometry from the file
162 fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
163 fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
164 //========== Booking Histograms
165 cout << "AnalyzeManyEvents > " << "Booking Histograms" << endl ;
169 AliPHOSDigit * digit ;
170 AliPHOSEmcRecPoint * emc ;
171 AliPHOSPpsdRecPoint * ppsd ;
172 // AliPHOSTrackSegment * tracksegment ;
173 AliPHOSRecParticle * recparticle;
174 for ( ievent=0; ievent<Nevents; ievent++)
176 if (ievent==0) cout << "AnalyzeManyEvents > " << "Starting Analyzing " << endl ;
177 //========== Create the Clusterizer
178 fClu = new AliPHOSClusterizerv1() ;
179 fClu->SetEmcEnergyThreshold(0.05) ;
180 fClu->SetEmcClusteringThreshold(0.50) ;
181 fClu->SetPpsdEnergyThreshold (0.0000002) ;
182 fClu->SetPpsdClusteringThreshold(0.0000001) ;
183 fClu->SetLocalMaxCut(0.03) ;
184 fClu->SetCalibrationParameters(0., 0.00000001) ;
185 //========== Creates the track segment maker
186 fTrs = new AliPHOSTrackSegmentMakerv1() ;
187 fTrs->UnsetUnfoldFlag() ;
188 //========== Creates the particle identifier
189 fPID = new AliPHOSPIDv1() ;
190 fPID->SetShowerProfileCuts(0.3, 1.8, 0.3, 1.8 ) ;
192 //========== Creates the Reconstructioner
193 fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
194 //========== Event Number>
195 if ( ( log10((Float_t)(ievent+1)) - (Int_t)(log10((Float_t)(ievent+1))) ) == 0. )
196 cout << "AnalyzeManyEvents > " << "Event is " << ievent << endl ;
197 //=========== Connects the various Tree's for evt
198 gAlice->GetEvent(ievent);
199 //=========== Gets the Digit TTree
200 gAlice->TreeD()->GetEvent(0) ;
201 //=========== Gets the number of entries in the Digits array
202 TIter nextdigit(fPHOS->Digits()) ;
203 while( ( digit = (AliPHOSDigit *)nextdigit() ) )
205 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
206 if (fClu->IsInEmc(digit)) fhEmcDigit->Fill(fClu->Calibrate(digit->GetAmp())) ;
209 if (relid[1]<17) fhVetoDigit->Fill(fClu->Calibrate(digit->GetAmp()));
210 if (relid[1]>16) fhConvertorDigit->Fill(fClu->Calibrate(digit->GetAmp()));
213 //=========== Do the reconstruction
214 fPHOS->Reconstruction(fRec);
215 //=========== Cluster in module
216 TIter nextEmc(fPHOS->EmcRecPoints() ) ;
217 while((emc = (AliPHOSEmcRecPoint *)nextEmc()))
219 if ( emc->GetPHOSMod() == module )
221 fhEmcCluster->Fill( emc->GetTotalEnergy() );
222 TIter nextPpsd( fPHOS->PpsdRecPoints()) ;
223 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
225 if ( ppsd->GetPHOSMod() == module )
227 if (!ppsd->GetUp()) fhConvertorEmc->Fill(emc->GetTotalEnergy(),ppsd->GetTotalEnergy()) ;
232 //=========== Cluster in module PPSD Down
233 TIter nextPpsd(fPHOS->PpsdRecPoints() ) ;
234 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
236 if ( ppsd->GetPHOSMod() == module )
238 if (!ppsd->GetUp()) fhConvertorCluster->Fill(ppsd->GetTotalEnergy()) ;
239 if (ppsd->GetUp()) fhVetoCluster ->Fill(ppsd->GetTotalEnergy()) ;
242 //========== TRackSegments in the event
243 TIter nextRecParticle(fPHOS->RecParticles() ) ;
244 while((recparticle = (AliPHOSRecParticle *)nextRecParticle()))
246 if ( recparticle->GetPHOSTrackSegment()->GetPHOSMod() == module )
248 cout << "Particle type is " << recparticle->GetType() << endl ;
249 Int_t numberofprimaries = 0 ;
250 Int_t * listofprimaries = recparticle->GetPrimaries(numberofprimaries) ;
251 cout << "Number of primaries = " << numberofprimaries << endl ;
253 for ( index = 0 ; index < numberofprimaries ; index++)
254 cout << " primary # " << index << " = " << listofprimaries[index] << endl ;
255 switch(recparticle->GetType())
258 fhPhotonEnergy->Fill(recparticle->Energy() ) ;
259 //fhPhotonPositionX->Fill(recpart. ) ;
260 //fhPhotonPositionY->Fill(recpart. ) ;
261 cout << "PHOTON" << endl;
264 fhElectronEnergy->Fill(recparticle->Energy() ) ;
265 //fhElectronPositionX->Fill(recpart. ) ;
266 //fhElectronPositionY->Fill(recpart. ) ;
267 cout << "ELECTRON" << endl;
270 fhNeutralHadronEnergy->Fill(recparticle->Energy() ) ;
271 //fhNeutralHadronPositionX->Fill(recpart. ) ;
272 //fhNeutralHadronPositionY->Fill(recpart. ) ;
273 cout << "NEUTRAl HADRON" << endl;
276 fhNeutralEMEnergy->Fill(recparticle->Energy() ) ;
277 //fhNeutralEMPositionX->Fill(recpart. ) ;
278 //fhNeutralEMPositionY->Fill(recpart. ) ;
279 //cout << "NEUTRAL EM" << endl;
282 fhChargedHadronEnergy->Fill(recparticle->Energy() ) ;
283 //fhChargedHadronPositionX->Fill(recpart. ) ;
284 //fhChargedHadronPositionY->Fill(recpart. ) ;
285 cout << "CHARGED HADRON" << endl;
288 fhPhotonHadronEnergy->Fill(recparticle->Energy() ) ;
289 //fhPhotonHadronPositionX->Fill(recpart. ) ;
290 //fhPhotonHadronPositionY->Fill(recpart. ) ;
291 cout << "PHOTON HADRON" << endl;
296 // Deleting fClu, fTrs, fPID et fRec
308 //____________________________________________________________________________
309 void AliPHOSAnalyze::BookingHistograms()
311 // Books the histograms where the results of the analysis are stored (to be changed)
317 if (fhConvertorDigit )
318 delete fhConvertorDigit ;
320 delete fhEmcCluster ;
322 delete fhVetoCluster ;
323 if (fhConvertorCluster )
324 delete fhConvertorCluster ;
326 delete fhConvertorEmc ;
328 fhEmcDigit = new TH1F("hEmcDigit", "hEmcDigit", 1000, 0. , 25.);
329 fhVetoDigit = new TH1F("hVetoDigit", "hVetoDigit", 500, 0. , 3.e-5);
330 fhConvertorDigit = new TH1F("hConvertorDigit","hConvertorDigit", 500, 0. , 3.e-5);
331 fhEmcCluster = new TH1F("hEmcCluster", "hEmcCluster", 1000, 0. , 30.);
332 fhVetoCluster = new TH1F("hVetoCluster", "hVetoCluster", 500, 0. , 3.e-5);
333 fhConvertorCluster = new TH1F("hConvertorCluster","hConvertorCluster",500, 0. , 3.e-5);
334 fhConvertorEmc = new TH2F("hConvertorEmc", "hConvertorEmc", 200, 1. , 3., 200, 0., 3.e-5);
335 fhPhotonEnergy = new TH1F("hPhotonEnergy", "hPhotonEnergy", 1000, 0. , 30.);
336 fhElectronEnergy = new TH1F("hElectronEnergy","hElectronEnergy", 1000, 0. , 30.);
337 fhNeutralHadronEnergy = new TH1F("hNeutralHadronEnergy", "hNeutralHadronEnergy", 1000, 0. , 30.);
338 fhNeutralEMEnergy = new TH1F("hNeutralEMEnergy", "hNeutralEMEnergy", 1000, 0. , 30.);
339 fhChargedHadronEnergy = new TH1F("hChargedHadronEnergy", "hChargedHadronEnergy", 1000, 0. , 30.);
340 fhPhotonHadronEnergy = new TH1F("hPhotonHadronEnergy","hPhotonHadronEnergy",500,-80. , 80.);
341 fhPhotonPositionX = new TH1F("hPhotonPositionX","hPhotonPositionX", 500,-80. , 80.);
342 fhElectronPositionX = new TH1F("hElectronPositionX","hElectronPositionX",500,-80. , 80.);
343 fhNeutralHadronPositionX = new TH1F("hNeutralHadronPositionX","hNeutralHadronPositionX",500,-80. , 80.);
344 fhNeutralEMPositionX = new TH1F("hNeutralEMPositionX","hNeutralEMPositionX",500,-80. , 80.);
345 fhChargedHadronPositionX = new TH1F("hChargedHadronPositionX","hChargedHadronPositionX",500,-80. , 80.);
346 fhPhotonHadronPositionX = new TH1F("hPhotonHadronPositionX","hPhotonHadronPositionX",500,-80. , 80.);
347 fhPhotonPositionY = new TH1F("hPhotonPositionY","hPhotonPositionY", 500,-80. , 80.);
348 fhElectronPositionY = new TH1F("hElectronPositionY","hElectronPositionY",500,-80. , 80.);
349 fhNeutralHadronPositionY = new TH1F("hNeutralHadronPositionY","hNeutralHadronPositionY",500,-80. , 80.);
350 fhNeutralEMPositionY = new TH1F("hNeutralEMPositionY","hNeutralEMPositionY",500,-80. , 80.);
351 fhChargedHadronPositionY = new TH1F("hChargedHadronPositionY","hChargedHadronPositionY",500,-80. , 80.);
352 fhPhotonHadronPositionY = new TH1F("hPhotonHadronPositionY","hPhotonHadronPositionY",500,-80. , 80.);
356 //____________________________________________________________________________
357 Bool_t AliPHOSAnalyze::Init(Int_t evt)
359 // Do a few initializations: open the root file
360 // get the AliRun object
361 // defines the clusterizer, tracksegment maker and particle identifier
362 // sets the associated parameters
366 //========== Open galice root file
368 if ( fRootFile == 0 ) {
369 Text_t * name = new Text_t[80] ;
370 cout << "AnalyzeOneEvent > Enter file root file name : " ;
372 Bool_t ok = OpenRootFile(name) ;
374 cout << " AliPHOSAnalyze > Error opening " << name << endl ;
376 //========== Get AliRun object from file
378 gAlice = (AliRun*) fRootFile->Get("gAlice") ;
380 //=========== Get the PHOS object and associated geometry from the file
382 fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
383 fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
391 //========== Initializes the Index to Object converter
393 fObjGetter = AliPHOSIndexToObject::GetInstance(fPHOS) ;
395 //========== Create the Clusterizer
397 fClu = new AliPHOSClusterizerv1() ;
398 fClu->SetEmcEnergyThreshold(0.030) ;
399 fClu->SetEmcClusteringThreshold(0.50) ;
400 fClu->SetPpsdEnergyThreshold (0.0000002) ;
401 fClu->SetPpsdClusteringThreshold(0.0000001) ;
402 fClu->SetLocalMaxCut(0.03) ;
403 fClu->SetCalibrationParameters(0., 0.00000001) ;
404 cout << "AnalyzeOneEvent > using clusterizer " << fClu->GetName() << endl ;
405 fClu->PrintParameters() ;
407 //========== Creates the track segment maker
409 fTrs = new AliPHOSTrackSegmentMakerv1() ;
410 cout << "AnalyzeOneEvent > using tack segment maker " << fTrs->GetName() << endl ;
411 fTrs->UnsetUnfoldFlag() ;
413 //========== Creates the particle identifier
415 fPID = new AliPHOSPIDv1() ;
416 cout << "AnalyzeOneEvent > using particle identifier " << fPID->GetName() << endl ;
417 //fPID->SetShowerProfileCuts(Float_t l1m, Float_t l1M, Float_t l2m, Float_t l2M) ;
418 fPID->SetShowerProfileCuts(0.7, 2.0 , 0.6 , 1.5) ;
420 //========== Creates the Reconstructioner
422 fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
423 fRec -> SetDebugReconstruction(kTRUE);
425 //=========== Connect the various Tree's for evt
428 cout << "AnalyzeOneEvent > Enter event number : " ;
430 cout << evt << endl ;
433 gAlice->GetEvent(evt);
435 //=========== Get the Digit TTree
437 gAlice->TreeD()->GetEvent(0) ;
445 //____________________________________________________________________________
446 void AliPHOSAnalyze::DisplayKineEvent(Int_t evt)
448 // Display particles from the Kine Tree in global Alice (theta, phi) coordinates.
449 // One PHOS module at the time.
450 // The particle type can be selected.
456 cout << "DisplayKineEvent > which module (1-5, -1: all) ? " ;
457 cin >> module ; cout << module << endl ;
460 cout << " 22 : PHOTON " << endl
461 << " (-)11 : (POSITRON)ELECTRON " << endl
462 << " (-)2112 : (ANTI)NEUTRON " << endl
463 << " -999 : Everything else " << endl ;
464 cout << "DisplayKineEvent > enter PDG particle code to display " ;
465 cin >> testparticle ; cout << testparticle << endl ;
467 Text_t histoname[80] ;
468 sprintf(histoname,"Event %d: Incident particles in module %d", evt, module) ;
470 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
471 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, kDegre) ;
473 Double_t theta, phi ;
474 fGeom->EmcXtalCoverage(theta, phi, kDegre) ;
476 Int_t tdim = (Int_t)( (tM - tm) / theta ) ;
477 Int_t pdim = (Int_t)( (pM - pm) / phi ) ;
484 TH2F * histoparticle = new TH2F("histoparticle", histoname,
485 pdim, pm, pM, tdim, tm, tM) ;
486 histoparticle->SetStats(kFALSE) ;
488 // Get pointers to Alice Particle TClonesArray
490 TParticle * particle;
491 TClonesArray * particlearray = gAlice->Particles();
493 Text_t canvasname[80];
494 sprintf(canvasname,"Particles incident in PHOS/EMC module # %d",module) ;
495 TCanvas * kinecanvas = new TCanvas("kinecanvas", canvasname, 650, 500) ;
499 TTree * kine = gAlice->TreeK() ;
500 Stat_t nParticles = kine->GetEntries() ;
501 cout << "DisplayKineEvent > events in kine " << nParticles << endl ;
503 // loop over particles
505 Double_t kRADDEG = 180. / TMath::Pi() ;
507 Int_t nparticlein = 0 ;
508 for (index1 = 0 ; index1 < nParticles ; index1++){
509 Int_t nparticle = particlearray->GetEntriesFast() ;
511 for( index2 = 0 ; index2 < nparticle ; index2++) {
512 particle = (TParticle*)particlearray->UncheckedAt(index2) ;
513 Int_t particletype = particle->GetPdgCode() ;
514 if (testparticle == -999 || testparticle == particletype) {
515 Double_t phi = particle->Phi() ;
516 Double_t theta = particle->Theta() ;
519 fGeom->ImpactOnEmc(theta, phi, mod, z, x) ;
520 if ( mod == module ) {
522 if (particle->Energy() > fClu->GetEmcClusteringThreshold() )
523 histoparticle->Fill(phi*kRADDEG, theta*kRADDEG, particle->Energy() ) ;
529 histoparticle->Draw("color") ;
530 TPaveText * pavetext = new TPaveText(294, 100, 300, 101);
532 sprintf(text, "Particles: %d ", nparticlein) ;
533 pavetext->AddText(text) ;
535 kinecanvas->Update();
538 //____________________________________________________________________________
539 void AliPHOSAnalyze::DisplayRecParticles()
541 // Display reconstructed particles in global Alice(theta, phi) coordinates.
542 // One PHOS module at the time.
543 // Click on symbols indicate the reconstructed particle type.
546 cout << "DisplayRecParticles > Analyze an event first ... (y/n) " ;
548 cin >> answer ; cout << answer ;
555 cout << "DisplayRecParticles > which module (1-5, -1: all) ? " ;
556 cin >> module ; cout << module << endl ;
557 Text_t histoname[80] ;
558 sprintf(histoname,"Event %d: Reconstructed particles in module %d", fEvt, module) ;
559 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
560 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, kDegre) ;
561 Double_t theta, phi ;
562 fGeom->EmcXtalCoverage(theta, phi, kDegre) ;
563 Int_t tdim = (Int_t)( (tM - tm) / theta ) ;
564 Int_t pdim = (Int_t)( (pM - pm) / phi ) ;
568 TH2F * histoRparticle = new TH2F("histoRparticle", histoname,
569 pdim, pm, pM, tdim, tm, tM) ;
570 histoRparticle->SetStats(kFALSE) ;
571 Text_t canvasname[80] ;
572 sprintf(canvasname, "Reconstructed particles in PHOSmodule # %d", module) ;
573 TCanvas * rparticlecanvas = new TCanvas("RparticleCanvas", canvasname, 650, 500) ;
574 RecParticlesList * rpl = fPHOS->RecParticles() ;
575 Int_t nRecParticles = rpl->GetEntries() ;
576 Int_t nRecParticlesInModule = 0 ;
577 TIter nextRecPart(rpl) ;
578 AliPHOSRecParticle * rp ;
579 cout << "DisplayRecParticles > " << nRecParticles << " reconstructed particles " << endl ;
580 Double_t kRADDEG = 180. / TMath::Pi() ;
581 while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) {
582 AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ;
583 if ( ts->GetPHOSMod() == module ) {
584 Int_t numberofprimaries = 0 ;
585 Int_t * listofprimaries = rp->GetPrimaries(numberofprimaries) ;
586 cout << "Number of primaries = " << numberofprimaries << endl ;
588 for ( index = 0 ; index < numberofprimaries ; index++)
589 cout << " primary # " << index << " = " << listofprimaries[index] << endl ;
591 nRecParticlesInModule++ ;
592 Double_t theta = rp->Theta() * kRADDEG ;
593 Double_t phi = rp->Phi() * kRADDEG ;
594 Double_t energy = rp->Energy() ;
595 histoRparticle->Fill(phi, theta, energy) ;
598 histoRparticle->Draw("color") ;
600 nextRecPart.Reset() ;
601 while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) {
602 AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ;
603 if ( ts->GetPHOSMod() == module )
608 sprintf(text, "reconstructed particles: %d", nRecParticlesInModule) ;
609 TPaveText * pavetext = new TPaveText(292, 100, 300, 101);
610 pavetext->AddText(text) ;
612 rparticlecanvas->Update() ;
616 //____________________________________________________________________________
617 void AliPHOSAnalyze::DisplayRecPoints()
619 // Display reconstructed points in local PHOS-module (x, z) coordinates.
620 // One PHOS module at the time.
621 // Click on symbols displays the EMC cluster, or PPSD information.
624 cout << "DisplayRecPoints > Analyze an event first ... (y/n) " ;
626 cin >> answer ; cout << answer ;
633 cout << "DisplayRecPoints > which module (1-5, -1: all) ? " ;
634 cin >> module ; cout << module << endl ;
636 Text_t canvasname[80];
637 sprintf(canvasname,"Digits in PHOS/EMC module # %d",module) ;
638 TCanvas * modulecanvas = new TCanvas("module", canvasname, 650, 500) ;
639 modulecanvas->Draw() ;
641 //=========== Creating 2d-histogram of the PHOS module
642 // a little bit junkie but is used to test Geom functinalities
644 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
646 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM);
647 // convert angles into coordinates local to the EMC module of interest
649 Int_t emcModuleNumber ;
650 Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module
651 Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module
652 fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ;
653 fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ;
654 Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ;
655 Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ;
656 Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ;
657 Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ;
658 Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ;
659 Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ;
660 Text_t histoname[80];
661 sprintf(histoname,"Event %d: Digits and RecPoints in module %d", fEvt, module) ;
662 TH2F * hModule = new TH2F("HistoReconstructed", histoname,
663 xdim, xmin, xMax, zdim, zmin, zMax) ;
664 hModule->SetMaximum(2.0);
665 hModule->SetMinimum(0.0);
666 hModule->SetStats(kFALSE);
668 TIter next(fPHOS->Digits()) ;
669 Float_t energy, y, z;
671 Int_t relid[4]; Int_t nDigits = 0 ;
672 AliPHOSDigit * digit ;
674 // Making 2D histogram of the EMC module
675 while((digit = (AliPHOSDigit *)next()))
677 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
678 if (relid[0] == module && relid[1] == 0)
680 energy = fClu->Calibrate(digit->GetAmp()) ;
681 cout << "Energy is " << energy << " and threshold is " << fClu->GetEmcEnergyThreshold() << endl;
682 if (energy > fClu->GetEmcEnergyThreshold() ){
685 fGeom->RelPosInModule(relid,y,z) ;
686 hModule->Fill(y, z, energy) ;
690 cout <<"DrawRecPoints > Found in module "
691 << module << " " << nDigits << " digits with total energy " << etot << endl ;
692 hModule->Draw("col2") ;
694 //=========== Cluster in module
696 // TClonesArray * emcRP = fPHOS->EmcClusters() ;
697 TObjArray * emcRP = fPHOS->EmcRecPoints() ;
700 Int_t totalnClusters = 0 ;
701 Int_t nClusters = 0 ;
702 TIter nextemc(emcRP) ;
703 AliPHOSEmcRecPoint * emc ;
704 while((emc = (AliPHOSEmcRecPoint *)nextemc()))
706 // Int_t numberofprimaries ;
707 // Int_t * primariesarray = new Int_t[10] ;
708 // emc->GetPrimaries(numberofprimaries, primariesarray) ;
710 if ( emc->GetPHOSMod() == module )
713 energy = emc->GetTotalEnergy() ;
718 cout << "DrawRecPoints > Found " << totalnClusters << " EMC Clusters in PHOS" << endl ;
719 cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " EMC Clusters " << endl ;
720 cout << "DrawRecPoints > total energy " << etot << endl ;
722 TPaveText * pavetext = new TPaveText(22, 80, 83, 90);
724 sprintf(text, "digits: %d; clusters: %d", nDigits, nClusters) ;
725 pavetext->AddText(text) ;
727 modulecanvas->Update();
729 //=========== Cluster in module PPSD Down
731 // TClonesArray * ppsdRP = fPHOS->PpsdClusters() ;
732 TObjArray * ppsdRP = fPHOS->PpsdRecPoints() ;
735 TIter nextPpsd(ppsdRP) ;
736 AliPHOSPpsdRecPoint * ppsd ;
737 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
740 if ( ppsd->GetPHOSMod() == module )
743 energy = ppsd->GetEnergy() ;
745 if (!ppsd->GetUp()) ppsd->Draw("P") ;
748 cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Down Clusters in PHOS" << endl ;
749 cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Down Clusters " << endl ;
750 cout << "DrawRecPoints > total energy " << etot << endl ;
752 //=========== Cluster in module PPSD Up
754 ppsdRP = fPHOS->PpsdRecPoints() ;
757 TIter nextPpsdUp(ppsdRP) ;
758 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsdUp()))
761 if ( ppsd->GetPHOSMod() == module )
764 energy = ppsd->GetEnergy() ;
766 if (ppsd->GetUp()) ppsd->Draw("P") ;
769 cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Up Clusters in PHOS" << endl ;
770 cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Up Clusters " << endl ;
771 cout << "DrawRecPoints > total energy " << etot << endl ;
776 //____________________________________________________________________________
777 void AliPHOSAnalyze::DisplayTrackSegments()
779 // Display track segments in local PHOS-module (x, z) coordinates.
780 // One PHOS module at the time.
781 // One symbol per PHOS subsystem: EMC, upper PPSD, lower PPSD.
784 cout << "DisplayTrackSegments > Analyze an event first ... (y/n) " ;
786 cin >> answer ; cout << answer ;
793 cout << "DisplayTrackSegments > which module (1-5, -1: all) ? " ;
794 cin >> module ; cout << module << endl ;
795 //=========== Creating 2d-histogram of the PHOS module
796 // a little bit junkie but is used to test Geom functinalities
798 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
800 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM);
801 // convert angles into coordinates local to the EMC module of interest
803 Int_t emcModuleNumber ;
804 Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module
805 Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module
806 fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ;
807 fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ;
808 Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ;
809 Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ;
810 Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ;
811 Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ;
812 Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ;
813 Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ;
814 Text_t histoname[80];
815 sprintf(histoname,"Event %d: Track Segments in module %d", fEvt, module) ;
816 TH2F * histotrack = new TH2F("histotrack", histoname,
817 xdim, xmin, xMax, zdim, zmin, zMax) ;
818 histotrack->SetStats(kFALSE);
819 Text_t canvasname[80];
820 sprintf(canvasname,"Track segments in PHOS/EMC-PPSD module # %d", module) ;
821 TCanvas * trackcanvas = new TCanvas("TrackSegmentCanvas", canvasname, 650, 500) ;
824 TrackSegmentsList * trsegl = fPHOS->TrackSegments() ;
825 AliPHOSTrackSegment * trseg ;
827 Int_t nTrackSegments = trsegl->GetEntries() ;
830 Int_t nTrackSegmentsInModule = 0 ;
831 for(index = 0; index < nTrackSegments ; index++){
832 trseg = (AliPHOSTrackSegment * )trsegl->At(index) ;
833 etot+= trseg->GetEnergy() ;
834 if ( trseg->GetPHOSMod() == module ) {
835 nTrackSegmentsInModule++ ;
840 sprintf(text, "track segments: %d", nTrackSegmentsInModule) ;
841 TPaveText * pavetext = new TPaveText(22, 80, 83, 90);
842 pavetext->AddText(text) ;
844 trackcanvas->Update() ;
845 cout << "DisplayTrackSegments > Found " << trsegl->GetEntries() << " Track segments with total energy "<< etot << endl ;
849 //____________________________________________________________________________
850 Bool_t AliPHOSAnalyze::OpenRootFile(Text_t * name)
852 // Open the root file named "name"
854 fRootFile = new TFile(name, "update") ;
855 return fRootFile->IsOpen() ;
857 //____________________________________________________________________________
858 void AliPHOSAnalyze::SavingHistograms()
860 // Saves the histograms in a root file named "name.analyzed"
862 Text_t outputname[80] ;
863 sprintf(outputname,"%s.analyzed",fRootFile->GetName());
864 TFile output(outputname,"RECREATE");
867 fhEmcDigit->Write() ;
869 fhVetoDigit->Write() ;
870 if (fhConvertorDigit )
871 fhConvertorDigit->Write() ;
873 fhEmcCluster->Write() ;
875 fhVetoCluster->Write() ;
876 if (fhConvertorCluster )
877 fhConvertorCluster->Write() ;
879 fhConvertorEmc->Write() ;
881 fhPhotonEnergy->Write() ;
882 if (fhPhotonPositionX)
883 fhPhotonPositionX->Write() ;
884 if (fhPhotonPositionY)
885 fhPhotonPositionX->Write() ;
886 if (fhElectronEnergy)
887 fhElectronEnergy->Write() ;
888 if (fhElectronPositionX)
889 fhElectronPositionX->Write() ;
890 if (fhElectronPositionY)
891 fhElectronPositionX->Write() ;
892 if (fhNeutralHadronEnergy)
893 fhNeutralHadronEnergy->Write() ;
894 if (fhNeutralHadronPositionX)
895 fhNeutralHadronPositionX->Write() ;
896 if (fhNeutralHadronPositionY)
897 fhNeutralHadronPositionX->Write() ;
898 if (fhNeutralEMEnergy)
899 fhNeutralEMEnergy->Write() ;
900 if (fhNeutralEMPositionX)
901 fhNeutralEMPositionX->Write() ;
902 if (fhNeutralEMPositionY)
903 fhNeutralEMPositionX->Write() ;
904 if (fhChargedHadronEnergy)
905 fhChargedHadronEnergy->Write() ;
906 if (fhChargedHadronPositionX)
907 fhChargedHadronPositionX->Write() ;
908 if (fhChargedHadronPositionY)
909 fhChargedHadronPositionX->Write() ;
910 if (fhPhotonHadronEnergy)
911 fhPhotonHadronEnergy->Write() ;
912 if (fhPhotonHadronPositionX)
913 fhPhotonHadronPositionX->Write() ;
914 if (fhPhotonHadronPositionY)
915 fhPhotonHadronPositionX->Write() ;