From aea3f062166516f80671696f8f73fcd65ef9f119 Mon Sep 17 00:00:00 2001 From: masera Date: Mon, 24 Feb 2014 18:48:22 +0100 Subject: [PATCH] Implementation of FindVertexForCurrentEvent --- ITS/UPGRADE/AliITSUVertexer.cxx | 67 +++++++++++++++++++-------------- ITS/UPGRADE/AliITSUVertexer.h | 11 +++--- 2 files changed, 43 insertions(+), 35 deletions(-) diff --git a/ITS/UPGRADE/AliITSUVertexer.cxx b/ITS/UPGRADE/AliITSUVertexer.cxx index c79c6137850..d115080f5c3 100644 --- a/ITS/UPGRADE/AliITSUVertexer.cxx +++ b/ITS/UPGRADE/AliITSUVertexer.cxx @@ -1,15 +1,16 @@ #include +#include +#include #include #include -#include -#include +#include #include "AliESDVertex.h" +#include "AliITSUClusterLines.h" #include "AliITSUClusterPix.h" #include "AliITSUVertexer.h" +#include "AliLog.h" #include "AliStrLine.h" #include "AliVertexerTracks.h" -#include "AliITSUClusterLines.h" -#include "AliLog.h" using TMath::Abs; using TMath::Sqrt; @@ -161,15 +162,21 @@ void AliITSUVertexer::FindVerticesForCurrentEvent() { } //______________________________________________________________________ -AliESDVertex* AliITSUVertexer::FindVertexForCurrentEvent(TTree *) +AliESDVertex* AliITSUVertexer::FindVertexForCurrentEvent(TTree *cluTree) { - Double_t startPos[3]={GetNominalPos()[0],GetNominalPos()[1],GetNominalPos()[2]}; - Double_t startCov[6]={GetNominalCov()[0],GetNominalCov()[1],GetNominalCov()[2], - GetNominalCov()[3],GetNominalCov()[4],GetNominalCov()[5]}; - AliESDVertex* vtx = new AliESDVertex(startPos,startCov,99999.,-2); - AliInfo("Creating dummy vertex from the mean vertex"); - vtx->Print(); - return vtx; +// Reconstruction of all the primary vertices in the event. It returns the vertex with the highest number of contributors. + Reset(); + for(Int_t i=0;i<3;++i) { + TBranch* br = cluTree->GetBranch(Form("ITSRecPoints%d",i)); + if (!br) return NULL; + br->SetAddress(&fClusters[i]); + } + cluTree->GetEntry(0); + + SortClusters(); + + FindVerticesForCurrentEvent(); + return &fVertices[0]; } //_____________________________________________________________________________________________ @@ -553,25 +560,27 @@ void AliITSUVertexer::FindTracklets() { } //___________________________________________________________________________ -void AliITSUVertexer::SetClusters(TClonesArray *clr, const UShort_t i) { +void AliITSUVertexer::SortClusters() { // Reading of the clusters on the first three layer of the upgraded ITS - fClusters[i]=clr; - Int_t nocl=clr->GetEntriesFast(); - if(nocl==0) { - fClusterPhi[i]=new Double_t[1]; - fClusterPhi[i][0]=-999999; - fClusterIndex[i]=new Int_t[1]; - fClusterIndex[i][0]=0; - } else { - fClusterPhi[i]=new Double_t[nocl]; - fClusterIndex[i]=new Int_t[nocl]; - for(Int_t k=0;kAt(k); - Double_t pt[3]; - cl->GetGlobalXYZ(pt); - fClusterPhi[i][k]=ATan2(pt[1],pt[0]); + for(Int_t i=0;i<3;++i) { + TClonesArray *clr=fClusters[i]; + Int_t nocl=clr->GetEntriesFast(); + if(nocl==0) { + fClusterPhi[i]=new Double_t[1]; + fClusterPhi[i][0]=-999999; + fClusterIndex[i]=new Int_t[1]; + fClusterIndex[i][0]=0; + } else { + fClusterPhi[i]=new Double_t[nocl]; + fClusterIndex[i]=new Int_t[nocl]; + for(Int_t k=0;kAt(k); + Double_t pt[3]; + cl->GetGlobalXYZ(pt); + fClusterPhi[i][k]=ATan2(pt[1],pt[0]); + } + BubbleLow(nocl,fClusterPhi[i],fClusterIndex[i]); } - BubbleLow(nocl,fClusterPhi[i],fClusterIndex[i]); } } diff --git a/ITS/UPGRADE/AliITSUVertexer.h b/ITS/UPGRADE/AliITSUVertexer.h index 8c070ff6a8d..cacca2c702b 100644 --- a/ITS/UPGRADE/AliITSUVertexer.h +++ b/ITS/UPGRADE/AliITSUVertexer.h @@ -24,19 +24,15 @@ class AliITSUVertexer : public AliVertexer { // Public methods virtual AliESDVertex* GetAllVertices(Int_t& nVert) const { nVert=fNoVertices; return (AliESDVertex*)&fVertices[0]; }; virtual AliESDVertex* FindVertexForCurrentEvent(TTree *); - void FindVerticesForCurrentEvent(); virtual void PrintStatus() const; - void Reset(); // Getters - UInt_t GetNoLines() const { return fNoLines; } + UInt_t GetNoLines() const { return fNoLines; } UShort_t GetNumOfVertices() const { return fNoVertices; } - // Setters - void SetClusters(TClonesArray *clr, const UShort_t i); void SetPhiCut(const Double_t phicut) { fPhiCut=phicut; } - void SetZCut(const Double_t zcut) { fZCut=zcut; } + void SetZCut(const Double_t zcut) { fZCut=zcut; } #ifdef MC_CHECK // Debug + MC truth @@ -55,8 +51,11 @@ class AliITSUVertexer : public AliVertexer { void Clusterize(UInt_t l1, UInt_t l2, Bool_t weight=kFALSE); void ComputeClusterCentroid(UInt_t cl); void FindTracklets(); + void FindVerticesForCurrentEvent(); Int_t MatchPoints(UShort_t layer, Double_t anchor, Double_t *p0=0x0, Double_t *p1=0x0); void MoveLabels(Short_t start, Short_t end); + void Reset(); + void SortClusters(); // Data members Int_t fClusterContribCut; -- 2.43.0