Commit 3f5a73b3 authored by Jens Kroeger's avatar Jens Kroeger
Browse files

Merge branch 'status_px' into 'master'

Add number of pixels to status progress

See merge request !186
parents b3a2fbf1 d276e63a
Pipeline #1172623 passed with stages
in 20 minutes and 19 seconds
......@@ -59,6 +59,12 @@ namespace corryvreckan {
*/
template <typename T> std::shared_ptr<std::vector<T*>> getData(const std::string& key = "") const;
/**
* @brief Method to count the number of objects of a given type on the clipboard
* @param key Identifying key of objects to be counted. An empty key will count all objects available.
*/
template <typename T> size_t countObjects(const std::string& key = "") const;
/**
* @brief Check whether an event has been defined
* @return true if an event has been defined, false otherwise
......
......@@ -29,4 +29,21 @@ namespace corryvreckan {
return std::static_pointer_cast<std::vector<T*>>(m_data.at(typeid(T)).at(key));
}
template <typename T> size_t Clipboard::countObjects(const std::string& key) const {
size_t number_of_objects = 0;
// Check if we have anything of this type:
if(m_data.count(typeid(T)) != 0) {
// Decide whether we should count all or just the ones identidied by a key:
if(key.empty()) {
for(const auto& block : m_data.at(typeid(T))) {
number_of_objects += std::static_pointer_cast<std::vector<T*>>(block.second)->size();
}
} else if(m_data.at(typeid(T)).count(key) != 0) {
number_of_objects = std::static_pointer_cast<std::vector<T*>>(m_data.at(typeid(T)).at(key))->size();
}
}
return number_of_objects;
}
} // namespace corryvreckan
......@@ -517,6 +517,7 @@ void ModuleManager::run() {
LOG(STATUS) << "========================| Event loop |========================";
m_events = 0;
m_tracks = 0;
m_pixels = 0;
while(1) {
bool run = true;
......@@ -574,8 +575,8 @@ void ModuleManager::run() {
}
// Print statistics:
auto tracks = m_clipboard->getData<Track>();
m_tracks += (tracks == nullptr ? 0 : static_cast<int>(tracks->size()));
m_tracks += static_cast<int>(m_clipboard->countObjects<Track>());
m_pixels += static_cast<int>(m_clipboard->countObjects<Pixel>());
if(m_events % 100 == 0) {
......@@ -588,7 +589,9 @@ void ModuleManager::run() {
};
LOG_PROGRESS(STATUS, "event_loop")
<< "Ev: " << kilo_or_mega(m_events) << " Tr: " << kilo_or_mega(m_tracks) << " (" << std::setprecision(3)
<< "Ev: " << kilo_or_mega(m_events) << " "
<< "Px: " << kilo_or_mega(m_pixels) << " "
<< "Tr: " << kilo_or_mega(m_tracks) << " (" << std::setprecision(3)
<< (static_cast<double>(m_tracks) / m_events) << "/ev)"
<< (m_clipboard->isEventDefined()
? " t = " + Units::display(m_clipboard->getEvent()->start(), {"ns", "us", "ms", "s"})
......
......@@ -100,6 +100,7 @@ namespace corryvreckan {
std::unique_ptr<TFile> m_histogramFile;
int m_events;
int m_tracks;
int m_pixels;
/**
* @brief Create unique modules
......
......@@ -25,4 +25,4 @@ min_hits_on_track = 5
[AnalysisTelescope]
#DATASET timepix3tel_dut150um_ebeam120_sim
#PASS Ev: 3.3k Tr: 3.2k (0.957/ev) t = 33us
#PASS Ev: 3.3k Px: 70.2k Tr: 3.2k (0.957/ev) t = 33us
......@@ -19,4 +19,4 @@ min_hits_on_track = 5
[AnalysisTelescope]
#DATASET timepix3tel_ebeam120
#PASS Ev: 18.8k Tr: 197.4k (10.5/ev) t = 3.76s
#PASS Ev: 18.8k Px: 6.23M Tr: 197.4k (10.5/ev) t = 3.76s
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