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

OnlineMon: improve updating behavior

parent a7e33f33
......@@ -8,7 +8,7 @@ using namespace std;
OnlineMonitor::OnlineMonitor(Configuration config, std::vector<std::shared_ptr<Detector>> detectors)
: Module(std::move(config), std::move(detectors)) {
canvasTitle = m_config.get<std::string>("canvasTitle", "Corryvreckan Testbeam Monitor");
updateNumber = m_config.get<int>("update", 500);
updateNumber = m_config.get<int>("update", 200);
// Set up overview plots:
canvas_overview = m_config.getMatrix<std::string>("Overview",
......@@ -109,32 +109,20 @@ void OnlineMonitor::initialise() {
eventNumber = 0;
}
StatusCode OnlineMonitor::run(std::shared_ptr<Clipboard> clipboard) {
StatusCode OnlineMonitor::run(std::shared_ptr<Clipboard>) {
// Draw all histograms
if(eventNumber % updateNumber == 0) {
gui->canvas->GetCanvas()->Paint();
gui->canvas->GetCanvas()->Update();
gui->Update();
eventNumber++;
}
gSystem->ProcessEvents();
// Get the tracks from the clipboard
Tracks* tracks = reinterpret_cast<Tracks*>(clipboard->get("tracks"));
if(tracks == nullptr) {
return Success;
}
// Otherwise increase the event number
// Increase the event number
eventNumber++;
return Success;
}
void OnlineMonitor::finalise() {
LOG(DEBUG) << "Analysed " << eventNumber << " events";
}
void OnlineMonitor::AddCanvas(std::string canvas_title, Matrix<std::string> canvas_plots) {
std::string canvas_name = canvas_title + "Canvas";
......
......@@ -34,7 +34,6 @@ namespace corryvreckan {
// Functions
void initialise();
StatusCode run(std::shared_ptr<Clipboard> clipboard);
void finalise();
// Application to allow display persistancy
TApplication* app;
......
......@@ -82,6 +82,11 @@ namespace corryvreckan {
// Exit the monitoring
inline void Exit() { raise(SIGINT); }
inline void Update() {
canvas->GetCanvas()->Paint();
canvas->GetCanvas()->Update();
}
// ROOT I/O class definition - update version number when you change this class!
ClassDef(GuiDisplay, 2)
};
......
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