RE: TF2 SetRange

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Mon, 22 Nov 2010 09:05:48 +0000


Hello,
I compiled and link your program: I get a Seg Fault when I run it. Using CINT I get the same thing.
Have you run what you sent me ?
May be there is still some files missing... Olivier

-----Original Message-----
From: nguler_at_jlab.org [mailto:nguler_at_jlab.org] Sent: Friday, November 19, 2010 7:34 PM
To: Olivier Couet
Cc: nguler_at_jlab.org; roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: RE: [ROOT] TF2 SetRange

Sorry I forgot to cleanup the Makefile itself. I removed some unused libraries from the Makefile, also cleaned the code a bit more and attached the whole package again. It should work now and produce a .gif file. Actually, the Makefile is not necessary, the code can also be loaded under root cint, in which case the subroutine to run is all(); Sorry for the confusion. As a side note, I am using root version 5.26/00. Thanks again for your help,
-Nevzat

>
> When I do "make" I get:
>
> g++ -o aImage_nifv1 aImage_nifv1.cc -O -Wall -fPIC -pthread -m32
> -I/home/couet/root/include -L/home/couet/root/lib -lCore -lCint -lRIO
> -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript
> -lMatrix -lPhysics -lMathCore -lThread -lGui -pthread -lm -ldl
> -rdynamic -L -lMinuit -I/home/nguler/eg1b/inc -L
> g++: argument to `-L' missing
>
> make: *** [exe] Error 1
>
> It is because the variable CLAS_LIB is not defined in the Makefile....
> what should it be ?
>
> OC
>
> Org: CERN - European Laboratory for Particle Physics.
> Mail: 1211 Geneve 23 - Switzerland Mailbox: J25910
> E-Mail: Olivier.Couet_at_cern.ch Phone: +41 22
> 7676522
> WWW: http://cern.ch/Olivier.Couet/ Fax: +41 22
> 7670300
>
> On Thu, 18 Nov 2010, nguler_at_jlab.org wrote:
>
>> Hello,
>> I tried gStyle->SetHistTopMargin(0); but it did not change anything.
>> I attached a tar file which includes simplified code (I tried to
>> clean as much as possible), a data file input and a makefile to
>> compile (make test). I hope the file size is too big for roottalk.
>> I am using the subroutine plot() in the code.
>>
>> Thanks for your help.
>>
>> P.S. As a side note: The subroutine graph() is trying to do the same
>> thing as the plot() but by using TGraph2D. However, it is extremely
>> slow and the graph it generates has large pixels which create a low
>> resolution plot. I was thinking to ask this separately but might be
>> more appropriate now.
>>
>>
>>> Hello,
>>> You did not sent a running macro showing the problem so I can only
>>> guess what could be wrong.
>>> It could be the following: histograms are not drawn from Min to Max
>>> of their content. There is a margin on top, added to the maximum. It
>>> could be that this margin provokes the difference in Z. To suppress
>>> it do: gStyle->SetHistTopMargin(0); Cheers, O.Couet
>>>
>>> -----Original Message-----
>>> From: owner-roottalk_at_root.cern.ch
>>> [mailto:owner-roottalk_at_root.cern.ch]
>>> On Behalf Of nguler_at_jlab.org
>>> Sent: Wednesday, November 17, 2010 1:08 AM
>>> To: roottalk (Mailing list discussing all aspects of the ROOT
>>> system.)
>>> Subject: [ROOT] TF2 SetRange
>>>
>>> Hello All,
>>> I have 2D histograms with various peaks in each. I perform a
>>> gaussian fit on the peaks. For the fit to be successful, I have to
>>> set x,y ranges around the peaks while defining my TF2 object.
>>> Therefore, the range of my TF2 is different than the range of my
>>> TH2F. This becomes problem later when I plot the histogram and the
>>> fit results together on the same canvas. So, I rescale the histogram
>>> by using SetRange. To be more clear, I define TH2F:
>>> TH2F *histsim = new
>>> TH2F(histsimName,histsimName,256,0,256,256,0,256);
>>> Then define TF2:
>>> TF2 *fitsim = new TF2("fitsim",Gaus2D,0,80,75,125,5);
>>> And I fit and plot:
>>> histsim->Fit("fitsim","RN");
>>> histsim->Draw("surf4");
>>> fitsim->Draw("cont1, same");
>>> But the fitsim is plotted on a different scale and does not overlap
>>> with the peak anymore even if the fit is successful. So, instead I
>>> do the
>>> following:
>>> histsim->Fit("fitsim","RN");
>>> histsim->Draw("surf4");
>>> fitsim->SetRange(0,0,256,256); //// necessary to rescale to the
>>> histogram range
>>> fitsim->Draw("cont1, same");
>>> This plots the fitsim on correct x and y positions. However, the z
>>> height of the fit is still off-scale. How can I rescale the fit
>>> height so that it is the same as the peak height? I tried following:
>>> fitsim->SetRange(0,0,0, 256,256, fitsim->GetParameter(0)); But
>>> it did not have any visible effect, the z range of the fit is still
>>> very different than the z range of the histogram.
>>>
>>> I appreciate your suggestions. Thank you,
>>>
>>> - Nevzat Guler
>>>
>>>
>>>
>>>
>>>
>>
>>
>> - Nevzat Guler
>> (757) 553-8318
>

Received on Mon Nov 22 2010 - 10:05:54 CET

This archive was generated by hypermail 2.2.0 : Mon Nov 22 2010 - 17:50:01 CET