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 "AliESDVertex.h"
18 #include "AliITSVertexer.h"
19 #include "AliITSVertexerTracks.h"
20 #include "AliTracker.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 printf(" B = %3.1f read from gAlice and set\n",field);
58 AliTracker::SetFieldMap(gAlice->Field(),1); // 1 means uniform magnetic field
60 printf(" File galice.root not found: default 0.4 T being used!\n");
63 // Open input and output files
64 TFile *inFile = TFile::Open(inName);
65 TFile *outFile = TFile::Open(outName,"update");
68 AliITSVertexerTracks *vertexer =
69 new AliITSVertexerTracks(inFile,outFile,field,evFirst,evLast);
72 vertexer->FindVerticesESD();
74 vertexer->FindVertices();
77 timer.Stop(); timer.Print();
88 //----------------------------------------------------------------------------
89 void VertexRecoInESDChain() {
94 // Look for field value in galice.root
96 if(!gSystem->AccessPathName("galice.root",kFileExists)) {
97 AliRunLoader *rl = AliRunLoader::Open("galice.root");
99 AliMagF *fiel = (AliMagF*)gAlice->Field();
100 field=(Double_t)fiel->SolenoidField()/10.;
101 printf(" B = %3.1f read from gAlice and set\n",field);
103 AliTracker::SetFieldMap(gAlice->Field(),1); // 1 means uniform magnetic field
107 printf(" File galice.root not found: default 0.4 T being used!\n");
110 // open file with ESD events (this would not be necessary in the chain...)
111 if(gSystem->AccessPathName("AliESDs.root",kFileExists))
112 { printf(" ESD file not found!\n"); return; }
113 TFile *esdFile = new TFile("AliESDs.root","update");
115 AliITSVertexerTracks *vertexer = new AliITSVertexerTracks();
116 vertexer->SetField(field);
120 TIter next(esdFile->GetListOfKeys());
122 //******* The loop over events
123 while ((key=(TKey*)next())!=0) {
124 printf("--- Processing event number : %d",n++);
126 AliESD *event=(AliESD*)key->ReadObj();
128 // find vertex and store it in the ESD (only pos and cov matrix)
129 vertexer->FindVertexForCurrentEvent(event);
131 // write event on file
136 timer.Stop(); timer.Print();