1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 //-- --- standard headers-------------
4 //--------Root headers ---------------
7 #include <TStopwatch.h>
10 //----- AliRoot headers ---------------
14 #include "AliKalmanTrack.h"
15 #include "AliITSVertex.h"
16 #include "AliITSVertexer.h"
17 #include "AliITSVertexerTracks.h"
18 #include <AliHeader.h>
19 #include <AliGenEventHeader.h>
20 //-------------------------------------
22 void AliITSVertexerTracksTest2(Int_t evFirst=0,Int_t evLast=0,
23 const Char_t *galiceName="galice.root",
24 const Char_t *trksName="AliITStracksV2.root",
25 const Char_t *vtxName="AliITSVertices.root") {
26 /*******************************************************************
28 * Test macro for vertexing in pp using tracks. *
29 * Input file must contain trees with AliITStrackV2 objects. *
30 * Output file can be the same file with the tracks *
32 * If the file galice.root is available, B is taken from there, *
33 * otherwise is can be set here "by hand". *
35 * Origin: A.Dainese, Padova andrea.dainese@pd.infn.it *
36 *******************************************************************/
38 // Look for field value in galice.root
42 if(!gSystem->AccessPathName(galiceName,kFileExists)) {
43 galice = new TFile(galiceName);
44 gAlice = (AliRun*)galice->Get("gAlice");
45 AliMagF *fiel = (AliMagF*)gAlice->Field();
46 field=(Double_t)fiel->SolenoidField()/10.;
47 AliKalmanTrack::SetConvConst(100/0.299792458/field);
48 printf(" B = %3.1f read from gAlice and set\n",field);
50 printf(" File galice.root not found: default 0.4 T being used!\n");
53 // Open input and output files
54 TFile *inFile = TFile::Open(trksName);
55 TFile *outFile = TFile::Open(vtxName,"recreate");
58 AliITSVertexerTracks *vertexer =
59 new AliITSVertexerTracks(inFile,outFile,field,0.,0.);
60 vertexer->SetDebug(0);
61 vertexer->SetUseThrustFrame(0);
62 vertexer->PrintStatus();
64 AliITSVertex *vert = 0;
67 for(Int_t i=evFirst; i<=evLast; i++){
68 if(i%100==0)cout<<"processing event "<<i<<endl;
70 // The true Z coord. is fetched for comparison
71 AliHeader *header = gAlice->GetHeader();
72 AliGenEventHeader* genEventHeader = header->GenEventHeader();
73 TArrayF primaryVertex(3);
74 genEventHeader->PrimaryVertex(primaryVertex);
75 vert = vertexer->FindVertexForCurrentEvent(i);
78 cout <<"========================================================\n";
79 cout << "Event number: "<<i<<") Z Vertex:"<<endl;
81 cout<<"FOUND: "<<vert->GetZv()<<"; "<<vert->GetZRes()<<endl;
82 cout <<" True Z position "<<primaryVertex[2]<<endl;
83 cout<<", diff= "<<(primaryVertex[2]-vert->GetZv())*10000.<<endl;
86 cout<<"NOT FOUND "<<endl;
91 for(Int_t kk=0;kk<3;kk++)pos[kk]=(Double_t)primaryVertex[kk];
92 vert->SetTruePos(pos);
93 vertexer->WriteCurrentVertex();