1 void readVertex(Int_t evNumber=1)
4 // Dynamically link some shared libs
5 if (gClassTable->GetID("AliRun") < 0) {
6 gROOT->LoadMacro("loadlibs.C");
10 // Connect the Root Galice file containing Geometry, Kine and Hits
12 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
13 if (!file) file = new TFile("galice.root","UPDATE");
15 // Get AliRun object from file or create it if not on file
17 gAlice = (AliRun*)file->Get("gAlice");
18 if (gAlice) printf("AliRun object found on file\n");
19 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
21 char nameTD[8],nameTR[8];
23 TH1F *hVertex = new TH1F("hVertex","Z position of vertex",100,-350,350);
25 digits = new AliSTARTdigit();
26 vertex = new AliSTARTvertex();
30 // Event ------------------------- LOOP
31 for (j=0; j<evNumber; j++){
32 sprintf(nameTD,"TreeD%d",j);
33 printf("%s\n",nameTD);
34 TTree *TD = (TTree*)gDirectory->Get(nameTD);
35 bd = TD->GetBranch("START");
36 bd->SetAddress(&digits);
38 printf(" Digits: %d \n ",digits->GetTime());
41 sprintf(nameTR,"TreeR%d",j);
42 printf("%s\n",nameTR);
43 TTree *TR = (TTree*)gDirectory->Get(nameTR);
44 bRec = TR->GetBranch("START");
45 bRec->SetAddress(&vertex);
47 if(digits->GetTime()!=999999){
48 hVertex->Fill(vertex->GetVertex());
49 // printf(" Z position %f\n",vertex->GetVertex());
52 Hfile = new TFile("figs1.root","RECREATE","Histograms for START Vertex");
53 printf("Writting histograms to root file \n");
56 //Create a canvas, set the view range, show histograms
58 gStyle->SetOptStat(111111);
59 TCanvas *c1 = new TCanvas("c1","Alice START Time (vertex)",400,10,600,600);
61 hVertex->SetXTitle("vertex position, mm");
62 hVertex->SetYTitle("number of events");