1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 //-- --- standard headers-------------
4 //--------Root headers ---------------
7 #include <TStopwatch.h>
10 #include <TStopwatch.h>
12 //----- AliRoot headers ---------------
15 #include "AliRunLoader.h"
17 #include "AliKalmanTrack.h"
18 #include "AliESDVertex.h"
19 #include "AliITSVertexer.h"
20 #include "AliITSVertexerTracks.h"
21 //-------------------------------------
23 void AliITSVertexerTracksTest(Int_t evFirst=0,Int_t evLast=0,Bool_t esd=kTRUE,
24 const Char_t *galiceName="galice.root",
25 const Char_t *inName="AliESDs.root",
26 const Char_t *outName="AliESDs.root") {
27 /*******************************************************************
29 * Test macro for vertexing in pp using tracks. *
31 * Input file must contain ESD events with tracks reco in ITS *
32 * if output file = input file, vertices will be stored in the *
33 * ESD events and these rewritten to the same file; otherwise *
34 * they will be written to a new file *
36 * input file must contain a tree with AliITStracksV2 and *
37 * can be written to the same file (output file = input file) *
40 * If file galice.root is present field will be read from it *
41 * otherwise it can be set here "by hand". *
43 * Origin: A.Dainese, Padova andrea.dainese@pd.infn.it *
44 *******************************************************************/
49 // Look for field value in galice.root
51 if(!gSystem->AccessPathName(galiceName,kFileExists)) {
52 AliRunLoader *rl = AliRunLoader::Open(galiceName);
54 AliMagF *fiel = (AliMagF*)gAlice->Field();
55 field=(Double_t)fiel->SolenoidField()/10.;
56 AliKalmanTrack::SetConvConst(100/0.299792458/field);
57 printf(" B = %3.1f read from gAlice and set\n",field);
59 printf(" File galice.root not found: default 0.4 T being used!\n");
62 // Open input and output files
63 TFile *inFile = TFile::Open(inName);
64 TFile *outFile = TFile::Open(outName,"update");
67 AliITSVertexerTracks *vertexer =
68 new AliITSVertexerTracks(inFile,outFile,field,evFirst,evLast);
71 vertexer->FindVerticesESD();
73 vertexer->FindVertices();
76 timer.Stop(); timer.Print();
87 //----------------------------------------------------------------------------
88 void VertexRecoInESDChain() {
93 // Look for field value in galice.root
95 if(!gSystem->AccessPathName("galice.root",kFileExists)) {
96 AliRunLoader *rl = AliRunLoader::Open("galice.root");
98 AliMagF *fiel = (AliMagF*)gAlice->Field();
99 field=(Double_t)fiel->SolenoidField()/10.;
100 AliKalmanTrack::SetConvConst(100/0.299792458/field);
101 printf(" B = %3.1f read from gAlice and set\n",field);
103 printf(" File galice.root not found: default 0.4 T being used!\n");
106 // open file with ESD events (this would not be necessary in the chain...)
107 if(gSystem->AccessPathName("AliESDs.root",kFileExists))
108 { printf(" ESD file not found!\n"); return; }
109 TFile *esdFile = new TFile("AliESDs.root","update");
111 AliITSVertexerTracks *vertexer = new AliITSVertexerTracks();
112 vertexer->SetField(field);
116 TIter next(esdFile->GetListOfKeys());
118 //******* The loop over events
119 while ((key=(TKey*)next())!=0) {
120 printf("--- Processing event number : %d",n++);
122 AliESD *event=(AliESD*)key->ReadObj();
124 // find vertex and store it in the ESD (only pos and cov matrix)
125 vertexer->FindVertexForCurrentEvent(event);
127 // write event on file
132 timer.Stop(); timer.Print();