00001 {
00002
00003
00004
00005
00006
00007
00008
00009 gROOT->Reset();
00010
00011
00012 TCanvas *c1;
00013 TPad *pad1, *pad2, *pad3;
00014 if (!gROOT->IsBatch()) {
00015 c1 = new TCanvas("c1","Shared Memory Consumer Example",200,10,700,780);
00016 pad1 = new TPad("pad1","This is pad1",0.02,0.52,0.98,0.98,21);
00017 pad2 = new TPad("pad2","This is pad2",0.02,0.02,0.48,0.48,21);
00018 pad3 = new TPad("pad3","This is pad3",0.52,0.02,0.98,0.48,21);
00019 pad1->Draw();
00020 pad2->Draw();
00021 pad3->Draw();
00022 }
00023
00024
00025 mfile = TMapFile::Create("hsimple.map");
00026
00027
00028 mfile->Print();
00029 mfile->ls();
00030
00031
00032 TH1F *hpx = 0;
00033 TH2F *hpxpy = 0;
00034 TProfile *hprof = 0;
00035
00036
00037
00038 Double_t oldentries = 0;
00039 while (1) {
00040 hpx = (TH1F *) mfile->Get("hpx", hpx);
00041 hpxpy = (TH2F *) mfile->Get("hpxpy", hpxpy);
00042 hprof = (TProfile *) mfile->Get("hprof", hprof);
00043 if (hpx->GetEntries() == oldentries) break;
00044 oldentries = hpx->GetEntries();
00045 if (!gROOT->IsBatch()) {
00046 pad1->cd();
00047 hpx->Draw();
00048 pad2->cd();
00049 hprof->Draw();
00050 pad3->cd();
00051 hpxpy->Draw("cont");
00052 c1->Modified();
00053 c1->Update();
00054 } else {
00055 printf("Entries, hpx=%d, Mean=%g, RMS=%g\n",hpx->GetEntries(),hpx->GetMean(),hpx->GetRMS());
00056 }
00057 gSystem->Sleep(100);
00058 if (gSystem->ProcessEvents())
00059 break;
00060 }
00061 }