Commit c4ab25c7 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Clipboard: use type directly as template param, not the vector of it

parent 08bb6b42
......@@ -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
......
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
......@@ -59,7 +59,7 @@ void AlignmentDUTResidual::initialise() {
StatusCode AlignmentDUTResidual::run(std::shared_ptr<Clipboard> clipboard) {
// Get the tracks
auto tracks = clipboard->get<Tracks>();
auto tracks = clipboard->get<Track>();
if(tracks == nullptr) {
return StatusCode::Success;
}
......
......@@ -70,7 +70,7 @@ void AlignmentMillepede::initialise() {
StatusCode AlignmentMillepede::run(std::shared_ptr<Clipboard> clipboard) {
// Get the tracks
auto tracks = clipboard->get<Tracks>();
auto tracks = clipboard->get<Track>();
if(tracks == nullptr) {
return StatusCode::Success;
}
......
......@@ -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<Tracks>();
auto tracks = clipboard->get<Track>();
if(tracks == nullptr) {
return StatusCode::Success;
}
......
......@@ -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<Clusters>(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<Tracks>();
auto tracks = clipboard->get<Track>();
if(tracks == nullptr) {
LOG(DEBUG) << "No tracks on the clipboard";
return StatusCode::Success;
......
......@@ -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<Tracks>();
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<Clusters>(m_detector->name());
auto clusters = clipboard->get<Cluster>(m_detector->name());
if(clusters == nullptr) {
LOG(DEBUG) << " - no DUT clusters";
} else {
......
......@@ -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<Tracks>();
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<Clusters>(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<Pixels>(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;
......
......@@ -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<SpidrSignals>(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<Clusters>(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;
......
......@@ -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<Tracks>();
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<MCParticles>(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<MCParticles>(detector->name());
auto mcParticles = clipboard->get<MCParticle>(detector->name());
if(mcParticles == nullptr) {
continue;
}
......
......@@ -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<Tracks>();
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<Clusters>(m_detector->name());
auto clusters = clipboard->get<Cluster>(m_detector->name());
if(clusters == nullptr) {
LOG(DEBUG) << " - no DUT clusters";
} else {
......
......@@ -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<Pixels>(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;
......
......@@ -52,7 +52,7 @@ void ClusteringSpatial::initialise() {
StatusCode ClusteringSpatial::run(std::shared_ptr<Clipboard> clipboard) {
// Get the pixels
auto pixels = clipboard->get<Pixels>(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;
......
......@@ -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<Tracks>();
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<Clusters>(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;
......
......@@ -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<Tracks>();
auto tracks = clipboard->get<Track>();
if(tracks == nullptr) {
LOG(DEBUG) << "No tracks on the clipboard";
return StatusCode::Success;
......
......@@ -81,7 +81,7 @@ void EtaCorrection::applyEta(Cluster* cluster) {
StatusCode EtaCorrection::run(std::shared_ptr<Clipboard> clipboard) {
// Get the clusters
auto clusters = clipboard->get<Clusters>(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;
......
......@@ -22,7 +22,7 @@ StatusCode ImproveReferenceTimestamp::run(std::shared_ptr<Clipboard> clipboard)
std::vector<double> trigger_times;
// Get trigger signals
auto spidrData = clipboard->get<SpidrSignals>(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<Tracks>();
auto tracks = clipboard->get<Track>();
if(tracks == nullptr) {
LOG(DEBUG) << "No tracks on the clipboard";
return StatusCode::Success;
......
......@@ -90,7 +90,7 @@ StatusCode MaskCreator::run(std::shared_ptr<Clipboard> clipboard) {
m_numEvents++;
// Get the pixels
auto pixels = clipboard->get<Pixels>(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;
......
......@@ -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<Pixels>(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;
......
......@@ -51,7 +51,7 @@ void Prealignment::initialise() {
StatusCode Prealignment::run(std::shared_ptr<Clipboard> clipboard) {
// Get the clusters
auto clusters = clipboard->get<Clusters>(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<Clusters>(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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment