-struct GoodTrackITS {
- Int_t event;
- Int_t lab;
- Int_t code;
- Float_t px,py,pz;
- Float_t x,y,z;
-};
-
-Int_t AliITSComparisonV2() {
- Int_t good_tracks_its(GoodTrackITS *gt, Int_t max);
-
- cerr<<"Doing comparison...\n";
-
- TFile *cf=TFile::Open("AliITSclustersV2.root");
- if (!cf->IsOpen()) {cerr<<"Can't open AliITSclustersV2.root !\n"; return 1;}
- AliITSgeom *geom=(AliITSgeom*)cf->Get("AliITSgeom");
- if (!geom) { cerr<<"Can't get the ITS geometry !\n"; return 2; }
- AliITStrackerV2 tracker(geom);
-
-// Load tracks
- TFile *tf=TFile::Open("AliITStracksV2.root");
- if (!tf->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 3;}
- TObjArray tarray(2000);
- TTree *tracktree=(TTree*)tf->Get("TreeT_ITS_0");
- if (!tracktree) {cerr<<"Can't get a tree with ITS tracks !\n"; return 4;}
- TBranch *tbranch=tracktree->GetBranch("tracks");
- Int_t nentr=(Int_t)tracktree->GetEntries(),i;
- for (i=0; i<nentr; i++) {
- AliITStrackV2 *iotrack=new AliITStrackV2;
- tbranch->SetAddress(&iotrack);
- tracktree->GetEvent(i);
-
- Int_t tpcLabel=iotrack->GetLabel();
- tracker.CookLabel(iotrack,0.);
- Int_t itsLabel=iotrack->GetLabel();
- if (itsLabel != tpcLabel) iotrack->SetLabel(-TMath::Abs(itsLabel));
- if (tpcLabel < 0) iotrack->SetLabel(-TMath::Abs(itsLabel));
- /*
- if (itsLabel==1234) {
- Int_t nc=iotrack->GetNumberOfClusters();
- for (Int_t k=0; k<nc; k++) {
- Int_t index=iotrack->GetClusterIndex(k);
- AliITSclusterV2 *c=tracker.GetCluster(index);
- cout<<c->GetLabel(0)<<' '<<c->GetLabel(1)<<' '<<c->GetLabel(2)<<endl;
- }
- }
- */
- tarray.AddLast(iotrack);
- }
- delete tracktree; //Thanks to Mariana Bondila
- tf->Close();
- delete geom; //Thanks to Mariana Bondila
- cf->Close();
-
-/////////////////////////////////////////////////////////////////////////
- const Int_t MAX=15000;
- GoodTrackITS gt[MAX];
- Int_t ngood=0;
- ifstream in("good_tracks_its");
- if (in) {
- cerr<<"Reading good tracks...\n";
- while (in>>gt[ngood].event>>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==MAX) {
- cerr<<"Too many good tracks !\n";
- break;
- }
- }
- if (!in.eof()) cerr<<"Read error (good_tracks_its) !\n";
- } else {
- cerr<<"Marking good tracks (this will take a while)...\n";
- ngood=good_tracks_its(gt,MAX);
- ofstream out("good_tracks_its");
- if (out) {
- for (Int_t ngd=0; ngd<ngood; ngd++)
- out<<gt[ngd].event<<' '<<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_its) !\n";
- out.close();
- }
- cerr<<"Number of good tracks : "<<ngood<<endl;