本文整理汇总了C++中KVDetector::GetGain方法的典型用法代码示例。如果您正苦于以下问题:C++ KVDetector::GetGain方法的具体用法?C++ KVDetector::GetGain怎么用?C++ KVDetector::GetGain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KVDetector
的用法示例。
在下文中一共展示了KVDetector::GetGain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InvertDouble
//___________________________________________________________________________
Double_t KVChannelVolt::InvertDouble(Double_t volts)
{
Double_t gain = 1.;
KVDetector* det = GetDetector();
if (det)
gain = det->GetGain();
Double_t channel = 0;
if (fReady) {
if (fPar[2]) {
// quadratic transfer function
Double_t c;
c = fPar[1] * fPar[1] - 4. * fPar[2] * (fPar[0] - gain / gain_ref * volts);
if (c < 0.0)
return -1;
c = (-fPar[1] + TMath::Sqrt(c)) / (2.0 * fPar[2]);
if (c < 0.0
&& ((-fPar[1] - TMath::Sqrt(c)) / (2.0 * fPar[2])) > 0.0) {
c = (-fPar[1] - TMath::Sqrt(c)) / (2.0 * fPar[2]);
}
channel = c;
}
else {
// linear transfer function
channel = (gain / gain_ref * volts - fPar[0]) / fPar[1];
}
}
else {
Warning("Compute", "Parameters not correctly initialized");
}
return (Double_t) channel;
}
示例2: Invert
//___________________________________________________________________________
Double_t KVChannelVolt::Invert(Double_t volts)
{
//Given the calibrated (or simulated) signal amplitude in volts,
//calculate the corresponding channel number according to the
//calibration parameters (useful for filtering simulations).
Double_t gain = 1.;
KVDetector* det = GetDetector();
if (det)
gain = det->GetGain();
Int_t channel = 0;
if (fReady) {
if (fPar[2]) {
// quadratic transfer function
Double_t c;
c = fPar[1] * fPar[1] - 4. * fPar[2] * (fPar[0] - gain / gain_ref * volts);
if (c < 0.0)
return -1;
c = (-fPar[1] + TMath::Sqrt(c)) / (2.0 * fPar[2]);
if (c < 0.0
&& ((-fPar[1] - TMath::Sqrt(c)) / (2.0 * fPar[2])) > 0.0) {
c = (-fPar[1] - TMath::Sqrt(c)) / (2.0 * fPar[2]);
}
channel = (Int_t)(c + 0.5);
} else {
// linear transfer function
channel = (Int_t)(0.5 + (gain / gain_ref * volts - fPar[0]) / fPar[1]);
}
} else {
Warning("Compute", "Parameters not correctly initialized");
}
return (Double_t) channel;
}
示例3: Compute
//___________________________________________________________________________
Double_t KVChannelVolt::Compute(Double_t chan) const
{
Double_t gain = 1.;
KVDetector* det = GetDetector();
if (det)
gain = det->GetGain();
//Calculate the calibrated signal strength in volts for a given channel number.
if (fReady) {
return (fPar[0] + fPar[1] * chan + fPar[2] * chan * chan) * gain_ref / gain;
} else {
return 0.;
}
}