Updated macro by J. Belikov
[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    cerr<<"Looking for tracks...\n";
16
17    TFile *out=TFile::Open("AliTPCtracks.root","new");
18    if (!out->IsOpen()) {cerr<<"Delete old AliTPCtracks.root !\n"; return 1;}
19
20    TFile *in=TFile::Open("AliTPCclusters.root");
21    if (!in->IsOpen()) {cerr<<"Can't open AliTPCclusters.root !\n"; return 2;}
22
23    AliTPCParam *par=(AliTPCParam*)in->Get("75x40_100x60_150x60");
24    if (!par) {cerr<<"Can't get TPC parameters !\n"; return 3;}
25  
26    TStopwatch timer;
27
28    Int_t rc=0;
29    for (Int_t i=0;i<eventn;i++){
30      printf("Processing event %d\n",i);
31      AliTPCtracker *tracker = new AliTPCtracker(par,i);
32      //Double_t xyz[]={0.,0.,0.}; tracker->SetVertex(xyz); //primary vertex
33      rc=tracker->Clusters2Tracks(0,out);
34      delete tracker;
35    }
36    timer.Stop(); timer.Print();
37  
38    delete par; //Thanks to Mariana Bondila
39
40    in->Close();
41    out->Close();
42
43    return rc;
44 }