]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSClusterizer.cxx
coverity fix
[u/mrichter/AliRoot.git] / PHOS / AliPHOSClusterizer.cxx
index c4d8dc4f6169ab1f98e8ea61526a97c76f7050d6..f88550f922d21449a7d4b7f5f72a5cf405072141 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id$ */
-
 //_________________________________________________________________________
 //  Base class for the clusterization algorithm (pure abstract)
 //*--
 //*-- Author: Yves Schutz  SUBATECH 
 //////////////////////////////////////////////////////////////////////////////
 
-// --- ROOT system ---
-
-
-// --- Standard library ---
-
-
-
-// --- AliRoot header files ---
+#include <TClonesArray.h>
+#include <TTree.h>
 
 #include "AliPHOSClusterizer.h"
+#include "AliPHOSDigit.h"
+#include "AliLog.h"
 
 ClassImp(AliPHOSClusterizer)
 
+AliPHOSCalibData * AliPHOSClusterizer::fgCalibData  = 0 ; 
+
 //____________________________________________________________________________
-  AliPHOSClusterizer::AliPHOSClusterizer():TTask("AliPHOSClusterizer","")
+AliPHOSClusterizer::AliPHOSClusterizer():
+  fGeom(NULL),
+  fDigitsArr(0),
+  fTreeR(0),
+  fEMCRecPoints(0),
+  fCPVRecPoints(0)
 {
   // ctor
+  fDigitsArr    = new TClonesArray("AliPHOSDigit",100);
+  fEMCRecPoints = new TObjArray(100) ;
+  fEMCRecPoints ->SetName("EMCRECPOINTS") ;
+  fCPVRecPoints = new TObjArray(100) ;
+  fCPVRecPoints ->SetName("CPVRECPOINTS") ;
 }
+
 //____________________________________________________________________________
-AliPHOSClusterizer::AliPHOSClusterizer(const char* HeaderFile,const char* DigitsFile = 0):
-TTask("AliPHOSClusterizer","")
+AliPHOSClusterizer::AliPHOSClusterizer(AliPHOSGeometry *geom):
+  fGeom(geom),
+  fDigitsArr(0),
+  fTreeR(0),
+  fEMCRecPoints(0),
+  fCPVRecPoints(0)
 {
   // ctor
+  fDigitsArr    = new TClonesArray("AliPHOSDigit",100);
+  fEMCRecPoints = new TObjArray(100) ;
+  fEMCRecPoints ->SetName("EMCRECPOINTS") ;
+  fCPVRecPoints = new TObjArray(100) ;
+  fCPVRecPoints ->SetName("CPVRECPOINTS") ;
 }
 
 //____________________________________________________________________________
 AliPHOSClusterizer::~AliPHOSClusterizer()
 {
   // dtor
+  if (fDigitsArr) {
+    fDigitsArr->Delete();
+    delete fDigitsArr;
+  }
+  if (fEMCRecPoints) {
+    fEMCRecPoints->Delete();
+    delete fEMCRecPoints;
+  }
+  if (fCPVRecPoints) {
+    fCPVRecPoints->Delete();
+    delete fCPVRecPoints;
+  }
+}
+
+//____________________________________________________________________________
+void AliPHOSClusterizer::SetInput(TTree * digitsTree) 
+{
+  // Get the tree with digits and sets
+  // the input array with digits for PHOS
+  TBranch *branch = digitsTree->GetBranch("PHOS");
+  if (!branch) { 
+    AliError("can't get the branch with the PHOS digits !");
+    return;
+  }
+  fDigitsArr->Clear();
+  branch->SetAddress(&fDigitsArr);
+  branch->GetEntry(0);
+}
+
+//____________________________________________________________________________
+void AliPHOSClusterizer::SetOutput(TTree * clustersTree) 
+{
+  // Set the output clusters tree,
+  // creates the arrays for EMC and CPV,
+  // and set the corresponding branch addresses
+  fTreeR = clustersTree;
+
+  AliDebug(9, "Making array for EMC clusters");
+  Int_t split = 0;
+  Int_t bufsize = 32000;
+  fTreeR->Branch("PHOSEmcRP", "TObjArray", &fEMCRecPoints, bufsize, split);
+
+  AliDebug(9, "Making array for CPV clusters");
+  fTreeR->Branch("PHOSCpvRP", "TObjArray", &fCPVRecPoints, bufsize, split);
 }