1 /****************************************************************************
2 * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch *
3 ****************************************************************************/
5 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include "TStopwatch.h"
12 #include "AliRunLoader.h"
13 #include "AliTPCLoader.h"
14 #include "AliITSLoader.h"
16 #include "AliITSgeom.h"
17 #include "AliITStrackerV2.h"
21 extern AliRun *gAlice;
23 Int_t AliITSFindTracksV2(Int_t nev=5) { //number of events to process
24 cerr<<"Looking for tracks...\n";
27 delete gAlice->GetRunLoader();
32 AliRunLoader* rl = AliRunLoader::Open("galice.root");
34 cerr<<"AliITSFindTracks.C : Can not open session RL=NULL"<< endl;
38 AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
40 cerr<<"AliITSFindTracksV2.C : Can not get ITS loader"<<endl;
44 if (rl->LoadgAlice()) {
45 cerr<<"AliITSFindTracksV2.C : LoadgAlice returned error"<<endl;
50 AliKalmanTrack::SetConvConst(
51 1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField()
54 AliITS *dITS = (AliITS*)rl->GetAliRun()->GetDetector("ITS");
56 cerr<<"AliITSFindClusters.C : Can not find the ITS detector !"<<endl;
59 AliITSgeom *geom = dITS->GetITSgeom();
61 AliITStrackerV2 tracker(geom);
63 itsl->LoadRecPoints("read");
65 if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
68 TFile *itsf=TFile::Open("AliESDits.root","RECREATE");
69 if ((!itsf)||(!itsf->IsOpen())) {
70 cerr<<"Can't AliESDits.root !\n"; return 1;
72 TFile *tpcf=TFile::Open("AliESDtpc.root");
73 if ((!tpcf)||(!tpcf->IsOpen())) {
74 cerr<<"Can't AliESDtpc.root !\n"; return 1;
77 TIter next(tpcf->GetListOfKeys());
79 for (Int_t i=0; i<nev; i++) {
81 if ((key=(TKey*)next())==0) break;
82 cerr<<"Processing event number: "<<i<<endl;
83 AliESD *event=(AliESD*)key->ReadObj();
87 TTree *cTree=itsl->TreeR();
89 cerr<<"AliITSFindTracksV2.C : Can't get the clusters tree !"<<endl;
93 tracker.LoadClusters(cTree);
94 rc=tracker.Clusters2Tracks(event);
95 tracker.UnloadClusters();
99 sprintf(ename,"%d",i);
101 if (!event->Write(ename)) rc++;
104 cerr<<"Something bad happened...\n";
108 timer.Stop(); timer.Print();