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

Clipboard: rename get/put for clarity

parent 25d4a095
Pipeline #1086975 passed with stages
in 15 minutes and 56 seconds
......@@ -51,13 +51,13 @@ namespace corryvreckan {
* @param objects Shared pointer to vector of objects to be stored
* @param key Identifying key for this set of objects. Defaults to empty key
*/
template <typename T> void put(std::shared_ptr<std::vector<T*>> objects, const std::string& key = "");
template <typename T> void putData(std::shared_ptr<std::vector<T*>> objects, const std::string& key = "");
/**
* @brief Method to retrieve objects from the clipboard
* @param key Identifying key of objects to be fetched. Defaults to empty key
*/
template <typename T> std::shared_ptr<std::vector<T*>> get(const std::string& key = "") const;
template <typename T> std::shared_ptr<std::vector<T*>> getData(const std::string& key = "") const;
/**
* @brief Check whether an event has been defined
......
namespace corryvreckan {
template <typename T> void Clipboard::put(std::shared_ptr<std::vector<T*>> objects, const std::string& key) {
template <typename T> void Clipboard::putData(std::shared_ptr<std::vector<T*>> objects, const std::string& key) {
// Do not insert empty sets:
if(objects->empty()) {
return;
......@@ -22,7 +22,7 @@ namespace corryvreckan {
}
}
template <typename T> std::shared_ptr<std::vector<T*>> Clipboard::get(const std::string& key) const {
template <typename T> std::shared_ptr<std::vector<T*>> Clipboard::getData(const std::string& key) const {
if(m_data.count(typeid(T)) == 0 || m_data.at(typeid(T)).count(key) == 0) {
return nullptr;
}
......
......@@ -574,7 +574,7 @@ void ModuleManager::run() {
}
// Print statistics:
auto tracks = m_clipboard->get<Track>();
auto tracks = m_clipboard->getData<Track>();
m_tracks += (tracks == nullptr ? 0 : static_cast<int>(tracks->size()));
if(m_events % 100 == 0) {
......
......@@ -58,7 +58,7 @@ void AlignmentDUTResidual::initialise() {
StatusCode AlignmentDUTResidual::run(std::shared_ptr<Clipboard> clipboard) {
// Get the tracks
auto tracks = clipboard->get<Track>();
auto tracks = clipboard->getData<Track>();
if(tracks == nullptr) {
return StatusCode::Success;
}
......
......@@ -69,7 +69,7 @@ void AlignmentMillepede::initialise() {
StatusCode AlignmentMillepede::run(std::shared_ptr<Clipboard> clipboard) {
// Get the tracks
auto tracks = clipboard->get<Track>();
auto tracks = clipboard->getData<Track>();
if(tracks == nullptr) {
return StatusCode::Success;
}
......
......@@ -33,7 +33,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>();
auto tracks = clipboard->getData<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<Cluster>(m_detector->name());
auto clusters = clipboard->getData<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>();
auto tracks = clipboard->getData<Track>();
if(tracks == nullptr) {
LOG(DEBUG) << "No tracks on the clipboard";
return StatusCode::Success;
......
......@@ -338,7 +338,7 @@ void AnalysisDUT::initialise() {
StatusCode AnalysisDUT::run(std::shared_ptr<Clipboard> clipboard) {
// Get the telescope tracks from the clipboard
auto tracks = clipboard->get<Track>();
auto tracks = clipboard->getData<Track>();
if(tracks == nullptr) {
LOG(DEBUG) << "No tracks on the clipboard";
return StatusCode::Success;
......
......@@ -172,7 +172,7 @@ void AnalysisEfficiency::initialise() {
StatusCode AnalysisEfficiency::run(std::shared_ptr<Clipboard> clipboard) {
// Get the telescope tracks from the clipboard
auto tracks = clipboard->get<Track>();
auto tracks = clipboard->getData<Track>();
if(tracks == nullptr) {
LOG(DEBUG) << "No tracks on the clipboard";
return StatusCode::Success;
......@@ -239,7 +239,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>(m_detector->name());
auto clusters = clipboard->getData<Cluster>(m_detector->name());
if(clusters == nullptr) {
LOG(DEBUG) << " - no DUT clusters";
} else {
......@@ -310,7 +310,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>(m_detector->name());
auto pixels = clipboard->getData<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<SpidrSignal>(m_detector->name());
auto spidrData = clipboard->getData<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>(m_detector->name());
auto clusters = clipboard->getData<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<Track>();
auto tracks = clipboard->getData<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>(name);
auto mcParticles = clipboard->getData<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>(detector->name());
auto mcParticles = clipboard->getData<MCParticle>(detector->name());
if(mcParticles == nullptr) {
continue;
}
......
......@@ -361,7 +361,7 @@ void AnalysisTimingATLASpix::initialise() {
StatusCode AnalysisTimingATLASpix::run(std::shared_ptr<Clipboard> clipboard) {
// Get the telescope tracks from the clipboard
auto tracks = clipboard->get<Track>();
auto tracks = clipboard->getData<Track>();
if(tracks == nullptr) {
LOG(DEBUG) << "No tracks on the clipboard";
return StatusCode::Success;
......@@ -424,7 +424,7 @@ StatusCode AnalysisTimingATLASpix::run(std::shared_ptr<Clipboard> clipboard) {
total_tracks++;
// Get the DUT clusters from the clipboard
auto clusters = clipboard->get<Cluster>(m_detector->name());
auto clusters = clipboard->getData<Cluster>(m_detector->name());
if(clusters == nullptr) {
LOG(DEBUG) << " - no DUT clusters";
} else {
......
......@@ -41,7 +41,7 @@ bool Clustering4D::sortByTime(Pixel* pixel1, Pixel* pixel2) {
StatusCode Clustering4D::run(std::shared_ptr<Clipboard> clipboard) {
// Get the pixels
auto pixels = clipboard->get<Pixel>(m_detector->name());
auto pixels = clipboard->getData<Pixel>(m_detector->name());
if(pixels == nullptr) {
LOG(DEBUG) << "Detector " << m_detector->name() << " does not have any pixels on the clipboard";
return StatusCode::Success;
......@@ -122,7 +122,7 @@ StatusCode Clustering4D::run(std::shared_ptr<Clipboard> clipboard) {
clusterMultiplicity->Fill(static_cast<double>(deviceClusters->size()));
// Put the clusters on the clipboard
clipboard->put(deviceClusters, m_detector->name());
clipboard->putData(deviceClusters, m_detector->name());
LOG(DEBUG) << "Made " << deviceClusters->size() << " clusters for device " << m_detector->name();
return StatusCode::Success;
......
......@@ -50,7 +50,7 @@ void ClusteringSpatial::initialise() {
StatusCode ClusteringSpatial::run(std::shared_ptr<Clipboard> clipboard) {
// Get the pixels
auto pixels = clipboard->get<Pixel>(m_detector->name());
auto pixels = clipboard->getData<Pixel>(m_detector->name());
if(pixels == nullptr) {
LOG(DEBUG) << "Detector " << m_detector->name() << " does not have any pixels on the clipboard";
return StatusCode::Success;
......@@ -160,7 +160,7 @@ StatusCode ClusteringSpatial::run(std::shared_ptr<Clipboard> clipboard) {
deviceClusters->push_back(cluster);
}
clipboard->put(deviceClusters, m_detector->name());
clipboard->putData(deviceClusters, m_detector->name());
LOG(DEBUG) << "Put " << deviceClusters->size() << " clusters on the clipboard for detector " << m_detector->name()
<< ". From " << pixels->size() << " pixels";
......
......@@ -75,14 +75,14 @@ void DUTAssociation::initialise() {
StatusCode DUTAssociation::run(std::shared_ptr<Clipboard> clipboard) {
// Get the tracks from the clipboard
auto tracks = clipboard->get<Track>();
auto tracks = clipboard->getData<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>(m_detector->name());
auto clusters = clipboard->getData<Cluster>(m_detector->name());
// Loop over all tracks
for(auto& track : (*tracks)) {
......
......@@ -74,7 +74,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>();
auto tracks = clipboard->getData<Track>();
if(tracks == nullptr) {
LOG(DEBUG) << "No tracks on the clipboard";
return StatusCode::Success;
......
......@@ -76,7 +76,7 @@ void EtaCorrection::applyEta(Cluster* cluster) {
StatusCode EtaCorrection::run(std::shared_ptr<Clipboard> clipboard) {
// Get the clusters
auto clusters = clipboard->get<Cluster>(m_detector->name());
auto clusters = clipboard->getData<Cluster>(m_detector->name());
if(clusters == nullptr) {
LOG(DEBUG) << "Detector " << m_detector->name() << " does not have any clusters on the clipboard";
return StatusCode::Success;
......
......@@ -290,7 +290,7 @@ StatusCode EventLoaderATLASpix::run(std::shared_ptr<Clipboard> clipboard) {
hPixelMultiplicity->Fill(static_cast<double>(pixels->size()));
// Put the data on the clipboard
clipboard->put(pixels, m_detector->name());
clipboard->putData(pixels, m_detector->name());
if(pixels->empty()) {
LOG(DEBUG) << "Returning <NoData> status, no hits found.";
......
......@@ -125,7 +125,7 @@ StatusCode EventLoaderCLICpix::run(std::shared_ptr<Clipboard> clipboard) {
LOG(TRACE) << "Loaded " << npixels << " pixels";
// Put the data on the clipboard
clipboard->put(pixels, m_detector->name());
clipboard->putData(pixels, m_detector->name());
// Fill histograms
hPixelMultiplicity->Fill(npixels);
......
......@@ -301,7 +301,7 @@ StatusCode EventLoaderCLICpix2::run(std::shared_ptr<Clipboard> clipboard) {
clipboard->putEvent(std::make_shared<Event>(shutterStartTime, shutterStopTime));
// Put the data on the clipboard
clipboard->put(pixels, m_detector->name());
clipboard->putData(pixels, m_detector->name());
if(pixels->empty()) {
return StatusCode::NoData;
......
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