00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "GainVoltCoeffCalculator.h"
00010 #include "GainVoltPmtParameters.h"
00011
00012
00013
00014 GainVoltCoeffCalculator::GainVoltCoeffCalculator()
00015 {}
00016
00017 GainVoltCoeffCalculator::GainVoltCoeffCalculator(const GainVoltCoeffCalculator&calculator)
00018 : _pmts(calculator._pmts)
00019 {}
00020
00021 GainVoltCoeffCalculator::~GainVoltCoeffCalculator()
00022 {}
00023
00024 GainVoltCoeffCalculator & GainVoltCoeffCalculator::operator=(const GainVoltCoeffCalculator&calculator)
00025 {
00026 _pmts = calculator._pmts;
00027 return *this;
00028 }
00029
00030 void GainVoltCoeffCalculator::setIoMode(int mode)
00031 {
00032 GainVoltPmtParameters::ioMode = mode;
00033 }
00034
00035 vector<GainVoltPmtParameters*>::iterator GainVoltCoeffCalculator::begin()
00036 {
00037 return _pmts.begin();
00038 }
00039
00040 vector<GainVoltPmtParameters*>::iterator GainVoltCoeffCalculator::end()
00041 {
00042 return _pmts.end();
00043 }
00044
00045 vector<GainVoltPmtParameters*>::const_iterator GainVoltCoeffCalculator::begin() const
00046 {
00047 return _pmts.begin();
00048 }
00049
00050 vector<GainVoltPmtParameters*>::const_iterator GainVoltCoeffCalculator::end() const
00051 {
00052 return _pmts.end();
00053 }
00054
00055
00056 void GainVoltCoeffCalculator::process()
00057 {
00058 setIoMode(3);
00059 try
00060 {
00061
00062 GVP_iterator i;
00063
00064 for (i=_pmts.begin();i!=_pmts.end();i++)
00065 {
00066 (*i)->fit();
00067
00068 }
00069 }
00070 catch (runtime_error & err)
00071 {
00072 cout << "GainVoltCoeffCalculator::process() - RunTimeError -"<< err.what() << endl;
00073 }
00074 }
00075
00077 istream& operator>>(istream& is, GainVoltCoeffCalculator& object)
00078 {
00079 int n;
00080 is >> n;
00081 if (n<=0)
00082 {
00083 cout << "GainVoltCoeffCalculator::operator>>() - FATAL - nPmt<=0";
00084 return is;
00085 }
00086 GainVoltPmtParameters * pmt;
00087
00088
00089 for (int i=0;i<n;i++)
00090 {
00091 pmt = new GainVoltPmtParameters();
00092 is >> *pmt;
00093 object._pmts.push_back(pmt);
00094
00095 }
00096 return is;
00097 }
00098
00099 ostream& operator<<(ostream& os, GainVoltCoeffCalculator& object)
00100 {
00101 vector<GainVoltPmtParameters*>::iterator i;
00102 for (i=object._pmts.begin();i!=object._pmts.end();i++)
00103 os << *(*i);
00104 return os;
00105 }
00106