42 #include "SystemOfUnits.h"
43 #include "StTpcDbElectronics.hh"
45 #include "StTpcDb/StTpcDb.h"
47 #ifndef ST_NO_EXCEPTIONS
49 # if !defined(ST_NO_NAMESPACES)
50 using std::invalid_argument;
56 StTpcDbElectronics::StTpcDbElectronics() { }
58 StTpcDbElectronics::StTpcDbElectronics(
StTpcDb* globalDbPointer)
60 gTpcDbPtr = globalDbPointer;
61 mNominalGain = gTpcDbPtr->Electronics()->nominalGain();
62 mSamplingFrequency = gTpcDbPtr->Electronics()->samplingFrequency();
63 mTZero = gTpcDbPtr->Electronics()->tZero();
64 mAdcConversion = gTpcDbPtr->Electronics()->adcConversion();
65 mAdcConversionCharge = gTpcDbPtr->Electronics()->adcCharge();
66 mNumberOfTimeBins = gTpcDbPtr->Electronics()->numberOfTimeBins();
67 mAveragePedestal =
static_cast<int>(gTpcDbPtr->Electronics()->averagePedestal());
68 mShapingTime = gTpcDbPtr->Electronics()->shapingTime();
69 mTau = gTpcDbPtr->Electronics()->tau();
71 #ifndef ST_NO_NAMESPACES
72 using namespace units;
76 mNominalGain *= (millivolt)/(coulomb*1.e-15);
77 mSamplingFrequency *= MHz;
78 mTZero *= microsecond;
79 mAdcConversion *= (millivolt);
80 mAdcConversionCharge *= (coulomb*1.e-15);
81 mShapingTime *= nanosecond;
86 StTpcDbElectronics::instance()
89 #ifndef ST_NO_EXCEPTIONS
90 throw invalid_argument(
"StTpcDbElectronics::getInstance(): Argument Missing!");
92 std::cerr <<
"StTpcDbElectronics::getInstance(): Argument Missing!" << endl;
93 std::cerr <<
"No arguments for instantiantion" << endl;
94 std::cerr <<
"Exiting..." << endl;
101 StTpcDbElectronics::instance(
StTpcDb* gTpcDbPtr)
107 std::cerr <<
"StTpcDbElectronics::instance()" << endl;
108 std::cerr <<
"\tWARNING:" << endl;
109 std::cerr <<
"\tSingleton class is already instantiated" << endl;
110 std::cerr <<
"\tArgument ignored!!" << endl;
111 std::cerr <<
"\tContinuing..." << endl;
116 double StTpcDbElectronics::channelGain(
int sector,
int row,
int pad)
const
126 return channelGain(coord.sector(), coord.row(), (Int_t) coord.pad());
129 int StTpcDbElectronics::pedestal(
int sector,
int row,
int pad,
int timeB)
const
131 return averagePedestal();
136 return pedestal(coord.sector(), coord.row(), (Int_t) coord.pad(), (Int_t) coord.timeBucket());
138 double StTpcDbElectronics::tZero(
int sector,
int row,
int pad)
const
140 return gTpcDbPtr->tpcT0()->T0(sector,row,pad);
144 return tZero(coord.sector(), coord.row(), (Int_t) coord.pad());
146 void StTpcDbElectronics::print(ostream& os)
const
148 #ifndef ST_NO_NAMESPACES
149 using namespace units;
151 os <<
"Electronics Data Base Parameters" << endl;
152 os <<
"=======================================" << endl;
153 os <<
"Analog:" << endl;
154 os <<
"nominalGain: " << mNominalGain/((volt*.001)/(coulomb*1.e-15)) <<
" mV/fC" << endl;
155 os <<
"samplingFrequency: " << mSamplingFrequency/MHz <<
" MHz" << endl;
156 os <<
"tZero: " << mTZero/microsecond <<
" us" << endl;
157 os <<
"shapingTime: " << mShapingTime/nanosecond <<
" ns" << endl;
158 os <<
"shapingTime2: " << mTau/nanosecond <<
" ns" << endl;
160 os <<
"\nDigital:" << endl;
161 os <<
"adcConversion: " << mAdcConversion/(volt*.001) <<
" mV/channel" << endl;
162 os <<
"adcConversionCharge: " << mAdcConversionCharge/(coulomb*1.e-15) <<
" mV/fC" << endl;
163 os <<
"numberOfTimeBins: " << mNumberOfTimeBins << endl;
164 os <<
"averagePedestal: " << mAveragePedestal <<
" channels" << endl;