]>
Commit | Line | Data |
---|---|---|
c630aafd | 1 | /**************************************************************************** |
2 | * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * | |
3 | ****************************************************************************/ | |
4 | ||
5 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
c0dd5278 | 6 | #include "Riostream.h" |
c630aafd | 7 | |
03248e6d | 8 | #include "TStopwatch.h" |
c0dd5278 | 9 | |
c630aafd | 10 | #include "AliRun.h" |
11 | #include "AliRunLoader.h" | |
12 | #include "AliTPCLoader.h" | |
13 | #include "AliITSLoader.h" | |
14 | #include "AliITS.h" | |
c0dd5278 | 15 | #include "AliITSgeom.h" |
16 | #include "AliITStrackerV2.h" | |
03248e6d | 17 | #endif |
18 | ||
c630aafd | 19 | extern AliRun *gAlice; |
20 | ||
21 | Int_t AliITSFindTracksV2(Int_t nev=5) { //number of events to process | |
03248e6d | 22 | cerr<<"Looking for tracks...\n"; |
88cb7938 | 23 | |
c630aafd | 24 | if (gAlice) { |
88cb7938 | 25 | delete gAlice->GetRunLoader(); |
26 | delete gAlice; | |
27 | gAlice=0; | |
c630aafd | 28 | } |
88cb7938 | 29 | |
c630aafd | 30 | AliRunLoader* rl = AliRunLoader::Open("galice.root"); |
31 | if (rl == 0x0) { | |
32 | cerr<<"AliITSFindTracks.C : Can not open session RL=NULL"<< endl; | |
33 | return 3; | |
34 | } | |
88cb7938 | 35 | |
c630aafd | 36 | Int_t retval = rl->LoadgAlice(); |
37 | if (retval) { | |
38 | cerr<<"AliITSFindTracksV2.C : LoadgAlice returned error"<<endl; | |
39 | delete rl; | |
88cb7938 | 40 | return 3; |
c630aafd | 41 | } |
42 | retval = rl->LoadHeader(); | |
43 | if (retval) { | |
44 | cerr<<"AliITSFindTracksV2.C : LoadHeader returned error"<<endl; | |
88cb7938 | 45 | delete rl; |
46 | return 3; | |
c630aafd | 47 | } |
48 | gAlice=rl->GetAliRun(); | |
49 | ||
50 | AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); | |
51 | if (itsl == 0x0) { | |
52 | cerr<<"AliITSFindTracksV2.C : Can not get ITS loader"<<endl; | |
88cb7938 | 53 | return 4; |
c630aafd | 54 | } |
03248e6d | 55 | |
c630aafd | 56 | AliTPCLoader* tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader"); |
57 | if (tpcl == 0x0) { | |
58 | cerr<<"AliITSFindTracksV2.C : can not get TPC loader"<<endl; | |
59 | return 5; | |
60 | } | |
03248e6d | 61 | |
c630aafd | 62 | AliITS *dITS = (AliITS*)gAlice->GetDetector("ITS"); |
63 | if (!dITS) { | |
64 | cerr<<"AliITSFindClusters.C : Can not find the ITS detector !"<<endl; | |
88cb7938 | 65 | return 6; |
c630aafd | 66 | } |
88cb7938 | 67 | AliITSgeom *geom = dITS->GetITSgeom(); |
03248e6d | 68 | |
c630aafd | 69 | AliITStrackerV2 tracker(geom); |
03248e6d | 70 | |
c630aafd | 71 | tpcl->LoadTracks("read"); |
72 | itsl->LoadTracks("recreate"); | |
73 | itsl->LoadRecPoints("read"); | |
74 | ||
75 | TStopwatch timer; | |
76 | if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents(); | |
77 | Int_t rc=0; | |
78 | for (Int_t i=0; i<nev; i++) { | |
79 | cerr<<"Processing event number: "<<i<<endl; | |
80 | rl->GetEvent(i); | |
81 | ||
82 | TTree *cTree=itsl->TreeR(); | |
83 | if (!cTree) { | |
84 | cerr<<"AliITSFindTracksV2.C : Can't get the clusters tree !"<<endl; | |
85 | return 4; | |
86 | } | |
87 | TTree *tpcTree=tpcl->TreeT(); | |
88 | if (!tpcTree) { | |
89 | cerr<<"AliITSFindTracksV2.C : Can't get the TPC track tree !"<<endl; | |
90 | return 4; | |
88cb7938 | 91 | } |
c630aafd | 92 | TTree *itsTree=itsl->TreeT(); |
93 | if (!itsTree) { | |
94 | itsl->MakeTree("T"); | |
95 | itsTree=itsl->TreeT(); | |
96 | } | |
97 | ||
98 | tracker.LoadClusters(cTree); | |
99 | rc=tracker.Clusters2Tracks(tpcTree,itsTree); | |
100 | tracker.UnloadClusters(); | |
101 | ||
102 | itsl->WriteTracks("OVERWRITE"); | |
103 | } | |
88cb7938 | 104 | timer.Stop(); timer.Print(); |
c630aafd | 105 | |
88cb7938 | 106 | delete rl; |
c630aafd | 107 | |
03248e6d | 108 | return rc; |
109 | } |