1 void vertexmacro (const char *filename="galice.root",Int_t evNumber=0) {
2 /////////////////////////////////////////////////////////////////////////
3 // This macro is a small example of a ROOT macro
4 // illustrating how to read the output of GALICE
5 // and fill some histograms.
7 // Root > .L vertexmacro.C //this loads the macro in memory
8 // Root > vertexmacro(); //by default process first event
9 // Root > vertexmacro("galice.root"); //process file galice.root
10 // Root > vertexmacro("galice.root",0); // process first event
11 // from galice.root file
12 /////////////////////////////////////////////////////////////////////////
15 // Dynamically link some shared libs
16 if (gClassTable->GetID("AliRun") < 0) {
17 gROOT->LoadMacro("loadlibs.C");
19 } // end if gClassTable...
22 // Connect the Root Galice file containing Geometry, Kine and Hits
23 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
24 if (!file){ file = new TFile(filename);printf("Opening new file\n");}
25 printf("Root input file is %s\n",filename);
27 // Get AliRun object from file or create it if not on file
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");
35 for(Int_t evnt=0;evnt<=evNumber;evnt++){
37 // define some variables for later use.
38 Int_t nparticles = gAlice->GetEvent(evnt);
39 if (nparticles <= 0) continue; // get next event
41 FindVertexs(evnt,1.0,16.82);