1 ////////////////////////////////////////////////////////////////////////
6 // author: Thomas Kuhr based on AliTPCTracking.C, AliITSFindClustersV2.C
7 // and AliITSFindTracksV2.C
10 // reconstructs of tracks in ITS in the following steps:
11 // ITS cluster finding
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)
22 ////////////////////////////////////////////////////////////////////////
25 #if !defined(__CINT__) || defined(__MAKECINT__)
26 #include "Riostream.h"
28 #include "TBenchmark.h"
30 #include "AliITSgeom.h"
31 #include "AliITSclustererV2.h"
32 #include "AliITStrackerV2.h"
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");
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);
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) {
61 AliTracker::SetFieldFactor(fileNameHits,kFALSE);
65 if (fileNameITSDigits && fileNameITSClusters) {
66 if(ITSFindClustersV2(fileNameITSDigits,fileNameITSClusters,nEvents,firstEvent)) {
67 cerr << "ITS clustering failed \n";
74 if (fileNameTPCTracks && fileNameITSClusters && fileNameITSTracks) {
75 if(ITSFindTracksV2(fileNameTPCTracks,fileNameITSClusters,fileNameITSTracks,nEvents,firstEvent)) {
76 cerr << "ITS tracking failed \n";
83 ////////////////////////////////////////////////////////////////////////
84 Int_t ITSFindClustersV2(const char* fileNameITSDigits, const char* fileNameITSClusters, Int_t nEvents, Int_t firstEvent) {
86 // create ITS clusters, store them in the file fileNameITSClusters
87 // gAlice object must be in memory
89 const char *name="ITSFindClustersV2";
90 if (gDEBUG>1) cout<<name<<" starts...\n";
91 if (gDEBUG>1) gBenchmark->Start(name);
93 TFile *in =TFile::Open(fileNameITSDigits);
95 cerr<<"Can't open file "<<fileNameITSDigits<<endl;
98 gAlice->SetTreeDFileName(fileNameITSDigits);
99 TFile *out=TFile::Open(fileNameITSClusters,"recreate");
100 if (!out->IsOpen()) {
101 cerr<<"Can't open file "<<fileNameITSClusters<<endl;
105 AliITS *ITS = (AliITS*)gAlice->GetModule("ITS");
106 if (!ITS) { cerr<<"Can't find the ITS !\n"; return 3; }
108 AliITSgeom *geom=ITS->GetITSgeom();
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);
118 clusterer.SetEvent(iEvent);
119 clusterer.Digits2Clusters(in,out);
125 if (gDEBUG>1) gBenchmark->Show(name);
128 ////////////////////////////////////////////////////////////////////////
129 Int_t ITSFindTracksV2(const char* fileNameTPCTracks,
130 const char* fileNameITSClusters,
131 const char* fileNameITSTracks,
132 Int_t nEvents, Int_t first) {
134 const char *name="ITSFindTracksV2";
135 if (gDEBUG>1) cout<<name<<" starts...\n";
136 if (gDEBUG>1) gBenchmark->Start(name);
138 TFile *out=TFile::Open(fileNameITSTracks,"recreate");
139 if (!out->IsOpen()) {
140 cerr<<"Can't open file "<<fileNameITSTracks<<endl;
143 TFile *in =TFile::Open(fileNameTPCTracks);
145 cerr<<"Can't open file "<<fileNameTPCTracks<<endl;
148 TFile *in2 =TFile::Open(fileNameITSClusters);
149 if (!in2->IsOpen()) {
150 cerr<<"Can't open file "<<fileNameITSClusters<<endl;
154 AliITSgeom *geom=(AliITSgeom*)in2->Get("AliITSgeom");
155 if (!geom) { cerr<<"can't get ITS geometry !\n"; return 1;}
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);
168 if (gDEBUG>1) gBenchmark->Show(name);