]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCFindTracks.C
3c67d7e35916f40edbc449d3ec2709cd80feb4e3
[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 N=-1) {
15
16    cerr<<"Looking for tracks...\n";
17
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     }
63
64    rl->UnloadgAlice()   
65    
66    tpcl->LoadRecPoints("read");
67    tpcl->LoadTracks("recreate");
68
69    Int_t eventn;
70    if (N<=0) 
71     {
72      eventn = rl->GetNumberOfEvents();
73      rl->UnloadHeader();
74     }
75    else
76     eventn = N;
77     
78    TStopwatch timer;
79    Int_t rc=0;
80    for (Int_t i=0;i<eventn;i++){
81      printf("Processing event %d\n",i);
82      AliTPCtracker *tracker = new AliTPCtracker(dig,i);
83      rc=tracker->Clusters2Tracks();
84      delete tracker;
85    }
86    timer.Stop(); timer.Print();
87  
88    delete dig; //Thanks to Mariana Bondila
89    delete rl;
90    return rc;
91 }