Hi, May be this can help you.I took it from guitest.C pro() { TH2D *h1 = new TH2D("h1","h1", 100, -4, 4, 100, -4, 4 ); TH1D *p1 = h1->ProjectionX("pro_h1", 40, 50,"" ); TCanvas *c1 = new TCanvas("c1", "c1", 10, 20, 620, 300); TCanvas *c2 = new TCanvas("c2", "c2", 710, 20, 620, 300); c1->cd(); h1->Draw(); c2->cd(); p1->Draw(); const int kUPDATE = 100000; int cnt = 0; while( 1 ) { float px, py; gRandom->Rannor(px,py); h1->Fill(px,py); p1->Fill(px); cnt++; if (!(cnt % kUPDATE)) { c1->cd(); c1->Modified(); c1->Update(); c2->cd(); c2->Modified(); c2->Update(); } gSystem->ProcessEvents(); // handle GUI events } } cheers Ernesto. On Fri, 9 May 2003, Thomas Bretz wrote: > Hi all, > > I have some kind of online display in which I can display histograms > (TH?D drawn in a TRootEmbeddedCanvas). When our calculation is filling > the histogram I update the histogram continously (let's say each 5sec) > by calling pad->Modified() pad->Update() for the corresponding pad. This > works fine for the histograms we fill ourself, but how can I provide > online update of Projections of 2D histograms? I don't want to rebuild > the object every time. In principal it would be enough if I could update > the contants of a projection from the contants of its 'parent' > histogram. Any idea how I can do this (without Copy&Paste the code from > TH2::Project to my code)? > > Thanks in advance, > Thomas. > > >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET