]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/vertexmacro.C
update info about cvs installation using cvs account
[u/mrichter/AliRoot.git] / ITS / vertexmacro.C
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.
6 //   
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 /////////////////////////////////////////////////////////////////////////
13
14
15 // Dynamically link some shared libs
16    if (gClassTable->GetID("AliRun") < 0) {
17       gROOT->LoadMacro("loadlibs.C");
18       loadlibs();
19    } // end if gClassTable...
20
21       
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);
26
27 // Get AliRun object from file or create it if not on file
28    if (!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 //
34
35    for(Int_t evnt=0;evnt<=evNumber;evnt++){
36
37       // define some variables for later use.
38       Int_t      nparticles = gAlice->GetEvent(evnt);
39       if (nparticles <= 0) continue; // get next event
40
41       FindVertexs(evnt,1.0,16.82);
42
43    } // end for evnt
44    return;
45 }