Transition to NewIO
[u/mrichter/AliRoot.git] / TPC / AliTPCFindTracks.C
CommitLineData
88cb7938 1/****************************************************************************
2 * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch *
3 ****************************************************************************/
4
b9de75e1 5#ifndef __CINT__
88cb7938 6 #include <iostream.h>
7f6ddf58 7 #include "AliTPCParam.h"
b9de75e1 8 #include "AliTPCtracker.h"
9
10 #include "TFile.h"
11 #include "TStopwatch.h"
12#endif
13
88cb7938 14Int_t AliTPCFindTracks(Int_t N=-1) {
15
73042f01 16 cerr<<"Looking for tracks...\n";
17
88cb7938 18 if (gAlice)
19 {
20 delete gAlice->GetRunLoader();
21 delete gAlice;
22 gAlice = 0x0;
23 }
24
25 rl = AliRunLoader::Open("galice.root");
26 if (rl == 0x0)
27 {
28 cerr<<"Can not open session"<<endl;
29 return 1;
30 }
31 tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
32 if (tpcl == 0x0)
33 {
34 cerr<<"Can not get TPC Loader"<<endl;
35 return 1;
36 }
37
38 if (rl->LoadgAlice())
39 {
40 cerr<<"Error occured while l"<<endl;
41 return 1;
42 }
43 AliKalmanTrack::SetConvConst(1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField());
44 rl->CdGAFile();
45 AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60");
46 if (!dig)
47 {
48 dig=(AliTPCParam *)gDirectory->Get("75x40_100x60");
49 if (!param)
50 {
51 cerr<<"TPC parameters have not been found !\n";
52 return 1;
53 }
54 else
55 {
56 cout<<"TPC 75x40_100x60 geometry found"<<endl;
57 }
58 }
59 else
60 {
61 cout<<"TPC 75x40_100x60_150x60 geometry found"<<endl;
62 }
73042f01 63
88cb7938 64 rl->UnloadgAlice()
65
66 tpcl->LoadRecPoints("read");
67 tpcl->LoadTracks("recreate");
73042f01 68
88cb7938 69 Int_t eventn;
70 if (N<=0)
71 {
72 eventn = rl->GetNumberOfEvents();
73 rl->UnloadHeader();
74 }
75 else
76 eventn = N;
77
73042f01 78 TStopwatch timer;
7f6ddf58 79 Int_t rc=0;
afc42102 80 for (Int_t i=0;i<eventn;i++){
81 printf("Processing event %d\n",i);
88cb7938 82 AliTPCtracker *tracker = new AliTPCtracker(dig,i);
83 rc=tracker->Clusters2Tracks();
84 delete tracker;
afc42102 85 }
73042f01 86 timer.Stop(); timer.Print();
b9de75e1 87
88cb7938 88 delete dig; //Thanks to Mariana Bondila
89 delete rl;
7f6ddf58 90 return rc;
73042f01 91}