]> git.uio.no Git - u/mrichter/AliRoot.git/blame - START/readVertex.C
New class by Andrea Dainese. It deals with the parameters used by
[u/mrichter/AliRoot.git] / START / readVertex.C
CommitLineData
ef51244a 1void readVertex(Int_t evNumber=1)
2{
3
4 // Dynamically link some shared libs
5 if (gClassTable->GetID("AliRun") < 0) {
6 gROOT->LoadMacro("loadlibs.C");
7 loadlibs();
8 }
9
10 // Connect the Root Galice file containing Geometry, Kine and Hits
11
12 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
7115262b 13 if (!file) file = new TFile("production.root","UPDATE");
ef51244a 14
15 // Get AliRun object from file or create it if not on file
16 if (!gAlice) {
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");
20 }
21 char nameTD[8],nameTR[8];
22
23 TH1F *hVertex = new TH1F("hVertex","Z position of vertex",100,-350,350);
7115262b 24 TH1F *hRealVertex = new TH1F("hRealVertex","Z position of vertex",100,-350,350);
ef51244a 25
26 digits = new AliSTARTdigit();
27 vertex = new AliSTARTvertex();
ef51244a 28 // Event ------------------------- LOOP
7115262b 29 for (Int_t j=0; j<evNumber; j++){
ef51244a 30
7115262b 31 sprintf(nameTR,"START_R_%d",j);
ef51244a 32 printf("%s\n",nameTR);
7115262b 33 TObject *tr = (TObject*)gDirectory->Get(nameTR);
34 cout<<" tr "<<tr<<endl;
35 vertex->Read(nameTR);
36
37 hVertex->Fill(vertex->GetVertex());
38 printf(" Z position %f\n",vertex->GetVertex());
39 gAlice->GetEvent(j);
40 AliHeader *header = gAlice->GetHeader();
41 AliGenEventHeader* genHeader = header->GenEventHeader();
42 TArrayF *o = new TArrayF(3);
43 genHeader->PrimaryVertex(*o);
44 cout<<" o "<<o<<endl;
45 Float_t zRealVertex=o->At(2);
46 cout<<" zRealVertex "<<zRealVertex<<endl;
47 hRealVertex->Fill(zRealVertex);
48
ef51244a 49 }
7115262b 50 Hfile = new TFile("figs.root","UPDATE","Histograms for START Vertex");
ef51244a 51 printf("Writting histograms to root file \n");
52 Hfile->cd();
53
54 //Create a canvas, set the view range, show histograms
55
56 gStyle->SetOptStat(111111);
ef51244a 57 hVertex->SetXTitle("vertex position, mm");
58 hVertex->SetYTitle("number of events");
59 hVertex->Write();
7115262b 60 hRealVertex->SetXTitle("vertex position, mm");
61 hRealVertex->SetYTitle("number of events");
62 hRealVertex->Write();
ef51244a 63
64} // end of macro
65
66
67
68