Hi Ulrich,
In your function statistics_all below, you create an object
TH2F h1("h1",segchannel.c_str(),65,0,65,50,0,500);
that you then fill via tree.Draw
However, this object will be automatically deleted when you leave the
scope of this function.
Replace the call above by;
TH2F *h1 = new TH2F("h1"....
Rene Brun
Ulrich Husemann wrote:
>
> Hi Rene!
>
> Here is the macro:
> {
> #include<string>
> gROOT->Reset("a");
> TFile f1("./good_fcs/dpr/dpr_1_1_991030_006.root");
> TFile f2("./good_fcs/dpr/dpr_1_4_991030_006.root");
> TFile f3("./good_fcs/dpr/dpr_1_8_991030_006.root");
> TFile f4("./good_fcs/dpr/dpr_2_4_991030_006.root");
> TFile f5("./good_fcs/dpr/dpr_2_8_991030_006.root");
>
> TCanvas *c1 = new TCanvas("c1","PCU dual ported RAM readout with FCS
> test pattern",800,800);
> TPad *pad1 = new TPad("pad1","Segment 1 Channel
> 1",0.02,0.47,0.32,0.90,10);
> TPad *pad2 = new TPad("pad2","Segment 1 Channel
> 4",0.34,0.47,0.65,0.90,10);
> TPad *pad3 = new TPad("pad3","Segment 1 Channel
> 8",0.67,0.47,0.98,0.90,10);
> TPad *pad4 = new TPad("pad4","Segment 1 Channel
> 4",0.02,0.02,0.49,0.45,10);
> TPad *pad5 = new TPad("pad5","Segment 1 Channel
> 8",0.51,0.02,0.98,0.45,10);
> TPaveLabel *label1 = new TPaveLabel(0.02,0.92,0.58,0.98,"FCS Test
> pattern 6: ALL");
> label1->SetFillColor(29);
> label1->Draw();
>
> pad1->Draw();
> pad1->SetLogy();
> pad2->Draw();
> pad3->SetLogy();
> pad3->Draw();
> pad3->SetLogy();
> pad4->Draw();
> pad4->SetLogy();
> pad5->Draw();
> pad5->SetLogy();
>
> c1->SetFillColor(10);
> Int_t colors[]={9,8,7,6,5,1};
> gStyle->SetPalette(6,colors);
> gStyle->SetOptStat(11);
>
> for (Int_t i=1;i<6;++i) statistics_all(i,200);
> }
>
> void statistics_all(Int_t filenumber, Int_t readouts)
> {
> switch(filenumber)
> {
> case 1: f1.cd(); pad1->cd(); string segchannel("Seg. 1 Ch. 1 ");
> break;
> case 2: f2.cd(); pad2->cd(); string segchannel("Seg. 1 Ch. 4 ");
> break;
> case 3: f3.cd(); pad3->cd(); string segchannel("Seg. 1 Ch. 8 ");
> break;
> case 4: f4.cd(); pad4->cd(); string segchannel("Seg. 2 Ch. 4 ");
> break;
> case 5: f5.cd(); pad5->cd(); string segchannel("Seg. 2 Ch. 8 ");
> break;
> }
> segchannel.append("\ncontents of MU4 vs. BX[4..0]CN");
> TH2F h1("h1",segchannel.c_str(),65,0,65,50,0,500);
> switch (filenumber)
> {
> case 1: mytree.Draw("(mu4l+mu4m+mu4r):bx>>h1","bx>1","colz"); break;
> case 2: mytree.Draw("(mu4l+mu4m):bx>>h1","bx>1","colz"); break;
> case 3: mytree.Draw("(mu4l+mu4m):bx>>h1","bx>1","colz"); break;
> case 4: mytree.Draw("(mu4l+mu4r):bx>>h1","bx>1","colz"); break;
> case 5: mytree.Draw("(mu4l+mu4m):bx>>h1","bx>1","colz"); break;
> }
> gPad->Update();
> }
>
> First I load the funktion statistics_all via ".L", then I execute the main
> program.
>
> Ulrich
>
> On Thu, 11 Nov 1999, Rene Brun wrote:
>
> > Hi Ulrich,
> > My guess is that your histograms are destroyed somewhere in your
> > process.
> > Could you send me a simplified version of your macro ?
> >
> > Rene Brun
> >
> > Ulrich Husemann wrote:
> > >
> > > Dear Rooters!
> > >
> > > I try to write a macro to paint several histograms into different pads in
> > > a canvas. The procedure is the following:
> > > 1) create pads
> > > 2) pad.cd();
> > > 3) book histogram
> > > 4) Draw contents of some root file and pipe them into the histogram
> > >
> > > If I stop here, nothing is painted.
> > >
> > > But if I do a
> > >
> > > gPad->Update();
> > >
> > > I can see the histogram for a few milliseconds before it is gone (the
> > > frames and the stat box are still there).
> > >
> > > Ulrich
> >
>
> ----------------------------------------------------------------
> Ulrich Husemann room P2-02-407
> Experimentelle Physik Vb phone +49-231-755-3667
> Dortmund University fax +49-231-755-4547
> Otto-Hahn-Str. 4, D-44227 Dortmund
>
> e-mail: husemann@physik.uni-dortmund.de
> WWW: http://www.physik.uni-dortmund.de/herab/main.html
> ----------------------------------------------------------------
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET