52 #include "SystemOfUnits.h"
53 #include "StTpcSimpleElectronics.hh"
54 #include "StGetConfigValue.hh"
55 #ifndef ST_NO_EXCEPTIONS
57 # if !defined(ST_NO_NAMESPACES)
58 using std::invalid_argument;
64 StTpcSimpleElectronics::StTpcSimpleElectronics() { }
66 StTpcSimpleElectronics::StTpcSimpleElectronics(
const char* file)
68 StGetConfigValue(file,
"nominalGain",mNominalGain);
69 StGetConfigValue(file,
"samplingFrequency",mSamplingFrequency);
70 StGetConfigValue(file,
"tZero",mTZero);
71 StGetConfigValue(file,
"adcConversion",mAdcConversion);
72 StGetConfigValue(file,
"adcCharge",mAdcConversionCharge);
73 StGetConfigValue(file,
"numberOfTimeBins",mNumberOfTimeBins);
74 StGetConfigValue(file,
"averagePedestal",mAveragePedestal);
75 StGetConfigValue(file,
"shapingTime",mShapingTime);
76 StGetConfigValue(file,
"tau",mTau);
78 #ifndef ST_NO_NAMESPACES
79 using namespace units;
83 mNominalGain *= ((volt*.001)/(coulomb*1.e-15));
84 mSamplingFrequency *= MHz;
85 mTZero *= microsecond;
86 mAdcConversion *= (volt*.001);
87 mAdcConversionCharge *= (coulomb*1.e-15);
88 mShapingTime *= nanosecond;
93 StTpcSimpleElectronics::instance()
96 #ifndef ST_NO_EXCEPTIONS
97 throw invalid_argument(
"StTpcSimpleElectronics::getInstance(): Argument Missing!");
99 std::cerr <<
"StTpcSimpleElectronics::getInstance(): Argument Missing!" << endl;
100 std::cerr <<
"No arguments for instantiantion" << endl;
101 std::cerr <<
"Aborting..." << endl;
109 StTpcSimpleElectronics::instance(
const char* file)
115 std::cerr <<
"StTpcSimpleElectronics::instance()" << endl;
116 std::cerr <<
"\tWARNING:" << endl;
117 std::cerr <<
"\tSingleton class is already instantiated" << endl;
118 std::cerr <<
"\tArgument \"" << file <<
"\" ignored!!" << endl;
119 std::cerr <<
"\tContinuing..." << endl;
124 double StTpcSimpleElectronics::channelGain(
int sector,
int row,
int pad)
const
127 return nominalGain();
132 return channelGain(coord.sector(), coord.row(), coord.pad());
135 int StTpcSimpleElectronics::pedestal(
int sector,
int row,
int pad,
int timeB)
const
137 return averagePedestal();
142 return pedestal(coord.sector(), coord.row(), coord.pad(), coord.timeBucket());
145 void StTpcSimpleElectronics::print(ostream& os)
const
147 #ifndef ST_NO_NAMESPACES
148 using namespace units;
150 os <<
"Simple Electronics Data Base Parameters" << endl;
151 os <<
"=======================================" << endl;
152 os <<
"Analog:" << endl;
153 os <<
"nominalGain: " << mNominalGain/((volt*.001)/(coulomb*1.e-15)) <<
" mV/fC" << endl;
154 os <<
"samplingFrequency: " << mSamplingFrequency/MHz <<
" MHz" << endl;
155 os <<
"tZero: " << mTZero/microsecond <<
" us" << endl;
156 os <<
"shapingTime: " << mShapingTime/nanosecond <<
" ns" << endl;
157 os <<
"shapingTime2: " << mTau/nanosecond <<
" ns" << endl;
159 os <<
"\nDigital:" << endl;
160 os <<
"adcConversion: " << mAdcConversion/(volt*.001) <<
" mV/channel" << endl;
161 os <<
"adcConversionCharge: " << mAdcConversionCharge/(coulomb*1.e-15) <<
" mV/fC" << endl;
162 os <<
"numberOfTimeBins: " << mNumberOfTimeBins << endl;
163 os <<
"averagePedestal: " << mAveragePedestal <<
" channels" << endl;