Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
22a15378
Commit
22a15378
authored
Nov 06, 2018
by
Simon Spannagel
Browse files
DUTAssociation: make DUT_MODULE
parent
c57259ff
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/modules/DUTAssociation/CMakeLists.txt
View file @
22a15378
# Define module and return the generated name as MODULE_NAME
CORRYVRECKAN_
GLOBAL
_MODULE
(
MODULE_NAME
)
CORRYVRECKAN_
DUT
_MODULE
(
MODULE_NAME
)
# Add source files to library
CORRYVRECKAN_MODULE_SOURCES
(
${
MODULE_NAME
}
...
...
src/modules/DUTAssociation/DUTAssociation.cpp
View file @
22a15378
...
...
@@ -3,12 +3,11 @@
using
namespace
corryvreckan
;
using
namespace
std
;
DUTAssociation
::
DUTAssociation
(
Configuration
config
,
std
::
vector
<
std
::
shared_ptr
<
Detector
>
>
detector
s
)
:
Module
(
std
::
move
(
config
),
std
::
move
(
detector
s
)
)
{
DUTAssociation
::
DUTAssociation
(
Configuration
config
,
std
::
shared_ptr
<
Detector
>
detector
)
:
Module
(
std
::
move
(
config
),
detector
),
m_detector
(
detector
)
{
auto
det
=
get_dut
();
timingCut
=
m_config
.
get
<
double
>
(
"timingCut"
,
static_cast
<
double
>
(
Units
::
convert
(
200
,
"ns"
)));
spatialCut
=
m_config
.
get
<
XYVector
>
(
"spatialCut"
,
2
*
det
->
pitch
());
spatialCut
=
m_config
.
get
<
XYVector
>
(
"spatialCut"
,
2
*
m_
det
ector
->
pitch
());
}
StatusCode
DUTAssociation
::
run
(
Clipboard
*
clipboard
)
{
...
...
@@ -20,11 +19,8 @@ StatusCode DUTAssociation::run(Clipboard* clipboard) {
return
Success
;
}
// Get the DUT:
auto
dut
=
get_dut
();
// Get the DUT clusters from the clipboard
Clusters
*
clusters
=
reinterpret_cast
<
Clusters
*>
(
clipboard
->
get
(
dut
->
name
(),
"clusters"
));
Clusters
*
clusters
=
reinterpret_cast
<
Clusters
*>
(
clipboard
->
get
(
m_detector
->
name
(),
"clusters"
));
if
(
clusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No DUT clusters on the clipboard"
;
return
Success
;
...
...
src/modules/DUTAssociation/DUTAssociation.cpp.orig
deleted
100644 → 0
View file @
c57259ff
#include "DUTAssociation.h"
using namespace corryvreckan;
using namespace std;
DUTAssociation::DUTAssociation(Configuration config, std::vector<std::shared_ptr<Detector>> detectors)
: Module(std::move(config), std::move(detectors)) {
auto det = get_dut();
<<<<<<< HEAD
timingCut = m_config.get<double>("timingCut", static_cast<double>(Units::convert(200, "ns")));
=======
timingCut = m_config.get<double>("timingCut", Units::convert(200, "ns"));
>>>>>>> master
spatialCut = m_config.get<XYVector>("spatialCut", 2 * det->pitch());
}
StatusCode DUTAssociation::run(Clipboard* clipboard) {
// Get the tracks from the clipboard
Tracks* tracks = reinterpret_cast<Tracks*>(clipboard->get("tracks"));
if(tracks == nullptr) {
LOG(DEBUG) << "No tracks on the clipboard";
return Success;
}
// Get the DUT:
auto dut = get_dut();
// Get the DUT clusters from the clipboard
Clusters* clusters = reinterpret_cast<Clusters*>(clipboard->get(dut->name(), "clusters"));
if(clusters == nullptr) {
LOG(DEBUG) << "No DUT clusters on the clipboard";
return Success;
}
// Loop over all tracks
for(auto& track : (*tracks)) {
// Loop over all DUT clusters
for(auto& cluster : (*clusters)) {
// Check distance between track and cluster
ROOT::Math::XYZPoint intercept = track->intercept(cluster->globalZ());
double xdistance = intercept.X() - cluster->globalX();
double ydistance = intercept.Y() - cluster->globalY();
if(abs(xdistance) > spatialCut.x() || abs(ydistance) > spatialCut.y()) {
LOG(DEBUG) << "Discarding DUT cluster with distance (" << abs(xdistance) << "," << abs(ydistance) << ")";
continue;
}
// Check if the cluster is close in time
if(std::abs(cluster->timestamp() - track->timestamp()) > timingCut) {
continue;
}
LOG(DEBUG) << "Found associated cluster with distance (" << abs(xdistance) << "," << abs(ydistance) << ")";
track->addAssociatedCluster(cluster);
}
}
// Return value telling analysis to keep running
return Success;
}
src/modules/DUTAssociation/DUTAssociation.h
View file @
22a15378
...
...
@@ -17,14 +17,14 @@ namespace corryvreckan {
public:
// Constructors and destructors
DUTAssociation
(
Configuration
config
,
std
::
vector
<
std
::
shared_ptr
<
Detector
>
>
detector
s
);
DUTAssociation
(
Configuration
config
,
std
::
shared_ptr
<
Detector
>
detector
);
~
DUTAssociation
()
=
default
;
// Functions
StatusCode
run
(
Clipboard
*
clipboard
);
private:
std
::
s
tring
m_DUT
;
std
::
s
hared_ptr
<
Detector
>
m_detector
;
double
timingCut
;
ROOT
::
Math
::
XYVector
spatialCut
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment