1 #ifndef CalibCalorimetry_HcalAlgos_DoublePadeDelay_h_
2 #define CalibCalorimetry_HcalAlgos_DoublePadeDelay_h_
16 template<
class ODE1,
class ODE2,
class DelayTimeModel1,
class DelayTimeModel2>
21 const unsigned padeRow2,
const unsigned padeColumn2)
22 :
ode1_(padeRow1, padeColumn1),
ode2_(padeRow2, padeColumn2)
28 const unsigned padeRow2,
const unsigned padeColumn2,
31 ode1_(padeRow1, padeColumn1),
32 ode2_(padeRow2, padeColumn2)
40 inline virtual void calc(
const double t,
41 const double*
x,
const unsigned lenX,
45 "In DoublePadeDelay::calc: timing and/or ODE parameters not set");
54 const unsigned npTau1 =
tau1_.nParameters();
55 const unsigned npOde1 =
ode1_.nParameters();
56 const unsigned npTau2 =
tau2_.nParameters();
57 const unsigned npOde2 =
ode2_.nParameters();
63 const double* pstart = &
params_[npTau1 + npOde1 + npTau2 + npOde2];
64 const double* pars = pstart;
65 const double ctlGainOut = *pars++;
66 const double inGainOut = *pars++;
67 const double outGainOut = *pars++;
77 unsigned firstPar = npTau1 + npOde1;
78 const double tau2 =
tau2_(currentIn, &
params_[firstPar], npTau2);
91 control = x[ctrlNode];
92 ode2_.calculate(tau2, currentIn, dIdt, d2Id2t,
93 x, lenX, ctrlNode, derivative);
99 ode2_.calculate(tau2, currentIn, dIdt, d2Id2t,
100 0, 0U, 0U, &control);
104 const double vtau = ctlGainOut*control +
105 inGainOut*currentIn +
106 outGainOut*currentOut;
114 ode1_.calculate(tau, currentIn, dIdt, d2Id2t, x, lenX, 0U, derivative);
118 {
return ode1_.getPadeColumn() +
ode2_.getPadeColumn();}
122 const unsigned npTau1 =
tau1_.nParameters();
123 const unsigned npOde1 =
ode1_.nParameters();
124 const unsigned npTau2 =
tau2_.nParameters();
125 const unsigned npOde2 =
ode2_.nParameters();
135 if (
ode2_.getPadeColumn())
137 return ode1_.getPadeColumn();
158 "In DoublePadeDelay::validate: the output "
159 "circuit must be modeled by an ODE");
168 #endif // CalibCalorimetry_HcalAlgos_DoublePadeDelay_h_
unsigned nParameters() const
DoublePadeDelay(const unsigned padeRow1, const unsigned padeColumn1, const unsigned padeRow2, const unsigned padeColumn2, const HcalInterpolatedPulse &pulse)
static const unsigned invalidNode
Derivative< X, A >::type derivative(const A &_)
std::vector< double > params_
unsigned numberOfNodes() const
double secondDerivative(const double t) const
unsigned controlNode() const
DoublePadeDelay(const unsigned padeRow1, const unsigned padeColumn1, const unsigned padeRow2, const unsigned padeColumn2)
unsigned outputNode() const
static const unsigned thisCodeNumPars
HcalInterpolatedPulse inputPulse_
bool allParametersSet() const
virtual void calc(const double t, const double *x, const unsigned lenX, double *derivative)
virtual DoublePadeDelay * clone() const
double derivative(const double t) const