SetBinWidthFine(0.);
SetTolerance(0.);
SetPPsetting(0.,0.);
+ ConfigIterations();
}
//______________________________________________________________________
SetBinWidthFine();
SetTolerance();
SetPPsetting();
+ ConfigIterations();
}
delete fZCombv;
}
+//______________________________________________________________________
+void AliITSVertexerZ::ConfigIterations(Int_t noiter,Float_t *ptr){
+ // configure the iterative procedure to gain efficiency for
+ // pp events with very low multiplicity
+ Float_t defaults[5]={0.05,0.1,0.2,0.3,0.5};
+ fMaxIter=noiter;
+ if(noiter>5){
+ Error("ConfigIterations","Maximum number of iterations is 5\n");
+ fMaxIter=5;
+ }
+ for(Int_t j=0;j<5;j++)fPhiDiffIter[j]=defaults[j];
+ if(ptr)for(Int_t j=0;j<fMaxIter;j++)fPhiDiffIter[j]=ptr[j];
+}
+
//______________________________________________________________________
AliESDVertex* AliITSVertexerZ::FindVertexForCurrentEvent(Int_t evnumber){
// Defines the AliESDVertex for the current event
-
+ VertexZFinder(evnumber);
+ Int_t ntrackl=0;
+ for(Int_t iteraz=0;iteraz<fMaxIter;iteraz++){
+ if(fCurrentVertex) ntrackl=fCurrentVertex->GetNContributors();
+ if(!fCurrentVertex || ntrackl==0 || ntrackl==-1){
+ Float_t diffPhiMaxOrig=fDiffPhiMax;
+ fDiffPhiMax=GetPhiMaxIter(iteraz);
+ VertexZFinder(evnumber);
+ fDiffPhiMax=diffPhiMaxOrig;
+ }
+ }
+
+ return fCurrentVertex;
+}
+
+//______________________________________________________________________
+void AliITSVertexerZ::VertexZFinder(Int_t evnumber){
+ // Defines the AliESDVertex for the current event
fCurrentVertex = 0;
AliRunLoader *rl =AliRunLoader::GetRunLoader();
AliITSLoader* itsLoader = (AliITSLoader*)rl->GetLoader("ITSLoader");
}
if(nrpL1 == 0 || nrpL2 == 0){
ResetHistograms();
- return fCurrentVertex;
+ itsLoader->UnloadRecPoints();
+ fCurrentVertex = new AliESDVertex(0.,5.3,-2);
+ return;
}
// The vertex finding is attempted only if the number of RP is !=0 on
// both layers
delete [] yc2;
delete [] zc2;
delete [] phi2;
- if(fZCombc->GetEntries()==0){
- Warning("FindVertexForCurrentEvent","Insufficient number of rec. points\n");
+ Double_t contents = fZCombc->GetEntries()- fZCombc->GetBinContent(0)-fZCombc->GetBinContent(nbincoarse+1);
+ if(contents<1.){
+ // Warning("FindVertexForCurrentEvent","Insufficient number of rec. points\n");
ResetHistograms();
- return fCurrentVertex;
+ itsLoader->UnloadRecPoints();
+ fCurrentVertex = new AliESDVertex(0.,5.3,-1);
+ return;
}
/*
else {
centre+= hc->GetBinCenter(ii)*hc->GetBinContent(ii);
nn+=static_cast<Int_t>(hc->GetBinContent(ii));
}
- // PH Sometimes nn is 0, so we need a protection
if (nn) centre/=nn;
/*
if(fDebug>0){
goon = TMath::Abs(TMath::Abs(fZFound-fZCombf->GetBinCenter(n1))-TMath::Abs(fZFound-fZCombf->GetBinCenter(n2)))>fTolerance;
// a window in the fine grained histogram is centered aroung the found Z. The width is 2 bins of
// the coarse grained histogram
- n1 = static_cast<Int_t>((fZFound-hc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fStepFine);
- if(n1<1)n1=1;
- n2 = static_cast<Int_t>((fZFound+hc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fStepFine);
- if(n2>nbinfine)n2=nbinfine;
- /*
- if(fDebug>0){
- cout<<"Search restricted to n1 = "<<n1<<", n2= "<<n2<<endl;
- cout<<"z1= "<<fZCombf->GetBinCenter(n1)<<", n2 = "<<fZCombf->GetBinCenter(n2)<<endl;
+ if(num>0){
+ n1 = static_cast<Int_t>((fZFound-hc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fStepFine);
+ if(n1<1)n1=1;
+ n2 = static_cast<Int_t>((fZFound+hc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fStepFine);
+ if(n2>nbinfine)n2=nbinfine;
+ /*
+ if(fDebug>0){
+ cout<<"Search restricted to n1 = "<<n1<<", n2= "<<n2<<endl;
+ cout<<"z1= "<<fZCombf->GetBinCenter(n1)<<", n2 = "<<fZCombf->GetBinCenter(n2)<<endl;
+ }
+ */
+ }
+ else {
+ n1 = static_cast<Int_t>((centre-(niter+2)*hc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fStepFine);
+ n2 = static_cast<Int_t>((centre+(niter+2)*hc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fStepFine);
+ if(n1<1)n1=1;
+ if(n2>nbinfine)n2=nbinfine;
}
- */
niter++;
// no more than 10 adjusting iterations
if(niter>=10){
goon = kFALSE;
- Warning("FindVertexForCurrentEvent","The procedure dows not converge\n");
+ // Warning("FindVertexForCurrentEvent","The procedure does not converge\n");
}
if((fZsig> 0.0001) && !goon && num>5){
fCurrentVertex = new AliESDVertex(fZFound,fZsig,num);
fCurrentVertex->SetTitle("vertexer: B");
ResetHistograms();
- return fCurrentVertex;
+ itsLoader->UnloadRecPoints();
+ return;
}
//_____________________________________________________________________
AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
itsLoader->ReloadRecPoints();
for(Int_t i=fFirstEvent;i<=fLastEvent;i++){
- cout<<"Processing event "<<i<<endl;
+ // cout<<"Processing event "<<i<<endl;
rl->GetEvent(i);
FindVertexForCurrentEvent(i);
if(fCurrentVertex){
AliITSVertexerZ();
AliITSVertexerZ(TString filename,Float_t x0=0., Float_t y0=0.);
virtual ~AliITSVertexerZ();
+ // The number of contributors set in the AliESDVertex object is the
+ // number of tracklets used to determine the vertex position
+ // If this number is <1, the procedure could not find a vertex position
+ // and by default the Z coordinate is set to 0
+ // Number of contributors = -1 --> No tracklets
+ // Number of contributors = -2 --> No SPD recpoints
virtual AliESDVertex* FindVertexForCurrentEvent(Int_t evnumb);
virtual void FindVertices();
virtual void PrintStatus() const;
void SetDiffPhiMax(Float_t pm = 0.01){fDiffPhiMax = pm;}
+ void ConfigIterations(Int_t noiter=3,Float_t *ptr=0);
void SetFirstLayerModules(Int_t m1 = 0, Int_t m2 = 79){fFirstL1 = m1; fLastL1 = m2;}
void SetSecondLayerModules(Int_t m1 = 80, Int_t m2 = 239){fFirstL2 = m1; fLastL2 = m2;}
void SetLowLimit(Float_t lim=-20.){fLowLim = lim;}
AliITSVertexerZ(const AliITSVertexerZ& vtxr);
AliITSVertexerZ& operator=(const AliITSVertexerZ& /* vtxr */);
void ResetHistograms();
+ void VertexZFinder(Int_t evnumber);
+ Float_t GetPhiMaxIter(Int_t i) const {return fPhiDiffIter[i];}
Int_t fFirstL1; // first module of the first pixel layer used
Int_t fLastL1; // last module of the first pixel layer used
Float_t fStepFine; // bin width for fZCombf
Float_t fTolerance; // tolerance on the symmetry of the Z interval
Float_t fPPsetting[2]; // [0] is the max. number of clusters on L2 to use [1] as fStepCoarse
+ Int_t fMaxIter; // Maximum number of iterations (<=5)
+ Float_t fPhiDiffIter[5]; // Delta phi used in iterations
- ClassDef(AliITSVertexerZ,3);
+ ClassDef(AliITSVertexerZ,4);
};
#endif