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,-100,100);
24 TH1F *hRealVertex = new TH1F("hRealVertex","Z position of vertex",
27 digits = new AliT0digit();
28 vertex = new AliT0vertex();
29 // Event ------------------------- LOOP
30 for (Int_t j=0; j<evNumber; j++){
32 sprintf(nameTR,"T0_R_%d",j);
33 printf("%s\n",nameTR);
34 TObject *tr = (TObject*)gDirectory->Get(nameTR);
35 cout<<" tr "<<tr<<endl;
38 hVertex->Fill(vertex->GetVertex());
39 printf(" Z position %f\n",vertex->GetVertex());
41 AliHeader *header = gAlice->GetHeader();
42 AliGenEventHeader* genHeader = header->GenEventHeader();
43 TArrayF *o = new TArrayF(3);
44 genHeader->PrimaryVertex(*o);
46 Float_t zRealVertex=o->At(2);
47 cout<<" zRealVertex "<<zRealVertex<<endl;
48 hRealVertex->Fill(zRealVertex);
51 Hfile = new TFile("figs.root","RECREATE","Histograms for T0 Vertex");
52 printf("Writting histograms to root file \n");
55 //Create a canvas, set the view range, show histograms
57 gStyle->SetOptStat(111111);
58 hVertex->SetXTitle("vertex position, mm");
59 hVertex->SetYTitle("number of events");
61 hRealVertex->SetXTitle("vertex position, mm");
62 hRealVertex->SetYTitle("number of events");