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 PHOSv1 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 //========== Get AliRun object from file
78 gAlice = (AliRun*) fRootFile->Get("gAlice") ;
80 //=========== Get the PHOS object and associated geometry from the file
81 fPHOS = (AliPHOSv1 *)gAlice->GetDetector("PHOS") ;
82 fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
84 //========== Initializes the Index to Object converter
85 fObjGetter = AliPHOSIndexToObject::GetInstance(fPHOS) ;
86 //========== Current event number
97 //____________________________________________________________________________
98 AliPHOSAnalyze::AliPHOSAnalyze(const AliPHOSAnalyze & ana)
101 ( (AliPHOSAnalyze &)ana ).Copy(*this) ;
104 //____________________________________________________________________________
105 void AliPHOSAnalyze::Copy(TObject & obj)
107 // copy an analysis into an other one
109 // I do nothing more because the copy is silly but the Code checkers requires one
112 //____________________________________________________________________________
113 AliPHOSAnalyze::~AliPHOSAnalyze()
117 if (fRootFile->IsOpen() )
139 //____________________________________________________________________________
140 void AliPHOSAnalyze::ActivePPSD(Int_t Nevents=1){
142 fhEnergyCorrelations = new TH2F("hEnergyCorrelations","hEnergyCorrelations",40, 0., 0.15, 30, 0., 3.e-5);
143 //========== Create the Clusterizer
144 fClu = new AliPHOSClusterizerv1() ;
145 fClu->SetEmcEnergyThreshold(0.01) ;
146 fClu->SetEmcClusteringThreshold(0.20) ;
147 fClu->SetPpsdEnergyThreshold (0.0000002) ;
148 fClu->SetPpsdClusteringThreshold(0.0000001) ;
149 fClu->SetLocalMaxCut(0.02) ;
150 fClu->SetCalibrationParameters(0., 0.00000001) ;
154 for ( ievent=0; ievent<Nevents; ievent++)
157 //========== Event Number>
158 if ( ( log10((Float_t)(ievent+1)) - (Int_t)(log10((Float_t)(ievent+1))) ) == 0. )
159 cout << "AnalyzeResolutions > " << "Event is " << ievent << endl ;
161 //=========== Connects the various Tree's for evt
162 gAlice->GetEvent(ievent);
164 //=========== Gets the Kine TTree
165 gAlice->TreeK()->GetEvent(0) ;
167 //=========== Get the Digit Tree
168 gAlice->TreeD()->GetEvent(0) ;
170 //========== Creating branches ===================================
171 AliPHOSRecPoint::RecPointsList ** EmcRecPoints = fPHOS->EmcRecPoints() ;
172 gAlice->TreeR()->SetBranchAddress( "PHOSEmcRP", EmcRecPoints ) ;
174 AliPHOSRecPoint::RecPointsList ** PpsdRecPoints = fPHOS->PpsdRecPoints() ;
175 gAlice->TreeR()->SetBranchAddress( "PHOSPpsdRP", PpsdRecPoints ) ;
177 AliPHOSTrackSegment::TrackSegmentsList ** TrackSegmentsList = fPHOS->TrackSegments() ;
178 if( (*TrackSegmentsList) )
179 (*TrackSegmentsList)->Clear() ;
180 gAlice->TreeR()->SetBranchAddress( "PHOSTS", TrackSegmentsList ) ;
182 AliPHOSRecParticle::RecParticlesList ** RecParticleList = fPHOS->RecParticles() ;
183 if( (*RecParticleList) )
184 (*RecParticleList)->Clear() ;
185 gAlice->TreeR()->SetBranchAddress( "PHOSRP", RecParticleList ) ;
188 //=========== Gets the Reconstraction TTree
189 gAlice->TreeR()->GetEvent(0) ;
191 AliPHOSPpsdRecPoint * RecPoint ;
193 TIter nextRP(*fPHOS->PpsdRecPoints() ) ;
194 while( ( RecPoint = (AliPHOSPpsdRecPoint *)nextRP() ) )
196 if(!(RecPoint->GetUp()) ) {
197 AliPHOSDigit *digit ;
199 for(iDigit = 0; iDigit < fPHOS->Digits()->GetEntries(); iDigit++)
201 digit = (AliPHOSDigit *) fPHOS->Digits()->At(iDigit) ;
202 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
203 if((relid[2]==1)&&(relid[3]==1)&&(relid[0]==RecPoint->GetPHOSMod())){
204 Float_t ConvertorEnergy = fClu->Calibrate(digit->GetAmp()) ;
205 fhEnergyCorrelations->Fill(ConvertorEnergy,RecPoint->GetTotalEnergy() );
214 fhEnergyCorrelations->Draw("BOX") ;
218 //____________________________________________________________________________
219 void AliPHOSAnalyze::AnalyzeManyEvents(Int_t Nevents, Int_t module)
221 // analyzes Nevents events in a single PHOS module
222 // Events should be reconstructed by Reconstruct()
224 if ( fRootFile == 0 )
225 cout << "AnalyzeManyEvents > " << "Root File not openned" << endl ;
228 //========== Booking Histograms
229 cout << "AnalyzeManyEvents > " << "Booking Histograms" << endl ;
234 AliPHOSDigit * digit ;
235 AliPHOSEmcRecPoint * emc ;
236 AliPHOSPpsdRecPoint * ppsd ;
237 // AliPHOSTrackSegment * tracksegment ;
238 AliPHOSRecParticle * recparticle;
240 for ( ievent=0; ievent<Nevents; ievent++)
242 //========== Event Number>
243 if ( ( log10((Float_t)(ievent+1)) - (Int_t)(log10((Float_t)(ievent+1))) ) == 0. )
244 cout << "AnalyzeManyEvents > " << "Event is " << ievent << endl ;
246 //=========== Connects the various Tree's for evt
247 gAlice->GetEvent(ievent);
249 //=========== Gets the Digit TTree
250 gAlice->TreeD()->GetEvent(0) ;
252 //=========== Gets the number of entries in the Digits array
253 TIter nextdigit(fPHOS->Digits()) ;
254 while( ( digit = (AliPHOSDigit *)nextdigit() ) )
256 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
257 if (fClu->IsInEmc(digit)) fhEmcDigit->Fill(fClu->Calibrate(digit->GetAmp())) ;
260 if (relid[1]<17) fhVetoDigit->Fill(fClu->Calibrate(digit->GetAmp()));
261 if (relid[1]>16) fhConvertorDigit->Fill(fClu->Calibrate(digit->GetAmp()));
266 //=========== Cluster in module
267 TIter nextEmc(*fPHOS->EmcRecPoints() ) ;
268 while((emc = (AliPHOSEmcRecPoint *)nextEmc()))
270 if ( emc->GetPHOSMod() == module )
272 fhEmcCluster->Fill( emc->GetTotalEnergy() );
273 TIter nextPpsd( *fPHOS->PpsdRecPoints()) ;
274 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
276 if ( ppsd->GetPHOSMod() == module )
278 if (!ppsd->GetUp()) fhConvertorEmc->Fill(emc->GetTotalEnergy(),ppsd->GetTotalEnergy()) ;
284 //=========== Cluster in module PPSD Down
285 TIter nextPpsd(*fPHOS->PpsdRecPoints() ) ;
286 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
288 if ( ppsd->GetPHOSMod() == module )
290 if (!ppsd->GetUp()) fhConvertorCluster->Fill(ppsd->GetTotalEnergy()) ;
291 if (ppsd->GetUp()) fhVetoCluster ->Fill(ppsd->GetTotalEnergy()) ;
295 //========== TRackSegments in the event
296 TIter nextRecParticle(*fPHOS->RecParticles() ) ;
297 while((recparticle = (AliPHOSRecParticle *)nextRecParticle()))
299 if ( recparticle->GetPHOSTrackSegment()->GetPHOSMod() == module )
301 cout << "Particle type is " << recparticle->GetType() << endl ;
302 Int_t numberofprimaries = 0 ;
303 Int_t * listofprimaries = recparticle->GetPrimaries(numberofprimaries) ;
304 cout << "Number of primaries = " << numberofprimaries << endl ;
306 for ( index = 0 ; index < numberofprimaries ; index++)
307 cout << " primary # " << index << " = " << listofprimaries[index] << endl ;
315 //____________________________________________________________________________
316 void AliPHOSAnalyze::Reconstruct(Int_t Nevents,Int_t FirstEvent )
319 for ( ievent=FirstEvent; ievent<Nevents; ievent++)
321 if (ievent==FirstEvent)
323 cout << "Analyze > Starting Reconstructing " << endl ;
324 //========== Create the Clusterizer
325 fClu = new AliPHOSClusterizerv1() ;
326 fClu->SetEmcEnergyThreshold(0.03) ;
327 fClu->SetEmcClusteringThreshold(0.20) ;
328 fClu->SetPpsdEnergyThreshold (0.0000001) ;
329 fClu->SetPpsdClusteringThreshold(0.0000001) ;
330 fClu->SetLocalMaxCut(0.02) ;
331 fClu->SetCalibrationParameters(0., 0.00000001) ;
333 //========== Creates the track segment maker
334 fTrs = new AliPHOSTrackSegmentMakerv1() ;
335 // fTrs->UnsetUnfoldFlag() ;
337 //========== Creates the particle identifier
338 fPID = new AliPHOSPIDv1() ;
339 fPID->SetShowerProfileCuts(0.3, 1.8, 0.3, 1.8 ) ;
340 fPID->SetDispersionCutOff(2.0) ;
341 fPID->SetRelativeDistanceCut(3.) ;
343 //========== Creates the Reconstructioner
344 fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
345 // fRec -> SetDebugReconstruction(kTRUE);
349 //========== Event Number>
350 // if ( ( log10((Float_t)(ievent+1)) - (Int_t)(log10((Float_t)(ievent+1))) ) == 0. )
351 cout << "Reconstruct > Event is " << ievent << endl ;
353 //=========== Connects the various Tree's for evt
354 gAlice->GetEvent(ievent);
356 //=========== Gets the Digit TTree
357 gAlice->TreeD()->GetEvent(0) ;
359 //=========== Do the reconstruction
360 fPHOS->Reconstruction(fRec);
373 //____________________________________________________________________________
374 void AliPHOSAnalyze::InvariantMass(Int_t Nevents )
376 // Calculates Real and Mixed invariant mass distributions
377 Int_t NMixedEvents = 4 ; //# of events used for calculation of 'mixed' distribution
378 Int_t MixedLoops = (Int_t )TMath::Ceil(Nevents/NMixedEvents) ;
380 //========== Booking Histograms
381 TH2D * hRealEM = new TH2D("hRealEM", "Real for EM particles", 250,0.,1.,40,0.,4.) ;
382 TH2D * hRealPhot = new TH2D("hRealPhot", "Real for kPhoton particles", 250,0.,1.,40,0.,4.) ;
383 TH2D * hMixedEM = new TH2D("hMixedEM", "Mixed for EM particles", 250,0.,1.,40,0.,4.) ;
384 TH2D * hMixedPhot= new TH2D("hMixedPhot","Mixed for kPhoton particles",250,0.,1.,40,0.,4.) ;
387 Int_t EventInMixedLoop ;
389 Int_t NRecParticles[NMixedEvents] ;
391 AliPHOSRecParticle::RecParticlesList * AllRecParticleList = new TClonesArray("AliPHOSRecParticle", NMixedEvents*1000) ;
393 for(EventInMixedLoop = 0; EventInMixedLoop < MixedLoops; EventInMixedLoop++ ){
396 for ( ievent=0; ievent < NMixedEvents; ievent++){
398 Int_t AbsEventNumber = EventInMixedLoop*NMixedEvents + ievent ;
400 //=========== Connects the various Tree's for evt
401 gAlice->GetEvent(AbsEventNumber);
403 //=========== Get the Digit Tree
404 gAlice->TreeD()->GetEvent(0) ;
406 //========== Creating branches ===================================
408 AliPHOSRecParticle::RecParticlesList ** RecParticleList = fPHOS->RecParticles() ;
409 if( (*RecParticleList) )
410 (*RecParticleList)->Clear() ;
411 gAlice->TreeR()->SetBranchAddress( "PHOSRP", RecParticleList ) ;
413 //=========== Gets the Reconstraction TTree
414 gAlice->TreeR()->GetEvent(0) ;
416 AliPHOSRecParticle * RecParticle ;
418 for(iRecParticle = 0; iRecParticle < (*RecParticleList)->GetEntries() ;iRecParticle++ )
420 RecParticle = (AliPHOSRecParticle *) (*RecParticleList)->At(iRecParticle) ;
421 if((RecParticle->GetType() == AliPHOSFastRecParticle::kGAMMA)||
422 (RecParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEM)){
423 new( (*AllRecParticleList)[iRecPhot] ) AliPHOSRecParticle(*RecParticle) ;
428 NRecParticles[ievent] = iRecPhot-1 ;
432 //Now calculate invariant mass:
434 Int_t NCurEvent = 0 ;
436 for(irp1 = 0; irp1 < AllRecParticleList->GetEntries()-1; irp1++){
437 AliPHOSRecParticle * rp1 = (AliPHOSRecParticle *)AllRecParticleList->At(irp1) ;
439 for(irp2 = irp1+1; irp2 < AllRecParticleList->GetEntries(); irp2++){
440 AliPHOSRecParticle * rp2 = (AliPHOSRecParticle *)AllRecParticleList->At(irp2) ;
443 InvMass = (rp1->Energy()+rp2->Energy())*(rp1->Energy()+rp2->Energy())-
444 (rp1->Px()+rp2->Px())*(rp1->Px()+rp2->Px())-
445 (rp1->Py()+rp2->Py())*(rp1->Py()+rp2->Py())-
446 (rp1->Pz()+rp2->Pz())*(rp1->Pz()+rp2->Pz()) ;
449 InvMass = TMath::Sqrt(InvMass);
452 Pt = TMath::Sqrt((rp1->Px()+rp2->Px() )*( rp1->Px()+rp2->Px() ) +(rp1->Py()+rp2->Py())*(rp1->Py()+rp2->Py()));
454 if(irp1 > NRecParticles[NCurEvent])
457 if(irp2 <= NRecParticles[NCurEvent]){ //'Real' event
458 hRealEM->Fill(InvMass,Pt);
459 if((rp1->GetType() == AliPHOSFastRecParticle::kGAMMA)&&(rp2->GetType() == AliPHOSFastRecParticle::kGAMMA))
460 hRealPhot->Fill(InvMass,Pt);
463 hMixedEM->Fill(InvMass,Pt);
464 if((rp1->GetType() == AliPHOSFastRecParticle::kGAMMA)&&(rp2->GetType() == AliPHOSFastRecParticle::kGAMMA))
465 hMixedPhot->Fill(InvMass,Pt);
468 } //loop over second rp
469 }//loop over first rp
472 AllRecParticleList->Delete() ;
475 delete AllRecParticleList ;
478 TFile output("invmass.root","RECREATE");
484 hMixedPhot->Write() ;
491 //____________________________________________________________________________
492 void AliPHOSAnalyze::AnalyzeResolutions(Int_t Nevents )
494 // analyzes Nevents events and calculate Energy and Position resolution as well as
495 // probaility of correct indentifiing of the incident particle
497 //========== Booking Histograms
498 cout << "AnalyzeResolutions > " << "Booking Histograms" << endl ;
499 BookResolutionHistograms();
501 Int_t Counter[9][5] ;
502 Int_t i1,i2,TotalInd = 0 ;
503 for(i1 = 0; i1<9; i1++)
504 for(i2 = 0; i2<5; i2++)
505 Counter[i1][i2] = 0 ;
507 Int_t TotalPrimary = 0 ;
508 Int_t TotalRecPart = 0 ;
509 Int_t TotalRPwithPrim = 0 ;
512 cout << "Start Analysing"<< endl ;
513 for ( ievent=0; ievent<Nevents; ievent++)
516 //========== Event Number>
517 // if ( ( log10((Float_t)(ievent+1)) - (Int_t)(log10((Float_t)(ievent+1))) ) == 0. )
518 cout << "AnalyzeResolutions > " << "Event is " << ievent << endl ;
520 //=========== Connects the various Tree's for evt
521 gAlice->GetEvent(ievent);
523 //=========== Gets the Kine TTree
524 gAlice->TreeK()->GetEvent(0) ;
526 //=========== Gets the list of Primari Particles
527 TClonesArray * PrimaryList = gAlice->Particles();
529 TParticle * Primary ;
531 for ( iPrimary = 0 ; iPrimary < PrimaryList->GetEntries() ; iPrimary++)
533 Primary = (TParticle*)PrimaryList->UncheckedAt(iPrimary) ;
534 Int_t PrimaryType = Primary->GetPdgCode() ;
535 if( PrimaryType == 22 ) {
537 Double_t PrimX, PrimZ ;
538 fGeom->ImpactOnEmc(Primary->Theta(), Primary->Phi(), ModuleNumber, PrimX, PrimZ) ;
540 fhPrimary->Fill(Primary->Energy()) ;
541 if(Primary->Energy() > 0.3)
547 //=========== Get the Digit Tree
548 gAlice->TreeD()->GetEvent(0) ;
550 //========== Creating branches ===================================
551 AliPHOSRecPoint::RecPointsList ** EmcRecPoints = fPHOS->EmcRecPoints() ;
552 gAlice->TreeR()->SetBranchAddress( "PHOSEmcRP", EmcRecPoints ) ;
554 AliPHOSRecPoint::RecPointsList ** PpsdRecPoints = fPHOS->PpsdRecPoints() ;
555 gAlice->TreeR()->SetBranchAddress( "PHOSPpsdRP", PpsdRecPoints ) ;
557 AliPHOSTrackSegment::TrackSegmentsList ** TrackSegmentsList = fPHOS->TrackSegments() ;
558 if( (*TrackSegmentsList) )
559 (*TrackSegmentsList)->Clear() ;
560 gAlice->TreeR()->SetBranchAddress( "PHOSTS", TrackSegmentsList ) ;
562 AliPHOSRecParticle::RecParticlesList ** RecParticleList = fPHOS->RecParticles() ;
563 if( (*RecParticleList) )
564 (*RecParticleList)->Clear() ;
565 gAlice->TreeR()->SetBranchAddress( "PHOSRP", RecParticleList ) ;
567 //=========== Gets the Reconstraction TTree
568 gAlice->TreeR()->GetEvent(0) ;
570 AliPHOSRecParticle * RecParticle ;
572 for(iRecParticle = 0; iRecParticle < (*RecParticleList)->GetEntries() ;iRecParticle++ )
574 RecParticle = (AliPHOSRecParticle *) (*RecParticleList)->At(iRecParticle) ;
575 fhAllRP->Fill(CorrectEnergy(RecParticle->Energy())) ;
577 Int_t ModuleNumberRec ;
578 Double_t RecX, RecZ ;
579 fGeom->ImpactOnEmc(RecParticle->Theta(), RecParticle->Phi(), ModuleNumberRec, RecX, RecZ) ;
581 Double_t MinDistance = 5. ;
582 Int_t ClosestPrimary = -1 ;
584 Int_t numberofprimaries ;
585 Int_t * listofprimaries = RecParticle->GetPrimaries(numberofprimaries) ;
587 TParticle * Primary ;
588 Double_t Distance = MinDistance ;
589 for ( index = 0 ; index < numberofprimaries ; index++){
590 Primary = (TParticle*)PrimaryList->UncheckedAt(listofprimaries[index]) ;
592 Double_t PrimX, PrimZ ;
593 fGeom->ImpactOnEmc(Primary->Theta(), Primary->Phi(), ModuleNumber, PrimX, PrimZ) ;
594 if(ModuleNumberRec == ModuleNumber)
595 Distance = TMath::Sqrt((RecX-PrimX)*(RecX-PrimX)+(RecZ-PrimZ)*(RecZ-PrimZ) ) ;
596 if(MinDistance > Distance)
598 MinDistance = Distance ;
599 ClosestPrimary = listofprimaries[index] ;
604 if(ClosestPrimary >=0 ){
607 Int_t PrimaryType = ((TParticle *)PrimaryList->At(ClosestPrimary))->GetPdgCode() ;
608 TParticlePDG* PDGparticle = ((TParticle *)PrimaryList->At(ClosestPrimary))->GetPDG();
609 Double_t charge = PDGparticle->Charge() ;
614 PrimaryCode = 0; //Photon
615 fhAllEnergy->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(), RecParticle->Energy()) ;
616 fhAllPosition->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(),MinDistance) ;
619 PrimaryCode = 1; //Electron
622 PrimaryCode = 1; //positron
625 PrimaryCode = 4; //K+
628 PrimaryCode = 4; //K-
631 PrimaryCode = 4; //K0s
634 PrimaryCode = 4; //K0l
638 PrimaryCode = 2; //Charged hadron
640 PrimaryCode = 3; //Neutral hadron
644 switch(RecParticle->GetType())
646 case AliPHOSFastRecParticle::kGAMMA:
647 if(PrimaryType == 22){
648 fhPhotEnergy->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(), RecParticle->Energy() ) ;
649 fhEMEnergy->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(), RecParticle->Energy() ) ;
650 fhPPSDEnergy->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(), RecParticle->Energy() ) ;
652 fhPhotPosition->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(),MinDistance) ;
653 fhEMPosition->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(),MinDistance) ;
654 fhPPSDPosition->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(),MinDistance) ;
656 fhPhotReg->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
657 fhPhotEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
658 fhPhotPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
660 fhPhotPhot->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
662 if(PrimaryType == 2112){ //neutron
663 fhNReg->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
664 fhNEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
665 fhNPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
668 if(PrimaryType == -2112){ //neutron ~
669 fhNBarReg->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
670 fhNBarEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
671 fhNBarPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
674 if(PrimaryCode == 2){
675 fhChargedReg->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
676 fhChargedEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
677 fhChargedPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
680 fhAllReg->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
681 fhAllEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
682 fhAllPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
683 fhShape->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
684 fhVeto->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
685 fhPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
686 Counter[0][PrimaryCode]++;
688 case AliPHOSFastRecParticle::kELECTRON:
689 if(PrimaryType == 22){
690 fhPhotElec->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
691 fhEMEnergy->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(), RecParticle->Energy() ) ;
692 fhEMPosition->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(),MinDistance) ;
693 fhPhotEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
694 fhPhotPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
696 if(PrimaryType == 2112){ //neutron
697 fhNEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
698 fhNPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
701 if(PrimaryType == -2112){ //neutron ~
702 fhNBarEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
703 fhNBarPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
706 if(PrimaryCode == 2){
707 fhChargedEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
708 fhChargedPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
711 fhAllEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
712 fhAllPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
713 fhShape->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
714 fhPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
715 Counter[1][PrimaryCode]++;
717 case AliPHOSFastRecParticle::kNEUTRALHA:
718 if(PrimaryType == 22)
719 fhPhotNeuH->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
721 fhVeto->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
722 Counter[2][PrimaryCode]++;
724 case AliPHOSFastRecParticle::kNEUTRALEM:
725 if(PrimaryType == 22){
726 fhEMEnergy->Fill(((TParticle *)PrimaryList->At(ClosestPrimary))->Energy(),RecParticle->Energy() ) ;
727 fhEMPosition->Fill(((TParticle *)PrimaryList->At(ClosestPrimary))->Energy(),MinDistance ) ;
729 fhPhotNuEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
730 fhPhotEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
732 if(PrimaryType == 2112) //neutron
733 fhNEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
735 if(PrimaryType == -2112) //neutron ~
736 fhNBarEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
739 fhChargedEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
741 fhAllEM->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
742 fhShape->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
743 fhVeto->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
745 Counter[3][PrimaryCode]++;
747 case AliPHOSFastRecParticle::kCHARGEDHA:
748 if(PrimaryType == 22) //photon
749 fhPhotChHa->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
751 Counter[4][PrimaryCode]++ ;
753 case AliPHOSFastRecParticle::kGAMMAHA:
754 if(PrimaryType == 22){ //photon
755 fhPhotGaHa->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
756 fhPPSDEnergy->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(), RecParticle->Energy() ) ;
757 fhPPSDPosition->Fill(((TParticle *) PrimaryList->At(ClosestPrimary))->Energy(),MinDistance) ;
758 fhPhotPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
760 if(PrimaryType == 2112){ //neutron
761 fhNPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
764 if(PrimaryType == -2112){ //neutron ~
765 fhNBarPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
767 if(PrimaryCode == 2){
768 fhChargedPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
771 fhAllPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
772 fhVeto->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
773 fhPPSD->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
775 Counter[5][PrimaryCode]++ ;
777 case AliPHOSFastRecParticle::kABSURDEM:
778 Counter[6][PrimaryCode]++ ;
779 fhShape->Fill(CorrectEnergy(RecParticle->Energy()) ) ;
781 case AliPHOSFastRecParticle::kABSURDHA:
782 Counter[7][PrimaryCode]++ ;
785 Counter[8][PrimaryCode]++ ;
792 cout << "Resolutions: Analyzed " << Nevents << " event(s)" << endl ;
793 cout << "Resolutions: Total primary " << TotalPrimary << endl ;
794 cout << "Resoluitons: Total reconstracted " << TotalRecPart << endl ;
795 cout << "TotalReconstructed with Primarie " << TotalRPwithPrim << endl ;
796 cout << " Primary: Photon Electron Ch. Hadr. Neutr. Hadr Kaons" << endl ;
797 cout << " Detected as photon " << Counter[0][0] << " " << Counter[0][1] << " " << Counter[0][2] << " " <<Counter[0][3] << " " << Counter[0][4] << endl ;
798 cout << " Detected as electron " << Counter[1][0] << " " << Counter[1][1] << " " << Counter[1][2] << " " <<Counter[1][3] << " " << Counter[1][4] << endl ;
799 cout << " Detected as neutral hadron " << Counter[2][0] << " " << Counter[2][1] << " " << Counter[2][2] << " " <<Counter[2][3] << " " << Counter[2][4] << endl ;
800 cout << " Detected as neutral EM " << Counter[3][0] << " " << Counter[3][1] << " " << Counter[3][2] << " " <<Counter[3][3] << " " << Counter[3][4] << endl ;
801 cout << " Detected as charged hadron " << Counter[4][0] << " " << Counter[4][1] << " " << Counter[4][2] << " " <<Counter[4][3] << " " << Counter[4][4] << endl ;
802 cout << " Detected as gamma-hadron " << Counter[5][0] << " " << Counter[5][1] << " " << Counter[5][2] << " " <<Counter[5][3] << " " << Counter[5][4] << endl ;
803 cout << " Detected as Absurd EM " << Counter[6][0] << " " << Counter[6][1] << " " << Counter[6][2] << " " <<Counter[6][3] << " " << Counter[6][4] << endl ;
804 cout << " Detected as absurd hadron " << Counter[7][0] << " " << Counter[7][1] << " " << Counter[7][2] << " " <<Counter[7][3] << " " << Counter[7][4] << endl ;
805 cout << " Detected as undefined " << Counter[8][0] << " " << Counter[8][1] << " " << Counter[8][2] << " " <<Counter[8][3] << " " << Counter[8][4] << endl ;
807 for(i1 = 0; i1<9; i1++)
808 for(i2 = 0; i2<5; i2++)
809 TotalInd+=Counter[i1][i2] ;
810 cout << "Indentified particles " << TotalInd << endl ;
815 //____________________________________________________________________________
816 void AliPHOSAnalyze::BookingHistograms()
818 // Books the histograms where the results of the analysis are stored (to be changed)
822 delete fhConvertorDigit ;
823 delete fhEmcCluster ;
824 delete fhVetoCluster ;
825 delete fhConvertorCluster ;
826 delete fhConvertorEmc ;
828 fhEmcDigit = new TH1F("hEmcDigit", "hEmcDigit", 1000, 0. , 25.);
829 fhVetoDigit = new TH1F("hVetoDigit", "hVetoDigit", 500, 0. , 3.e-5);
830 fhConvertorDigit = new TH1F("hConvertorDigit","hConvertorDigit", 500, 0. , 3.e-5);
831 fhEmcCluster = new TH1F("hEmcCluster", "hEmcCluster", 1000, 0. , 30.);
832 fhVetoCluster = new TH1F("hVetoCluster", "hVetoCluster", 500, 0. , 3.e-5);
833 fhConvertorCluster = new TH1F("hConvertorCluster","hConvertorCluster",500, 0. , 3.e-5);
834 fhConvertorEmc = new TH2F("hConvertorEmc", "hConvertorEmc", 200, 1. , 3., 200, 0., 3.e-5);
837 //____________________________________________________________________________
838 void AliPHOSAnalyze::BookResolutionHistograms()
840 // Books the histograms where the results of the Resolution analysis are stored
843 // delete fhAllEnergy ;
845 // delete fhPhotEnergy ;
847 // delete fhEMEnergy ;
849 // delete fhPPSDEnergy ;
852 fhAllEnergy = new TH2F("hAllEnergy", "Energy of any RP with primary photon",100, 0., 5., 100, 0., 5.);
853 fhPhotEnergy = new TH2F("hPhotEnergy", "Energy of kGAMMA with primary photon",100, 0., 5., 100, 0., 5.);
854 fhEMEnergy = new TH2F("hEMEnergy", "Energy of EM with primary photon", 100, 0., 5., 100, 0., 5.);
855 fhPPSDEnergy = new TH2F("hPPSDEnergy", "Energy of PPSD with primary photon", 100, 0., 5., 100, 0., 5.);
858 // delete fhAllPosition ;
859 // if(fhPhotPosition)
860 // delete fhPhotPosition ;
862 // delete fhEMPosition ;
863 // if(fhPPSDPosition)
864 // delete fhPPSDPosition ;
867 fhAllPosition = new TH2F("hAllPosition", "Position of any RP with primary photon",100, 0., 5., 100, 0., 5.);
868 fhPhotPosition = new TH2F("hPhotPosition", "Position of kGAMMA with primary photon",100, 0., 5., 100, 0., 5.);
869 fhEMPosition = new TH2F("hEMPosition", "Position of EM with primary photon", 100, 0., 5., 100, 0., 5.);
870 fhPPSDPosition = new TH2F("hPPSDPosition", "Position of PPSD with primary photon", 100, 0., 5., 100, 0., 5.);
875 // delete fhPhotReg ;
879 // delete fhNBarReg ;
881 // delete fhChargedReg ;
883 fhAllReg = new TH1F("hAllReg", "All primaries registered as photon", 100, 0., 5.);
884 fhPhotReg = new TH1F("hPhotReg", "Photon registered as photon", 100, 0., 5.);
885 fhNReg = new TH1F("hNReg", "N registered as photon", 100, 0., 5.);
886 fhNBarReg = new TH1F("hNBarReg", "NBar registered as photon", 100, 0., 5.);
887 fhChargedReg= new TH1F("hChargedReg", "Charged hadron registered as photon",100, 0., 5.);
898 // delete fhChargedEM ;
900 fhAllEM = new TH1F("hAllEM", "All primary registered as EM",100, 0., 5.);
901 fhPhotEM = new TH1F("hPhotEM", "Photon registered as EM", 100, 0., 5.);
902 fhNEM = new TH1F("hNEM", "N registered as EM", 100, 0., 5.);
903 fhNBarEM = new TH1F("hNBarEM", "NBar registered as EM", 100, 0., 5.);
904 fhChargedEM= new TH1F("hChargedEM","Charged registered as EM",100, 0., 5.);
907 // delete fhAllPPSD ;
909 // delete fhPhotPPSD ;
913 // delete fhNBarPPSD ;
915 // delete fhChargedPPSD ;
917 fhAllPPSD = new TH1F("hAllPPSD", "All primary registered as PPSD",100, 0., 5.);
918 fhPhotPPSD = new TH1F("hPhotPPSD", "Photon registered as PPSD", 100, 0., 5.);
919 fhNPPSD = new TH1F("hNPPSD", "N registered as PPSD", 100, 0., 5.);
920 fhNBarPPSD = new TH1F("hNBarPPSD", "NBar registered as PPSD", 100, 0., 5.);
921 fhChargedPPSD= new TH1F("hChargedPPSD","Charged registered as PPSD",100, 0., 5.);
924 // delete fhPrimary ;
925 fhPrimary= new TH1F("hPrimary", "hPrimary", 100, 0., 5.);
936 fhAllRP = new TH1F("hAllRP","All Reconstructed particles", 100, 0., 5.);
937 fhVeto = new TH1F("hVeto", "All uncharged particles", 100, 0., 5.);
938 fhShape = new TH1F("hShape","All particles with EM shaower",100, 0., 5.);
939 fhPPSD = new TH1F("hPPSD", "All PPSD photon particles", 100, 0., 5.);
943 // delete fhPhotPhot ;
945 // delete fhPhotElec ;
947 // delete fhPhotNeuH ;
949 // delete fhPhotNuEM ;
951 // delete fhPhotChHa ;
953 // delete fhPhotGaHa ;
955 fhPhotPhot = new TH1F("hPhotPhot","hPhotPhot", 100, 0., 5.); //Photon registered as photon
956 fhPhotElec = new TH1F("hPhotElec","hPhotElec", 100, 0., 5.); //Photon registered as Electron
957 fhPhotNeuH = new TH1F("hPhotNeuH","hPhotNeuH", 100, 0., 5.); //Photon registered as Neutral Hadron
958 fhPhotNuEM = new TH1F("hPhotNuEM","hPhotNuEM", 100, 0., 5.); //Photon registered as Neutral EM
959 fhPhotChHa = new TH1F("hPhotChHa","hPhotChHa", 100, 0., 5.); //Photon registered as Charged Hadron
960 fhPhotGaHa = new TH1F("hPhotGaHa","hPhotGaHa", 100, 0., 5.); //Photon registered as Gamma-Hadron
964 //____________________________________________________________________________
965 Bool_t AliPHOSAnalyze::Init(Int_t evt)
967 // Do a few initializations: open the root file
968 // get the AliRun object
969 // defines the clusterizer, tracksegment maker and particle identifier
970 // sets the associated parameters
974 //========== Open galice root file
976 if ( fRootFile == 0 ) {
977 Text_t * name = new Text_t[80] ;
978 cout << "AnalyzeOneEvent > Enter file root file name : " ;
980 Bool_t ok = OpenRootFile(name) ;
982 cout << " AliPHOSAnalyze > Error opening " << name << endl ;
984 //========== Get AliRun object from file
986 gAlice = (AliRun*) fRootFile->Get("gAlice") ;
988 //=========== Get the PHOS object and associated geometry from the file
990 fPHOS = (AliPHOSv1 *)gAlice->GetDetector("PHOS") ;
991 fGeom = fPHOS->GetGeometry();
992 // fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
999 //========== Create the Clusterizer
1001 fClu = new AliPHOSClusterizerv1() ;
1002 fClu->SetEmcEnergyThreshold(0.030) ;
1003 fClu->SetEmcClusteringThreshold(0.20) ;
1004 fClu->SetPpsdEnergyThreshold (0.0000002) ;
1005 fClu->SetPpsdClusteringThreshold(0.0000001) ;
1006 fClu->SetLocalMaxCut(0.03) ;
1007 fClu->SetCalibrationParameters(0., 0.00000001) ;
1008 cout << "AnalyzeOneEvent > using clusterizer " << fClu->GetName() << endl ;
1009 fClu->PrintParameters() ;
1011 //========== Creates the track segment maker
1013 fTrs = new AliPHOSTrackSegmentMakerv1() ;
1014 cout << "AnalyzeOneEvent > using tack segment maker " << fTrs->GetName() << endl ;
1015 // fTrs->UnsetUnfoldFlag() ;
1017 //========== Creates the particle identifier
1019 fPID = new AliPHOSPIDv1() ;
1020 cout << "AnalyzeOneEvent > using particle identifier " << fPID->GetName() << endl ;
1021 //fPID->SetShowerProfileCuts(Float_t l1m, Float_t l1M, Float_t l2m, Float_t l2M) ;
1022 fPID->SetShowerProfileCuts(0.7, 2.0 , 0.6 , 1.5) ;
1024 //========== Creates the Reconstructioner
1026 fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
1027 fRec -> SetDebugReconstruction(kFALSE);
1029 //=========== Connect the various Tree's for evt
1031 if ( evt == -999 ) {
1032 cout << "AnalyzeOneEvent > Enter event number : " ;
1034 cout << evt << endl ;
1037 gAlice->GetEvent(evt);
1039 //=========== Get the Digit TTree
1041 gAlice->TreeD()->GetEvent(0) ;
1049 //____________________________________________________________________________
1050 void AliPHOSAnalyze::DisplayKineEvent(Int_t evt)
1052 // Display particles from the Kine Tree in global Alice (theta, phi) coordinates.
1053 // One PHOS module at the time.
1054 // The particle type can be selected.
1060 cout << "DisplayKineEvent > which module (1-5, -1: all) ? " ;
1061 cin >> module ; cout << module << endl ;
1063 Int_t testparticle ;
1064 cout << " 22 : PHOTON " << endl
1065 << " (-)11 : (POSITRON)ELECTRON " << endl
1066 << " (-)2112 : (ANTI)NEUTRON " << endl
1067 << " -999 : Everything else " << endl ;
1068 cout << "DisplayKineEvent > enter PDG particle code to display " ;
1069 cin >> testparticle ; cout << testparticle << endl ;
1071 Text_t histoname[80] ;
1072 sprintf(histoname,"Event %d: Incident particles in module %d", evt, module) ;
1074 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
1075 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, AliPHOSGeometry::Degre() ) ;
1077 Double_t theta, phi ;
1078 fGeom->EmcXtalCoverage(theta, phi, AliPHOSGeometry::Degre() ) ;
1080 Int_t tdim = (Int_t)( (tM - tm) / theta ) ;
1081 Int_t pdim = (Int_t)( (pM - pm) / phi ) ;
1088 TH2F * histoparticle = new TH2F("histoparticle", histoname,
1089 pdim, pm, pM, tdim, tm, tM) ;
1090 histoparticle->SetStats(kFALSE) ;
1092 // Get pointers to Alice Particle TClonesArray
1094 TParticle * particle;
1095 TClonesArray * particlearray = gAlice->Particles();
1097 Text_t canvasname[80];
1098 sprintf(canvasname,"Particles incident in PHOS/EMC module # %d",module) ;
1099 TCanvas * kinecanvas = new TCanvas("kinecanvas", canvasname, 650, 500) ;
1101 // get the KINE Tree
1103 TTree * kine = gAlice->TreeK() ;
1104 Stat_t nParticles = kine->GetEntries() ;
1105 cout << "DisplayKineEvent > events in kine " << nParticles << endl ;
1107 // loop over particles
1109 Double_t kRADDEG = 180. / TMath::Pi() ;
1111 Int_t nparticlein = 0 ;
1112 for (index1 = 0 ; index1 < nParticles ; index1++){
1113 Int_t nparticle = particlearray->GetEntriesFast() ;
1115 for( index2 = 0 ; index2 < nparticle ; index2++) {
1116 particle = (TParticle*)particlearray->UncheckedAt(index2) ;
1117 Int_t particletype = particle->GetPdgCode() ;
1118 if (testparticle == -999 || testparticle == particletype) {
1119 Double_t phi = particle->Phi() ;
1120 Double_t theta = particle->Theta() ;
1123 fGeom->ImpactOnEmc(theta, phi, mod, z, x) ;
1124 if ( mod == module ) {
1126 if (particle->Energy() > fClu->GetEmcClusteringThreshold() )
1127 histoparticle->Fill(phi*kRADDEG, theta*kRADDEG, particle->Energy() ) ;
1132 kinecanvas->Draw() ;
1133 histoparticle->Draw("color") ;
1134 TPaveText * pavetext = new TPaveText(294, 100, 300, 101);
1136 sprintf(text, "Particles: %d ", nparticlein) ;
1137 pavetext->AddText(text) ;
1139 kinecanvas->Update();
1142 //____________________________________________________________________________
1143 void AliPHOSAnalyze::DisplayRecParticles()
1145 // Display reconstructed particles in global Alice(theta, phi) coordinates.
1146 // One PHOS module at the time.
1147 // Click on symbols indicate the reconstructed particle type.
1150 cout << "DisplayRecParticles > Analyze an event first ... (y/n) " ;
1152 cin >> answer ; cout << answer ;
1153 // if ( answer == "y" )
1154 // AnalyzeOneEvent() ;
1159 cout << "DisplayRecParticles > which module (1-5, -1: all) ? " ;
1160 cin >> module ; cout << module << endl ;
1161 Text_t histoname[80] ;
1162 sprintf(histoname,"Event %d: Reconstructed particles in module %d", fEvt, module) ;
1163 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
1164 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, AliPHOSGeometry::Degre() ) ;
1165 Double_t theta, phi ;
1166 fGeom->EmcXtalCoverage(theta, phi, AliPHOSGeometry::Degre() ) ;
1167 Int_t tdim = (Int_t)( (tM - tm) / theta ) ;
1168 Int_t pdim = (Int_t)( (pM - pm) / phi ) ;
1172 TH2F * histoRparticle = new TH2F("histoRparticle", histoname,
1173 pdim, pm, pM, tdim, tm, tM) ;
1174 histoRparticle->SetStats(kFALSE) ;
1175 Text_t canvasname[80] ;
1176 sprintf(canvasname, "Reconstructed particles in PHOSmodule # %d", module) ;
1177 TCanvas * rparticlecanvas = new TCanvas("RparticleCanvas", canvasname, 650, 500) ;
1178 AliPHOSRecParticle::RecParticlesList * rpl = *fPHOS->RecParticles() ;
1179 Int_t nRecParticles = rpl->GetEntries() ;
1180 Int_t nRecParticlesInModule = 0 ;
1181 TIter nextRecPart(rpl) ;
1182 AliPHOSRecParticle * rp ;
1183 cout << "DisplayRecParticles > " << nRecParticles << " reconstructed particles " << endl ;
1184 Double_t kRADDEG = 180. / TMath::Pi() ;
1185 while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) {
1186 AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ;
1187 if ( ts->GetPHOSMod() == module ) {
1188 Int_t numberofprimaries = 0 ;
1189 Int_t * listofprimaries = 0;
1190 rp->GetPrimaries(numberofprimaries) ;
1191 cout << "Number of primaries = " << numberofprimaries << endl ;
1193 for ( index = 0 ; index < numberofprimaries ; index++)
1194 cout << " primary # " << index << " = " << listofprimaries[index] << endl ;
1196 nRecParticlesInModule++ ;
1197 Double_t theta = rp->Theta() * kRADDEG ;
1198 Double_t phi = rp->Phi() * kRADDEG ;
1199 Double_t energy = rp->Energy() ;
1200 histoRparticle->Fill(phi, theta, energy) ;
1203 histoRparticle->Draw("color") ;
1205 nextRecPart.Reset() ;
1206 while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) {
1207 AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ;
1208 if ( ts->GetPHOSMod() == module )
1213 sprintf(text, "reconstructed particles: %d", nRecParticlesInModule) ;
1214 TPaveText * pavetext = new TPaveText(292, 100, 300, 101);
1215 pavetext->AddText(text) ;
1217 rparticlecanvas->Update() ;
1221 //____________________________________________________________________________
1222 void AliPHOSAnalyze::DisplayRecPoints()
1224 // Display reconstructed points in local PHOS-module (x, z) coordinates.
1225 // One PHOS module at the time.
1226 // Click on symbols displays the EMC cluster, or PPSD information.
1229 cout << "DisplayRecPoints > Analyze an event first ... (y/n) " ;
1231 cin >> answer ; cout << answer ;
1232 // if ( answer == "y" )
1233 // AnalyzeOneEvent() ;
1238 cout << "DisplayRecPoints > which module (1-5, -1: all) ? " ;
1239 cin >> module ; cout << module << endl ;
1241 Text_t canvasname[80];
1242 sprintf(canvasname,"Digits in PHOS/EMC module # %d",module) ;
1243 TCanvas * modulecanvas = new TCanvas("module", canvasname, 650, 500) ;
1244 modulecanvas->Draw() ;
1246 //=========== Creating 2d-histogram of the PHOS module
1247 // a little bit junkie but is used to test Geom functinalities
1249 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
1251 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM);
1252 // convert angles into coordinates local to the EMC module of interest
1254 Int_t emcModuleNumber ;
1255 Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module
1256 Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module
1257 fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ;
1258 fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ;
1259 Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ;
1260 Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ;
1261 Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ;
1262 Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ;
1263 Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ;
1264 Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ;
1265 Text_t histoname[80];
1266 sprintf(histoname,"Event %d: Digits and RecPoints in module %d", fEvt, module) ;
1267 TH2F * hModule = new TH2F("HistoReconstructed", histoname,
1268 xdim, xmin, xMax, zdim, zmin, zMax) ;
1269 hModule->SetMaximum(2.0);
1270 hModule->SetMinimum(0.0);
1271 hModule->SetStats(kFALSE);
1273 TIter next(fPHOS->Digits()) ;
1274 Float_t energy, y, z;
1276 Int_t relid[4]; Int_t nDigits = 0 ;
1277 AliPHOSDigit * digit ;
1279 // Making 2D histogram of the EMC module
1280 while((digit = (AliPHOSDigit *)next()))
1282 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
1283 if (relid[0] == module && relid[1] == 0)
1285 energy = fClu->Calibrate(digit->GetAmp()) ;
1286 cout << "Energy is " << energy << " and threshold is " << fClu->GetEmcEnergyThreshold() << endl;
1287 if (energy > fClu->GetEmcEnergyThreshold() ){
1290 fGeom->RelPosInModule(relid,y,z) ;
1291 hModule->Fill(y, z, energy) ;
1295 cout <<"DrawRecPoints > Found in module "
1296 << module << " " << nDigits << " digits with total energy " << etot << endl ;
1297 hModule->Draw("col2") ;
1299 //=========== Cluster in module
1301 // TClonesArray * emcRP = fPHOS->EmcClusters() ;
1302 TObjArray * emcRP = *(fPHOS->EmcRecPoints()) ;
1305 Int_t totalnClusters = 0 ;
1306 Int_t nClusters = 0 ;
1307 TIter nextemc(emcRP) ;
1308 AliPHOSEmcRecPoint * emc ;
1309 while((emc = (AliPHOSEmcRecPoint *)nextemc()))
1311 // Int_t numberofprimaries ;
1312 // Int_t * primariesarray = new Int_t[10] ;
1313 // emc->GetPrimaries(numberofprimaries, primariesarray) ;
1315 if ( emc->GetPHOSMod() == module )
1318 energy = emc->GetTotalEnergy() ;
1323 cout << "DrawRecPoints > Found " << totalnClusters << " EMC Clusters in PHOS" << endl ;
1324 cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " EMC Clusters " << endl ;
1325 cout << "DrawRecPoints > total energy " << etot << endl ;
1327 TPaveText * pavetext = new TPaveText(22, 80, 83, 90);
1329 sprintf(text, "digits: %d; clusters: %d", nDigits, nClusters) ;
1330 pavetext->AddText(text) ;
1332 modulecanvas->Update();
1334 //=========== Cluster in module PPSD Down
1336 // TClonesArray * ppsdRP = fPHOS->PpsdClusters() ;
1337 TObjArray * ppsdRP = *(fPHOS->PpsdRecPoints() );
1340 TIter nextPpsd(ppsdRP) ;
1341 AliPHOSPpsdRecPoint * ppsd ;
1342 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd()))
1345 if ( ppsd->GetPHOSMod() == module )
1348 energy = ppsd->GetEnergy() ;
1350 if (!ppsd->GetUp()) ppsd->Draw("P") ;
1353 cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Down Clusters in PHOS" << endl ;
1354 cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Down Clusters " << endl ;
1355 cout << "DrawRecPoints > total energy " << etot << endl ;
1357 //=========== Cluster in module PPSD Up
1359 ppsdRP = *(fPHOS->PpsdRecPoints()) ;
1362 TIter nextPpsdUp(ppsdRP) ;
1363 while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsdUp()))
1366 if ( ppsd->GetPHOSMod() == module )
1369 energy = ppsd->GetEnergy() ;
1371 if (ppsd->GetUp()) ppsd->Draw("P") ;
1374 cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Up Clusters in PHOS" << endl ;
1375 cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Up Clusters " << endl ;
1376 cout << "DrawRecPoints > total energy " << etot << endl ;
1381 //____________________________________________________________________________
1382 void AliPHOSAnalyze::DisplayTrackSegments()
1384 // Display track segments in local PHOS-module (x, z) coordinates.
1385 // One PHOS module at the time.
1386 // One symbol per PHOS subsystem: EMC, upper PPSD, lower PPSD.
1389 cout << "DisplayTrackSegments > Analyze an event first ... (y/n) " ;
1391 cin >> answer ; cout << answer ;
1392 // if ( answer == "y" )
1393 // AnalyzeOneEvent() ;
1398 cout << "DisplayTrackSegments > which module (1-5, -1: all) ? " ;
1399 cin >> module ; cout << module << endl ;
1400 //=========== Creating 2d-histogram of the PHOS module
1401 // a little bit junkie but is used to test Geom functinalities
1403 Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module
1405 fGeom->EmcModuleCoverage(module, tm, tM, pm, pM);
1406 // convert angles into coordinates local to the EMC module of interest
1408 Int_t emcModuleNumber ;
1409 Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module
1410 Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module
1411 fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ;
1412 fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ;
1413 Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ;
1414 Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ;
1415 Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ;
1416 Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ;
1417 Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ;
1418 Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ;
1419 Text_t histoname[80];
1420 sprintf(histoname,"Event %d: Track Segments in module %d", fEvt, module) ;
1421 TH2F * histotrack = new TH2F("histotrack", histoname,
1422 xdim, xmin, xMax, zdim, zmin, zMax) ;
1423 histotrack->SetStats(kFALSE);
1424 Text_t canvasname[80];
1425 sprintf(canvasname,"Track segments in PHOS/EMC-PPSD module # %d", module) ;
1426 TCanvas * trackcanvas = new TCanvas("TrackSegmentCanvas", canvasname, 650, 500) ;
1427 histotrack->Draw() ;
1429 AliPHOSTrackSegment::TrackSegmentsList * trsegl = *(fPHOS->TrackSegments()) ;
1430 AliPHOSTrackSegment * trseg ;
1432 Int_t nTrackSegments = trsegl->GetEntries() ;
1435 Int_t nTrackSegmentsInModule = 0 ;
1436 for(index = 0; index < nTrackSegments ; index++){
1437 trseg = (AliPHOSTrackSegment * )trsegl->At(index) ;
1438 etot+= trseg->GetEnergy() ;
1439 if ( trseg->GetPHOSMod() == module ) {
1440 nTrackSegmentsInModule++ ;
1445 sprintf(text, "track segments: %d", nTrackSegmentsInModule) ;
1446 TPaveText * pavetext = new TPaveText(22, 80, 83, 90);
1447 pavetext->AddText(text) ;
1449 trackcanvas->Update() ;
1450 cout << "DisplayTrackSegments > Found " << trsegl->GetEntries() << " Track segments with total energy "<< etot << endl ;
1454 //____________________________________________________________________________
1455 Bool_t AliPHOSAnalyze::OpenRootFile(Text_t * name)
1457 // Open the root file named "name"
1459 fRootFile = new TFile(name, "update") ;
1460 return fRootFile->IsOpen() ;
1462 //____________________________________________________________________________
1463 void AliPHOSAnalyze::SaveHistograms()
1465 // Saves the histograms in a root file named "name.analyzed"
1467 Text_t outputname[80] ;
1468 sprintf(outputname,"%s.analyzed",fRootFile->GetName());
1469 TFile output(outputname,"RECREATE");
1473 fhAllEnergy->Write() ;
1475 fhPhotEnergy->Write() ;
1477 fhEMEnergy->Write() ;
1479 fhPPSDEnergy->Write() ;
1481 fhAllPosition->Write() ;
1483 fhPhotPosition->Write() ;
1485 fhEMPosition->Write() ;
1487 fhPPSDPosition->Write() ;
1491 fhPhotReg->Write() ;
1495 fhNBarReg->Write() ;
1497 fhChargedReg->Write() ;
1507 fhChargedEM->Write() ;
1509 fhAllPPSD->Write() ;
1511 fhPhotPPSD->Write() ;
1515 fhNBarPPSD->Write() ;
1517 fhChargedPPSD->Write() ;
1519 fhPrimary->Write() ;
1529 fhPhotPhot->Write() ;
1531 fhPhotElec->Write() ;
1533 fhPhotNeuH->Write() ;
1535 fhPhotNuEM->Write() ;
1537 fhPhotNuEM->Write() ;
1539 fhPhotChHa->Write() ;
1541 fhPhotGaHa->Write() ;
1542 if(fhEnergyCorrelations)
1543 fhEnergyCorrelations->Write() ;
1548 //____________________________________________________________________________
1549 Float_t AliPHOSAnalyze::CorrectEnergy(Float_t ERecPart)
1551 return ERecPart/0.8783 ;
1554 //____________________________________________________________________________
1555 void AliPHOSAnalyze::ResetHistograms()
1557 fhEnergyCorrelations = 0 ; //Energy correlations between Eloss in Convertor and PPSD(2)
1559 fhEmcDigit = 0 ; // Histo of digit energies in the Emc
1560 fhVetoDigit = 0 ; // Histo of digit energies in the Veto
1561 fhConvertorDigit = 0 ; // Histo of digit energies in the Convertor
1562 fhEmcCluster = 0 ; // Histo of Cluster energies in Emc
1563 fhVetoCluster = 0 ; // Histo of Cluster energies in Veto
1564 fhConvertorCluster = 0 ; // Histo of Cluster energies in Convertor
1565 fhConvertorEmc = 0 ; // 2d Convertor versus Emc energies
1568 fhPhotEnergy = 0 ; // Total spectrum of detected photons
1569 fhEMEnergy = 0 ; // Spectrum of detected electrons with electron primary
1572 fhPhotPosition = 0 ;
1574 fhPPSDPosition = 0 ;