1 #if !defined(__CINT__) || defined(__MAKECINT__)
3 #include "AliITSgeom.h"
5 #include "AliITStrackerSA.h"
6 #include "AliITSVertexerFast.h"
8 #include "AliRunLoader.h"
9 // #include "AliTPCLoader.h"
10 #include "AliITSLoader.h"
11 #include "TStopwatch.h"
15 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") {
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.
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.
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
28 // write 6/6 to accept only tracks with 6 clusters
29 // write 5/6 to accept tracks with 5 clusters good over 6
33 delete gAlice->GetRunLoader();
38 AliRunLoader* rl = AliRunLoader::Open("galice.root");
40 cerr<<"AliITSFindTracksSA.C : Can not open session RL=NULL"<< endl;
44 Int_t retval = rl->LoadgAlice();
46 cerr<<"AliITSFindTracksSA.C : LoadgAlice returned error"<<endl;
51 retval = rl->LoadHeader();
53 cerr<<"AliITSFindTracksSA.C : LoadHeader returned error"<<endl;
57 gAlice=rl->GetAliRun();
59 AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
61 cerr<<"AliITSFindTracksSA.C : Can not get ITS loader"<<endl;
65 AliITS *iTS = (AliITS*)gAlice->GetDetector("ITS");
67 cerr<<"AliITSFindTracksSA.C : Can not find the ITS detector !"<<endl;
70 AliITSgeom *geom = iTS->GetITSgeom();
71 AliKalmanTrack::SetConvConst(1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField());
74 Bool_t onlyITS=choice.Contains("onlyITS");
78 for(Int_t iev=evin;iev<nevents;iev++){
80 itsl->LoadRecPoints();
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);
90 itsl->UnloadRecPoints();
91 itsl->SetRecPointsFileName(clusterFileName);
92 itsl->LoadRecPoints();
95 itsl->SetTracksFileName(tracksFileName);
96 itsl->LoadTracks("recreate");
98 TTree* treec = (TTree*)itsl->TreeR();
99 TTree *itsTree=itsl->TreeT();
102 itsTree=itsl->TreeT();
105 tracker.FindTracks(treec,itsTree,iev,opt);
106 itsl->WriteTracks("OVERWRITE");
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();
119 itsTree=itsl->TreeT();
121 tracker.FindTracks(treec,itsTree,iev,opt);
122 itsl->WriteTracks("OVERWRITE");
127 timer.Stop(); timer.Print();