]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSClusterizer.cxx
Merge branch 'master' into LocalDev
[u/mrichter/AliRoot.git] / PHOS / AliPHOSClusterizer.cxx
index 2adef3868d6d0e467fd376406756b41a6a9e795c..77fce84bdece2ff7701f5663e9f6176883c4b6d1 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 ---
+#include <TClonesArray.h>
+#include <TTree.h>
 
-// --- AliRoot header files ---
 #include "AliPHOSClusterizer.h"
-#include "AliPHOSGetter.h" 
-#include "AliPHOSQualAssDataMaker.h" 
-
-// --- AliRoot header files ---
-#include "AliPHOSQualAssDataMaker.h"
+#include "AliPHOSDigit.h"
+#include "AliLog.h"
 
 ClassImp(AliPHOSClusterizer)
 
+AliPHOSCalibData * AliPHOSClusterizer::fgCalibData  = 0 ; 
+
 //____________________________________________________________________________
 AliPHOSClusterizer::AliPHOSClusterizer():
-  TTask("",""),
-  fEventFolderName(""),
-  fFirstEvent(0),
-  fLastEvent(-1),
-  fRawReader(0),
-  fQADM(0)
+  fGeom(NULL),
+  fDigitsArr(0),
+  fTreeR(0),
+  fEMCRecPoints(0),
+  fCPVRecPoints(0)
 {
- // ctor
+  // ctor
+  fDigitsArr    = new TClonesArray("AliPHOSDigit",100);
+  fEMCRecPoints = new TObjArray(100) ;
+  fEMCRecPoints ->SetName("EMCRECPOINTS") ;
+  fCPVRecPoints = new TObjArray(100) ;
+  fCPVRecPoints ->SetName("CPVRECPOINTS") ;
 }
 
 //____________________________________________________________________________
-AliPHOSClusterizer::AliPHOSClusterizer(const TString alirunFileName, 
-                                      const TString eventFolderName):
-  TTask("PHOS"+AliConfig::Instance()->GetReconstructionerTaskName(), 
-       alirunFileName), fEventFolderName(eventFolderName),
-  fFirstEvent(0),
-  fLastEvent(-1),
-  fRawReader(0),
-  fQADM(0)
+AliPHOSClusterizer::AliPHOSClusterizer(AliPHOSGeometry *geom):
+  fGeom(geom),
+  fDigitsArr(0),
+  fTreeR(0),
+  fEMCRecPoints(0),
+  fCPVRecPoints(0)
 {
   // ctor
-  fQADM = new AliPHOSQualAssDataMaker() ;  
-  //initiaizes the quality assurance data maker
-  fQADM ->Init(AliQualAss::kRECPOINTS) ;    
+  fDigitsArr    = new TClonesArray("AliPHOSDigit",100);
+  fEMCRecPoints = new TObjArray(100) ;
+  fEMCRecPoints ->SetName("EMCRECPOINTS") ;
+  fCPVRecPoints = new TObjArray(100) ;
+  fCPVRecPoints ->SetName("CPVRECPOINTS") ;
 }
 
 //____________________________________________________________________________
-AliPHOSClusterizer::AliPHOSClusterizer(const AliPHOSClusterizer & clusterizer) :
-  TTask(clusterizer),fEventFolderName(clusterizer.GetEventFolderName()),
-  fFirstEvent(clusterizer.GetFirstEvent()),fLastEvent(clusterizer.GetLastEvent()),
-  fRawReader(clusterizer.GetRawReader()),
-  fQADM(clusterizer.GetQualAssDataMaker())
+AliPHOSClusterizer::~AliPHOSClusterizer()
 {
-  //Copy constructor
-  //initiaizes the quality assurance data maker
-  GetQualAssDataMaker()->Init(AliQualAss::kRECPOINTS) ;    
+  // dtor
+  if (fDigitsArr) {
+    fDigitsArr->Delete();
+    delete fDigitsArr;
+  }
+  if (fEMCRecPoints) {
+    fEMCRecPoints->Delete();
+    delete fEMCRecPoints;
+  }
+  if (fCPVRecPoints) {
+    fCPVRecPoints->Delete();
+    delete fCPVRecPoints;
+  }
 }
+
 //____________________________________________________________________________
-AliPHOSClusterizer::~AliPHOSClusterizer()
+void AliPHOSClusterizer::SetInput(TTree * digitsTree) 
 {
-  // dtor
-         
- //Remove this from the parental task before destroying
-  if(AliPHOSGetter::Instance()->PhosLoader())
-    AliPHOSGetter::Instance()->PhosLoader()->CleanReconstructioner();
-  delete fQADM ; 
+  // 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("C");
+  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);
+}