7 : preampOutputCut_(-1.0e100), inputGain_(1.0),
8 outputGain_(1.0), runCount_(0),
10 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)
31 "In QIE8Simulator constructor: invalid charge collection node");
38 const double tDigitize,
39 double* TS,
const unsigned lenTS)
43 "In QIE8Simulator::run: preamp model is not set");
47 "In QIE8Simulator::run: invalid time step");
50 "In QIE8Simulator::run: invalid stopping time");
53 "In QIE8Simulator::run: can't digitize at t < 0");
56 const double dsteps = tstop/
dt;
58 if (dsteps != static_cast<double>(n))
78 "invalid mode of operation");
79 const unsigned runLen = n + 1U;
83 for (
unsigned istep=0; istep<runLen; ++istep, ++hbuf)
84 rhs.
calc(istep*dt, 0, 0U, hbuf);
100 for (
unsigned its=0; its<lenTS; ++its)
102 const double t0 = tDigitize + its*tsWidth;
105 double t1 = t0 + tsWidth;
125 "In QIE8Simulator::preampOutput: please run the simulation first");
137 "In QIE8Simulator::controlOutput: please run the simulation first");
148 "In QIE8Simulator::preampPeakTime: please run the simulation first");
151 "In QIE8Simulator::preampPeakTime: no preamp node in the circuit");
156 const double*
values,
const unsigned sz)
160 "In QIE8Simulator::setInitialConditions: unexpected number "
161 "of initial conditions");
166 for (
unsigned i=0;
i<sz; ++
i)
172 const unsigned chargeNode,
173 const bool useCubicInterpolation)
177 "In QIE8Simulator::setRHS invalid charge collection node");
193 for (
unsigned i=0;
i<sz; ++
i)
201 "In QIE8Simulator::validateGain: invalid input gain");
207 "In QIE8Simulator::lastStopTime: please run the simulation first");
214 "In QIE8Simulator::totalIntegratedCharge: "
215 "please run the simulation first");
double preampPeakTime() const
static const unsigned invalidNode
virtual unsigned numberOfNodes() const =0
std::vector< double > initialConditions_
double totalIntegratedCharge(double t) const
bool integrateToGetCharge_
virtual unsigned outputNode() const =0
double lastStopTime() const
static double adcTSWidth()
std::vector< double > historyBuffer_
void setInitialConditions(const double *values, const unsigned len)
int solver_(double *obj, double *rhs, double *lbound, double *ubound, double *diag, double *odiag, double *xs, double *dxs, double *dxsn, double *up, double *dspr, double *ddspr, double *ddsprn, double *dsup, double *ddsup, double *ddsupn, double *dv, double *ddv, double *ddvn, double *prinf, double *upinf, double *duinf, double *scale, double *nonzeros, int *vartyp, int *slktyp, int *colpnt, int *ecolpnt, int *count, int *vcstat, int *pivots, int *invprm, int *snhead, int *nodtyp, int *inta1, int *prehis, int *rowidx, int *rindex, int *code, double *opt, int *iter, int *corect, int *fixn, int *dropn, int *fnzmax, int *fnzmin, double *addobj, double *bigbou, double *big, int *ft)
double getPeakTime(unsigned which) const
virtual unsigned controlNode() const
const AbsElectronicODERHS & getRHS() const
void validateGain() const
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 getCharge(const double t) const
double interpolateCoordinate(unsigned which, double t, bool cubic=false) const
void run(const double *initialConditions, unsigned lenConditions, double dt, unsigned nSteps)
double preampOutput(double t) const
void truncateCoordinate(unsigned which, double minValue, double maxValue)
unsigned run(double dt, double tstop, double tDigitize, double *TS, unsigned lenTS)
volatile std::atomic< bool > shutdown_flag false
void zeroInitialConditions()
void setHistory(double dt, const double *data, unsigned dim, unsigned runLen)
static const unsigned maxlen
double controlOutput(double t) const