1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //____________________________________________________________________
20 // Forward Multiplicity Detector based on Silicon wafers.
22 // This class is a singleton that handles various parameters of
24 // Eventually, this class will use the Conditions DB to get the
25 // various parameters, which code can then request from here.
27 #include "AliLog.h" // ALILOG_H
28 #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
29 #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H
30 #include "AliFMDRing.h" // ALIFMDRING_H
31 #include "AliFMDCalibGain.h" // ALIFMDCALIBGAIN_H
32 #include "AliFMDCalibPedestal.h" // ALIFMDCALIBPEDESTAL_H
33 #include "AliFMDCalibSampleRate.h" // ALIFMDCALIBPEDESTAL_H
34 #include "AliFMDAltroMapping.h" // ALIFMDALTROMAPPING_H
35 #include <AliCDBManager.h> // ALICDBMANAGER_H
36 #include <AliCDBEntry.h> // ALICDBMANAGER_H
37 #include <Riostream.h>
39 //====================================================================
40 ClassImp(AliFMDParameters)
42 ; // This is here to keep Emacs for indenting the next line
45 //____________________________________________________________________
46 AliFMDParameters* AliFMDParameters::fgInstance = 0;
48 //____________________________________________________________________
49 const char* AliFMDParameters::fgkPulseGain = "FMD/Calib/PulseGain";
50 const char* AliFMDParameters::fgkPedestal = "FMD/Calib/Pedestal";
51 const char* AliFMDParameters::fgkDead = "FMD/Calib/Dead";
52 const char* AliFMDParameters::fgkSampleRate = "FMD/Calib/SampleRate";
53 const char* AliFMDParameters::fgkAltroMap = "FMD/Calib/AltroMap";
54 const char* AliFMDParameters::fgkZeroSuppression = "FMD/Calib/ZeroSuppression";
57 //____________________________________________________________________
59 AliFMDParameters::Instance()
61 // Get static instance
62 if (!fgInstance) fgInstance = new AliFMDParameters;
66 //____________________________________________________________________
67 AliFMDParameters::AliFMDParameters()
79 // Default constructor
81 SetAltroChannelSize();
82 SetChannelsPerAltro();
91 //__________________________________________________________________
93 AliFMDParameters::Init()
95 // Initialize the parameters manager. We need to get stuff from the
99 AliCDBManager* cdb = AliCDBManager::Instance();
100 AliCDBEntry* gain = cdb->Get(fgkPulseGain);
101 AliCDBEntry* pedestal = cdb->Get(fgkPedestal);
102 AliCDBEntry* deadMap = cdb->Get(fgkDead);
103 AliCDBEntry* zeroSup = cdb->Get(fgkZeroSuppression);
104 AliCDBEntry* sampRat = cdb->Get(fgkSampleRate);
105 AliCDBEntry* hwMap = cdb->Get(fgkAltroMap);
108 AliDebug(1, Form("Got gain from CDB"));
109 fPulseGain = dynamic_cast<AliFMDCalibGain*>(gain->GetObject());
111 AliWarning("Invalid pulser gain object from CDB");
114 AliDebug(1, Form("Got pedestal from CDB"));
115 fPedestal = dynamic_cast<AliFMDCalibPedestal*>(pedestal->GetObject());
117 AliWarning("Invalid pedestal object from CDB");
120 AliDebug(1, Form("Got dead map from CDB"));
121 fDeadMap = dynamic_cast<AliFMDCalibDeadMap*>(deadMap->GetObject());
123 AliWarning("Invalid dead map object from CDB");
126 AliDebug(1, Form("Got zero suppression from CDB"));
128 dynamic_cast<AliFMDCalibZeroSuppression*>(zeroSup->GetObject());
129 if (!fZeroSuppression)
130 AliWarning("Invalid zero suppression object from CDB");
133 AliDebug(1, Form("Got zero suppression from CDB"));
135 dynamic_cast<AliFMDCalibSampleRate*>(sampRat->GetObject());
137 AliWarning("Invalid zero suppression object from CDB");
140 AliDebug(1, Form("Got ALTRO map from CDB"));
141 fAltroMap = dynamic_cast<AliFMDAltroMapping*>(hwMap->GetObject());
143 AliWarning("Invalid ALTRO map object from CDB");
145 if (!fAltroMap) fAltroMap = new AliFMDAltroMapping;
150 //__________________________________________________________________
152 AliFMDParameters::GetThreshold() const
154 if (!fPulseGain) return fFixedThreshold;
155 return fPulseGain->Threshold();
158 //__________________________________________________________________
160 AliFMDParameters::GetPulseGain(UShort_t detector, Char_t ring,
161 UShort_t sector, UShort_t strip) const
163 // Returns the pulser calibrated gain for strip # strip in sector #
164 // sector or ring id ring of detector # detector.
166 // For simulation, this is normally set to
169 // ------------------ * MIP_Energy_Loss
170 // ALTRO_channel_size
173 if (fFixedPulseGain <= 0)
174 fFixedPulseGain = fVA1MipRange * GetEdepMip() / fAltroChannelSize;
175 return fFixedPulseGain;
177 return fPulseGain->Value(detector, ring, sector, strip);
180 //__________________________________________________________________
182 AliFMDParameters::IsDead(UShort_t detector, Char_t ring,
183 UShort_t sector, UShort_t strip) const
185 if (!fDeadMap) return kFALSE;
186 return fDeadMap->operator()(detector, ring, sector, strip);
189 //__________________________________________________________________
191 AliFMDParameters::GetZeroSuppression(UShort_t detector, Char_t ring,
192 UShort_t sector, UShort_t strip) const
194 if (!fZeroSuppression) return fFixedZeroSuppression;
195 // Need to map strip to ALTRO chip.
196 return fZeroSuppression->operator()(detector, ring, sector, strip/128);
199 //__________________________________________________________________
201 AliFMDParameters::GetSampleRate(UShort_t ddl) const
203 if (!fSampleRate) return fFixedSampleRate;
204 // Need to map sector to digitizier card.
205 return fSampleRate->Rate(ddl);
208 //__________________________________________________________________
210 AliFMDParameters::GetPedestal(UShort_t detector, Char_t ring,
211 UShort_t sector, UShort_t strip) const
213 if (!fPedestal) return fFixedPedestal;
214 return fPedestal->Value(detector, ring, sector, strip);
217 //__________________________________________________________________
219 AliFMDParameters::GetPedestalWidth(UShort_t detector, Char_t ring,
220 UShort_t sector, UShort_t strip) const
222 if (!fPedestal) return fFixedPedestalWidth;
223 return fPedestal->Width(detector, ring, sector, strip);
226 //__________________________________________________________________
228 AliFMDParameters::GetAltroMap() const
234 //__________________________________________________________________
236 AliFMDParameters::Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
237 Char_t& ring, UShort_t& sec,
240 if (!fAltroMap) return kFALSE;
241 return fAltroMap->Hardware2Detector(ddl, addr, det, ring, sec, str);
244 //__________________________________________________________________
246 AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec,
247 UShort_t str, UInt_t& ddl,
250 if (!fAltroMap) return kFALSE;
251 return fAltroMap->Detector2Hardware(det, ring, sec, str, ddl, addr);
255 //__________________________________________________________________
257 AliFMDParameters::GetEdepMip() const
259 // Get energy deposited by a MIP in the silicon sensors
261 AliFMDGeometry* fmd = AliFMDGeometry::Instance();
262 fEdepMip = (fSiDeDxMip
263 * fmd->GetRing('I')->GetSiThickness()
264 * fmd->GetSiDensity());
273 //____________________________________________________________________