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"
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") {
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.
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.
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
27 // write 6/6 to accept only tracks with 6 clusters
28 // write 5/6 to accept tracks with 5 clusters good over 6
32 delete AliRunLoader::Instance();
37 AliRunLoader* rl = AliRunLoader::Open("galice.root");
39 cerr<<"AliITSFindTracksSA.C : Can not open session RL=NULL"<< endl;
43 Int_t retval = rl->LoadgAlice();
45 cerr<<"AliITSFindTracksSA.C : LoadgAlice returned error"<<endl;
50 retval = rl->LoadHeader();
52 cerr<<"AliITSFindTracksSA.C : LoadHeader returned error"<<endl;
56 gAlice=rl->GetAliRun();
58 AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
60 cerr<<"AliITSFindTracksSA.C : Can not get ITS loader"<<endl;
64 AliITS *iTS = (AliITS*)gAlice->GetDetector("ITS");
66 cerr<<"AliITSFindTracksSA.C : Can not find the ITS detector !"<<endl;
69 AliITSgeom *geom = iTS->GetITSgeom();
70 AliKalmanTrack::SetConvConst(1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField());
73 Bool_t onlyITS=choice.Contains("onlyITS");
77 for(Int_t iev=evin;iev<nevents;iev++){
79 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 TTree* cltree = itsl->TreeR();
85 AliITSVertex* vert = vertexer->FindVertexForCurrentEvent(cltree);
86 AliITStrackerSA tracker(geom,vert);
87 tracker.SetEventNumber(iev);
89 itsl->UnloadRecPoints();
90 itsl->SetRecPointsFileName(clusterFileName);
91 itsl->LoadRecPoints();
94 itsl->SetTracksFileName(tracksFileName);
95 itsl->LoadTracks("recreate");
97 TTree* treec = (TTree*)itsl->TreeR();
98 TTree *itsTree=itsl->TreeT();
101 itsTree=itsl->TreeT();
104 tracker.FindTracks(treec,itsTree,iev,opt);
105 itsl->WriteTracks("OVERWRITE");
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();
118 itsTree=itsl->TreeT();
120 tracker.FindTracks(treec,itsTree,iev,opt);
121 itsl->WriteTracks("OVERWRITE");
126 timer.Stop(); timer.Print();