]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSVertexerTracksTest.C
Test macros for primary vertex finding
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerTracksTest.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 //-- --- standard headers------------- 
3 #include <Riostream.h>
4 //--------Root headers ---------------
5 #include <TSystem.h>
6 #include <TFile.h>
7 #include <TStopwatch.h>
8 #include <TObject.h>
9 #include <TTree.h>
10 //----- AliRoot headers ---------------
11 #include "alles.h"
12 #include "AliRun.h"
13 #include "AliMagF.h"
14 #include "AliKalmanTrack.h"
15 #include "AliITSVertex.h"
16 #include "AliITSVertexer.h"
17 #include "AliITSVertexerTracks.h"
18 //-------------------------------------
19 #endif
20 void AliITSVertexerTracksTest(Int_t evFirst=0,Int_t evLast=0,
21                               const Char_t *galiceName="galice.root",
22                               const Char_t *trksName="AliITStracksV2.root",
23                               const Char_t *vtxName="AliITSVertices.root") {
24   /*******************************************************************
25    *                                                                 *
26    * Test macro for vertexing in pp using tracks.                    *
27    * Input file must contain trees with AliITStrackV2 objects.       *
28    * Output file can be the same file with the tracks                *
29    * or another file.                                                *
30    * If the file galice.root is available, B is taken from there,    *
31    * otherwise is can be set here "by hand".                         *
32    *                                                                 *
33    * Origin: A.Dainese, Padova  andrea.dainese@pd.infn.it            *
34    *******************************************************************/     
35
36   // Look for field value in galice.root
37   Double_t field = 0.4;
38   if(!gSystem->AccessPathName(galiceName,kFileExists)) {
39     TFile *galice = new TFile(galiceName);
40     gAlice = (AliRun*)galice->Get("gAlice");
41     AliMagF *fiel = (AliMagF*)gAlice->Field();
42     field=(Double_t)fiel->SolenoidField()/10.;
43     AliKalmanTrack::SetConvConst(100/0.299792458/field);
44     printf(" B = %3.1f read from gAlice and set\n",field);
45     delete gAlice;
46     gAlice = 0;
47     galice->Close();
48     delete galice;
49   } else {
50     printf(" File galice.root not found: default 0.4 T being used!\n");
51   }
52
53   // Open input and output files
54   TFile *inFile = TFile::Open(trksName);
55   TFile *outFile = TFile::Open(vtxName,"recreate");
56
57   // Create vertexer
58   AliITSVertexerTracks *vertexer = 
59     new AliITSVertexerTracks(inFile,outFile,field);
60   vertexer->SetFirstEvent(evFirst);
61   vertexer->SetLastEvent(evLast);
62   vertexer->SetDebug(0);
63   vertexer->SetUseThrustFrame(0);
64   vertexer->PrintStatus();
65   // Find vertices
66   vertexer->FindVertices();
67
68
69   delete vertexer;
70
71
72
73   inFile->Close();
74   outFile->Close();
75   delete inFile;
76   delete outFile;
77
78   return;
79 }