From 507265fdf6edb20bed8f02e281fd118431deed81 Mon Sep 17 00:00:00 2001 From: masera Date: Mon, 27 Sep 2010 07:34:33 +0000 Subject: [PATCH] 3D vertexer fixed in order to work with PbPb (F.Prino) --- ITS/AliITSVertexer3D.cxx | 82 ++++++++++++++++++++++++++++++++++++++-- ITS/AliITSVertexer3D.h | 5 ++- 2 files changed, 83 insertions(+), 4 deletions(-) diff --git a/ITS/AliITSVertexer3D.cxx b/ITS/AliITSVertexer3D.cxx index 176aa9b8766..b9460f1a0c8 100644 --- a/ITS/AliITSVertexer3D.cxx +++ b/ITS/AliITSVertexer3D.cxx @@ -63,7 +63,9 @@ AliITSVertexer3D::AliITSVertexer3D(): fBinSizeR(0.), fBinSizeZ(0.), fPileupAlgo(0), - fMaxNumOfCl(fgkMaxNumOfClDefault) + fMaxNumOfCl(fgkMaxNumOfClDefault), + fDoDownScale(kFALSE), + fGenerForDownScale(0) { // Default constructor SetCoarseDiffPhiCut(); @@ -86,6 +88,7 @@ AliITSVertexer3D::AliITSVertexer3D(): Double_t binsize=0.02; // default 200 micron Int_t nbins=static_cast(1+2*fZCutDiamond/binsize); fZHisto=new TH1F("hz","",nbins,-fZCutDiamond,-fZCutDiamond+binsize*nbins); + fGenerForDownScale=new TRandom3(987654321); } //______________________________________________________________________ @@ -93,6 +96,7 @@ AliITSVertexer3D::~AliITSVertexer3D() { // Destructor fLines.Clear("C"); if(fZHisto) delete fZHisto; + if(fGenerForDownScale) delete fGenerForDownScale; } //______________________________________________________________________ @@ -522,9 +526,23 @@ Int_t AliITSVertexer3D::FindTracklets(TTree *itsClusterTree, Int_t optCuts){ return -1; } AliDebug(1,Form("RecPoints on Layer 1,2 = %d, %d\n",nrpL1,nrpL2)); + fDoDownScale=kFALSE; + Float_t factDownScal=1.; + Int_t origLaddersOnLayer2=fLadOnLay2; + if(nrpL1>fMaxNumOfCl || nrpL2>fMaxNumOfCl){ - AliWarning(Form("Too many recpoints on SPD(%d %d ), call vertexerZ",nrpL1,nrpL2)); - return -1; + SetLaddersOnLayer2(2); + fDoDownScale=kTRUE; + factDownScal=(Float_t)fMaxNumOfCl*(Float_t)fMaxNumOfCl/(Float_t)nrpL1/(Float_t)nrpL2; + if(optCuts==1){ + factDownScal*=(fCoarseDiffPhiCut/fDiffPhiMax)*10; + if(factDownScal>1.){ + fDoDownScale=kFALSE; + SetLaddersOnLayer2(origLaddersOnLayer2); + } + } + else if(optCuts==2) return -1; + if(fDoDownScale)AliDebug(1,Form("Too many recpoints on SPD(%d %d ), downscale by %f",nrpL1,nrpL2,factDownScal)); } Double_t a[3]={xbeam,ybeam,0.}; @@ -539,6 +557,7 @@ Int_t AliITSVertexer3D::FindTracklets(TTree *itsClusterTree, Int_t optCuts){ Int_t lastL1 = AliITSgeomTGeo::GetModuleIndex(2,1,1)-1; for(Int_t modul1= firstL1; modul1<=lastL1;modul1++){ // Loop on modules of layer 1 if(!fUseModule[modul1]) continue; + UShort_t ladder=modul1/4+1; // ladders are numbered starting from 1 TClonesArray *prpl1=rpcont->UncheckedGetClusters(modul1); Int_t nrecp1 = prpl1->GetEntries(); @@ -546,6 +565,7 @@ Int_t AliITSVertexer3D::FindTracklets(TTree *itsClusterTree, Int_t optCuts){ if(j>kMaxCluPerMod) continue; UShort_t idClu1=modul1*kMaxCluPerMod+j; if(fUsedCluster.TestBitNumber(idClu1)) continue; + if(fDoDownScale && fGenerForDownScale->Rndm()>factDownScal) continue; AliITSRecPoint *recp1 = (AliITSRecPoint*)prpl1->At(j); recp1->GetGlobalXYZ(gc1f); for(Int_t ico=0;ico<3;ico++)gc1[ico]=gc1f[ico]; @@ -564,6 +584,7 @@ Int_t AliITSVertexer3D::FindTracklets(TTree *itsClusterTree, Int_t optCuts){ if(j2>kMaxCluPerMod) continue; UShort_t idClu2=modul2*kMaxCluPerMod+j2; if(fUsedCluster.TestBitNumber(idClu2)) continue; + AliITSRecPoint *recp2 = (AliITSRecPoint*)itsRec->At(j2); recp2->GetGlobalXYZ(gc2f); for(Int_t ico=0;ico<3;ico++)gc2[ico]=gc2f[ico]; @@ -590,6 +611,7 @@ Int_t AliITSVertexer3D::FindTracklets(TTree *itsClusterTree, Int_t optCuts){ Double_t deltaZ=cp[2]-zvert; if(TMath::Abs(deltaZ)>dZmax)continue; + if(nolines == 0){ if(fLines.GetEntriesFast()>0)fLines.Clear("C"); } @@ -639,6 +661,12 @@ Int_t AliITSVertexer3D::FindTracklets(TTree *itsClusterTree, Int_t optCuts){ } } } + + if(fDoDownScale){ + SetLaddersOnLayer2(origLaddersOnLayer2); + } + + if(nolines == 0)return -2; return nolines; } @@ -669,6 +697,13 @@ Int_t AliITSVertexer3D::Prepare3DVertex(Int_t optCuts){ deltaR=fMaxRCut; } + Double_t origBinSizeR=fBinSizeR; + Double_t origBinSizeZ=fBinSizeZ; + if(fDoDownScale){ + SetBinSizeR(0.05); + SetBinSizeZ(0.05); + } + Double_t rl=-fCoarseMaxRCut; Double_t rh=fCoarseMaxRCut; Double_t zl=-fZCutDiamond; @@ -751,6 +786,47 @@ Int_t AliITSVertexer3D::Prepare3DVertex(Int_t optCuts){ } delete h3dcs; + // Finer Histo in limited range in case of high mult. + if(fDoDownScale){ + SetBinSizeR(0.01); + SetBinSizeZ(0.01); + Double_t xl=peak[0]-0.3; + Double_t xh=peak[0]+0.3; + Double_t yl=peak[1]-0.3; + Double_t yh=peak[1]+0.3; + zl=peak[2]-0.5; + zh=peak[2]+0.5; + Int_t nbxfs=(Int_t)((xh-xl)/fBinSizeR+0.0001); + Int_t nbyfs=(Int_t)((yh-yl)/fBinSizeR+0.0001); + Int_t nbzfs=(Int_t)((zh-zl)/fBinSizeZ+0.0001); + + TH3F *h3dfs = new TH3F("h3dfs","xyz distribution",nbxfs,xl,xh,nbyfs,yl,yh,nbzfs,zl,zh); + for(Int_t i=0; iCross(l2,point); + if(retc<0)continue; + h3dfs->Fill(point[0],point[1],point[2]); + } + } + ntrkl=0; + ntimes=0; + + Double_t newpeak[3]={0.,0.,0.}; + FindPeaks(h3dfs,newpeak,ntrkl,ntimes); + if(ntimes==1){ + for(Int_t iCoo=0; iCoo<3; iCoo++) peak[iCoo]=newpeak[iCoo]; + binsizer=fBinSizeR; + binsizez=fBinSizeZ; + } + delete h3dfs; + SetBinSizeR(origBinSizeR); + SetBinSizeZ(origBinSizeZ); + } + + // Second selection loop Double_t bs=(binsizer+binsizez)/2.; diff --git a/ITS/AliITSVertexer3D.h b/ITS/AliITSVertexer3D.h index 6d05d9a4dfb..da1a25f08ea 100644 --- a/ITS/AliITSVertexer3D.h +++ b/ITS/AliITSVertexer3D.h @@ -12,6 +12,7 @@ /* $Id$ */ #include +#include #include #include #include @@ -100,10 +101,12 @@ protected: // 0->VertexerZ pileup algo // 1->Unused RecPoints algo Int_t fMaxNumOfCl; // max number of clusters on L1 or L2 + Bool_t fDoDownScale; // Control downscaling of tracklets in high mult + TRandom3 *fGenerForDownScale; // randomnumber generator fordownscaling static const Int_t fgkMaxNumOfClDefault; // Default max number of clusters - ClassDef(AliITSVertexer3D,13); + ClassDef(AliITSVertexer3D,14); }; -- 2.43.0