]>
Commit | Line | Data |
---|---|---|
4b9aeba1 | 1 | //////////////////////////////////////////////////////////////////////// |
2 | // | |
3 | // AliITSTrackingV2.C | |
4 | // | |
5 | // date: 18.03.2003 | |
6 | // author: Thomas Kuhr based on AliTPCTracking.C, AliITSFindClustersV2.C | |
7 | // and AliITSFindTracksV2.C | |
8 | // version: 1.0 | |
9 | // description: | |
10 | // reconstructs of tracks in ITS in the following steps: | |
11 | // ITS cluster finding | |
12 | // ITS track finding | |
13 | // input parameters: | |
14 | // Int_t nEvents ... nr of events to process | |
15 | // Int_t firstEventNr ... first event number (starts from 0) | |
16 | // char* fileNameHits ... name of file with hits | |
17 | // char* fileNameITSDigits .. name of file with ITS digits | |
18 | // char* fileNameITSTracks .. name of file with TPC tracks | |
19 | // char* fileNameITSClusters .. name of file with ITS clusters (output) | |
20 | // char* fileNameITSTracks .. name of file with ITS tracks (output) | |
21 | // | |
22 | //////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | ||
25 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
26 | #include "Riostream.h" | |
27 | #include "TFile.h" | |
28 | #include "TBenchmark.h" | |
29 | #include "AliITS.h" | |
30 | #include "AliITSgeom.h" | |
31 | #include "AliITSclustererV2.h" | |
32 | #include "AliITStrackerV2.h" | |
33 | #include "AliRun.h" | |
34 | #endif | |
35 | ||
36 | Int_t gDEBUG = 2; | |
37 | ||
38 | Int_t AliITSTrackingV2(Int_t nEvents=1, Int_t firstEvent=0, | |
39 | const char* fileNameHits="galice.root", | |
40 | const char* fileNameITSDigits="its.digits.root", | |
41 | const char* fileNameTPCTracks="tpc.tracks.root", | |
42 | const char* fileNameITSClusters="its.clusters.root", | |
43 | const char* fileNameITSTracks="its.tracks.root"); | |
44 | ||
45 | Int_t ITSFindClustersV2(const char* fileNameITSDigits, | |
46 | const char* fileNameITSClusters, | |
47 | Int_t n, Int_t first); | |
48 | Int_t ITSFindTracksV2(const char* fileNameTPCTracks, | |
49 | const char* fileNameITSClusters, | |
50 | const char* fileNameITSTracks, | |
51 | Int_t n, Int_t first); | |
52 | ||
53 | //////////////////////////////////////////////////////////////////////// | |
54 | Int_t AliITSTrackingV2(Int_t nEvents, Int_t firstEvent, | |
55 | const char* fileNameHits, | |
56 | const char* fileNameITSDigits, | |
57 | const char* fileNameTPCTracks, | |
58 | const char* fileNameITSClusters, | |
59 | const char* fileNameITSTracks) { | |
60 | ||
61 | AliTracker::SetFieldFactor(fileNameHits,kFALSE); | |
62 | ||
63 | // find clusters | |
64 | ||
65 | if (fileNameITSDigits && fileNameITSClusters) { | |
66 | if(ITSFindClustersV2(fileNameITSDigits,fileNameITSClusters,nEvents,firstEvent)) { | |
67 | cerr << "ITS clustering failed \n"; | |
68 | return 1; | |
69 | } | |
70 | } | |
71 | ||
72 | // find tracks | |
73 | ||
74 | if (fileNameTPCTracks && fileNameITSClusters && fileNameITSTracks) { | |
75 | if(ITSFindTracksV2(fileNameTPCTracks,fileNameITSClusters,fileNameITSTracks,nEvents,firstEvent)) { | |
76 | cerr << "ITS tracking failed \n"; | |
77 | return 2; | |
78 | } | |
79 | } | |
80 | ||
81 | return 0; | |
82 | } | |
83 | //////////////////////////////////////////////////////////////////////// | |
84 | Int_t ITSFindClustersV2(const char* fileNameITSDigits, const char* fileNameITSClusters, Int_t nEvents, Int_t firstEvent) { | |
85 | // | |
86 | // create ITS clusters, store them in the file fileNameITSClusters | |
87 | // gAlice object must be in memory | |
88 | ||
89 | const char *name="ITSFindClustersV2"; | |
90 | if (gDEBUG>1) cout<<name<<" starts...\n"; | |
91 | if (gDEBUG>1) gBenchmark->Start(name); | |
92 | ||
93 | TFile *in =TFile::Open(fileNameITSDigits); | |
94 | if (!in->IsOpen()) { | |
95 | cerr<<"Can't open file "<<fileNameITSDigits<<endl; | |
96 | return 1; | |
97 | } | |
98 | gAlice->SetTreeDFileName(fileNameITSDigits); | |
99 | TFile *out=TFile::Open(fileNameITSClusters,"recreate"); | |
100 | if (!out->IsOpen()) { | |
101 | cerr<<"Can't open file "<<fileNameITSClusters<<endl; | |
102 | return 1; | |
103 | } | |
104 | ||
105 | AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); | |
106 | if (!ITS) { cerr<<"Can't find the ITS !\n"; return 3; } | |
107 | ||
108 | AliITSgeom *geom=ITS->GetITSgeom(); | |
109 | out->cd(); | |
110 | geom->Write(); | |
111 | gROOT->cd(); | |
112 | ||
113 | AliITSclustererV2 clusterer(geom); | |
114 | for (Int_t iEvent = firstEvent; iEvent<firstEvent+nEvents; iEvent++){ | |
115 | cout<<"ITSFindClusters: processing event "<<iEvent<<endl; | |
116 | gAlice->GetEvent(iEvent); | |
117 | in->cd(); | |
118 | clusterer.SetEvent(iEvent); | |
119 | clusterer.Digits2Clusters(in,out); | |
120 | } | |
121 | ||
122 | out->Close(); | |
123 | in->Close(); | |
124 | ||
125 | if (gDEBUG>1) gBenchmark->Show(name); | |
126 | return 0; | |
127 | } | |
128 | //////////////////////////////////////////////////////////////////////// | |
129 | Int_t ITSFindTracksV2(const char* fileNameTPCTracks, | |
130 | const char* fileNameITSClusters, | |
131 | const char* fileNameITSTracks, | |
132 | Int_t nEvents, Int_t first) { | |
133 | Int_t rc=0; | |
134 | const char *name="ITSFindTracksV2"; | |
135 | if (gDEBUG>1) cout<<name<<" starts...\n"; | |
136 | if (gDEBUG>1) gBenchmark->Start(name); | |
137 | ||
138 | TFile *out=TFile::Open(fileNameITSTracks,"recreate"); | |
139 | if (!out->IsOpen()) { | |
140 | cerr<<"Can't open file "<<fileNameITSTracks<<endl; | |
141 | return 1; | |
142 | } | |
143 | TFile *in =TFile::Open(fileNameTPCTracks); | |
144 | if (!in->IsOpen()) { | |
145 | cerr<<"Can't open file "<<fileNameTPCTracks<<endl; | |
146 | return 1; | |
147 | } | |
148 | TFile *in2 =TFile::Open(fileNameITSClusters); | |
149 | if (!in2->IsOpen()) { | |
150 | cerr<<"Can't open file "<<fileNameITSClusters<<endl; | |
151 | return 1; | |
152 | } | |
153 | ||
154 | AliITSgeom *geom=(AliITSgeom*)in2->Get("AliITSgeom"); | |
155 | if (!geom) { cerr<<"can't get ITS geometry !\n"; return 1;} | |
156 | ||
157 | AliITStrackerV2 tracker(geom); | |
158 | for (Int_t iEvent=first;iEvent<first+nEvents;iEvent++){ | |
159 | cout<<"ITSFindTracks -- event "<<iEvent<<endl; | |
160 | tracker.SetEventNumber(iEvent); | |
161 | rc=tracker.Clusters2Tracks(in,out); | |
162 | } | |
163 | ||
164 | in->Close(); | |
165 | in2->Close(); | |
166 | out->Close(); | |
167 | ||
168 | if (gDEBUG>1) gBenchmark->Show(name); | |
169 | return rc; | |
170 | } | |
171 |