CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
QIE8Simulator Class Reference

#include <QIE8Simulator.h>

Public Member Functions

double controlOutput (double t) const
 
double getInputAmplitude () const
 
double getInputGain () const
 
double getInputIntegral () const
 
const HcalInterpolatedPulsegetInputSignal () const
 
double getInputStartTime () const
 
double getOutputGain () const
 
double getParameter (const unsigned which) const
 
double getPreampOutputCut () const
 
const AbsElectronicODERHSgetRHS () const
 
unsigned long getRunCount () const
 
double lastStopTime () const
 
unsigned nParameters () const
 
double preampOutput (double t) const
 
double preampPeakTime () const
 
 QIE8Simulator ()
 
 QIE8Simulator (const AbsElectronicODERHS &model, unsigned chargeNode, bool interpolateCubic=false, double preampOutputCut=-1.0e100, double inputGain=1.0, double outputGain=1.0)
 
unsigned run (double dt, double tstop, double tDigitize, double *TS, unsigned lenTS)
 
void scaleInputSignal (const double s)
 
void setInitialConditions (const double *values, const unsigned len)
 
void setInputAmplitude (const double a)
 
void setInputGain (const double g)
 
void setInputIntegral (const double d)
 
template<class Real >
void setInputShape (const Real *values, const unsigned len)
 
template<class Signal >
void setInputSignal (const Signal &inputSignal)
 
void setInputStartTime (const double newStartTime)
 
void setLeadingParameters (const double *values, const unsigned len)
 
void setOutputGain (const double g)
 
void setParameter (const unsigned which, const double p)
 
void setPreampOutputCut (const double p)
 
void setRHS (const AbsElectronicODERHS &rhs, unsigned chargeNode, bool interpolateCubic=false)
 
double totalIntegratedCharge (double t) const
 
void zeroInitialConditions ()
 

Static Public Member Functions

static double adcTSWidth ()
 

Static Public Attributes

static const unsigned maxlen = HcalInterpolatedPulse::maxlen
 

Private Member Functions

double getCharge (const double t) const
 
AbsElectronicODERHSmodifiableRHS ()
 
void validateGain () const
 

Private Attributes

unsigned chargeNode_
 
std::vector< double > historyBuffer_
 
std::vector< double > initialConditions_
 
double inputGain_
 
bool integrateToGetCharge_
 
double outputGain_
 
double preampOutputCut_
 
unsigned long runCount_
 
RK4 solver_
 
bool useCubic_
 

Detailed Description

Definition at line 11 of file QIE8Simulator.h.

Constructor & Destructor Documentation

QIE8Simulator::QIE8Simulator ( )

Definition at line 6 of file QIE8Simulator.cc.

7  : preampOutputCut_(-1.0e100),
8  inputGain_(1.0),
9  outputGain_(1.0),
10  runCount_(0),
12  integrateToGetCharge_(false),
13  useCubic_(false) {}
static const unsigned invalidNode
unsigned chargeNode_
double preampOutputCut_
bool integrateToGetCharge_
unsigned long runCount_
double outputGain_
QIE8Simulator::QIE8Simulator ( const AbsElectronicODERHS model,
unsigned  chargeNode,
bool  interpolateCubic = false,
double  preampOutputCut = -1.0e100,
double  inputGain = 1.0,
double  outputGain = 1.0 
)

Definition at line 15 of file QIE8Simulator.cc.

References Exception, integrateToGetCharge_, AbsElectronicODERHS::invalidNode, AbsElectronicODERHS::outputNode(), validateGain(), and zeroInitialConditions().

21  : solver_(model),
22  preampOutputCut_(preampOutputCut),
23  inputGain_(inputGain),
24  outputGain_(outputGain),
25  runCount_(0),
26  chargeNode_(chargeNode),
27  useCubic_(interpolateCubic) {
28  if (chargeNode >= AbsElectronicODERHS::invalidNode)
29  throw cms::Exception("In QIE8Simulator constructor: invalid charge collection node");
30  integrateToGetCharge_ = chargeNode == model.outputNode();
31  validateGain();
33 }
static const unsigned invalidNode
unsigned chargeNode_
double preampOutputCut_
bool integrateToGetCharge_
virtual unsigned outputNode() const =0
unsigned long runCount_
void validateGain() const
double outputGain_
void zeroInitialConditions()

Member Function Documentation

static double QIE8Simulator::adcTSWidth ( )
inlinestatic

Definition at line 135 of file QIE8Simulator.h.

Referenced by run().

135 { return 25.0; }
double QIE8Simulator::controlOutput ( double  t) const

Definition at line 121 of file QIE8Simulator.cc.

References AbsElectronicODERHS::controlNode(), Exception, getRHS(), ConstantStepOdeSolver::interpolateCoordinate(), AbsElectronicODERHS::invalidNode, runCount_, solver_, and useCubic_.

Referenced by setInputStartTime().

121  {
122  if (!runCount_)
123  throw cms::Exception("In QIE8Simulator::controlOutput: please run the simulation first");
124  const unsigned controlNode = getRHS().controlNode();
125  if (controlNode >= AbsElectronicODERHS::invalidNode)
126  return 0.0;
127  else
128  return solver_.interpolateCoordinate(controlNode, t, useCubic_);
129 }
static const unsigned invalidNode
unsigned long runCount_
virtual unsigned controlNode() const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
double interpolateCoordinate(unsigned which, double t, bool cubic=false) const
double QIE8Simulator::getCharge ( const double  t) const
inlineprivate

Definition at line 145 of file QIE8Simulator.h.

References chargeNode_, integrateToGetCharge_, ConstantStepOdeSolver::interpolateCoordinate(), ConstantStepOdeSolver::interpolateIntegrated(), data-class-funcs::q, solver_, useCubic_, and validateGain().

Referenced by run(), and totalIntegratedCharge().

145  {
146  double q;
149  else
151  return q;
152  }
unsigned chargeNode_
double interpolateIntegrated(unsigned which, double t, bool cubic=false) const
bool integrateToGetCharge_
double interpolateCoordinate(unsigned which, double t, bool cubic=false) const
double QIE8Simulator::getInputAmplitude ( ) const
inline

Definition at line 91 of file QIE8Simulator.h.

References InterpolatedPulse< MaxLen >::getPeakValue(), getRHS(), inputGain_, and AbsElectronicODERHS::inputPulse().

91 { return getRHS().inputPulse().getPeakValue() / inputGain_; }
const HcalInterpolatedPulse & inputPulse() const
double getPeakValue() const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
double QIE8Simulator::getInputGain ( ) const
inline

Definition at line 37 of file QIE8Simulator.h.

References inputGain_.

37 { return inputGain_; }
double QIE8Simulator::getInputIntegral ( ) const
inline

Definition at line 96 of file QIE8Simulator.h.

References InterpolatedPulse< MaxLen >::getIntegral(), getRHS(), inputGain_, and AbsElectronicODERHS::inputPulse().

96 { return getRHS().inputPulse().getIntegral() / inputGain_; }
double getIntegral() const
const HcalInterpolatedPulse & inputPulse() const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
const HcalInterpolatedPulse& QIE8Simulator::getInputSignal ( ) const
inline

Definition at line 77 of file QIE8Simulator.h.

References getRHS(), and AbsElectronicODERHS::inputPulse().

77 { return getRHS().inputPulse(); }
const HcalInterpolatedPulse & inputPulse() const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
double QIE8Simulator::getInputStartTime ( ) const
inline

Definition at line 101 of file QIE8Simulator.h.

References getRHS(), InterpolatedPulse< MaxLen >::getStartTime(), and AbsElectronicODERHS::inputPulse().

101 { return getRHS().inputPulse().getStartTime(); }
const HcalInterpolatedPulse & inputPulse() const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
double getStartTime() const
double QIE8Simulator::getOutputGain ( ) const
inline

Definition at line 38 of file QIE8Simulator.h.

References outputGain_.

38 { return outputGain_; }
double outputGain_
double QIE8Simulator::getParameter ( const unsigned  which) const
inline

Definition at line 44 of file QIE8Simulator.h.

References AbsElectronicODERHS::getParameter(), and getRHS().

Referenced by Mixins._Parameterizable::hasParameter().

44 { return getRHS().getParameter(which); }
double getParameter(const unsigned which) const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
def which(cmd)
Definition: eostools.py:336
double QIE8Simulator::getPreampOutputCut ( ) const
inline

Definition at line 40 of file QIE8Simulator.h.

References preampOutputCut_.

40 { return preampOutputCut_; }
double preampOutputCut_
const AbsElectronicODERHS& QIE8Simulator::getRHS ( ) const
inline

Definition at line 29 of file QIE8Simulator.h.

References Exception, ConstantStepOdeSolver::getRHS(), and solver_.

Referenced by controlOutput(), getInputAmplitude(), getInputIntegral(), getInputSignal(), getInputStartTime(), getParameter(), nParameters(), preampOutput(), preampPeakTime(), setInitialConditions(), and zeroInitialConditions().

29  {
30  const AbsODERHS* ptr = solver_.getRHS();
31  if (!ptr)
32  throw cms::Exception("In QIE8Simulator::getRHS: RHS is not set");
33  return *(static_cast<const AbsElectronicODERHS*>(ptr));
34  }
const AbsODERHS * getRHS() const
unsigned long QIE8Simulator::getRunCount ( ) const
inline

Definition at line 39 of file QIE8Simulator.h.

References runCount_.

39 { return runCount_; }
unsigned long runCount_
double QIE8Simulator::lastStopTime ( ) const

Definition at line 182 of file QIE8Simulator.cc.

References Exception, ConstantStepOdeSolver::lastMaxT(), runCount_, and solver_.

Referenced by setInputStartTime().

182  {
183  if (!runCount_)
184  throw cms::Exception("In QIE8Simulator::lastStopTime: please run the simulation first");
185  return solver_.lastMaxT();
186 }
unsigned long runCount_
AbsElectronicODERHS& QIE8Simulator::modifiableRHS ( )
inlineprivate

Definition at line 138 of file QIE8Simulator.h.

References Exception, ConstantStepOdeSolver::getRHS(), and solver_.

Referenced by run(), scaleInputSignal(), setInputAmplitude(), setInputIntegral(), setInputShape(), setInputSignal(), setInputStartTime(), setLeadingParameters(), and setParameter().

138  {
139  AbsODERHS* ptr = solver_.getRHS();
140  if (!ptr)
141  throw cms::Exception("In QIE8Simulator::modifiableRHS: no RHS");
142  return *(static_cast<AbsElectronicODERHS*>(ptr));
143  }
const AbsODERHS * getRHS() const
unsigned QIE8Simulator::nParameters ( ) const
inline

Definition at line 43 of file QIE8Simulator.h.

References getRHS(), and AbsElectronicODERHS::nParameters().

43 { return getRHS().nParameters(); }
virtual unsigned nParameters() const =0
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
double QIE8Simulator::preampOutput ( double  t) const

Definition at line 111 of file QIE8Simulator.cc.

References Exception, getRHS(), ConstantStepOdeSolver::interpolateCoordinate(), AbsElectronicODERHS::invalidNode, outputGain_, AbsElectronicODERHS::outputNode(), runCount_, solver_, and useCubic_.

Referenced by setInputStartTime().

111  {
112  if (!runCount_)
113  throw cms::Exception("In QIE8Simulator::preampOutput: please run the simulation first");
114  const unsigned preampNode = getRHS().outputNode();
115  if (preampNode >= AbsElectronicODERHS::invalidNode)
116  return 0.0;
117  else
118  return outputGain_ * solver_.interpolateCoordinate(preampNode, t, useCubic_);
119 }
static const unsigned invalidNode
virtual unsigned outputNode() const =0
unsigned long runCount_
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
double interpolateCoordinate(unsigned which, double t, bool cubic=false) const
double outputGain_
double QIE8Simulator::preampPeakTime ( ) const

Definition at line 131 of file QIE8Simulator.cc.

References Exception, ConstantStepOdeSolver::getPeakTime(), getRHS(), AbsElectronicODERHS::invalidNode, AbsElectronicODERHS::outputNode(), runCount_, and solver_.

Referenced by setInputStartTime().

131  {
132  if (!runCount_)
133  throw cms::Exception("In QIE8Simulator::preampPeakTime: please run the simulation first");
134  const unsigned preampNode = getRHS().outputNode();
135  if (preampNode >= AbsElectronicODERHS::invalidNode)
136  throw cms::Exception("In QIE8Simulator::preampPeakTime: no preamp node in the circuit");
137  return solver_.getPeakTime(preampNode);
138 }
static const unsigned invalidNode
virtual unsigned outputNode() const =0
unsigned long runCount_
double getPeakTime(unsigned which) const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
unsigned QIE8Simulator::run ( double  dt,
double  tstop,
double  tDigitize,
double *  TS,
unsigned  lenTS 
)

Definition at line 35 of file QIE8Simulator.cc.

References adcTSWidth(), AbsODERHS::calc(), chargeNode_, dt, Exception, getCharge(), historyBuffer_, initialConditions_, integrateToGetCharge_, AbsElectronicODERHS::invalidNode, ConstantStepOdeSolver::lastMaxT(), maxlen, modifiableRHS(), dqmiodumpmetadata::n, AbsElectronicODERHS::numberOfNodes(), outputGain_, preampOutputCut_, data-class-funcs::q, ConstantStepOdeSolver::run(), runCount_, ConstantStepOdeSolver::setHistory(), solver_, FrontierCondition_GT_autoExpress_cfi::t0, RandomServiceHelper::t1, ConstantStepOdeSolver::truncateCoordinate(), and mitigatedMETSequence_cff::U.

Referenced by DTWorkflow.DTWorkflow::all(), Types.EventID::cppID(), Types.LuminosityBlockID::cppID(), o2olib.O2OTool::execute(), and setInputStartTime().

36  {
38  throw cms::Exception("In QIE8Simulator::run: preamp model is not set");
39 
40  // Check arguments for validity
41  if (dt <= 0.0)
42  throw cms::Exception("In QIE8Simulator::run: invalid time step");
43 
44  if (tstop < dt)
45  throw cms::Exception("In QIE8Simulator::run: invalid stopping time");
46 
47  if (lenTS && tDigitize < 0.0)
48  throw cms::Exception("In QIE8Simulator::run: can't digitize at t < 0");
49 
50  // Determine the number of time steps
51  const double dsteps = tstop / dt;
52  unsigned n = dsteps;
53  if (dsteps != static_cast<double>(n))
54  ++n;
55  if (n >= maxlen)
56  n = maxlen - 1;
57 
58  // Run the simulation
60  const unsigned numNodes = rhs.numberOfNodes();
61  if (numNodes) {
62  assert(initialConditions_.size() == numNodes);
63  solver_.run(&initialConditions_[0], numNodes, dt, n);
64  } else {
65  // Special situation: the simulation does not
66  // need to solve any ODE. Instead, it will fill
67  // out the output directly.
68  if (!(integrateToGetCharge_ && chargeNode_ == 0U))
69  throw cms::Exception(
70  "In QIE8Simulator::run: "
71  "invalid mode of operation");
72  const unsigned runLen = n + 1U;
73  if (historyBuffer_.size() < runLen)
74  historyBuffer_.resize(runLen);
75  double* hbuf = &historyBuffer_[0];
76  for (unsigned istep = 0; istep < runLen; ++istep, ++hbuf)
77  rhs.calc(istep * dt, nullptr, 0U, hbuf);
78  solver_.setHistory(dt, &historyBuffer_[0], 1U, runLen);
79  }
80 
81  // Truncate the preamp output if this will affect subsequent results
82  if (integrateToGetCharge_ && preampOutputCut_ > -0.9e100)
84 
85  // Digitize the accumulated charge
86  unsigned filled = 0;
87  if (lenTS) {
88  assert(TS);
89  const double lastTStop = solver_.lastMaxT();
90  const double tsWidth = this->adcTSWidth();
91  double oldCharge = getCharge(tDigitize);
92  for (unsigned its = 0; its < lenTS; ++its) {
93  const double t0 = tDigitize + its * tsWidth;
94  if (t0 < lastTStop) {
95  double t1 = t0 + tsWidth;
96  if (t1 > lastTStop)
97  t1 = lastTStop;
98  else
99  ++filled;
100  const double q = getCharge(t1);
101  TS[its] = (q - oldCharge) * outputGain_;
102  oldCharge = q;
103  } else
104  TS[its] = 0.0;
105  }
106  }
107  ++runCount_;
108  return filled;
109 }
float dt
Definition: AMPTWrapper.h:136
virtual unsigned numberOfNodes() const =0
static const unsigned invalidNode
std::vector< double > initialConditions_
unsigned chargeNode_
double preampOutputCut_
bool integrateToGetCharge_
unsigned long runCount_
static double adcTSWidth()
std::vector< double > historyBuffer_
virtual void calc(double t, const double *x, unsigned lenX, double *derivative)=0
AbsElectronicODERHS & modifiableRHS()
double getCharge(const double t) const
void run(const double *initialConditions, unsigned lenConditions, double dt, unsigned nSteps)
double outputGain_
void truncateCoordinate(unsigned which, double minValue, double maxValue)
void setHistory(double dt, const double *data, unsigned dim, unsigned runLen)
static const unsigned maxlen
Definition: QIE8Simulator.h:13
void QIE8Simulator::scaleInputSignal ( const double  s)
inline

Definition at line 88 of file QIE8Simulator.h.

References AbsElectronicODERHS::inputPulse(), modifiableRHS(), and alignCSCRings::s.

88 { modifiableRHS().inputPulse() *= s; }
const HcalInterpolatedPulse & inputPulse() const
AbsElectronicODERHS & modifiableRHS()
void QIE8Simulator::setInitialConditions ( const double *  values,
const unsigned  len 
)

Definition at line 140 of file QIE8Simulator.cc.

References HltBtagPostValidation_cff::c, Exception, getRHS(), mps_fire::i, initialConditions_, and AbsElectronicODERHS::numberOfNodes().

Referenced by setOutputGain().

140  {
141  const unsigned nExpected = getRHS().numberOfNodes();
142  if (sz != nExpected)
143  throw cms::Exception(
144  "In QIE8Simulator::setInitialConditions: unexpected number "
145  "of initial conditions");
146  assert(sz == initialConditions_.size());
147  if (sz) {
148  double* c = &initialConditions_[0];
149  for (unsigned i = 0; i < sz; ++i)
150  *c++ = *values++;
151  }
152 }
virtual unsigned numberOfNodes() const =0
std::vector< double > initialConditions_
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29
void QIE8Simulator::setInputAmplitude ( const double  a)
inline

Definition at line 93 of file QIE8Simulator.h.

References inputGain_, AbsElectronicODERHS::inputPulse(), modifiableRHS(), and InterpolatedPulse< MaxLen >::setPeakValue().

const HcalInterpolatedPulse & inputPulse() const
AbsElectronicODERHS & modifiableRHS()
void setPeakValue(const double newValue)
double a
Definition: hdecay.h:119
void QIE8Simulator::setInputGain ( const double  g)
inline

Definition at line 47 of file QIE8Simulator.h.

References g, inputGain_, and validateGain().

47  {
48  inputGain_ = g;
49  validateGain();
50  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
void validateGain() const
void QIE8Simulator::setInputIntegral ( const double  d)
inline

Definition at line 98 of file QIE8Simulator.h.

References inputGain_, AbsElectronicODERHS::inputPulse(), modifiableRHS(), and InterpolatedPulse< MaxLen >::setIntegral().

const HcalInterpolatedPulse & inputPulse() const
d
Definition: ztail.py:151
AbsElectronicODERHS & modifiableRHS()
void setIntegral(const double newValue)
template<class Real >
void QIE8Simulator::setInputShape ( const Real *  values,
const unsigned  len 
)
inline

Definition at line 82 of file QIE8Simulator.h.

References inputGain_, AbsElectronicODERHS::inputPulse(), modifiableRHS(), and InterpolatedPulse< MaxLen >::setShape().

82  {
85  }
void setShape(const Real *values, const unsigned len)
const HcalInterpolatedPulse & inputPulse() const
AbsElectronicODERHS & modifiableRHS()
template<class Signal >
void QIE8Simulator::setInputSignal ( const Signal inputSignal)
inline

Definition at line 71 of file QIE8Simulator.h.

References inputGain_, AbsElectronicODERHS::inputPulse(), modifiableRHS(), and AbsElectronicODERHS::setInputPulse().

71  {
72  modifiableRHS().setInputPulse(inputSignal);
74  }
const HcalInterpolatedPulse & inputPulse() const
AbsElectronicODERHS & modifiableRHS()
void setInputPulse(const Pulse &pulse)
void QIE8Simulator::setInputStartTime ( const double  newStartTime)
inline
void QIE8Simulator::setLeadingParameters ( const double *  values,
const unsigned  len 
)
inline

Definition at line 62 of file QIE8Simulator.h.

References modifiableRHS(), and AbsElectronicODERHS::setLeadingParameters().

62  {
64  }
void setLeadingParameters(const double *values, const unsigned len)
AbsElectronicODERHS & modifiableRHS()
void QIE8Simulator::setOutputGain ( const double  g)
inline

Definition at line 51 of file QIE8Simulator.h.

References g, outputGain_, setInitialConditions(), validateGain(), contentValuesCheck::values, and zeroInitialConditions().

51  {
52  outputGain_ = g;
53  validateGain();
54  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
void validateGain() const
double outputGain_
void QIE8Simulator::setParameter ( const unsigned  which,
const double  p 
)
inline

Definition at line 61 of file QIE8Simulator.h.

References modifiableRHS(), and AbsElectronicODERHS::setParameter().

Referenced by editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), tauTools.AddTauCollection::__call__(), trackTools.MakeTrackCandidates::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::jetConfiguration().

void setParameter(const unsigned which, const double value)
AbsElectronicODERHS & modifiableRHS()
def which(cmd)
Definition: eostools.py:336
void QIE8Simulator::setPreampOutputCut ( const double  p)
inline
void QIE8Simulator::setRHS ( const AbsElectronicODERHS rhs,
unsigned  chargeNode,
bool  interpolateCubic = false 
)

Definition at line 154 of file QIE8Simulator.cc.

References chargeNode_, Exception, integrateToGetCharge_, AbsElectronicODERHS::invalidNode, AbsElectronicODERHS::outputNode(), ConstantStepOdeSolver::setRHS(), solver_, useCubic_, and zeroInitialConditions().

156  {
157  if (chargeNode >= AbsElectronicODERHS::invalidNode)
158  throw cms::Exception("In QIE8Simulator::setRHS invalid charge collection node");
159  solver_.setRHS(rhs);
160  chargeNode_ = chargeNode;
161  integrateToGetCharge_ = chargeNode == rhs.outputNode();
162  useCubic_ = useCubicInterpolation;
164 }
static const unsigned invalidNode
unsigned chargeNode_
bool integrateToGetCharge_
virtual unsigned outputNode() const =0
void setRHS(const AbsODERHS &rhs)
void zeroInitialConditions()
double QIE8Simulator::totalIntegratedCharge ( double  t) const

Definition at line 188 of file QIE8Simulator.cc.

References Exception, getCharge(), outputGain_, and runCount_.

Referenced by setInputStartTime().

188  {
189  if (!runCount_)
190  throw cms::Exception(
191  "In QIE8Simulator::totalIntegratedCharge: "
192  "please run the simulation first");
193  return outputGain_ * getCharge(t);
194 }
unsigned long runCount_
double getCharge(const double t) const
double outputGain_
void QIE8Simulator::validateGain ( ) const
private

Definition at line 177 of file QIE8Simulator.cc.

References Exception, and inputGain_.

Referenced by getCharge(), QIE8Simulator(), setInputGain(), and setOutputGain().

177  {
178  if (inputGain_ <= 0.0)
179  throw cms::Exception("In QIE8Simulator::validateGain: invalid input gain");
180 }
void QIE8Simulator::zeroInitialConditions ( )

Definition at line 166 of file QIE8Simulator.cc.

References HltBtagPostValidation_cff::c, getRHS(), mps_fire::i, initialConditions_, and AbsElectronicODERHS::numberOfNodes().

Referenced by QIE8Simulator(), setOutputGain(), and setRHS().

166  {
167  const unsigned sz = getRHS().numberOfNodes();
168  if (initialConditions_.size() != sz)
169  initialConditions_.resize(sz);
170  if (sz) {
171  double* c = &initialConditions_[0];
172  for (unsigned i = 0; i < sz; ++i)
173  *c++ = 0.0;
174  }
175 }
virtual unsigned numberOfNodes() const =0
std::vector< double > initialConditions_
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:29

Member Data Documentation

unsigned QIE8Simulator::chargeNode_
private

Definition at line 163 of file QIE8Simulator.h.

Referenced by getCharge(), run(), and setRHS().

std::vector<double> QIE8Simulator::historyBuffer_
private

Definition at line 158 of file QIE8Simulator.h.

Referenced by run().

std::vector<double> QIE8Simulator::initialConditions_
private

Definition at line 157 of file QIE8Simulator.h.

Referenced by run(), setInitialConditions(), and zeroInitialConditions().

double QIE8Simulator::inputGain_
private
bool QIE8Simulator::integrateToGetCharge_
private

Definition at line 164 of file QIE8Simulator.h.

Referenced by getCharge(), QIE8Simulator(), run(), and setRHS().

const unsigned QIE8Simulator::maxlen = HcalInterpolatedPulse::maxlen
static
double QIE8Simulator::outputGain_
private
double QIE8Simulator::preampOutputCut_
private

Definition at line 159 of file QIE8Simulator.h.

Referenced by getPreampOutputCut(), run(), and setPreampOutputCut().

unsigned long QIE8Simulator::runCount_
private
RK4 QIE8Simulator::solver_
private
bool QIE8Simulator::useCubic_
private

Definition at line 165 of file QIE8Simulator.h.

Referenced by controlOutput(), getCharge(), preampOutput(), and setRHS().