Hi Sabine,
You were using option "O" instead of "0".
Anyhow, I have simplified your macro. See extract below.
Rene Brun
TFile f50("fit50.root");
//===> fit intercryostat gauche et droite
TF1 *fitetad1= new TF1("fitetad1","exp(12*x+[0])+[1]*x",0.0,1.5);
TF1 *fitetad2= new TF1("fitetad2","exp(-15*x+[0])+[1]*x",1.3,5.0);
myc->Divide(1,2);
myc->cd(1);
TH1F *pr_Evsetad = (TH1F*)f50.Get("pr_Evsetad");
TH1F *prsave = (TH1F*)pr_Evsetad->Clone("prsave");
prsave->Fit("fitetad1","","",0.0,1.2);
myc->cd(2);
pr_Evsetad->Fit("fitetad2","","",1.3,3.0);
myc->Update();
myc->Print("fit1etaphicutetacor50.eps");
On Tue, 6 Aug 2002, Sabine Crepe-Renaudin wrote:
>
> Thanks Rene, it works on the small routine I sent to you but not
> on fitest.c I have attached to this mail (you need the fit50.root file)
> and which is quite similar ...
> I don't see why ? because it's profile histos ?
> (I'm using version 3.01/06).
>
> Sabine.
>
> On Tue, 6 Aug 2002, Rene Brun wrote:
>
> > Hi Sabine,
> >
> > Look at the two lines modified below
> >
> > Rene Brun
> >
> >
> > {
> > gROOT->Reset();
> > const Int_t np = 49;
> > Float_t x[np] = {1.913521, 1.953769, 2.347435, 2.883654,
> > 3.493567,4.047560,4.337210, 4.364347, 4.563004, 5.054247,5.194183,
> > 5.380521, 5.303213, 5.384578, 5.563983,5.728500, 5.685752, 5.080029,
> > 4.251809, 3.372246,2.207432, 1.227541, 0.8597788,0.8220503,
> > 0.8046592,0.7684097,0.7469761,0.8019787,0.8362375,0.8744895,0.9143721,0.9462768,0.9285364,0.8954604,0.8410891,0.7853871,0.7100883,
> > 0.6938808,0.7363682,0.7032954,0.6029015,0.5600163,0.7477068,1.188785,
> > 1.938228,2.602717, 3.472962, 4.465014, 5.177035};
> >
> > h = new TH1F("g1","Example of several fits in subranges",np,85,134);
> > h->SetMaximum(7);
> >
> > for (int i=0;i<np;i++) {
> > h->SetBinContent(i+1,x[i]);
> > }
> >
> > Double_t par[9];
> > g1 = new TF1("g1","gaus",85,95);
> > g2 = new TF1("g2","gaus",98,108);
> >
> >
> > TCanvas *myc = new TCanvas("myc","myc_titre",0,0,360,520);
> > myc->Clear();
> > myc->Divide(1,2);
> > myc->cd(1);
> > h->Fit("g1","","0",85,95); //<=========
> > h->DrawCopy(); //<=========
> > myc->cd(2);
> > h->Fit("g2","","",98,108);
> > myc->Update();
> >
> > myc->Print("fit.eps");
> > }
> >
> >
> > On Tue, 6 Aug 2002, Sabine Crepe-Renaudin wrote:
> >
> > >
> > >
> > > Hello,
> > >
> > >
> > > I'm using something equivalent to the following routine
> > > which simply fit an histo in two ranges and display each fit in 2 pads.
> > > Everything is OK till I try to print the result.
> > >
> > > You can try the routine below to see the effect. If the print
> > > command is commented, you see the 2 fits, if you uncomment the last line,
> > > then the first fit is overwritten with the second and this is what is
> > > saved in the postscript file ...
> > >
> > > Have I done something wrong ? is it possible to print the results
> > > correctly without copying the histo in an other one and fit 2 different
> > > histos ???
> > >
> > > Thanks in advance for any suggestion,
> > >
> > > Sabine.
> > >
> > >
> > > {
> > > gROOT->Reset();
> > > const Int_t np = 49;
> > > Float_t x[np] = {1.913521, 1.953769, 2.347435, 2.883654, 3.493567,4.047560,4.337210, 4.364347, 4.563004, 5.054247,5.194183, 5.380521, 5.303213, 5.384578, 5.563983,5.728500, 5.685752, 5.080029, 4.251809, 3.372246,2.207432, 1.227541, 0.8597788,0.8220503,
> > > 0.8046592,0.7684097,0.7469761,0.8019787,0.8362375,0.8744895,0.9143721,0.9462768,0.9285364,0.8954604,0.8410891,0.7853871,0.7100883,0.6938808,0.7363682,0.7032954,0.6029015,0.5600163,0.7477068,1.188785, 1.938228,2.602717, 3.472962, 4.465014, 5.177035};
> > >
> > > h = new TH1F("g1","Example of several fits in subranges",np,85,134);
> > > h->SetMaximum(7);
> > >
> > > for (int i=0;i<np;i++) {
> > > h->SetBinContent(i+1,x[i]);
> > > }
> > >
> > > Double_t par[9];
> > > g1 = new TF1("g1","gaus",85,95);
> > > g2 = new TF1("g2","gaus",98,108);
> > >
> > >
> > > TCanvas *myc = new TCanvas("myc","myc_titre",0,0,360,520);
> > > myc->Clear();
> > > myc->Divide(1,2);
> > > myc->cd(1);
> > > h->Fit("g1","","",85,95);
> > > myc->Update();
> > > myc->cd(2);
> > > h->Fit("g2","","",98,108);
> > > myc->Update();
> > >
> > > // myc->Print("fit.eps");
> > > }
> > >
> > >
> > >
> > > --------------------------------------------------------------------
> > > Sabine Crépé-Renaudin
> > > Expérience D0 (Fermilab)
> > > ISN
> > > --------------------------------------------------------------------
> > >
> > >
> >
> >
>
>
> --------------------------------------------------------------------
> Sabine Crépé-Renaudin
> Expérience D0 (Fermilab) Tel +33 4 76 28 40 72
> ISN
> 53 avenue des Martyrs Fax +33 4 76 28 40 04
> 38026 GRENOBLE CEDEX - FRANCE
> --------------------------------------------------------------------
>
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:03 MET