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();
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);
88 itsl->UnloadRecPoints();
89 itsl->SetRecPointsFileName(clusterFileName);
90 itsl->LoadRecPoints();
93 itsl->SetTracksFileName(tracksFileName);
94 itsl->LoadTracks("recreate");
96 TTree* treec = (TTree*)itsl->TreeR();
97 TTree *itsTree=itsl->TreeT();
100 itsTree=itsl->TreeT();
103 tracker.FindTracks(treec,itsTree,iev,opt);
104 itsl->WriteTracks("OVERWRITE");
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();
117 itsTree=itsl->TreeT();
119 tracker.FindTracks(treec,itsTree,iev,opt);
120 itsl->WriteTracks("OVERWRITE");
125 timer.Stop(); timer.Print();