// p-p collisions
////////////////////////////////////////////////////////////////
-const Int_t AliITSVertexer3D::fgkMaxNumOfClDefault = 500;
+const Int_t AliITSVertexer3D::fgkMaxNumOfClDefault = 1000;
ClassImp(AliITSVertexer3D)
fBinSizeR(0.),
fBinSizeZ(0.),
fPileupAlgo(0),
- fMaxNumOfCl(fgkMaxNumOfClDefault)
+ fMaxNumOfCl(fgkMaxNumOfClDefault),
+ fDoDownScale(kFALSE),
+ fGenerForDownScale(0)
{
// Default constructor
SetCoarseDiffPhiCut();
Double_t binsize=0.02; // default 200 micron
Int_t nbins=static_cast<Int_t>(1+2*fZCutDiamond/binsize);
fZHisto=new TH1F("hz","",nbins,-fZCutDiamond,-fZCutDiamond+binsize*nbins);
+ fGenerForDownScale=new TRandom3(987654321);
}
//______________________________________________________________________
// Destructor
fLines.Clear("C");
if(fZHisto) delete fZHisto;
+ if(fGenerForDownScale) delete fGenerForDownScale;
}
//______________________________________________________________________
if(nolines>=2){
rc=Prepare3DVertex(1);
if(fPileupAlgo == 2 && rc == 0) FindVertex3DIterative();
- else if(fPileupAlgo<2 && rc == 0) FindVertex3D(itsClusterTree);
+ else if(fPileupAlgo!=2 && rc == 0) FindVertex3D(itsClusterTree);
if(rc!=0) fVert3D.SetNContributors(0); // exclude this vertex
}
}
switch(fPileupAlgo){
case 0: PileupFromZ(); break;
case 1: FindOther3DVertices(itsClusterTree); break;
+ case 3: break; // no pileup algo
default: AliError("Wrong pileup algorithm"); break;
}
if(fNoVertices==1){
Float_t gc2f[3]={0.,0.,0.};
Double_t gc2[3]={0.,0.,0.};
AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
- itsRec=rpcont->FetchClusters(0,itsClusterTree);
+ rpcont->FetchClusters(0,itsClusterTree);
if(!rpcont->IsSPDActive()){
AliWarning("No SPD rec points found, 3D vertex not calculated");
return -1;
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.};
Int_t nolines = 0;
// Loop on modules of layer 1
- Int_t firstL1 = AliITSgeomTGeo::GetModuleIndex(1,1,1);
+ Int_t firstL1 = TMath::Max(0,AliITSgeomTGeo::GetModuleIndex(1,1,1));
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();
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];
Int_t ladmod=fLadders[ladder-1]+ladl2;
if(ladmod>AliITSgeomTGeo::GetNLadders(2)) ladmod=ladmod-AliITSgeomTGeo::GetNLadders(2);
Int_t modul2=AliITSgeomTGeo::GetModuleIndex(2,ladmod,k+1);
+ if(modul2<0)continue;
if(!fUseModule[modul2]) continue;
itsRec=rpcont->UncheckedGetClusters(modul2);
Int_t nrecp2 = itsRec->GetEntries();
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];
Double_t deltaZ=cp[2]-zvert;
if(TMath::Abs(deltaZ)>dZmax)continue;
+
if(nolines == 0){
if(fLines.GetEntriesFast()>0)fLines.Clear("C");
}
}
}
}
+
+ if(fDoDownScale){
+ SetLaddersOnLayer2(origLaddersOnLayer2);
+ }
+
+
if(nolines == 0)return -2;
return nolines;
}
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;
TH3F *h3dcs = new TH3F("h3dcs","xyz distribution",nbrcs,rl,rh,nbrcs,rl,rh,nbzcs,zl,zh);
// cleanup of the TCLonesArray of tracklets (i.e. fakes are removed)
- Int_t *validate = new Int_t [fLines.GetEntriesFast()];
- for(Int_t i=0; i<fLines.GetEntriesFast();i++)validate[i]=0;
- for(Int_t i=0; i<fLines.GetEntriesFast()-1;i++){
+ Int_t vsiz = fLines.GetEntriesFast();
+ Int_t *validate = new Int_t [vsiz];
+ for(Int_t i=0; i<vsiz;i++)validate[i]=0;
+ for(Int_t i=0; i<vsiz-1;i++){
AliStrLine *l1 = (AliStrLine*)fLines.At(i);
for(Int_t j=i+1;j<fLines.GetEntriesFast();j++){
AliStrLine *l2 = (AliStrLine*)fLines.At(j);
Int_t numbtracklets=0;
- for(Int_t i=0; i<fLines.GetEntriesFast();i++)if(validate[i]>=1)numbtracklets++;
+ for(Int_t i=0; i<vsiz;i++)if(validate[i]>=1)numbtracklets++;
if(numbtracklets<2){
delete [] validate;
delete h3d;
}
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; i<fLines.GetEntriesFast()-1;i++){
+ AliStrLine *l1 = (AliStrLine*)fLines.At(i);
+ for(Int_t j=i+1;j<fLines.GetEntriesFast();j++){
+ AliStrLine *l2 = (AliStrLine*)fLines.At(j);
+ Double_t point[3];
+ Int_t retc = l1->Cross(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.;