CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 > Class Template Reference

#include <DoublePadeDelay.h>

Inheritance diagram for DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >:
AbsElectronicODERHS AbsODERHS

Public Member Functions

virtual void calc (const double t, const double *x, const unsigned lenX, double *derivative)
 
virtual DoublePadeDelayclone () const
 
unsigned controlNode () const
 
 DoublePadeDelay (const unsigned padeRow1, const unsigned padeColumn1, const unsigned padeRow2, const unsigned padeColumn2)
 
 DoublePadeDelay (const unsigned padeRow1, const unsigned padeColumn1, const unsigned padeRow2, const unsigned padeColumn2, const HcalInterpolatedPulse &pulse)
 
unsigned nParameters () const
 
unsigned numberOfNodes () const
 
unsigned outputNode () const
 
- Public Member Functions inherited from AbsElectronicODERHS
 AbsElectronicODERHS ()
 
 AbsElectronicODERHS (const HcalInterpolatedPulse &pulse)
 
bool allParametersSet () const
 
const std::vector< double > & getAllParameters () const
 
double getParameter (const unsigned which) const
 
HcalInterpolatedPulseinputPulse ()
 
const HcalInterpolatedPulseinputPulse () const
 
template<class Pulse >
void setInputPulse (const Pulse &pulse)
 
void setLeadingParameters (const double *values, const unsigned len)
 
void setLeadingParameters (const std::vector< double > &values)
 
void setParameter (const unsigned which, const double value)
 
 ~AbsElectronicODERHS () override
 
- Public Member Functions inherited from AbsODERHS
virtual ~AbsODERHS ()
 

Private Member Functions

void validate () const
 

Private Attributes

ODE1 ode1_
 
ODE2 ode2_
 
DelayTimeModel1 tau1_
 
DelayTimeModel2 tau2_
 

Static Private Attributes

static const unsigned thisCodeNumPars = 3U
 

Additional Inherited Members

- Static Public Attributes inherited from AbsElectronicODERHS
static const unsigned invalidNode = UINT_MAX - 1U
 
- Protected Attributes inherited from AbsElectronicODERHS
HcalInterpolatedPulse inputPulse_
 
std::vector< double > params_
 

Detailed Description

template<class ODE1, class ODE2, class DelayTimeModel1, class DelayTimeModel2>
class DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >

Definition at line 17 of file DoublePadeDelay.h.

Constructor & Destructor Documentation

◆ DoublePadeDelay() [1/2]

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::DoublePadeDelay ( const unsigned  padeRow1,
const unsigned  padeColumn1,
const unsigned  padeRow2,
const unsigned  padeColumn2 
)
inline

Definition at line 20 of file DoublePadeDelay.h.

22  : ode1_(padeRow1, padeColumn1), ode2_(padeRow2, padeColumn2)
23  {
24  validate();
25  }

References DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::validate().

Referenced by DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::clone().

◆ DoublePadeDelay() [2/2]

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::DoublePadeDelay ( const unsigned  padeRow1,
const unsigned  padeColumn1,
const unsigned  padeRow2,
const unsigned  padeColumn2,
const HcalInterpolatedPulse pulse 
)
inline

Definition at line 27 of file DoublePadeDelay.h.

31  ode1_(padeRow1, padeColumn1),
32  ode2_(padeRow2, padeColumn2)
33  {
34  validate();
35  }

References DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::validate().

Member Function Documentation

◆ calc()

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
virtual void DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::calc ( const double  t,
const double *  x,
const unsigned  lenX,
double *  derivative 
)
inlinevirtual

Implements AbsODERHS.

Definition at line 40 of file DoublePadeDelay.h.

43  {
44  if (!allParametersSet()) throw cms::Exception(
45  "In DoublePadeDelay::calc: timing and/or ODE parameters not set");
46 
47  // The input signal
48  const double currentIn = inputPulse_(t);
49 
50  // The output signal
51  const double currentOut = x[outputNode()];
52 
53  // Numbers of parameters used by the member objects
54  const unsigned npTau1 = tau1_.nParameters();
55  const unsigned npOde1 = ode1_.nParameters();
56  const unsigned npTau2 = tau2_.nParameters();
57  const unsigned npOde2 = ode2_.nParameters();
58 
59  // Parameters for this code.
60  // Order of parameters in the overall parameter set is:
61  // parameters for tau1, then for ode1, then tau2, then ode2,
62  // then parameters of this code.
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++;
68  assert(thisCodeNumPars == static_cast<unsigned>(pars - pstart));
69 
70  // Save a little bit of time by not calculating the input
71  // signal derivatives in case they will not be needed
72  const unsigned row = std::max(ode1_.getPadeRow(), ode2_.getPadeRow());
73  const double dIdt = row ? inputPulse_.derivative(t) : 0.0;
74  const double d2Id2t = row > 1U ? inputPulse_.secondDerivative(t) : 0.0;
75 
76  // Set the timing parameters of the control circuit
77  unsigned firstPar = npTau1 + npOde1;
78  const double tau2 = tau2_(currentIn, &params_[firstPar], npTau2);
79 
80  // Set the ODE parameters for the control circuit
81  firstPar += npTau2;
82  if (npOde2)
83  ode2_.setParameters(&params_[firstPar], npOde2);
84 
85  // Run the control circuit
86  const unsigned ctrlNode = controlNode();
87  double control;
88  if (ctrlNode < AbsElectronicODERHS::invalidNode)
89  {
90  // The control circuit solves an ODE
91  control = x[ctrlNode];
92  ode2_.calculate(tau2, currentIn, dIdt, d2Id2t,
93  x, lenX, ctrlNode, derivative);
94  }
95  else
96  {
97  // The control circuit does not solve an ODE.
98  // Instead, it drives its output directly.
99  ode2_.calculate(tau2, currentIn, dIdt, d2Id2t,
100  0, 0U, 0U, &control);
101  }
102 
103  // Timing parameter for the output circuit (the preamp)
104  const double vtau = ctlGainOut*control +
105  inGainOut*currentIn +
106  outGainOut*currentOut;
107  const double tau = tau1_(vtau, &params_[0], npTau1);
108 
109  // ODE parameters for the output circuit
110  if (npOde1)
111  ode1_.setParameters(&params_[npTau1], npOde1);
112 
113  // Run the output circuit
114  ode1_.calculate(tau, currentIn, dIdt, d2Id2t, x, lenX, 0U, derivative);
115  }

References AbsElectronicODERHS::allParametersSet(), cms::cuda::assert(), DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::controlNode(), funct::derivative(), InterpolatedPulse< MaxLen >::derivative(), Exception, AbsElectronicODERHS::inputPulse_, AbsElectronicODERHS::invalidNode, SiStripPI::max, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::ode1_, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::ode2_, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::outputNode(), AbsElectronicODERHS::params_, InterpolatedPulse< MaxLen >::secondDerivative(), submitPVValidationJobs::t, metsig::tau, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::tau1_, jets_cff::tau2, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::tau2_, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::thisCodeNumPars, mitigatedMETSequence_cff::U, and x.

◆ clone()

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
virtual DoublePadeDelay* DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::clone ( void  ) const
inlinevirtual

Implements AbsODERHS.

Definition at line 37 of file DoublePadeDelay.h.

38  {return new DoublePadeDelay(*this);}

References DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::DoublePadeDelay().

◆ controlNode()

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
unsigned DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::controlNode ( ) const
inlinevirtual

Reimplemented from AbsElectronicODERHS.

Definition at line 133 of file DoublePadeDelay.h.

134  {
135  if (ode2_.getPadeColumn())
136  // ode2 has a real output node
137  return ode1_.getPadeColumn();
138  else
139  // ode2 does not have a real output node
141  }

References AbsElectronicODERHS::invalidNode, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::ode1_, and DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::ode2_.

Referenced by DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::calc().

◆ nParameters()

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
unsigned DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::nParameters ( ) const
inlinevirtual

Implements AbsElectronicODERHS.

Definition at line 120 of file DoublePadeDelay.h.

121  {
122  const unsigned npTau1 = tau1_.nParameters();
123  const unsigned npOde1 = ode1_.nParameters();
124  const unsigned npTau2 = tau2_.nParameters();
125  const unsigned npOde2 = ode2_.nParameters();
126  return npTau1 + npOde1 + npTau2 + npOde2 + thisCodeNumPars;
127  }

References DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::ode1_, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::ode2_, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::tau1_, DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::tau2_, and DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::thisCodeNumPars.

◆ numberOfNodes()

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
unsigned DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::numberOfNodes ( ) const
inlinevirtual

◆ outputNode()

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
unsigned DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::outputNode ( ) const
inlinevirtual

◆ validate()

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
void DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::validate ( ) const
inlineprivate

Definition at line 146 of file DoublePadeDelay.h.

147  {
148  // Basically, we need to avoid the situation in which
149  // we need to solve the differential equation for the control
150  // circuit but do not need to solve the differential equation
151  // for the preamp. It this case we will not have a good way
152  // to pass the preamp output to the simulator. The simplest
153  // way to ensure correctness of the whole procedure is to require
154  // that the preamp must always be modeled by an ODE. Indeed,
155  // one will almost surely need to represent it by at least
156  // a low-pass filter.
157  if (!ode1_.getPadeColumn()) throw cms::Exception(
158  "In DoublePadeDelay::validate: the output "
159  "circuit must be modeled by an ODE");
160  }

References DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::ode1_.

Referenced by DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::DoublePadeDelay().

Member Data Documentation

◆ ode1_

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
ODE1 DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::ode1_
private

◆ ode2_

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
ODE2 DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::ode2_
private

◆ tau1_

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
DelayTimeModel1 DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::tau1_
private

◆ tau2_

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
DelayTimeModel2 DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::tau2_
private

◆ thisCodeNumPars

template<class ODE1 , class ODE2 , class DelayTimeModel1 , class DelayTimeModel2 >
const unsigned DoublePadeDelay< ODE1, ODE2, DelayTimeModel1, DelayTimeModel2 >::thisCodeNumPars = 3U
staticprivate
DoublePadeDelay::validate
void validate() const
Definition: DoublePadeDelay.h:146
metsig::tau
Definition: SignAlgoResolutions.h:49
AbsElectronicODERHS::AbsElectronicODERHS
AbsElectronicODERHS()
Definition: AbsElectronicODERHS.h:20
pulse
double pulse(double x, double y, double z, double t)
Definition: SiStripPulseShape.cc:49
DoublePadeDelay::tau1_
DelayTimeModel1 tau1_
Definition: DoublePadeDelay.h:164
cms::cuda::assert
assert(be >=bs)
funct::derivative
Derivative< X, A >::type derivative(const A &_)
Definition: Derivative.h:18
DDAxes::x
DoublePadeDelay::ode2_
ODE2 ode2_
Definition: DoublePadeDelay.h:163
AbsElectronicODERHS::params_
std::vector< double > params_
Definition: AbsElectronicODERHS.h:114
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
DoublePadeDelay::ode1_
ODE1 ode1_
Definition: DoublePadeDelay.h:162
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
InterpolatedPulse::secondDerivative
double secondDerivative(const double t) const
Definition: InterpolatedPulse.h:174
AbsElectronicODERHS::allParametersSet
bool allParametersSet() const
Definition: AbsElectronicODERHS.h:52
InterpolatedPulse::derivative
double derivative(const double t) const
Definition: InterpolatedPulse.h:147
DoublePadeDelay::tau2_
DelayTimeModel2 tau2_
Definition: DoublePadeDelay.h:165
Exception
Definition: hltDiff.cc:246
DoublePadeDelay::outputNode
unsigned outputNode() const
Definition: DoublePadeDelay.h:129
jets_cff.tau2
tau2
Definition: jets_cff.py:428
DoublePadeDelay::thisCodeNumPars
static const unsigned thisCodeNumPars
Definition: DoublePadeDelay.h:144
AbsElectronicODERHS::inputPulse_
HcalInterpolatedPulse inputPulse_
Definition: AbsElectronicODERHS.h:113
cms::Exception
Definition: Exception.h:70
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
DoublePadeDelay::DoublePadeDelay
DoublePadeDelay(const unsigned padeRow1, const unsigned padeColumn1, const unsigned padeRow2, const unsigned padeColumn2)
Definition: DoublePadeDelay.h:20
AbsElectronicODERHS::invalidNode
static const unsigned invalidNode
Definition: AbsElectronicODERHS.h:18
DoublePadeDelay::controlNode
unsigned controlNode() const
Definition: DoublePadeDelay.h:133