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
59 AliEMCALRecParam* AliEMCALLoader::fgRecParam = 0; //reconstruction parameters
61 //____________________________________________________________________________
62 AliEMCALLoader::AliEMCALLoader()
65 //Default constructor for EMCAL Loader Class
69 //____________________________________________________________________________
70 AliEMCALLoader::AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername)
71 : AliLoader(detname,eventfoldername), fDebug(0)
73 //Specific constructor for EMCAL Loader class
77 //____________________________________________________________________________
78 AliEMCALLoader::AliEMCALLoader(const Char_t *name, TFolder *topfolder)
79 : AliLoader(name,topfolder), fDebug(0)
81 //Specific constructor for EMCAL Loader class
85 //____________________________________________________________________________
86 AliEMCALLoader::~AliEMCALLoader()
88 // Disconnect trees and remove arrays
90 TreeH()->SetBranchAddress(fDetectorName,0);
92 // TreeD()->SetBranchAddress(fDetectorName,0);
94 // TreeS()->SetBranchAddress(fDetectorName,0);
96 // TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0);
98 Clean(fgkECASDigitsBranchName);
99 Clean(fgkECADigitsBranchName);
100 Clean(fgkECARecPointsBranchName);
102 AliLoader::CleanFolders();
106 //____________________________________________________________________________
107 AliEMCALCalibData* AliEMCALLoader::CalibData()
109 // Check if the instance of AliEMCALCalibData exists, if not, create it if
110 // the OCDB is available, and finally return it.
112 if(!fgCalibData && (AliCDBManager::Instance()->IsDefaultStorageSet()))
114 AliCDBEntry *entry = (AliCDBEntry*)
115 AliCDBManager::Instance()->Get("EMCAL/Calib/Data");
116 if (entry) fgCalibData = (AliEMCALCalibData*) entry->GetObject();
120 AliFatal("Calibration parameters not found in CDB!");
126 //____________________________________________________________________________
127 AliCaloCalibPedestal* AliEMCALLoader::PedestalData()
129 // Check if the instance of AliCaloCalibPedestal exists, if not, create it if
130 // the OCDB is available, and finally return it.
132 if(!fgCaloPed && (AliCDBManager::Instance()->IsDefaultStorageSet()))
134 AliCDBEntry *entry = (AliCDBEntry*)
135 AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals");
136 if (entry) fgCaloPed = (AliCaloCalibPedestal*) entry->GetObject();
140 AliFatal("Pedestal info not found in CDB!");
146 //____________________________________________________________________________
147 AliEMCALSimParam* AliEMCALLoader::SimulationParameters()
149 // Check if the instance of AliEMCALSimParam exists, if not, create it if
150 // the OCDB is available, and finally return it.
152 if(!fgSimParam && (AliCDBManager::Instance()->IsDefaultStorageSet()))
154 AliCDBEntry *entry = (AliCDBEntry*)
155 AliCDBManager::Instance()->Get("EMCAL/Calib/SimParam");
156 if (entry) fgSimParam = (AliEMCALSimParam*) entry->GetObject();
161 AliFatal("Simulations parameters not found in CDB!");
168 //____________________________________________________________________________
169 AliEMCALRecParam* AliEMCALLoader::ReconstructionParameters(Int_t eventType = 0)
171 // Check if the instance of AliEMCALRecParam exists, if not, create it if
172 // the OCDB is available, and finally return it.
173 // The event type must be provided.
175 if(!fgRecParam && (AliCDBManager::Instance()->IsDefaultStorageSet()))
177 AliCDBEntry *entry = (AliCDBEntry*)
178 AliCDBManager::Instance()->Get("EMCAL/Calib/RecoParam");
179 if (entry) fgRecParam = (AliEMCALRecParam*)((TObjArray *) entry->GetObject())->At(eventType);
184 AliFatal("Reconstruction parameters not found in CDB!");
191 //____________________________________________________________________________
192 Int_t AliEMCALLoader::GetEvent()
194 //Method to load all of the data
195 //members of the EMCAL for a given
196 //event from the Trees
198 AliLoader::GetEvent(); // First call AliLoader to do all the groundwork
201 // Hits are now handled directly on the AliEMCALSDigitizer, the only place it is requested.
202 // together with AliEveEMCALData
205 // Initialize the SDigits TClonesArray, only if it did not existed before
208 TTree *treeS = TreeS();
210 TBranch * branchS = treeS->GetBranch(fDetectorName);
212 // Reset SDigits array and branch
213 branchS->ResetAddress();
214 TClonesArray* sdigits = const_cast<AliEMCALLoader *>(this)->SDigits();
215 if (sdigits) sdigits->Clear("C");
217 branchS->SetAddress(&sdigits);
218 branchS->GetEntry(0);
222 // Initialize the Digits TClonesArray, only if it did not existed before
225 TTree *treeD = TreeD();
227 TBranch * branchD = treeD->GetBranch(fDetectorName);
229 // Reset Digits array and branch
230 branchD->ResetAddress();
231 TClonesArray* digits = const_cast<AliEMCALLoader *>(this)->Digits();
232 if (digits) digits->Clear("C");
234 branchD->SetAddress(&digits);
235 branchD->GetEntry(0);
239 // Initialize the RecPoints TObjArray, only if it did not existed before
240 MakeRecPointsArray();
242 TTree *treeR = TreeR();
244 TBranch * branchR = treeR->GetBranch(fgkECARecPointsBranchName);
246 // Reset RecPoints array and branch
247 branchR->ResetAddress();
248 TObjArray* rp = const_cast<AliEMCALLoader *>(this)->RecPoints();
251 branchR->SetAddress(&rp);
252 branchR->GetEntry(0);
258 //____________________________________________________________________________
259 void AliEMCALLoader::MakeSDigitsArray(){
260 // Add SDigits array to the data folder
261 if (SDigits()) return;
262 TClonesArray* sdigits = new TClonesArray("AliEMCALDigit",0);
263 sdigits->SetName(fgkECASDigitsBranchName);
264 GetDetectorDataFolder()->Add(sdigits);
267 //____________________________________________________________________________
268 void AliEMCALLoader::MakeDigitsArray(){
269 // Add Digits array to the data folder
270 if (Digits()) return;
271 TClonesArray* digits = new TClonesArray("AliEMCALDigit",0);
272 digits->SetName(fgkECADigitsBranchName);
273 GetDetectorDataFolder()->Add(digits);
276 //____________________________________________________________________________
277 void AliEMCALLoader::MakeRecPointsArray(){
278 // Add RecPoints array to the data folder
279 if (RecPoints()) return;
280 TObjArray* rp = new TObjArray(0);
281 rp->SetName(fgkECARecPointsBranchName);
282 GetDetectorDataFolder()->Add(rp);