7 : preampOutputCut_(-1.0e100),
12 integrateToGetCharge_(
false),
16 const unsigned chargeNode,
17 const bool interpolateCubic,
18 const double preampOutputCut,
19 const double inputGain,
20 const double outputGain)
22 preampOutputCut_(preampOutputCut),
23 inputGain_(inputGain),
24 outputGain_(outputGain),
26 chargeNode_(chargeNode),
27 useCubic_(interpolateCubic) {
29 throw cms::Exception(
"In QIE8Simulator constructor: invalid charge collection node");
36 const double dt,
const double tstop,
const double tDigitize,
double* TS,
const unsigned lenTS) {
38 throw cms::Exception(
"In QIE8Simulator::run: preamp model is not set");
45 throw cms::Exception(
"In QIE8Simulator::run: invalid stopping time");
47 if (lenTS && tDigitize < 0.0)
48 throw cms::Exception(
"In QIE8Simulator::run: can't digitize at t < 0");
51 const double dsteps = tstop /
dt;
53 if (dsteps != static_cast<double>(
n))
70 "In QIE8Simulator::run: " 71 "invalid mode of operation");
72 const unsigned runLen =
n + 1
U;
92 for (
unsigned its = 0; its < lenTS; ++its) {
93 const double t0 = tDigitize + its * tsWidth;
95 double t1 =
t0 + tsWidth;
113 throw cms::Exception(
"In QIE8Simulator::preampOutput: please run the simulation first");
123 throw cms::Exception(
"In QIE8Simulator::controlOutput: please run the simulation first");
133 throw cms::Exception(
"In QIE8Simulator::preampPeakTime: please run the simulation first");
136 throw cms::Exception(
"In QIE8Simulator::preampPeakTime: no preamp node in the circuit");
144 "In QIE8Simulator::setInitialConditions: unexpected number " 145 "of initial conditions");
149 for (
unsigned i = 0;
i < sz; ++
i)
155 const unsigned chargeNode,
156 const bool useCubicInterpolation) {
158 throw cms::Exception(
"In QIE8Simulator::setRHS invalid charge collection node");
172 for (
unsigned i = 0;
i < sz; ++
i)
179 throw cms::Exception(
"In QIE8Simulator::validateGain: invalid input gain");
184 throw cms::Exception(
"In QIE8Simulator::lastStopTime: please run the simulation first");
191 "In QIE8Simulator::totalIntegratedCharge: " 192 "please run the simulation first");
const AbsElectronicODERHS & getRHS() const
static const unsigned invalidNode
virtual unsigned numberOfNodes() const =0
std::vector< double > initialConditions_
bool integrateToGetCharge_
virtual unsigned outputNode() const =0
double getPeakTime(unsigned which) const
double interpolateCoordinate(unsigned which, double t, bool cubic=false) const
double totalIntegratedCharge(double t) const
static double adcTSWidth()
std::vector< double > historyBuffer_
void setInitialConditions(const double *values, const unsigned len)
void setRHS(const AbsODERHS &rhs)
virtual void calc(double t, const double *x, unsigned lenX, double *derivative)=0
void setRHS(const AbsElectronicODERHS &rhs, unsigned chargeNode, bool interpolateCubic=false)
AbsElectronicODERHS & modifiableRHS()
double controlOutput(double t) const
double preampOutput(double t) const
double lastStopTime() const
void run(const double *initialConditions, unsigned lenConditions, double dt, unsigned nSteps)
double preampPeakTime() const
double getCharge(const double t) const
void validateGain() const
void truncateCoordinate(unsigned which, double minValue, double maxValue)
unsigned run(double dt, double tstop, double tDigitize, double *TS, unsigned lenTS)
virtual unsigned controlNode() const
void zeroInitialConditions()
void setHistory(double dt, const double *data, unsigned dim, unsigned runLen)
static const unsigned maxlen