]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALClusterizer.cxx
Treatment of default recoparameters is corrected.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALClusterizer.cxx
index ed61757cb7a122b0c97e17e23169dddefc4f7ff5..c36b80125d682a572d6356d9082c46522ddd6c70 100644 (file)
 //  Base class for the clusterization algorithm (pure abstract)
 //*--
 //*-- Author: Yves Schutz  SUBATECH 
+// Modif: 
+//  August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
+//                           of new  IO (à la PHOS)
 //////////////////////////////////////////////////////////////////////////////
 
 // --- ROOT system ---
-
-#include "TGeometry.h"
-#include "TDirectory.h"
-#include "TFile.h"
-#include "TTree.h" 
+#include "TClonesArray.h"
+#include "TTree.h"
 
 // --- Standard library ---
 
-#include <iostream.h>
-#include <stdlib.h>   
 
 // --- AliRoot header files ---
-
-#include "AliRun.h" 
 #include "AliEMCALClusterizer.h"
-#include "AliHeader.h" 
+#include "AliLog.h"
 
 ClassImp(AliEMCALClusterizer)
 
 //____________________________________________________________________________
-  AliEMCALClusterizer::AliEMCALClusterizer():TTask("","")
+AliEMCALClusterizer::AliEMCALClusterizer():
+  fDigitsArr(NULL),
+  fTreeR(NULL),
+  fRecPoints(NULL)
 {
   // ctor
-  fSplitFile = 0 ;  
 }
 
 //____________________________________________________________________________
-AliEMCALClusterizer::AliEMCALClusterizer(const char* headerFile, const char* name):
-TTask(name, headerFile)
+AliEMCALClusterizer::~AliEMCALClusterizer()
 {
-  // ctor
-  fSplitFile = 0 ;  
+  // dtor
+  if (fDigitsArr) {
+    fDigitsArr->Delete();
+    delete fDigitsArr;
+  }
+  if (fRecPoints) {
+    fRecPoints->Delete();
+    delete fRecPoints;
+  }
 }
 
 //____________________________________________________________________________
-AliEMCALClusterizer::~AliEMCALClusterizer()
+void AliEMCALClusterizer::SetInput(TTree *digitsTree)
 {
-  // dtor
-  
-  fSplitFile = 0 ;
-
+  // Read the digits from the input tree
+  TBranch *branch = digitsTree->GetBranch("EMCAL");
+  if (!branch) { 
+    AliError("can't get the branch with the EMCAL digits !");
+    return;
+  }
+  fDigitsArr = new TClonesArray("AliEMCALDigit",100);
+  branch->SetAddress(&fDigitsArr);
+  branch->GetEntry(0);
 }
 
 //____________________________________________________________________________
-void AliEMCALClusterizer::SetSplitFile(const TString splitFileName) 
+void AliEMCALClusterizer::SetOutput(TTree *clustersTree)
 {
-  // Diverts the Digits in a file separate from the hits file
-  
-
-  TDirectory * cwd = gDirectory ;
-  fSplitFile = gAlice->InitTreeFile("R",splitFileName.Data());
-  fSplitFile->cd() ; 
-  gAlice->Write(0, TObject::kOverwrite);
-  
-  TTree *treeE  = gAlice->TreeE();
-  if (!treeE) {
-    cerr << "ERROR: AliEMCALClusterizer::SetSplitFile -> No TreeE found "<<endl;
-    abort() ;
-  }      
-  
-  // copy TreeE
-  AliHeader *header = new AliHeader();
-  treeE->SetBranchAddress("Header", &header);
-  treeE->SetBranchStatus("*",1);
-  TTree *treeENew =  treeE->CloneTree();
-  treeENew->Write(0, TObject::kOverwrite);
-  
-  // copy AliceGeom
-  TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
-  if (!AliceGeom) {
-    cerr << "ERROR: AliEMCALClusterizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
-    abort() ;
-  }
-  AliceGeom->Write(0, TObject::kOverwrite);
+  // Read the digits from the input tree
+  fTreeR = clustersTree;
   
-  gAlice->MakeTree("R", fSplitFile);
-  cwd->cd() ; 
-  cout << "INFO: AliEMCALClusterizer::SetSPlitMode -> RecPoints will be stored in " << splitFileName.Data() << endl ;   
+  AliDebug(9, "Making array for EMCAL clusters");
+  fRecPoints = new TObjArray(100) ;
+  Int_t split = 0;
+  Int_t bufsize = 32000;
+  fTreeR->Branch("EMCALECARP", "TObjArray", &fRecPoints, bufsize, split);
 }