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 **************************************************************************/
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
21 //____________________________________________________________________
23 // Forward Multiplicity Detector based on Silicon wafers.
25 // This class is a singleton that handles various parameters of
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.
32 #include "AliFMDDebug.h" // ALILOG_H
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
38 #include "AliFMDCalibSampleRate.h" // ALIFMDCALIBSAMPLERATE_H
39 #include "AliFMDCalibStripRange.h" // ALIFMDCALIBSTRIPRANGE_H
40 #include "AliFMDAltroMapping.h" // ALIFMDALTROMAPPING_H
41 #include <AliCDBManager.h> // ALICDBMANAGER_H
42 #include <AliCDBEntry.h> // ALICDBMANAGER_H
43 #include <AliFMDPreprocessor.h>
45 #include <Riostream.h>
51 //====================================================================
52 ClassImp(AliFMDParameters)
54 ; // This is here to keep Emacs for indenting the next line
57 //____________________________________________________________________
58 AliFMDParameters* AliFMDParameters::fgInstance = 0;
60 //____________________________________________________________________
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";
72 //____________________________________________________________________
74 AliFMDParameters::Instance()
76 // Get static instance
77 if (!fgInstance) fgInstance = new AliFMDParameters;
81 //____________________________________________________________________
82 AliFMDParameters::AliFMDParameters()
91 fZSPedSubtract(kFALSE),
93 fFixedPedestalWidth(0),
94 fFixedZeroSuppression(0),
101 fHasCompleteHeader(kTRUE),
110 // Default constructor
112 SetAltroChannelSize();
113 SetChannelsPerAltro();
114 SetZeroSuppression();
121 fAltroMap = new AliFMDAltroMapping;
124 //__________________________________________________________________
126 AliFMDParameters::Init(Bool_t forceReInit, UInt_t what)
128 // Initialize the parameters manager. We need to get stuff from the
130 if (forceReInit) fIsInit = kFALSE;
132 if (what & kPulseGain) InitPulseGain();
133 if (what & kPedestal) InitPedestal();
134 if (what & kDeadMap) InitDeadMap();
135 if (what & kSampleRate) InitSampleRate();
136 if (what & kZeroSuppression) InitZeroSuppression();
137 if (what & kAltroMap) InitAltroMap();
138 if (what & kStripRange) InitStripRange();
141 //__________________________________________________________________
143 AliFMDParameters::Init(AliFMDPreprocessor* pp, Bool_t forceReInit, UInt_t what)
145 // Initialize the parameters manager. We need to get stuff from the
147 if (forceReInit) fIsInit = kFALSE;
149 if (what & kPulseGain) InitPulseGain(pp);
150 if (what & kPedestal) InitPedestal(pp);
151 if (what & kDeadMap) InitDeadMap(pp);
152 if (what & kSampleRate) InitSampleRate(pp);
153 if (what & kZeroSuppression) InitZeroSuppression(pp);
154 if (what & kAltroMap) InitAltroMap(pp);
155 if (what & kStripRange) InitStripRange(pp);
159 //__________________________________________________________________
160 #define DET2IDX(det,ring,sec,str) \
161 (det * 1000 + (ring == 'I' ? 0 : 512) + str)
163 //__________________________________________________________________
165 AliFMDParameters::Draw(Option_t* option)
169 kLocalPulseGain, // Path to PulseGain calib object
170 kLocalThreshold, // Path to PulseGain calib object
171 kLocalPedestal, // Path to Pedestal calib object
172 kLocalPedestalWidth, // Path to Pedestal calib object
173 kLocalDead, // Path to Dead calib object
174 kLocalSampleRate, // Path to SampleRate calib object
175 kLocalAltroMap, // Path to AltroMap calib object
176 kLocalZeroSuppression, // Path to ZeroSuppression cal object
177 kLocalMinStripRange, // Path to strip range cal object
178 kLocalMaxStripRange // Path to strip range cal object
181 if (opt.Contains("dead", TString::kIgnoreCase))
183 else if (opt.Contains("threshold",TString::kIgnoreCase))
184 what = kLocalThreshold;
185 else if (opt.Contains("gain",TString::kIgnoreCase))
186 what = kLocalPulseGain;
187 else if (opt.Contains("pedestal",TString::kIgnoreCase))
188 what = kLocalPedestal;
189 else if (opt.Contains("noise",TString::kIgnoreCase))
190 what = kLocalPedestalWidth;
191 else if (opt.Contains("zero",TString::kIgnoreCase))
192 what = kLocalZeroSuppression;
193 else if (opt.Contains("rate",TString::kIgnoreCase))
194 what = kLocalSampleRate;
195 else if (opt.Contains("min",TString::kIgnoreCase))
196 what = kLocalMinStripRange;
197 else if (opt.Contains("max",TString::kIgnoreCase))
198 what = kLocalMaxStripRange;
199 else if (opt.Contains("map",TString::kIgnoreCase))
200 what = kLocalAltroMap;
202 Warning("Draw", "unknown parameter: %s\n\tShould be one of\n\t"
203 "dead, threshold, gain, pedestal, noise, zero, rate, "
209 TArrayD xbins(3 * 512 + 2 * 256 + 5);
212 for (UShort_t det = 1; det <= 3; det++) {
213 UShort_t nRings = (det == 1 ? 1 : 2);
214 for (UShort_t iring = 0; iring < nRings; iring++) {
215 UShort_t nStrip = (iring == 0 ? 512 : 256);
216 Char_t ring = (iring == 0 ? 'I' : 'O');
217 for (UShort_t str = 0; str < nStrip; str++) {
218 // UShort_t nSec = (iring == 0 ? 20 : 40);
219 // Char_t ring = (iring == 0 ? 'I' : 'O');
220 // for (UShort_t sec = 0; sec < nSec; sec++) {
221 Int_t idx = DET2IDX(det, ring, 0, str);
222 // Int_t idx = DET2IDX(det, ring, sec, 0);
224 xbins[i-1] = idx - .5;
235 for (/*Int_t*/ i = 0; i < ybins.fN; i++) ybins[i] = Float_t(i - .5);
236 TH2D* hist = new TH2D("calib", Form("Calibration %s", option),
237 xbins.fN-1, xbins.fArray,
238 ybins.fN-1, ybins.fArray);
239 hist->GetXaxis()->SetTitle("1000 #times detector + 512 #times ring + strip");
240 hist->GetYaxis()->SetTitle("sector");
242 // hist->Draw("Lego");
245 for (UShort_t det = 1; det <= 3; det++) {
246 UShort_t nRings = (det == 1 ? 1 : 2);
247 for (UShort_t iring = 0; iring < nRings; iring++) {
248 UShort_t nSector = (iring == 0 ? 20 : 40);
249 UShort_t nStrip = (iring == 0 ? 512 : 256);
250 Char_t ring = (iring == 0 ? 'I' : 'O');
251 for (UShort_t sec = 0; sec < nSector; sec++) {
252 for (UShort_t str = 0; str < nStrip; str++) {
253 Int_t idx = DET2IDX(det, ring, sec, str);
254 UShort_t ddl, addr, time, sam=0;
257 case kLocalPulseGain: // Path to PulseGain calib object
258 val = GetPulseGain(det,ring,sec,str); break;
259 case kLocalThreshold: // Path to PulseGain calib object
260 val = GetThreshold(); break;
261 case kLocalPedestal: // Path to Pedestal calib object
262 val = GetPedestal(det,ring,sec,str); break;
263 case kLocalPedestalWidth: // Path to Pedestal calib object
264 val = GetPedestalWidth(det,ring,sec,str); break;
265 case kLocalDead: // Path to Dead calib object
266 val = IsDead(det,ring,sec,str); break;
267 case kLocalSampleRate: // Path to SampleRate calib object
268 val = GetSampleRate(det,ring,sec,str); break;
269 case kLocalAltroMap: // Path to AltroMap calib object
270 Detector2Hardware(det,ring,sec,str,sam,ddl,addr,time);
272 case kLocalZeroSuppression: // Path to ZeroSuppression cal object
273 val = GetZeroSuppression(det,ring,sec,str); break;
274 case kLocalMinStripRange: // Path to strip range cal object
275 val = GetMinStrip(det,ring,sec,str); break;
276 case kLocalMaxStripRange: // Path to strip range cal object
277 val = GetMaxStrip(det,ring,sec,str); break;
279 hist->Fill(idx,sec,val);
280 // hist->Fill(idx,str,val);
288 //__________________________________________________________________
290 AliFMDParameters::Print(Option_t* option) const
292 // Print information.
293 // If option contains an 'A' then everything is printed.
294 // If the option contains the string "FMD" the function will search
295 // for detector, ring, sector, and strip numbers to print, in the
298 // FMD<detector><ring>[<sector>,<string>]
300 // The wild card '*' means all of <detector>, <ring>, <sector>, or
303 Bool_t showStrips = opt.Contains("a", TString::kIgnoreCase);
304 UShort_t ds[] = { 1, 2, 3, 0 };
305 Char_t rs[] = { 'I', 'O', '\0' };
306 UShort_t minStrip = 0;
307 UShort_t maxStrip = 512;
308 UShort_t minSector = 0;
309 UShort_t maxSector = 40;
312 if (opt.Contains("fmd",TString::kIgnoreCase)) {
313 Int_t i = opt.Index("fmd",TString::kIgnoreCase);
314 Int_t j = opt.Index("]",TString::kIgnoreCase);
329 std::stringstream s(opt(i+4, j-i-3).Data());
330 while (state != kEnd) {
331 Char_t tmp = s.peek();
332 if (tmp == ' ' || tmp == '\t') {
337 case kReadDet: { // First, try to kRead the detector
338 if (tmp == '*') s.get();
347 state = (s.bad() ? kEnd : kReadRing);
349 case kReadRing: { // Then try to read the ring;
352 if (ring != '*' && !s.bad()) {
356 state = (s.bad() ? kEnd : kReadLbrack);
358 case kReadLbrack: { // Try to read a left bracket
361 state = (s.bad() ? kEnd : kReadSector);
363 case kReadSector: { // Try to read a sector
364 if (tmp == '*') s.get();
373 state = (s.bad() ? kEnd : kReadComma);
375 case kReadComma: { // Try to read a left bracket
378 state = (s.bad() ? kEnd : kReadStrip);
380 case kReadStrip: { // Try to read a strip
381 if (tmp == '*') s.get();
390 state = (s.bad() ? kEnd : kReadRbrack);
392 case kReadRbrack: { // Try to read a left bracket
404 while ((det = *(dp++))) {
408 while ((ring = *(rp++))) {
409 if (det == 1 && ring == 'O') continue;
410 UShort_t min = GetMinStrip(det, ring, 0, 0);
411 UShort_t max = GetMaxStrip(det, ring, 0, 0);
412 std::cout << "FMD" << det << ring
414 << std::setw(3) << min << ","
415 << std::setw(3) << max << std::endl;
417 UShort_t nSec = ( ring == 'I' ? 20 : 40 );
418 UShort_t nStr = ( ring == 'I' ? 512 : 256 );
419 for (UShort_t sec = minSector; sec < maxSector && sec < nSec; sec++) {
421 UShort_t rate = GetSampleRate(det, ring, sec, 0);
422 std::cout << "FMD" << det << ring << "[" << std::setw(2) << sec
423 << "] sample rate: " << rate << std::endl;
425 if (!showStrips) continue;
427 << " Strip | Pedestal | Gain | ZS thr. | Address\n"
428 << "--------+-------------------+------------+---------+---------"
430 for (UShort_t str = minStrip; str < nStr && str < maxStrip; str++) {
431 if (str == minStrip) std::cout << std::setw(3) << sec << ",";
432 else std::cout << " ";
433 std::cout << std::setw(3) << str << " | ";
434 if (IsDead(det, ring, sec, str)) {
435 std::cout << "dead" << std::endl;
438 UShort_t ddl, addr, time, sam=0;
439 Detector2Hardware(det, ring, sec, str, sam, ddl, addr, time);
440 std::cout << std::setw(7) << GetPedestal(det, ring, sec, str)
441 << "+/-" << std::setw(7)
442 << GetPedestalWidth(det, ring, sec, str)
443 << " | " << std::setw(10)
444 << GetPulseGain(det, ring, sec, str)
445 << " | " << std::setw(7)
446 << GetZeroSuppression(det, ring, sec, str)
447 << " | 0x" << std::hex << std::setw(4)
448 << std::setfill('0') << ddl << ",0x" << std::setw(3)
449 << addr << std::dec << std::setfill(' ') << std::endl;
453 << "============================================================="
460 //__________________________________________________________________
462 AliFMDParameters::SetStripRange(UShort_t min, UShort_t max)
464 // Set fixed strip range
465 fFixedMinStrip = min;
466 fFixedMaxStrip = max;
469 //__________________________________________________________________
471 AliFMDParameters::GetEntry(const char* path, AliFMDPreprocessor* pp,
474 // Get an entry from the CDB or via preprocessor
475 AliCDBEntry* entry = 0;
477 AliCDBManager* cdb = AliCDBManager::Instance();
478 entry = cdb->Get(path);
481 const char* third = gSystem->BaseName(path);
482 const char* second = gSystem->BaseName(gSystem->DirName(path));
483 entry = pp->GetFromCDB(second, third);
486 TString msg(Form("No %s found in CDB, perhaps you need to "
487 "use AliFMDCalibFaker?", path));
488 if (fatal) { AliFatal(msg.Data()); }
489 else AliLog::Message(AliLog::kWarning, msg.Data(), "FMD",
490 "AliFMDParameters", "GetEntry", __FILE__,
498 //__________________________________________________________________
500 AliFMDParameters::InitPulseGain(AliFMDPreprocessor* pp)
502 // Get pulse gain from CDB or used fixed
503 AliCDBEntry* gain = GetEntry(fgkPulseGain, pp);
506 AliFMDDebug(5, ("Got gain from CDB"));
507 fPulseGain = dynamic_cast<AliFMDCalibGain*>(gain->GetObject());
508 if (!fPulseGain) AliFatal("Invalid pulser gain object from CDB");
510 //__________________________________________________________________
512 AliFMDParameters::InitPedestal(AliFMDPreprocessor* pp)
514 // Initialize the pedestals from CDB
515 AliCDBEntry* pedestal = GetEntry(fgkPedestal, pp);
516 if (!pedestal) return;
518 AliFMDDebug(5, ("Got pedestal from CDB"));
519 fPedestal = dynamic_cast<AliFMDCalibPedestal*>(pedestal->GetObject());
520 if (!fPedestal) AliFatal("Invalid pedestal object from CDB");
523 //__________________________________________________________________
525 AliFMDParameters::InitDeadMap(AliFMDPreprocessor* pp)
527 // Get Dead-channel-map from CDB
528 AliCDBEntry* deadMap = GetEntry(fgkDead, pp);
529 if (!deadMap) return;
531 AliFMDDebug(5, ("Got dead map from CDB"));
532 fDeadMap = dynamic_cast<AliFMDCalibDeadMap*>(deadMap->GetObject());
533 if (!fDeadMap) AliFatal("Invalid dead map object from CDB");
536 //__________________________________________________________________
538 AliFMDParameters::InitZeroSuppression(AliFMDPreprocessor* pp)
540 // Get 0-suppression from CDB
541 AliCDBEntry* zeroSup = GetEntry(fgkZeroSuppression, pp);
542 if (!zeroSup) return;
543 AliFMDDebug(5, ("Got zero suppression from CDB"));
545 dynamic_cast<AliFMDCalibZeroSuppression*>(zeroSup->GetObject());
546 if (!fZeroSuppression)AliFatal("Invalid zero suppression object from CDB");
549 //__________________________________________________________________
551 AliFMDParameters::InitSampleRate(AliFMDPreprocessor* pp)
553 // get Sample rate from CDB
554 AliCDBEntry* sampRat = GetEntry(fgkSampleRate, pp);
555 if (!sampRat) return;
556 AliFMDDebug(5, ("Got zero suppression from CDB"));
557 fSampleRate = dynamic_cast<AliFMDCalibSampleRate*>(sampRat->GetObject());
558 if (!fSampleRate) AliFatal("Invalid zero suppression object from CDB");
561 //__________________________________________________________________
563 AliFMDParameters::InitAltroMap(AliFMDPreprocessor* pp)
565 // Get hardware mapping from CDB
570 AliCDBEntry* hwMap = GetEntry(fgkAltroMap, pp, kFALSE);
573 AliFMDDebug(5, ("Got ALTRO map from CDB"));
574 fAltroMap = dynamic_cast<AliFMDAltroMapping*>(hwMap->GetObject());
576 AliFatal("Invalid ALTRO map object from CDB");
577 fAltroMap = new AliFMDAltroMapping;
581 //__________________________________________________________________
583 AliFMDParameters::InitStripRange(AliFMDPreprocessor* pp)
585 // Get strips read-out from CDB
586 AliCDBEntry* range = GetEntry(fgkStripRange, pp);
588 AliFMDDebug(5, ("Got strip range from CDB"));
589 fStripRange = dynamic_cast<AliFMDCalibStripRange*>(range->GetObject());
590 if (!fStripRange) AliFatal("Invalid strip range object from CDB");
594 //__________________________________________________________________
596 AliFMDParameters::GetThreshold() const
598 // Get threshold from CDB
599 if (!fPulseGain) return fFixedThreshold;
600 return fPulseGain->Threshold();
603 //__________________________________________________________________
605 AliFMDParameters::GetPulseGain(UShort_t detector, Char_t ring,
606 UShort_t sector, UShort_t strip) const
608 // Returns the pulser calibrated gain for strip # strip in sector #
609 // sector or ring id ring of detector # detector.
611 // For simulation, this is normally set to
614 // ------------------ * MIP_Energy_Loss
615 // ALTRO_channel_size
618 if (fFixedPulseGain <= 0)
619 fFixedPulseGain = fVA1MipRange * GetEdepMip() / fAltroChannelSize;
620 return fFixedPulseGain;
622 AliFMDDebug(50, ("pulse gain for FMD%d%c[%2d,%3d]=%f",
623 detector, ring, sector, strip,
624 fPulseGain->Value(detector, ring, sector, strip)));
625 return fPulseGain->Value(detector, ring, sector, strip);
628 //__________________________________________________________________
630 AliFMDParameters::IsDead(UShort_t detector, Char_t ring,
631 UShort_t sector, UShort_t strip) const
633 // Check if the channel is dead
634 if (!fDeadMap) return kFALSE;
635 AliFMDDebug(50, ("Dead for FMD%d%c[%2d,%3d]=%s",
636 detector, ring, sector, strip,
637 fDeadMap->operator()(detector, ring, sector, strip) ?
639 return fDeadMap->operator()(detector, ring, sector, strip);
642 //__________________________________________________________________
644 AliFMDParameters::GetZeroSuppression(UShort_t detector, Char_t ring,
645 UShort_t sector, UShort_t strip) const
647 // Get zero suppression threshold
648 if (!fZeroSuppression) return fFixedZeroSuppression;
649 // Need to map strip to ALTRO chip.
650 AliFMDDebug(50, ("zero sup. for FMD%d%c[%2d,%3d]=%f",
651 detector, ring, sector, strip,
652 fZeroSuppression->operator()(detector, ring,
654 return fZeroSuppression->operator()(detector, ring, sector, strip/128);
657 //__________________________________________________________________
659 AliFMDParameters::GetSampleRate(UShort_t det, Char_t ring, UShort_t sector,
663 if (!fSampleRate) return fFixedSampleRate;
664 // Need to map sector to digitizier card.
665 UInt_t ret = fSampleRate->Rate(det, ring, sector, str);
666 AliFMDDebug(50, ("Sample rate for FMD%d%c[%2d,%3d]=%d",
667 det, ring, sector, str, ret));
671 //__________________________________________________________________
673 AliFMDParameters::GetMinStrip(UShort_t det, Char_t ring, UShort_t sector,
676 // Get strip range read out
677 if (!fStripRange) return fFixedMinStrip;
678 // Need to map sector to digitizier card.
679 UInt_t ret = fStripRange->Min(det, ring, sector, str);
680 AliFMDDebug(50, ("Min strip # for FMD%d%c[%2d,%3d]=%d",
681 det, ring, sector, str, ret));
685 //__________________________________________________________________
687 AliFMDParameters::GetMaxStrip(UShort_t det, Char_t ring, UShort_t sector,
690 // Get strip range read out
691 if (!fStripRange) return fFixedMaxStrip;
692 // Need to map sector to digitizier card.
693 UInt_t ret = fStripRange->Max(det, ring, sector, str);
694 AliFMDDebug(50, ("Max strip # for FMD%d%c[%2d,%3d]=%d",
695 det, ring, sector, str, ret));
699 //__________________________________________________________________
701 AliFMDParameters::GetPedestal(UShort_t detector, Char_t ring,
702 UShort_t sector, UShort_t strip) const
705 if (!fPedestal) return fFixedPedestal;
706 AliFMDDebug(50, ("pedestal for FMD%d%c[%2d,%3d]=%f",
707 detector, ring, sector, strip,
708 fPedestal->Value(detector, ring, sector, strip)));
709 return fPedestal->Value(detector, ring, sector, strip);
712 //__________________________________________________________________
714 AliFMDParameters::GetPedestalWidth(UShort_t detector, Char_t ring,
715 UShort_t sector, UShort_t strip) const
718 if (!fPedestal) return fFixedPedestalWidth;
719 AliFMDDebug(50, ("pedetal width for FMD%d%c[%2d,%3d]=%f",
720 detector, ring, sector, strip,
721 fPedestal->Width(detector, ring, sector, strip)));
722 return fPedestal->Width(detector, ring, sector, strip);
725 //__________________________________________________________________
727 AliFMDParameters::GetAltroMap() const
729 // Get the hardware address to detector index map
734 //____________________________________________________________________
736 AliFMDParameters::Hardware2Detector(UShort_t ddl, UShort_t addr,
738 UShort_t& det, Char_t& ring,
739 UShort_t& sec, Short_t& str,
742 // Translate a hardware address to detector coordinates.
744 // See also Hardware2Detector that accepts 4 inputs
745 if (!fAltroMap) return kFALSE;
746 UShort_t board, chip, chan;
747 fAltroMap->ChannelAddress(addr, board, chip, chan);
748 return Hardware2Detector(ddl,board,chip,chan,timebin,det,ring,sec,str,sam);
750 //____________________________________________________________________
752 AliFMDParameters::Hardware2Detector(UShort_t ddl, UShort_t board,
753 UShort_t chip, UShort_t chan,
755 UShort_t& det, Char_t& ring,
756 UShort_t& sec, Short_t& str,
759 // Translate a hardware address to detector coordinates.
761 // See also Hardware2Detector that accepts 4 inputs
762 if (!fAltroMap) return kFALSE;
763 if (fAltroMap->DDL2Detector(ddl) < 0) return kFALSE;
764 Short_t stripBase = 0;
765 if (!fAltroMap->Channel2StripBase(board,chip,chan, ring, sec, stripBase))
767 UShort_t preSamples = GetPreSamples(det, ring, sec, stripBase);
768 UShort_t sampleRate = GetSampleRate(det, ring, sec, stripBase);
769 Short_t stripOff = 0;
770 fAltroMap->Timebin2Strip(sec, timebin, preSamples, sampleRate, stripOff, sam);
771 str = stripBase + stripOff;
772 AliFMDDebug(50, ("%d/0x%02x/0x%x/0x%x/%04d -> FMD%d%c[%02d,%03d]-%d"
773 " (pre=%2d, rate=%d)",
774 ddl, board, chip, chan, timebin,
775 det, ring, sec, str, sam, preSamples, sampleRate));
780 //__________________________________________________________________
782 AliFMDParameters::Hardware2Detector(UShort_t ddl, UShort_t board,
783 UShort_t chip, UShort_t chan,
784 UShort_t& det, Char_t& ring,
785 UShort_t& sec, Short_t& str) const
787 // Map hardware address to detector index
788 if (!fAltroMap) return kFALSE;
789 return fAltroMap->Hardware2Detector(ddl,board,chip,chan, det,ring,sec,str);
791 //__________________________________________________________________
793 AliFMDParameters::Hardware2Detector(UShort_t ddl, UShort_t addr,
794 UShort_t& det, Char_t& ring,
795 UShort_t& sec, Short_t& str) const
797 // Map hardware address to detector index
798 if (!fAltroMap) return kFALSE;
799 return fAltroMap->Hardware2Detector(ddl, addr, det, ring, sec, str);
803 //____________________________________________________________________
805 AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring,
806 UShort_t sec, UShort_t str,
808 UShort_t& ddl, UShort_t& board,
809 UShort_t& altro, UShort_t& channel,
810 UShort_t& timebin) const
812 if (!fAltroMap) return kFALSE;
813 UShort_t preSamples = GetPreSamples(det, ring, sec, str);
814 UShort_t sampleRate = GetSampleRate(det, ring, sec, str);
815 UShort_t strip = str - GetMinStrip(det,ring,sec,str);
816 return fAltroMap->Detector2Hardware(det, ring, sec, strip, sam,
817 preSamples, sampleRate,
818 ddl, board, altro, channel, timebin);
823 //____________________________________________________________________
825 AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring,
826 UShort_t sec, UShort_t str,
828 UShort_t& ddl, UShort_t& addr,
829 UShort_t& timebin) const
831 if (!fAltroMap) return kFALSE;
832 UShort_t preSamples = GetPreSamples(det, ring, sec, str);
833 UShort_t sampleRate = GetSampleRate(det, ring, sec, str);
834 UShort_t strip = str - GetMinStrip(det,ring,sec,str);
835 return fAltroMap->Detector2Hardware(det, ring, sec, strip, sam,
836 preSamples, sampleRate,
841 //__________________________________________________________________
843 AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring,
844 UShort_t sec, UShort_t str,
845 UShort_t& ddl, UShort_t& board,
846 UShort_t& chip, UShort_t& chan) const
848 // Map detector index to hardware address
849 if (!fAltroMap) return kFALSE;
850 return fAltroMap->Detector2Hardware(det,ring,sec,str, ddl,board,chip,chan);
853 //__________________________________________________________________
855 AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring,
856 UShort_t sec, UShort_t str,
857 UShort_t& ddl, UShort_t& addr) const
859 // Map detector index to hardware address
860 if (!fAltroMap) return kFALSE;
861 return fAltroMap->Detector2Hardware(det, ring, sec, str, ddl, addr);
865 //__________________________________________________________________
867 AliFMDParameters::GetEdepMip() const
869 // Get energy deposited by a MIP in the silicon sensors
871 AliFMDGeometry* fmd = AliFMDGeometry::Instance();
872 fEdepMip = (fkSiDeDxMip
873 * fmd->GetRing('I')->GetSiThickness()
874 * fmd->GetSiDensity());
878 //____________________________________________________________________
880 AliFMDParameters::GetDACPerMIP() const
882 //This is the conversion from the Digital-to-Analog-Converter setting
883 // to the number of MIPs. The number was measured in the NBI lab during
890 //____________________________________________________________________