From c7ee21ca1b7adf0bea0baef4be1d33164400ce34 Mon Sep 17 00:00:00 2001 From: hristov Date: Sun, 21 Oct 2001 19:20:02 +0000 Subject: [PATCH] Several patches were done to adapt the ITS reconstruction version V2 to the multi-event case. Some memory leaks were corrected. (Yu.Belikov) --- ITS/AliITSComparisonV2.C | 45 ++++++++++++++++++++++---------------- ITS/AliITSFindClustersV2.C | 21 ++++++++++++------ ITS/AliITSFindTracksV2.C | 2 ++ ITS/AliITStrackerV2.cxx | 22 +++++++++++-------- ITS/AliITStrackerV2.h | 2 +- 5 files changed, 56 insertions(+), 36 deletions(-) diff --git a/ITS/AliITSComparisonV2.C b/ITS/AliITSComparisonV2.C index 7209f90e45e..ef036cfc491 100644 --- a/ITS/AliITSComparisonV2.C +++ b/ITS/AliITSComparisonV2.C @@ -20,15 +20,17 @@ #include "TParticle.h" #endif -struct GoodTrack { +struct GoodTrackITS { + Int_t event; Int_t lab; Int_t code; Float_t px,py,pz; Float_t x,y,z; }; -Int_t good_tracks(GoodTrack *gt, Int_t max); Int_t AliITSComparisonV2() { + Int_t good_tracks_its(GoodTrackITS *gt, Int_t max); + cerr<<"Doing comparison...\n"; TFile *cf=TFile::Open("AliITSclustersV2.root"); @@ -41,7 +43,7 @@ Int_t AliITSComparisonV2() { 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("ITSf"); + 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; @@ -66,22 +68,25 @@ Int_t AliITSComparisonV2() { } */ tarray.AddLast(iotrack); - } + } + delete tracktree; //Thanks to Mariana Bondila tf->Close(); + delete geom; //Thanks to Mariana Bondila cf->Close(); ///////////////////////////////////////////////////////////////////////// - GoodTrack gt[15000]; + 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].lab>>gt[ngood].code>> + 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<GetITSgeom(); if (!geom) { - cerr<<"cen't get ITS geometry !\n"; exit(9); + cerr<<"can't get ITS geometry !\n"; exit(9); } TFile *cf=TFile::Open("AliITSclustersV2.root"); if (!cf->IsOpen()){ cerr<<"Can't open AliITSclustersV2.root !\n"; exit(6); } - TTree *cTree=(TTree*)cf->Get("cTree"); + TTree *cTree=(TTree*)cf->Get("TreeC_ITS_0"); if (!cTree) { cerr<<"Can't get cTree !\n"; exit(7); } @@ -283,12 +288,12 @@ Int_t good_tracks(GoodTrack *gt, Int_t max) { Int_t entr=(Int_t)cTree->GetEntries(); for (k=0; kGetEvent(k)) continue; + cTree->GetEvent(k); + Int_t ncl=clusters->GetEntriesFast(); if (ncl==0) continue; Int_t lay,lad,det; geom->GetModuleId(k,lay,lad,det); if (lay<1 || lay>6) { cerr<<"wrong layer !\n"; exit(10); } - Int_t ncl=clusters->GetEntriesFast(); while (ncl--) { AliITSclusterV2 *pnt=(AliITSclusterV2*)clusters->UncheckedAt(ncl); Int_t l0=pnt->GetLabel(0); @@ -301,6 +306,7 @@ Int_t good_tracks(GoodTrack *gt, Int_t max) { } } clusters->Delete(); delete clusters; + delete cTree; //Thanks to Mariana Bondila cf->Close(); ifstream in("good_tracks_tpc"); @@ -309,10 +315,11 @@ Int_t good_tracks(GoodTrack *gt, Int_t max) { } Int_t nt=0; Double_t px,py,pz,x,y,z; - Int_t code,lab; - while (in>>lab>>code>>px>>py>>pz>>x>>y>>z) { + Int_t code,lab,event; + while (in>>event>>lab>>code>>px>>py>>pz>>x>>y>>z) { if (good[lab] != 0x3F) continue; TParticle *p = (TParticle*)gAlice->Particle(lab); + gt[nt].event=event; gt[nt].lab=lab; gt[nt].code=p->GetPdgCode(); //**** px py pz - in global coordinate system diff --git a/ITS/AliITSFindClustersV2.C b/ITS/AliITSFindClustersV2.C index 0e06e7044dd..bc82fa92ded 100644 --- a/ITS/AliITSFindClustersV2.C +++ b/ITS/AliITSFindClustersV2.C @@ -1,4 +1,6 @@ #ifndef __CINT__ + #include + #include "AliRun.h" #include "AliITS.h" #include "AliITSgeom.h" @@ -41,14 +43,15 @@ Int_t AliITSFindClustersV2() { gAlice->MakeTree("R"); ITS->MakeBranch("R",0); //////////////// Taken from ITSHitsToFastPoints.C /////////////////////// - AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints(); - for (Int_t i=0;i<3;i++) { ITS->SetSimulationModel(i,sim); } - + ITS->SetSimulationModel(0,new AliITSsimulationFastPoints()); + ITS->SetSimulationModel(1,new AliITSsimulationFastPoints()); + ITS->SetSimulationModel(2,new AliITSsimulationFastPoints()); Int_t nsignal=25; Int_t size=-1; Int_t bgr_ev=Int_t(ev/nsignal); ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," "); ////////////////////////////////////////////////////////////////////////// + delete gAlice; gAlice=0; in->Close(); @@ -79,11 +82,12 @@ Int_t AliITSFindClustersV2() { geom->Write(); TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000); - TTree *cTree=new TTree("cTree","ITS clusters"); + //TTree *cTree=new TTree("cTree","ITS clusters"); + TTree *cTree=new TTree("TreeC_ITS_0","ITS clusters"); cTree->Branch("Clusters",&clusters); TTree *pTree=gAlice->TreeR(); - if (!pTree) { + if (!pTree) { cerr<<"Can't get TreeR !\n"; return 7; } @@ -102,13 +106,14 @@ Int_t AliITSFindClustersV2() { cerr<<"Number of entries: "<GetEvent(i)) {cTree->Fill(); continue;} + points->Clear(); + pTree->GetEvent(i); + Int_t ncl=points->GetEntriesFast(); if (ncl==0){cTree->Fill();continue;} Int_t lay,lad,det; geom->GetModuleId(i,lay,lad,det); Float_t x,y,zshift; geom->GetTrans(lay,lad,det,x,y,zshift); Double_t rot[9]; geom->GetRotMatrix(lay,lad,det,rot); Double_t yshift = x*rot[0] + y*rot[1]; Int_t ndet=(lad-1)*geom->GetNdetectors(lay) + (det-1); - Int_t ncl=points->GetEntriesFast(); nclusters+=ncl; for (Int_t j=0; jUncheckedAt(j); @@ -147,10 +152,12 @@ Int_t AliITSFindClustersV2() { delete cTree; delete clusters; delete points; delete gAlice; gAlice=0; + in->Close(); out->Close(); return 0; + } diff --git a/ITS/AliITSFindTracksV2.C b/ITS/AliITSFindTracksV2.C index fa490266e8d..aa3ef1dcbf6 100644 --- a/ITS/AliITSFindTracksV2.C +++ b/ITS/AliITSFindTracksV2.C @@ -25,6 +25,8 @@ Int_t AliITSFindTracksV2() { Int_t rc=tracker.Clusters2Tracks(in,out); timer.Stop(); timer.Print(); + delete geom; //Thanks to Mariana Bondila + file->Close(); in->Close(); out->Close(); diff --git a/ITS/AliITStrackerV2.cxx b/ITS/AliITStrackerV2.cxx index 3b447b20266..1a499862a5a 100644 --- a/ITS/AliITStrackerV2.cxx +++ b/ITS/AliITStrackerV2.cxx @@ -92,11 +92,10 @@ if (phi<0) phi += 2*TMath::Pi(); try { //Read clusters - //MI change - char cname[100]; - sprintf(cname,"TreeC_ITS_%d",eventn); + //MI change + char cname[100]; + sprintf(cname,"TreeC_ITS_%d",eventn); TTree *cTree=(TTree*)gDirectory->Get(cname); - // TTree *cTree=(TTree*)gDirectory->Get("cTree"); if (!cTree) throw ("AliITStrackerV2::AliITStrackerV2 can't get cTree !\n"); @@ -111,7 +110,6 @@ if (phi<0) phi += 2*TMath::Pi(); Int_t nentr=(Int_t)cTree->GetEntries(); for (i=0; iGetEvent(i)) continue; - //Int_t lay,lad,det; g->GetModuleId(i-1,lay,lad,det); Int_t lay,lad,det; g->GetModuleId(i,lay,lad,det); Int_t ncl=clusters->GetEntriesFast(); while (ncl--) { @@ -131,6 +129,7 @@ cout<GetY()<<' '<GetZ()<Delete(); } + delete cTree; //Thanks to Mariana Bondila } catch (const Char_t *msg) { cerr<Get(tname); - //TTree *tpcTree=(TTree*)in->Get("TPCf"); if (!tpcTree) { cerr<<"AliITStrackerV2::Clusters2Tracks() "; @@ -267,6 +265,8 @@ cout<cd(); - TTree *itsTree=(TTree*)in->Get("ITSf"); + TTree *itsTree=(TTree*)in->Get("TreeT_ITS_0"); if (!itsTree) { cerr<<"AliITStrackerV2::PropagateBack() "; cerr<<"can't get a tree with ITS tracks !\n"; @@ -302,7 +302,7 @@ Int_t AliITStrackerV2::PropagateBack(const TFile *inp, TFile *out) { itsTree->SetBranchAddress("tracks",&itrack); out->cd(); - TTree backTree("ITSb","Tree with back propagated ITS tracks"); + TTree backTree("TreeT_ITSb_0","Tree with back propagated ITS tracks"); AliTPCtrack *otrack=0; backTree.Branch("tracks","AliTPCtrack",&otrack,32000,0); @@ -454,6 +454,8 @@ for (Int_t k=0; k