Dear Rooters, I cannot see the plot I draw() using the following procedure
that I put in my class' method Deco::PDistrib() (I generated Deco.C con
MakeClass)
void Deco::PDistrib(double pmin, double pmax)
{
TFile *hfile = new TFile("Pdist.root","RECREATE","DATA");
_pmin = pmin; _pmax=pmax;
Int_t nentries = Int_t(fChain->GetEntries());
TH1F *hp = new TH1F("hp","P distrib",_nbin,pmin,pmax);
double areamin=100000,areamax=0;
Int_t nbytes = 0, nb = 0;
for (Int_t jentry=0; jentry<nentries;jentry++) {
Int_t ientry = LoadTree(jentry);
nb = fChain->GetEntry(jentry); nbytes += nb;
// if (Cut(ientry) < 0) continue;
hp->Fill(tp);
}
hp->Write();
hfile->Close();
TCanvas *nc = new TCanvas("nc");
hp->Draw("");
}
The fact is that the plot exist but does not appear in the canvas!
I think that the problem is in creating and closing of TFile *hfile.
I tried to change the position of the line
TFile *hfile = new TFile("Pdist.root","RECREATE","DATA");
postponing it after the iteration over "jentry" but, naturally, it is the
same!
Neither mooving the lines
TCanvas *nc = new TCanvas("nc");
hp->Draw("");
out from the "scope"
TFile *hfile = new TFile("Pdist.root","RECREATE","DATA");
...
hfile->Close();
but it yelded the same result: no plot on the screen.
Why does it happen?
Which mistake do I commit?
Thanks and Cheers, Tommaso
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:08 MET