Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
7926e251
Commit
7926e251
authored
4 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
Introduce DetectorContext as a replacement of DetectorElements
parent
aa43bc92
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Core/Instrument/DetectorContext.cpp
+49
-0
49 additions, 0 deletions
Core/Instrument/DetectorContext.cpp
Core/Instrument/DetectorContext.h
+47
-0
47 additions, 0 deletions
Core/Instrument/DetectorContext.h
with
96 additions
and
0 deletions
Core/Instrument/DetectorContext.cpp
0 → 100644
+
49
−
0
View file @
7926e251
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/Instrument/DetectorContext.cpp
//! @brief Implements DetectorContext class.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************** //
#include
"DetectorContext.h"
#include
"IDetector2D.h"
DetectorContext
::
DetectorContext
(
const
IDetector2D
*
detector
)
{
setup_context
(
detector
);
}
size_t
DetectorContext
::
numberOfSimulationElements
()
const
{
return
active_indices
.
size
();
}
//! Creates pixel for given element index. Element index is sequetial index in a vector
//! of SimulationElements. Corresponds to sequence of detector bins inside ROI and outside
//! of masked areas.
std
::
unique_ptr
<
IPixel
>
DetectorContext
::
createPixel
(
size_t
element_index
)
const
{
return
std
::
unique_ptr
<
IPixel
>
(
pixels
[
element_index
]
->
clone
());
}
size_t
DetectorContext
::
detectorIndex
(
size_t
element_index
)
const
{
return
active_indices
[
element_index
];
}
void
DetectorContext
::
setup_context
(
const
IDetector2D
*
detector
)
{
active_indices
=
detector
->
active_indices
();
analyzer_operator
=
detector
->
detectionProperties
().
analyzerOperator
();
pixels
.
reserve
(
active_indices
.
size
());
for
(
auto
detector_index
:
active_indices
)
pixels
.
emplace_back
(
detector
->
createPixel
(
detector_index
));
}
This diff is collapsed.
Click to expand it.
Core/Instrument/DetectorContext.h
0 → 100644
+
47
−
0
View file @
7926e251
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/Instrument/DetectorContext.h
//! @brief Define DetectorContext class.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************** //
#ifndef DETECTORCONTEXT_H
#define DETECTORCONTEXT_H
#include
"EigenCore.h"
#include
"IPixel.h"
#include
"WinDllMacros.h"
#include
<memory>
#include
<vector>
class
IDetector2D
;
//! Holds precalculated information for faster SimulationElement generation.
//! @ingroup simulation
class
BA_CORE_API_
DetectorContext
{
public:
DetectorContext
(
const
IDetector2D
*
detector
);
size_t
numberOfSimulationElements
()
const
;
std
::
unique_ptr
<
IPixel
>
createPixel
(
size_t
element_index
)
const
;
size_t
detectorIndex
(
size_t
element_index
)
const
;
private:
void
setup_context
(
const
IDetector2D
*
detector
);
Eigen
::
Matrix2cd
analyzer_operator
;
std
::
vector
<
std
::
unique_ptr
<
IPixel
>>
pixels
;
//! All unmasked pixels inside ROI.
std
::
vector
<
size_t
>
active_indices
;
//! The sequence of detector bin indices (unmasked, in ROI)
};
#endif // DETECTORCONTEXT_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment