Back to index

PdbADCChan.cc

 
//----------------------------------------------------------------------------- 
//  $Header: /afs/rhic/phenix/PHENIX_CVS/offline/database/pdbcal/PdbADCChan.cc,v 1.6 1999/08/17 21:14:32 messer Exp $ 
// 
//  The pdbcal package 
//  Copyright (C) PHENIX collaboration, 1999 
// 
//  Implementation of class PdbADCChan 
// 
//  Author: Matthias Messer 
//----------------------------------------------------------------------------- 
#include "PdbADCChan.hh" 
 
#include <iostream.h> 
#include <iomanip.h> 
 
PdbADCChan::PdbADCChan() : nDim(3) 
{ 
   zero(); 
} 
 
void PdbADCChan::zero() 
{ 
   for (int i = 0; i < nDim; i++) { 
      ADCParameter[i] = 0.0; 
      ADCParError[i]  = 0.0; 
   } 
} 
 
PdbADCChan::~PdbADCChan() 
{ 
} 
 
float PdbADCChan::getParameter(size_t i) const 
{ 
   // 
   // Returns the parameter value at a given index location, 0.0 if the index is out of range. 
   // 
   if (i>=0 && i<nDim) 
      return ADCParameter[i]; 
   else 
      return 0.0; 
} 
 
float PdbADCChan::getParError(size_t i) const 
{ 
   // 
   // Returns the parameter error at a given index location, 0.0 if the index is out of range. 
   // 
   if (i>=0 && i<nDim) 
      return ADCParError[i]; 
   else 
      return 0.0; 
} 
 
const char* PdbADCChan::getParName(size_t i) const 
{ 
   // 
   // Returns the parameter error at a given index location. Returns 0.0 if the index is out of range. 
   // 
   switch(i) { 
   case 0: 
      return "Low Gain"; 
   case 1: 
      return "High Gain"; 
   case 2: 
      return "Conversion Factor"; 
   default: 
      return 0; 
   } 
} 
 
void PdbADCChan::setParameter(size_t i, float val) 
{ 
   if (i>=0 && i<nDim) 
      ADCParameter[i] = val; 
   else 
      cout << "PdbADCChan::SetParameter - Index = " << i  << " is out of range. [0.." << nDim-1 << "] is valid." << endl; 
} 
 
void PdbADCChan::setParError(size_t i, float val) 
{ 
   if (i>=0 && i<nDim) 
      ADCParError[i] = val; 
   else 
      cout << "PdbADCChan::SetParError - Index = " << i  << " is out of range. [0.." << nDim-1 << "] is valid." << endl; 
} 
 
void PdbADCChan::print() const 
{ 
   cout << "LowGain  = " << ADCParameter[0] << " +- " << ADCParError[0] << endl; 
   cout << "HighGain = " << ADCParameter[1] << " +- " << ADCParError[1] << endl; 
   cout << "Convert  = " << ADCParameter[2] << " +- " << ADCParError[2] << endl; 
} 
 
 
 
 
 
 
 

Back to index