]>
Commit | Line | Data |
---|---|---|
52783dbc | 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 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // class for PHOS calibration // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
fc6706cb | 24 | #include "TRandom.h" |
76d78b7a | 25 | #include "AliLog.h" |
52783dbc | 26 | #include "AliPHOSCalibData.h" |
fc6706cb | 27 | #include "AliCDBManager.h" |
28 | #include "AliCDBStorage.h" | |
29 | #include "AliCDBId.h" | |
30 | #include "AliCDBEntry.h" | |
1fdb1c5e | 31 | #include "AliPHOSEmcCalibData.h" |
32 | #include "AliPHOSCpvCalibData.h" | |
81701069 | 33 | #include "AliPHOSEmcBadChannelsMap.h" |
1fdb1c5e | 34 | #include "AliCDBMetaData.h" |
52783dbc | 35 | |
36 | ClassImp(AliPHOSCalibData) | |
37 | ||
38 | //________________________________________________________________ | |
fc6706cb | 39 | AliPHOSCalibData::AliPHOSCalibData(): |
3f7dbdb7 | 40 | TNamed(), |
41 | fCalibDataEmc(0x0), | |
42 | fCalibDataCpv(0x0), | |
81701069 | 43 | fEmcBadChannelsMap(0x0), |
3f7dbdb7 | 44 | fEmcDataPath("PHOS/Calib/EmcGainPedestals"), |
81701069 | 45 | fCpvDataPath("PHOS/Calib/CpvGainPedestals"), |
46 | fEmcBadChannelsMapPath("PHOS/Calib/EmcBadChannels") | |
52783dbc | 47 | { |
76d78b7a | 48 | // Default constructor. |
49 | // Open CDB entry, get EMC and CPV calibration data and bad channel map. | |
50 | // If EMC or CPV calibration data does not exist, stop the run | |
49519b04 | 51 | |
52783dbc | 52 | } |
53 | ||
54 | //________________________________________________________________ | |
fc6706cb | 55 | AliPHOSCalibData::AliPHOSCalibData(Int_t runNumber) : |
56 | TNamed("phosCalib","PHOS Calibration Data Manager"), | |
81701069 | 57 | fCalibDataEmc(0x0), fCalibDataCpv(0x0), fEmcBadChannelsMap(0x0), |
3f7dbdb7 | 58 | fEmcDataPath("PHOS/Calib/EmcGainPedestals"), |
81701069 | 59 | fCpvDataPath("PHOS/Calib/CpvGainPedestals"), |
60 | fEmcBadChannelsMapPath("PHOS/Calib/EmcBadChannels") | |
52783dbc | 61 | { |
62 | // Constructor | |
76d78b7a | 63 | // Open CDB entry, get EMC and CPV calibration data and bad channel map. |
64 | // If EMC or CPV calibration data does not exist, stop the run | |
65 | ||
fc6706cb | 66 | AliCDBEntry* entryEmc = AliCDBManager::Instance()->Get(fEmcDataPath.Data(),runNumber); |
67 | if(entryEmc) | |
68 | fCalibDataEmc = (AliPHOSEmcCalibData*)entryEmc->GetObject(); | |
76d78b7a | 69 | |
70 | if(!fCalibDataEmc) | |
71 | AliFatal("Calibration parameters for PHOS EMC not found. Stop reconstruction!\n"); | |
fc6706cb | 72 | |
73 | AliCDBEntry* entryCpv = AliCDBManager::Instance()->Get(fCpvDataPath.Data(),runNumber); | |
74 | if(entryCpv) | |
75 | fCalibDataCpv = (AliPHOSCpvCalibData*)entryCpv->GetObject(); | |
52783dbc | 76 | |
76d78b7a | 77 | if(!fCalibDataCpv) |
78 | AliFatal("Calibration parameters for PHOS CPV not found. Stop reconstruction!\n"); | |
79 | ||
81701069 | 80 | AliCDBEntry* entryEmcBadMap = AliCDBManager::Instance()-> |
81 | Get(fEmcBadChannelsMapPath.Data(),runNumber); | |
82 | if(entryEmcBadMap) | |
83 | fEmcBadChannelsMap = (AliPHOSEmcBadChannelsMap*)entryEmcBadMap->GetObject(); | |
84 | ||
52783dbc | 85 | } |
86 | ||
1fdb1c5e | 87 | //________________________________________________________________ |
88 | AliPHOSCalibData::AliPHOSCalibData(AliPHOSCalibData & phosCDB) : | |
3f7dbdb7 | 89 | TNamed(phosCDB), |
90 | fCalibDataEmc(phosCDB.fCalibDataEmc), | |
91 | fCalibDataCpv(phosCDB.fCalibDataCpv), | |
81701069 | 92 | fEmcBadChannelsMap(phosCDB.fEmcBadChannelsMap), |
3f7dbdb7 | 93 | fEmcDataPath(phosCDB.fEmcDataPath), |
81701069 | 94 | fCpvDataPath(phosCDB.fCpvDataPath), |
95 | fEmcBadChannelsMapPath(phosCDB.fEmcBadChannelsMapPath) | |
1fdb1c5e | 96 | { |
97 | // Copy constructor | |
1fdb1c5e | 98 | } |
52783dbc | 99 | //________________________________________________________________ |
100 | AliPHOSCalibData::~AliPHOSCalibData() | |
101 | { | |
102 | // Destructor | |
fc6706cb | 103 | |
52783dbc | 104 | } |
105 | ||
929af5d7 | 106 | //________________________________________________________________ |
3f7dbdb7 | 107 | AliPHOSCalibData & AliPHOSCalibData::operator = (const AliPHOSCalibData & rhs) |
108 | { | |
109 | //Copy-assignment. Does not delete anything (see destructor) | |
110 | //compiler generated is ok, but ... because -Weffc++ and pointer | |
111 | //members we have to define it explicitly. | |
112 | TNamed::operator=(rhs); | |
929af5d7 | 113 | if (this != &rhs) { |
114 | fCalibDataEmc = rhs.fCalibDataEmc; | |
115 | fCalibDataCpv = rhs.fCalibDataCpv; | |
116 | fEmcBadChannelsMap = rhs.fEmcBadChannelsMap; | |
117 | fEmcDataPath = rhs.fEmcDataPath; | |
118 | fCpvDataPath = rhs.fCpvDataPath; | |
119 | fEmcBadChannelsMapPath = rhs.fEmcBadChannelsMapPath; | |
120 | } | |
121 | else { | |
122 | AliFatal("Self assignment!"); | |
123 | } | |
3f7dbdb7 | 124 | return *this; |
125 | } | |
126 | ||
52783dbc | 127 | //________________________________________________________________ |
128 | void AliPHOSCalibData::Reset() | |
129 | { | |
b8628054 | 130 | // Set all pedestals to 0 and all ADC channels to 1, |
131 | // and all channels are good (alive) | |
fc6706cb | 132 | |
b8628054 | 133 | fCalibDataEmc ->Reset(); |
134 | fCalibDataCpv ->Reset(); | |
135 | fEmcBadChannelsMap->Reset(); | |
52783dbc | 136 | } |
137 | ||
138 | //________________________________________________________________ | |
139 | void AliPHOSCalibData::Print(Option_t *option) const | |
140 | { | |
1fdb1c5e | 141 | // Print EMC and CPV calibration containers |
142 | // Input: option="ped" to print pedestals | |
143 | // option="gain" to print calibration coefficients | |
df0d5123 | 144 | if (fCalibDataEmc) fCalibDataEmc->Print(option); |
145 | if (fCalibDataCpv) fCalibDataCpv->Print(option); | |
fc6706cb | 146 | } |
147 | ||
148 | //________________________________________________________________ | |
149 | void AliPHOSCalibData::CreateNew() | |
150 | { | |
1fdb1c5e | 151 | // Create new EMC and CPV calibration containers with ideal coefficients |
152 | ||
fc6706cb | 153 | if(fCalibDataEmc) delete fCalibDataEmc; |
154 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
155 | ||
156 | if(fCalibDataCpv) delete fCalibDataCpv; | |
157 | fCalibDataCpv = new AliPHOSCpvCalibData("PHOS-CPV"); | |
158 | ||
81701069 | 159 | if(fEmcBadChannelsMap) delete fEmcBadChannelsMap; |
160 | fEmcBadChannelsMap = new AliPHOSEmcBadChannelsMap(); | |
161 | ||
fc6706cb | 162 | } |
163 | ||
164 | //________________________________________________________________ | |
165 | Bool_t AliPHOSCalibData::WriteEmc(Int_t firstRun, Int_t lastRun, AliCDBMetaData *md) | |
166 | { | |
1fdb1c5e | 167 | // Write EMC calibration container to CDB |
fc6706cb | 168 | |
169 | if(!fCalibDataEmc) return kFALSE; | |
170 | ||
18669c5c | 171 | AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("PHOS/*"); |
df0d5123 | 172 | if(!storage) |
173 | storage = AliCDBManager::Instance()->GetDefaultStorage(); | |
174 | ||
fc6706cb | 175 | if(storage) { |
176 | AliCDBId id(fEmcDataPath.Data(),firstRun,lastRun); | |
177 | storage->Put(fCalibDataEmc,id, md); | |
178 | return kTRUE; | |
52783dbc | 179 | } |
fc6706cb | 180 | else |
181 | return kFALSE; | |
52783dbc | 182 | |
fc6706cb | 183 | } |
184 | ||
185 | //________________________________________________________________ | |
186 | Bool_t AliPHOSCalibData::WriteCpv(Int_t firstRun, Int_t lastRun, AliCDBMetaData *md) | |
187 | { | |
1fdb1c5e | 188 | // Write CPV calibration container to CDB |
fc6706cb | 189 | |
190 | if(!fCalibDataCpv) return kFALSE; | |
191 | ||
18669c5c | 192 | AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("PHOS/*"); |
df0d5123 | 193 | if(!storage) |
194 | storage = AliCDBManager::Instance()->GetDefaultStorage(); | |
195 | ||
fc6706cb | 196 | if(storage) { |
197 | AliCDBId id(fCpvDataPath.Data(),firstRun,lastRun); | |
198 | storage->Put(fCalibDataCpv,id, md); | |
199 | return kTRUE; | |
52783dbc | 200 | } |
fc6706cb | 201 | else |
202 | return kFALSE; | |
203 | ||
52783dbc | 204 | } |
072de3a8 | 205 | |
81701069 | 206 | |
207 | //________________________________________________________________ | |
208 | Bool_t AliPHOSCalibData::WriteEmcBadChannelsMap(Int_t firstRun,Int_t lastRun,AliCDBMetaData *md) | |
209 | { | |
210 | //Write EMC bad channels map into CDB. | |
211 | ||
212 | if(!fEmcBadChannelsMap) return kFALSE; | |
213 | ||
214 | AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("PHOS/*"); | |
215 | if(!storage) | |
216 | storage = AliCDBManager::Instance()->GetDefaultStorage(); | |
217 | ||
218 | if(storage) { | |
219 | AliCDBId id(fEmcBadChannelsMapPath.Data(),firstRun,lastRun); | |
220 | storage->Put(fEmcBadChannelsMap,id, md); | |
221 | return kTRUE; | |
222 | } | |
223 | else | |
224 | return kFALSE; | |
225 | } | |
226 | ||
fc6706cb | 227 | //________________________________________________________________ |
072de3a8 | 228 | Float_t AliPHOSCalibData::GetADCchannelEmc(Int_t module, Int_t column, Int_t row) const |
229 | { | |
1fdb1c5e | 230 | // Return EMC calibration coefficient |
231 | // for channel defined by (module,column,row) | |
232 | // module, column,raw should follow the internal PHOS convention: | |
233 | // module 1:5, column 1:56, row 1:64 | |
234 | // if CBD instance exists, the value is taken from CDB. | |
235 | // Otherwise it is an ideal one | |
072de3a8 | 236 | |
fc6706cb | 237 | if(fCalibDataEmc) |
238 | return fCalibDataEmc->GetADCchannelEmc(module,column,row); | |
239 | else | |
5f8bb860 | 240 | return 1.0; // default width of one EMC ADC channel in GeV |
072de3a8 | 241 | } |
242 | ||
e3310625 | 243 | //________________________________________________________________ |
244 | void AliPHOSCalibData::SetADCchannelEmc(Int_t module, Int_t column, Int_t row, Float_t value) | |
245 | { | |
246 | // Set EMC calibration coefficient for (module,column,row) | |
247 | ||
248 | if(!fCalibDataEmc) | |
249 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
250 | ||
251 | fCalibDataEmc->SetADCchannelEmc(module,column,row,value); | |
252 | } | |
253 | ||
1fdb1c5e | 254 | //________________________________________________________________ |
072de3a8 | 255 | Float_t AliPHOSCalibData::GetADCpedestalEmc(Int_t module, Int_t column, Int_t row) const |
256 | { | |
1fdb1c5e | 257 | // Return EMC pedestal for channel defined by (module,column,row) |
258 | // module, column,raw should follow the internal PHOS convention: | |
259 | // module 1:5, column 1:56, row 1:64 | |
260 | // if CBD instance exists, the value is taken from CDB. | |
261 | // Otherwise it is an ideal one | |
262 | ||
fc6706cb | 263 | if(fCalibDataEmc) |
264 | return fCalibDataEmc->GetADCpedestalEmc(module,column,row); | |
265 | else | |
5f8bb860 | 266 | return 0.0; // default EMC ADC pedestal |
072de3a8 | 267 | } |
268 | ||
1fdb1c5e | 269 | //________________________________________________________________ |
e3310625 | 270 | void AliPHOSCalibData::SetADCpedestalEmc(Int_t module, Int_t column, Int_t row, Float_t value) |
072de3a8 | 271 | { |
e3310625 | 272 | // Set EMC pedestal for (module,column,row) |
1fdb1c5e | 273 | |
fc6706cb | 274 | if(!fCalibDataEmc) |
275 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
276 | ||
e3310625 | 277 | fCalibDataEmc->SetADCpedestalEmc(module,column,row,value); |
072de3a8 | 278 | } |
279 | ||
1fdb1c5e | 280 | //________________________________________________________________ |
e3310625 | 281 | Float_t AliPHOSCalibData::GetHighLowRatioEmc(Int_t module, Int_t column, Int_t row) const |
072de3a8 | 282 | { |
e3310625 | 283 | // Return EMC calibration coefficient |
284 | // for channel defined by (module,column,row) | |
285 | // module, column,raw should follow the internal PHOS convention: | |
286 | // module 1:5, column 1:56, row 1:64 | |
287 | // if CBD instance exists, the value is taken from CDB. | |
288 | // Otherwise it is an ideal one | |
289 | ||
290 | if(fCalibDataEmc) | |
291 | return fCalibDataEmc->GetHighLowRatioEmc(module,column,row); | |
292 | else | |
293 | return 1.0; // default width of one EMC ADC channel in GeV | |
294 | } | |
295 | ||
296 | //________________________________________________________________ | |
297 | void AliPHOSCalibData::SetHighLowRatioEmc(Int_t module, Int_t column, Int_t row, Float_t value) | |
298 | { | |
299 | // Set EMC calibration coefficient for (module,column,row) | |
300 | ||
fc6706cb | 301 | if(!fCalibDataEmc) |
302 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
e3310625 | 303 | |
304 | fCalibDataEmc->SetHighLowRatioEmc(module,column,row,value); | |
fc6706cb | 305 | } |
e3310625 | 306 | |
307 | //________________________________________________________________ | |
308 | Float_t AliPHOSCalibData::GetTimeShiftEmc(Int_t module, Int_t column, Int_t row) const | |
309 | { | |
310 | // Return EMC calibration coefficient | |
311 | // for channel defined by (module,column,row) | |
312 | // module, column,raw should follow the internal PHOS convention: | |
313 | // module 1:5, column 1:56, row 1:64 | |
314 | // if CBD instance exists, the value is taken from CDB. | |
315 | // Otherwise it is an ideal one | |
316 | ||
317 | if(fCalibDataEmc) | |
318 | return fCalibDataEmc->GetTimeShiftEmc(module,column,row); | |
319 | else | |
f1731579 | 320 | return 0.0; // by default no offset |
e3310625 | 321 | } |
f1731579 | 322 | //________________________________________________________________ |
323 | Float_t AliPHOSCalibData::GetLGTimeShiftEmc(Int_t module, Int_t column, Int_t row) const | |
324 | { | |
325 | // Return EMC calibration coefficient | |
326 | // for channel defined by (module,column,row) | |
327 | // module, column,raw should follow the internal PHOS convention: | |
328 | // module 1:5, column 1:56, row 1:64 | |
329 | // if CBD instance exists, the value is taken from CDB. | |
330 | // Otherwise it is an ideal one | |
331 | ||
332 | if(fCalibDataEmc) | |
333 | return fCalibDataEmc->GetLGTimeShiftEmc(module,column,row); | |
334 | else | |
335 | return 0.0; // no offset by default | |
336 | } | |
337 | ||
338 | //________________________________________________________________ | |
339 | void AliPHOSCalibData::SetLGTimeShiftEmc(Int_t module, Int_t column, Int_t row, Float_t value) | |
340 | { | |
341 | // Set EMC calibration coefficient for (module,column,row) | |
e3310625 | 342 | |
f1731579 | 343 | if(!fCalibDataEmc) |
344 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
345 | ||
346 | fCalibDataEmc->SetLGTimeShiftEmc(module,column,row,value); | |
347 | } | |
e3310625 | 348 | //________________________________________________________________ |
349 | void AliPHOSCalibData::SetTimeShiftEmc(Int_t module, Int_t column, Int_t row, Float_t value) | |
350 | { | |
351 | // Set EMC calibration coefficient for (module,column,row) | |
352 | ||
353 | if(!fCalibDataEmc) | |
354 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
355 | ||
356 | fCalibDataEmc->SetTimeShiftEmc(module,column,row,value); | |
357 | } | |
bafc1087 | 358 | //________________________________________________________________ |
6f47f50d | 359 | Float_t AliPHOSCalibData::GetSampleTimeStep() const |
360 | { | |
361 | //Get conversion coeff. from sample time step to seconds. | |
362 | //Negative value means that it is not used in reconstruction | |
363 | //but only in simulation of raw. | |
364 | if(fCalibDataEmc) | |
365 | return fCalibDataEmc->GetSampleTimeStep(); | |
366 | else | |
367 | return 0.0; // default width of one EMC ADC channel in GeV | |
368 | } | |
369 | //________________________________________________________________ | |
370 | void AliPHOSCalibData::SetSampleTimeStep(Float_t step) | |
371 | { | |
372 | //Set conversion coeff. from sample time step to seconds. | |
373 | //Negative value means that it is not used in reconstruction | |
374 | //but only in simulation of raw. | |
375 | if(!fCalibDataEmc) | |
376 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
377 | ||
378 | fCalibDataEmc->SetSampleTimeStep(step) ; | |
379 | } | |
380 | //________________________________________________________________ | |
bafc1087 | 381 | Int_t AliPHOSCalibData::GetAltroOffsetEmc(Int_t module, Int_t column, Int_t row) const |
382 | { | |
383 | // Return ALTRO pedestal coefficient | |
384 | // for channel defined by (module,column,row) | |
385 | // module, column,raw should follow the internal PHOS convention: | |
386 | // module 1:5, column 1:56, row 1:64 | |
387 | // if CBD instance exists, the value is taken from CDB. | |
388 | // Otherwise it is an ideal one | |
389 | ||
390 | if(fCalibDataEmc) | |
391 | return fCalibDataEmc->GetAltroOffsetEmc(module,column,row); | |
392 | else | |
393 | return 0; // default width of one EMC ADC channel in GeV | |
394 | } | |
395 | ||
396 | //________________________________________________________________ | |
397 | void AliPHOSCalibData::SetAltroOffsetEmc(Int_t module, Int_t column, Int_t row, Int_t value) | |
398 | { | |
399 | // Set altro offset for (module,column,row) | |
400 | ||
401 | if(!fCalibDataEmc) | |
402 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
403 | ||
404 | fCalibDataEmc->SetAltroOffsetEmc(module,column,row,value); | |
405 | } | |
406 | ||
e3310625 | 407 | |
fc6706cb | 408 | //________________________________________________________________ |
409 | Float_t AliPHOSCalibData::GetADCchannelCpv(Int_t module, Int_t column, Int_t row) const | |
410 | { | |
1fdb1c5e | 411 | // Return CPV calibration coefficient |
412 | // for channel defined by (module,column,row) | |
413 | // module, column,raw should follow the internal CPV convention: | |
414 | // module 1:5, column 1:56, row 1:128 | |
415 | // if CBD instance exists, the value is taken from CDB. | |
416 | // Otherwise it is an ideal one | |
fc6706cb | 417 | |
418 | if(fCalibDataCpv) | |
419 | return fCalibDataCpv->GetADCchannelCpv(module,column,row); | |
420 | else | |
5f8bb860 | 421 | return 0.0012; // default width of one ADC channel in CPV arbitrary units |
fc6706cb | 422 | } |
423 | ||
1fdb1c5e | 424 | //________________________________________________________________ |
fc6706cb | 425 | Float_t AliPHOSCalibData::GetADCpedestalCpv(Int_t module, Int_t column, Int_t row) const |
426 | { | |
1fdb1c5e | 427 | // Return CPV pedestal |
428 | // for channel defined by (module,column,row) | |
429 | // module, column,raw should follow the internal CPV convention: | |
430 | // module 1:5, column 1:56, row 1:128 | |
431 | // if CBD instance exists, the value is taken from CDB. | |
432 | // Otherwise it is an ideal one | |
433 | ||
fc6706cb | 434 | if(fCalibDataCpv) |
435 | return fCalibDataCpv->GetADCpedestalCpv(module,column,row); | |
436 | else | |
437 | return 0.012; // default CPV ADC pedestal | |
438 | } | |
439 | ||
1fdb1c5e | 440 | //________________________________________________________________ |
fc6706cb | 441 | void AliPHOSCalibData::SetADCchannelCpv(Int_t module, Int_t column, Int_t row, Float_t value) |
442 | { | |
1fdb1c5e | 443 | // Set CPV calibration coefficient for (module,column,row) |
444 | ||
fc6706cb | 445 | if(!fCalibDataCpv) |
446 | fCalibDataCpv = new AliPHOSCpvCalibData("PHOS-CPV"); | |
447 | ||
448 | fCalibDataCpv->SetADCchannelCpv(module,column,row,value); | |
449 | } | |
450 | ||
1fdb1c5e | 451 | //________________________________________________________________ |
fc6706cb | 452 | void AliPHOSCalibData::SetADCpedestalCpv(Int_t module, Int_t column, Int_t row, Float_t value) |
453 | { | |
1fdb1c5e | 454 | // Set CPV pedestal for (module,column,row) |
455 | ||
fc6706cb | 456 | if(!fCalibDataCpv) |
457 | fCalibDataCpv = new AliPHOSCpvCalibData("PHOS-CPV"); | |
458 | ||
459 | fCalibDataCpv->SetADCpedestalCpv(module,column,row,value); | |
460 | } | |
461 | ||
462 | //________________________________________________________________ | |
e2e977c3 | 463 | void AliPHOSCalibData::RandomEmc(Float_t ccMin, Float_t ccMax) |
fc6706cb | 464 | { |
1fdb1c5e | 465 | // Create decalibrated EMC with calibration coefficients and pedestals |
466 | // randomly distributed within hard-coded limits | |
e2e977c3 | 467 | // Default spread of calibration parameters is Cmax/Cmin = 4, (Cmax-Cmin)/2 = 1 |
fc6706cb | 468 | |
469 | if(fCalibDataEmc) delete fCalibDataEmc; | |
470 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
471 | ||
472 | TRandom rn; | |
473 | rn.SetSeed(0); //the seed is set to the current machine clock | |
474 | ||
1fdb1c5e | 475 | Float_t adcChannelEmc,adcPedestalEmc; |
fc6706cb | 476 | |
477 | for(Int_t module=1; module<6; module++) { | |
478 | for(Int_t column=1; column<57; column++) { | |
479 | for(Int_t row=1; row<65; row++) { | |
e2e977c3 | 480 | adcChannelEmc =rn.Uniform(ccMin,ccMax); |
5f8bb860 | 481 | adcPedestalEmc=rn.Uniform(0.0,0.0); // 0 spread of pedestals |
1fdb1c5e | 482 | fCalibDataEmc->SetADCchannelEmc(module,column,row,adcChannelEmc); |
483 | fCalibDataEmc->SetADCpedestalEmc(module,column,row,adcPedestalEmc); | |
fc6706cb | 484 | } |
485 | } | |
486 | } | |
487 | ||
488 | } | |
489 | ||
490 | //________________________________________________________________ | |
e2e977c3 | 491 | void AliPHOSCalibData::RandomCpv(Float_t ccMin, Float_t ccMax) |
fc6706cb | 492 | { |
1fdb1c5e | 493 | // Create decalibrated CPV with calibration coefficients and pedestals |
494 | // randomly distributed within hard-coded limits | |
e2e977c3 | 495 | // Default spread of calibration parameters is 0.0012 +- 25% |
fc6706cb | 496 | |
497 | if(fCalibDataCpv) delete fCalibDataCpv; | |
498 | fCalibDataCpv = new AliPHOSCpvCalibData("PHOS-CPV"); | |
499 | ||
500 | TRandom rn; | |
501 | rn.SetSeed(0); //the seed is set to the current machine clock | |
502 | ||
1fdb1c5e | 503 | Float_t adcChannelCpv,adcPedestalCpv; |
fc6706cb | 504 | |
505 | for(Int_t module=1; module<6; module++) { | |
5f8bb860 | 506 | for(Int_t column=1; column<57; column++) { |
fc6706cb | 507 | for(Int_t row=1; row<129; row++) { |
e2e977c3 | 508 | adcChannelCpv =rn.Uniform(ccMin,ccMax); |
1fdb1c5e | 509 | adcPedestalCpv=rn.Uniform(0.0048,0.0192); // Ped[max]/Ped[min] = 4, <Ped> = 0.012 |
510 | fCalibDataCpv->SetADCchannelCpv(module,column,row,adcChannelCpv); | |
511 | fCalibDataCpv->SetADCpedestalCpv(module,column,row,adcPedestalCpv); | |
fc6706cb | 512 | } |
513 | } | |
514 | } | |
072de3a8 | 515 | } |
81701069 | 516 | //________________________________________________________________ |
517 | Bool_t AliPHOSCalibData::IsBadChannelEmc(Int_t module, Int_t col, Int_t row) const | |
518 | { | |
519 | //If no bad channels map found, channel considered good | |
520 | ||
521 | if(fEmcBadChannelsMap) | |
522 | return fEmcBadChannelsMap->IsBadChannel(module,col,row); | |
523 | else | |
524 | return kFALSE; | |
525 | } | |
526 | ||
527 | //________________________________________________________________ | |
528 | Int_t AliPHOSCalibData::GetNumOfEmcBadChannels() const | |
529 | { | |
530 | if(fEmcBadChannelsMap) | |
531 | return fEmcBadChannelsMap->GetNumOfBadChannels(); | |
532 | else | |
533 | return 0; | |
534 | } | |
d940eb29 | 535 | //________________________________________________________________ |
536 | void AliPHOSCalibData::EmcBadChannelIds(Int_t *badIds) | |
537 | { | |
538 | //Fill array badIds by the Ids of EMC bad channels. | |
539 | //Array badIds of length GetNumOfBadChannels() should be prepared in advance. | |
540 | ||
541 | if(fEmcBadChannelsMap) | |
542 | fEmcBadChannelsMap->BadChannelIds(badIds); | |
543 | } | |
d5b302a6 | 544 | |
545 | //________________________________________________________________ | |
546 | Float_t AliPHOSCalibData::GetADCchannelEmcDecalib(Int_t module, Int_t column, Int_t row) const | |
547 | { | |
548 | // Return random EMC (de)calibration factor O(1) for channel defined by (module,column,row). | |
549 | // Used in simulation. | |
550 | ||
551 | // module, column,raw should follow the internal PHOS convention: | |
552 | // module 1:5, column 1:56, row 1:64 | |
553 | // if CBD instance exists, the value is taken from CDB. | |
554 | // Otherwise it is an ideal one (no decalibration). | |
555 | ||
556 | if(fCalibDataEmc) | |
557 | return fCalibDataEmc->GetADCchannelEmcDecalib(module,column,row); | |
558 | else | |
559 | return 1.0; // no decalibration by default | |
560 | } | |
561 | ||
562 | //________________________________________________________________ | |
563 | void AliPHOSCalibData::SetADCchannelEmcDecalib(Int_t module, Int_t column, Int_t row, Float_t value) | |
564 | { | |
565 | // Set EMC (de)calibration factor for (module,column,row). | |
566 | // Used in simulation. | |
567 | ||
568 | if(!fCalibDataEmc) | |
569 | fCalibDataEmc = new AliPHOSEmcCalibData("PHOS-EMC"); | |
570 | ||
571 | fCalibDataEmc->SetADCchannelEmcDecalib(module,column,row,value); | |
572 | } |