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
c4ab25c7
Commit
c4ab25c7
authored
May 21, 2019
by
Simon Spannagel
Browse files
Clipboard: use type directly as template param, not the vector of it
parent
08bb6b42
Changes
24
Hide whitespace changes
Inline
Side-by-side
src/core/clipboard/Clipboard.hpp
View file @
c4ab25c7
...
...
@@ -50,7 +50,7 @@ namespace corryvreckan {
* @param type Type of the object collection to be stored
* @param Objects vector of Objects to store
*/
template
<
typename
T
>
void
put
(
std
::
shared_ptr
<
T
>
objects
,
const
std
::
string
&
key
=
""
);
template
<
typename
T
>
void
put
(
std
::
shared_ptr
<
std
::
vector
<
T
*>
>
objects
,
const
std
::
string
&
key
=
""
);
/**
* @brief Retrieve objects from the clipboard
...
...
@@ -58,7 +58,7 @@ namespace corryvreckan {
* @param type Type of objects to be retrieved
* @return Vector of Object pointers
*/
template
<
typename
T
>
std
::
shared_ptr
<
T
>
get
(
const
std
::
string
&
key
=
""
)
const
;
template
<
typename
T
>
std
::
shared_ptr
<
std
::
vector
<
T
*>
>
get
(
const
std
::
string
&
key
=
""
)
const
;
/**
* @brief Check whether an event has been defined
...
...
src/core/clipboard/Clipboard.tpp
View file @
c4ab25c7
namespace
corryvreckan
{
template
<
typename
T
>
void
Clipboard
::
put
(
std
::
shared_ptr
<
T
>
objects
,
const
std
::
string
&
key
)
{
template
<
typename
T
>
void
Clipboard
::
put
(
std
::
shared_ptr
<
std
::
vector
<
T
*>
>
objects
,
const
std
::
string
&
key
)
{
// Do not insert empty sets:
if
(
objects
->
empty
())
{
return
;
...
...
@@ -22,11 +22,11 @@ namespace corryvreckan {
}
}
template
<
typename
T
>
std
::
shared_ptr
<
T
>
Clipboard
::
get
(
const
std
::
string
&
key
)
const
{
template
<
typename
T
>
std
::
shared_ptr
<
std
::
vector
<
T
*>
>
Clipboard
::
get
(
const
std
::
string
&
key
)
const
{
if
(
m_data
.
count
(
typeid
(
T
))
==
0
||
m_data
.
at
(
typeid
(
T
)).
count
(
key
)
==
0
)
{
return
nullptr
;
}
return
std
::
static_pointer_cast
<
T
>
(
m_data
.
at
(
typeid
(
T
)).
at
(
key
));
return
std
::
static_pointer_cast
<
std
::
vector
<
T
*>
>
(
m_data
.
at
(
typeid
(
T
)).
at
(
key
));
}
}
// namespace corryvreckan
src/modules/AlignmentDUTResidual/AlignmentDUTResidual.cpp
View file @
c4ab25c7
...
...
@@ -59,7 +59,7 @@ void AlignmentDUTResidual::initialise() {
StatusCode
AlignmentDUTResidual
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the tracks
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
return
StatusCode
::
Success
;
}
...
...
src/modules/AlignmentMillepede/AlignmentMillepede.cpp
View file @
c4ab25c7
...
...
@@ -70,7 +70,7 @@ void AlignmentMillepede::initialise() {
StatusCode
AlignmentMillepede
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the tracks
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
return
StatusCode
::
Success
;
}
...
...
src/modules/AlignmentTrackChi2/AlignmentTrackChi2.cpp
View file @
c4ab25c7
...
...
@@ -34,7 +34,7 @@ AlignmentTrackChi2::AlignmentTrackChi2(Configuration config, std::vector<std::sh
StatusCode
AlignmentTrackChi2
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the tracks
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
return
StatusCode
::
Success
;
}
...
...
src/modules/AnalysisCLICpix/AnalysisCLICpix.cpp
View file @
c4ab25c7
...
...
@@ -219,7 +219,7 @@ void AnalysisCLICpix::initialise() {
StatusCode
AnalysisCLICpix
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the clicpix clusters in this event
auto
clusters
=
clipboard
->
get
<
Cluster
s
>
(
m_detector
->
name
());
auto
clusters
=
clipboard
->
get
<
Cluster
>
(
m_detector
->
name
());
if
(
clusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No clusters for "
<<
m_detector
->
name
()
<<
" on the clipboard"
;
return
StatusCode
::
Success
;
...
...
@@ -236,7 +236,7 @@ StatusCode AnalysisCLICpix::run(std::shared_ptr<Clipboard> clipboard) {
fillClusterHistos
(
clusters
);
// Get the tracks in this event
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No tracks on the clipboard"
;
return
StatusCode
::
Success
;
...
...
src/modules/AnalysisDUT/AnalysisDUT.cpp
View file @
c4ab25c7
...
...
@@ -200,7 +200,7 @@ void AnalysisDUT::initialise() {
StatusCode
AnalysisDUT
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the telescope tracks from the clipboard
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No tracks on the clipboard"
;
return
StatusCode
::
Success
;
...
...
@@ -264,7 +264,7 @@ StatusCode AnalysisDUT::run(std::shared_ptr<Clipboard> clipboard) {
auto
ymod
=
static_cast
<
double
>
(
Units
::
convert
(
inpixel
.
Y
(),
"um"
));
// Get the DUT clusters from the clipboard
auto
clusters
=
clipboard
->
get
<
Cluster
s
>
(
m_detector
->
name
());
auto
clusters
=
clipboard
->
get
<
Cluster
>
(
m_detector
->
name
());
if
(
clusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
" - no DUT clusters"
;
}
else
{
...
...
src/modules/AnalysisEfficiency/AnalysisEfficiency.cpp
View file @
c4ab25c7
...
...
@@ -165,7 +165,7 @@ void AnalysisEfficiency::initialise() {
StatusCode
AnalysisEfficiency
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the telescope tracks from the clipboard
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No tracks on the clipboard"
;
return
StatusCode
::
Success
;
...
...
@@ -232,7 +232,7 @@ StatusCode AnalysisEfficiency::run(std::shared_ptr<Clipboard> clipboard) {
auto
ymod
=
static_cast
<
double
>
(
Units
::
convert
(
inpixel
.
Y
(),
"um"
));
// Get the DUT clusters from the clipboard
auto
clusters
=
clipboard
->
get
<
Cluster
s
>
(
m_detector
->
name
());
auto
clusters
=
clipboard
->
get
<
Cluster
>
(
m_detector
->
name
());
if
(
clusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
" - no DUT clusters"
;
}
else
{
...
...
@@ -303,7 +303,7 @@ StatusCode AnalysisEfficiency::run(std::shared_ptr<Clipboard> clipboard) {
// Before going to the next event, loop over all pixels (all hits incl. noise)
// and fill matrix with timestamps of previous pixels.
auto
pixels
=
clipboard
->
get
<
Pixel
s
>
(
m_detector
->
name
());
auto
pixels
=
clipboard
->
get
<
Pixel
>
(
m_detector
->
name
());
if
(
pixels
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"Detector "
<<
m_detector
->
name
()
<<
" does not have any pixels on the clipboard"
;
return
StatusCode
::
Success
;
...
...
src/modules/AnalysisPowerPulsing/AnalysisPowerPulsing.cpp
View file @
c4ab25c7
...
...
@@ -91,7 +91,7 @@ StatusCode AnalysisPowerPulsing::run(std::shared_ptr<Clipboard> clipboard) {
*/
// Now update the power pulsing with any new signals
auto
spidrData
=
clipboard
->
get
<
SpidrSignal
s
>
(
m_detector
->
name
());
auto
spidrData
=
clipboard
->
get
<
SpidrSignal
>
(
m_detector
->
name
());
// If there are new signals
if
(
spidrData
!=
nullptr
)
{
...
...
@@ -135,7 +135,7 @@ StatusCode AnalysisPowerPulsing::run(std::shared_ptr<Clipboard> clipboard) {
}
// Get the DUT clusters from the clipboard
auto
clusters
=
clipboard
->
get
<
Cluster
s
>
(
m_detector
->
name
());
auto
clusters
=
clipboard
->
get
<
Cluster
>
(
m_detector
->
name
());
if
(
clusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No DUT clusters on the clipboard!"
;
return
StatusCode
::
Success
;
...
...
src/modules/AnalysisTelescope/AnalysisTelescope.cpp
View file @
c4ab25c7
...
...
@@ -75,7 +75,7 @@ ROOT::Math::XYZPoint AnalysisTelescope::closestApproach(ROOT::Math::XYZPoint pos
StatusCode
AnalysisTelescope
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the tracks from the clipboard
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No tracks on the clipboard"
;
return
StatusCode
::
Success
;
...
...
@@ -104,7 +104,7 @@ StatusCode AnalysisTelescope::run(std::shared_ptr<Clipboard> clipboard) {
telescopeResidualsY
[
name
]
->
Fill
(
cluster
->
global
().
y
()
-
intercept
.
Y
());
// Get the MC particles from the clipboard
auto
mcParticles
=
clipboard
->
get
<
MCParticle
s
>
(
name
);
auto
mcParticles
=
clipboard
->
get
<
MCParticle
>
(
name
);
if
(
mcParticles
==
nullptr
)
{
continue
;
}
...
...
@@ -123,7 +123,7 @@ StatusCode AnalysisTelescope::run(std::shared_ptr<Clipboard> clipboard) {
}
// Get the MC particles from the clipboard
auto
mcParticles
=
clipboard
->
get
<
MCParticle
s
>
(
detector
->
name
());
auto
mcParticles
=
clipboard
->
get
<
MCParticle
>
(
detector
->
name
());
if
(
mcParticles
==
nullptr
)
{
continue
;
}
...
...
src/modules/AnalysisTimingATLASpix/AnalysisTimingATLASpix.cpp
View file @
c4ab25c7
...
...
@@ -355,7 +355,7 @@ void AnalysisTimingATLASpix::initialise() {
StatusCode
AnalysisTimingATLASpix
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the telescope tracks from the clipboard
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No tracks on the clipboard"
;
return
StatusCode
::
Success
;
...
...
@@ -418,7 +418,7 @@ StatusCode AnalysisTimingATLASpix::run(std::shared_ptr<Clipboard> clipboard) {
total_tracks
++
;
// Get the DUT clusters from the clipboard
auto
clusters
=
clipboard
->
get
<
Cluster
s
>
(
m_detector
->
name
());
auto
clusters
=
clipboard
->
get
<
Cluster
>
(
m_detector
->
name
());
if
(
clusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
" - no DUT clusters"
;
}
else
{
...
...
src/modules/Clustering4D/Clustering4D.cpp
View file @
c4ab25c7
...
...
@@ -34,7 +34,7 @@ bool Clustering4D::sortByTime(Pixel* pixel1, Pixel* pixel2) {
StatusCode
Clustering4D
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the pixels
auto
pixels
=
clipboard
->
get
<
Pixel
s
>
(
m_detector
->
name
());
auto
pixels
=
clipboard
->
get
<
Pixel
>
(
m_detector
->
name
());
if
(
pixels
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"Detector "
<<
m_detector
->
name
()
<<
" does not have any pixels on the clipboard"
;
return
StatusCode
::
Success
;
...
...
src/modules/ClusteringSpatial/ClusteringSpatial.cpp
View file @
c4ab25c7
...
...
@@ -52,7 +52,7 @@ void ClusteringSpatial::initialise() {
StatusCode
ClusteringSpatial
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the pixels
auto
pixels
=
clipboard
->
get
<
Pixel
s
>
(
m_detector
->
name
());
auto
pixels
=
clipboard
->
get
<
Pixel
>
(
m_detector
->
name
());
if
(
pixels
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"Detector "
<<
m_detector
->
name
()
<<
" does not have any pixels on the clipboard"
;
return
StatusCode
::
Success
;
...
...
src/modules/DUTAssociation/DUTAssociation.cpp
View file @
c4ab25c7
...
...
@@ -13,14 +13,14 @@ DUTAssociation::DUTAssociation(Configuration config, std::shared_ptr<Detector> d
StatusCode
DUTAssociation
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the tracks from the clipboard
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No tracks on the clipboard"
;
return
StatusCode
::
Success
;
}
// Get the DUT clusters from the clipboard
auto
clusters
=
clipboard
->
get
<
Cluster
s
>
(
m_detector
->
name
());
auto
clusters
=
clipboard
->
get
<
Cluster
>
(
m_detector
->
name
());
if
(
clusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No DUT clusters on the clipboard"
;
return
StatusCode
::
Success
;
...
...
src/modules/EtaCalculation/EtaCalculation.cpp
View file @
c4ab25c7
...
...
@@ -70,7 +70,7 @@ void EtaCalculation::calculateEta(Track* track, Cluster* cluster) {
StatusCode
EtaCalculation
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the tracks from the clipboard
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No tracks on the clipboard"
;
return
StatusCode
::
Success
;
...
...
src/modules/EtaCorrection/EtaCorrection.cpp
View file @
c4ab25c7
...
...
@@ -81,7 +81,7 @@ void EtaCorrection::applyEta(Cluster* cluster) {
StatusCode
EtaCorrection
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the clusters
auto
clusters
=
clipboard
->
get
<
Cluster
s
>
(
m_detector
->
name
());
auto
clusters
=
clipboard
->
get
<
Cluster
>
(
m_detector
->
name
());
if
(
clusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"Detector "
<<
m_detector
->
name
()
<<
" does not have any clusters on the clipboard"
;
return
StatusCode
::
Success
;
...
...
src/modules/ImproveReferenceTimestamp/ImproveReferenceTimestamp.cpp
View file @
c4ab25c7
...
...
@@ -22,7 +22,7 @@ StatusCode ImproveReferenceTimestamp::run(std::shared_ptr<Clipboard> clipboard)
std
::
vector
<
double
>
trigger_times
;
// Get trigger signals
auto
spidrData
=
clipboard
->
get
<
SpidrSignal
s
>
(
m_source
);
auto
spidrData
=
clipboard
->
get
<
SpidrSignal
>
(
m_source
);
if
(
spidrData
!=
nullptr
)
{
// Loop over all signals registered
for
(
auto
&
signal
:
(
*
spidrData
))
{
...
...
@@ -34,7 +34,7 @@ StatusCode ImproveReferenceTimestamp::run(std::shared_ptr<Clipboard> clipboard)
}
// Get the tracks from the clipboard
auto
tracks
=
clipboard
->
get
<
Track
s
>
();
auto
tracks
=
clipboard
->
get
<
Track
>
();
if
(
tracks
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"No tracks on the clipboard"
;
return
StatusCode
::
Success
;
...
...
src/modules/MaskCreator/MaskCreator.cpp
View file @
c4ab25c7
...
...
@@ -90,7 +90,7 @@ StatusCode MaskCreator::run(std::shared_ptr<Clipboard> clipboard) {
m_numEvents
++
;
// Get the pixels
auto
pixels
=
clipboard
->
get
<
Pixel
s
>
(
m_detector
->
name
());
auto
pixels
=
clipboard
->
get
<
Pixel
>
(
m_detector
->
name
());
if
(
pixels
==
nullptr
)
{
LOG
(
TRACE
)
<<
"Detector "
<<
m_detector
->
name
()
<<
" does not have any pixels on the clipboard"
;
return
StatusCode
::
NoData
;
...
...
src/modules/MaskCreatorTimepix3/MaskCreatorTimepix3.cpp
View file @
c4ab25c7
...
...
@@ -10,7 +10,7 @@ MaskCreatorTimepix3::MaskCreatorTimepix3(Configuration config, std::shared_ptr<D
StatusCode
MaskCreatorTimepix3
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the pixels
auto
pixels
=
clipboard
->
get
<
Pixel
s
>
(
m_detector
->
name
());
auto
pixels
=
clipboard
->
get
<
Pixel
>
(
m_detector
->
name
());
if
(
pixels
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"Detector "
<<
m_detector
->
name
()
<<
" does not have any pixels on the clipboard"
;
return
StatusCode
::
NoData
;
...
...
src/modules/Prealignment/Prealignment.cpp
View file @
c4ab25c7
...
...
@@ -51,7 +51,7 @@ void Prealignment::initialise() {
StatusCode
Prealignment
::
run
(
std
::
shared_ptr
<
Clipboard
>
clipboard
)
{
// Get the clusters
auto
clusters
=
clipboard
->
get
<
Cluster
s
>
(
m_detector
->
name
());
auto
clusters
=
clipboard
->
get
<
Cluster
>
(
m_detector
->
name
());
if
(
clusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"Detector "
<<
m_detector
->
name
()
<<
" does not have any clusters on the clipboard"
;
return
StatusCode
::
Success
;
...
...
@@ -59,7 +59,7 @@ StatusCode Prealignment::run(std::shared_ptr<Clipboard> clipboard) {
// Get clusters from reference detector
auto
reference
=
get_reference
();
auto
referenceClusters
=
clipboard
->
get
<
Cluster
s
>
(
reference
->
name
());
auto
referenceClusters
=
clipboard
->
get
<
Cluster
>
(
reference
->
name
());
if
(
referenceClusters
==
nullptr
)
{
LOG
(
DEBUG
)
<<
"Reference detector "
<<
reference
->
name
()
<<
" does not have any clusters on the clipboard"
;
return
StatusCode
::
Success
;
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
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