]>
Commit | Line | Data |
---|---|---|
13918578 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <Riostream.h> | |
3 | #include "AliITSgeom.h" | |
4 | #include "AliITS.h" | |
5 | #include "AliITStrackerSA.h" | |
6 | #include "AliITSVertexerFast.h" | |
7 | #include "AliRun.h" | |
8 | #include "AliRunLoader.h" | |
308c2f7c | 9 | // #include "AliTPCLoader.h" |
13918578 | 10 | #include "AliITSLoader.h" |
11 | #include "TStopwatch.h" | |
13918578 | 12 | #endif |
13 | ||
14 | Int_t AliITSFindTracksSA(Int_t evin=0,Int_t nevents=1,char *opt="onlyITS+6/6",const Char_t *clusterFileName="clusters.root", const Char_t *tracksFileName="ITS.TracksSA.root") { | |
15 | ||
16 | //This macro finds tracks in the ITS Stand Alone and writes them in | |
17 | //the file ITS.TracksSA.root as tracks of class AliITStracksV2. | |
18 | ||
19 | //This macro needs both AliITSRecPoint (to find the vertex) and | |
20 | //AliITSclusterV2 reconstructed points (track finding). Clusters V2 | |
21 | //must be saved in a file with a different name from that of RecPoint. | |
22 | ||
23 | //Options: write onlyITS to track only with the ITS | |
24 | // without the option onlyITS combined tracking TPC+ITS | |
25 | // and ITS stand-alone will be performed | |
26 | // | |
27 | // write 6/6 to accept only tracks with 6 clusters | |
28 | // write 5/6 to accept tracks with 5 clusters good over 6 | |
29 | ||
30 | ||
31 | if (gAlice) { | |
33c3c91a | 32 | delete AliRunLoader::Instance(); |
13918578 | 33 | delete gAlice; |
34 | gAlice=0; | |
35 | } | |
36 | ||
37 | AliRunLoader* rl = AliRunLoader::Open("galice.root"); | |
38 | if (rl == 0x0) { | |
39 | cerr<<"AliITSFindTracksSA.C : Can not open session RL=NULL"<< endl; | |
40 | return 3; | |
41 | } | |
42 | ||
43 | Int_t retval = rl->LoadgAlice(); | |
44 | if (retval) { | |
45 | cerr<<"AliITSFindTracksSA.C : LoadgAlice returned error"<<endl; | |
46 | delete rl; | |
47 | return 3; | |
48 | } | |
49 | ||
50 | retval = rl->LoadHeader(); | |
51 | if (retval) { | |
52 | cerr<<"AliITSFindTracksSA.C : LoadHeader returned error"<<endl; | |
53 | delete rl; | |
54 | return 3; | |
55 | } | |
56 | gAlice=rl->GetAliRun(); | |
57 | ||
58 | AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); | |
59 | if (itsl == 0x0) { | |
60 | cerr<<"AliITSFindTracksSA.C : Can not get ITS loader"<<endl; | |
61 | return 4; | |
62 | } | |
63 | ||
64 | AliITS *iTS = (AliITS*)gAlice->GetDetector("ITS"); | |
65 | if (!iTS) { | |
66 | cerr<<"AliITSFindTracksSA.C : Can not find the ITS detector !"<<endl; | |
67 | return 6; | |
68 | } | |
69 | AliITSgeom *geom = iTS->GetITSgeom(); | |
70 | AliKalmanTrack::SetConvConst(1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField()); | |
71 | ||
72 | TString choice(opt); | |
73 | Bool_t onlyITS=choice.Contains("onlyITS"); | |
74 | ||
75 | TStopwatch timer; | |
76 | ||
77 | for(Int_t iev=evin;iev<nevents;iev++){ | |
78 | rl->GetEvent(iev); | |
79 | itsl->LoadRecPoints(); | |
308c2f7c | 80 | |
13918578 | 81 | //AliITSVertexerPPZ* vertexer = new AliITSVertexerPPZ("vertici.root"); |
82 | Double_t smear[3]={0.0150,0.0150,0.0150}; | |
83 | AliITSVertexerFast* vertexer = new AliITSVertexerFast(smear); | |
308c2f7c | 84 | TTree* cltree = itsl->TreeR(); |
85 | AliITSVertex* vert = vertexer->FindVertexForCurrentEvent(cltree); | |
13918578 | 86 | AliITStrackerSA tracker(geom,vert); |
87 | tracker.SetEventNumber(iev); | |
88 | ||
89 | itsl->UnloadRecPoints(); | |
90 | itsl->SetRecPointsFileName(clusterFileName); | |
91 | itsl->LoadRecPoints(); | |
92 | ||
93 | if(onlyITS){ | |
94 | itsl->SetTracksFileName(tracksFileName); | |
95 | itsl->LoadTracks("recreate"); | |
96 | ||
97 | TTree* treec = (TTree*)itsl->TreeR(); | |
98 | TTree *itsTree=itsl->TreeT(); | |
99 | if (!itsTree) { | |
100 | itsl->MakeTree("T"); | |
101 | itsTree=itsl->TreeT(); | |
102 | } | |
103 | ||
104 | tracker.FindTracks(treec,itsTree,iev,opt); | |
105 | itsl->WriteTracks("OVERWRITE"); | |
106 | } | |
107 | if(!onlyITS){ | |
108 | itsl->LoadTracks("read"); | |
109 | TTree *treev2=(TTree*)itsl->TreeT(); | |
110 | TTree* treec = (TTree*)itsl->TreeR(); | |
111 | tracker.UseFoundTracksV2(iev,treev2,treec); | |
112 | itsl->UnloadTracks(); | |
113 | itsl->SetTracksFileName(tracksFileName); | |
114 | itsl->LoadTracks("recreate"); | |
115 | TTree *itsTree=itsl->TreeT(); | |
116 | if (!itsTree) { | |
117 | itsl->MakeTree("T"); | |
118 | itsTree=itsl->TreeT(); | |
119 | } | |
120 | tracker.FindTracks(treec,itsTree,iev,opt); | |
121 | itsl->WriteTracks("OVERWRITE"); | |
122 | ||
123 | } | |
124 | ||
125 | } | |
126 | timer.Stop(); timer.Print(); | |
127 | delete geom; | |
128 | ||
129 | ||
130 | return 0; | |
131 | } | |
132 | ||
133 | ||
134 | ||
135 | ||
136 |