]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSVertexer.cxx
New task to produce lightweight events for correlation analysis
[u/mrichter/AliRoot.git] / ITS / AliITSVertexer.cxx
index 0944a9b84346c0e485514001c68100cd57e11a0d..6ecff35c54fe813a2a63e2ebb5f23b8d8417f4f0 100644 (file)
@@ -1,10 +1,12 @@
 #include "AliLog.h"
 #include "AliMultiplicity.h"
 #include "AliITSgeomTGeo.h"
+#include "AliITSDetTypeRec.h"
 #include "AliITSVertexer.h"
 #include "AliITSLoader.h"
 #include "AliITSMultReconstructor.h"
 #include "AliITSRecPointContainer.h"
+#include "AliRunLoader.h"
 
 const Float_t AliITSVertexer::fgkPipeRadius = 3.0;
 
@@ -13,7 +15,7 @@ ClassImp(AliITSVertexer)
 //////////////////////////////////////////////////////////////////////
 // Base class for primary vertex reconstruction                     //
 // AliESDVertexer is a class for full 3D primary vertex finding     //
-// derived classes: AliITSVertexerIons AliITSvertexer3D             //
+// derived classes: AliITSvertexer3D, AliITSVertexerZ.              //       
 //                  AliITSVertexerCosmics                           //
 //////////////////////////////////////////////////////////////////////
 
@@ -21,7 +23,7 @@ ClassImp(AliITSVertexer)
 
 //______________________________________________________________________
 AliITSVertexer::AliITSVertexer():AliVertexer(),
-fLadders(), 
+fLadders(NULL), 
 fLadOnLay2(0),
 fComputeMultiplicity(kFALSE),
 fDetTypeRec(NULL),
@@ -43,12 +45,8 @@ fLastEvent(-1)
 //______________________________________________________________________
 AliITSVertexer::~AliITSVertexer() {
   // Destructor
-  if(fLadders) delete [] fLadders;
-  if (fNoVertices > 0){
-    delete []fVertArray;
-    fVertArray = NULL;
-    fNoVertices = 0;
-  }
+  delete [] fLadders;
+  delete []fVertArray;
 }
 
 //______________________________________________________________________
@@ -97,7 +95,7 @@ void AliITSVertexer::FindMultiplicity(TTree *itsClusterTree){
     multReco.LoadClusterFiredChips(itsClusterTree);
     Short_t nfcL1 = multReco.GetNFiredChips(0);
     Short_t nfcL2 = multReco.GetNFiredChips(1);
-    fMult = new AliMultiplicity(0,0,0,0,0,0,0,0,0,0,nfcL1,nfcL2,fastOrFiredMap);
+    fMult = new AliMultiplicity(0,0,0,0,0,0,0,0,0,0,0,nfcL1,nfcL2,fastOrFiredMap);
     fMult->SetFiredChipMap(firedChipMap);
     AliITSRecPointContainer* rcont = AliITSRecPointContainer::Instance();
     fMult->SetITSClusters(0,rcont->GetNClustersInLayer(1,itsClusterTree));
@@ -135,13 +133,15 @@ void AliITSVertexer::FindMultiplicity(TTree *itsClusterTree){
   Int_t nosingleclus=multReco.GetNSingleClusters();
   Float_t *ths = new Float_t [nosingleclus];
   Float_t *phs = new Float_t [nosingleclus];
+  Int_t *labelss = new Int_t [nosingleclus];
   for(Int_t i=0;i<nosingleclus;i++){
     ths[i] = multReco.GetCluster(i)[0];
     phs[i] = multReco.GetCluster(i)[1];
+    labelss[i] = (Int_t)multReco.GetCluster(i)[2];
   }
   Short_t nfcL1 = multReco.GetNFiredChips(0);
   Short_t nfcL2 = multReco.GetNFiredChips(1);
-  fMult = new AliMultiplicity(notracks,tht,phi,dtht,dphi,labels,labelsL2,nosingleclus,ths,phs,nfcL1,nfcL2,fastOrFiredMap);
+  fMult = new AliMultiplicity(notracks,tht,phi,dtht,dphi,labels,labelsL2,nosingleclus,ths,phs,labelss,nfcL1,nfcL2,fastOrFiredMap);
   fMult->SetFiredChipMap(firedChipMap);
   AliITSRecPointContainer* rcont = AliITSRecPointContainer::Instance();
   fMult->SetITSClusters(0,rcont->GetNClustersInLayer(1,itsClusterTree));
@@ -156,6 +156,7 @@ void AliITSVertexer::FindMultiplicity(TTree *itsClusterTree){
   delete [] phs;
   delete [] labels;
   delete [] labelsL2;
+  delete [] labelss;
 
   return;
 }
@@ -164,6 +165,7 @@ void AliITSVertexer::FindMultiplicity(TTree *itsClusterTree){
 void AliITSVertexer::SetLaddersOnLayer2(Int_t ladwid){
   // Calculates the array of ladders on layer 2 to be used with a 
   // given ladder on layer 1
+  if(ladwid == fLadOnLay2 && fLadders)return;
   fLadOnLay2=ladwid;
   Int_t ladtot1=AliITSgeomTGeo::GetNLadders(1);
   if(fLadders) delete [] fLadders;
@@ -199,7 +201,6 @@ void AliITSVertexer::SetLaddersOnLayer2(Int_t ladwid){
   }
 }
 
-#include "AliRunLoader.h"
 
 //______________________________________________________________________
 void AliITSVertexer::Init(TString filename){
@@ -207,7 +208,8 @@ void AliITSVertexer::Init(TString filename){
   // analysis of an entire file
   AliRunLoader *rl = AliRunLoader::Instance();
   if(!rl){
-    Fatal("AliITSVertexer","Run Loader not found");
+    AliFatal("Run Loader not found");
+    return;
   }
   if (fLastEvent < 0) SetLastEvent(rl->GetNumberOfEvents()-1);