]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSVertexerZ.cxx
Update of TPC responsibles
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerZ.cxx
index 1fc981571cb607163300f728de0f777081de1187..798b9fb1b3ed5cc65ddd1a4df9ccc430085d26d5 100644 (file)
@@ -32,6 +32,8 @@
 // It can be used successfully with Pb-Pb collisions
 ////////////////////////////////////////////////////////////////
 
+using std::endl;
+using std::cout;
 ClassImp(AliITSVertexerZ)
 
 
@@ -51,7 +53,9 @@ fHighLim(0.),
 fStepCoarse(0),
 fTolerance(0.),
 fMaxIter(0),
-fWindowWidth(0) {
+fWindowWidth(0),
+fSearchForPileup(kTRUE)
+{
   // Default constructor
   SetDiffPhiMax();
   SetFirstLayerModules();
@@ -80,7 +84,9 @@ fHighLim(0.),
 fStepCoarse(0),
 fTolerance(0.),
 fMaxIter(0),
-fWindowWidth(0) {
+fWindowWidth(0),
+fSearchForPileup(kTRUE)
+{
   // Standard Constructor
   SetDiffPhiMax();
   SetFirstLayerModules();
@@ -187,21 +193,23 @@ AliESDVertex* AliITSVertexerZ::FindVertexForCurrentEvent(TTree *itsClusterTree){
 //______________________________________________________________________
 void AliITSVertexerZ::VertexZFinder(TTree *itsClusterTree){
   // Defines the AliESDVertex for the current event
+  delete fCurrentVertex;
   fCurrentVertex = 0;
+  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]};
   ResetVertex();
   TClonesArray *itsRec  = 0;
   // lc1 and gc1 are local and global coordinates for layer 1
-  Float_t lc1[3]={0.,0.,0.}; // for(Int_t ii=0; ii<3; ii++) lc1[ii]=0.;
   Float_t gc1[3]={0.,0.,0.}; // ; for(Int_t ii=0; ii<3; ii++) gc1[ii]=0.;
   // lc2 and gc2 are local and global coordinates for layer 2
-  Float_t lc2[3]={0.,0.,0.}; // ; for(Int_t ii=0; ii<3; ii++) lc2[ii]=0.;
   Float_t gc2[3]={0.,0.,0.}; //; for(Int_t ii=0; ii<3; ii++) gc2[ii]=0.;
   AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
-  itsRec=rpcont->FetchClusters(0,itsClusterTree);
+  rpcont->FetchClusters(0,itsClusterTree);
   if(!rpcont->IsSPDActive()){
     AliWarning("Null pointer for RecPoints branch, vertex not calculated");
     ResetHistograms();
-    fCurrentVertex = new AliESDVertex(0.,5.3,-2);
+    fCurrentVertex = new AliESDVertex(startPos,startCov,99999.,-2);
     return;
   }
 
@@ -213,7 +221,7 @@ void AliITSVertexerZ::VertexZFinder(TTree *itsClusterTree){
   if(nrpL1 == 0 || nrpL2 == 0){
     AliDebug(1,Form("No RecPoints in at least one SPD layer (%d %d)",nrpL1,nrpL2));
     ResetHistograms();
-    fCurrentVertex = new AliESDVertex(0.,5.3,-2);
+    fCurrentVertex = new AliESDVertex(startPos,startCov,99999.,-2);
     return;
   }
   // Force a coarse bin size of 200 microns if the number of clusters on layer 2
@@ -267,6 +275,7 @@ void AliITSVertexerZ::VertexZFinder(TTree *itsClusterTree){
          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=recpArr[modul2]; // rpcont->UncheckedGetClusters(modul2);
          Int_t nrecp2 = nEntriesMod[modul2]; // itsRec->GetEntries();
@@ -310,7 +319,7 @@ void AliITSVertexerZ::VertexZFinder(TTree *itsClusterTree){
   if(contents<1.){
     //    Warning("FindVertexForCurrentEvent","Insufficient number of rec. points\n");
     ResetHistograms();
-    fCurrentVertex = new AliESDVertex(0.,5.3,-1);
+    fCurrentVertex = new AliESDVertex(startPos,startCov,99999.,-1);
     points.Clear();
     return;
   }
@@ -345,7 +354,7 @@ void AliITSVertexerZ::VertexZFinder(TTree *itsClusterTree){
     zm=0.;
     ezm=0.;
     ncontr=0;
-    for(Int_t i =0; i<points.GetEntries(); i++){
+    for(Int_t i =0; i<points.GetEntriesFast(); i++){
       AliITSZPoint* p=(AliITSZPoint*)points.UncheckedAt(i);
       if(p->GetZ()>lim1 && p->GetZ()<lim2){
         Float_t deno = p->GetErrZ();
@@ -361,12 +370,14 @@ void AliITSVertexerZ::VertexZFinder(TTree *itsClusterTree){
     niter++;
   } while(niter<10 && TMath::Abs((zm-lim1)-(lim2-zm))>fTolerance);
   if(nPeaks==2) ezm=widthSR;
-  fCurrentVertex = new AliESDVertex(zm,ezm,ncontr);
+  Double_t position[3]={GetNominalPos()[0],GetNominalPos()[1],zm};
+  Double_t covmatrix[6]={GetNominalCov()[0],0.,GetNominalCov()[2],0.,0.,ezm};
+  fCurrentVertex = new AliESDVertex(position,covmatrix,99999.,ncontr);
   fCurrentVertex->SetTitle("vertexer: Z");
   fCurrentVertex->SetDispersion(fDiffPhiMax);
   fNoVertices=1;
   points.Clear();
-  if(ncontr>fMinTrackletsForPilup){ 
+  if(fSearchForPileup && ncontr>fMinTrackletsForPilup){ 
     Float_t secPeakPos;
     Int_t ncontr2=FindSecondPeak(fZCombc,binmin,binmax,secPeakPos);
     if(ncontr2>=fMinTrackletsForPilup){ 
@@ -390,7 +401,9 @@ void AliITSVertexerZ::VertexZFinder(TTree *itsClusterTree){
 }
 
 //_____________________________________________________________________
-Int_t AliITSVertexerZ::FindSecondPeak(TH1F* h, Int_t binmin,Int_t binmax, Float_t& secPeakPos){  
+Int_t AliITSVertexerZ::FindSecondPeak(TH1F* h, Int_t binmin,Int_t binmax, Float_t& secPeakPos){ 
+  // Resets bin contents between binmin and binmax and then search 
+  // for a second peak position 
   for(Int_t i=binmin-1;i<=binmax+1;i++){
     h->SetBinContent(i,0.);
   }