]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/RICHpatrec.C
call to Init() added to deafult ctor
[u/mrichter/AliRoot.git] / RICH / RICHpatrec.C
CommitLineData
de48ca26 1RICHpatrec (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// Connect the Root Galice file containing Geometry, Kine and Hits
13
14 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
15 if (file) file->Close();
16 file = new TFile("galice.root","UPDATE");
17 file->ls();
18
6f2779f1 19 //printf ("I'm after Map \n");
de48ca26 20
21// Get AliRun object from file or create it if not on file
22
23 if (!gAlice) {
24 gAlice = (AliRun*)file->Get("gAlice");
25 if (gAlice) printf("AliRun object found on file\n");
26 if (!gAlice) gAlice = new AliRun("gAlice","RICH reconstruction program");
27 }else {
28 delete gAlice;
29 gAlice = (AliRun*)file->Get("gAlice");
30 if (gAlice) printf("AliRun object found on file\n");
31 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
32 }
33
6f2779f1 34 //printf ("I'm after gAlice \n");
de48ca26 35
36 AliRICH *RICH = (AliRICH*) gAlice->GetDetector("RICH");
37
38 // Create Recontruction algorithm object
39 AliRICHPatRec *detect = new AliRICHPatRec("RICH patrec algorithm","Reconstruction");
40
41// Reconstruct
42 // Event Loop
43 //
44 for (int nev=0; nev<= evNumber2; nev++) {
45 Int_t nparticles = gAlice->GetEvent(nev);
dd70fc03 46 cout <<endl<< "Processing event:" <<nev<<endl;
47 cout << "Particles :" <<nparticles<<endl;
de48ca26 48 if (nev < evNumber1) continue;
49 if (nparticles <= 0) return;
50 if (RICH) detect->PatRec();
51 char hname[30];
52 sprintf(hname,"TreeR%d",nev);
53 gAlice->TreeR()->Write(hname);
54 gAlice->TreeR()->Reset();
55 } // event loop
56
57 printf("\nEnd of Macro*************************************\n");
58}
59
60
61