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 ---
42 // --- AliRoot header files ---
44 #include "AliPHOSIhepAnalyze.h"
45 #include "AliPHOSDigit.h"
46 #include "AliPHOSRecParticle.h"
47 #include "AliPHOSGetter.h"
48 #include "AliPHOSHit.h"
49 #include "AliPHOSImpact.h"
50 #include "AliPHOSvImpacts.h"
51 #include "AliPHOSCpvRecPoint.h"
53 #include "AliPHOSGeometry.h"
54 #include "AliPHOSEvalRecPoint.h"
56 ClassImp(AliPHOSIhepAnalyze)
58 //____________________________________________________________________________
60 AliPHOSIhepAnalyze::AliPHOSIhepAnalyze() {}
62 //____________________________________________________________________________
64 AliPHOSIhepAnalyze::AliPHOSIhepAnalyze(Text_t * name) : fFileName(name) {}
66 //____________________________________________________________________________
67 void AliPHOSIhepAnalyze::AnalyzeCPV1(Int_t Nevents)
70 // Analyzes CPV characteristics: resolutions, cluster multiplicity,
71 // cluster lengths along Z and Phi.
72 // Author: Yuri Kharlov
74 // Modified by Boris Polichtchouk, 3.07.2001
79 TH1F *hDx = new TH1F("hDx" ,"CPV x-resolution@reconstruction",100,-5. , 5.);
80 TH1F *hDz = new TH1F("hDz" ,"CPV z-resolution@reconstruction",100,-5. , 5.);
81 TH1F *hChi2 = new TH1F("hChi2" ,"Chi2/dof of one-gamma fit",30, 0. , 10.);
82 TH1S *hNrp = new TH1S("hNrp" ,"CPV rec.point multiplicity", 21,-0.5,20.5);
83 TH1S *hNrpX = new TH1S("hNrpX","CPV rec.point Phi-length" , 21,-0.5,20.5);
84 TH1S *hNrpZ = new TH1S("hNrpZ","CPV rec.point Z-length" , 21,-0.5,20.5);
86 TH1F *hEg = new TH1F("hEg" ,"Energies of impacts",30,0.,6.);
87 TH1F *hEr = new TH1F("hEr" ,"Amplitudes of rec. points",50,0.,20.);
90 TBranch * branchCPVimpacts;
92 AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS");
93 const AliPHOSGeometry * fGeom = please->PHOSGeometry();
95 cout << "Start CPV Analysis-1. Resolutions, cluster multiplicity and lengths"<<endl;
96 for ( Int_t ievent=0; ievent<Nevents; ievent++) {
99 Int_t nChargedGen = 0;
101 Int_t ntracks = gAlice->GetEvent(ievent);
102 cout<<" >>>>>>>Event "<<ievent<<".<<<<<<<"<<endl;
104 // Get branch of CPV impacts
105 if (! (branchCPVimpacts =gAlice->TreeH()->GetBranch("PHOSCpvImpacts")) ) {
106 cout<<" Couldn't find branch PHOSCpvImpacts. Exit."<<endl;
110 // Create and fill arrays of hits for each CPV module
112 Int_t nOfModules = fGeom->GetNModules();
113 TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
115 for (iModule=0; iModule < nOfModules; iModule++)
116 hitsPerModule[iModule] = new TClonesArray("AliPHOSImpact",100);
118 TClonesArray *impacts;
119 AliPHOSImpact *impact;
122 // First go through all primary tracks and fill the arrays
123 // of hits per each CPV module
125 for (Int_t itrack=0; itrack<ntracks; itrack++) {
126 branchCPVimpacts ->SetAddress(&fCpvImpacts);
127 branchCPVimpacts ->GetEntry(itrack,0);
129 for (Int_t iModule=0; iModule < nOfModules; iModule++) {
130 impacts = (TClonesArray *)fCpvImpacts->At(iModule);
131 // Do loop over impacts in the module
132 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
133 impact=(AliPHOSImpact*)impacts->At(iImpact);
134 hEg->Fill(impact->GetMomentum().E());
135 TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
136 if(IsCharged(impact->GetPid())) nChargedGen++;
137 new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSImpact(*impact);
140 fCpvImpacts->Clear();
142 for (iModule=0; iModule < nOfModules; iModule++) {
143 Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
144 printf("CPV module %d has %d impacts\n",iModule,nsum);
148 // Then go through reconstructed points and for each find
150 // The distance from the rec.point to the closest hit
151 // gives the coordinate resolution of the CPV
153 please->Event(ievent);
154 TIter nextRP(please->CpvRecPoints()) ;
155 AliPHOSCpvRecPoint *cpvRecPoint ;
156 Float_t xgen, ygen, zgen;
157 while( ( cpvRecPoint = (AliPHOSCpvRecPoint *)nextRP() ) ) {
159 Float_t chi2dof = ((AliPHOSEvalRecPoint*)cpvRecPoint)->Chi2Dof();
160 hChi2->Fill(chi2dof);
161 hEr->Fill(cpvRecPoint->GetEnergy());
164 cpvRecPoint->GetLocalPosition(locpos);
165 Int_t phosModule = cpvRecPoint->GetPHOSMod();
166 Int_t rpMult = cpvRecPoint->GetMultiplicity();
167 Int_t rpMultX, rpMultZ;
168 cpvRecPoint->GetClusterLengths(rpMultX,rpMultZ);
169 Float_t xrec = locpos.X();
170 Float_t zrec = locpos.Z();
171 Float_t dxmin = 1.e+10;
172 Float_t dzmin = 1.e+10;
173 Float_t r2min = 1.e+10;
176 Int_t nCPVhits = (hitsPerModule[phosModule-1])->GetEntriesFast();
177 Float_t locImpX=1e10,locImpZ=1e10; // local coords of closest impact
178 Float_t gImpX=1e10, gImpZ=1e10,gImpY=1e10; // global coords of closest impact
179 for (Int_t ihit=0; ihit<nCPVhits; ihit++) {
180 impact = (AliPHOSImpact*)(hitsPerModule[phosModule-1])->UncheckedAt(ihit);
185 //Transform to the local ref.frame
186 const AliPHOSGeometry* geom = please->PHOSGeometry();
187 Float_t phig = geom->GetPHOSAngle(phosModule);
188 Float_t phi = TMath::Pi()/180*phig;
189 Float_t distanceIPtoCPV = geom->GetIPtoOuterCoverDistance() -
190 (geom->GetFTPosition(1)+
191 geom->GetFTPosition(2)+
192 geom->GetCPVTextoliteThickness()
194 Float_t xoL,yoL,zoL ;
195 // xoL = xgen*TMath::Cos(phig)+ygen*TMath::Sin(phig) ;
196 // yoL = -xgen*TMath::Sin(phig)+ygen*TMath::Cos(phig) + distanceIPtoCPV;
197 xoL = xgen*TMath::Cos(phi)-ygen*TMath::Sin(phi) ;
198 yoL = xgen*TMath::Sin(phi)+ygen*TMath::Cos(phi) + distanceIPtoCPV;
201 r2 = TMath::Power((xoL-xrec),2) + TMath::Power((zoL-zrec),2);
213 cout<<" Impact global (X,Z,Y) = "<<gImpX<<" "<<gImpZ<<" "<<gImpY<<endl;
214 cout<<" Impact local (X,Z) = "<<locImpX<<" "<<locImpZ<<endl;
215 cout<<" Reconstructed (X,Z) = "<<xrec<<" "<<zrec<<endl;
216 cout<<" dxmin "<<dxmin<<" dzmin "<<dzmin<<endl<<endl;
219 // hDr ->Fill(TMath::Sqrt(r2min));
221 hNrpX->Fill(rpMultX);
222 hNrpZ->Fill(rpMultZ);
224 delete [] hitsPerModule;
226 cout<<"++++ Event "<<ievent<<": total "<<nTotalGen<<" impacts, "
227 <<nChargedGen<<" charged impacts and "<<please->CpvRecPoints()->GetEntries()
228 <<" rec. points."<<endl<<endl;
232 Text_t outputname[80] ;
233 sprintf(outputname,"%s.analyzed",GetFileName().Data());
234 TFile output(outputname,"RECREATE");
239 TCanvas *cpvCanvas = new TCanvas("Cpv1","CPV analysis-I",20,20,800,600);
240 gStyle->SetOptStat(111111);
241 gStyle->SetOptFit(1);
242 gStyle->SetOptDate(1);
243 cpvCanvas->Divide(3,3);
246 gPad->SetFillColor(10);
247 hNrp->SetFillColor(16);
251 gPad->SetFillColor(10);
252 hNrpX->SetFillColor(16);
256 gPad->SetFillColor(10);
257 hNrpZ->SetFillColor(16);
261 gPad->SetFillColor(10);
262 hDx->SetFillColor(16);
267 gPad->SetFillColor(10);
268 hDz->SetFillColor(16);
273 gPad->SetFillColor(10);
274 hChi2->SetFillColor(16);
278 gPad->SetFillColor(10);
279 hEg->SetFillColor(16);
283 gPad->SetFillColor(10);
284 hEr->SetFillColor(16);
287 cpvCanvas->Write(0,kOverwrite);
292 void AliPHOSIhepAnalyze::AnalyzeEMC1(Int_t Nevents)
295 // Analyzes Emc characteristics: resolutions, cluster multiplicity,
296 // cluster lengths along Z and Phi.
297 // Author: Boris Polichtchouk, 24.08.2001
302 TH1F *hDx = new TH1F("hDx" ,"EMC x-resolution@reconstruction",100,-5. , 5.);
303 TH1F *hDz = new TH1F("hDz" ,"EMC z-resolution@reconstruction",100,-5. , 5.);
304 TH1F *hChi2 = new TH1F("hChi2" ,"Chi2/dof of one-gamma fit",30, 0. , 3.);
305 TH1S *hNrp = new TH1S("hNrp" ,"EMC rec.point multiplicity", 21,-0.5,20.5);
306 TH1S *hNrpX = new TH1S("hNrpX","EMC rec.point Phi-length" , 21,-0.5,20.5);
307 TH1S *hNrpZ = new TH1S("hNrpZ","EMC rec.point Z-length" , 21,-0.5,20.5);
309 TList * fEmcImpacts ;
310 TBranch * branchEMCimpacts;
312 AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS");
313 const AliPHOSGeometry * fGeom = please->PHOSGeometry();
315 cout << "Start EMC Analysis-1. Resolutions, cluster multiplicity and lengths"<<endl;
316 for ( Int_t ievent=0; ievent<Nevents; ievent++) {
320 Int_t ntracks = gAlice->GetEvent(ievent);
321 cout<<" >>>>>>>Event "<<ievent<<".<<<<<<<"<<endl;
323 // Get branch of EMC impacts
324 if (! (branchEMCimpacts =gAlice->TreeH()->GetBranch("PHOSEmcImpacts")) ) {
325 cout<<" Couldn't find branch PHOSEmcImpacts. Exit."<<endl;
329 // Create and fill arrays of hits for each EMC module
331 Int_t nOfModules = fGeom->GetNModules();
332 TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
334 for (iModule=0; iModule < nOfModules; iModule++)
335 hitsPerModule[iModule] = new TClonesArray("AliPHOSImpact",100);
337 TClonesArray *impacts;
338 AliPHOSImpact *impact;
341 // First go through all primary tracks and fill the arrays
342 // of hits per each EMC module
344 for (Int_t itrack=0; itrack<ntracks; itrack++) {
345 branchEMCimpacts ->SetAddress(&fEmcImpacts);
346 branchEMCimpacts ->GetEntry(itrack,0);
348 for (Int_t iModule=0; iModule < nOfModules; iModule++) {
349 impacts = (TClonesArray *)fEmcImpacts->At(iModule);
350 // Do loop over impacts in the module
351 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
352 impact=(AliPHOSImpact*)impacts->At(iImpact);
353 TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
354 new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSImpact(*impact);
357 fEmcImpacts->Clear();
359 for (iModule=0; iModule < nOfModules; iModule++) {
360 Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
361 printf("EMC module %d has %d hits\n",iModule,nsum);
365 // Then go through reconstructed points and for each find
367 // The distance from the rec.point to the closest hit
368 // gives the coordinate resolution of the EMC
370 please->Event(ievent);
371 TIter nextRP(please->EmcRecPoints()) ;
372 AliPHOSEmcRecPoint *emcRecPoint ;
373 Float_t xgen, ygen, zgen;
374 while( ( emcRecPoint = (AliPHOSEmcRecPoint *)nextRP() ) ) {
376 Float_t chi2dof = ((AliPHOSEvalRecPoint*)emcRecPoint)->Chi2Dof();
377 hChi2->Fill(chi2dof);
380 emcRecPoint->GetLocalPosition(locpos);
381 Int_t phosModule = emcRecPoint->GetPHOSMod();
382 Int_t rpMult = emcRecPoint->GetMultiplicity();
383 Int_t rpMultX, rpMultZ;
384 ((AliPHOSEvalRecPoint*)emcRecPoint)->GetClusterLengths(rpMultX,rpMultZ);
385 Float_t xrec = locpos.X();
386 Float_t zrec = locpos.Z();
387 Float_t dxmin = 1.e+10;
388 Float_t dzmin = 1.e+10;
389 Float_t r2min = 1.e+10;
392 Int_t nEMChits = (hitsPerModule[phosModule-1])->GetEntriesFast();
393 Float_t locImpX=1e10,locImpZ=1e10; // local coords of closest impact
394 Float_t gImpX=1e10, gImpZ=1e10,gImpY=1e10; // global coords of closest impact
395 for (Int_t ihit=0; ihit<nEMChits; ihit++) {
396 impact = (AliPHOSImpact*)(hitsPerModule[phosModule-1])->UncheckedAt(ihit);
402 //Transform to the local ref.frame
403 const AliPHOSGeometry* geom = please->PHOSGeometry();
404 Float_t phig = geom->GetPHOSAngle(phosModule);
405 Float_t phi = TMath::Pi()/180*phig;
406 Float_t distanceIPtoEMC = geom->GetIPtoCrystalSurface();
407 Float_t xoL,yoL,zoL ;
408 // xoL = xgen*TMath::Cos(phig)+ygen*TMath::Sin(phig) ;
409 // yoL = -xgen*TMath::Sin(phig)+ygen*TMath::Cos(phig) + distanceIPtoEMC;
410 xoL = xgen*TMath::Cos(phi)-ygen*TMath::Sin(phi) ;
411 yoL = xgen*TMath::Sin(phi)+ygen*TMath::Cos(phi) + distanceIPtoEMC;
414 r2 = TMath::Power((xoL-xrec),2) + TMath::Power((zoL-zrec),2);
426 cout<<" Impact global (X,Z,Y) = "<<gImpX<<" "<<gImpZ<<" "<<gImpY<<endl;
427 cout<<" Impact local (X,Z) = "<<locImpX<<" "<<locImpZ<<endl;
428 cout<<" Reconstructed (X,Z) = "<<xrec<<" "<<zrec<<endl;
429 cout<<" dxmin "<<dxmin<<" dzmin "<<dzmin<<endl<<endl;
432 // hDr ->Fill(TMath::Sqrt(r2min));
434 hNrpX->Fill(rpMultX);
435 hNrpZ->Fill(rpMultZ);
437 delete [] hitsPerModule;
439 cout<<"++++ Event "<<ievent<<": total "<<nTotalGen<<" impacts, "
440 <<please->EmcRecPoints()->GetEntriesFast()<<" Emc rec. points."<<endl<<endl;
445 Text_t outputname[80] ;
446 sprintf(outputname,"%s.analyzed",GetFileName().Data());
447 TFile output(outputname,"update");
452 TCanvas *emcCanvas = new TCanvas("Emc1","EMC analysis-I",20,20,800,400);
453 gStyle->SetOptStat(111111);
454 gStyle->SetOptFit(1);
455 gStyle->SetOptDate(1);
456 emcCanvas->Divide(3,2);
459 gPad->SetFillColor(10);
460 hNrp->SetFillColor(16);
464 gPad->SetFillColor(10);
465 hNrpX->SetFillColor(16);
469 gPad->SetFillColor(10);
470 hNrpZ->SetFillColor(16);
474 gPad->SetFillColor(10);
475 hDx->SetFillColor(16);
480 gPad->SetFillColor(10);
481 hDz->SetFillColor(16);
486 gPad->SetFillColor(10);
487 hChi2->SetFillColor(16);
490 emcCanvas->Write(0,kOverwrite);
493 //____________________________________________________________________________
494 void AliPHOSIhepAnalyze::AnalyzeCPV2(Int_t Nevents)
496 // CPV analysis - part II.
497 // Ratio of combinatoric distances between generated
498 // and reconstructed hits.
499 // Author: Boris Polichtchouk (polishchuk@mx.ihep.su)
503 TH1F* hDrij_cpv_r = new TH1F("Drij_cpv_r","Distance between reconstructed hits in CPV",140,0,50);
504 TH1F* hDrij_cpv_g = new TH1F("Drij_cpv_g","Distance between generated hits in CPV",140,0,50);
505 TH1F* hDrij_cpv_ratio = new TH1F("Drij_cpv_ratio","R_{ij}^{rec}/R_{ij}^{gen} in CPV",140,0,50);
507 // TH1F* hT0 = new TH1F("hT0","Type of entering particle",20000,-10000,10000);
509 hDrij_cpv_r->Sumw2();
510 hDrij_cpv_g->Sumw2();
511 hDrij_cpv_ratio->Sumw2(); //correct treatment of errors
513 TList * fCpvImpacts = new TList();
514 TBranch * branchCPVimpacts;
516 AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS");
517 const AliPHOSGeometry * fGeom = please->PHOSGeometry();
519 for (Int_t nev=0; nev<Nevents; nev++)
521 printf("\n=================== Event %10d ===================\n",nev);
522 Int_t ntracks = gAlice->GetEvent(nev);
525 Int_t nrec_cpv = 0; // Reconstructed points in event
526 Int_t ngen_cpv = 0; // Impacts in event
528 // Get branch of CPV impacts
529 if (! (branchCPVimpacts =gAlice->TreeH()->GetBranch("PHOSCpvImpacts")) ) return;
531 // Create and fill arrays of hits for each CPV module
532 Int_t nOfModules = fGeom->GetNModules();
533 TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
535 for (iModule=0; iModule < nOfModules; iModule++)
536 hitsPerModule[iModule] = new TClonesArray("AliPHOSImpact",100);
538 TClonesArray *impacts;
539 AliPHOSImpact *impact;
541 for (Int_t itrack=0; itrack<ntracks; itrack++) {
542 branchCPVimpacts ->SetAddress(&fCpvImpacts);
543 cout<<" branchCPVimpacts ->SetAddress(&fCpvImpacts) OK."<<endl;
544 branchCPVimpacts ->GetEntry(itrack,0);
546 for (Int_t iModule=0; iModule < nOfModules; iModule++) {
547 impacts = (TClonesArray *)fCpvImpacts->At(iModule);
548 // Do loop over impacts in the module
549 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
550 impact=(AliPHOSImpact*)impacts->At(iImpact);
551 TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
552 if(IsCharged(impact->GetPid()))
553 new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSImpact(*impact);
556 fCpvImpacts->Clear();
559 for (iModule=0; iModule < nOfModules; iModule++) {
560 Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
561 printf("CPV module %d has %d hits\n",iModule,nsum);
563 AliPHOSImpact* GenHit1;
564 AliPHOSImpact* GenHit2;
566 for(irp1=0; irp1< nsum; irp1++)
568 GenHit1 = (AliPHOSImpact*)((hitsPerModule[iModule])->At(irp1));
569 for(irp2 = irp1+1; irp2<nsum; irp2++)
571 GenHit2 = (AliPHOSImpact*)((hitsPerModule[iModule])->At(irp2));
572 Float_t dx = GenHit1->X() - GenHit2->X();
573 Float_t dz = GenHit1->Z() - GenHit2->Z();
574 Float_t dr = TMath::Sqrt(dx*dx + dz*dz);
575 hDrij_cpv_g->Fill(dr);
576 // cout<<"(dx dz dr): "<<dx<<" "<<dz<<" "<<endl;
582 //--------- Combinatoric distance between rec. hits in CPV
584 TObjArray* cpvRecPoints = please->CpvRecPoints();
585 nrec_cpv = cpvRecPoints->GetEntriesFast();
589 AliPHOSCpvRecPoint* RecHit1;
590 AliPHOSCpvRecPoint* RecHit2;
591 TIter next_cpv_rec1(cpvRecPoints);
592 while(TObject* obj1 = next_cpv_rec1() )
594 TIter next_cpv_rec2(cpvRecPoints);
595 while (TObject* obj2 = next_cpv_rec2())
597 if(!obj2->IsEqual(obj1))
599 RecHit1 = (AliPHOSCpvRecPoint*)obj1;
600 RecHit2 = (AliPHOSCpvRecPoint*)obj2;
603 RecHit1->GetLocalPosition(locpos1);
604 RecHit2->GetLocalPosition(locpos2);
605 Float_t dx = locpos1.X() - locpos2.X();
606 Float_t dz = locpos1.Z() - locpos2.Z();
607 Float_t dr = TMath::Sqrt(dx*dx + dz*dz);
608 if(RecHit1->GetPHOSMod() == RecHit2->GetPHOSMod())
609 hDrij_cpv_r->Fill(dr);
615 cout<<" Event "<<nev<<". Total of "<<ngen_cpv<<" hits, "<<nrec_cpv<<" rec.points."<<endl;
617 delete [] hitsPerModule;
619 } // End of loop over events.
622 // hDrij_cpv_g->Draw();
623 // hDrij_cpv_r->Draw();
624 hDrij_cpv_ratio->Divide(hDrij_cpv_r,hDrij_cpv_g);
625 hDrij_cpv_ratio->Draw();
632 void AliPHOSIhepAnalyze::CpvSingle(Int_t nevents)
634 // Distributions of coordinates and cluster lengths of rec. points
635 // in the case of single initial particle.
637 TH1F* hZr = new TH1F("Zrec","Reconstructed Z distribution",150,-5,5);
638 TH1F* hXr = new TH1F("Xrec","Reconstructed X distribution",150,-14,-2);
639 TH1F *hChi2 = new TH1F("hChi2" ,"Chi2/dof of one-gamma fit",100, 0. , 20.);
641 TH1S *hNrp = new TH1S("hNrp" ,"CPV rec.point multiplicity",21,-0.5,20.5);
642 TH1S *hNrpX = new TH1S("hNrpX","CPV rec.point Phi-length" ,21,-0.5,20.5);
643 TH1S *hNrpZ = new TH1S("hNrpZ","CPV rec.point Z-length" ,21,-0.5,20.5);
645 AliPHOSGetter* gime = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS");
647 for(Int_t ievent=0; ievent<nevents; ievent++)
650 if(gime->CpvRecPoints()->GetEntriesFast()>1) continue;
652 AliPHOSCpvRecPoint* pt = (AliPHOSCpvRecPoint*)(gime->CpvRecPoints())->At(0);
655 pt->GetLocalPosition(lpos);
659 Int_t rpMult = pt->GetMultiplicity();
661 Int_t rpMultX, rpMultZ;
662 pt->GetClusterLengths(rpMultX,rpMultZ);
663 hNrpX->Fill(rpMultX);
664 hNrpZ->Fill(rpMultZ);
665 hChi2->Fill(((AliPHOSEvalRecPoint*)pt)->Chi2Dof());
666 cout<<"+++++ Event "<<ievent<<". (Mult,MultX,MultZ) = "<<rpMult<<" "<<rpMultX<<" "<<rpMultZ<<"+++++"<<endl;
672 Text_t outputname[80] ;
673 sprintf(outputname,"%s.analyzed.single",GetFileName().Data());
674 TFile output(outputname,"RECREATE");
678 TCanvas *cpvCanvas = new TCanvas("SingleParticle","Single particle events",20,20,800,400);
679 gStyle->SetOptStat(111111);
680 gStyle->SetOptFit(1);
681 gStyle->SetOptDate(1);
682 cpvCanvas->Divide(3,2);
685 gPad->SetFillColor(10);
686 hXr->SetFillColor(16);
690 gPad->SetFillColor(10);
691 hZr->SetFillColor(16);
695 gPad->SetFillColor(10);
696 hChi2->SetFillColor(16);
700 gPad->SetFillColor(10);
701 hNrp->SetFillColor(16);
705 gPad->SetFillColor(10);
706 hNrpX->SetFillColor(16);
710 gPad->SetFillColor(10);
711 hNrpZ->SetFillColor(16);
714 cpvCanvas->Write(0,kOverwrite);
718 void AliPHOSIhepAnalyze::HitsCPV(TClonesArray& hits, Int_t nev)
720 // Cumulative list of charged CPV impacts in event nev.
722 TList * fCpvImpacts ;
723 TBranch * branchCPVimpacts;
725 AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS");
726 const AliPHOSGeometry * fGeom = please->PHOSGeometry();
729 printf("\n=================== Event %10d ===================\n",nev);
730 Int_t ntracks = gAlice->GetEvent(nev);
733 // Int_t nrec_cpv = 0; // Reconstructed points in event // 01.10.2001
734 // Int_t ngen_cpv = 0; // Impacts in event
736 // Get branch of CPV impacts
737 if (! (branchCPVimpacts =gAlice->TreeH()->GetBranch("PHOSCpvImpacts")) ) return;
739 // Create and fill arrays of hits for each CPV module
740 Int_t nOfModules = fGeom->GetNModules();
741 TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
743 for (iModule=0; iModule < nOfModules; iModule++)
744 hitsPerModule[iModule] = new TClonesArray("AliPHOSImpact",100);
746 TClonesArray *impacts;
747 AliPHOSImpact *impact;
749 for (Int_t itrack=0; itrack<ntracks; itrack++) {
750 branchCPVimpacts ->SetAddress(&fCpvImpacts);
751 cout<<" branchCPVimpacts ->SetAddress(&fCpvImpacts) OK."<<endl;
752 branchCPVimpacts ->GetEntry(itrack,0);
754 for (Int_t iModule=0; iModule < nOfModules; iModule++) {
755 impacts = (TClonesArray *)fCpvImpacts->At(iModule);
756 // Do loop over impacts in the module
757 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
758 impact=(AliPHOSImpact*)impacts->At(iImpact);
759 TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
760 new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSImpact(*impact);
763 fCpvImpacts->Clear();
766 for (iModule=0; iModule < nOfModules; iModule++) {
767 Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
768 printf("CPV module %d has %d hits\n",iModule,nsum);
771 // TList * fCpvImpacts ;
772 // TBranch * branchCPVimpacts;
773 // AliPHOSImpact* impact;
774 // TClonesArray* impacts;
776 // AliPHOSGetter * please = AliPHOSGetter::GetInstance(GetFileName().Data(),"PHOS");
777 // const AliPHOSGeometry * fGeom = please->PHOSGeometry();
779 // Int_t ntracks = gAlice->GetEvent(ievent);
780 // Int_t nOfModules = fGeom->GetNModules();
781 // cout<<" Tracks: "<<ntracks<<" Modules: "<<nOfModules<<endl;
783 // if (! (branchCPVimpacts =gAlice->TreeH()->GetBranch("PHOSCpvImpacts")) ) return;
785 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
786 // branchCPVimpacts ->SetAddress(&fCpvImpacts);
787 // cout<<" branchCPVimpacts ->SetAddress(&fCpvImpacts) OK."<<endl;
788 // branchCPVimpacts ->GetEntry(itrack,0);
789 // cout<<" branchCPVimpacts ->GetEntry(itrack,0) OK."<<endl;
791 // for (Int_t iModule=0; iModule < nOfModules; iModule++) {
792 // impacts = (TClonesArray *)fCpvImpacts->At(iModule);
793 // cout<<" fCpvImpacts->At(iModule) OK."<<endl;
794 // // Do loop over impacts in the module
795 // for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
796 // impact=(AliPHOSImpact*)impacts->At(iImpact);
798 // if(IsCharged(impact->GetPid()))
800 // cout<<" Add charged hit..";
801 // new(hits[hits.GetEntriesFast()]) AliPHOSImpact(*impact);
802 // cout<<"done."<<endl;
806 // fCpvImpacts->Clear();
809 // cout<<" PHOS event "<<ievent<<": "<<hits.GetEntries()<<" charged CPV hits."<<endl;
814 // void AliPHOSIhepAnalyze::ChargedHitsCPV(TClonesArray* hits, Int_t ievent, Int_t iModule)
816 // // Cumulative list of charged CPV hits in event ievent
817 // // in PHOS module iModule.
819 // HitsCPV(hits,ievent,iModule);
822 // while(AliPHOSCPVHit* cpvhit = (AliPHOSCPVHit*)next())
824 // if(!IsCharged(cpvhit->GetIpart()))
826 // hits->Remove(cpvhit);
832 // cout<<" PHOS module "<<iModule<<": "<<hits->GetEntries()<<" charged CPV hits."<<endl;
835 Bool_t AliPHOSIhepAnalyze::IsCharged(Int_t pdg_code)
838 cout<<" pdg_code "<<pdg_code<<endl;
839 if(pdg_code==211 || pdg_code==-211 || pdg_code==321 || pdg_code==-321 || pdg_code==11 || pdg_code==-11 || pdg_code==2212 || pdg_code==-2212) return kTRUE;
843 //---------------------------------------------------------------------------