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"
39 // --- Standard library ---
44 // --- AliRoot header files ---
47 #include "AliPHOSAnalyze.h"
48 #include "AliPHOSClusterizerv1.h"
49 #include "AliPHOSTrackSegmentMakerv1.h"
50 #include "AliPHOSPIDv1.h"
51 #include "AliPHOSReconstructioner.h"
52 #include "AliPHOSDigit.h"
53 #include "AliPHOSTrackSegment.h"
54 #include "AliPHOSRecParticle.h"
55 #include "AliPHOSIndexToObject.h"
56 #include "AliPHOSHit.h"
57 #include "AliPHOSCPVHit.h"
58 #include "AliPHOSCpvRecPoint.h"
60 ClassImp(AliPHOSAnalyze)
62 //____________________________________________________________________________
63 AliPHOSAnalyze::AliPHOSAnalyze()
65 // default ctor (useless)
70 //____________________________________________________________________________
71 AliPHOSAnalyze::AliPHOSAnalyze(Text_t * name)
73 // ctor: analyze events from root file "name"
75 Bool_t ok = OpenRootFile(name) ;
77 cout << " AliPHOSAnalyze > Error opening " << name << endl ;
80 //========== Get AliRun object from file
81 gAlice = (AliRun*) fRootFile->Get("gAlice") ;
83 //=========== Get the PHOS object and associated geometry from the file
84 fPHOS = (AliPHOSv1 *)gAlice->GetDetector("PHOS") ;
85 fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
87 //========== Initializes the Index to Object converter
88 fObjGetter = AliPHOSIndexToObject::GetInstance(fPHOS) ;
89 //========== Current event number
101 //____________________________________________________________________________
102 AliPHOSAnalyze::AliPHOSAnalyze(const AliPHOSAnalyze & ana)
105 ( (AliPHOSAnalyze &)ana ).Copy(*this) ;
108 //____________________________________________________________________________
109 void AliPHOSAnalyze::Copy(TObject & obj)
111 // copy an analysis into an other one
113 // I do nothing more because the copy is silly but the Code checkers requires one
116 //____________________________________________________________________________
117 AliPHOSAnalyze::~AliPHOSAnalyze()
121 if(fRootFile->IsOpen()) fRootFile->Close() ;
122 if(fRootFile) {delete fRootFile ; fRootFile=0 ;}
123 if(fPHOS) {delete fPHOS ; fPHOS =0 ;}
124 if(fClu) {delete fClu ; fClu =0 ;}
125 if(fPID) {delete fPID ; fPID =0 ;}
126 if(fRec) {delete fRec ; fRec =0 ;}
127 if(fTrs) {delete fTrs ; fTrs =0 ;}
130 //____________________________________________________________________________
131 void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod){
132 //Draws pimary particles and reconstructed
133 //digits, RecPoints, RecPartices etc
134 //for event Nevent in the module Nmod.
136 TH2F * digitOccupancy = new TH2F("digitOccupancy","EMC digits", 64,-71.,71.,64,-71.,71.);
137 TH2F * emcOccupancy = new TH2F("emcOccupancy","EMC RecPoints",64,-71.,71.,64,-71.,71.);
138 TH2F * ppsdUp = new TH2F("ppsdUp","PPSD Up digits", 128,-71.,71.,128,-71.,71.) ;
139 TH2F * ppsdUpCl = new TH2F("ppsdUpCl","PPSD Up RecPoints",128,-71.,71.,128,-71.,71.) ;
140 TH2F * ppsdLow = new TH2F("ppsdLow","PPSD Low digits", 128,-71.,71.,128,-71.,71.) ;
141 TH2F * ppsdLowCl = new TH2F("ppsdLowCl","PPSD Low RecPoints",128,-71.,71.,128,-71.,71.) ;
142 TH2F * nbar = new TH2F("nbar","Primary nbar", 64,-71.,71.,64,-71.,71.);
143 TH2F * phot = new TH2F("phot","Primary Photon", 64,-71.,71.,64,-71.,71.);
144 TH2F * charg = new TH2F("charg","Primary charged",64,-71.,71.,64,-71.,71.);
145 TH2F * recPhot = new TH2F("recPhot","RecParticles with primary Photon",64,-71.,71.,64,-71.,71.);
146 TH2F * recNbar = new TH2F("recNbar","RecParticles with primary Nbar", 64,-71.,71.,64,-71.,71.);
148 //========== Create the Clusterizer
149 fClu = new AliPHOSClusterizerv1() ;
151 gAlice->GetEvent(Nevent);
153 TParticle * primary ;
155 for ( iPrimary = 0 ; iPrimary < gAlice->GetNtrack() ; iPrimary++)
157 primary = gAlice->Particle(iPrimary) ;
158 Int_t primaryType = primary->GetPdgCode() ;
159 if( (primaryType == 211)||(primaryType == -211)||(primaryType == 2212)||(primaryType == -2212) ) {
161 Double_t primX, primZ ;
162 fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
163 if(moduleNumber==Nmod)
164 charg->Fill(primZ,primX,primary->Energy()) ;
166 if( primaryType == 22 ) {
168 Double_t primX, primZ ;
169 fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
170 if(moduleNumber==Nmod)
171 phot->Fill(primZ,primX,primary->Energy()) ;
174 if( primaryType == -2112 ) {
176 Double_t primX, primZ ;
177 fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
178 if(moduleNumber==Nmod)
179 nbar->Fill(primZ,primX,primary->Energy()) ;
184 fPHOS->SetTreeAddress() ;
186 gAlice->TreeD()->GetEvent(0) ;
187 gAlice->TreeR()->GetEvent(0) ;
189 TObjArray ** emcRecPoints = fPHOS->EmcRecPoints() ;
190 TObjArray ** ppsdRecPoints = fPHOS->PpsdRecPoints() ;
191 TClonesArray ** recParticleList = fPHOS->RecParticles() ;
194 AliPHOSDigit * digit ;
196 for(iDigit = 0; iDigit < fPHOS->Digits()->GetEntries(); iDigit++)
198 digit = (AliPHOSDigit *) fPHOS->Digits()->At(iDigit) ;
200 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
202 fGeom->RelPosInModule(relid,x,z) ;
203 Float_t e = fClu->Calibrate(digit->GetAmp()) ;
205 if(relid[1]==0) //EMC
206 digitOccupancy->Fill(x,z,e) ;
207 if((relid[1]>0)&&(relid[1]<17))
208 ppsdUp->Fill(x,z,e) ;
210 ppsdLow->Fill(x,z,e) ;
217 for(irecp = 0; irecp < (*emcRecPoints)->GetEntries() ; irecp ++){
218 AliPHOSEmcRecPoint * emc= (AliPHOSEmcRecPoint*)(*emcRecPoints)->At(irecp) ;
219 if(emc->GetPHOSMod()==Nmod){
220 emc->GetLocalPosition(pos) ;
221 emcOccupancy->Fill(pos.X(),pos.Z(),emc->GetEnergy());
225 for(irecp = 0; irecp < (*ppsdRecPoints)->GetEntries() ; irecp ++){
226 AliPHOSPpsdRecPoint * ppsd= (AliPHOSPpsdRecPoint *)(*ppsdRecPoints)->At(irecp) ;
227 if(ppsd->GetPHOSMod()==Nmod){
228 ppsd->GetLocalPosition(pos) ;
230 ppsdUpCl->Fill(pos.X(),pos.Z(),ppsd->GetEnergy());
232 ppsdLowCl->Fill(pos.X(),pos.Z(),ppsd->GetEnergy());
236 AliPHOSRecParticle * recParticle ;
238 for(iRecParticle = 0; iRecParticle < (*recParticleList)->GetEntries() ;iRecParticle++ )
240 recParticle = (AliPHOSRecParticle *) (*recParticleList)->At(iRecParticle) ;
242 Int_t moduleNumberRec ;
243 Double_t recX, recZ ;
244 fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
245 if(moduleNumberRec == Nmod){
247 Double_t minDistance = 5. ;
248 Int_t closestPrimary = -1 ;
250 Int_t numberofprimaries ;
251 Int_t * listofprimaries = recParticle->GetPrimaries(numberofprimaries) ;
253 TParticle * primary ;
254 Double_t distance = minDistance ;
256 for ( index = 0 ; index < numberofprimaries ; index++){
257 primary = gAlice->Particle(listofprimaries[index]) ;
259 Double_t primX, primZ ;
260 fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
261 if(moduleNumberRec == moduleNumber)
262 distance = TMath::Sqrt((recX-primX)*(recX-primX)+(recZ-primZ)*(recZ-primZ) ) ;
263 if(minDistance > distance)
265 minDistance = distance ;
266 closestPrimary = listofprimaries[index] ;
270 if(closestPrimary >=0 ){
272 Int_t primaryType = gAlice->Particle(closestPrimary)->GetPdgCode() ;
275 recPhot->Fill(recZ,recX,recParticle->Energy()) ;
277 if(primaryType==-2112)
278 recNbar->Fill(recZ,recX,recParticle->Energy()) ;
284 digitOccupancy->Draw("box") ;
285 emcOccupancy->SetLineColor(2) ;
286 emcOccupancy->Draw("boxsame") ;
287 ppsdUp->SetLineColor(3) ;
288 ppsdUp->Draw("boxsame") ;
289 ppsdLow->SetLineColor(4) ;
290 ppsdLow->Draw("boxsame") ;
291 phot->SetLineColor(8) ;
292 phot->Draw("boxsame") ;
293 nbar->SetLineColor(6) ;
294 nbar->Draw("boxsame") ;
297 //____________________________________________________________________________
298 void AliPHOSAnalyze::Reconstruct(Int_t nevents,Int_t firstEvent )
301 // Performs reconstruction of EMC and CPV (GPS2, IHEP or MIXT)
302 // for events from FirstEvent to Nevents
305 for ( ievent=firstEvent; ievent<nevents; ievent++) {
306 if (ievent==firstEvent) {
307 cout << "Analyze > Starting Reconstructing " << endl ;
308 //========== Create the Clusterizer
309 fClu = new AliPHOSClusterizerv1() ;
311 //========== Creates the track segment maker
312 fTrs = new AliPHOSTrackSegmentMakerv1() ;
313 // fTrs->UnsetUnfoldFlag() ;
315 //========== Creates the particle identifier
316 fPID = new AliPHOSPIDv1() ;
317 fPID->SetShowerProfileCuts(0.3, 1.8, 0.3, 1.8 ) ;
319 //========== Creates the Reconstructioner
320 fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
321 if (fDebugLevel != 0) fRec -> SetDebugReconstruction(kTRUE);
324 if (fDebugLevel != 0 ||
325 (ievent+1) % (Int_t)TMath::Power( 10, (Int_t)TMath::Log10(ievent+1) ) == 0)
326 cout << "======= Analyze ======> Event " << ievent+1 << endl ;
330 gAlice->Hits2Digits() ;
332 //=========== Do the reconstruction
333 fPHOS->Reconstruction(fRec);
337 if(fClu) {delete fClu ; fClu =0 ;}
338 if(fPID) {delete fPID ; fPID =0 ;}
339 if(fRec) {delete fRec ; fRec =0 ;}
340 if(fTrs) {delete fTrs ; fTrs =0 ;}
344 //-------------------------------------------------------------------------------------
345 void AliPHOSAnalyze::ReadAndPrintCPV(Int_t EvFirst, Int_t EvLast)
348 // // Read and print generated and reconstructed hits in CPV
349 // // for events from EvFirst to Nevent.
350 // // If only EvFirst is defined, print only this one event.
351 // // Author: Yuri Kharlov
352 // // 12 October 2000
355 // if (EvFirst!=0 && EvLast==0) EvLast=EvFirst;
356 // for ( Int_t ievent=EvFirst; ievent<=EvLast; ievent++) {
358 // //========== Event Number>
359 // cout << endl << "==== ReadAndPrintCPV ====> Event is " << ievent+1 << endl ;
361 // //=========== Connects the various Tree's for evt
362 // Int_t ntracks = gAlice->GetEvent(ievent);
364 // //========== Creating branches ===================================
365 // AliPHOSRecPoint::RecPointsList ** emcRecPoints = fPHOS->EmcRecPoints() ;
366 // gAlice->TreeR()->SetBranchAddress( "PHOSEmcRP" , emcRecPoints ) ;
368 // AliPHOSRecPoint::RecPointsList ** cpvRecPoints = fPHOS->PpsdRecPoints() ;
369 // gAlice->TreeR()->SetBranchAddress( "PHOSPpsdRP", cpvRecPoints ) ;
371 // // Read and print CPV hits
373 // AliPHOSCPVModule cpvModule;
374 // TClonesArray *cpvHits;
376 // AliPHOSCPVHit *cpvHit;
378 // Float_t xgen, zgen;
380 // Int_t nGenHits = 0;
381 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
382 // //=========== Get the Hits Tree for the Primary track itrack
383 // gAlice->ResetHits();
384 // gAlice->TreeH()->GetEvent(itrack);
385 // Int_t iModule = 0 ;
386 // for (iModule=0; iModule < fGeom->GetNCPVModules(); iModule++) {
387 // cpvModule = fPHOS->GetCPVModule(iModule);
388 // cpvHits = cpvModule.Hits();
389 // nCPVhits = cpvHits->GetEntriesFast();
390 // for (Int_t ihit=0; ihit<nCPVhits; ihit++) {
392 // cpvHit = (AliPHOSCPVHit*)cpvHits->UncheckedAt(ihit);
393 // p = cpvHit->GetMomentum();
394 // xgen = cpvHit->X();
395 // zgen = cpvHit->Y();
396 // ipart = cpvHit->GetIpart();
397 // printf("CPV hit in module %d: ",iModule+1);
398 // printf(" p = (%f, %f, %f, %f) GeV,\n",
399 // p.Px(),p.Py(),p.Pz(),p.Energy());
400 // printf(" (X,Z) = (%8.4f, %8.4f) cm, ipart = %d\n",
406 // // Read and print CPV reconstructed points
408 // //=========== Gets the Reconstruction TTree
409 // gAlice->TreeR()->GetEvent(0) ;
410 // printf("Recpoints: %d\n",(*fPHOS->CpvRecPoints())->GetEntries());
411 // TIter nextRP(*fPHOS->CpvRecPoints() ) ;
412 // AliPHOSCpvRecPoint *cpvRecPoint ;
413 // Int_t nRecPoints = 0;
414 // while( ( cpvRecPoint = (AliPHOSCpvRecPoint *)nextRP() ) ) {
417 // cpvRecPoint->GetLocalPosition(locpos);
418 // Int_t phosModule = cpvRecPoint->GetPHOSMod();
419 // printf("CPV recpoint in module %d: (X,Z) = (%f,%f) cm\n",
420 // phosModule,locpos.X(),locpos.Z());
422 // printf("This event has %d generated hits and %d reconstructed points\n",
423 // nGenHits,nRecPoints);
427 //____________________________________________________________________________
428 void AliPHOSAnalyze::AnalyzeCPV(Int_t Nevents)
431 // // Analyzes CPV characteristics
432 // // Author: Yuri Kharlov
436 // // Book histograms
438 // TH1F *hDx = new TH1F("hDx" ,"CPV x-resolution@reconstruction",100,-5. , 5.);
439 // TH1F *hDz = new TH1F("hDz" ,"CPV z-resolution@reconstruction",100,-5. , 5.);
440 // TH1F *hDr = new TH1F("hDr" ,"CPV r-resolution@reconstruction",100, 0. , 5.);
441 // TH1S *hNrp = new TH1S("hNrp" ,"CPV rec.point multiplicity", 21,-0.5,20.5);
442 // TH1S *hNrpX = new TH1S("hNrpX","CPV rec.point Phi-length" , 21,-0.5,20.5);
443 // TH1S *hNrpZ = new TH1S("hNrpZ","CPV rec.point Z-length" , 21,-0.5,20.5);
445 // cout << "Start CPV Analysis"<< endl ;
446 // for ( Int_t ievent=0; ievent<Nevents; ievent++) {
448 // //========== Event Number>
449 // // if ( (ievent+1) % (Int_t)TMath::Power( 10, (Int_t)TMath::Log10(ievent+1) ) == 0)
450 // cout << endl << "==== AnalyzeCPV ====> Event is " << ievent+1 << endl ;
452 // //=========== Connects the various Tree's for evt
453 // Int_t ntracks = gAlice->GetEvent(ievent);
455 // //========== Creating branches ===================================
456 // AliPHOSRecPoint::RecPointsList ** emcRecPoints = fPHOS->EmcRecPoints() ;
457 // gAlice->TreeR()->SetBranchAddress( "PHOSEmcRP" , emcRecPoints ) ;
459 // AliPHOSRecPoint::RecPointsList ** cpvRecPoints = fPHOS->PpsdRecPoints() ;
460 // gAlice->TreeR()->SetBranchAddress( "PHOSPpsdRP", cpvRecPoints ) ;
462 // // Create and fill arrays of hits for each CPV module
464 // Int_t nOfModules = fGeom->GetNModules();
465 // TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
466 // Int_t iModule = 0;
467 // for (iModule=0; iModule < nOfModules; iModule++)
468 // hitsPerModule[iModule] = new TClonesArray("AliPHOSCPVHit",100);
470 // AliPHOSCPVModule cpvModule;
471 // TClonesArray *cpvHits;
473 // AliPHOSCPVHit *cpvHit;
478 // // First go through all primary tracks and fill the arrays
479 // // of hits per each CPV module
481 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
482 // // Get the Hits Tree for the Primary track itrack
483 // gAlice->ResetHits();
484 // gAlice->TreeH()->GetEvent(itrack);
485 // for (Int_t iModule=0; iModule < nOfModules; iModule++) {
486 // cpvModule = fPHOS->GetCPVModule(iModule);
487 // cpvHits = cpvModule.Hits();
488 // nCPVhits = cpvHits->GetEntriesFast();
489 // for (Int_t ihit=0; ihit<nCPVhits; ihit++) {
490 // cpvHit = (AliPHOSCPVHit*)cpvHits->UncheckedAt(ihit);
491 // p = cpvHit->GetMomentum();
492 // xzgen[0] = cpvHit->X();
493 // xzgen[1] = cpvHit->Y();
494 // ipart = cpvHit->GetIpart();
495 // TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
496 // new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSCPVHit(*cpvHit);
498 // cpvModule.Clear();
501 // for (iModule=0; iModule < nOfModules; iModule++) {
502 // Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
503 // printf("Module %d has %d hits\n",iModule,nsum);
506 // // Then go through reconstructed points and for each find
507 // // the closeset hit
508 // // The distance from the rec.point to the closest hit
509 // // gives the coordinate resolution of the CPV
511 // // Get the Reconstruction Tree
512 // gAlice->TreeR()->GetEvent(0) ;
513 // TIter nextRP(*fPHOS->PpsdRecPoints() ) ;
514 // AliPHOSCpvRecPoint *cpvRecPoint ;
515 // Float_t xgen, zgen;
516 // while( ( cpvRecPoint = (AliPHOSCpvRecPoint *)nextRP() ) ) {
518 // cpvRecPoint->GetLocalPosition(locpos);
519 // Int_t phosModule = cpvRecPoint->GetPHOSMod();
520 // Int_t rpMult = cpvRecPoint->GetDigitsMultiplicity();
521 // Int_t rpMultX, rpMultZ;
522 // cpvRecPoint->GetClusterLengths(rpMultX,rpMultZ);
523 // Float_t xrec = locpos.X();
524 // Float_t zrec = locpos.Z();
525 // Float_t dxmin = 1.e+10;
526 // Float_t dzmin = 1.e+10;
527 // Float_t r2min = 1.e+10;
530 // cpvHits = hitsPerModule[phosModule-1];
531 // Int_t nCPVhits = cpvHits->GetEntriesFast();
532 // for (Int_t ihit=0; ihit<nCPVhits; ihit++) {
533 // cpvHit = (AliPHOSCPVHit*)cpvHits->UncheckedAt(ihit);
534 // xgen = cpvHit->X();
535 // zgen = cpvHit->Y();
536 // r2 = TMath::Power((xgen-xrec),2) + TMath::Power((zgen-zrec),2);
537 // if ( r2 < r2min ) {
539 // dxmin = xgen - xrec;
540 // dzmin = zgen - zrec;
543 // hDx ->Fill(dxmin);
544 // hDz ->Fill(dzmin);
545 // hDr ->Fill(TMath::Sqrt(r2min));
546 // hNrp ->Fill(rpMult);
547 // hNrpX->Fill(rpMultX);
548 // hNrpZ->Fill(rpMultZ);
550 // delete [] hitsPerModule;
552 // // Save histograms
554 // Text_t outputname[80] ;
555 // sprintf(outputname,"%s.analyzed",fRootFile->GetName());
556 // TFile output(outputname,"RECREATE");
566 // // Plot histograms
568 // TCanvas *cpvCanvas = new TCanvas("CPV","CPV analysis",20,20,800,400);
569 // gStyle->SetOptStat(111111);
570 // gStyle->SetOptFit(1);
571 // gStyle->SetOptDate(1);
572 // cpvCanvas->Divide(3,2);
575 // gPad->SetFillColor(10);
576 // hNrp->SetFillColor(16);
580 // gPad->SetFillColor(10);
581 // hNrpX->SetFillColor(16);
585 // gPad->SetFillColor(10);
586 // hNrpZ->SetFillColor(16);
590 // gPad->SetFillColor(10);
591 // hDx->SetFillColor(16);
596 // gPad->SetFillColor(10);
597 // hDz->SetFillColor(16);
602 // gPad->SetFillColor(10);
603 // hDr->SetFillColor(16);
606 // cpvCanvas->Print("CPV.ps");
610 //____________________________________________________________________________
611 void AliPHOSAnalyze::InvariantMass(Int_t Nevents )
613 // Calculates Real and Mixed invariant mass distributions
615 const Int_t knMixedEvents = 4 ; //# of events used for calculation of 'mixed' distribution
616 Int_t mixedLoops = (Int_t )TMath::Ceil(Nevents/knMixedEvents) ;
618 //========== Booking Histograms
619 TH2D * hRealEM = new TH2D("hRealEM", "Real for EM particles", 250,0.,1.,40,0.,4.) ;
620 TH2D * hRealPhot = new TH2D("hRealPhot", "Real for kPhoton particles", 250,0.,1.,40,0.,4.) ;
621 TH2D * hMixedEM = new TH2D("hMixedEM", "Mixed for EM particles", 250,0.,1.,40,0.,4.) ;
622 TH2D * hMixedPhot= new TH2D("hMixedPhot","Mixed for kPhoton particles",250,0.,1.,40,0.,4.) ;
625 Int_t eventInMixedLoop ;
627 Int_t nRecParticles[4];//knMixedEvents] ;
629 AliPHOSRecParticle::RecParticlesList * allRecParticleList = new TClonesArray("AliPHOSRecParticle", knMixedEvents*1000) ;
631 for(eventInMixedLoop = 0; eventInMixedLoop < mixedLoops; eventInMixedLoop++ ){
634 for ( ievent=0; ievent < knMixedEvents; ievent++){
636 Int_t absEventNumber = eventInMixedLoop*knMixedEvents + ievent ;
638 //=========== Connects the various Tree's for evt
639 gAlice->GetEvent(absEventNumber);
641 //========== Creating branches ===================================
642 fPHOS->SetTreeAddress() ;
644 gAlice->TreeD()->GetEvent(0) ;
645 gAlice->TreeR()->GetEvent(0) ;
647 TClonesArray ** recParticleList = fPHOS->RecParticles() ;
650 AliPHOSRecParticle * recParticle ;
652 for(iRecParticle = 0; iRecParticle < (*recParticleList)->GetEntries() ;iRecParticle++ )
654 recParticle = (AliPHOSRecParticle *) (*recParticleList)->At(iRecParticle) ;
655 if((recParticle->GetType() == AliPHOSFastRecParticle::kGAMMA)||
656 (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEM)){
657 new( (*allRecParticleList)[iRecPhot] ) AliPHOSRecParticle(*recParticle) ;
662 nRecParticles[ievent] = iRecPhot-1 ;
665 //Now calculate invariant mass:
667 Int_t nCurEvent = 0 ;
669 for(irp1 = 0; irp1 < allRecParticleList->GetEntries()-1; irp1++){
670 AliPHOSRecParticle * rp1 = (AliPHOSRecParticle *)allRecParticleList->At(irp1) ;
672 for(irp2 = irp1+1; irp2 < allRecParticleList->GetEntries(); irp2++){
673 AliPHOSRecParticle * rp2 = (AliPHOSRecParticle *)allRecParticleList->At(irp2) ;
676 invMass = (rp1->Energy()+rp2->Energy())*(rp1->Energy()+rp2->Energy())-
677 (rp1->Px()+rp2->Px())*(rp1->Px()+rp2->Px())-
678 (rp1->Py()+rp2->Py())*(rp1->Py()+rp2->Py())-
679 (rp1->Pz()+rp2->Pz())*(rp1->Pz()+rp2->Pz()) ;
682 invMass = TMath::Sqrt(invMass);
685 pt = TMath::Sqrt((rp1->Px()+rp2->Px() )*( rp1->Px()+rp2->Px() ) +(rp1->Py()+rp2->Py())*(rp1->Py()+rp2->Py()));
687 if(irp1 > nRecParticles[nCurEvent])
690 if(irp2 <= nRecParticles[nCurEvent]){ //'Real' event
691 hRealEM->Fill(invMass,pt);
692 if((rp1->GetType() == AliPHOSFastRecParticle::kGAMMA)&&(rp2->GetType() == AliPHOSFastRecParticle::kGAMMA))
693 hRealPhot->Fill(invMass,pt);
696 hMixedEM->Fill(invMass,pt);
697 if((rp1->GetType() == AliPHOSFastRecParticle::kGAMMA)&&(rp2->GetType() == AliPHOSFastRecParticle::kGAMMA))
698 hMixedPhot->Fill(invMass,pt);
701 } //loop over second rp
702 }//loop over first rp
703 allRecParticleList->Delete() ;
706 delete allRecParticleList ;
709 TFile output("invmass.root","RECREATE");
715 hMixedPhot->Write() ;
722 //____________________________________________________________________________
723 void AliPHOSAnalyze::ReadAndPrintEMC(Int_t EvFirst, Int_t EvLast)
726 // // Read and print generated and reconstructed hits in EMC
727 // // for events from EvFirst to Nevent.
728 // // If only EvFirst is defined, print only this one event.
729 // // Author: Yuri Kharlov
730 // // 24 November 2000
733 // if (EvFirst!=0 && EvLast==0) EvLast=EvFirst;
735 // for (ievent=EvFirst; ievent<=EvLast; ievent++) {
737 // //========== Event Number>
738 // cout << endl << "==== ReadAndPrintEMC ====> Event is " << ievent+1 << endl ;
740 // //=========== Connects the various Tree's for evt
741 // Int_t ntracks = gAlice->GetEvent(ievent);
742 // fPHOS->SetTreeAddress() ;
744 // gAlice->TreeD()->GetEvent(0) ;
745 // gAlice->TreeR()->GetEvent(0) ;
747 // // Loop over reconstructed particles
749 // TClonesArray ** recParticleList = fPHOS->RecParticles() ;
750 // AliPHOSRecParticle * recParticle ;
751 // Int_t iRecParticle ;
754 // for(iRecParticle = 0; iRecParticle < (*recParticleList)->GetEntries() ;iRecParticle++ ) {
755 // recParticle = (AliPHOSRecParticle *) (*recParticleList)->At(iRecParticle) ;
756 // Float_t recE = recParticle->Energy();
757 // primList = recParticle->GetPrimaries(nPrimary);
758 // Int_t moduleNumberRec ;
759 // Double_t recX, recZ ;
760 // fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
761 // printf("Rec point: module %d, (X,Z) = (%8.4f,%8.4f) cm, E = %.3f GeV, primary = %d\n",
762 // moduleNumberRec,recX,recZ,recE,*primList);
765 // // Read and print EMC hits from EMCn branches
767 // AliPHOSCPVModule emcModule;
768 // TClonesArray *emcHits;
770 // AliPHOSCPVHit *emcHit;
772 // Float_t xgen, zgen;
773 // Int_t ipart, primary;
774 // Int_t nGenHits = 0;
775 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
776 // //=========== Get the Hits Tree for the Primary track itrack
777 // gAlice->ResetHits();
778 // gAlice->TreeH()->GetEvent(itrack);
779 // Int_t iModule = 0 ;
780 // for (iModule=0; iModule < fGeom->GetNModules(); iModule++) {
781 // emcModule = fPHOS->GetEMCModule(iModule);
782 // emcHits = emcModule.Hits();
783 // nEMChits = emcHits->GetEntriesFast();
784 // for (Int_t ihit=0; ihit<nEMChits; ihit++) {
786 // emcHit = (AliPHOSCPVHit*)emcHits->UncheckedAt(ihit);
787 // p = emcHit->GetMomentum();
788 // xgen = emcHit->X();
789 // zgen = emcHit->Y();
790 // ipart = emcHit->GetIpart();
791 // primary= emcHit->GetTrack();
792 // printf("EMC hit A: module %d, ",iModule+1);
793 // printf(" p = (%f .4, %f .4, %f .4, %f .4) GeV,\n",
794 // p.Px(),p.Py(),p.Pz(),p.Energy());
795 // printf(" (X,Z) = (%8.4f, %8.4f) cm, ipart = %d, primary = %d\n",
796 // xgen,zgen,ipart,primary);
801 // // // Read and print EMC hits from PHOS branch
803 // // for (Int_t itrack=0; itrack<ntracks; itrack++) {
804 // // //=========== Get the Hits Tree for the Primary track itrack
805 // // gAlice->ResetHits();
806 // // gAlice->TreeH()->GetEvent(itrack);
807 // // TClonesArray *hits = fPHOS->Hits();
808 // // AliPHOSHit *hit ;
810 // // for ( ihit = 0 ; ihit < hits->GetEntries() ; ihit++ ) {
811 // // hit = (AliPHOSHit*)hits->At(ihit) ;
812 // // Float_t hitXYZ[3];
813 // // hitXYZ[0] = hit->X();
814 // // hitXYZ[1] = hit->Y();
815 // // hitXYZ[2] = hit->Z();
816 // // ipart = hit->GetPid();
817 // // primary = hit->GetPrimary();
818 // // Int_t absId = hit->GetId();
819 // // Int_t relId[4];
820 // // fGeom->AbsToRelNumbering(absId, relId) ;
821 // // Int_t module = relId[0];
822 // // if (relId[1]==0 && !(hitXYZ[0]==0 && hitXYZ[2]==0))
823 // // printf("EMC hit B: module %d, (X,Z) = (%8.4f, %8.4f) cm, ipart = %d, primary = %d\n",
824 // // module,hitXYZ[0],hitXYZ[2],ipart,primary);
831 //____________________________________________________________________________
832 void AliPHOSAnalyze::AnalyzeEMC(Int_t Nevents)
835 // // Read generated and reconstructed hits in EMC for Nevents events.
836 // // Plots the coordinate and energy resolution histograms.
837 // // Coordinate resolution is a difference between the reconstructed
838 // // coordinate and the exact coordinate on the face of the PHOS
839 // // Author: Yuri Kharlov
840 // // 27 November 2000
843 // // Book histograms
845 // TH1F *hDx1 = new TH1F("hDx1" ,"EMC x-resolution", 100,-5. , 5.);
846 // TH1F *hDz1 = new TH1F("hDz1" ,"EMC z-resolution", 100,-5. , 5.);
847 // TH1F *hDE1 = new TH1F("hDE1" ,"EMC E-resolution", 100,-2. , 2.);
849 // TH2F *hDx2 = new TH2F("hDx2" ,"EMC x-resolution", 100, 0., 10., 100,-5. , 5.);
850 // TH2F *hDz2 = new TH2F("hDz2" ,"EMC z-resolution", 100, 0., 10., 100,-5. , 5.);
851 // TH2F *hDE2 = new TH2F("hDE2" ,"EMC E-resolution", 100, 0., 10., 100, 0. , 5.);
853 // cout << "Start EMC Analysis"<< endl ;
854 // for (Int_t ievent=0; ievent<Nevents; ievent++) {
856 // //========== Event Number>
857 // if ( (ievent+1) % (Int_t)TMath::Power( 10, (Int_t)TMath::Log10(ievent+1) ) == 0)
858 // cout << "==== AnalyzeEMC ====> Event is " << ievent+1 << endl ;
860 // //=========== Connects the various Tree's for evt
861 // Int_t ntracks = gAlice->GetEvent(ievent);
863 // fPHOS->SetTreeAddress() ;
865 // gAlice->TreeD()->GetEvent(0) ;
866 // gAlice->TreeR()->GetEvent(0) ;
868 // // Create and fill arrays of hits for each EMC module
870 // Int_t nOfModules = fGeom->GetNModules();
871 // TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
873 // for (iModule=0; iModule < nOfModules; iModule++)
874 // hitsPerModule[iModule] = new TClonesArray("AliPHOSCPVHit",100);
876 // AliPHOSCPVModule emcModule;
877 // TClonesArray *emcHits;
879 // AliPHOSCPVHit *emcHit;
881 // // First go through all primary tracks and fill the arrays
882 // // of hits per each EMC module
884 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
885 // // Get the Hits Tree for the Primary track itrack
886 // gAlice->ResetHits();
887 // gAlice->TreeH()->GetEvent(itrack);
888 // for (Int_t iModule=0; iModule < nOfModules; iModule++) {
889 // emcModule = fPHOS->GetEMCModule(iModule);
890 // emcHits = emcModule.Hits();
891 // nEMChits = emcHits->GetEntriesFast();
892 // for (Int_t ihit=0; ihit<nEMChits; ihit++) {
893 // emcHit = (AliPHOSCPVHit*)emcHits->UncheckedAt(ihit);
894 // TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
895 // new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSCPVHit(*emcHit);
897 // emcModule.Clear();
901 // // Loop over reconstructed particles
903 // TClonesArray ** recParticleList = fPHOS->RecParticles() ;
904 // AliPHOSRecParticle * recParticle ;
905 // Int_t nEMCrecs = (*recParticleList)->GetEntries();
906 // if (nEMCrecs == 1) {
907 // recParticle = (AliPHOSRecParticle *) (*recParticleList)->At(0) ;
908 // Float_t recE = recParticle->Energy();
910 // Double_t recX, recZ ;
911 // fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), phosModule, recX, recZ) ;
913 // // for this rec.point take the hit list in the same PHOS module
915 // emcHits = hitsPerModule[phosModule-1];
916 // Int_t nEMChits = emcHits->GetEntriesFast();
917 // if (nEMChits == 1) {
918 // Float_t genX, genZ, genE;
919 // for (Int_t ihit=0; ihit<nEMChits; ihit++) {
920 // emcHit = (AliPHOSCPVHit*)emcHits->UncheckedAt(ihit);
921 // genX = emcHit->X();
922 // genZ = emcHit->Y();
923 // genE = emcHit->GetMomentum().E();
925 // Float_t dx = recX - genX;
926 // Float_t dz = recZ - genZ;
927 // Float_t de = recE - genE;
931 // hDx2 ->Fill(genE,dx);
932 // hDz2 ->Fill(genE,dz);
933 // hDE2 ->Fill(genE,recE);
936 // delete [] hitsPerModule;
938 // // Save histograms
940 // Text_t outputname[80] ;
941 // sprintf(outputname,"%s.analyzed",fRootFile->GetName());
942 // TFile output(outputname,"RECREATE");
952 // // Plot histograms
954 // TCanvas *emcCanvas = new TCanvas("EMC","EMC analysis",20,20,700,300);
955 // gStyle->SetOptStat(111111);
956 // gStyle->SetOptFit(1);
957 // gStyle->SetOptDate(1);
958 // emcCanvas->Divide(3,1);
961 // gPad->SetFillColor(10);
962 // hDx1->SetFillColor(16);
966 // gPad->SetFillColor(10);
967 // hDz1->SetFillColor(16);
971 // gPad->SetFillColor(10);
972 // hDE1->SetFillColor(16);
975 // emcCanvas->Print("EMC.ps");
979 //____________________________________________________________________________
980 void AliPHOSAnalyze::AnalyzeResolutions(Int_t Nevents )
982 // analyzes Nevents events and calculate Energy and Position resolution as well as
983 // probaility of correct indentifiing of the incident particle
985 //========== Booking Histograms
986 cout << "AnalyzeResolutions > " << "Booking Histograms" << endl ;
987 BookResolutionHistograms();
989 Int_t counter[9][5] ;
990 Int_t i1,i2,totalInd = 0 ;
991 for(i1 = 0; i1<9; i1++)
992 for(i2 = 0; i2<5; i2++)
993 counter[i1][i2] = 0 ;
995 Int_t totalPrimary = 0 ;
996 Int_t totalRecPart = 0 ;
997 Int_t totalRPwithPrim = 0 ;
1000 cout << "Start Analysing"<< endl ;
1001 for ( ievent=0; ievent<Nevents; ievent++)
1004 //========== Event Number>
1005 // if ( ( log10((Float_t)(ievent+1)) - (Int_t)(log10((Float_t)(ievent+1))) ) == 0. )
1006 cout << "AnalyzeResolutions > " << "Event is " << ievent << endl ;
1008 //=========== Connects the various Tree's for evt
1009 gAlice->GetEvent(ievent);
1011 //=========== Gets the Kine TTree
1012 gAlice->TreeK()->GetEvent(0) ;
1014 //=========== Gets the list of Primari Particles
1016 TParticle * primary ;
1018 for ( iPrimary = 0 ; iPrimary < gAlice->GetNtrack() ; iPrimary++)
1020 primary = gAlice->Particle(iPrimary) ;
1021 Int_t primaryType = primary->GetPdgCode() ;
1022 if( primaryType == 22 ) {
1023 Int_t moduleNumber ;
1024 Double_t primX, primZ ;
1025 fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
1027 fhPrimary->Fill(primary->Energy()) ;
1028 if(primary->Energy() > 0.3)
1034 fPHOS->SetTreeAddress() ;
1036 gAlice->TreeD()->GetEvent(0) ;
1037 gAlice->TreeR()->GetEvent(0) ;
1039 TClonesArray ** recParticleList = fPHOS->RecParticles() ;
1041 AliPHOSRecParticle * recParticle ;
1042 Int_t iRecParticle ;
1043 for(iRecParticle = 0; iRecParticle < (*recParticleList)->GetEntries() ;iRecParticle++ )
1045 recParticle = (AliPHOSRecParticle *) (*recParticleList)->At(iRecParticle) ;
1046 fhAllRP->Fill(CorrectEnergy(recParticle->Energy())) ;
1048 Int_t moduleNumberRec ;
1049 Double_t recX, recZ ;
1050 fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
1052 Double_t minDistance = 100. ;
1053 Int_t closestPrimary = -1 ;
1055 Int_t numberofprimaries ;
1056 Int_t * listofprimaries = recParticle->GetPrimaries(numberofprimaries) ;
1058 TParticle * primary ;
1059 Double_t distance = minDistance ;
1061 Double_t dXmin = 0.;
1062 Double_t dZmin = 0. ;
1063 for ( index = 0 ; index < numberofprimaries ; index++){
1064 primary = gAlice->Particle(listofprimaries[index]) ;
1065 Int_t moduleNumber ;
1066 Double_t primX, primZ ;
1067 fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
1068 if(moduleNumberRec == moduleNumber) {
1071 distance = TMath::Sqrt(dX*dX + dZ*dZ) ;
1072 if(minDistance > distance) {
1073 minDistance = distance ;
1076 closestPrimary = listofprimaries[index] ;
1082 if(closestPrimary >=0 ){
1085 Int_t primaryType = gAlice->Particle(closestPrimary)->GetPdgCode() ;
1086 // TParticlePDG* pDGparticle = gAlice->ParticleAt(closestPrimary)->GetPDG();
1087 // Double_t charge = PDGparticle->Charge() ;
1089 // cout <<"Primary " <<primaryType << " E " << ((TParticle *)primaryList->At(closestPrimary))->Energy() << endl ;
1094 primaryCode = 0; //Photon
1095 fhAllEnergy ->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy()) ;
1096 fhAllPosition ->Fill(gAlice->Particle(closestPrimary)->Energy(), minDistance) ;
1097 fhAllPositionX->Fill(dXmin);
1098 fhAllPositionZ->Fill(dZmin);
1101 primaryCode = 1; //Electron
1104 primaryCode = 1; //positron
1107 primaryCode = 4; //K+
1110 primaryCode = 4; //K-
1113 primaryCode = 4; //K0s
1116 primaryCode = 4; //K0l
1119 primaryCode = 2; //K0l
1122 primaryCode = 2; //K0l
1125 primaryCode = 2; //K0l
1128 primaryCode = 2; //K0l
1131 primaryCode = 3; //ELSE
1135 switch(recParticle->GetType())
1137 case AliPHOSFastRecParticle::kGAMMA:
1138 if(primaryType == 22){
1139 fhPhotEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1140 fhEMEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1141 fhPPSDEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1143 fhPhotPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1144 fhEMPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1145 fhPPSDPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1147 fhPhotReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1148 fhPhotEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1149 fhPhotPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1151 fhPhotPhot->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1153 if(primaryType == 2112){ //neutron
1154 fhNReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1155 fhNEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1156 fhNPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1159 if(primaryType == -2112){ //neutron ~
1160 fhNBarReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1161 fhNBarEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1162 fhNBarPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1165 if(primaryCode == 2){
1166 fhChargedReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1167 fhChargedEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1168 fhChargedPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1171 fhAllReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1172 fhAllEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1173 fhAllPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1174 fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1175 fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1176 fhPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1177 counter[0][primaryCode]++;
1179 case AliPHOSFastRecParticle::kELECTRON:
1180 if(primaryType == 22){
1181 fhPhotElec->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1182 fhEMEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1183 fhEMPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1184 fhPhotEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1185 fhPhotPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1187 if(primaryType == 2112){ //neutron
1188 fhNEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1189 fhNPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1192 if(primaryType == -2112){ //neutron ~
1193 fhNBarEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1194 fhNBarPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1197 if(primaryCode == 2){
1198 fhChargedEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1199 fhChargedPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1202 fhAllEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1203 fhAllPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1204 fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1205 fhPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1206 counter[1][primaryCode]++;
1208 case AliPHOSFastRecParticle::kNEUTRALHA:
1209 if(primaryType == 22)
1210 fhPhotNeuH->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1212 fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1213 counter[2][primaryCode]++;
1215 case AliPHOSFastRecParticle::kNEUTRALEM:
1216 if(primaryType == 22){
1217 fhEMEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(),recParticle->Energy() ) ;
1218 fhEMPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance ) ;
1220 fhPhotNuEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1221 fhPhotEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1223 if(primaryType == 2112) //neutron
1224 fhNEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1226 if(primaryType == -2112) //neutron ~
1227 fhNBarEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1229 if(primaryCode == 2)
1230 fhChargedEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1232 fhAllEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1233 fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1234 fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1236 counter[3][primaryCode]++;
1238 case AliPHOSFastRecParticle::kCHARGEDHA:
1239 if(primaryType == 22) //photon
1240 fhPhotChHa->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1242 counter[4][primaryCode]++ ;
1244 case AliPHOSFastRecParticle::kGAMMAHA:
1245 if(primaryType == 22){ //photon
1246 fhPhotGaHa->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1247 fhPPSDEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1248 fhPPSDPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1249 fhPhotPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1251 if(primaryType == 2112){ //neutron
1252 fhNPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1255 if(primaryType == -2112){ //neutron ~
1256 fhNBarPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1258 if(primaryCode == 2){
1259 fhChargedPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1262 fhAllPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1263 fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1264 fhPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1265 counter[5][primaryCode]++ ;
1267 case AliPHOSFastRecParticle::kABSURDEM:
1268 counter[6][primaryCode]++ ;
1269 fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1271 case AliPHOSFastRecParticle::kABSURDHA:
1272 counter[7][primaryCode]++ ;
1275 counter[8][primaryCode]++ ;
1282 cout << "Resolutions: Analyzed " << Nevents << " event(s)" << endl ;
1283 cout << "Resolutions: Total primary " << totalPrimary << endl ;
1284 cout << "Resoluitons: Total reconstracted " << totalRecPart << endl ;
1285 cout << "TotalReconstructed with Primarie " << totalRPwithPrim << endl ;
1286 cout << " Primary: Photon Electron Ch. Hadr. Neutr. Hadr Kaons" << endl ;
1287 cout << " Detected as photon " << counter[0][0] << " " << counter[0][1] << " " << counter[0][2] << " " <<counter[0][3] << " " << counter[0][4] << endl ;
1288 cout << " Detected as electron " << counter[1][0] << " " << counter[1][1] << " " << counter[1][2] << " " <<counter[1][3] << " " << counter[1][4] << endl ;
1289 cout << " Detected as neutral hadron " << counter[2][0] << " " << counter[2][1] << " " << counter[2][2] << " " <<counter[2][3] << " " << counter[2][4] << endl ;
1290 cout << " Detected as neutral EM " << counter[3][0] << " " << counter[3][1] << " " << counter[3][2] << " " <<counter[3][3] << " " << counter[3][4] << endl ;
1291 cout << " Detected as charged hadron " << counter[4][0] << " " << counter[4][1] << " " << counter[4][2] << " " <<counter[4][3] << " " << counter[4][4] << endl ;
1292 cout << " Detected as gamma-hadron " << counter[5][0] << " " << counter[5][1] << " " << counter[5][2] << " " <<counter[5][3] << " " << counter[5][4] << endl ;
1293 cout << " Detected as Absurd EM " << counter[6][0] << " " << counter[6][1] << " " << counter[6][2] << " " <<counter[6][3] << " " << counter[6][4] << endl ;
1294 cout << " Detected as absurd hadron " << counter[7][0] << " " << counter[7][1] << " " << counter[7][2] << " " <<counter[7][3] << " " << counter[7][4] << endl ;
1295 cout << " Detected as undefined " << counter[8][0] << " " << counter[8][1] << " " << counter[8][2] << " " <<counter[8][3] << " " << counter[8][4] << endl ;
1297 for(i1 = 0; i1<9; i1++)
1298 for(i2 = 0; i2<5; i2++)
1299 totalInd+=counter[i1][i2] ;
1300 cout << "Indentified particles " << totalInd << endl ;
1305 //____________________________________________________________________________
1306 void AliPHOSAnalyze::BookingHistograms()
1308 // Books the histograms where the results of the analysis are stored (to be changed)
1311 delete fhVetoDigit ;
1312 delete fhConvertorDigit ;
1313 delete fhEmcCluster ;
1314 delete fhVetoCluster ;
1315 delete fhConvertorCluster ;
1316 delete fhConvertorEmc ;
1318 fhEmcDigit = new TH1F("hEmcDigit", "hEmcDigit", 1000, 0. , 25.);
1319 fhVetoDigit = new TH1F("hVetoDigit", "hVetoDigit", 500, 0. , 3.e-5);
1320 fhConvertorDigit = new TH1F("hConvertorDigit","hConvertorDigit", 500, 0. , 3.e-5);
1321 fhEmcCluster = new TH1F("hEmcCluster", "hEmcCluster", 1000, 0. , 30.);
1322 fhVetoCluster = new TH1F("hVetoCluster", "hVetoCluster", 500, 0. , 3.e-5);
1323 fhConvertorCluster = new TH1F("hConvertorCluster","hConvertorCluster",500, 0. , 3.e-5);
1324 fhConvertorEmc = new TH2F("hConvertorEmc", "hConvertorEmc", 200, 1. , 3., 200, 0., 3.e-5);
1327 //____________________________________________________________________________
1328 void AliPHOSAnalyze::BookResolutionHistograms()
1330 // Books the histograms where the results of the Resolution analysis are stored
1333 // delete fhAllEnergy ;
1335 // delete fhPhotEnergy ;
1337 // delete fhEMEnergy ;
1339 // delete fhPPSDEnergy ;
1342 fhAllEnergy = new TH2F("hAllEnergy", "Energy of any RP with primary photon",100, 0., 5., 100, 0., 5.);
1343 fhPhotEnergy = new TH2F("hPhotEnergy", "Energy of kGAMMA with primary photon",100, 0., 5., 100, 0., 5.);
1344 fhEMEnergy = new TH2F("hEMEnergy", "Energy of EM with primary photon", 100, 0., 5., 100, 0., 5.);
1345 fhPPSDEnergy = new TH2F("hPPSDEnergy", "Energy of PPSD with primary photon", 100, 0., 5., 100, 0., 5.);
1347 // if(fhAllPosition)
1348 // delete fhAllPosition ;
1349 // if(fhPhotPosition)
1350 // delete fhPhotPosition ;
1352 // delete fhEMPosition ;
1353 // if(fhPPSDPosition)
1354 // delete fhPPSDPosition ;
1357 fhAllPosition = new TH2F("hAllPosition", "Position of any RP with primary photon",100, 0., 5., 100, 0., 5.);
1358 fhPhotPosition = new TH2F("hPhotPosition", "Position of kGAMMA with primary photon",100, 0., 5., 100, 0., 5.);
1359 fhEMPosition = new TH2F("hEMPosition", "Position of EM with primary photon", 100, 0., 5., 100, 0., 5.);
1360 fhPPSDPosition = new TH2F("hPPSDPosition", "Position of PPSD with primary photon", 100, 0., 5., 100, 0., 5.);
1362 fhAllPositionX = new TH1F("hAllPositionX", "#Delta X of any RP with primary photon",100, -2., 2.);
1363 fhAllPositionZ = new TH1F("hAllPositionZ", "#Delta X of any RP with primary photon",100, -2., 2.);
1366 // delete fhAllReg ;
1368 // delete fhPhotReg ;
1372 // delete fhNBarReg ;
1374 // delete fhChargedReg ;
1376 fhAllReg = new TH1F("hAllReg", "All primaries registered as photon", 100, 0., 5.);
1377 fhPhotReg = new TH1F("hPhotReg", "Photon registered as photon", 100, 0., 5.);
1378 fhNReg = new TH1F("hNReg", "N registered as photon", 100, 0., 5.);
1379 fhNBarReg = new TH1F("hNBarReg", "NBar registered as photon", 100, 0., 5.);
1380 fhChargedReg= new TH1F("hChargedReg", "Charged hadron registered as photon",100, 0., 5.);
1385 // delete fhPhotEM ;
1389 // delete fhNBarEM ;
1391 // delete fhChargedEM ;
1393 fhAllEM = new TH1F("hAllEM", "All primary registered as EM",100, 0., 5.);
1394 fhPhotEM = new TH1F("hPhotEM", "Photon registered as EM", 100, 0., 5.);
1395 fhNEM = new TH1F("hNEM", "N registered as EM", 100, 0., 5.);
1396 fhNBarEM = new TH1F("hNBarEM", "NBar registered as EM", 100, 0., 5.);
1397 fhChargedEM= new TH1F("hChargedEM","Charged registered as EM",100, 0., 5.);
1400 // delete fhAllPPSD ;
1402 // delete fhPhotPPSD ;
1406 // delete fhNBarPPSD ;
1407 // if(fhChargedPPSD)
1408 // delete fhChargedPPSD ;
1410 fhAllPPSD = new TH1F("hAllPPSD", "All primary registered as PPSD",100, 0., 5.);
1411 fhPhotPPSD = new TH1F("hPhotPPSD", "Photon registered as PPSD", 100, 0., 5.);
1412 fhNPPSD = new TH1F("hNPPSD", "N registered as PPSD", 100, 0., 5.);
1413 fhNBarPPSD = new TH1F("hNBarPPSD", "NBar registered as PPSD", 100, 0., 5.);
1414 fhChargedPPSD= new TH1F("hChargedPPSD","Charged registered as PPSD",100, 0., 5.);
1417 // delete fhPrimary ;
1418 fhPrimary= new TH1F("hPrimary", "hPrimary", 100, 0., 5.);
1429 fhAllRP = new TH1F("hAllRP","All Reconstructed particles", 100, 0., 5.);
1430 fhVeto = new TH1F("hVeto", "All uncharged particles", 100, 0., 5.);
1431 fhShape = new TH1F("hShape","All particles with EM shaower",100, 0., 5.);
1432 fhPPSD = new TH1F("hPPSD", "All PPSD photon particles", 100, 0., 5.);
1436 // delete fhPhotPhot ;
1438 // delete fhPhotElec ;
1440 // delete fhPhotNeuH ;
1442 // delete fhPhotNuEM ;
1444 // delete fhPhotChHa ;
1446 // delete fhPhotGaHa ;
1448 fhPhotPhot = new TH1F("hPhotPhot","hPhotPhot", 100, 0., 5.); //Photon registered as photon
1449 fhPhotElec = new TH1F("hPhotElec","hPhotElec", 100, 0., 5.); //Photon registered as Electron
1450 fhPhotNeuH = new TH1F("hPhotNeuH","hPhotNeuH", 100, 0., 5.); //Photon registered as Neutral Hadron
1451 fhPhotNuEM = new TH1F("hPhotNuEM","hPhotNuEM", 100, 0., 5.); //Photon registered as Neutral EM
1452 fhPhotChHa = new TH1F("hPhotChHa","hPhotChHa", 100, 0., 5.); //Photon registered as Charged Hadron
1453 fhPhotGaHa = new TH1F("hPhotGaHa","hPhotGaHa", 100, 0., 5.); //Photon registered as Gamma-Hadron
1456 //____________________________________________________________________________
1457 Bool_t AliPHOSAnalyze::OpenRootFile(Text_t * name)
1459 // Open the root file named "name"
1461 fRootFile = new TFile(name, "update") ;
1462 return fRootFile->IsOpen() ;
1465 //____________________________________________________________________________
1466 void AliPHOSAnalyze::SaveHistograms()
1468 // Saves the histograms in a root file named "name.analyzed"
1470 Text_t outputname[80] ;
1471 sprintf(outputname,"%s.analyzed",fRootFile->GetName());
1472 TFile output(outputname,"RECREATE");
1476 fhAllEnergy->Write() ;
1478 fhPhotEnergy->Write() ;
1480 fhEMEnergy->Write() ;
1482 fhPPSDEnergy->Write() ;
1484 fhAllPosition->Write() ;
1486 fhAllPositionX->Write() ;
1488 fhAllPositionZ->Write() ;
1490 fhPhotPosition->Write() ;
1492 fhEMPosition->Write() ;
1494 fhPPSDPosition->Write() ;
1498 fhPhotReg->Write() ;
1502 fhNBarReg->Write() ;
1504 fhChargedReg->Write() ;
1514 fhChargedEM->Write() ;
1516 fhAllPPSD->Write() ;
1518 fhPhotPPSD->Write() ;
1522 fhNBarPPSD->Write() ;
1524 fhChargedPPSD->Write() ;
1526 fhPrimary->Write() ;
1536 fhPhotPhot->Write() ;
1538 fhPhotElec->Write() ;
1540 fhPhotNeuH->Write() ;
1542 fhPhotNuEM->Write() ;
1544 fhPhotNuEM->Write() ;
1546 fhPhotChHa->Write() ;
1548 fhPhotGaHa->Write() ;
1549 if(fhEnergyCorrelations)
1550 fhEnergyCorrelations->Write() ;
1555 //____________________________________________________________________________
1556 Float_t AliPHOSAnalyze::CorrectEnergy(Float_t ERecPart)
1558 return ERecPart/0.8783 ;
1561 //____________________________________________________________________________
1562 void AliPHOSAnalyze::ResetHistograms()
1564 fhEnergyCorrelations = 0 ; //Energy correlations between Eloss in Convertor and PPSD(2)
1566 fhEmcDigit = 0 ; // Histo of digit energies in the Emc
1567 fhVetoDigit = 0 ; // Histo of digit energies in the Veto
1568 fhConvertorDigit = 0 ; // Histo of digit energies in the Convertor
1569 fhEmcCluster = 0 ; // Histo of Cluster energies in Emc
1570 fhVetoCluster = 0 ; // Histo of Cluster energies in Veto
1571 fhConvertorCluster = 0 ; // Histo of Cluster energies in Convertor
1572 fhConvertorEmc = 0 ; // 2d Convertor versus Emc energies
1575 fhPhotEnergy = 0 ; // Total spectrum of detected photons
1576 fhEMEnergy = 0 ; // Spectrum of detected electrons with electron primary
1579 fhAllPositionX = 0 ;
1580 fhAllPositionZ = 0 ;
1581 fhPhotPosition = 0 ;
1583 fhPPSDPosition = 0 ;