]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSVertexer3D.cxx
Add Reaction Plane
[u/mrichter/AliRoot.git] / ITS / AliITSVertexer3D.cxx
index e9c67445d6570a2a0ddf48036b8f31599764fd19..679b6d7feb2d7bb0d7ec602a4875e65e98d0f1fb 100644 (file)
@@ -487,7 +487,7 @@ Int_t AliITSVertexer3D::FindTracklets(TTree *itsClusterTree, Int_t optCuts){
   Float_t gc2f[3]={0.,0.,0.};
   Double_t gc2[3]={0.,0.,0.};
   AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
-  itsRec=rpcont->FetchClusters(0,itsClusterTree);
+  rpcont->FetchClusters(0,itsClusterTree);
   if(!rpcont->IsSPDActive()){
     AliWarning("No SPD rec points found, 3D vertex not calculated");
     return -1;
@@ -554,7 +554,7 @@ Int_t AliITSVertexer3D::FindTracklets(TTree *itsClusterTree, Int_t optCuts){
 
   Int_t nolines = 0;
   // Loop on modules of layer 1
-  Int_t firstL1 = AliITSgeomTGeo::GetModuleIndex(1,1,1);
+  Int_t firstL1 = TMath::Max(0,AliITSgeomTGeo::GetModuleIndex(1,1,1));
   Int_t lastL1 = AliITSgeomTGeo::GetModuleIndex(2,1,1)-1;
   for(Int_t modul1= firstL1; modul1<=lastL1;modul1++){   // Loop on modules of layer 1
     if(!fUseModule[modul1]) continue;
@@ -719,9 +719,10 @@ Int_t  AliITSVertexer3D::Prepare3DVertex(Int_t optCuts){
   TH3F *h3dcs = new TH3F("h3dcs","xyz distribution",nbrcs,rl,rh,nbrcs,rl,rh,nbzcs,zl,zh);
 
   // cleanup of the TCLonesArray of tracklets (i.e. fakes are removed)
-  Int_t *validate = new Int_t [fLines.GetEntriesFast()];
-  for(Int_t i=0; i<fLines.GetEntriesFast();i++)validate[i]=0;
-  for(Int_t i=0; i<fLines.GetEntriesFast()-1;i++){
+  Int_t vsiz = fLines.GetEntriesFast();
+  Int_t *validate = new Int_t [vsiz];
+  for(Int_t i=0; i<vsiz;i++)validate[i]=0;
+  for(Int_t i=0; i<vsiz-1;i++){
     AliStrLine *l1 = (AliStrLine*)fLines.At(i);
     for(Int_t j=i+1;j<fLines.GetEntriesFast();j++){
       AliStrLine *l2 = (AliStrLine*)fLines.At(j);
@@ -748,7 +749,7 @@ Int_t  AliITSVertexer3D::Prepare3DVertex(Int_t optCuts){
 
 
   Int_t numbtracklets=0;
-  for(Int_t i=0; i<fLines.GetEntriesFast();i++)if(validate[i]>=1)numbtracklets++;
+  for(Int_t i=0; i<vsiz;i++)if(validate[i]>=1)numbtracklets++;
   if(numbtracklets<2){
     delete [] validate; 
     delete h3d; 
@@ -994,28 +995,35 @@ Int_t AliITSVertexer3D::RemoveTracklets(){
 //________________________________________________________
 void AliITSVertexer3D::FindOther3DVertices(TTree *itsClusterTree){
   // pileup identification based on 3D vertexing with not used clusters
-  MarkUsedClusters();
-  fLines.Clear("C");
-  Int_t nolines = FindTracklets(itsClusterTree,2);
-  if(nolines>=2){
-    Int_t nr=RemoveTracklets();
-    nolines-=nr;
+
+  fVertArray = new AliESDVertex[kMaxPileupVertices+1];
+  fVertArray[0]=(*fCurrentVertex);
+  Int_t nFoundVert=1;
+  for(Int_t iPilV=1; iPilV<=kMaxPileupVertices; iPilV++){
+    MarkUsedClusters();
+    fLines.Clear("C");
+    Int_t nolines = FindTracklets(itsClusterTree,2);
     if(nolines>=2){
-      Int_t rc=Prepare3DVertex(2);
-      if(rc==0){ 
-       fVert3D=AliVertexerTracks::TrackletVertexFinder(&fLines,0);
-       if(fVert3D.GetNContributors()>=fMinTrackletsForPilup){
-         fIsPileup=kTRUE;
-         fNoVertices=2;
-         fVertArray = new AliESDVertex[2];
-         fVertArray[0]=(*fCurrentVertex);
-         fVertArray[1]=fVert3D;
-         fZpuv=fVert3D.GetZv();
-         fNTrpuv=fVert3D.GetNContributors();
+      Int_t nr=RemoveTracklets();
+      nolines-=nr;
+      if(nolines>=2){
+       Int_t rc=Prepare3DVertex(2);
+       if(rc==0){ 
+         fVert3D=AliVertexerTracks::TrackletVertexFinder(&fLines,0);
+         if(fVert3D.GetNContributors()>=fMinTrackletsForPilup){
+           fIsPileup=kTRUE;
+           fVertArray[nFoundVert]=fVert3D;
+           nFoundVert++;
+           if(nFoundVert==2){
+             fZpuv=fVert3D.GetZv();
+             fNTrpuv=fVert3D.GetNContributors();
+           }
+         }
        }
       }
     }
   }
+  fNoVertices=nFoundVert;
 }
 //______________________________________________________________________
 void AliITSVertexer3D::PileupFromZ(){