BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
DepthProbeInstrumentItem Class Reference

Description

Definition at line 127 of file InstrumentItems.h.

Inheritance diagram for DepthProbeInstrumentItem:
[legend]
Collaboration diagram for DepthProbeInstrumentItem:
[legend]

Public Member Functions

 DepthProbeInstrumentItem ()
 
virtual bool alignedWith (const RealDataItem *item) const
 
 AXIS_PROPERTY (zAxis)
 
BackgroundItembackgroundItem () const
 
SelectionDescriptor< BackgroundItem * > backgroundSelection () const
 
SpecularBeamItembeamItem () const override
 
ICoordSystem * createCoordSystem () const override
 
InstrumentItemcreateCopy () const
 Creates an exact copy; also ID is the same! More...
 
DepthProbeSimulation * createSimulation (const MultiLayer &sample) const
 
QString defaultName () const override
 The default user visible name when creating an instrument. More...
 
QString description () const
 
 DOUBLE_PROPERTY (analyzerTotalTransmission, AnalyzerTotalTransmission)
 
QString id () const
 
virtual void importMasks (const MaskContainerItem *)
 
QString instrumentName () const
 
QString instrumentType () const override
 The type as how to show it on the UI. Do not use for type checking or similar! More...
 
template<typename T >
bool is () const
 
void serialize (Streamer &s) override
 
template<typename T >
T * setBackgroundType ()
 
void setDescription (const QString &description)
 
void setId (const QString &id)
 
void setInstrumentName (const QString &instrumentName)
 
void setWithPolarizerAnalyzer (bool with)
 
std::vector< int > shape () const override
 
void updateToRealData (const RealDataItem *item) override
 
 VECTOR_PROPERTY (analyzerDirection, AnalyzerDirection)
 
 VECTOR_PROPERTY (polarization, Polarization)
 
bool withPolarizerAnalyzer () const
 

Protected Member Functions

template<typename T >
T * beam () const
 

Protected Attributes

SelectionProperty< BackgroundItem * > m_backgroundItem
 
std::unique_ptr< BeamItemm_beamItem
 
QString m_description
 
QString m_id
 
QString m_name
 
bool m_withPolarizerAnalyzer
 

Constructor & Destructor Documentation

◆ DepthProbeInstrumentItem()

DepthProbeInstrumentItem::DepthProbeInstrumentItem ( )

Definition at line 254 of file InstrumentItems.cpp.

255 {
256  m_beamItem.reset(new SpecularBeamItem(this));
257 
258  auto* axisItem = beamItem()->inclinationAxis();
259  axisItem->setLowerBound(0.0);
260  axisItem->setUpperBound(1.0);
261  axisItem->setBinCount(500);
262 
263  m_zAxis.initNbins("Nbins", "Number of points in scan across sample bulk");
264  m_zAxis.initMin("Min", "Starting value below sample horizon", -100.0, Unit::nanometer,
265  RealLimits::limitless());
266  m_zAxis.initMax("Max", "Ending value above sample horizon", 100.0, Unit::nanometer,
267  RealLimits::limitless());
268 }
@ nanometer
void setLowerBound(double value)
Definition: AxesItems.cpp:48
SpecularBeamItem * beamItem() const override
std::unique_ptr< BeamItem > m_beamItem
BasicAxisItem * inclinationAxis() const
Definition: BeamItems.cpp:156

References beamItem(), SpecularBeamItem::inclinationAxis(), InstrumentItem::m_beamItem, nanometer, and BasicAxisItem::setLowerBound().

Here is the call graph for this function:

Member Function Documentation

◆ alignedWith()

bool InstrumentItem::alignedWith ( const RealDataItem item) const
virtualinherited

Reimplemented in SpecularInstrumentItem.

Definition at line 129 of file InstrumentItems.cpp.

130 {
131  return shape() == item->shape();
132 }
virtual std::vector< int > shape() const =0
std::vector< int > shape() const
Returns the shape of underlying data item.

References RealDataItem::shape(), and InstrumentItem::shape().

Referenced by LinkInstrumentManager::onInstrumentChanged(), and SimulationView::validateSimulationSetup().

Here is the call graph for this function:

◆ AXIS_PROPERTY()

DepthProbeInstrumentItem::AXIS_PROPERTY ( zAxis  )

◆ backgroundItem()

BackgroundItem * InstrumentItem::backgroundItem ( ) const
inherited

Definition at line 119 of file InstrumentItems.cpp.

120 {
121  return m_backgroundItem.get();
122 }
SelectionProperty< BackgroundItem * > m_backgroundItem
T get() const
Direct access to the stored pointer.

References SelectionProperty< T >::get(), and InstrumentItem::m_backgroundItem.

Here is the call graph for this function:

◆ backgroundSelection()

SelectionDescriptor< BackgroundItem * > InstrumentItem::backgroundSelection ( ) const
inherited

◆ beam()

template<typename T >
T * InstrumentItem::beam
protectedinherited

◆ beamItem()

SpecularBeamItem * DepthProbeInstrumentItem::beamItem ( ) const
overridevirtual

Reimplemented from InstrumentItem.

Definition at line 277 of file InstrumentItems.cpp.

278 {
279  return beam<SpecularBeamItem>();
280 }

Referenced by DepthProbeInstrumentEditor::DepthProbeInstrumentEditor(), DepthProbeInstrumentItem(), and createSimulation().

◆ createCoordSystem()

ICoordSystem * DepthProbeInstrumentItem::createCoordSystem ( ) const
overridevirtual

Implements InstrumentItem.

Definition at line 323 of file InstrumentItems.cpp.

324 {
325  // TODO set pol filters ?
326  return nullptr; // TODO NOW RESTORE createSimulation()->createCoordSystem();
327 }

◆ createCopy()

InstrumentItem * InstrumentItem::createCopy ( ) const
inherited

Creates an exact copy; also ID is the same!

Definition at line 76 of file InstrumentItems.cpp.

77 {
78  const auto type = InstrumentItemCatalog::type(this);
79  auto* copy = InstrumentItemCatalog::create(type);
80  GUI::Util::copyContents(this, copy);
81  return copy;
82 }
static Type type(const InstrumentItem *item)
Returns the enum type of the given item.
static InstrumentItem * create(Type type)
Creates the item of the given type.
void copyContents(const T *source, T *dest)
Definition: Backup.h:46

References GUI::Util::copyContents(), InstrumentItemCatalog::create(), and InstrumentItemCatalog::type().

Referenced by JobItem::copyInstrumentIntoJob(), and InstrumentCollection::insertCopy().

Here is the call graph for this function:

◆ createSimulation()

DepthProbeSimulation * DepthProbeInstrumentItem::createSimulation ( const MultiLayer &  sample) const

Definition at line 302 of file InstrumentItems.cpp.

303 {
304  auto* simulation = new DepthProbeSimulation(sample);
305 
306  auto* const axis_item = beamItem()->inclinationAxis();
307  auto axis = axis_item->createAxis(Units::deg);
308 
309  simulation->setBeamParameters(beamItem()->wavelength(), static_cast<int>(axis->size()),
310  axis->min(), axis->max());
311 
312  simulation->setZSpan(m_zAxis.nbins(), m_zAxis.min(), m_zAxis.max());
313 
314  setBeamDistribution(ParameterDistribution::BeamWavelength, *beamItem()->wavelengthItem(),
315  *simulation);
316 
317  setBeamDistribution(ParameterDistribution::BeamInclinationAngle,
318  *beamItem()->inclinationAngleItem(), *simulation);
319 
320  return simulation;
321 }
virtual std::unique_ptr< IAxis > createAxis(double scale) const
Definition: AxesItems.cpp:110

References beamItem(), BasicAxisItem::createAxis(), and SpecularBeamItem::inclinationAxis().

Here is the call graph for this function:

◆ defaultName()

QString DepthProbeInstrumentItem::defaultName ( ) const
overridevirtual

The default user visible name when creating an instrument.

Implements InstrumentItem.

Definition at line 292 of file InstrumentItems.cpp.

293 {
294  return "DepthProbe";
295 }

◆ description()

QString InstrumentItem::description ( ) const
inherited

Definition at line 104 of file InstrumentItems.cpp.

105 {
106  return m_description;
107 }

References InstrumentItem::m_description.

Referenced by InstrumentItem::setDescription().

◆ DOUBLE_PROPERTY()

InstrumentItem::DOUBLE_PROPERTY ( analyzerTotalTransmission  ,
AnalyzerTotalTransmission   
)
inherited

◆ id()

QString InstrumentItem::id ( ) const
inherited

◆ importMasks()

virtual void InstrumentItem::importMasks ( const MaskContainerItem )
inlinevirtualinherited

Reimplemented in Instrument2DItem.

Definition at line 78 of file InstrumentItems.h.

78 {}

◆ instrumentName()

◆ instrumentType()

QString DepthProbeInstrumentItem::instrumentType ( ) const
overridevirtual

The type as how to show it on the UI. Do not use for type checking or similar!

Implements InstrumentItem.

Definition at line 297 of file InstrumentItems.cpp.

298 {
299  return "Depth probe";
300 }

◆ is()

◆ serialize()

void DepthProbeInstrumentItem::serialize ( Streamer s)
overridevirtual

Reimplemented from InstrumentItem.

Definition at line 270 of file InstrumentItems.cpp.

271 {
272  s.assertVersion(0);
273  Serialize::rwBaseClass<InstrumentItem>(s, "InstrumentItem", this);
274  m_zAxis.rwAxisProperty(s, "zAxis");
275 }
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
Definition: Streamer.cpp:26

References Streamer::assertVersion().

Here is the call graph for this function:

◆ setBackgroundType()

template<typename T >
T * InstrumentItem::setBackgroundType
inherited

Definition at line 205 of file InstrumentItems.h.

206 {
207  m_backgroundItem.set<T>();
208  return dynamic_cast<T*>(m_backgroundItem.get());
209 }
void set(T t, bool callInitializer=false)
Directly set the new item.

References SelectionProperty< T >::get(), InstrumentItem::m_backgroundItem, and SelectionProperty< T >::set().

Here is the call graph for this function:

◆ setDescription()

void InstrumentItem::setDescription ( const QString &  description)
inherited

Definition at line 109 of file InstrumentItems.cpp.

110 {
112 }
QString description() const

References InstrumentItem::description(), and InstrumentItem::m_description.

Referenced by InstrumentView::onInstrumentdescriptionEdited(), and InstrumentsTreeModel::setData().

Here is the call graph for this function:

◆ setId()

void InstrumentItem::setId ( const QString &  id)
inherited

Definition at line 89 of file InstrumentItems.cpp.

90 {
91  m_id = id;
92 }
QString id() const

References InstrumentItem::id(), and InstrumentItem::m_id.

Referenced by InstrumentCollection::insertCopy().

Here is the call graph for this function:

◆ setInstrumentName()

void InstrumentItem::setInstrumentName ( const QString &  instrumentName)
inherited

Definition at line 94 of file InstrumentItems.cpp.

95 {
97 }
QString instrumentName() const

References InstrumentItem::instrumentName(), and InstrumentItem::m_name.

Referenced by InstrumentsEditController::addCopy(), InstrumentsTreeModel::setData(), InstrumentsEditController::setInstrumentName(), and GUI::Model::JobFunctions::setupJobItemInstrument().

Here is the call graph for this function:

◆ setWithPolarizerAnalyzer()

void InstrumentItem::setWithPolarizerAnalyzer ( bool  with)
inherited

◆ shape()

std::vector< int > DepthProbeInstrumentItem::shape ( ) const
overridevirtual

Implements InstrumentItem.

Definition at line 282 of file InstrumentItems.cpp.

283 {
284  return std::vector<int>(); // no certain shape to avoid linking to real data
285 }

◆ updateToRealData()

void DepthProbeInstrumentItem::updateToRealData ( const RealDataItem item)
overridevirtual

Implements InstrumentItem.

Definition at line 287 of file InstrumentItems.cpp.

288 {
289  throw std::runtime_error("DepthProbeInstrumentItem::updateToRealData()");
290 }

◆ VECTOR_PROPERTY() [1/2]

InstrumentItem::VECTOR_PROPERTY ( analyzerDirection  ,
AnalyzerDirection   
)
inherited

◆ VECTOR_PROPERTY() [2/2]

InstrumentItem::VECTOR_PROPERTY ( polarization  ,
Polarization   
)
inherited

◆ withPolarizerAnalyzer()

bool InstrumentItem::withPolarizerAnalyzer ( ) const
inherited

Member Data Documentation

◆ m_backgroundItem

◆ m_beamItem

◆ m_description

QString InstrumentItem::m_description
protectedinherited

◆ m_id

QString InstrumentItem::m_id
protectedinherited

◆ m_name

QString InstrumentItem::m_name
protectedinherited

◆ m_withPolarizerAnalyzer

bool InstrumentItem::m_withPolarizerAnalyzer
protectedinherited

The documentation for this class was generated from the following files: