]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/PHOS.C
coverity fix
[u/mrichter/AliRoot.git] / PHOS / PHOS.C
1 PHOS (Int_t event_number=0,Float_t SignalStep=0.001,Int_t SignalMin=15)
2 {
3 // From Int_t Sread ()
4
5    // Dynamically link some shared libs
6    if (gClassTable->GetID("AliRun") < 0) {
7       gSystem->Load("libGeant3Dummy.so");   // a dummy version of Geant3
8       gSystem->Load("PHOS/libPHOSreconstruction.so");        // the standard Alice classes 
9       gSystem->Load("libgalice.so");        // the standard Alice classes 
10    }
11     
12    // Connect the Root Galice file containing Geometry, Kine and Hits
13    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
14    if (!file) file = new TFile("galice.root");
15
16    // Get AliRun object from file or create it if not on file
17    if (!gAlice) {
18       gAlice = (AliRun*)file->Get("gAlice");
19       if (gAlice) printf("AliRun object found on file\n");
20       if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
21    }
22 ////////////////////////////////
23
24   AliPHOS *PHOS= gAlice->GetDetector("PHOS");
25   if( NULL==PHOS )
26   {
27     cout << "Can't find PHOS detector!\n";
28     exit(1);
29   }
30
31   PHOS->SetTreeAddress();
32
33   if( 0==PHOS->fTreePHOS->GetEvent(event_number) )
34   {
35     printf("Cannot read event number %d\n",event_number);
36     return;
37   }
38
39   printf("This is event number %d from %d\n",
40          event_number,PHOS->fTreePHOS->GetEntries());
41
42   for( int i=0; i<PHOS->fCradles->GetEntries(); i++ )
43   {
44     AliPHOSCradle &cradle = PHOS->GetCradle(i);
45     printf("===============================================================\n");
46     printf("Cradle %d\n",i+1);
47     cradle.Print();
48     //cout.flush();
49     
50
51     cradle.Reconstruction(SignalStep,SignalMin);
52
53     printf("It were %d particles in that cradle\n",cradle.GetParticles().GetEntries());
54     for( int j=0; j<cradle.GetParticles().GetEntries(); j++ )
55     {
56       TObjArray &pp = cradle.GetParticles();
57       AliPHOSgamma *g = (AliPHOSgamma *) pp.At(j);
58       printf("%3d  ",j+1);
59       g->Print();
60     }
61
62     printf("\nReconstruction: %d gammas\n",cradle.GetGammasReconstructed().GetEntries());
63     for( int j=0; j<cradle.GetGammasReconstructed().GetEntries(); j++ )
64     {
65       TObjArray &pp = cradle.GetGammasReconstructed();
66       AliPHOSgamma *g = (AliPHOSgamma *) pp.At(j);
67       printf("%3d  ",j+1);
68       g->Print();
69     }
70
71     //cout.flush();
72     
73   }
74
75 ////////////////////////////////////////////////////////////////////////////////
76
77   printf("Done\n");
78 }