]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/oldmacros/AliITSVertexerTracksTest2.C
Adding more information to the debug output
[u/mrichter/AliRoot.git] / ITS / oldmacros / AliITSVertexerTracksTest2.C
CommitLineData
b3d9d240 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#include <AliHeader.h>
19#include <AliGenEventHeader.h>
20//-------------------------------------
21#endif
22void 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 /*******************************************************************
27 * *
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 *
31 * or another file. *
32 * If the file galice.root is available, B is taken from there, *
33 * otherwise is can be set here "by hand". *
34 * *
35 * Origin: A.Dainese, Padova andrea.dainese@pd.infn.it *
36 *******************************************************************/
37
38 // Look for field value in galice.root
39 Double_t field = 0.4;
40 Int_t kDebug = 0;
41 TFile *galice = 0;
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);
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,0.,0.);
60 vertexer->SetDebug(0);
61 vertexer->SetUseThrustFrame(0);
62 vertexer->PrintStatus();
63
64 AliITSVertex *vert = 0;
65 // Find vertices
66
67 for(Int_t i=evFirst; i<=evLast; i++){
68 if(i%100==0)cout<<"processing event "<<i<<endl;
69 gAlice->GetEvent(i);
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);
76 if(kDebug>0){
77 // Prints the results
78 cout <<"========================================================\n";
79 cout << "Event number: "<<i<<") Z Vertex:"<<endl;
80 if(vert){
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;
84 }
85 else {
86 cout<<"NOT FOUND "<<endl;
87 }
88 }
89 if(vert){
90 Double_t pos[3];
91 for(Int_t kk=0;kk<3;kk++)pos[kk]=(Double_t)primaryVertex[kk];
92 vert->SetTruePos(pos);
93 vertexer->WriteCurrentVertex();
94 }
95 }
96
97 delete vertexer;
98
99
100
101 inFile->Close();
102 outFile->Close();
103 delete inFile;
104 delete outFile;
105 galice->Close();
106 delete galice;
107 return;
108}