Hi guys,
I’m trying to do a simple online display - a histogram that every second updates with new data arriving.
I did a sample code that reads a tree file that gets update on the go by the daq process (different c++ program)
How do i get the histogram to fill again and redraw? also how do i make my canvas responding while waiting for new data to arrive?
for testing i just want the hist to fill random and redraw itself every second.
i’m running the file with .x OnlineViewer.C
[code]void OnlineViewer()
{
TH1F * OccupancyHist = new TH1F(“Occupancy”,“Occupancy”,200,-5,5);
//Creating the gui canvases
TCanvas cOccupancy("Occupancy","Occupancy",0,0,1000,700);
cOccupancy.cd();
cOccupancy.Update();
OccupancyHist->FillRandom("gaus");
OccupancyHist->Draw();
cOccupancy.Update();
while ( true )
{
gSystem->Sleep(1000);
OccupancyHist->FillRandom("gaus");
cOccupancy.cd();
OccupancyHist->Draw();
}
}[/code]
all i’m getting now is a frozen canvas that doesn’t updates at all.
I realize that my problem is fundamental so i would love to get some guidelines & better practices.
Thanks