New Trigger class, TRU mapping method included in Geometry
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALLoader.cxx
CommitLineData
88cb7938 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
803d1ab0 16/* $Id$ */
88cb7938 17
18//_________________________________________________________________________
19// A singleton. This class should be used in the analysis stage to get
20// reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
5dee926e 21// instead of directly reading them from galice.root file.
88cb7938 22//
5dee926e 23// MvL Feb 2006:
24// The AliEMCALLoader now holds the TClonesArray and TObjArray for reading
25// Hits, Dgits, SDigits and RecPoints. Filling is managed in the GetEvent()
26// method.
27//
28// Creation/writing of files is managed by the relevant parts of the
29// reconstruction software (AliEMCALDigitiser etx)
30//
88cb7938 31//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
32//*-- Completely redesigned by Dmitri Peressounko March 2001
33//
34//*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
5dee926e 35//*-- systematic usage of TFolders without changing the interface
36//
37//*-- Marco van Leeuwen, Jan 2006: complete revision to simplify reading
38//*-- and fit better in general ALICE scheme
39//
88cb7938 40//////////////////////////////////////////////////////////////////////////////
41
42
43// --- ROOT system ---
44
88cb7938 45#include "TTree.h"
88cb7938 46
47// --- Standard library ---
88cb7938 48
49// --- AliRoot header files ---
a9bbb414 50#include "AliEMCALLoader.h"
51#include "AliLog.h"
88cb7938 52
53ClassImp(AliEMCALLoader)
d64c959b 54
88cb7938 55const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
d64c959b 56
88cb7938 57//____________________________________________________________________________
58AliEMCALLoader::AliEMCALLoader()
d64c959b 59{
88cb7938 60 fDebug = 0;
5dee926e 61 fHits = new TClonesArray("AliEMCALHit");
62 fDigits = new TClonesArray("AliEMCALDigit");
63 fSDigits = new TClonesArray("AliEMCALDigit");
64 fRecPoints = new TObjArray();
d64c959b 65}
66
88cb7938 67//____________________________________________________________________________
68AliEMCALLoader::AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername):
d64c959b 69 AliLoader(detname,eventfoldername)
88cb7938 70{
71 fDebug=0;
5dee926e 72 fHits = new TClonesArray("AliEMCALHit");
73 fDigits = new TClonesArray("AliEMCALDigit");
74 fSDigits = new TClonesArray("AliEMCALDigit");
75 fRecPoints = new TObjArray();
88cb7938 76}
88cb7938 77
d64c959b 78//____________________________________________________________________________
88cb7938 79AliEMCALLoader::~AliEMCALLoader()
80{
5dee926e 81 // Disconnect trees and remove arrays
82 if (TreeH())
83 TreeH()->SetBranchAddress(fDetectorName,0);
84 if (TreeD())
85 TreeD()->SetBranchAddress(fDetectorName,0);
86 if (TreeS())
87 TreeS()->SetBranchAddress(fDetectorName,0);
88 if (TreeR())
89 TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0);
90 delete fHits;
91 delete fDigits;
92 delete fSDigits;
93 delete fRecPoints;
94}
95
96//____________________________________________________________________________
97Int_t AliEMCALLoader::GetEvent() {
98 AliLoader::GetEvent(); // First call AliLoader to do all the groundwork
99
5dee926e 100 // Now connect and fill TClonesArray
101
102 // Hits
103 TTree *treeH = TreeH();
104 if (treeH) {
105 treeH->SetBranchAddress(fDetectorName,&fHits);
106 if (treeH->GetEntries() > 1)
40b572fb 107 AliWarning("Multiple arrays in treeH no longer supported");
5dee926e 108 treeH->GetEvent(0);
88cb7938 109 }
88cb7938 110
5dee926e 111 // SDigits
112 TTree *treeS = TreeS();
113 if (treeS) {
114 treeS->SetBranchAddress(fDetectorName,&fSDigits);
115 treeS->GetEvent(0);
116 }
88cb7938 117
5dee926e 118 // Digits
119 TTree *treeD = TreeD();
120 if (treeD) {
121 treeD->SetBranchAddress(fDetectorName,&fDigits);
122 treeD->GetEvent(0);
123 }
88cb7938 124
5dee926e 125 // RecPoints
126 TTree *treeR = TreeR();
127 if (treeR) {
128 treeR->SetBranchAddress(fgkECARecPointsBranchName,&fRecPoints);
129 treeR->GetEvent(0);
130 }
88cb7938 131
5dee926e 132 return 0;
88cb7938 133}