Transition to NewIO
[u/mrichter/AliRoot.git] / ITS / AliITSFindTracksV2.C
CommitLineData
03248e6d 1#ifndef __CINT__
c0dd5278 2 #include "Riostream.h"
03248e6d 3 #include "TFile.h"
4 #include "TStopwatch.h"
c0dd5278 5
6 #include "AliITSgeom.h"
7 #include "AliITStrackerV2.h"
03248e6d 8#endif
9
61ab8ea8 10Int_t AliITSFindTracksV2(Int_t nev=1) { //number of events to process
03248e6d 11 cerr<<"Looking for tracks...\n";
88cb7938 12
13 if (gAlice)
14 {
15 delete gAlice->GetRunLoader();
16 delete gAlice;
17 gAlice=0;
18 }
19
20 AliRunLoader* rl = AliRunLoader::Open("galice.root");
21 if (rl == 0x0)
22 {
23 cerr<<"AliITSHits2DigitsDefault.C : Can not open session RL=NULL"
24 << endl;
25 return 3;
26 }
27
28 Int_t retval = rl->LoadgAlice();
29 if (retval)
30 {
31 ::Error("AliITSHits2DigitsDefault.C","LoadgAlice returned error");
32 delete rl;
33 return 3;
34 }
35 retval = rl->LoadHeader();
36 if (retval)
37 {
38 ::Error("AliITSHits2DigitsDefault.C","LoadHeader returned error");
39 delete rl;
40 return 3;
41 }
42 gAlice=rl->GetAliRun();
43
44
45 AliITSLoader* itsloader = (AliITSLoader*)rl->GetLoader("ITSLoader");
46 if (itsloader == 0x0)
47 {
48 ::Error("AliITSHits2DigitsDefault.C","can not get ITS loader");
49 return 4;
50 }
03248e6d 51
88cb7938 52 AliLoader* tpcloader = rl->GetLoader("TPCLoader");
53 if (tpcloader == 0x0)
54 {
55 cerr<<"AliITSHits2DigitsDefault.C : can not get TPC loader"
56 << endl;
57 }
03248e6d 58
88cb7938 59 rl->GetEvent(0);
03248e6d 60
88cb7938 61 itsloader->LoadTracks("recreate");
62 tpcloader->LoadTracks("read");
63 itsloader->LoadRawClusters("read");
03248e6d 64
88cb7938 65 AliITS* dITS = (AliITS*)gAlice->GetDetector("ITS");
66 if(!dITS)
67 {
68 ::Error("AliITSHits2DigitsDefault.C","Can not find ITS detector.");
69 return 6;
70 } // end if !fITS
03248e6d 71
88cb7938 72 AliITSgeom *geom = dITS->GetITSgeom();
73 if(geom == 0x0)
74 {
75 ::Error("AliITSHits2DigitsDefault.C","Can not get geometry from ITS detector.");
76 return 6;
77 } // end if !GetITSgeom()
03248e6d 78
03248e6d 79
88cb7938 80 TStopwatch timer;
81
82 for (Int_t i = 0;i < rl->GetNumberOfEvents(); i++)
83 {
84 AliITStrackerV2* tracker = new AliITStrackerV2(geom,i);
85 Int_t rc=tracker->Clusters2Tracks();
86 if (rc)
87 {
88 ::Error("AliITSHits2DigitsDefault.C",
89 "AliITStrackerV2::Clusters2Tracks returned errror for event %d",i);
90 delete tracker;
91 break;
92 }
93 }
94 timer.Stop(); timer.Print();
95 delete tracker;
96 delete rl;
03248e6d 97 return rc;
98}