]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSFindPrimaryVertex.C
Removing obsolete macros
[u/mrichter/AliRoot.git] / ITS / AliITSFindPrimaryVertex.C
CommitLineData
af8e1c2d 1#include "iostream.h"
2#include "TMath.h"
3
4void AliITSFindPrimaryVertex(Int_t evNumber1=0,Int_t evNumber2=0, const char *filename="galice.root") {
5
6
c5f0f3c1 7 ///////////////// Dynamically link some shared libs /////////////////////
af8e1c2d 8
9 if (gClassTable->GetID("AliRun") < 0) {
10 gROOT->LoadMacro("loadlibs.C");
11 loadlibs();
12 } else {
13 delete gAlice;
14 gAlice=0;
15 }
16
17// Connect the Root Galice file containing Geometry, Kine and Hits
18 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
c5f0f3c1 19 if (!file) file = new TFile(filename);
af8e1c2d 20
21
c5f0f3c1 22// Get AliRun object from file
af8e1c2d 23 if (!gAlice) {
24 gAlice = (AliRun*)file->Get("gAlice");
c5f0f3c1 25 if (gAlice) {
26 printf("AliRun object found on file\n");
27 }
28 else {
29 printf("AliRun object not found - nothing done\n");
30 return;
31 }
af8e1c2d 32 }
33
c5f0f3c1 34 // Open output file for vertices and Create vertexer
35 TFile *filou = new TFile("vertices.root","recreate");
36 AliITSVertexerIons *vertexer = new AliITSVertexerIons(file,filou);
37 AliITSVertex *V;
af8e1c2d 38// Loop over events
39//
40 Int_t Nh=0;
41 Int_t Nh1=0;
42 for (int nev=0; nev<= evNumber2; nev++) {
43 gAlice->SetEvent(nev);
44 Int_t nparticles = gAlice->GetEvent(nev);
45 cout << "nev " << nev <<endl;
46 cout << "nparticles " << nparticles <<endl;
47 if (nev < evNumber1) continue;
48 if (nparticles <= 0) return;
49
50
51 TStopwatch timer;
52 timer.Start();
53
c5f0f3c1 54 V=vertexer->FindVertexForCurrentEvent(i);
af8e1c2d 55
56 timer.Stop();
57 timer.Print();
58
59 cout << endl << "Xv = " << V->GetXv() << " cm" << endl;
60 cout << "X resolution = " << V->GetXRes()*10000 << " microns" << endl;
61 cout << "Signal/Noise for X = " << V->GetXSNR() << endl;
62 cout << endl << "Yv = " << V->GetYv() << " cm" << endl;
63 cout << "Y resolution = " << V->GetYRes()*10000 << " microns" << endl;
64 cout << "Signal/Noise for Y = " << V->GetYSNR() << endl;
65 cout << endl << "Zv = " << V->GetZv() << " cm" << endl;
66 cout << "Z Resolution = " << V->GetZRes()*10000 << " microns" << endl;
67 cout << "Signal/Noise for Z = " << V->GetZSNR() <<endl;
68
c5f0f3c1 69 vertexer->WriteCurrentVertex();
af8e1c2d 70 }
71
72 file->Close();
c5f0f3c1 73 filou->Close();
af8e1c2d 74}
75