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 **************************************************************************/
16 //_________________________________________________________________________
17 // Algorythm class to analyze PHOSv1 events:
18 // Construct histograms and displays them.
19 // IHEP CPV/PHOS reconstruction algorithm used.
20 // Use the macro EditorBar.C for best access to the functionnalities
22 //*-- Author: B. Polichtchouk (IHEP)
23 //////////////////////////////////////////////////////////////////////////////
25 // --- ROOT system ---
31 #include "TParticle.h"
32 #include "TClonesArray.h"
38 // --- Standard library ---
40 // --- AliRoot header files ---
42 #include "AliRunLoader.h"
43 #include "AliHeader.h"
45 // --- PHOS header files ---
47 #include "AliPHOSIhepAnalyze.h"
48 #include "AliPHOSDigit.h"
49 #include "AliPHOSRecParticle.h"
50 #include "AliPHOSLoader.h"
51 #include "AliPHOSHit.h"
52 #include "AliPHOSImpact.h"
53 #include "AliPHOSvImpacts.h"
54 #include "AliPHOSCpvRecPoint.h"
56 #include "AliPHOSGeometry.h"
57 #include "AliPHOSEvalRecPoint.h"
59 ClassImp(AliPHOSIhepAnalyze)
61 //____________________________________________________________________________
62 AliPHOSIhepAnalyze::AliPHOSIhepAnalyze():
68 //____________________________________________________________________________
69 AliPHOSIhepAnalyze::AliPHOSIhepAnalyze(Text_t * name) :
73 // Constructor: open a header file
74 fRunLoader = AliRunLoader::Open(fFileName);
75 if (fRunLoader == 0x0)
77 AliFatal(Form("Can not load event from file %s",name));
81 //____________________________________________________________________________
82 void AliPHOSIhepAnalyze::AnalyzeCPV1(Int_t Nevents)
85 // Analyzes CPV characteristics: resolutions, cluster multiplicity,
86 // cluster lengths along Z and Phi.
87 // Author: Yuri Kharlov
89 // Modified by Boris Polichtchouk, 3.07.2001
94 TH1F *hDx = new TH1F("hDx" ,"CPV x-resolution@reconstruction",100,-5. , 5.);
95 TH1F *hDz = new TH1F("hDz" ,"CPV z-resolution@reconstruction",100,-5. , 5.);
96 TH1F *hChi2 = new TH1F("hChi2" ,"Chi2/dof of one-gamma fit",30, 0. , 10.);
97 TH1S *hNrp = new TH1S("hNrp" ,"CPV rec.point multiplicity", 21,-0.5,20.5);
98 TH1S *hNrpX = new TH1S("hNrpX","CPV rec.point Phi-length" , 21,-0.5,20.5);
99 TH1S *hNrpZ = new TH1S("hNrpZ","CPV rec.point Z-length" , 21,-0.5,20.5);
101 TH1F *hEg = new TH1F("hEg" ,"Energies of impacts",30,0.,6.);
102 TH1F *hEr = new TH1F("hEr" ,"Amplitudes of rec. points",50,0.,20.);
104 TList * fCpvImpacts ;
105 TBranch * branchCPVimpacts;
109 AliPHOSLoader* please = dynamic_cast<AliPHOSLoader*>(fRunLoader->GetLoader("PHOSLoader"));
112 AliError(Form("Could not obtain the Loader object !"));
116 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
118 AliInfo(Form("Start CPV Analysis-1. Resolutions, cluster multiplicity and lengths")) ;
119 for ( Int_t ievent=0; ievent<Nevents; ievent++) {
122 Int_t nChargedGen = 0;
124 Int_t ntracks = gAlice->GetEvent(ievent);
125 AliInfo(Form(">>>>>>>Event %d .<<<<<<<", ievent)) ;
127 /******************************************************************/
128 TTree* treeH = please->TreeH();
131 AliError(Form("Can not get TreeH"));
134 /******************************************************************/
136 // Get branch of CPV impacts
137 if (! (branchCPVimpacts =treeH->GetBranch("PHOSCpvImpacts")) ) {
138 AliWarning(Form("Couldn't find branch PHOSCpvImpacts. Exit.")) ;
142 // Create and fill arrays of hits for each CPV module
144 Int_t nOfModules = phosgeom->GetNModules();
145 TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
147 for (iModule=0; iModule < nOfModules; iModule++)
148 hitsPerModule[iModule] = new TClonesArray("AliPHOSImpact",100);
150 TClonesArray *impacts;
151 AliPHOSImpact *impact;
154 // First go through all primary tracks and fill the arrays
155 // of hits per each CPV module
157 for (Int_t itrack=0; itrack<ntracks; itrack++) {
158 branchCPVimpacts ->SetAddress(&fCpvImpacts);
159 branchCPVimpacts ->GetEntry(itrack,0);
161 for (iModule=0; iModule < nOfModules; iModule++) {
162 impacts = (TClonesArray *)fCpvImpacts->At(iModule);
163 // Do loop over impacts in the module
164 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
165 impact=(AliPHOSImpact*)impacts->At(iImpact);
166 hEg->Fill(impact->GetMomentum().E());
167 TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
168 if(IsCharged(impact->GetPid())) nChargedGen++;
169 new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSImpact(*impact);
172 fCpvImpacts->Clear();
174 for (iModule=0; iModule < nOfModules; iModule++) {
175 Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
176 printf("CPV module %d has %d impacts\n",iModule,nsum);
180 // Then go through reconstructed points and for each find
182 // The distance from the rec.point to the closest hit
183 // gives the coordinate resolution of the CPV
185 fRunLoader->GetEvent(ievent);
186 TIter nextRP(please->CpvRecPoints()) ;
187 AliPHOSCpvRecPoint *cpvRecPoint ;
188 Float_t xgen, ygen, zgen;
189 while( ( cpvRecPoint = (AliPHOSCpvRecPoint *)nextRP() ) ) {
191 Float_t chi2dof = ((AliPHOSEvalRecPoint*)cpvRecPoint)->Chi2Dof();
192 hChi2->Fill(chi2dof);
193 hEr->Fill(cpvRecPoint->GetEnergy());
196 cpvRecPoint->GetLocalPosition(locpos);
197 Int_t phosModule = cpvRecPoint->GetPHOSMod();
198 Int_t rpMult = cpvRecPoint->GetMultiplicity();
199 Int_t rpMultX, rpMultZ;
200 cpvRecPoint->GetClusterLengths(rpMultX,rpMultZ);
201 Float_t xrec = locpos.X();
202 Float_t zrec = locpos.Z();
203 Float_t dxmin = 1.e+10;
204 Float_t dzmin = 1.e+10;
205 Float_t r2min = 1.e+10;
208 Int_t nCPVhits = (hitsPerModule[phosModule-1])->GetEntriesFast();
209 Float_t locImpX=1e10,locImpZ=1e10; // local coords of closest impact
210 Float_t gImpX=1e10, gImpZ=1e10,gImpY=1e10; // global coords of closest impact
211 for (Int_t ihit=0; ihit<nCPVhits; ihit++) {
212 impact = (AliPHOSImpact*)(hitsPerModule[phosModule-1])->UncheckedAt(ihit);
217 //Transform to the local ref.frame
218 Float_t phig = phosgeom->GetPHOSAngle(phosModule);
219 Float_t phi = TMath::Pi()/180*phig;
220 Float_t distanceIPtoCPV = phosgeom->GetIPtoOuterCoverDistance() -
221 (phosgeom->GetFTPosition(1)+
222 phosgeom->GetFTPosition(2)+
223 phosgeom->GetCPVTextoliteThickness())/2;
224 Float_t xoL,yoL,zoL ;
225 // xoL = xgen*TMath::Cos(phig)+ygen*TMath::Sin(phig) ;
226 // yoL = -xgen*TMath::Sin(phig)+ygen*TMath::Cos(phig) + distanceIPtoCPV;
227 xoL = xgen*TMath::Cos(phi)-ygen*TMath::Sin(phi) ;
228 yoL = xgen*TMath::Sin(phi)+ygen*TMath::Cos(phi) + distanceIPtoCPV;
231 r2 = TMath::Power((xoL-xrec),2) + TMath::Power((zoL-zrec),2);
243 AliInfo(Form("Impact global (X,Z,Y) = %f %f %f", gImpX, gImpZ, gImpY));
244 AliInfo(Form("Impact local (X,Z) = %f %f", locImpX, locImpZ));
245 AliInfo(Form("Reconstructed (X,Z) = %f %f", xrec, zrec));
246 AliInfo(Form("dxmin %f dzmin %f", dxmin, dzmin));
249 // hDr ->Fill(TMath::Sqrt(r2min));
251 hNrpX->Fill(rpMultX);
252 hNrpZ->Fill(rpMultZ);
254 delete [] hitsPerModule;
256 AliInfo(Form("++++ Event %d : total %d impacts, %d charged impacts and %d rec. points.",
257 ievent, nTotalGen, nChargedGen, please->CpvRecPoints()->GetEntries())) ;
261 Text_t outputname[80] ;
262 snprintf(outputname,80,"%s.analyzed",GetFileName().Data());
263 TFile output(outputname,"RECREATE");
268 TCanvas *cpvCanvas = new TCanvas("Cpv1","CPV analysis-I",20,20,800,600);
269 gStyle->SetOptStat(111111);
270 gStyle->SetOptFit(1);
271 gStyle->SetOptDate(1);
272 cpvCanvas->Divide(3,3);
275 gPad->SetFillColor(10);
276 hNrp->SetFillColor(16);
280 gPad->SetFillColor(10);
281 hNrpX->SetFillColor(16);
285 gPad->SetFillColor(10);
286 hNrpZ->SetFillColor(16);
290 gPad->SetFillColor(10);
291 hDx->SetFillColor(16);
296 gPad->SetFillColor(10);
297 hDz->SetFillColor(16);
302 gPad->SetFillColor(10);
303 hChi2->SetFillColor(16);
307 gPad->SetFillColor(10);
308 hEg->SetFillColor(16);
312 gPad->SetFillColor(10);
313 hEr->SetFillColor(16);
316 cpvCanvas->Write(0,kOverwrite);
321 void AliPHOSIhepAnalyze::AnalyzeEMC1(Int_t Nevents)
324 // Analyzes Emc characteristics: resolutions, cluster multiplicity,
325 // cluster lengths along Z and Phi.
326 // Author: Boris Polichtchouk, 24.08.2001
331 TH1F *hDx = new TH1F("hDx" ,"EMC x-resolution@reconstruction",100,-5. , 5.);
332 TH1F *hDz = new TH1F("hDz" ,"EMC z-resolution@reconstruction",100,-5. , 5.);
333 TH1F *hChi2 = new TH1F("hChi2" ,"Chi2/dof of one-gamma fit",30, 0. , 3.);
334 TH1S *hNrp = new TH1S("hNrp" ,"EMC rec.point multiplicity", 21,-0.5,20.5);
335 TH1S *hNrpX = new TH1S("hNrpX","EMC rec.point Phi-length" , 21,-0.5,20.5);
336 TH1S *hNrpZ = new TH1S("hNrpZ","EMC rec.point Z-length" , 21,-0.5,20.5);
338 TList * fEmcImpacts ;
339 TBranch * branchEMCimpacts;
341 AliPHOSLoader* please = dynamic_cast<AliPHOSLoader*>(fRunLoader->GetLoader("PHOSLoader"));
344 AliError(Form("Could not obtain the Loader object !"));
348 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
350 AliInfo(Form("Start EMC Analysis-1. Resolutions, cluster multiplicity and lengths"));
351 for ( Int_t ievent=0; ievent<Nevents; ievent++) {
355 Int_t ntracks = gAlice->GetEvent(ievent);
357 AliInfo(Form(" >>>>>>>Event %d .<<<<<<<", ievent)) ;
359 TTree* treeH = please->TreeH();
362 AliError(Form("Can not get TreeH"));
367 // Get branch of EMC impacts
368 if (! (branchEMCimpacts =treeH->GetBranch("PHOSEmcImpacts")) ) {
369 AliWarning(Form(" Couldn't find branch PHOSEmcImpacts. Exit."));
373 // Create and fill arrays of hits for each EMC module
375 Int_t nOfModules = phosgeom->GetNModules();
376 TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
378 for (iModule=0; iModule < nOfModules; iModule++)
379 hitsPerModule[iModule] = new TClonesArray("AliPHOSImpact",100);
381 TClonesArray *impacts;
382 AliPHOSImpact *impact;
385 // First go through all primary tracks and fill the arrays
386 // of hits per each EMC module
388 for (Int_t itrack=0; itrack<ntracks; itrack++) {
389 branchEMCimpacts ->SetAddress(&fEmcImpacts);
390 branchEMCimpacts ->GetEntry(itrack,0);
392 for (iModule=0; iModule < nOfModules; iModule++) {
393 impacts = (TClonesArray *)fEmcImpacts->At(iModule);
394 // Do loop over impacts in the module
395 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
396 impact=(AliPHOSImpact*)impacts->At(iImpact);
397 TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
398 new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSImpact(*impact);
401 fEmcImpacts->Clear();
403 for (iModule=0; iModule < nOfModules; iModule++) {
404 Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
405 printf("EMC module %d has %d hits\n",iModule,nsum);
409 // Then go through reconstructed points and for each find
411 // The distance from the rec.point to the closest hit
412 // gives the coordinate resolution of the EMC
414 fRunLoader->GetEvent(ievent);
415 TIter nextRP(please->EmcRecPoints()) ;
416 AliPHOSEmcRecPoint *emcRecPoint ;
417 Float_t xgen, ygen, zgen;
418 while( ( emcRecPoint = (AliPHOSEmcRecPoint *)nextRP() ) ) {
420 Float_t chi2dof = ((AliPHOSEvalRecPoint*)emcRecPoint)->Chi2Dof();
421 hChi2->Fill(chi2dof);
424 emcRecPoint->GetLocalPosition(locpos);
425 Int_t phosModule = emcRecPoint->GetPHOSMod();
426 Int_t rpMult = emcRecPoint->GetMultiplicity();
427 Int_t rpMultX, rpMultZ;
428 ((AliPHOSEvalRecPoint*)emcRecPoint)->GetClusterLengths(rpMultX,rpMultZ);
429 Float_t xrec = locpos.X();
430 Float_t zrec = locpos.Z();
431 Float_t dxmin = 1.e+10;
432 Float_t dzmin = 1.e+10;
433 Float_t r2min = 1.e+10;
436 Int_t nEMChits = (hitsPerModule[phosModule-1])->GetEntriesFast();
437 Float_t locImpX=1e10,locImpZ=1e10; // local coords of closest impact
438 Float_t gImpX=1e10, gImpZ=1e10,gImpY=1e10; // global coords of closest impact
439 for (Int_t ihit=0; ihit<nEMChits; ihit++) {
440 impact = (AliPHOSImpact*)(hitsPerModule[phosModule-1])->UncheckedAt(ihit);
446 //Transform to the local ref.frame
447 Float_t phig = phosgeom->GetPHOSAngle(phosModule);
448 Float_t phi = TMath::Pi()/180*phig;
449 Float_t distanceIPtoEMC = phosgeom->GetIPtoCrystalSurface();
450 Float_t xoL,yoL,zoL ;
451 // xoL = xgen*TMath::Cos(phig)+ygen*TMath::Sin(phig) ;
452 // yoL = -xgen*TMath::Sin(phig)+ygen*TMath::Cos(phig) + distanceIPtoEMC;
453 xoL = xgen*TMath::Cos(phi)-ygen*TMath::Sin(phi) ;
454 yoL = xgen*TMath::Sin(phi)+ygen*TMath::Cos(phi) + distanceIPtoEMC;
457 r2 = TMath::Power((xoL-xrec),2) + TMath::Power((zoL-zrec),2);
469 AliInfo(Form(" Impact global (X,Z,Y) = %f %f %f", gImpX, gImpZ, gImpY));
470 AliInfo(Form(" Impact local (X,Z) = %f %f", locImpX, locImpZ));
471 AliInfo(Form(" Reconstructed (X,Z) = %f %f", xrec, zrec));
472 AliInfo(Form(" dxmin %f dzmin %f", dxmin, dzmin)) ;
475 // hDr ->Fill(TMath::Sqrt(r2min));
477 hNrpX->Fill(rpMultX);
478 hNrpZ->Fill(rpMultZ);
480 delete [] hitsPerModule;
482 AliInfo(Form("++++ Event %d : total %d impacts, %d Emc rec. points.",
483 ievent, nTotalGen, please->EmcRecPoints()->GetEntriesFast())) ;
488 Text_t outputname[80] ;
489 snprintf(outputname,80,"%s.analyzed",GetFileName().Data());
490 TFile output(outputname,"update");
495 TCanvas *emcCanvas = new TCanvas("Emc1","EMC analysis-I",20,20,800,400);
496 gStyle->SetOptStat(111111);
497 gStyle->SetOptFit(1);
498 gStyle->SetOptDate(1);
499 emcCanvas->Divide(3,2);
502 gPad->SetFillColor(10);
503 hNrp->SetFillColor(16);
507 gPad->SetFillColor(10);
508 hNrpX->SetFillColor(16);
512 gPad->SetFillColor(10);
513 hNrpZ->SetFillColor(16);
517 gPad->SetFillColor(10);
518 hDx->SetFillColor(16);
523 gPad->SetFillColor(10);
524 hDz->SetFillColor(16);
529 gPad->SetFillColor(10);
530 hChi2->SetFillColor(16);
533 emcCanvas->Write(0,kOverwrite);
536 //____________________________________________________________________________
537 void AliPHOSIhepAnalyze::AnalyzeCPV2(Int_t Nevents)
539 // CPV analysis - part II.
540 // Ratio of combinatoric distances between generated
541 // and reconstructed hits.
542 // Author: Boris Polichtchouk (polishchuk@mx.ihep.su)
546 TH1F* hDrijCPVr = new TH1F("Drij_cpv_r","Distance between reconstructed hits in CPV",140,0,50);
547 TH1F* hDrijCPVg = new TH1F("Drij_cpv_g","Distance between generated hits in CPV",140,0,50);
548 TH1F* hDrijCPVratio = new TH1F("Drij_cpv_ratio","R_{ij}^{rec}/R_{ij}^{gen} in CPV",140,0,50);
550 // TH1F* hT0 = new TH1F("hT0","Type of entering particle",20000,-10000,10000);
554 hDrijCPVratio->Sumw2(); //correct treatment of errors
556 TList * fCpvImpacts = new TList();
557 TBranch * branchCPVimpacts;
559 AliPHOSLoader* please = dynamic_cast<AliPHOSLoader*>(fRunLoader->GetLoader("PHOSLoader"));
562 AliError(Form("Could not obtain the Loader object !"));
565 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
566 fRunLoader->LoadHeader();
568 for (Int_t nev=0; nev<Nevents; nev++)
570 printf("\n=================== Event %10d ===================\n",nev);
571 fRunLoader->GetEvent(nev);
572 Int_t ntracks = fRunLoader->GetHeader()->GetNtrack();
574 Int_t nRecCPV = 0; // Reconstructed points in event
575 Int_t nGenCPV = 0; // Impacts in event
577 // Get branch of CPV impacts
578 TTree* treeH = please->TreeH();
581 AliError(Form("Can not get TreeH"));
585 if (! (branchCPVimpacts =treeH->GetBranch("PHOSCpvImpacts")) ) return;
587 // Create and fill arrays of hits for each CPV module
588 Int_t nOfModules = phosgeom->GetNModules();
589 TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
591 for (iModule=0; iModule < nOfModules; iModule++)
592 hitsPerModule[iModule] = new TClonesArray("AliPHOSImpact",100);
594 TClonesArray *impacts;
595 AliPHOSImpact *impact;
597 for (Int_t itrack=0; itrack<ntracks; itrack++) {
598 branchCPVimpacts ->SetAddress(&fCpvImpacts);
599 AliInfo(Form(" branchCPVimpacts ->SetAddress(&fCpvImpacts) OK."));
600 branchCPVimpacts ->GetEntry(itrack,0);
602 for (iModule=0; iModule < nOfModules; iModule++) {
603 impacts = (TClonesArray *)fCpvImpacts->At(iModule);
604 // Do loop over impacts in the module
605 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
606 impact=(AliPHOSImpact*)impacts->At(iImpact);
607 TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
608 if(IsCharged(impact->GetPid()))
609 new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSImpact(*impact);
612 fCpvImpacts->Clear();
615 for (iModule=0; iModule < nOfModules; iModule++) {
616 Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
617 printf("CPV module %d has %d hits\n",iModule,nsum);
619 AliPHOSImpact* genHit1;
620 AliPHOSImpact* genHit2;
622 for(irp1=0; irp1< nsum; irp1++)
624 genHit1 = (AliPHOSImpact*)((hitsPerModule[iModule])->At(irp1));
625 for(irp2 = irp1+1; irp2<nsum; irp2++)
627 genHit2 = (AliPHOSImpact*)((hitsPerModule[iModule])->At(irp2));
628 Float_t dx = genHit1->X() - genHit2->X();
629 Float_t dz = genHit1->Z() - genHit2->Z();
630 Float_t dr = TMath::Sqrt(dx*dx + dz*dz);
632 // AliInfo(Form("(dx dz dr): %f %f", dx, dz));
638 //--------- Combinatoric distance between rec. hits in CPV
640 TObjArray* cpvRecPoints = please->CpvRecPoints();
641 nRecCPV = cpvRecPoints->GetEntriesFast();
645 AliPHOSCpvRecPoint* recHit1;
646 AliPHOSCpvRecPoint* recHit2;
647 TIter nextCPVrec1(cpvRecPoints);
648 while(TObject* obj1 = nextCPVrec1() )
650 TIter nextCPVrec2(cpvRecPoints);
651 while (TObject* obj2 = nextCPVrec2())
653 if(!obj2->IsEqual(obj1))
655 recHit1 = (AliPHOSCpvRecPoint*)obj1;
656 recHit2 = (AliPHOSCpvRecPoint*)obj2;
659 recHit1->GetLocalPosition(locpos1);
660 recHit2->GetLocalPosition(locpos2);
661 Float_t dx = locpos1.X() - locpos2.X();
662 Float_t dz = locpos1.Z() - locpos2.Z();
663 Float_t dr = TMath::Sqrt(dx*dx + dz*dz);
664 if(recHit1->GetPHOSMod() == recHit2->GetPHOSMod())
671 AliInfo(Form(" Event %d . Total of %d hits, %d rec.points.",
672 nev, nGenCPV, nRecCPV)) ;
674 delete [] hitsPerModule;
676 } // End of loop over events.
679 // hDrijCPVg->Draw();
680 // hDrijCPVr->Draw();
681 hDrijCPVratio->Divide(hDrijCPVr,hDrijCPVg);
682 hDrijCPVratio->Draw();
689 void AliPHOSIhepAnalyze::CpvSingle(Int_t nevents)
691 // Distributions of coordinates and cluster lengths of rec. points
692 // in the case of single initial particle.
694 TH1F* hZr = new TH1F("Zrec","Reconstructed Z distribution",150,-5,5);
695 TH1F* hXr = new TH1F("Xrec","Reconstructed X distribution",150,-14,-2);
696 TH1F *hChi2 = new TH1F("hChi2" ,"Chi2/dof of one-gamma fit",100, 0. , 20.);
698 TH1S *hNrp = new TH1S("hNrp" ,"CPV rec.point multiplicity",21,-0.5,20.5);
699 TH1S *hNrpX = new TH1S("hNrpX","CPV rec.point Phi-length" ,21,-0.5,20.5);
700 TH1S *hNrpZ = new TH1S("hNrpZ","CPV rec.point Z-length" ,21,-0.5,20.5);
702 AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(fRunLoader->GetLoader("PHOSLoader"));
705 AliError(Form("Could not obtain the Loader object !"));
709 for(Int_t ievent=0; ievent<nevents; ievent++)
711 fRunLoader->GetEvent(ievent);
712 if(gime->CpvRecPoints()->GetEntriesFast()>1) continue;
714 AliPHOSCpvRecPoint* pt = (AliPHOSCpvRecPoint*)(gime->CpvRecPoints())->At(0);
717 pt->GetLocalPosition(lpos);
721 Int_t rpMult = pt->GetMultiplicity();
723 Int_t rpMultX, rpMultZ;
724 pt->GetClusterLengths(rpMultX,rpMultZ);
725 hNrpX->Fill(rpMultX);
726 hNrpZ->Fill(rpMultZ);
727 hChi2->Fill(((AliPHOSEvalRecPoint*)pt)->Chi2Dof());
728 AliInfo(Form("+++++ Event %d . (Mult,MultX,MultZ) = %d %d %d +++++",
729 ievent, rpMult, rpMultX, rpMultZ)) ;
735 Text_t outputname[80] ;
736 snprintf(outputname,80,"%s.analyzed.single",GetFileName().Data());
737 TFile output(outputname,"RECREATE");
741 TCanvas *cpvCanvas = new TCanvas("SingleParticle","Single particle events",20,20,800,400);
742 gStyle->SetOptStat(111111);
743 gStyle->SetOptFit(1);
744 gStyle->SetOptDate(1);
745 cpvCanvas->Divide(3,2);
748 gPad->SetFillColor(10);
749 hXr->SetFillColor(16);
753 gPad->SetFillColor(10);
754 hZr->SetFillColor(16);
758 gPad->SetFillColor(10);
759 hChi2->SetFillColor(16);
763 gPad->SetFillColor(10);
764 hNrp->SetFillColor(16);
768 gPad->SetFillColor(10);
769 hNrpX->SetFillColor(16);
773 gPad->SetFillColor(10);
774 hNrpZ->SetFillColor(16);
777 cpvCanvas->Write(0,kOverwrite);
781 void AliPHOSIhepAnalyze::HitsCPV(Int_t nev)
783 // Cumulative list of charged CPV impacts in event nev.
785 AliPHOSLoader* please = dynamic_cast<AliPHOSLoader*>(fRunLoader->GetLoader("PHOSLoader"));
788 AliError(Form("Could not obtain the Loader object !"));
793 printf("\n=================== Event %10d ===================\n",nev);
794 //16.03.2011: DP. Code below seems to be obsollete
795 //Comment it to sutisfy Coverity
797 TList * fCpvImpacts ;
798 TBranch * branchCPVimpacts;
800 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
802 fRunLoader->GetEvent(nev);
803 Int_t ntracks = fRunLoader->GetHeader()->GetNtrack();
805 // Int_t nRecCPV = 0; // Reconstructed points in event // 01.10.2001
806 // Int_t nGenCPV = 0; // Impacts in event
808 // Get branch of CPV impacts
809 TTree* treeH = please->TreeH();
812 AliError(Form("Can not get TreeH"));
816 if (! (branchCPVimpacts =treeH->GetBranch("PHOSCpvImpacts")) ) return;
818 // Create and fill arrays of hits for each CPV module
819 Int_t nOfModules = phosgeom->GetNModules();
820 TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
822 for (iModule=0; iModule < nOfModules; iModule++)
823 hitsPerModule[iModule] = new TClonesArray("AliPHOSImpact",100);
825 TClonesArray *impacts;
826 AliPHOSImpact *impact;
828 for (Int_t itrack=0; itrack<ntracks; itrack++) {
829 branchCPVimpacts ->SetAddress(&fCpvImpacts);
830 AliInfo(Form(" branchCPVimpacts ->SetAddress(&fCpvImpacts) OK."));
831 branchCPVimpacts ->GetEntry(itrack,0);
833 for (iModule=0; iModule < nOfModules; iModule++) {
834 impacts = (TClonesArray *)fCpvImpacts->At(iModule);
835 // Do loop over impacts in the module
836 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
837 impact=(AliPHOSImpact*)impacts->At(iImpact);
838 TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
839 new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSImpact(*impact);
842 fCpvImpacts->Clear();
845 for (iModule=0; iModule < nOfModules; iModule++) {
846 Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
847 printf("CPV module %d has %d hits\n",iModule,nsum);
853 // TList * fCpvImpacts ;
854 // TBranch * branchCPVimpacts;
855 // AliPHOSImpact* impact;
856 // TClonesArray* impacts;
858 // AliPHOSLoader * please = AliPHOSLoader::GetInstance(GetFileName().Data(),"PHOS");
859 // const AliPHOSGeometry * fGeom = please->PHOSGeometry();
861 // Int_t ntracks = gAlice->GetEvent(ievent);
862 // Int_t nOfModules = fGeom->GetNModules();
863 // AliInfo(Form(" Tracks: "<<ntracks<<" Modules: "<<nOfModules));
865 // if (! (branchCPVimpacts =gAlice->TreeH()->GetBranch("PHOSCpvImpacts")) ) return;
867 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
868 // branchCPVimpacts ->SetAddress(&fCpvImpacts);
869 // Info("AnalyzeCPV1", " branchCPVimpacts ->SetAddress(&fCpvImpacts) OK.");
870 // branchCPVimpacts ->GetEntry(itrack,0);
871 // Info(Form(" branchCPVimpacts ->GetEntry(itrack,0) OK."));
873 // for (Int_t iModule=0; iModule < nOfModules; iModule++) {
874 // impacts = (TClonesArray *)fCpvImpacts->At(iModule);
875 // Info(Form(" fCpvImpacts->At(iModule) OK."));
876 // // Do loop over impacts in the module
877 // for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
878 // impact=(AliPHOSImpact*)impacts->At(iImpact);
880 // if(IsCharged(impact->GetPid()))
882 // Info(Form(" Add charged hit.."));
883 // new(hits[hits.GetEntriesFast()]) AliPHOSImpact(*impact);
884 // Info(Form("done."));
888 // fCpvImpacts->Clear();
891 // Info(Form(" PHOS event "<<ievent<<": "<<hits.GetEntries()<<" charged CPV hits."));
896 // void AliPHOSIhepAnalyze::ChargedHitsCPV(TClonesArray* hits, Int_t ievent, Int_t iModule)
898 // // Cumulative list of charged CPV hits in event ievent
899 // // in PHOS module iModule.
901 // HitsCPV(hits,ievent,iModule);
904 // while(AliPHOSCPVHit* cpvhit = (AliPHOSCPVHit*)next())
906 // if(!IsCharged(cpvhit->GetIpart()))
908 // hits->Remove(cpvhit);
914 // Info(Form(" PHOS module "<<iModule<<": "<<hits->GetEntries()<<" charged CPV hits."));
917 Bool_t AliPHOSIhepAnalyze::IsCharged(Int_t pdgCode)
920 AliInfo(Form("pdgCode %d", pdgCode));
921 if(pdgCode==211 || pdgCode==-211 || pdgCode==321 || pdgCode==-321 || pdgCode==11 || pdgCode==-11 || pdgCode==2212 || pdgCode==-2212) return kTRUE;
925 //---------------------------------------------------------------------------