]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSFindTracksSA.C
Adding more information to the debug output
[u/mrichter/AliRoot.git] / ITS / AliITSFindTracksSA.C
... / ...
CommitLineData
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
82 //AliITSVertexerPPZ* vertexer = new AliITSVertexerPPZ("vertici.root");
83 Double_t smear[3]={0.0150,0.0150,0.0150};
84 AliITSVertexerFast* vertexer = new AliITSVertexerFast(smear);
85 TTree* cltree = itsl->TreeR();
86 AliITSVertex* vert = vertexer->FindVertexForCurrentEvent(cltree);
87 AliITStrackerSA tracker(geom,vert);
88 tracker.SetEventNumber(iev);
89
90 itsl->UnloadRecPoints();
91 itsl->SetRecPointsFileName(clusterFileName);
92 itsl->LoadRecPoints();
93
94 if(onlyITS){
95 itsl->SetTracksFileName(tracksFileName);
96 itsl->LoadTracks("recreate");
97
98 TTree* treec = (TTree*)itsl->TreeR();
99 TTree *itsTree=itsl->TreeT();
100 if (!itsTree) {
101 itsl->MakeTree("T");
102 itsTree=itsl->TreeT();
103 }
104
105 tracker.FindTracks(treec,itsTree,iev,opt);
106 itsl->WriteTracks("OVERWRITE");
107 }
108 if(!onlyITS){
109 itsl->LoadTracks("read");
110 TTree *treev2=(TTree*)itsl->TreeT();
111 TTree* treec = (TTree*)itsl->TreeR();
112 tracker.UseFoundTracksV2(iev,treev2,treec);
113 itsl->UnloadTracks();
114 itsl->SetTracksFileName(tracksFileName);
115 itsl->LoadTracks("recreate");
116 TTree *itsTree=itsl->TreeT();
117 if (!itsTree) {
118 itsl->MakeTree("T");
119 itsTree=itsl->TreeT();
120 }
121 tracker.FindTracks(treec,itsTree,iev,opt);
122 itsl->WriteTracks("OVERWRITE");
123
124 }
125
126 }
127 timer.Stop(); timer.Print();
128 delete geom;
129
130
131 return 0;
132}
133
134
135
136
137