]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/RICHdetect.C
Remove Process_t
[u/mrichter/AliRoot.git] / RICH / RICHdetect.C
1 RICHdetect (Int_t evNumber1=0,Int_t evNumber2=0) {
2 // Dynamically link some shared libs
3  
4     if (gClassTable->GetID("AliRun") < 0) {
5         gROOT->LoadMacro("loadlibs.C");
6         loadlibs();
7     }
8     else {
9       delete gAlice;
10       gAlice = 0;
11     }
12     
13     galice=0;
14
15 // Connect the Root Galice file containing Geometry, Kine and Hits
16     
17     TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
18     if (file) file->Close(); 
19     file = new TFile("galice.root","UPDATE");
20     file->ls();
21     
22     //printf ("I'm after Map \n");
23     
24 // Get AliRun object from file or create it if not on file
25     
26     if (!gAlice) {
27         gAlice = (AliRun*)file->Get("gAlice");
28         if (gAlice) printf("AliRun object found on file\n");
29         if (!gAlice) gAlice = new AliRun("gAlice","RICH reconstruction program");
30     } else {
31       delete gAlice;
32       gAlice = (AliRun*)file->Get("gAlice");
33         if (gAlice) printf("AliRun object found on file\n");
34         if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
35     }
36     
37     //printf ("I'm after gAlice \n");
38     
39     AliRICH *RICH  = (AliRICH*) gAlice->GetDetector("RICH"); 
40     
41     // Create Recontruction algorithm object
42     AliRICHDetect *detect = new AliRICHDetect("RICH reconstruction algorithm","Reconstruction");
43     
44 // Reconstruct
45     // Event Loop
46     //
47     for (int nev=0; nev<= evNumber2; nev++) {
48       Int_t nparticles = gAlice->GetEvent(nev);
49       printf("\nProcessing event: %d\n",nev);
50       printf("\nParticles       : %d\n",nparticles);
51       if (nev < evNumber1) continue;
52       if (nparticles <= 0) return;
53       if (RICH) detect->Detect();
54       char hname[30];
55       sprintf(hname,"TreeR%d",nev);
56       gAlice->TreeR()->Write(hname);
57       gAlice->TreeR()->Reset();
58    } // event loop  
59    
60     //delete gAlice;
61     printf("\nEnd of Macro  *************************************\n");
62 }
63
64
65