1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // The AliEMCALLoader gets the TClonesArray and TObjArray for reading
20 // Hits, Dgits, SDigits and RecPoints. Filling is managed in the GetEvent()
22 // It also provides acces methods to the calibration and simulation OCDB parameters
24 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
25 //*-- Completely redesigned by Dmitri Peressounko March 2001
27 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
28 //*-- systematic usage of TFolders without changing the interface
30 //*-- Marco van Leeuwen, Jan 2006: complete revision to simplify reading
31 //*-- and fit better in general ALICE scheme
32 //*-- GCB: Remove TClonesArrays and TObjArrays data members, they are created elsewhere.
33 //*-- Provide access to OCDB calibration and simulation parameters.
35 //////////////////////////////////////////////////////////////////////////////
37 // --- ROOT system ---
40 // --- Standard library ---
42 // --- AliRoot header files ---
43 #include "AliEMCALLoader.h"
45 #include "AliCDBLocal.h"
46 #include "AliCDBStorage.h"
47 #include "AliCDBManager.h"
48 #include "AliCDBEntry.h"
50 ClassImp(AliEMCALLoader)
52 const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
53 const TString AliEMCALLoader::fgkECADigitsBranchName("DIGITS");//Name for branch with ECA Digits
54 const TString AliEMCALLoader::fgkECASDigitsBranchName("SDIGITS");//Name for branch with ECA SDigits
56 AliEMCALCalibData* AliEMCALLoader::fgCalibData = 0; //calibration data
57 //AliCaloCalibPedestal* AliEMCALLoader::fgCaloPed = 0; //dead map data
58 AliEMCALSimParam* AliEMCALLoader::fgSimParam = 0; //simulation parameters
60 //____________________________________________________________________________
61 AliEMCALLoader::AliEMCALLoader()
64 //Default constructor for EMCAL Loader Class
68 //____________________________________________________________________________
69 AliEMCALLoader::AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername)
70 : AliLoader(detname,eventfoldername), fDebug(0)
72 //Specific constructor for EMCAL Loader class
76 //____________________________________________________________________________
77 AliEMCALLoader::AliEMCALLoader(const Char_t *name, TFolder *topfolder)
78 : AliLoader(name,topfolder), fDebug(0)
80 //Specific constructor for EMCAL Loader class
84 //____________________________________________________________________________
85 AliEMCALLoader::~AliEMCALLoader()
87 // Disconnect trees and remove arrays
89 TreeH()->SetBranchAddress(fDetectorName,0);
91 // TreeD()->SetBranchAddress(fDetectorName,0);
93 // TreeS()->SetBranchAddress(fDetectorName,0);
95 // TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0);
97 Clean(fgkECASDigitsBranchName);
98 Clean(fgkECADigitsBranchName);
99 Clean(fgkECARecPointsBranchName);
101 AliLoader::CleanFolders();
105 //____________________________________________________________________________
106 AliEMCALCalibData* AliEMCALLoader::CalibData()
108 // Check if the instance of AliEMCALCalibData exists, if not, create it if
109 // the OCDB is available, and finally return it.
111 if(!fgCalibData && (AliCDBManager::Instance()->IsDefaultStorageSet()))
113 AliCDBEntry *entry = (AliCDBEntry*)
114 AliCDBManager::Instance()->Get("EMCAL/Calib/Data");
115 if (entry) fgCalibData = (AliEMCALCalibData*) entry->GetObject();
119 AliFatal("Calibration parameters not found in CDB!");
125 //____________________________________________________________________________
126 //AliCaloCalibPedestal* AliEMCALLoader::PedestalData()
128 // // Check if the instance of AliCaloCalibPedestal exists, if not, create it if
129 // // the OCDB is available, and finally return it.
131 // if(!fgCaloPed && (AliCDBManager::Instance()->IsDefaultStorageSet()))
133 // AliCDBEntry *entry = (AliCDBEntry*)
134 // AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals");
135 // if (entry) fgCaloPed = (AliCaloCalibPedestal*) entry->GetObject();
139 // AliFatal("Pedestal info not found in CDB!");
145 //____________________________________________________________________________
146 AliEMCALSimParam* AliEMCALLoader::SimulationParameters()
148 // Check if the instance of AliEMCALSimParam exists, if not, create it if
149 // the OCDB is available, and finally return it.
151 if(!fgSimParam && (AliCDBManager::Instance()->IsDefaultStorageSet()))
153 AliCDBEntry *entry = (AliCDBEntry*)
154 AliCDBManager::Instance()->Get("EMCAL/Calib/SimParam");
155 if (entry) fgSimParam = (AliEMCALSimParam*) entry->GetObject();
160 AliFatal("Simulations parameters not found in CDB!");
166 //____________________________________________________________________________
167 Int_t AliEMCALLoader::GetEvent()
169 //Method to load all of the data
170 //members of the EMCAL for a given
171 //event from the Trees
173 AliLoader::GetEvent(); // First call AliLoader to do all the groundwork
176 // Hits are now handled directly on the AliEMCALSDigitizer, the only place it is requested.
177 // together with AliEveEMCALData
180 // Initialize the SDigits TClonesArray, only if it did not existed before
183 TTree *treeS = TreeS();
185 TBranch * branchS = treeS->GetBranch(fDetectorName);
187 // Reset SDigits array and branch
188 branchS->ResetAddress();
189 TClonesArray* sdigits = const_cast<AliEMCALLoader *>(this)->SDigits();
190 if (sdigits) sdigits->Clear("C");
192 branchS->SetAddress(&sdigits);
193 branchS->GetEntry(0);
197 // Initialize the Digits TClonesArray, only if it did not existed before
200 TTree *treeD = TreeD();
202 TBranch * branchD = treeD->GetBranch(fDetectorName);
204 // Reset Digits array and branch
205 branchD->ResetAddress();
206 TClonesArray* digits = const_cast<AliEMCALLoader *>(this)->Digits();
207 if (digits) digits->Clear("C");
209 branchD->SetAddress(&digits);
210 branchD->GetEntry(0);
214 // Initialize the RecPoints TObjArray, only if it did not existed before
215 MakeRecPointsArray();
217 TTree *treeR = TreeR();
219 TBranch * branchR = treeR->GetBranch(fgkECARecPointsBranchName);
221 // Reset RecPoints array and branch
222 branchR->ResetAddress();
223 TObjArray* rp = const_cast<AliEMCALLoader *>(this)->RecPoints();
226 branchR->SetAddress(&rp);
227 branchR->GetEntry(0);
233 //____________________________________________________________________________
234 void AliEMCALLoader::MakeSDigitsArray(){
235 // Add SDigits array to the data folder
236 if (SDigits()) return;
237 TClonesArray* sdigits = new TClonesArray("AliEMCALDigit",0);
238 sdigits->SetName(fgkECASDigitsBranchName);
239 GetDetectorDataFolder()->Add(sdigits);
242 //____________________________________________________________________________
243 void AliEMCALLoader::MakeDigitsArray(){
244 // Add Digits array to the data folder
245 if (Digits()) return;
246 TClonesArray* digits = new TClonesArray("AliEMCALDigit",0);
247 digits->SetName(fgkECADigitsBranchName);
248 GetDetectorDataFolder()->Add(digits);
251 //____________________________________________________________________________
252 void AliEMCALLoader::MakeRecPointsArray(){
253 // Add RecPoints array to the data folder
254 if (RecPoints()) return;
255 TObjArray* rp = new TObjArray(0);
256 rp->SetName(fgkECARecPointsBranchName);
257 GetDetectorDataFolder()->Add(rp);