1 #include "VoltCalibrator.h"
33 #include "GainVoltCoeffCalculator.h"
34 #include "PmtIdentifier.h"
35 #include "GainVoltPmtParameters.h"
41 VoltCalibrator::~VoltCalibrator()
44 void VoltCalibrator::setRefFile(
const char * name)
49 void VoltCalibrator::setGainFile(
const char *name)
54 void VoltCalibrator::setVoltInputFile(
const char *name)
59 void VoltCalibrator::setVoltOutputFile(
const char *name)
64 void VoltCalibrator::process()
76 coeff.open(
"hvGainCoeff.dat");
89 double g,v,newV,cGain;
95 mygain[pmtId._softId-1]=g;
99 while(!currentVolt.eof())
101 currentVolt >> pmtIdCurrent >> v;
102 long soft = pmtIdCurrent._softId;
103 long serial = pmtIdCurrent._serial;
105 if(g==0 || g==1) newV = v;
108 vector<GainVoltPmtParameters*>::iterator i;
109 for (i=calculator.begin();i!=calculator.end();i++)
112 if(identifier._serial==serial)
114 cout <<
"PMT found in DB | ";
115 cGain = (*i)->getGain(v);
116 newV = (*i)->getVoltage(g*cGain);
122 cGain = exp(A+B*log(v));
123 newV = exp(log(cGain*g)/B-A);
124 cout <<
"PMT is not in DB | ";
127 cout <<
"id = "<<soft<<
" pmtId = "<<pmtIdCurrent<<
" V = "<<v<<
" cGain = "<<cGain<<
" newV = "<<newV<<
" corr = "<<g<<endl;
128 newVolt<<pmtIdCurrent<<
"\t"<<newV<<endl;
148 gain.open(
"gainTemplate.dat");
149 volt.open(
"hvTemplate.dat");
153 vector<GainVoltPmtParameters*>::iterator i;
154 for (i=calculator.begin();i!=calculator.end();i++)
156 cout << (*i)->getPmtIdentifier() <<
"\t" << 1 << endl;
157 gain << (*i)->getPmtIdentifier() <<
"\t" << 1 << endl;
158 volt << (*i)->getPmtIdentifier() <<
"\t" << 777 << endl;
const char * currentVoltFile
Current Voltage Setting File.
const char * refFile
Reference Gain/Volt File.
const char * gainFile
Requested Relative Gain Change File.
const char * newVoltFile
New Voltage Setting File.