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