- TFile *cf=TFile::Open("AliTPCclusters.root");
- if (!cf->IsOpen()) {cerr<<"Can't open AliTPCclusters.root !\n"; return 1;}
- AliTPCParam *digp= (AliTPCParam*)cf->Get("75x40_100x60");
- if (!digp) { cerr<<"TPC parameters have not been found !\n"; return 2; }
-
-// Load clusters
- AliTPCClustersArray *ca=new AliTPCClustersArray;
- ca->Setup(digp);
- ca->SetClusterType("AliTPCcluster");
- ca->ConnectTree("Segment Tree");
- Int_t nentr=Int_t(ca->GetTree()->GetEntries());
- for (i=0; i<nentr; i++) ca->LoadEntry(i);
-
-// Load tracks
- TFile *tf=TFile::Open("AliTPCtracks.root");
- if (!tf->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return 3;}
- TObjArray tarray(2000);
- TTree *tracktree=(TTree*)tf->Get("TreeT");
- TBranch *tbranch=tracktree->GetBranch("tracks");
- nentr=(Int_t)tracktree->GetEntries();
-
- AliTPCtrack *iotrack=0;
- for (i=0; i<nentr; i++) {
- iotrack=new AliTPCtrack;
- tbranch->SetAddress(&iotrack);
- tracktree->GetEvent(i);
- iotrack->CookLabel(ca);
- tarray.AddLast(iotrack);
- }
- tf->Close();
-
- delete ca;
- cf->Close();
-
-/////////////////////////////////////////////////////////////////////////
- GoodTrack gt[15000];
- Int_t ngood=0;
- ifstream in("good_tracks_tpc");
- if (in) {
- cerr<<"Reading good tracks...\n";
- while (in>>gt[ngood].lab>>gt[ngood].code>>
- gt[ngood].px>>gt[ngood].py>>gt[ngood].pz>>
- gt[ngood].x >>gt[ngood].y >>gt[ngood].z) {
- ngood++;
- cerr<<ngood<<'\r';
- if (ngood==15000) {
- cerr<<"Too many good tracks !\n";
- break;
- }
- }
- if (!in.eof()) cerr<<"Read error (good_tracks_tpc) !\n";
- } else {
- cerr<<"Marking good tracks (this will take a while)...\n";
- ngood=good_tracks(gt,15000);
- ofstream out("good_tracks_tpc");
- if (out) {
- for (Int_t ngd=0; ngd<ngood; ngd++)
- out<<gt[ngd].lab<<' '<<gt[ngd].code<<' '<<
- gt[ngd].px<<' '<<gt[ngd].py<<' '<<gt[ngd].pz<<' '<<
- gt[ngd].x <<' '<<gt[ngd].y <<' '<<gt[ngd].z <<endl;
- } else cerr<<"Can not open file (good_tracks_tpc) !\n";
- out.close();
-
- cerr<<"Preparing tracks for matching with the ITS...\n";
- tarray.Sort();
- tf=TFile::Open("AliTPCtracks.root","recreate");
- tracktree=new TTree("TreeT","Tree with TPC tracks");
- tracktree->Branch("tracks","AliTPCtrack",&iotrack,32000,0);
- for (i=0; i<nentr; i++) {
- iotrack=(AliTPCtrack*)tarray.UncheckedAt(i);
- tracktree->Fill();
- }
- tracktree->Write();
- tf->Close();