]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSVertexerTracksTest.C
SSD calibration
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerTracksTest.C
CommitLineData
314e387c 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#include <TStopwatch.h>
11#include <TKey.h>
12//----- AliRoot headers ---------------
13#include "alles.h"
14#include "AliRun.h"
15#include "AliRunLoader.h"
16#include "AliMagF.h"
2e7b4767 17#include "AliESDVertex.h"
314e387c 18#include "AliITSVertexer.h"
19#include "AliITSVertexerTracks.h"
c84a5e9e 20#include "AliTracker.h"
314e387c 21//-------------------------------------
22#endif
23void 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 /*******************************************************************
28 * *
29 * Test macro for vertexing in pp using tracks. *
30 * If(esd) { *
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 *
35 * } else { *
36 * input file must contain a tree with AliITStracksV2 and *
37 * can be written to the same file (output file = input file) *
38 * or to a new one *
39 * } *
40 * If file galice.root is present field will be read from it *
41 * otherwise it can be set here "by hand". *
42 * *
43 * Origin: A.Dainese, Padova andrea.dainese@pd.infn.it *
44 *******************************************************************/
45
46 TStopwatch timer;
47 timer.Start();
48
49 // Look for field value in galice.root
50 Double_t field = 0.4;
51 if(!gSystem->AccessPathName(galiceName,kFileExists)) {
52 AliRunLoader *rl = AliRunLoader::Open(galiceName);
53 rl->LoadgAlice();
54 AliMagF *fiel = (AliMagF*)gAlice->Field();
55 field=(Double_t)fiel->SolenoidField()/10.;
314e387c 56 printf(" B = %3.1f read from gAlice and set\n",field);
c84a5e9e 57
58 AliTracker::SetFieldMap(gAlice->Field(),1); // 1 means uniform magnetic field
314e387c 59 } else {
60 printf(" File galice.root not found: default 0.4 T being used!\n");
61 }
62
63 // Open input and output files
64 TFile *inFile = TFile::Open(inName);
65 TFile *outFile = TFile::Open(outName,"update");
66
67 // Create vertexer
68 AliITSVertexerTracks *vertexer =
7d0f8548 69 new AliITSVertexerTracks(inFile,outFile,evFirst,evLast);
314e387c 70 // Find vertices
71 if(esd) {
72 vertexer->FindVerticesESD();
73 } else {
74 vertexer->FindVertices();
75 }
76
77 timer.Stop(); timer.Print();
78
79 delete vertexer;
80
81 inFile->Close();
82 outFile->Close();
83 delete inFile;
84 delete outFile;
85
86 return;
87}
88//----------------------------------------------------------------------------
89void VertexRecoInESDChain() {
90
91 TStopwatch timer;
92 timer.Start();
93
94 // Look for field value in galice.root
95 Double_t field = 0.4;
96 if(!gSystem->AccessPathName("galice.root",kFileExists)) {
97 AliRunLoader *rl = AliRunLoader::Open("galice.root");
98 rl->LoadgAlice();
99 AliMagF *fiel = (AliMagF*)gAlice->Field();
100 field=(Double_t)fiel->SolenoidField()/10.;
314e387c 101 printf(" B = %3.1f read from gAlice and set\n",field);
c84a5e9e 102
103 AliTracker::SetFieldMap(gAlice->Field(),1); // 1 means uniform magnetic field
104
105
314e387c 106 } else {
107 printf(" File galice.root not found: default 0.4 T being used!\n");
108 }
109
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");
114
115 AliITSVertexerTracks *vertexer = new AliITSVertexerTracks();
116 vertexer->SetField(field);
117
118 Int_t n=0;
119 TKey *key=0;
120 TIter next(esdFile->GetListOfKeys());
121
122 //******* The loop over events
123 while ((key=(TKey*)next())!=0) {
124 printf("--- Processing event number : %d",n++);
125
126 AliESD *event=(AliESD*)key->ReadObj();
127
128 // find vertex and store it in the ESD (only pos and cov matrix)
129 vertexer->FindVertexForCurrentEvent(event);
130
131 // write event on file
132 event->Write();
133
134 }
135
136 timer.Stop(); timer.Print();
137
138 delete vertexer;
139 esdFile->Close();
140 delete esdFile;
141
142 return;
143}
144
145
146
147
148
149
150