Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PHOS / ReadImpacts.C
CommitLineData
d0a21d66 1ReadImpacts(Int_t nEvents=1,char* file="galice.root")
2{
3
4 // Script reads PHOS impacts and prints them
5 // Impacts are exacts values of the track coming to EMC, CPV or PPSD
6 // and was stored to separate branches of TreeH by AliPHOSvImpacts
7 //
8 // Yuri Kharlov 4 June 2001
9
10 f = new TFile(file,"readonly");
11 (AliRun*)gAlice=(AliRun*)f->Get("gAlice");
12 AliPHOSvImpacts * fPHOS = (AliPHOSvImpacts *)gAlice->GetDetector("PHOS") ;
13 AliPHOSGeometry * fGeom = AliPHOSGeometry::GetInstance(fPHOS->GetGeometry()->
14 GetName(),
15 fPHOS->GetGeometry()->GetTitle() ) ;
16 Int_t nPHOSModules = fGeom->GetNModules();
17 Int_t nCPVModules = fGeom->GetNCPVModules();
18 Int_t nPPSDModules = fGeom->GetNPPSDModules();
19
20 TBranch * branchEMCimpacts;
21 TBranch * branchCPVimpacts;
22 TBranch * branchPPSDimpacts;
23 TList * fEmcImpacts ;
24 TList * fCpvImpacts ;
25 TList * fPpsdImpacts ;
26
27 // Loop over events
28 for (Int_t iEvent=0; iEvent<nEvents; iEvent++) {
29 printf("===========> Event %5d <====================\n",iEvent);
30 gAlice->GetEvent(iEvent) ;
31
32 // Get branches EMC, CPV and PPSD impacts
33 if (! (branchEMCimpacts =gAlice->TreeH()->GetBranch("PHOSEmcImpacts")) ) return 1;
34 if (! (branchCPVimpacts =gAlice->TreeH()->GetBranch("PHOSCpvImpacts")) ) return 1;
35 if (! (branchPPSDimpacts=gAlice->TreeH()->GetBranch("PHOSPpsdImpacts")) ) return 1;
36
37 // Loop over primary tracks
38 for (itrack=0; itrack < gAlice->GetNtrack(); itrack++){
39 // Set addresses of impacts
40 branchEMCimpacts ->SetAddress(&fEmcImpacts) ;
41 branchCPVimpacts ->SetAddress(&fCpvImpacts) ;
42 branchPPSDimpacts->SetAddress(&fPpsdImpacts) ;
43 branchEMCimpacts ->GetEntry(itrack,0);
44 branchCPVimpacts ->GetEntry(itrack,0);
45 branchPPSDimpacts->GetEntry(itrack,0);
46
47 TClonesArray *impacts;
48 AliPHOSImpact *impact;
49 Int_t iModule;
50
51 // Do loop over EMC modules
52 for (iModule=0; iModule<nPHOSModules; iModule++) {
53 impacts = (TClonesArray *)fEmcImpacts->At(iModule);
54 // Do loop over impacts in the module
55 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
56 impact=(AliPHOSImpact*)impacts->At(iImpact);
57 printf("EMC module %d: ",iModule);
58 impact->Print();
59 }
60 }
61
62 // Do loop over CPV modules
63 for (iModule=0; iModule<nCPVModules; iModule++) {
64 impacts = (TClonesArray *)fCpvImpacts->At(iModule);
65 // Do loop over impacts in the module
66 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
67 impact=(AliPHOSImpact*)impacts->At(iImpact);
68 printf("CPV module %d: ",iModule);
69 impact->Print();
70 }
71 }
72
73 // Do loop over PPSD modules
74 for (iModule=0; iModule<nPPSDModules; iModule++) {
75 impacts = (TClonesArray *)fPpsdImpacts->At(iModule);
76 // Do loop over impacts in the module
77 for (Int_t iImpact=0; iImpact<impacts->GetEntries(); iImpact++) {
78 impact=(AliPHOSImpact*)impacts->At(iImpact);
79 printf("PPSD Module %d: ",iModule);
80 impact->Print();
81 }
82 }
83
84 }
85 }
86}