Lorenzo Moneta | 1 Sep 13:08 2011
Picon
Picon

Re: [ROOT] different fit behaviour in ROOT and ROOFIT

Hi Roberta, 

 Sorry for having looking late into this problem. I have investigated more, it required me some time and I
have concluded that the RooFIt result is probably not right, while the ROOT is. The reason for the
difference is still to be found. 
I have been using the same pdf definition of RooFit, by transforming the pdf in a TF1 and then fitted using
ROOT and I get consistent results
with your TestROOT macro. In particular if I use as input the RooFit parameters , I get clearly a smaller
value of the likelihood  function 
(meaning that is not optimal). 
Furthermore, when using a chi2 fit method (not maximum likelihood) which should work perfectly fine and
give the same results in your case since the histogram bin errors are gaussian I get again the same result. (
NJPSI ~ 2200)

So, something is probably wrong in the RooFIt fitting, it could be also a numerical problem not dealt
correctly in the likelihood calculation in RooFit.  

I attach my macro, which uses the RooFit to build the model but  ROOT for fitting 

Cheers, 

 Lorenzo

Attachment (TestROOT2.C): application/octet-stream, 8 KiB


 

(Continue reading)

suvayu ali | 1 Sep 16:58 2011
Picon

[ROOT] RooFit html documentation doubt

Hi,

In the htmldocs for RooFormulaVar[1] it keeps referring to RooRealVar as
the generic implementation. Is this correct? I thought RooFormulaVar is
the generic implementation of RooRealVar, or is my understanding wrong?

Footnotes:

[1] <http://root.cern.ch/root/html530/RooFormulaVar.html>

--

-- 
Suvayu

Open source is the future. It sets us free.

Roberta Arnaldi | 2 Sep 10:19 2011
Picon
Picon

Re: [ROOT] different fit behaviour in ROOT and ROOFIT

Dear Lorenzo,

thanks a lot for having looked to my problem and for spotting the "guilty" 
fitter :)
Unfortunately, the discrepancy between Root and Roofit is something which 
I always observe, while performing fits to the invariant mass 
spectra, i.e. it is not something related to the specific histogram I had
attached to the mail...
It's really a pity to give up the use of Roofit, since (before 
discovering the discrepancy with ROOT) I had the impression 
that the fit stability and the speed where really very good!

...in my opinion, it would be important to understand why roofit seems not 
to behave properly, since it is now widely used in the LHC experiments!
Please, let me know if there are any news!

  Ciao and thanks again!

     Roberta

On Thu, 1 Sep 2011, Lorenzo Moneta wrote:

> Hi Roberta,
>
> Sorry for having looking late into this problem. I have investigated more, it required me some time and I
have concluded that the RooFIt result is probably not right, while the ROOT is. The reason for the
difference is still to be found.
> I have been using the same pdf definition of RooFit, by transforming the pdf in a TF1 and then fitted using
ROOT and I get consistent results
> with your TestROOT macro. In particular if I use as input the RooFit parameters , I get clearly a smaller
(Continue reading)

Marc Escalier | 2 Sep 16:24 2011
Picon
Picon

[ROOT] root : strange behaviour of AddBinContent()

Hello,

it seems that there is a strange behaviour of TH1::AddBinContent()

intuitively, i would think that adding a content to a bin would mean 
that the number of entries should increase,
as it is when one does TH1::Fill(1) (apart that this last comment is 
very slow)

but :

root [0] TH1F *hist_initial_events=new 
TH1F("hist_initial_events","hist_initial_events",20,0.5,20.5);
root [1] hist_initial_events.GetEntries()
(const Double_t)0.00000000000000000e+00
root [3] hist_initial_events->AddBinContent(1)
root [4] hist_initial_events.GetEntries()
(const Double_t)0.00000000000000000e+00

root [5] hist_initial_events.GetBinContent(1)
(const Double_t)1.00000000000000000e+00

-->
*is the fact that AddBinContent() does not increase the number of 
entries expected ?

*On other subject, is there a way to find a much faster command that 
TH1::Fill to add 1 to an histogram ?

(i see that a simple counter "int" is much more faster, but i need a TH1 
(Continue reading)

Lorenzo Moneta | 2 Sep 17:59 2011
Picon
Picon

Re: [ROOT] root : strange behaviour of AddBinContent()

Hi, 

 TH1::Fill(x), finds the right bin number,  add the bin content and update the histogram statistics
(entries, total sum of weights , etc.._ ) and in case of weighted histogram the bin sum of weight square.  
If you want to be faster (like calling AddBinContent) you need to give up some of the other information. You
can always set the entries later using SetEntries

Cheers, 
 Lorenzo
On Sep 2, 2011, at 4:24 PM, Marc Escalier wrote:

> Hello,
> 
> it seems that there is a strange behavior of TH1::AddBinContent()
> 
> intuitively, i would think that adding a content to a bin would mean that the number of entries should increase,
> as it is when one does TH1::Fill(1) (apart that this last comment is very slow)
> 
> but :
> 
> root [0] TH1F *hist_initial_events=new TH1F("hist_initial_events","hist_initial_events",20,0.5,20.5);
> root [1] hist_initial_events.GetEntries()
> (const Double_t)0.00000000000000000e+00
> root [3] hist_initial_events->AddBinContent(1)
> root [4] hist_initial_events.GetEntries()
> (const Double_t)0.00000000000000000e+00
> 
> root [5] hist_initial_events.GetBinContent(1)
> (const Double_t)1.00000000000000000e+00
> 
(Continue reading)

Axel Naumann | 2 Sep 18:03 2011
Picon
Picon

Re: [ROOT] root : strange behaviour of AddBinContent()

Hi Marc,

An alternative to Lorenzo's reply is to use TParameter<int>::GetVal():
simple int with a name, wrapped as TObject.

Cheers, Axel.

Marc Escalier wrote on 09/02/2011 04:24 PM:
> Hello,
> 
> it seems that there is a strange behaviour of TH1::AddBinContent()
> 
> intuitively, i would think that adding a content to a bin would mean
> that the number of entries should increase,
> as it is when one does TH1::Fill(1) (apart that this last comment is
> very slow)
> 
> but :
> 
> root [0] TH1F *hist_initial_events=new
> TH1F("hist_initial_events","hist_initial_events",20,0.5,20.5);
> root [1] hist_initial_events.GetEntries()
> (const Double_t)0.00000000000000000e+00
> root [3] hist_initial_events->AddBinContent(1)
> root [4] hist_initial_events.GetEntries()
> (const Double_t)0.00000000000000000e+00
> 
> root [5] hist_initial_events.GetBinContent(1)
> (const Double_t)1.00000000000000000e+00
> 
(Continue reading)

Marc Escalier | 2 Sep 19:20 2011
Picon
Picon

Re: [ROOT] root : strange behaviour of AddBinContent()

thank you very much
Lorenzo and Axel

============

On Fri, 2 Sep 2011, Axel Naumann wrote:

> Hi Marc,
>
> An alternative to Lorenzo's reply is to use TParameter<int>::GetVal():
> simple int with a name, wrapped as TObject.
>
> Cheers, Axel.
>
>
> Marc Escalier wrote on 09/02/2011 04:24 PM:
>> Hello,
>>
>> it seems that there is a strange behaviour of TH1::AddBinContent()
>>
>> intuitively, i would think that adding a content to a bin would mean
>> that the number of entries should increase,
>> as it is when one does TH1::Fill(1) (apart that this last comment is
>> very slow)
>>
>> but :
>>
>> root [0] TH1F *hist_initial_events=new
>> TH1F("hist_initial_events","hist_initial_events",20,0.5,20.5);
>> root [1] hist_initial_events.GetEntries()
(Continue reading)

suvayu ali | 3 Sep 11:03 2011
Picon

[ROOT] RooGlobalFunc documentation

Hi,

I was wondering if the global helper functions in RooGlobalFunc.h that
create RooCmdArg containers are documented somewhere. The htmldocs
page (http://root.cern.ch/root/html530/RooGlobalFunc.html) doesn't
have anything and I end up going through the header file and guessing
what each function does depending on the context and the variable
names in the source.

Thank you

--

-- 
Suvayu

Open source is the future. It sets us free.

Aamer Wali Rauf | 3 Sep 13:37 2011
Picon
Picon

[ROOT] highlighting part of the histogram

Hi,

Is there any way I can shade different parts of the histogram with different colours. What I want to do is to show the left background band, the right background band and the band around the signal. I want to have these three windows shaded different just for illustration.Thanks,
Aamer
Rene Brun | 4 Sep 11:45 2011
Picon
Picon

Re: [ROOT] highlighting part of the histogram

Assuming TH1* h,
left band from bins 1 to bl
right band bins from br to nbins
signal band bins from sl to sr
do:
h->Draw();
TH1 *hleft = (TH1*)h->Clone("hleft");
hleft->GetXaxis()->SetRange(1,bl);
hleft->SetFillColor(color of left band);
hleft->Draw("same");
TH1 *hright = (TH1*)h->Clone("hright");
hright->GetXaxis()->SetRange(br,nbins);
hright->SetFillColor(color of right band);
hright->Draw("same");
TH1 *hsig = (TH1*)h->Clone("hsig");
hsig->GetXaxis()->SetRange(sl,sr);
hsig->SetFillColor(color of signal band);
hsig->Draw("same");

Rene


On 03/09/2011 13:37, Aamer Wali Rauf wrote:
Hi,

Is there any way I can shade different parts of the histogram with different colours. What I want to do is to show the left background band, the right background band and the band around the signal. I want to have these three windows shaded different just for illustration.Thanks,
Aamer


Gmane