AliRoot Core  3dc7879 (3dc7879)
AliEMCALLoader.cxx
Go to the documentation of this file.
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 // --- ROOT system ---
17 #include "TMath.h"
18 #include "TTree.h"
19 
20 // --- AliRoot header files ---
21 #include "AliEMCALLoader.h"
22 #include "AliLog.h"
23 #include "AliCDBLocal.h"
24 #include "AliCDBStorage.h"
25 #include "AliCDBManager.h"
26 #include "AliCDBEntry.h"
27 
29 ClassImp(AliEMCALLoader);
31 
32 const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP"); // Name for branch with ECA Reconstructed Points
33 const TString AliEMCALLoader::fgkECADigitsBranchName("DIGITS"); // Name for branch with ECA Digits
34 const TString AliEMCALLoader::fgkECASDigitsBranchName("SDIGITS"); // Name for branch with ECA SDigits
35 
36 AliEMCALCalibData* AliEMCALLoader::fgCalibData = 0; // Energy calibration data
37 AliEMCALCalibTime* AliEMCALLoader::fgCalibTime = 0; // Time calibration data
39 AliEMCALSimParam* AliEMCALLoader::fgSimParam = 0; // Simulation parameters
40 AliEMCALRecParam* AliEMCALLoader::fgRecParam = 0; // Reconstruction parameters
41 
44 //____________________________________________________________________________
46 : fDebug(0)
47 { }
48 
51 //____________________________________________________________________________
52 AliEMCALLoader::AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername)
53  : AliLoader(detname,eventfoldername), fDebug(0)
54 { }
55 
58 //____________________________________________________________________________
59 AliEMCALLoader::AliEMCALLoader(const Char_t *name, TFolder *topfolder)
60  : AliLoader(name,topfolder), fDebug(0)
61 { }
62 
65 //____________________________________________________________________________
67 {
68  if (TreeH())
69  TreeH()->SetBranchAddress(fDetectorName,0);
70 // if (TreeD())
71 // TreeD()->SetBranchAddress(fDetectorName,0);
72 // if (TreeS())
73 // TreeS()->SetBranchAddress(fDetectorName,0);
74 // if (TreeR())
75 // TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0);
76 
80 
82 }
83 
87 //____________________________________________________________________________
89 {
90  if(!fgCalibData && (AliCDBManager::Instance()->IsDefaultStorageSet()))
91  {
92  AliCDBEntry *entry = (AliCDBEntry*)
93  AliCDBManager::Instance()->Get("EMCAL/Calib/Data");
94  if (entry) fgCalibData = (AliEMCALCalibData*) entry->GetObject();
95  }
96 
97  if(!fgCalibData)
98  AliFatal("Calibration parameters not found in CDB!");
99 
100  return fgCalibData;
101 }
102 
106 //____________________________________________________________________________
108 {
109  if(!fgCalibTime && (AliCDBManager::Instance()->IsDefaultStorageSet()))
110  {
111  AliCDBEntry *entry = (AliCDBEntry*)
112  AliCDBManager::Instance()->Get("EMCAL/Calib/Time");
113  if (entry) fgCalibTime = (AliEMCALCalibTime*) entry->GetObject();
114  }
115 
116  if(!fgCalibTime)
117  AliFatal("Calibration parameters not found in CDB!");
118 
119  return fgCalibTime;
120 
121 }
122 
126 //____________________________________________________________________________
128 {
129  if(!fgCaloPed && (AliCDBManager::Instance()->IsDefaultStorageSet()))
130  {
131  AliCDBEntry *entry = (AliCDBEntry*)
132  AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals");
133  if (entry) fgCaloPed = (AliCaloCalibPedestal*) entry->GetObject();
134  }
135 
136  if(!fgCaloPed)
137  AliFatal("Pedestal info not found in CDB!");
138 
139  return fgCaloPed;
140 }
141 
145 //____________________________________________________________________________
147 {
148  if(!fgSimParam && (AliCDBManager::Instance()->IsDefaultStorageSet()))
149  {
150  AliCDBEntry *entry = (AliCDBEntry*)
151  AliCDBManager::Instance()->Get("EMCAL/Calib/SimParam");
152  if (entry) fgSimParam = (AliEMCALSimParam*) entry->GetObject();
153 
154  }
155 
156  if(!fgSimParam)
157  AliFatal("Simulations parameters not found in CDB!");
158 
159  return fgSimParam;
160 }
161 
167 //____________________________________________________________________________
169 {
170  if(!fgRecParam && (AliCDBManager::Instance()->IsDefaultStorageSet()))
171  {
172  AliCDBEntry *entry = (AliCDBEntry*)
173  AliCDBManager::Instance()->Get("EMCAL/Calib/RecoParam");
174  if (entry) fgRecParam = (AliEMCALRecParam*)((TObjArray *) entry->GetObject())->At(eventType);
175 
176  }
177 
178  if(!fgRecParam)
179  AliFatal("Reconstruction parameters not found in CDB!");
180 
181  return fgRecParam;
182 }
183 
188 //____________________________________________________________________________
190 {
191  AliLoader::GetEvent(); // First call AliLoader to do all the groundwork
192 
193  // *** Hits ***
194  // Hits are now handled directly on the AliEMCALSDigitizer, the only place it is requested.
195  // together with AliEveEMCALData
196 
197  // *** SDigits ***
198  // Initialize the SDigits TClonesArray, only if it did not existed before
200 
201  TTree *treeS = TreeS();
202  if (treeS)
203  {
204  TBranch * branchS = treeS->GetBranch(fDetectorName);
205 
206  // Reset SDigits array and branch
207  branchS->ResetAddress();
208  TClonesArray* sdigits = const_cast<AliEMCALLoader *>(this)->SDigits();
209  if (sdigits) sdigits->Clear("C");
210 
211  branchS->SetAddress(&sdigits);
212  branchS->GetEntry(0);
213  }
214 
215  // *** Digits ***
216  // Initialize the Digits TClonesArray, only if it did not existed before
217  MakeDigitsArray();
218 
219  TTree *treeD = TreeD();
220  if (treeD)
221  {
222  TBranch * branchD = treeD->GetBranch(fDetectorName);
223 
224  // Reset Digits array and branch
225  branchD->ResetAddress();
226  TClonesArray* digits = const_cast<AliEMCALLoader *>(this)->Digits();
227  if (digits) digits->Clear("C");
228 
229  branchD->SetAddress(&digits);
230  branchD->GetEntry(0);
231  }
232 
233  // *** RecPoints ***
234  // Initialize the RecPoints TObjArray, only if it did not existed before
236 
237  TTree *treeR = TreeR();
238  if (treeR)
239  {
240  TBranch * branchR = treeR->GetBranch(fgkECARecPointsBranchName);
241 
242  // Reset RecPoints array and branch
243  branchR->ResetAddress();
244  TObjArray* rp = const_cast<AliEMCALLoader *>(this)->RecPoints();
245  if (rp) rp->Clear();
246 
247  branchR->SetAddress(&rp);
248  branchR->GetEntry(0);
249  }
250 
251  return 0;
252 }
253 
256 //____________________________________________________________________________
258 {
259  if (SDigits()) return ;
260 
261  TClonesArray* sdigits = new TClonesArray("AliEMCALDigit",0);
262 
263  sdigits->SetName(fgkECASDigitsBranchName);
264 
265  GetDetectorDataFolder()->Add(sdigits);
266 }
267 
270 //____________________________________________________________________________
272 {
273  if (Digits()) return;
274 
275  TClonesArray* digits = new TClonesArray("AliEMCALDigit",0);
276 
277  digits->SetName(fgkECADigitsBranchName);
278 
279  GetDetectorDataFolder()->Add(digits);
280 }
281 
284 //____________________________________________________________________________
286 {
287  if (RecPoints()) return;
288 
289  TObjArray* rp = new TObjArray(0);
290 
291  rp->SetName(fgkECARecPointsBranchName);
292 
293  GetDetectorDataFolder()->Add(rp);
294 }
void MakeSDigitsArray()
Add SDigits array to the data folder.
virtual void CleanFolders()
Definition: AliLoader.cxx:401
TFolder * GetDetectorDataFolder()
Definition: AliLoader.h:322
AliEMCALRecParam * ReconstructionParameters(Int_t eventType)
static const TString fgkECARecPointsBranchName
! Name of branch with ECA Reconstructed Points
static AliEMCALCalibData * fgCalibData
Energy calibration data.
#define TObjArray
AliCaloCalibPedestal * PedestalData()
void MakeDigitsArray()
Add Digits array to the data folder.
static AliEMCALSimParam * fgSimParam
Sim param.
virtual Int_t GetEvent()
TClonesArray * SDigits()
TTree * TreeD() const
Definition: AliLoader.h:87
AliEMCALSimParam * SimulationParameters()
TTree * TreeS() const
Definition: AliLoader.h:85
Cell energy calibration factors container class.
Int_t fDebug
Debug level.
Container of reconstruction parameters.
TClonesArray * Digits()
static AliEMCALCalibTime * fgCalibTime
Time calibration data.
Give access to hits, digits, recpoints arrays and OCDB.
AliCDBEntry * Get(const AliCDBId &query, Bool_t forceCaching=kFALSE)
void Clean()
Definition: AliLoader.cxx:550
TTree * TreeR() const
Definition: AliLoader.h:89
static AliEMCALRecParam * fgRecParam
Rec param.
TObjArray * RecPoints()
TObject * GetObject()
Definition: AliCDBEntry.h:56
virtual ~AliEMCALLoader()
Disconnect trees and remove arrays.
virtual Int_t GetEvent()
Definition: AliLoader.cxx:195
Container of simulation parameters.
Cell time shifts container class.
pedestal/bad map monitoring and calibration tools
Definition: AliCDBEntry.h:18
#define AliFatal(message)
Definition: AliLog.h:640
AliEMCALLoader()
Default constructor for EMCAL Loader Class.
TString fDetectorName
Definition: AliLoader.h:291
void MakeRecPointsArray()
Add RecPoints array to the data folder.
TTree * TreeH() const
Definition: AliLoader.h:83
static const TString fgkECASDigitsBranchName
! Name of branch with ECA SDigits
AliEMCALCalibData * CalibData()
AliEMCALCalibTime * CalibTime()
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
static const TString fgkECADigitsBranchName
! Name of branch with ECA Digits
static AliCaloCalibPedestal * fgCaloPed
Dead map.