Added a collaborative work between Getter and Tasks (Digitizer and Clustrizer) so...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALClusterizer.cxx
CommitLineData
483b0559 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
839828a6 26#include "TGeometry.h"
27#include "TDirectory.h"
28#include "TFile.h"
29#include "TTree.h"
483b0559 30
31// --- Standard library ---
32
839828a6 33#include <iostream.h>
34#include <stdlib.h>
483b0559 35
36// --- AliRoot header files ---
37
839828a6 38#include "AliRun.h"
483b0559 39#include "AliEMCALClusterizer.h"
839828a6 40#include "AliHeader.h"
9bd3caba 41#include "AliEMCALGetter.h"
42#include "AliEMCALSDigitizer.h"
43#include "AliEMCALDigitizer.h"
483b0559 44
45ClassImp(AliEMCALClusterizer)
46
47//____________________________________________________________________________
48 AliEMCALClusterizer::AliEMCALClusterizer():TTask("","")
49{
50 // ctor
839828a6 51 fSplitFile = 0 ;
9bd3caba 52 fHitsFileName = "" ;
53 fSDigitsFileName = "" ;
54 fDigitsFileName = "" ;
55
483b0559 56}
839828a6 57
483b0559 58//____________________________________________________________________________
59AliEMCALClusterizer::AliEMCALClusterizer(const char* headerFile, const char* name):
60TTask(name, headerFile)
61{
62 // ctor
839828a6 63 fSplitFile = 0 ;
9bd3caba 64 fDigitsFileName = headerFile ;
65 AliEMCALGetter * gime = AliEMCALGetter::GetInstance(headerFile, name) ;
66 gime->Event(0,"D") ;
67 fSDigitsFileName = gime->Digitizer()->GetTitle() ;
68 gime = AliEMCALGetter::GetInstance(fSDigitsFileName, name) ;
69 gime->Event(0,"S") ;
70 fHitsFileName = gime->SDigitizer()->GetTitle() ;
483b0559 71}
72
73//____________________________________________________________________________
74AliEMCALClusterizer::~AliEMCALClusterizer()
75{
76 // dtor
839828a6 77
78 fSplitFile = 0 ;
9bd3caba 79
839828a6 80}
81
82//____________________________________________________________________________
83void AliEMCALClusterizer::SetSplitFile(const TString splitFileName)
84{
85 // Diverts the Digits in a file separate from the hits file
86
87
88 TDirectory * cwd = gDirectory ;
89 fSplitFile = gAlice->InitTreeFile("R",splitFileName.Data());
90 fSplitFile->cd() ;
91 gAlice->Write(0, TObject::kOverwrite);
92
93 TTree *treeE = gAlice->TreeE();
94 if (!treeE) {
95 cerr << "ERROR: AliEMCALClusterizer::SetSplitFile -> No TreeE found "<<endl;
96 abort() ;
97 }
98
99 // copy TreeE
100 AliHeader *header = new AliHeader();
101 treeE->SetBranchAddress("Header", &header);
102 treeE->SetBranchStatus("*",1);
103 TTree *treeENew = treeE->CloneTree();
104 treeENew->Write(0, TObject::kOverwrite);
105
106 // copy AliceGeom
107 TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
108 if (!AliceGeom) {
109 cerr << "ERROR: AliEMCALClusterizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
110 abort() ;
111 }
112 AliceGeom->Write(0, TObject::kOverwrite);
113
114 gAlice->MakeTree("R", fSplitFile);
115 cwd->cd() ;
116 cout << "INFO: AliEMCALClusterizer::SetSPlitMode -> RecPoints will be stored in " << splitFileName.Data() << endl ;
483b0559 117}