]>
Commit | Line | Data |
---|---|---|
1a1fdef7 | 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 | **************************************************************************/ | |
1a1fdef7 | 15 | /* $Id$ */ |
c2fc1258 | 16 | /** @file AliFMDParameters.cxx |
17 | @author Christian Holm Christensen <cholm@nbi.dk> | |
18 | @date Mon Mar 27 12:44:26 2006 | |
19 | @brief Manager of FMD parameters | |
20 | */ | |
1a1fdef7 | 21 | //____________________________________________________________________ |
22 | // | |
23 | // Forward Multiplicity Detector based on Silicon wafers. | |
24 | // | |
25 | // This class is a singleton that handles various parameters of | |
26 | // the FMD detectors. | |
6169f936 | 27 | // The manager normally serves the parameters from the Conditions |
28 | // Database (CDB). These are retrivied by the member function | |
29 | // `Init'. Optionally, the class can serve hard-coded constants, if | |
30 | // no CDB is available. | |
1a1fdef7 | 31 | // |
f95a63c4 | 32 | #include "AliFMDDebug.h" // ALILOG_H |
8f6ee336 | 33 | #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H |
34 | #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H | |
35 | #include "AliFMDRing.h" // ALIFMDRING_H | |
36 | #include "AliFMDCalibGain.h" // ALIFMDCALIBGAIN_H | |
37 | #include "AliFMDCalibPedestal.h" // ALIFMDCALIBPEDESTAL_H | |
c2fc1258 | 38 | #include "AliFMDCalibSampleRate.h" // ALIFMDCALIBSAMPLERATE_H |
39 | #include "AliFMDCalibStripRange.h" // ALIFMDCALIBSTRIPRANGE_H | |
57c3c593 | 40 | #include "AliFMDAltroMapping.h" // ALIFMDALTROMAPPING_H |
41 | #include <AliCDBManager.h> // ALICDBMANAGER_H | |
42 | #include <AliCDBEntry.h> // ALICDBMANAGER_H | |
dc02d468 | 43 | #include <AliFMDPreprocessor.h> |
44 | #include <AliLog.h> | |
1a1fdef7 | 45 | #include <Riostream.h> |
8ec606c2 | 46 | #include <sstream> |
dc02d468 | 47 | #include <TSystem.h> |
6169f936 | 48 | #include <TArrayF.h> |
49 | #include <TH2D.h> | |
1a1fdef7 | 50 | |
51 | //==================================================================== | |
52 | ClassImp(AliFMDParameters) | |
53 | #if 0 | |
54 | ; // This is here to keep Emacs for indenting the next line | |
55 | #endif | |
56 | ||
57 | //____________________________________________________________________ | |
58 | AliFMDParameters* AliFMDParameters::fgInstance = 0; | |
59 | ||
57c3c593 | 60 | //____________________________________________________________________ |
77186f44 | 61 | const char* AliFMDParameters::fgkPulseGain = "FMD/Calib/PulseGain"; |
62 | const char* AliFMDParameters::fgkPedestal = "FMD/Calib/Pedestal"; | |
63 | const char* AliFMDParameters::fgkDead = "FMD/Calib/Dead"; | |
64 | const char* AliFMDParameters::fgkSampleRate = "FMD/Calib/SampleRate"; | |
65 | const char* AliFMDParameters::fgkAltroMap = "FMD/Calib/AltroMap"; | |
66 | const char* AliFMDParameters::fgkZeroSuppression = "FMD/Calib/ZeroSuppression"; | |
67 | const char* AliFMDParameters::fgkStripRange = "FMD/Calib/StripRange"; | |
68 | const char* AliFMDParameters::fkPedestalShuttleID = "pedestals"; | |
69 | const char* AliFMDParameters::fkGainShuttleID = "gains"; | |
70 | const char* AliFMDParameters::fkConditionsShuttleID = "conditions"; | |
57c3c593 | 71 | |
1a1fdef7 | 72 | //____________________________________________________________________ |
73 | AliFMDParameters* | |
74 | AliFMDParameters::Instance() | |
75 | { | |
76 | // Get static instance | |
77 | if (!fgInstance) fgInstance = new AliFMDParameters; | |
78 | return fgInstance; | |
79 | } | |
80 | ||
81 | //____________________________________________________________________ | |
82 | AliFMDParameters::AliFMDParameters() | |
57c3c593 | 83 | : fIsInit(kFALSE), |
02a27b50 | 84 | fkSiDeDxMip(1.664), |
b5ee4425 | 85 | fVA1MipRange(0), |
86 | fAltroChannelSize(0), | |
87 | fChannelsPerAltro(0), | |
88 | fPedestalFactor(0), | |
89 | fFixedPedestal(0), | |
90 | fFixedPedestalWidth(0), | |
91 | fFixedZeroSuppression(0), | |
92 | fFixedSampleRate(0), | |
93 | fFixedThreshold(0), | |
94 | fFixedMinStrip(0), | |
95 | fFixedMaxStrip(0), | |
8f6ee336 | 96 | fFixedPulseGain(0), |
97 | fEdepMip(0), | |
625d7886 | 98 | fHasCompleteHeader(kTRUE), |
8f6ee336 | 99 | fZeroSuppression(0), |
100 | fSampleRate(0), | |
101 | fPedestal(0), | |
102 | fPulseGain(0), | |
57c3c593 | 103 | fDeadMap(0), |
c2fc1258 | 104 | fAltroMap(0), |
105 | fStripRange(0) | |
1a1fdef7 | 106 | { |
107 | // Default constructor | |
108 | SetVA1MipRange(); | |
109 | SetAltroChannelSize(); | |
110 | SetChannelsPerAltro(); | |
111 | SetZeroSuppression(); | |
112 | SetSampleRate(); | |
113 | SetPedestal(); | |
114 | SetPedestalWidth(); | |
115 | SetPedestalFactor(); | |
8f6ee336 | 116 | SetThreshold(); |
c2fc1258 | 117 | SetStripRange(); |
06ca6759 | 118 | fAltroMap = new AliFMDAltroMapping; |
1a1fdef7 | 119 | } |
120 | ||
57c3c593 | 121 | //__________________________________________________________________ |
122 | void | |
f6449cc0 | 123 | AliFMDParameters::Init(Bool_t forceReInit, UInt_t what) |
57c3c593 | 124 | { |
125 | // Initialize the parameters manager. We need to get stuff from the | |
126 | // CDB here. | |
a9579262 | 127 | if (forceReInit) fIsInit = kFALSE; |
57c3c593 | 128 | if (fIsInit) return; |
f6449cc0 | 129 | if (what & kPulseGain) InitPulseGain(); |
130 | if (what & kPedestal) InitPedestal(); | |
131 | if (what & kDeadMap) InitDeadMap(); | |
132 | if (what & kSampleRate) InitSampleRate(); | |
133 | if (what & kZeroSuppression) InitZeroSuppression(); | |
134 | if (what & kAltroMap) InitAltroMap(); | |
1e8f773e | 135 | fIsInit = kTRUE; |
dc02d468 | 136 | } |
137 | //__________________________________________________________________ | |
138 | void | |
139 | AliFMDParameters::Init(AliFMDPreprocessor* pp, Bool_t forceReInit, UInt_t what) | |
140 | { | |
141 | // Initialize the parameters manager. We need to get stuff from the | |
142 | // CDB here. | |
143 | if (forceReInit) fIsInit = kFALSE; | |
144 | if (fIsInit) return; | |
145 | if (what & kPulseGain) InitPulseGain(pp); | |
146 | if (what & kPedestal) InitPedestal(pp); | |
147 | if (what & kDeadMap) InitDeadMap(pp); | |
148 | if (what & kSampleRate) InitSampleRate(pp); | |
149 | if (what & kZeroSuppression) InitZeroSuppression(pp); | |
150 | if (what & kAltroMap) InitAltroMap(pp); | |
151 | fIsInit = kTRUE; | |
1e8f773e | 152 | } |
c2fc1258 | 153 | |
6169f936 | 154 | //__________________________________________________________________ |
155 | #define DET2IDX(det,ring,sec,str) \ | |
a9579262 | 156 | (det * 1000 + (ring == 'I' ? 0 : 512) + str) |
6169f936 | 157 | |
158 | //__________________________________________________________________ | |
159 | void | |
160 | AliFMDParameters::Draw(Option_t* option) | |
161 | { | |
162 | TString opt(option); | |
163 | enum { | |
164 | kPulseGain, // Path to PulseGain calib object | |
165 | kThreshold, // Path to PulseGain calib object | |
166 | kPedestal, // Path to Pedestal calib object | |
167 | kPedestalWidth, // Path to Pedestal calib object | |
168 | kDead, // Path to Dead calib object | |
169 | kSampleRate, // Path to SampleRate calib object | |
170 | kAltroMap, // Path to AltroMap calib object | |
171 | kZeroSuppression, // Path to ZeroSuppression cal object | |
172 | kMinStripRange, // Path to strip range cal object | |
173 | kMaxStripRange // Path to strip range cal object | |
174 | } what; | |
175 | ||
176 | ||
177 | if (opt.Contains("dead", TString::kIgnoreCase)) | |
178 | what = kDead; | |
179 | else if (opt.Contains("threshold",TString::kIgnoreCase)) | |
180 | what = kThreshold; | |
181 | else if (opt.Contains("gain",TString::kIgnoreCase)) | |
182 | what = kPulseGain; | |
183 | else if (opt.Contains("pedestal",TString::kIgnoreCase)) | |
184 | what = kPedestal; | |
185 | else if (opt.Contains("noise",TString::kIgnoreCase)) | |
186 | what = kPedestalWidth; | |
187 | else if (opt.Contains("zero",TString::kIgnoreCase)) | |
188 | what = kZeroSuppression; | |
189 | else if (opt.Contains("rate",TString::kIgnoreCase)) | |
190 | what = kSampleRate; | |
191 | else if (opt.Contains("min",TString::kIgnoreCase)) | |
192 | what = kMinStripRange; | |
193 | else if (opt.Contains("max",TString::kIgnoreCase)) | |
194 | what = kMaxStripRange; | |
195 | else if (opt.Contains("map",TString::kIgnoreCase)) | |
196 | what = kAltroMap; | |
197 | else { | |
198 | Warning("Draw", "unknown parameter: %s\n\tShould be one of\n\t" | |
199 | "dead, threshold, gain, pedestal, noise, zero, rate, " | |
200 | "min, max, map", | |
201 | option); | |
202 | return; | |
203 | } | |
204 | ||
205 | TArrayD xbins(3 * 512 + 2 * 256 + 5); | |
206 | Int_t i = 1; | |
207 | Bool_t skip = kTRUE; | |
208 | for (UShort_t det = 1; det <= 3; det++) { | |
209 | UShort_t nRings = (det == 1 ? 1 : 2); | |
210 | for (UShort_t iring = 0; iring < nRings; iring++) { | |
211 | UShort_t nStrip = (iring == 0 ? 512 : 256); | |
212 | Char_t ring = (iring == 0 ? 'I' : 'O'); | |
213 | for (UShort_t str = 0; str < nStrip; str++) { | |
a9579262 | 214 | // UShort_t nSec = (iring == 0 ? 20 : 40); |
215 | // Char_t ring = (iring == 0 ? 'I' : 'O'); | |
216 | // for (UShort_t sec = 0; sec < nSec; sec++) { | |
6169f936 | 217 | Int_t idx = DET2IDX(det, ring, 0, str); |
a9579262 | 218 | // Int_t idx = DET2IDX(det, ring, sec, 0); |
6169f936 | 219 | if (skip) { |
220 | xbins[i-1] = idx - .5; | |
221 | skip = kFALSE; | |
222 | } | |
223 | xbins[i] = idx + .5; | |
224 | i++; | |
225 | } | |
226 | skip = kTRUE; | |
227 | i++; | |
228 | } | |
229 | } | |
230 | TArrayD ybins(41); | |
a9579262 | 231 | for (Int_t i = 0; i < ybins.fN; i++) ybins[i] = Float_t(i - .5); |
6169f936 | 232 | TH2D* hist = new TH2D("calib", Form("Calibration %s", option), |
233 | xbins.fN-1, xbins.fArray, | |
234 | ybins.fN-1, ybins.fArray); | |
a9579262 | 235 | hist->GetXaxis()->SetTitle("1000 #times detector + 512 #times ring + strip"); |
236 | hist->GetYaxis()->SetTitle("sector"); | |
237 | ||
6169f936 | 238 | // hist->Draw("Lego"); |
239 | // return; | |
240 | ||
241 | for (UShort_t det = 1; det <= 3; det++) { | |
242 | UShort_t nRings = (det == 1 ? 1 : 2); | |
243 | for (UShort_t iring = 0; iring < nRings; iring++) { | |
244 | UShort_t nSector = (iring == 0 ? 20 : 40); | |
245 | UShort_t nStrip = (iring == 0 ? 512 : 256); | |
246 | Char_t ring = (iring == 0 ? 'I' : 'O'); | |
247 | for (UShort_t sec = 0; sec < nSector; sec++) { | |
248 | for (UShort_t str = 0; str < nStrip; str++) { | |
249 | Int_t idx = DET2IDX(det, ring, sec, str); | |
250 | UInt_t ddl, addr; | |
251 | Double_t val = 0; | |
252 | switch (what) { | |
253 | case kPulseGain: // Path to PulseGain calib object | |
254 | val = GetPulseGain(det,ring,sec,str); break; | |
255 | case kThreshold: // Path to PulseGain calib object | |
256 | val = GetThreshold(); break; | |
257 | case kPedestal: // Path to Pedestal calib object | |
258 | val = GetPedestal(det,ring,sec,str); break; | |
259 | case kPedestalWidth: // Path to Pedestal calib object | |
260 | val = GetPedestalWidth(det,ring,sec,str); break; | |
261 | case kDead: // Path to Dead calib object | |
262 | val = IsDead(det,ring,sec,str); break; | |
263 | case kSampleRate: // Path to SampleRate calib object | |
264 | val = GetSampleRate(det,ring,sec,str); break; | |
265 | case kAltroMap: // Path to AltroMap calib object | |
266 | Detector2Hardware(det,ring,sec,str, ddl, addr); | |
267 | val = addr; break; | |
268 | case kZeroSuppression: // Path to ZeroSuppression cal object | |
269 | val = GetZeroSuppression(det,ring,sec,str); break; | |
270 | case kMinStripRange: // Path to strip range cal object | |
271 | val = GetMinStrip(det,ring,sec,str); break; | |
272 | case kMaxStripRange: // Path to strip range cal object | |
273 | val = GetMaxStrip(det,ring,sec,str); break; | |
274 | } | |
275 | hist->Fill(idx,sec,val); | |
a9579262 | 276 | // hist->Fill(idx,str,val); |
6169f936 | 277 | } |
278 | } | |
279 | } | |
280 | } | |
281 | hist->Draw("lego"); | |
282 | } | |
283 | ||
c2fc1258 | 284 | //__________________________________________________________________ |
285 | void | |
286 | AliFMDParameters::Print(Option_t* option) const | |
287 | { | |
02a27b50 | 288 | // Print information. |
289 | // If option contains an 'A' then everything is printed. | |
a9579262 | 290 | // If the option contains the string "FMD" the function will search |
291 | // for detector, ring, sector, and strip numbers to print, in the | |
292 | // format | |
293 | // | |
294 | // FMD<detector><ring>[<sector>,<string>] | |
295 | // | |
296 | // The wild card '*' means all of <detector>, <ring>, <sector>, or | |
297 | // <strip>. | |
c2fc1258 | 298 | TString opt(option); |
a9579262 | 299 | Bool_t showStrips = opt.Contains("a", TString::kIgnoreCase); |
300 | UShort_t ds[] = { 1, 2, 3, 0 }; | |
301 | Char_t rs[] = { 'I', 'O', '\0' }; | |
302 | UShort_t minStrip = 0; | |
303 | UShort_t maxStrip = 512; | |
304 | UShort_t minSector = 0; | |
305 | UShort_t maxSector = 40; | |
306 | ||
307 | ||
8ec606c2 | 308 | if (opt.Contains("fmd",TString::kIgnoreCase)) { |
a9579262 | 309 | showStrips = kTRUE; |
310 | size_t i = opt.Index("fmd",TString::kIgnoreCase); | |
311 | size_t j = opt.Index("]",TString::kIgnoreCase); | |
312 | enum { | |
97e94238 | 313 | kReadDet, |
314 | kReadRing, | |
315 | kReadLbrack, | |
316 | kReadSector, | |
317 | kReadComma, | |
318 | kReadStrip, | |
319 | kReadRbrack, | |
320 | kEnd | |
321 | } state = kReadDet; | |
8ec606c2 | 322 | std::stringstream s(opt(i+4, j-i-3).Data()); |
97e94238 | 323 | while (state != kEnd) { |
a9579262 | 324 | Char_t tmp = s.peek(); |
325 | if (tmp == ' ' || tmp == '\t') { | |
326 | s.get(); | |
327 | continue; | |
328 | } | |
329 | switch (state) { | |
97e94238 | 330 | case kReadDet: { // First, try to kRead the detector |
a9579262 | 331 | if (tmp == '*') s.get(); |
332 | else { | |
333 | UShort_t det; | |
334 | s >> det; | |
335 | if (!s.bad()) { | |
336 | ds[0] = det; | |
337 | ds[1] = 0; | |
338 | } | |
339 | } | |
97e94238 | 340 | state = (s.bad() ? kEnd : kReadRing); |
a9579262 | 341 | } break; |
97e94238 | 342 | case kReadRing: { // Then try to read the ring; |
a9579262 | 343 | Char_t ring; |
344 | s >> ring; | |
345 | if (ring != '*' && !s.bad()) { | |
346 | rs[0] = ring; | |
347 | rs[1] = '\0'; | |
348 | } | |
97e94238 | 349 | state = (s.bad() ? kEnd : kReadLbrack); |
a9579262 | 350 | } break; |
97e94238 | 351 | case kReadLbrack: { // Try to read a left bracket |
a9579262 | 352 | Char_t lbrack; |
353 | s >> lbrack; | |
97e94238 | 354 | state = (s.bad() ? kEnd : kReadSector); |
a9579262 | 355 | } break; |
97e94238 | 356 | case kReadSector: { // Try to read a sector |
a9579262 | 357 | if (tmp == '*') s.get(); |
358 | else { | |
359 | UShort_t sec; | |
360 | s >> sec; | |
361 | if (!s.bad()) { | |
362 | minSector = sec; | |
363 | maxSector = sec + 1; | |
364 | } | |
365 | } | |
97e94238 | 366 | state = (s.bad() ? kEnd : kReadComma); |
a9579262 | 367 | } break; |
97e94238 | 368 | case kReadComma: { // Try to read a left bracket |
a9579262 | 369 | Char_t comma; |
370 | s >> comma; | |
97e94238 | 371 | state = (s.bad() ? kEnd : kReadStrip); |
a9579262 | 372 | } break; |
97e94238 | 373 | case kReadStrip: { // Try to read a strip |
a9579262 | 374 | if (tmp == '*') s.get(); |
375 | else { | |
376 | UShort_t str; | |
377 | s >> str; | |
378 | if (!s.bad()) { | |
379 | minStrip = str; | |
380 | maxStrip = str + 1; | |
381 | } | |
382 | } | |
97e94238 | 383 | state = (s.bad() ? kEnd : kReadRbrack); |
a9579262 | 384 | } break; |
97e94238 | 385 | case kReadRbrack: { // Try to read a left bracket |
a9579262 | 386 | Char_t rbrack; |
387 | s >> rbrack; | |
97e94238 | 388 | state = kEnd; |
a9579262 | 389 | } break; |
97e94238 | 390 | case kEnd: |
a9579262 | 391 | break; |
392 | } | |
393 | } | |
8ec606c2 | 394 | } |
a9579262 | 395 | UShort_t* dp = ds; |
396 | UShort_t det; | |
397 | while ((det = *(dp++))) { | |
398 | ||
399 | Char_t* rp = rs; | |
400 | Char_t ring; | |
401 | while ((ring = *(rp++))) { | |
402 | if (det == 1 && ring == 'O') continue; | |
403 | UShort_t min = GetMinStrip(det, ring, 0, 0); | |
404 | UShort_t max = GetMaxStrip(det, ring, 0, 0); | |
405 | UShort_t rate = GetSampleRate(det, ring, 0, 0); | |
406 | std::cout << "FMD" << det << ring | |
407 | << " Strip range: " | |
408 | << std::setw(3) << min << "," | |
409 | << std::setw(3) << max << " Rate: " | |
410 | << std::setw(2) << rate << std::endl; | |
411 | ||
412 | if (!showStrips) continue; | |
413 | UShort_t nSec = ( ring == 'I' ? 20 : 40 ); | |
414 | UShort_t nStr = ( ring == 'I' ? 512 : 256 ); | |
415 | for (UShort_t sec = minSector; sec < maxSector && sec < nSec; sec++) { | |
c2fc1258 | 416 | std::cout |
8ec606c2 | 417 | << " Strip | Pedestal | Gain | ZS thr. | Address\n" |
418 | << "--------+-------------------+------------+---------+---------" | |
c2fc1258 | 419 | << std::endl; |
a9579262 | 420 | for (UShort_t str = minStrip; str < nStr && str < maxStrip; str++) { |
421 | if (str == minStrip) std::cout << std::setw(3) << sec << ","; | |
422 | else std::cout << " "; | |
423 | std::cout << std::setw(3) << str << " | "; | |
424 | if (IsDead(det, ring, sec, str)) { | |
c2fc1258 | 425 | std::cout << "dead" << std::endl; |
426 | continue; | |
427 | } | |
428 | UInt_t ddl, addr; | |
a9579262 | 429 | Detector2Hardware(det, ring, sec, str, ddl, addr); |
430 | std::cout << std::setw(7) << GetPedestal(det, ring, sec, str) | |
c2fc1258 | 431 | << "+/-" << std::setw(7) |
a9579262 | 432 | << GetPedestalWidth(det, ring, sec, str) |
8ec606c2 | 433 | << " | " << std::setw(10) |
a9579262 | 434 | << GetPulseGain(det, ring, sec, str) |
435 | << " | " << std::setw(7) | |
436 | << GetZeroSuppression(det, ring, sec, str) | |
c2fc1258 | 437 | << " | 0x" << std::hex << std::setw(4) |
438 | << std::setfill('0') << ddl << ",0x" << std::setw(3) | |
439 | << addr << std::dec << std::setfill(' ') << std::endl; | |
a9579262 | 440 | } // for (strip) |
441 | } // for (sector) | |
442 | std::cout | |
443 | << "=============================================================" | |
444 | << std::endl; | |
445 | } // while (ring) | |
446 | } // while (det) | |
447 | ||
c2fc1258 | 448 | } |
449 | ||
450 | //__________________________________________________________________ | |
451 | void | |
452 | AliFMDParameters::SetStripRange(UShort_t min, UShort_t max) | |
453 | { | |
02a27b50 | 454 | // Set fixed strip range |
c2fc1258 | 455 | fFixedMinStrip = min; |
456 | fFixedMaxStrip = max; | |
457 | } | |
458 | ||
dc02d468 | 459 | //__________________________________________________________________ |
460 | AliCDBEntry* | |
461 | AliFMDParameters::GetEntry(const char* path, AliFMDPreprocessor* pp, | |
462 | Bool_t fatal) const | |
463 | { | |
464 | // Get an entry from the CDB or via preprocessor | |
465 | AliCDBEntry* entry = 0; | |
466 | if (!pp) { | |
467 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
468 | entry = cdb->Get(path); | |
469 | } | |
470 | else { | |
471 | const char* third = gSystem->BaseName(path); | |
472 | const char* second = gSystem->BaseName(gSystem->DirName(path)); | |
473 | entry = pp->GetFromCDB(second, third); | |
474 | } | |
475 | if (!entry) { | |
476 | TString msg(Form("No %s found in CDB, perhaps you need to " | |
477 | "use AliFMDCalibFaker?", path)); | |
478 | if (fatal) { AliFatal(msg.Data()); } | |
479 | else AliLog::Message(AliLog::kWarning, msg.Data(), "FMD", | |
480 | "AliFMDParameters", "GetEntry", __FILE__, | |
481 | __LINE__); | |
482 | return 0; | |
483 | } | |
484 | return entry; | |
485 | } | |
486 | ||
487 | ||
1e8f773e | 488 | //__________________________________________________________________ |
489 | void | |
dc02d468 | 490 | AliFMDParameters::InitPulseGain(AliFMDPreprocessor* pp) |
1e8f773e | 491 | { |
02a27b50 | 492 | // Get pulse gain from CDB or used fixed |
dc02d468 | 493 | AliCDBEntry* gain = GetEntry(fgkPulseGain, pp); |
494 | if (!gain) return; | |
57c3c593 | 495 | |
f95a63c4 | 496 | AliFMDDebug(1, ("Got gain from CDB")); |
1e8f773e | 497 | fPulseGain = dynamic_cast<AliFMDCalibGain*>(gain->GetObject()); |
f95a63c4 | 498 | if (!fPulseGain) AliFatal("Invalid pulser gain object from CDB"); |
1e8f773e | 499 | } |
500 | //__________________________________________________________________ | |
501 | void | |
dc02d468 | 502 | AliFMDParameters::InitPedestal(AliFMDPreprocessor* pp) |
1e8f773e | 503 | { |
02a27b50 | 504 | // Initialize the pedestals from CDB |
dc02d468 | 505 | AliCDBEntry* pedestal = GetEntry(fgkPedestal, pp); |
506 | if (!pedestal) return; | |
507 | ||
f95a63c4 | 508 | AliFMDDebug(1, ("Got pedestal from CDB")); |
1e8f773e | 509 | fPedestal = dynamic_cast<AliFMDCalibPedestal*>(pedestal->GetObject()); |
f95a63c4 | 510 | if (!fPedestal) AliFatal("Invalid pedestal object from CDB"); |
1e8f773e | 511 | } |
512 | ||
513 | //__________________________________________________________________ | |
514 | void | |
dc02d468 | 515 | AliFMDParameters::InitDeadMap(AliFMDPreprocessor* pp) |
1e8f773e | 516 | { |
02a27b50 | 517 | // Get Dead-channel-map from CDB |
dc02d468 | 518 | AliCDBEntry* deadMap = GetEntry(fgkDead, pp); |
519 | if (!deadMap) return; | |
520 | ||
f95a63c4 | 521 | AliFMDDebug(1, ("Got dead map from CDB")); |
1e8f773e | 522 | fDeadMap = dynamic_cast<AliFMDCalibDeadMap*>(deadMap->GetObject()); |
f95a63c4 | 523 | if (!fDeadMap) AliFatal("Invalid dead map object from CDB"); |
1e8f773e | 524 | } |
525 | ||
526 | //__________________________________________________________________ | |
527 | void | |
dc02d468 | 528 | AliFMDParameters::InitZeroSuppression(AliFMDPreprocessor* pp) |
1e8f773e | 529 | { |
02a27b50 | 530 | // Get 0-suppression from CDB |
dc02d468 | 531 | AliCDBEntry* zeroSup = GetEntry(fgkZeroSuppression, pp); |
532 | if (!zeroSup) return; | |
f95a63c4 | 533 | AliFMDDebug(1, ("Got zero suppression from CDB")); |
1e8f773e | 534 | fZeroSuppression = |
535 | dynamic_cast<AliFMDCalibZeroSuppression*>(zeroSup->GetObject()); | |
f95a63c4 | 536 | if (!fZeroSuppression)AliFatal("Invalid zero suppression object from CDB"); |
1e8f773e | 537 | } |
538 | ||
539 | //__________________________________________________________________ | |
540 | void | |
dc02d468 | 541 | AliFMDParameters::InitSampleRate(AliFMDPreprocessor* pp) |
1e8f773e | 542 | { |
02a27b50 | 543 | // get Sample rate from CDB |
dc02d468 | 544 | AliCDBEntry* sampRat = GetEntry(fgkSampleRate, pp); |
545 | if (!sampRat) return; | |
f95a63c4 | 546 | AliFMDDebug(1, ("Got zero suppression from CDB")); |
1e8f773e | 547 | fSampleRate = dynamic_cast<AliFMDCalibSampleRate*>(sampRat->GetObject()); |
f95a63c4 | 548 | if (!fSampleRate) AliFatal("Invalid zero suppression object from CDB"); |
1e8f773e | 549 | } |
550 | ||
551 | //__________________________________________________________________ | |
552 | void | |
dc02d468 | 553 | AliFMDParameters::InitAltroMap(AliFMDPreprocessor* pp) |
1e8f773e | 554 | { |
02a27b50 | 555 | // Get hardware mapping from CDB |
06ca6759 | 556 | if (fAltroMap) { |
557 | delete fAltroMap; | |
558 | fAltroMap = 0; | |
559 | } | |
dc02d468 | 560 | AliCDBEntry* hwMap = GetEntry(fgkAltroMap, pp); |
561 | if (!hwMap) return; | |
562 | ||
f95a63c4 | 563 | AliFMDDebug(1, ("Got ALTRO map from CDB")); |
1e8f773e | 564 | fAltroMap = dynamic_cast<AliFMDAltroMapping*>(hwMap->GetObject()); |
565 | if (!fAltroMap) { | |
f95a63c4 | 566 | AliFatal("Invalid ALTRO map object from CDB"); |
1e8f773e | 567 | fAltroMap = new AliFMDAltroMapping; |
57c3c593 | 568 | } |
57c3c593 | 569 | } |
570 | ||
c2fc1258 | 571 | //__________________________________________________________________ |
572 | void | |
dc02d468 | 573 | AliFMDParameters::InitStripRange(AliFMDPreprocessor* pp) |
c2fc1258 | 574 | { |
02a27b50 | 575 | // Get strips read-out from CDB |
dc02d468 | 576 | AliCDBEntry* range = GetEntry(fgkStripRange, pp); |
577 | if (!range) return; | |
f95a63c4 | 578 | AliFMDDebug(1, ("Got strip range from CDB")); |
c2fc1258 | 579 | fStripRange = dynamic_cast<AliFMDCalibStripRange*>(range->GetObject()); |
f95a63c4 | 580 | if (!fStripRange) AliFatal("Invalid strip range object from CDB"); |
c2fc1258 | 581 | } |
582 | ||
1e8f773e | 583 | |
8f6ee336 | 584 | //__________________________________________________________________ |
585 | Float_t | |
586 | AliFMDParameters::GetThreshold() const | |
587 | { | |
02a27b50 | 588 | // Get threshold from CDB |
8f6ee336 | 589 | if (!fPulseGain) return fFixedThreshold; |
590 | return fPulseGain->Threshold(); | |
591 | } | |
592 | ||
593 | //__________________________________________________________________ | |
594 | Float_t | |
595 | AliFMDParameters::GetPulseGain(UShort_t detector, Char_t ring, | |
596 | UShort_t sector, UShort_t strip) const | |
597 | { | |
598 | // Returns the pulser calibrated gain for strip # strip in sector # | |
599 | // sector or ring id ring of detector # detector. | |
600 | // | |
601 | // For simulation, this is normally set to | |
602 | // | |
603 | // VA1_MIP_Range | |
604 | // ------------------ * MIP_Energy_Loss | |
605 | // ALTRO_channel_size | |
606 | // | |
607 | if (!fPulseGain) { | |
608 | if (fFixedPulseGain <= 0) | |
609 | fFixedPulseGain = fVA1MipRange * GetEdepMip() / fAltroChannelSize; | |
610 | return fFixedPulseGain; | |
611 | } | |
f95a63c4 | 612 | AliFMDDebug(50, ("pulse gain for FMD%d%c[%2d,%3d]=%f", |
1e8f773e | 613 | detector, ring, sector, strip, |
614 | fPulseGain->Value(detector, ring, sector, strip))); | |
8f6ee336 | 615 | return fPulseGain->Value(detector, ring, sector, strip); |
616 | } | |
617 | ||
618 | //__________________________________________________________________ | |
619 | Bool_t | |
620 | AliFMDParameters::IsDead(UShort_t detector, Char_t ring, | |
621 | UShort_t sector, UShort_t strip) const | |
622 | { | |
02a27b50 | 623 | // Check if the channel is dead |
8f6ee336 | 624 | if (!fDeadMap) return kFALSE; |
f95a63c4 | 625 | AliFMDDebug(50, ("Dead for FMD%d%c[%2d,%3d]=%s", |
1e8f773e | 626 | detector, ring, sector, strip, |
627 | fDeadMap->operator()(detector, ring, sector, strip) ? | |
628 | "no" : "yes")); | |
8f6ee336 | 629 | return fDeadMap->operator()(detector, ring, sector, strip); |
630 | } | |
631 | ||
632 | //__________________________________________________________________ | |
633 | UShort_t | |
634 | AliFMDParameters::GetZeroSuppression(UShort_t detector, Char_t ring, | |
635 | UShort_t sector, UShort_t strip) const | |
636 | { | |
02a27b50 | 637 | // Get zero suppression threshold |
8f6ee336 | 638 | if (!fZeroSuppression) return fFixedZeroSuppression; |
639 | // Need to map strip to ALTRO chip. | |
f95a63c4 | 640 | AliFMDDebug(50, ("zero sup. for FMD%d%c[%2d,%3d]=%f", |
1e8f773e | 641 | detector, ring, sector, strip, |
642 | fZeroSuppression->operator()(detector, ring, | |
643 | sector, strip))); | |
8f6ee336 | 644 | return fZeroSuppression->operator()(detector, ring, sector, strip/128); |
645 | } | |
646 | ||
647 | //__________________________________________________________________ | |
648 | UShort_t | |
c2fc1258 | 649 | AliFMDParameters::GetSampleRate(UShort_t det, Char_t ring, UShort_t sector, |
650 | UShort_t str) const | |
8f6ee336 | 651 | { |
02a27b50 | 652 | // Get sampl rate |
8f6ee336 | 653 | if (!fSampleRate) return fFixedSampleRate; |
654 | // Need to map sector to digitizier card. | |
c2fc1258 | 655 | UInt_t ret = fSampleRate->Rate(det, ring, sector, str); |
f95a63c4 | 656 | AliFMDDebug(50, ("Sample rate for FMD%d%c[%2d,%3d]=%d", |
c2fc1258 | 657 | det, ring, sector, str, ret)); |
658 | return ret; | |
659 | } | |
660 | ||
661 | //__________________________________________________________________ | |
662 | UShort_t | |
663 | AliFMDParameters::GetMinStrip(UShort_t det, Char_t ring, UShort_t sector, | |
664 | UShort_t str) const | |
665 | { | |
02a27b50 | 666 | // Get strip range read out |
c2fc1258 | 667 | if (!fStripRange) return fFixedMinStrip; |
668 | // Need to map sector to digitizier card. | |
669 | UInt_t ret = fStripRange->Min(det, ring, sector, str); | |
f95a63c4 | 670 | AliFMDDebug(50, ("Min strip # for FMD%d%c[%2d,%3d]=%d", |
c2fc1258 | 671 | det, ring, sector, str, ret)); |
672 | return ret; | |
673 | } | |
674 | ||
675 | //__________________________________________________________________ | |
676 | UShort_t | |
677 | AliFMDParameters::GetMaxStrip(UShort_t det, Char_t ring, UShort_t sector, | |
678 | UShort_t str) const | |
679 | { | |
02a27b50 | 680 | // Get strip range read out |
c2fc1258 | 681 | if (!fStripRange) return fFixedMaxStrip; |
682 | // Need to map sector to digitizier card. | |
683 | UInt_t ret = fStripRange->Max(det, ring, sector, str); | |
f95a63c4 | 684 | AliFMDDebug(50, ("Max strip # for FMD%d%c[%2d,%3d]=%d", |
c2fc1258 | 685 | det, ring, sector, str, ret)); |
686 | return ret; | |
8f6ee336 | 687 | } |
1a1fdef7 | 688 | |
8f6ee336 | 689 | //__________________________________________________________________ |
690 | Float_t | |
691 | AliFMDParameters::GetPedestal(UShort_t detector, Char_t ring, | |
692 | UShort_t sector, UShort_t strip) const | |
693 | { | |
02a27b50 | 694 | // Get the pedesal |
8f6ee336 | 695 | if (!fPedestal) return fFixedPedestal; |
f95a63c4 | 696 | AliFMDDebug(50, ("pedestal for FMD%d%c[%2d,%3d]=%f", |
1e8f773e | 697 | detector, ring, sector, strip, |
698 | fPedestal->Value(detector, ring, sector, strip))); | |
8f6ee336 | 699 | return fPedestal->Value(detector, ring, sector, strip); |
700 | } | |
701 | ||
702 | //__________________________________________________________________ | |
703 | Float_t | |
704 | AliFMDParameters::GetPedestalWidth(UShort_t detector, Char_t ring, | |
705 | UShort_t sector, UShort_t strip) const | |
706 | { | |
02a27b50 | 707 | // Get the pedesal |
8f6ee336 | 708 | if (!fPedestal) return fFixedPedestalWidth; |
f95a63c4 | 709 | AliFMDDebug(50, ("pedetal width for FMD%d%c[%2d,%3d]=%f", |
1e8f773e | 710 | detector, ring, sector, strip, |
711 | fPedestal->Width(detector, ring, sector, strip))); | |
8f6ee336 | 712 | return fPedestal->Width(detector, ring, sector, strip); |
713 | } | |
714 | ||
1a1fdef7 | 715 | //__________________________________________________________________ |
57c3c593 | 716 | AliFMDAltroMapping* |
717 | AliFMDParameters::GetAltroMap() const | |
718 | { | |
02a27b50 | 719 | // Get the hardware address to detector index map |
57c3c593 | 720 | return fAltroMap; |
1a1fdef7 | 721 | } |
722 | ||
57c3c593 | 723 | |
bf000c32 | 724 | //__________________________________________________________________ |
725 | Bool_t | |
f6449cc0 | 726 | AliFMDParameters::Hardware2Detector(UInt_t ddl, UInt_t board, |
727 | UInt_t chip, UInt_t chan, | |
728 | UShort_t& det, Char_t& ring, | |
729 | UShort_t& sec, UShort_t& str) const | |
730 | { | |
731 | // Map hardware address to detector index | |
732 | if (!fAltroMap) return kFALSE; | |
733 | return fAltroMap->Hardware2Detector(ddl,board,chip,chan, det,ring,sec,str); | |
734 | } | |
735 | //__________________________________________________________________ | |
736 | Bool_t | |
737 | AliFMDParameters::Hardware2Detector(UInt_t ddl, UInt_t addr, | |
738 | UShort_t& det, Char_t& ring, | |
739 | UShort_t& sec, UShort_t& str) const | |
bf000c32 | 740 | { |
02a27b50 | 741 | // Map hardware address to detector index |
57c3c593 | 742 | if (!fAltroMap) return kFALSE; |
743 | return fAltroMap->Hardware2Detector(ddl, addr, det, ring, sec, str); | |
bf000c32 | 744 | } |
745 | ||
746 | //__________________________________________________________________ | |
747 | Bool_t | |
f6449cc0 | 748 | AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring, |
749 | UShort_t sec, UShort_t str, | |
750 | UInt_t& ddl, UInt_t& board, | |
751 | UInt_t& chip, UInt_t& chan) const | |
752 | { | |
753 | // Map detector index to hardware address | |
754 | if (!fAltroMap) return kFALSE; | |
755 | return fAltroMap->Detector2Hardware(det,ring,sec,str, ddl,board,chip,chan); | |
756 | } | |
757 | ||
758 | //__________________________________________________________________ | |
759 | Bool_t | |
760 | AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring, | |
761 | UShort_t sec, UShort_t str, | |
762 | UInt_t& ddl, UInt_t& addr) const | |
bf000c32 | 763 | { |
02a27b50 | 764 | // Map detector index to hardware address |
57c3c593 | 765 | if (!fAltroMap) return kFALSE; |
766 | return fAltroMap->Detector2Hardware(det, ring, sec, str, ddl, addr); | |
bf000c32 | 767 | } |
768 | ||
57c3c593 | 769 | |
770 | //__________________________________________________________________ | |
771 | Float_t | |
772 | AliFMDParameters::GetEdepMip() const | |
773 | { | |
774 | // Get energy deposited by a MIP in the silicon sensors | |
775 | if (fEdepMip <= 0){ | |
776 | AliFMDGeometry* fmd = AliFMDGeometry::Instance(); | |
02a27b50 | 777 | fEdepMip = (fkSiDeDxMip |
57c3c593 | 778 | * fmd->GetRing('I')->GetSiThickness() |
779 | * fmd->GetSiDensity()); | |
780 | } | |
781 | return fEdepMip; | |
782 | } | |
783 | ||
784 | ||
bf000c32 | 785 | |
786 | ||
787 | ||
1a1fdef7 | 788 | //____________________________________________________________________ |
789 | // | |
790 | // EOF | |
791 | // |