Field conversion factor added.
[u/mrichter/AliRoot.git] / TPC / AliTPCFindTracks.C
1 /****************************************************************************
2  *           Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch                 *
3  ****************************************************************************/
4
5 #ifndef __CINT__
6   #include <iostream.h>
7   #include "AliTPCParam.h"
8   #include "AliTPCtracker.h"
9
10   #include "TFile.h"
11   #include "TStopwatch.h"
12 #endif
13
14 Int_t AliTPCFindTracks(Int_t eventn=1) {
15
16 AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField()); 
17    cerr<<"Looking for tracks...\n";
18
19    TFile *out=TFile::Open("AliTPCtracks.root","new");
20    if (!out->IsOpen()) {cerr<<"Delete old AliTPCtracks.root !\n"; return 1;}
21
22    TFile *in=TFile::Open("AliTPCclusters.root");
23    if (!in->IsOpen()) {cerr<<"Can't open AliTPCclusters.root !\n"; return 2;}
24
25    AliTPCParam *par=(AliTPCParam*)in->Get("75x40_100x60_150x60");
26    if (!par) {cerr<<"Can't get TPC parameters !\n"; return 3;}
27  
28    TStopwatch timer;
29
30    Int_t rc=0;
31    for (Int_t i=0;i<eventn;i++){
32      printf("Processing event %d\n",i);
33      AliTPCtracker *tracker = new AliTPCtracker(par,i);
34      //Double_t xyz[]={0.,0.,0.}; tracker->SetVertex(xyz); //primary vertex
35      rc=tracker->Clusters2Tracks(0,out);
36      delete tracker;
37    }
38    timer.Stop(); timer.Print();
39  
40    delete par; //Thanks to Mariana Bondila
41
42    in->Close();
43    out->Close();
44
45    return rc;
46 }