当前位置: 首页>>代码示例>>C++>>正文


C++ KVDetector::GetGain方法代码示例

本文整理汇总了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;
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:33,代码来源:KVChannelVolt.cpp

示例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;
}
开发者ID:GiuseppePast,项目名称:kaliveda,代码行数:35,代码来源:KVChannelVolt.cpp

示例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.;
   }
}
开发者ID:GiuseppePast,项目名称:kaliveda,代码行数:14,代码来源:KVChannelVolt.cpp


注:本文中的KVDetector::GetGain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。