test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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), inputGain_(1.0),
8  outputGain_(1.0), runCount_(0),
10  integrateToGetCharge_(false),
11  useCubic_(false)
12 {
13 }
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 {
29  if (chargeNode >= AbsElectronicODERHS::invalidNode)
30  throw cms::Exception(
31  "In QIE8Simulator constructor: invalid charge collection node");
32  integrateToGetCharge_ = chargeNode == model.outputNode();
33  validateGain();
35 }
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 146 of file QIE8Simulator.h.

Referenced by run().

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

Definition at line 134 of file QIE8Simulator.cc.

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

135 {
136  if (!runCount_) throw cms::Exception(
137  "In QIE8Simulator::controlOutput: please run the simulation first");
138  const unsigned controlNode = getRHS().controlNode();
139  if (controlNode >= AbsElectronicODERHS::invalidNode)
140  return 0.0;
141  else
142  return solver_.interpolateCoordinate(controlNode, t, useCubic_);
143 }
static const unsigned invalidNode
unsigned long runCount_
virtual unsigned controlNode() const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:31
double interpolateCoordinate(unsigned which, double t, bool cubic=false) const
double QIE8Simulator::getCharge ( const double  t) const
inlineprivate

Definition at line 157 of file QIE8Simulator.h.

References chargeNode_, integrateToGetCharge_, ConstantStepOdeSolver::interpolateCoordinate(), ConstantStepOdeSolver::interpolateIntegrated(), lumiQueryAPI::q, solver_, and useCubic_.

Referenced by run(), and totalIntegratedCharge().

158  {
159  double q;
162  else
164  return q;
165  }
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 95 of file QIE8Simulator.h.

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

const HcalInterpolatedPulse & inputPulse() const
double getPeakValue() const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:31
double QIE8Simulator::getInputGain ( ) const
inline

Definition at line 40 of file QIE8Simulator.h.

References inputGain_.

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

Definition at line 102 of file QIE8Simulator.h.

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

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

Definition at line 78 of file QIE8Simulator.h.

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

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

Definition at line 109 of file QIE8Simulator.h.

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

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

Definition at line 41 of file QIE8Simulator.h.

References outputGain_.

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

Definition at line 48 of file QIE8Simulator.h.

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

Referenced by Mixins._Parameterizable::hasParameter().

49  {return getRHS().getParameter(which);}
def which
Definition: eostools.py:335
double getParameter(const unsigned which) const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:31
double QIE8Simulator::getPreampOutputCut ( ) const
inline

Definition at line 43 of file QIE8Simulator.h.

References preampOutputCut_.

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

Definition at line 31 of file QIE8Simulator.h.

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

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

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

Definition at line 42 of file QIE8Simulator.h.

References runCount_.

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

Definition at line 204 of file QIE8Simulator.cc.

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

205 {
206  if (!runCount_) throw cms::Exception(
207  "In QIE8Simulator::lastStopTime: please run the simulation first");
208  return solver_.lastMaxT();
209 }
unsigned long runCount_
AbsElectronicODERHS& QIE8Simulator::modifiableRHS ( )
inlineprivate

Definition at line 149 of file QIE8Simulator.h.

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

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

150  {
151  AbsODERHS* ptr = solver_.getRHS();
152  if (!ptr) throw cms::Exception(
153  "In QIE8Simulator::modifiableRHS: no RHS");
154  return *(static_cast<AbsElectronicODERHS*>(ptr));
155  }
const AbsODERHS * getRHS() const
unsigned QIE8Simulator::nParameters ( ) const
inline

Definition at line 46 of file QIE8Simulator.h.

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

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

Definition at line 122 of file QIE8Simulator.cc.

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

123 {
124  if (!runCount_) throw cms::Exception(
125  "In QIE8Simulator::preampOutput: please run the simulation first");
126  const unsigned preampNode = getRHS().outputNode();
127  if (preampNode >= AbsElectronicODERHS::invalidNode)
128  return 0.0;
129  else
131  preampNode, t, useCubic_);
132 }
static const unsigned invalidNode
virtual unsigned outputNode() const =0
unsigned long runCount_
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:31
double interpolateCoordinate(unsigned which, double t, bool cubic=false) const
double outputGain_
double QIE8Simulator::preampPeakTime ( ) const

Definition at line 145 of file QIE8Simulator.cc.

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

146 {
147  if (!runCount_) throw cms::Exception(
148  "In QIE8Simulator::preampPeakTime: please run the simulation first");
149  const unsigned preampNode = getRHS().outputNode();
150  if (preampNode >= AbsElectronicODERHS::invalidNode) throw cms::Exception(
151  "In QIE8Simulator::preampPeakTime: no preamp node in the circuit");
152  return solver_.getPeakTime(preampNode);
153 }
static const unsigned invalidNode
virtual unsigned outputNode() const =0
unsigned long runCount_
double getPeakTime(unsigned which) const
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:31
unsigned QIE8Simulator::run ( double  dt,
double  tstop,
double  tDigitize,
double *  TS,
unsigned  lenTS 
)

Definition at line 37 of file QIE8Simulator.cc.

References adcTSWidth(), assert(), AbsODERHS::calc(), chargeNode_, dt, Exception, getCharge(), historyBuffer_, initialConditions_, integrateToGetCharge_, AbsElectronicODERHS::invalidNode, ConstantStepOdeSolver::lastMaxT(), maxlen, modifiableRHS(), gen::n, AbsElectronicODERHS::numberOfNodes(), outputGain_, preampOutputCut_, lumiQueryAPI::q, ConstantStepOdeSolver::run(), runCount_, ConstantStepOdeSolver::setHistory(), solver_, FrontierCondition_GT_autoExpress_cfi::t0, and ConstantStepOdeSolver::truncateCoordinate().

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

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

Definition at line 91 of file QIE8Simulator.h.

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

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

Definition at line 155 of file QIE8Simulator.cc.

References assert(), EnergyCorrector::c, Exception, getRHS(), i, initialConditions_, and AbsElectronicODERHS::numberOfNodes().

157 {
158  const unsigned nExpected = getRHS().numberOfNodes();
159  if (sz != nExpected) throw cms::Exception(
160  "In QIE8Simulator::setInitialConditions: unexpected number "
161  "of initial conditions");
162  assert(sz == initialConditions_.size());
163  if (sz)
164  {
165  double* c = &initialConditions_[0];
166  for (unsigned i=0; i<sz; ++i)
167  *c++ = *values++;
168  }
169 }
int i
Definition: DBlmapReader.cc:9
virtual unsigned numberOfNodes() const =0
std::vector< double > initialConditions_
assert(m_qm.get())
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:31
void QIE8Simulator::setInputAmplitude ( const double  a)
inline

Definition at line 98 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:121
void QIE8Simulator::setInputGain ( const double  g)
inline

Definition at line 52 of file QIE8Simulator.h.

References g, inputGain_, and validateGain().

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 105 of file QIE8Simulator.h.

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

const HcalInterpolatedPulse & inputPulse() const
tuple 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 84 of file QIE8Simulator.h.

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

85  {
88  }
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().

72  {
73  modifiableRHS().setInputPulse(inputSignal);
75  }
const HcalInterpolatedPulse & inputPulse() const
AbsElectronicODERHS & modifiableRHS()
void setInputPulse(const Pulse &pulse)
void QIE8Simulator::setInputStartTime ( const double  newStartTime)
inline

Definition at line 112 of file QIE8Simulator.h.

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

113  {modifiableRHS().inputPulse().setStartTime(newStartTime);}
void setStartTime(const double newStartTime)
const HcalInterpolatedPulse & inputPulse() const
AbsElectronicODERHS & modifiableRHS()
void QIE8Simulator::setLeadingParameters ( const double *  values,
const unsigned  len 
)
inline

Definition at line 62 of file QIE8Simulator.h.

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

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

Definition at line 53 of file QIE8Simulator.h.

References g, outputGain_, and validateGain().

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 60 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__(), trackTools.MakeTrackCandidates::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), jetTools.AddJetCollection::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::jetConfiguration().

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

Definition at line 171 of file QIE8Simulator.cc.

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

174 {
175  if (chargeNode >= AbsElectronicODERHS::invalidNode)
176  throw cms::Exception(
177  "In QIE8Simulator::setRHS invalid charge collection node");
178  solver_.setRHS(rhs);
179  chargeNode_ = chargeNode;
180  integrateToGetCharge_ = chargeNode == rhs.outputNode();
181  useCubic_ = useCubicInterpolation;
183 }
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 211 of file QIE8Simulator.cc.

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

212 {
213  if (!runCount_) throw cms::Exception(
214  "In QIE8Simulator::totalIntegratedCharge: "
215  "please run the simulation first");
216  return outputGain_*getCharge(t);
217 }
unsigned long runCount_
double getCharge(const double t) const
double outputGain_
void QIE8Simulator::validateGain ( ) const
private

Definition at line 198 of file QIE8Simulator.cc.

References Exception, and inputGain_.

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

199 {
200  if (inputGain_ <= 0.0) throw cms::Exception(
201  "In QIE8Simulator::validateGain: invalid input gain");
202 }
void QIE8Simulator::zeroInitialConditions ( )

Definition at line 185 of file QIE8Simulator.cc.

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

Referenced by QIE8Simulator(), and setRHS().

186 {
187  const unsigned sz = getRHS().numberOfNodes();
188  if (initialConditions_.size() != sz)
189  initialConditions_.resize(sz);
190  if (sz)
191  {
192  double* c = &initialConditions_[0];
193  for (unsigned i=0; i<sz; ++i)
194  *c++ = 0.0;
195  }
196 }
int i
Definition: DBlmapReader.cc:9
virtual unsigned numberOfNodes() const =0
std::vector< double > initialConditions_
const AbsElectronicODERHS & getRHS() const
Definition: QIE8Simulator.h:31

Member Data Documentation

unsigned QIE8Simulator::chargeNode_
private

Definition at line 176 of file QIE8Simulator.h.

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

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

Definition at line 171 of file QIE8Simulator.h.

Referenced by run().

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

Definition at line 170 of file QIE8Simulator.h.

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

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

Definition at line 177 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 172 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 178 of file QIE8Simulator.h.

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