]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSTrackSegmentMaker.cxx
Fixed memory leaks for #86360: High memory consumption in 2.76TeV p+p RAW reco jobs
[u/mrichter/AliRoot.git] / PHOS / AliPHOSTrackSegmentMaker.cxx
index 3ea319199c4173a12c403b7c0cfafebfd0378590..3482f19e829e4d198ccf32f7e448c1cebcfaf8a5 100644 (file)
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.29  2007/08/28 12:55:08  policheh
+ * Loaders removed from the reconstruction code (C.Cheshkov)
+ *
+ * Revision 1.28  2007/08/07 14:12:03  kharlov
+ * Quality assurance added (Yves Schutz)
+ *
+ * Revision 1.27  2006/08/25 16:56:30  kharlov
+ * Compliance with Effective C++
+ *
  * Revision 1.26  2006/08/25 16:00:53  kharlov
  * Compliance with Effective C++AliPHOSHit.cxx
  *
 
 
 // --- ROOT system ---
+#include "TTree.h"
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
 #include "AliPHOSTrackSegmentMaker.h"
-#include "AliPHOSGetter.h"
+#include "AliLog.h"
 
 ClassImp( AliPHOSTrackSegmentMaker) 
 
 
 //____________________________________________________________________________
 AliPHOSTrackSegmentMaker:: AliPHOSTrackSegmentMaker() : 
-  TTask("",""),
-  fEventFolderName(""),
-  fFirstEvent(0),
-  fLastEvent(-1),
-  fESD(0)
+  TObject(),
+  fESD(0), 
+  fGeom(0),
+  fEMCRecPoints(0),
+  fCPVRecPoints(0)
 {
-  // ctor
+ // ctor
+  fEMCRecPoints = new TObjArray(100) ;
+  fCPVRecPoints = new TObjArray(100) ;
 }
 
 //____________________________________________________________________________
-AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const TString alirunFileName, 
-                                                  const TString eventFolderName):
-  TTask("PHOS"+AliConfig::Instance()->GetTrackerTaskName(), alirunFileName), 
-  fEventFolderName(eventFolderName),
-  fFirstEvent(0),
-  fLastEvent(-1),
-  fESD(0)
+AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(AliPHOSGeometry *geom):
+  TObject(),
+  fESD(0), 
+  fGeom(geom),
+  fEMCRecPoints(0),
+  fCPVRecPoints(0)
 {
   // ctor
+  fEMCRecPoints = new TObjArray(100) ;
+  fCPVRecPoints = new TObjArray(100) ;
 }
 
 //____________________________________________________________________________
 AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const AliPHOSTrackSegmentMaker & tsmaker) :
-  TTask(tsmaker),
-  fEventFolderName(tsmaker.GetEventFolderName()),
-  fFirstEvent(tsmaker.GetFirstEvent()),
-  fLastEvent(tsmaker.GetLastEvent()),
-  fESD(tsmaker.GetESD())
+  TObject(tsmaker),
+  fESD(tsmaker.GetESD()), 
+  fGeom(tsmaker.fGeom),
+  fEMCRecPoints(tsmaker.fEMCRecPoints),
+  fCPVRecPoints(tsmaker.fCPVRecPoints)
 {
   //Copy constructor
 } 
@@ -81,8 +94,38 @@ AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const AliPHOSTrackSegmentMake
 //____________________________________________________________________________
 AliPHOSTrackSegmentMaker::~AliPHOSTrackSegmentMaker()
 {
- //Remove this from the parental task before destroying
-  if(AliPHOSGetter::Instance()->PhosLoader())
-    AliPHOSGetter::Instance()->PhosLoader()->CleanTracker();
+  //Remove this from the parental task before destroying
+  if (fEMCRecPoints) {
+    fEMCRecPoints->Delete();
+    delete fEMCRecPoints;
+  }
+  if (fCPVRecPoints) {
+    fCPVRecPoints->Delete();
+    delete fCPVRecPoints;
+  }
 }
 
+//____________________________________________________________________________
+void AliPHOSTrackSegmentMaker::SetInput(TTree *clustersTree)
+{
+  // Read the clusters tree and set addresses to the
+  // arrays with the EMC and CPV clusters
+
+  TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
+  if (!emcbranch) { 
+    AliError("can't get the branch with the PHOS EMC clusters !");
+    return;
+  }
+  emcbranch->SetAddress(&fEMCRecPoints);
+  fEMCRecPoints->Delete();
+  emcbranch->GetEntry(0);
+
+  TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP");
+  if (!cpvbranch) { 
+    AliError("can't get the branch with the PHOS CPV clusters !");
+    return;
+  }
+  cpvbranch->SetAddress(&fCPVRecPoints);
+  fCPVRecPoints->Delete();
+  cpvbranch->GetEntry(0);
+}