From 170a4fc50523b5ee3348a8c1218e60f689f090b8 Mon Sep 17 00:00:00 2001 From: dibari Date: Mon, 27 Oct 2008 12:04:04 +0000 Subject: [PATCH] Database as TH2F removed + minors. --- HMPID/AliHMPIDReconHTA.cxx | 99 +++++++++++++++++++------------------- HMPID/AliHMPIDReconHTA.h | 9 ++-- HMPID/AliHMPIDTracker.cxx | 1 - 3 files changed, 53 insertions(+), 56 deletions(-) diff --git a/HMPID/AliHMPIDReconHTA.cxx b/HMPID/AliHMPIDReconHTA.cxx index 79127c76bd4..ef3f01c2ea1 100644 --- a/HMPID/AliHMPIDReconHTA.cxx +++ b/HMPID/AliHMPIDReconHTA.cxx @@ -33,9 +33,7 @@ #include //ShapeModel() #include "TStopwatch.h" // -TH2F* AliHMPIDReconHTA::fgDatabase = 0x0; -//TH2F* AliHMPIDReconHTA::fgDatabase = new TH2F("deconv","database;d1;d2;thC+1000*thTrk",500,0,50,150,0,15); -Int_t AliHMPIDReconHTA::fgDB[501][51]={25551*0}; +Int_t AliHMPIDReconHTA::fgDB[500][150]={75000*0}; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ AliHMPIDReconHTA::AliHMPIDReconHTA(): TTask("RichRec","RichPat"), @@ -278,27 +276,21 @@ Bool_t AliHMPIDReconHTA::FindShape(Double_t &thTrkRec,Double_t &phiTrkRec,Double Double_t xA,xB; status = kFALSE; - if(!ShapeModel(npeff,phiphotP,distP,xA,xB,phiTrkRec)) {Printf("ShapeModel failed "); return kFALSE;} + if(!ShapeModel(npeff,phiphotP,distP,xA,xB,phiTrkRec)) {/*Printf("ShapeModel failed ");*/ return kFALSE;} // if(xA > 50 || xB > 15) {Printf("xA and xB failed out of range"); return kFALSE;} - Int_t bin = fgDatabase->FindBin(xA,xB); - if(bin<=0) {Printf("bin < 0 ! failed "); return kFALSE;} - - Int_t compact = (Int_t)fgDatabase->GetBinContent(bin); + Int_t binxDB,binyDB; + FindBinDB(xA,xB,binxDB,binyDB); + if(binxDB<0 || binyDB<0) {/*Printf("bin < 0 ! failed ");*/ return kFALSE;} + Int_t compactDB = fgDB[binxDB][binyDB]; - if(compact<0) {Printf("compact< 0! failed "); return kFALSE;} + if(compactDB<0) {/*Printf("compact< 0! failed ");*/ return kFALSE;} // - Int_t binxDB,binyDB; - FindBinDB(xA,xB,binxDB,binyDB); - Int_t compactDB=0; - if(binxDB>0 && binyDB>0 ) compactDB = fgDB[binxDB][binyDB]; // - Printf("compact %i compactDB %i",compact,compactDB); - - thetaCRec = (Double_t)(compact%1000); - thTrkRec = (Double_t)(compact/1000); + thetaCRec = (Double_t)(compactDB%1000); + thTrkRec = (Double_t)(compactDB/1000); thTrkRec *= TMath::DegToRad(); thetaCRec *= TMath::DegToRad(); @@ -510,22 +502,25 @@ void AliHMPIDReconHTA::InitDatabase() // Construction a database of ring shapes on fly // Arguments: none // Returns : none -// N.B. fgDatabase points to a TH2I with x-min dist from MIP -// y-dist from the ring of the MIP perpendicular to major axis +// N.B. fgDB is the distance with x-min from MIP +// y-dist from the ring of the MIP perpendicular to major axis // The content is the packed info of track theta and thetaC in degrees // thetaC+1000*thTrk // // TFile *pout = new TFile("./database.root","recreate"); + static Bool_t isDone = kFALSE; + TStopwatch timer; - timer.Start(); - - - if(!fgDatabase) fgDatabase = new TH2F("deconv","database;d1;d2;thC+1000*thTrk",500,0,50,150,0,15); - if(fgDatabase->GetEntries()>=1) { - AliInfo("HTA database already built. "); + + if(isDone) { return; } + + if(!isDone) { + timer.Start(); + } + AliInfo(Form("database HTA is being built.Please, wait...")); // Double_t x[3]={0,0,0},y[3]; @@ -539,7 +534,6 @@ void AliHMPIDReconHTA::InitDatabase() Int_t nstepx = 1000; Int_t nstepy = 1000; -// TH2F *fgDatabase = new TH2F("deconv","database;d1;d2;thC+1000*thTrk",500,0,50,150,0,15); // Double_t xrad = 0; Double_t yrad = 0; @@ -594,20 +588,20 @@ void AliHMPIDReconHTA::InitDatabase() Double_t distB = TMath::Sqrt((x[2]-xmip)*(x[2]-xmip)+(y[2]-ymip)*(y[2]-ymip)); // compact the infos... Int_t compact = (Int_t)(thetaC*TMath::RadToDeg())+1000*(Int_t)(thTrk*TMath::RadToDeg()); - Int_t bin = fgDatabase->FindBin(distA,distB); - if(fgDatabase->GetBinContent(bin)==0) fgDatabase->Fill(distA,distB,compact); Int_t binxDB,binyDB; FindBinDB(distA,distB,binxDB,binyDB); - fgDB[binxDB][binyDB] = compact; + if(fgDB[binxDB][binyDB]==0) fgDB[binxDB][binyDB] = compact; } } FillZeroChan(); -// fgDatabase = deconv; - timer.Stop(); - Double_t nSecs = timer.CpuTime(); - AliInfo(Form("database HTA successfully open in %3.1f sec.(CPU). Reconstruction is started.",nSecs)); + if(!isDone) { + timer.Stop(); + Double_t nSecs = timer.CpuTime(); + AliInfo(Form("database HTA successfully open in %3.1f sec.(CPU). Reconstruction is started.",nSecs)); + isDone = kTRUE; + } // pout->Write(); // pout->Close(); @@ -621,28 +615,29 @@ void AliHMPIDReconHTA::FillZeroChan()const // Arguments: histogram pointer of the database // Returns: none // - Int_t nbinx = fgDatabase->GetNbinsX(); - Int_t nbiny = fgDatabase->GetNbinsY(); - for(Int_t i = 0;iGetBinContent(i,j) == 0) { - fgDatabase->SetCellContent(i,j,-1); + const Int_t nxDB = 500; + const Int_t nyDB = 150; + + for(Int_t i = 0;inbinx) continue; + if(ix<0||ix>=nxDB) continue; for(Int_t iy=nYmin;iy<=nYmax;iy++) { - if(iy<0||iy>nbiny) continue; - meanC += (Int_t)fgDatabase->GetBinContent(ix,iy)%1000; - meanTrk+= (Int_t)fgDatabase->GetBinContent(ix,iy)/1000; + if(iy<0||iy>=nyDB) continue; + meanC += (Int_t)(fgDB[ix][iy]%1000); + meanTrk+= (Int_t)(fgDB[ix][iy]/1000); nc++; } meanC/=nc; meanTrk/=nc; Int_t compact = (Int_t)meanC+1000*(Int_t)meanTrk; - if(compact>0)fgDatabase->SetCellContent(i,j,compact); + if(compact>0)fgDB[i][j] = compact; } } } @@ -772,7 +767,8 @@ Double_t AliHMPIDReconHTA::FindSimmPhi() //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void AliHMPIDReconHTA::FindBinDB(Double_t x,Double_t y,Int_t &binX,Int_t &binY) { - //const Int_t nxDB = 500; + const Int_t nxDB = 500; + const Int_t nyDB = 150; const Double_t xlowDB = 0; const Double_t xhigDB = 50; const Double_t ylowDB = 0; @@ -780,8 +776,13 @@ void AliHMPIDReconHTA::FindBinDB(Double_t x,Double_t y,Int_t &binX,Int_t &binY) binX = -1; binY = -1; - if(xxlowDB && - yylowDB) return; - binX = (Int_t)((x-xlowDB)/(xhigDB-xlowDB)); - binY = (Int_t)((y-ylowDB)/(yhigDB-ylowDB)); + if(xxhigDB && + yyhigDB) return; + binX = Int_t((x-xlowDB)/(xhigDB-xlowDB)*nxDB); + binY = Int_t((y-ylowDB)/(yhigDB-ylowDB)*nyDB); + if(binX>=nxDB || binY>=nyDB) { + binX = -1; + binY = -1; + } + } diff --git a/HMPID/AliHMPIDReconHTA.h b/HMPID/AliHMPIDReconHTA.h index cf686488772..7bd50f35f35 100644 --- a/HMPID/AliHMPIDReconHTA.h +++ b/HMPID/AliHMPIDReconHTA.h @@ -14,7 +14,6 @@ #include //base class -#include //InitDatabase() class TClonesArray; //CkovAngle() class AliESDtrack; //CkovAngle() @@ -30,8 +29,7 @@ public : void InitVars (Int_t n); //init space for variables void DeleteVars ()const; //delete variables void InitDatabase (); //initialization of database - TH2F* DBHTA () {return fgDatabase;} //pointer for HTA database of rings - void FindBinDB (Double_t x,Double_t y,Int_t &binX,Int_t &binY); //tmp new DB + void FindBinDB (Double_t x,Double_t y,Int_t &binX,Int_t &binY); //find indices of DB void FillZeroChan ()const; //complete the DB Bool_t CkovHiddenTrk (AliESDtrack *pTrk,TClonesArray *pClu,Int_t index, Double_t nmean); //Pattern recognition without trackinf information Bool_t CluPreFilter (TClonesArray *pClu ); //Pre clustering filter to cut bkg clusters @@ -85,14 +83,13 @@ protected: Double_t fCkovSig2; //estimated error^2 on ring Cherenkov angle AliHMPIDParam *fParam; //Pointer to AliHMPIDParam - static TH2F* fgDatabase; //database for ring shapes - static Int_t fgDB[501][51]; //tmp DB + static Int_t fgDB[500][150]; //tmp DB // private: AliHMPIDReconHTA(const AliHMPIDReconHTA& r); //dummy copy constructor AliHMPIDReconHTA &operator=(const AliHMPIDReconHTA& r); //dummy assignment operator // - ClassDef(AliHMPIDReconHTA,2) + ClassDef(AliHMPIDReconHTA,3) }; #endif // #ifdef AliHMPIDReconHTA_cxx diff --git a/HMPID/AliHMPIDTracker.cxx b/HMPID/AliHMPIDTracker.cxx index 73c09578acb..d84fd5c8480 100644 --- a/HMPID/AliHMPIDTracker.cxx +++ b/HMPID/AliHMPIDTracker.cxx @@ -352,7 +352,6 @@ Int_t AliHMPIDTracker::ReconHiddenTrk(AliESDEvent *pEsd,TObjArray *pClus,TObjArr } } // - Printf(" qthre %f nmean %f index %i cham %i",qthre,nmean,indMip,chMip); if(!reconHTA.CkovHiddenTrk(pTrk,(TClonesArray *)pClus->At(ipCh),indMip,nmean)) { //search for track parameters and Cerenkov angle of this track AliHMPIDPid pID; Double_t prob[5]; -- 2.39.3