#include <Riostream.h>
+#include <TBranch.h>
+#include <TClonesArray.h>
#include <TMath.h>
#include <TString.h>
-#include <TClonesArray.h>
-#include <TSystem.h>
+#include <TTree.h>
#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;
}
//______________________________________________________________________
-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];
}
//_____________________________________________________________________________________________
}
//___________________________________________________________________________
-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;k<nocl;++k) {
- AliITSUClusterPix* cl=(AliITSUClusterPix*)clr->At(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;k<nocl;++k) {
+ AliITSUClusterPix* cl=(AliITSUClusterPix*)clr->At(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]);
}
}
// 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
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;