29{
   32 
   34 
   37  
   38  map_t             input;
   40 
   41  double            minDistanceHV = 2 * 3.14;
   42  JRange_t          rangeHV       = JRange_t(-1500 + 1e-2,
   43                                             -80 - 1e-2);
   44  JRange_t          rangeGain     = JRange_t(FITTOT_GAIN_MIN + 1e-2,
   45                                             FITTOT_GAIN_MAX - 1e-2);
   47  
   49 
   50  try {
   51 
   52    JParser<> zap(
"Example program to interpolate high-voltage versus gain ASCII data.");
 
   53 
   55 
   60    
   65 
   66    zap(argc, argv);
   67  }
   68  catch (const exception& error) {
   69    FATAL(error.what() << endl);
 
   70  }
   71 
   72  JHVInterpolator::setMinHVDistance(minDistanceHV);
   73  JHVInterpolator::setHVRange      (rangeHV);
   74  JHVInterpolator::setGainRange    (rangeGain);
   75 
   78  
   80  
   81  for (map_t::const_iterator i = input.cbegin(); i != input.cend(); ++i) {
   82    
   83    const double HV        = i->first;
   84    const double gain      = i->second.first;
   85    const double gainError = i->second.second;
   86    
   88    
   89    interpolator.AddPoint(HV, gain, gainError);
   90  }
   91 
   92  TFile file(output.
getFilename().c_str(), 
"RECREATE");
 
   93 
   95  
   96  graph.Write();
   97  
   98  file.Close();
   99  
  100  NOTICE(
FILL(100,
'-') << 
" Interpolated high-voltage" << setfill(
' ') << endl);
 
  101  
  102  try {
  103    
  104    interpolator.interpolateHV(targetGain);
  105    
  106    const double targetHV      = interpolator.getHV     ();
  107    const double targetHVError = interpolator.getHVError();
  108    
  109    NOTICE(
FIXED(35,2) << right << -targetHV << 
" +/- " <<
 
  110           FIXED(8, 2) << left  <<  targetHVError <<
 
  111           FIXED(9, 2) << right <<  targetGain << endl);
 
  112  }
  113  catch (const exception& error) {
  114    FATAL(error.what() << endl);
 
  115  }
  116}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
 
Utility class to parse parameter values.
 
Auxiliary class to handle file name, ROOT directory and object name.
 
TString getObjectName() const
Get object name.
 
const std::string & getFilename() const
Get file name.
 
Utility class to parse command line options.
 
const double NOMINAL_GAIN
Specification for normalized gain corresponding to a one photo-electron pulse.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
 
Auxiliary data structure for sequence of same character.
 
Auxiliary data structure for floating point format specification.
 
Auxiliary data structure to store high-voltage versus gain data and interpolate the nominal high-volt...
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Auxiliary data structure for alignment of data.