BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
Instrument2DItem Class Referenceabstract

Description

Definition at line 149 of file InstrumentItems.h.

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

Public Member Functions

virtual bool alignedWith (const RealDataItem *item) const
 
BackgroundItembackgroundItem () const
 
SelectionDescriptor< BackgroundItem * > backgroundSelection () const
 
virtual BeamItembeamItem () const
 
virtual ICoordSystem * createCoordSystem () const =0
 
InstrumentItemcreateCopy () const
 Creates an exact copy; also ID is the same! More...
 
std::unique_ptr< InstrumentcreateInstrument () const
 
OffspecSimulation * createOffspecSimulation (const MultiLayer &sample) const
 
ScatteringSimulation * createScatteringSimulation (const MultiLayer &sample) const
 
virtual QString defaultName () const =0
 The default user visible name when creating an instrument. More...
 
QString description () const
 
GroupItemdetectorGroup ()
 
DetectorItemdetectorItem () const
 
SelectionDescriptor< DetectorItem * > detectorSelection () const
 
 DOUBLE_PROPERTY (analyzerTotalTransmission, AnalyzerTotalTransmission)
 
QString id () const
 
void importMasks (const MaskContainerItem *maskContainer) override
 
QString instrumentName () const
 
virtual QString instrumentType () const =0
 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)
 
template<typename T >
T * setDetectorType ()
 
void setId (const QString &id)
 
void setInstrumentName (const QString &instrumentName)
 
void setWithPolarizerAnalyzer (bool with)
 
virtual std::vector< int > shape () const =0
 
virtual void updateToRealData (const RealDataItem *item)=0
 
 VECTOR_PROPERTY (analyzerDirection, AnalyzerDirection)
 
 VECTOR_PROPERTY (polarization, Polarization)
 
bool withPolarizerAnalyzer () const
 

Static Public Member Functions

static bool isDetectorPropertyName (const QString &name)
 

Protected Member Functions

 Instrument2DItem ()
 
template<typename T >
T * beam () const
 

Protected Attributes

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

Constructor & Destructor Documentation

◆ Instrument2DItem()

Instrument2DItem::Instrument2DItem ( )
protected

Definition at line 333 of file InstrumentItems.cpp.

334 {
335  m_beamItem.reset(new GISASBeamItem());
336  m_detectorItem.init<DetectorItemCatalog>("Detector", "", "detector");
337 }
SelectionProperty< DetectorItem * > m_detectorItem
std::unique_ptr< BeamItem > m_beamItem
void init(const QString &label, const QString &tooltip, const QString &persistentTag, ArgsForCreation... argsForCreation)
Initialize by means of a catalog class and optional creation arguments.

References SelectionProperty< T >::init(), InstrumentItem::m_beamItem, and m_detectorItem.

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:

◆ 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

Definition at line 145 of file InstrumentItems.cpp.

146 {
147  return dynamic_cast<T*>(m_beamItem.get());
148 }

References InstrumentItem::m_beamItem.

Referenced by SpecularInstrumentItem::createCoordSystem(), createInstrument(), createOffspecSimulation(), and createScatteringSimulation().

◆ beamItem()

◆ createCoordSystem()

◆ 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:

◆ createInstrument()

std::unique_ptr< Instrument > Instrument2DItem::createInstrument ( ) const

Definition at line 361 of file InstrumentItems.cpp.

362 {
363  auto beam = beamItem()->createBeam();
364  auto detector = detectorItem()->createDetector();
365  detector->setDetectorNormal(beam->direction().zReflected());
366 
367  return std::make_unique<Instrument>(*beam, *detector);
368 }
std::unique_ptr< Beam > createBeam() const
Definition: BeamItems.cpp:97
std::unique_ptr< IDetector > createDetector() const
DetectorItem * detectorItem() const
virtual BeamItem * beamItem() const

References InstrumentItem::beam(), InstrumentItem::beamItem(), BeamItem::createBeam(), DetectorItem::createDetector(), and detectorItem().

Referenced by GISASInstrumentItem::createCoordSystem(), and OffspecInstrumentItem::createCoordSystem().

Here is the call graph for this function:

◆ createOffspecSimulation()

OffspecSimulation * Instrument2DItem::createOffspecSimulation ( const MultiLayer &  sample) const

Definition at line 382 of file InstrumentItems.cpp.

383 {
384  auto beam = beamItem()->createBeam();
385  beam->setPolarization(m_polarization);
386  auto detector = detectorItem()->createDetector();
387  detector->setAnalyzer(m_analyzerDirection, m_analyzerEfficiency, m_analyzerTotalTransmission);
388  detector->setDetectorNormal(beam->direction().zReflected());
389 
390  auto* result = new OffspecSimulation(*beam, sample, *detector);
391  return result;
392 }

References InstrumentItem::beam(), InstrumentItem::beamItem(), BeamItem::createBeam(), DetectorItem::createDetector(), and detectorItem().

Here is the call graph for this function:

◆ createScatteringSimulation()

ScatteringSimulation * Instrument2DItem::createScatteringSimulation ( const MultiLayer &  sample) const

Definition at line 370 of file InstrumentItems.cpp.

371 {
372  auto beam = beamItem()->createBeam();
373  beam->setPolarization(m_polarization);
374  auto detector = detectorItem()->createDetector();
375  detector->setAnalyzer(m_analyzerDirection, m_analyzerEfficiency, m_analyzerTotalTransmission);
376  detector->setDetectorNormal(beam->direction().zReflected());
377 
378  auto* result = new ScatteringSimulation(*beam, sample, *detector);
379  return result;
380 }

References InstrumentItem::beam(), InstrumentItem::beamItem(), BeamItem::createBeam(), DetectorItem::createDetector(), and detectorItem().

Here is the call graph for this function:

◆ defaultName()

virtual QString InstrumentItem::defaultName ( ) const
pure virtualinherited

The default user visible name when creating an instrument.

Implemented in OffspecInstrumentItem, GISASInstrumentItem, DepthProbeInstrumentItem, and SpecularInstrumentItem.

◆ 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().

◆ detectorGroup()

GroupItem* Instrument2DItem::detectorGroup ( )

◆ detectorItem()

DetectorItem * Instrument2DItem::detectorItem ( ) const

Definition at line 346 of file InstrumentItems.cpp.

347 {
348  return m_detectorItem.get();
349 }

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

Referenced by createInstrument(), createOffspecSimulation(), createScatteringSimulation(), importMasks(), GISASInstrumentItem::shape(), OffspecInstrumentItem::shape(), GISASInstrumentItem::updateToRealData(), and OffspecInstrumentItem::updateToRealData().

Here is the call graph for this function:

◆ detectorSelection()

SelectionDescriptor< DetectorItem * > Instrument2DItem::detectorSelection ( ) const

Definition at line 351 of file InstrumentItems.cpp.

352 {
353  return m_detectorItem;
354 }

References m_detectorItem.

Referenced by DetectorEditor::DetectorEditor(), and DetectorEditor::createDetectorWidgets().

◆ DOUBLE_PROPERTY()

InstrumentItem::DOUBLE_PROPERTY ( analyzerTotalTransmission  ,
AnalyzerTotalTransmission   
)
inherited

◆ id()

QString InstrumentItem::id ( ) const
inherited

◆ importMasks()

void Instrument2DItem::importMasks ( const MaskContainerItem maskContainer)
overridevirtual

Reimplemented from InstrumentItem.

Definition at line 356 of file InstrumentItems.cpp.

357 {
358  detectorItem()->importMasks(maskContainer);
359 }
void importMasks(const MaskContainerItem *maskContainer)

References detectorItem(), and DetectorItem::importMasks().

Here is the call graph for this function:

◆ instrumentName()

◆ instrumentType()

virtual QString InstrumentItem::instrumentType ( ) const
pure virtualinherited

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

Implemented in OffspecInstrumentItem, GISASInstrumentItem, DepthProbeInstrumentItem, and SpecularInstrumentItem.

◆ is()

◆ isDetectorPropertyName()

static bool Instrument2DItem::isDetectorPropertyName ( const QString &  name)
static

◆ serialize()

void Instrument2DItem::serialize ( Streamer s)
overridevirtual

Reimplemented from InstrumentItem.

Reimplemented in OffspecInstrumentItem.

Definition at line 339 of file InstrumentItems.cpp.

340 {
341  s.assertVersion(0);
342  Serialize::rwBaseClass<InstrumentItem>(s, "InstrumentItem", this);
343  Serialize::rwSelected<DetectorItemCatalog>(s, m_detectorItem);
344 }
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
Definition: Streamer.cpp:26

References Streamer::assertVersion(), and m_detectorItem.

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:

◆ setDetectorType()

template<typename T >
T * Instrument2DItem::setDetectorType

Definition at line 212 of file InstrumentItems.h.

213 {
214  m_detectorItem.set<T>();
215  return dynamic_cast<T*>(m_detectorItem.get());
216 }

◆ 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()

virtual std::vector<int> InstrumentItem::shape ( ) const
pure virtualinherited

◆ updateToRealData()

virtual void InstrumentItem::updateToRealData ( const RealDataItem item)
pure virtualinherited

◆ 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_detectorItem

SelectionProperty<DetectorItem*> Instrument2DItem::m_detectorItem
protected

Definition at line 170 of file InstrumentItems.h.

Referenced by Instrument2DItem(), detectorItem(), detectorSelection(), and serialize().

◆ 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: