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