Fixes to use the vertexer within the standard reconstruction framework
authormasera <massimo.masera@cern.ch>
Thu, 27 Feb 2014 09:26:46 +0000 (10:26 +0100)
committermasera <massimo.masera@cern.ch>
Thu, 27 Feb 2014 09:26:46 +0000 (10:26 +0100)
ITS/UPGRADE/AliITSUVertexer.cxx
ITS/UPGRADE/AliITSUVertexer.h

index d115080..c08ce8e 100644 (file)
@@ -43,7 +43,7 @@ AliITSUVertexer::AliITSUVertexer(Double_t phicut, Double_t zcut, Double_t paircu
                                                                                                                  fZCut(zcut),
                                                                                                                  fUsedClusters(),
                                                                                                                  fUsedLines(),
-                                                                                                                 fVertices() 
+                                                                                                                 fVertices(NULL) 
 #ifdef MC_CHECK 
 ,fGoodLines(0),fGoodLinesPhi(0),fParticleId(0)
 #endif
@@ -63,7 +63,7 @@ void AliITSUVertexer::FindVerticesForCurrentEvent() {
   fNoVertices=0;
   FindTracklets();
   if(fNoLines<2) { 
-    fVertices.push_back(AliESDVertex());
+    //fVertices.push_back(AliESDVertex());
     return;// AliESDVertex();
   }
   
@@ -103,7 +103,6 @@ void AliITSUVertexer::FindVerticesForCurrentEvent() {
            fUsedLines[i3]=fNoClusters;
            current->GetVertex(p);
          }
-         //cout << "Ballo la ula" << endl;
        }
        ++fNoClusters;
        //cout << endl;
@@ -140,6 +139,7 @@ void AliITSUVertexer::FindVerticesForCurrentEvent() {
     }
   }
 
+  fVertices=new AliESDVertex[fNoClusters];
   for(Int_t i0=fNoClusters-1;i0>=0; --i0) {
     AliITSUClusterLines *clu0 = (AliITSUClusterLines*)fLinesClusters.At(i0);
     Int_t size=clu0->GetSize();
@@ -153,10 +153,9 @@ void AliITSUVertexer::FindVerticesForCurrentEvent() {
     clu0->GetVertex(p0);
     clu0->GetCovMatrix(cov);
     if((p0[0]*p0[0]+p0[1]*p0[1])<1.98*1.98) {
-      fVertices.push_back(AliESDVertex(p0,cov,99999.,size));   
+      fVertices[fNoVertices++]=AliESDVertex(p0,cov,99999.,size);   
     }
   }
-  fNoVertices=fVertices.size();
   
   return;// AliVertexerTracks::TrackletVertexFinder(&fLines,0);
 }
@@ -176,7 +175,8 @@ AliESDVertex* AliITSUVertexer::FindVertexForCurrentEvent(TTree *cluTree)
   SortClusters();
 
   FindVerticesForCurrentEvent();
-  return &fVertices[0];
+  if(fNoVertices<1) return NULL;
+  return new AliESDVertex(fVertices[0]);
 }  
 
 //_____________________________________________________________________________________________
@@ -426,10 +426,11 @@ void AliITSUVertexer::Reset() {
     delete []fUsedLines;
   }
 
+  delete[] fVertices;
+
   fLinesPhi=0;
   fLines.Clear();
   fLinesClusters.Clear();
-  fVertices.clear();
   
   #ifdef MC_CHECK
   fGoodLines=0;
index cacca2c..89e7e25 100644 (file)
@@ -22,7 +22,7 @@ class AliITSUVertexer : public AliVertexer {
   virtual ~AliITSUVertexer();
 
   // Public methods
-  virtual AliESDVertex* GetAllVertices(Int_t& nVert) const { nVert=fNoVertices; return (AliESDVertex*)&fVertices[0]; };
+  virtual AliESDVertex* GetAllVertices(Int_t& nVert) const { nVert=fNoVertices; return fVertices; };
   virtual AliESDVertex* FindVertexForCurrentEvent(TTree *); 
   virtual void PrintStatus() const;
 
@@ -74,7 +74,7 @@ class AliITSUVertexer : public AliVertexer {
   Double_t fZCut;                    // cut on deltatheta for cluster matching among first two layers and the third one
   Bool_t *fUsedClusters[3];          // flag for used clusters in tracklet formation
   Short_t *fUsedLines;               // flag for used lines
-  vector<AliESDVertex> fVertices;    // array of vertices
+  AliESDVertex *fVertices;           // array of vertices
 
   #ifdef MC_CHECK
   // MC truth methods