]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALClusterizer.cxx
Added the option to write objects into separate files and improved the cleaning
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALClusterizer.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 //_________________________________________________________________________
19 //  Base class for the clusterization algorithm (pure abstract)
20 //*--
21 //*-- Author: Yves Schutz  SUBATECH 
22 //////////////////////////////////////////////////////////////////////////////
23
24 // --- ROOT system ---
25
26 #include "TGeometry.h"
27 #include "TDirectory.h"
28 #include "TFile.h"
29 #include "TTree.h" 
30
31 // --- Standard library ---
32
33 #include <iostream.h>
34 #include <stdlib.h>   
35
36 // --- AliRoot header files ---
37
38 #include "AliRun.h" 
39 #include "AliEMCALClusterizer.h"
40 #include "AliHeader.h" 
41
42 ClassImp(AliEMCALClusterizer)
43
44 //____________________________________________________________________________
45   AliEMCALClusterizer::AliEMCALClusterizer():TTask("","")
46 {
47   // ctor
48   fSplitFile = 0 ;  
49 }
50
51 //____________________________________________________________________________
52 AliEMCALClusterizer::AliEMCALClusterizer(const char* headerFile, const char* name):
53 TTask(name, headerFile)
54 {
55   // ctor
56   fSplitFile = 0 ;  
57 }
58
59 //____________________________________________________________________________
60 AliEMCALClusterizer::~AliEMCALClusterizer()
61 {
62   // dtor
63   
64   fSplitFile = 0 ;
65
66 }
67
68 //____________________________________________________________________________
69 void AliEMCALClusterizer::SetSplitFile(const TString splitFileName) 
70 {
71   // Diverts the Digits in a file separate from the hits file
72   
73
74   TDirectory * cwd = gDirectory ;
75   fSplitFile = gAlice->InitTreeFile("R",splitFileName.Data());
76   fSplitFile->cd() ; 
77   gAlice->Write(0, TObject::kOverwrite);
78   
79   TTree *treeE  = gAlice->TreeE();
80   if (!treeE) {
81     cerr << "ERROR: AliEMCALClusterizer::SetSplitFile -> No TreeE found "<<endl;
82     abort() ;
83   }      
84   
85   // copy TreeE
86   AliHeader *header = new AliHeader();
87   treeE->SetBranchAddress("Header", &header);
88   treeE->SetBranchStatus("*",1);
89   TTree *treeENew =  treeE->CloneTree();
90   treeENew->Write(0, TObject::kOverwrite);
91   
92   // copy AliceGeom
93   TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
94   if (!AliceGeom) {
95     cerr << "ERROR: AliEMCALClusterizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
96     abort() ;
97   }
98   AliceGeom->Write(0, TObject::kOverwrite);
99   
100   gAlice->MakeTree("R", fSplitFile);
101   cwd->cd() ; 
102   cout << "INFO: AliEMCALClusterizer::SetSPlitMode -> RecPoints will be stored in " << splitFileName.Data() << endl ;   
103 }