]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCFindTracksMI.C
Removing warnings (icc), adding more detailed description
[u/mrichter/AliRoot.git] / TPC / AliTPCFindTracksMI.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 AliTPCFindTracksMI(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->UnloadgAlice();
45    
46    rl->CdGAFile();
47    
48    AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60");
49    if (!dig) 
50     {
51      dig=(AliTPCParam *)gDirectory->Get("75x40_100x60");
52      if (!param) 
53       {
54         cerr<<"TPC parameters have not been found !\n";
55         return 1;
56       }
57      else
58       {
59         cout<<"TPC 75x40_100x60 geometry found"<<endl;
60       }
61     }
62    else
63     {
64       cout<<"TPC 75x40_100x60_150x60  geometry found"<<endl;
65     }
66
67    
68    tpcl->LoadTracks("recreate");
69
70    Int_t eventn;
71    if (N<=0) 
72     {
73      eventn = rl->GetNumberOfEvents();
74      rl->UnloadHeader();
75     }
76    else
77     eventn = N;
78     
79    TStopwatch timer;
80    Int_t rc=0;
81    for (Int_t i=0;i<eventn;i++)
82     {
83       TTree * input = tpcl->TreeR();
84       if (input == 0x0)
85        {
86          tpcl->LoadRecPoints("read");
87          input = tpcl->TreeR();
88          if (input == 0x0)
89           {
90             cerr << "Problems with input tree (TreeR) for event " << i <<endl;
91             continue;
92           }
93        }
94       TTree * output = tpcl->TreeT();
95       if (output == 0x0)
96        {
97          tpcl->MakeTree("T");
98          output = tpcl->TreeT();
99          if (output == 0x0)
100           {
101             cerr << "Problems with output tree (TreeT) for event " << i <<endl;
102             continue;
103           }
104        }
105
106       printf("Processing event %d\n",i);
107       AliTPCtrackerMI *tracker = new AliTPCtrackerMI(dig);
108       rc=tracker->Clusters2Tracks();
109       delete tracker;
110     }
111    timer.Stop(); timer.Print();
112  
113    delete dig; //Thanks to Mariana Bondila
114    delete rl;
115    return rc;
116 }