]>
Commit | Line | Data |
---|---|---|
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 | ||
88cb7938 | 42 | // --- ROOT system --- |
88cb7938 | 43 | #include "TTree.h" |
88cb7938 | 44 | |
45 | // --- Standard library --- | |
88cb7938 | 46 | |
47 | // --- AliRoot header files --- | |
a9bbb414 | 48 | #include "AliEMCALLoader.h" |
49 | #include "AliLog.h" | |
f565d89d | 50 | #include "AliCDBLocal.h" |
51 | #include "AliCDBStorage.h" | |
52 | #include "AliCDBManager.h" | |
88cb7938 | 53 | |
54 | ClassImp(AliEMCALLoader) | |
d64c959b | 55 | |
88cb7938 | 56 | const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points |
14ce0a6e | 57 | AliEMCALCalibData* AliEMCALLoader::fgCalibData = 0; //calibation data |
58 | AliEMCALAlignData* AliEMCALLoader::fgAlignData = 0; //alignment data | |
d64c959b | 59 | |
88cb7938 | 60 | //____________________________________________________________________________ |
61 | AliEMCALLoader::AliEMCALLoader() | |
d64c959b | 62 | { |
14ce0a6e | 63 | //Default constructor for EMCAL Loader Class |
64 | ||
88cb7938 | 65 | fDebug = 0; |
5dee926e | 66 | fHits = new TClonesArray("AliEMCALHit"); |
67 | fDigits = new TClonesArray("AliEMCALDigit"); | |
68 | fSDigits = new TClonesArray("AliEMCALDigit"); | |
69 | fRecPoints = new TObjArray(); | |
d64c959b | 70 | } |
71 | ||
88cb7938 | 72 | //____________________________________________________________________________ |
73 | AliEMCALLoader::AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername): | |
d64c959b | 74 | AliLoader(detname,eventfoldername) |
88cb7938 | 75 | { |
14ce0a6e | 76 | //Specific constructor for EMCAL Loader class |
77 | ||
88cb7938 | 78 | fDebug=0; |
5dee926e | 79 | fHits = new TClonesArray("AliEMCALHit"); |
80 | fDigits = new TClonesArray("AliEMCALDigit"); | |
81 | fSDigits = new TClonesArray("AliEMCALDigit"); | |
82 | fRecPoints = new TObjArray(); | |
88cb7938 | 83 | } |
88cb7938 | 84 | |
d64c959b | 85 | //____________________________________________________________________________ |
88cb7938 | 86 | AliEMCALLoader::~AliEMCALLoader() |
87 | { | |
5dee926e | 88 | // Disconnect trees and remove arrays |
89 | if (TreeH()) | |
90 | TreeH()->SetBranchAddress(fDetectorName,0); | |
91 | if (TreeD()) | |
92 | TreeD()->SetBranchAddress(fDetectorName,0); | |
93 | if (TreeS()) | |
94 | TreeS()->SetBranchAddress(fDetectorName,0); | |
95 | if (TreeR()) | |
96 | TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0); | |
97 | delete fHits; | |
98 | delete fDigits; | |
99 | delete fSDigits; | |
100 | delete fRecPoints; | |
101 | } | |
102 | ||
bcdecbbe | 103 | //____________________________________________________________________________ |
104 | AliEMCALAlignData* AliEMCALLoader::AlignData() | |
105 | { | |
106 | // Check if the instance of AliEMCALAlignData exists, and return it | |
107 | ||
108 | if( !(AliCDBManager::Instance()->IsDefaultStorageSet()) ) | |
14ce0a6e | 109 | fgAlignData=0x0; |
110 | return fgAlignData; | |
bcdecbbe | 111 | } |
112 | ||
f565d89d | 113 | //____________________________________________________________________________ |
114 | AliEMCALCalibData* AliEMCALLoader::CalibData() | |
115 | { | |
bcdecbbe | 116 | // Check if the instance of AliEMCALCalibData exists, and return it |
f565d89d | 117 | |
78cbbabb | 118 | if( !(AliCDBManager::Instance()->IsDefaultStorageSet()) ) |
14ce0a6e | 119 | fgCalibData=0x0; |
78cbbabb | 120 | |
14ce0a6e | 121 | return fgCalibData; |
78cbbabb | 122 | |
f565d89d | 123 | } |
124 | ||
125 | //____________________________________________________________________________ | |
126 | Int_t AliEMCALLoader::CalibrateRaw(Double_t energy, Int_t module, | |
127 | Int_t column, Int_t row) | |
128 | { | |
129 | // Convert energy into digitized amplitude for a cell relId | |
130 | // It is a user responsilibity to open CDB and set | |
131 | // AliEMCALCalibData object by the following operators: | |
132 | // | |
133 | // AliCDBLocal *loc = new AliCDBLocal("deCalibDB"); | |
134 | // AliEMCALCalibData* clb = (AliEMCALCalibData*)AliCDBStorage::Instance() | |
135 | // ->Get(path_to_calibdata,run_number); | |
136 | // AliEMCALGetter* gime = AliEMCALGetter::Instance("galice.root"); | |
137 | // gime->SetCalibData(clb); | |
138 | ||
139 | if (CalibData() == 0) | |
140 | Warning("CalibrateRaw","Calibration DB is not initiated!"); | |
141 | ||
78cbbabb | 142 | Float_t gainFactor = 0.00305;//0.0015; // width of one ADC channel in GeV |
143 | Float_t pedestal = 0.009;//0.005; // pedestals | |
f565d89d | 144 | |
145 | if(CalibData()) { | |
146 | gainFactor = CalibData()->GetADCchannel (module,column,row); | |
147 | pedestal = CalibData()->GetADCpedestal(module,column,row); | |
148 | } | |
149 | ||
150 | Int_t amp = static_cast<Int_t>( (energy - pedestal) / gainFactor + 0.5 ) ; | |
151 | return amp; | |
152 | } | |
153 | ||
5dee926e | 154 | //____________________________________________________________________________ |
14ce0a6e | 155 | Int_t AliEMCALLoader::LoadHits(Option_t* opt) |
156 | { | |
157 | //Load the hits tree for the | |
158 | //EMCAL | |
ea6ddc2c | 159 | |
160 | Int_t status = AliLoader::LoadHits(opt); // First call AliLoader to do all the groundwork | |
161 | ||
5dee926e | 162 | TTree *treeH = TreeH(); |
ea6ddc2c | 163 | |
5dee926e | 164 | if (treeH) { |
165 | treeH->SetBranchAddress(fDetectorName,&fHits); | |
166 | if (treeH->GetEntries() > 1) | |
40b572fb | 167 | AliWarning("Multiple arrays in treeH no longer supported"); |
5dee926e | 168 | treeH->GetEvent(0); |
88cb7938 | 169 | } |
ea6ddc2c | 170 | |
171 | return status; | |
172 | } | |
88cb7938 | 173 | |
ea6ddc2c | 174 | //____________________________________________________________________________ |
14ce0a6e | 175 | Int_t AliEMCALLoader::LoadSDigits(Option_t* opt) |
176 | { | |
177 | //Load SDigits from TreeS for EMCAL | |
178 | ||
ea6ddc2c | 179 | Int_t status = AliLoader::LoadSDigits(opt); // First call AliLoader to do all the groundwork |
180 | ||
5dee926e | 181 | TTree *treeS = TreeS(); |
ea6ddc2c | 182 | |
5dee926e | 183 | if (treeS) { |
184 | treeS->SetBranchAddress(fDetectorName,&fSDigits); | |
185 | treeS->GetEvent(0); | |
186 | } | |
ea6ddc2c | 187 | |
188 | return status; | |
189 | } | |
88cb7938 | 190 | |
ea6ddc2c | 191 | //____________________________________________________________________________ |
14ce0a6e | 192 | Int_t AliEMCALLoader::LoadDigits(Option_t* opt) |
193 | { | |
194 | //Load Digits from TreeD for EMCAL | |
195 | ||
ea6ddc2c | 196 | Int_t status = AliLoader::LoadDigits(opt); // First call AliLoader to do all the groundwork |
197 | ||
5dee926e | 198 | TTree *treeD = TreeD(); |
ea6ddc2c | 199 | |
5dee926e | 200 | if (treeD) { |
201 | treeD->SetBranchAddress(fDetectorName,&fDigits); | |
202 | treeD->GetEvent(0); | |
203 | } | |
ea6ddc2c | 204 | |
205 | return status; | |
206 | } | |
88cb7938 | 207 | |
ea6ddc2c | 208 | //____________________________________________________________________________ |
14ce0a6e | 209 | Int_t AliEMCALLoader::LoadRecPoints(Option_t* opt) |
210 | { | |
211 | //Load RecPoints from TreeR for EMCAL | |
ea6ddc2c | 212 | |
213 | Int_t status = AliLoader::LoadRecPoints(opt); // First call AliLoader to do all the groundwork | |
214 | ||
5dee926e | 215 | TTree *treeR = TreeR(); |
216 | if (treeR) { | |
217 | treeR->SetBranchAddress(fgkECARecPointsBranchName,&fRecPoints); | |
218 | treeR->GetEvent(0); | |
219 | } | |
ea6ddc2c | 220 | |
221 | return status; | |
222 | } | |
88cb7938 | 223 | |
ea6ddc2c | 224 | //____________________________________________________________________________ |
14ce0a6e | 225 | Int_t AliEMCALLoader::GetEvent() |
226 | { | |
227 | //Method to load all of the data | |
228 | //members of the EMCAL for a given | |
229 | //event from the Trees | |
230 | ||
ea6ddc2c | 231 | AliLoader::GetEvent(); // First call AliLoader to do all the groundwork |
232 | ||
233 | // Now connect and fill TClonesArray | |
234 | ||
235 | // Hits | |
236 | TTree *treeH = TreeH(); | |
237 | ||
238 | if (treeH) { | |
239 | treeH->SetBranchAddress(fDetectorName,&fHits); | |
240 | if (treeH->GetEntries() > 1) | |
241 | AliWarning("Multiple arrays in treeH no longer supported"); | |
242 | treeH->GetEvent(0); | |
243 | } | |
244 | ||
245 | ||
246 | // SDigits | |
247 | TTree *treeS = TreeS(); | |
248 | if (treeS) { | |
249 | treeS->SetBranchAddress(fDetectorName,&fSDigits); | |
250 | treeS->GetEvent(0); | |
251 | } | |
252 | ||
253 | // Digits | |
254 | TTree *treeD = TreeD(); | |
255 | if (treeD) { | |
256 | treeD->SetBranchAddress(fDetectorName,&fDigits); | |
257 | treeD->GetEvent(0); | |
258 | } | |
259 | ||
260 | // RecPoints | |
261 | TTree *treeR = TreeR(); | |
262 | if (treeR) { | |
263 | treeR->SetBranchAddress(fgkECARecPointsBranchName,&fRecPoints); | |
264 | treeR->GetEvent(0); | |
265 | } | |
266 | ||
267 | return 0; | |
88cb7938 | 268 | } |