]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Implementation of FindVertexForCurrentEvent
authormasera <massimo.masera@cern.ch>
Mon, 24 Feb 2014 17:48:22 +0000 (18:48 +0100)
committermasera <massimo.masera@cern.ch>
Mon, 24 Feb 2014 17:48:48 +0000 (18:48 +0100)
ITS/UPGRADE/AliITSUVertexer.cxx
ITS/UPGRADE/AliITSUVertexer.h

index c79c61378504ed0b97459c38055cec7fb52a5d3c..d115080f5c3f60085e397bfc1ee38225684e2eb6 100644 (file)
@@ -1,15 +1,16 @@
 #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;
@@ -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;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]);
   }
 }
 
index 8c070ff6a8d3b22f6d3a7a6b823edd8944ce2458..cacca2c702b4af1c91cbe0939da12299c880384f 100644 (file)
@@ -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;