Skip to content
Snippets Groups Projects
Commit bb36d36a authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Merge branch 'BugInDetectorInit' into develop

parents 5c837061 87815e62
No related branches found
No related tags found
No related merge requests found
......@@ -119,15 +119,9 @@ inline Beam Instrument::getBeam() const
return m_beam;
}
inline void Instrument::setBeam(const Beam &beam)
{
m_beam = beam;
}
inline void Instrument::setBeamParameters(double wavelength, double alpha_i, double phi_i)
{
m_beam.setCentralK(wavelength, alpha_i, phi_i);
}
inline void Instrument::setBeamIntensity(double intensity)
{
......
......@@ -46,6 +46,7 @@ Instrument &Instrument::operator=(const Instrument &other)
void Instrument::setDetector(const IDetector2D& detector)
{
mP_detector.reset(detector.clone());
initDetector();
}
void Instrument::matchDetectorAxes(const OutputData<double> &output_data)
......@@ -82,6 +83,9 @@ std::string Instrument::addParametersToExternalPool(std::string path, ParameterP
void Instrument::initDetector()
{
if(!mP_detector) {
throw RuntimeErrorException("Instrument::initDetector() -> Error. Detector is not initialized.");
}
getDetector()->init(getBeam());
}
......@@ -140,3 +144,15 @@ void Instrument::print(std::ostream &ostr) const
ostr << " " << m_beam << std::endl;
ostr << " " << *mP_detector << std::endl;
}
void Instrument::setBeamParameters(double wavelength, double alpha_i, double phi_i)
{
m_beam.setCentralK(wavelength, alpha_i, phi_i);
if(mP_detector) initDetector();
}
void Instrument::setBeam(const Beam &beam)
{
m_beam = beam;
if(mP_detector) initDetector();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment