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("production.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);
24 TH1F *hRealVertex = new TH1F("hRealVertex","Z position of vertex",100,-350,350);
26 digits = new AliSTARTdigit();
27 vertex = new AliSTARTvertex();
28 // Event ------------------------- LOOP
29 for (Int_t j=0; j<evNumber; j++){
31 sprintf(nameTR,"START_R_%d",j);
32 printf("%s\n",nameTR);
33 TObject *tr = (TObject*)gDirectory->Get(nameTR);
34 cout<<" tr "<<tr<<endl;
37 hVertex->Fill(vertex->GetVertex());
38 printf(" Z position %f\n",vertex->GetVertex());
40 AliHeader *header = gAlice->GetHeader();
41 AliGenEventHeader* genHeader = header->GenEventHeader();
42 TArrayF *o = new TArrayF(3);
43 genHeader->PrimaryVertex(*o);
45 Float_t zRealVertex=o->At(2);
46 cout<<" zRealVertex "<<zRealVertex<<endl;
47 hRealVertex->Fill(zRealVertex);
50 Hfile = new TFile("figs.root","UPDATE","Histograms for START Vertex");
51 printf("Writting histograms to root file \n");
54 //Create a canvas, set the view range, show histograms
56 gStyle->SetOptStat(111111);
57 hVertex->SetXTitle("vertex position, mm");
58 hVertex->SetYTitle("number of events");
60 hRealVertex->SetXTitle("vertex position, mm");
61 hRealVertex->SetYTitle("number of events");