Discussion:
Using RooStats::SPlot with weighted datasets
Antonio Augusto Alves Jr
2014-07-24 03:14:02 UTC
Permalink
Dear ROOTERS,

Please, I would like to know if the class RooStats::SPlot is compatible
with weighted datasets ?

I would like to compute sWeights and yields for a efficiency corrected
data set, as described in the section 4.5, page 16 of the
http://arxiv.org/pdf/physics/0402083v3.pdf.

Is the class implemented in a such way to take in consideration the
event weights when calculating the sWeights ?

Thanks you!
A.A.
--
Queriam-me casado, fútil, quotidiano e tributável? Queriam-me o
contrário disto, o contrário de qualquer coisa? Se eu fosse outra
pessoa, fazia-lhes, a todos, a vontade. Assim, como sou, tenham
paciência! Vão para o diabo sem mim, Ou deixem-me ir sozinho para o
diabo! Alvaro de Campos.
moneta
2014-08-14 09:11:32 UTC
Permalink
Dear Antonio,

It should be compatible with weighted data sets. I think you need to specify the flag includeWeights in the constructor.
If you find any problems with using weights, please let me know and I will investigate it

Best Regards


Lorenzo
Post by Antonio Augusto Alves Jr
Dear ROOTERS,
Please, I would like to know if the class RooStats::SPlot is compatible
with weighted datasets ?
I would like to compute sWeights and yields for a efficiency corrected
data set, as described in the section 4.5, page 16 of the
http://arxiv.org/pdf/physics/0402083v3.pdf.
Is the class implemented in a such way to take in consideration the
event weights when calculating the sWeights ?
Thanks you!
A.A.
--
Queriam-me casado, fútil, quotidiano e tributável? Queriam-me o
contrário disto, o contrário de qualquer coisa? Se eu fosse outra
pessoa, fazia-lhes, a todos, a vontade. Assim, como sou, tenham
paciência! Vão para o diabo sem mim, Ou deixem-me ir sozinho para o
diabo! Alvaro de Campos.
Marc Escalier
2014-10-03 16:22:04 UTC
Permalink
Hello,

in root, with an histogram, we could plot is with the text information
of the content.
Let's suppose we wish to do this, but for *two* histograms.

my problem is that the text overlap. Is there way to shift the text of
an histogram with respect to the other one ?

(i mean, let's suppose the two histograms have the *same* content.
Here is the example below is with random values, but we see any way some
overlap. My point is : how to change the *constant shift* between the
peak of a bin and the vertical position of the text in this bin)

Thank you

here is an example :

TH1F *hist1=new TH1F("hist1","hist1",10,0,2)
hist1->FillRandom("gaus")
hist1->Draw("text")

TH1F *hist1=new TH1F("hist2","hist2",10,0,2)
hist2->FillRandom("gaus")
hist2->Draw("textsame")
Escalier Marc
2014-10-03 23:47:16 UTC
Permalink
Hello,

Here is a reformulation of the question, because people could think
that my request is not useful.

Actually, the real problem is for 2D histogram (i spoke of TH1 in order
to simplify the problem, but my request may appear as not useful for the
reader if one consider TH1)

The real problem is the following :

If one wishes to plot a TH2 histogram with the content as "text",
then, if he wishes to make a superposition of two TH2F, the "text" will superpose.

The main question is :
"how to *shift* the text when the option "text" is used, in order to
prevent overlap of the text of two histograms that are drawn together"

hist2D_1->Draw("text")
hist2D_2->Draw("textsame")

-->big problem of overlap of the text...

Thank you for any help

========================
========================
Post by Marc Escalier
Hello,
in root, with an histogram, we could plot is with the text information of the
content.
Let's suppose we wish to do this, but for *two* histograms.
my problem is that the text overlap. Is there way to shift the text of an
histogram with respect to the other one ?
(i mean, let's suppose the two histograms have the *same* content.
Here is the example below is with random values, but we see any way some
overlap. My point is : how to change the *constant shift* between the peak of
a bin and the vertical position of the text in this bin)
Thank you
TH1F *hist1=new TH1F("hist1","hist1",10,0,2)
hist1->FillRandom("gaus")
hist1->Draw("text")
TH1F *hist1=new TH1F("hist2","hist2",10,0,2)
hist2->FillRandom("gaus")
hist2->Draw("textsame")
Dag Gillberg
2014-10-04 06:34:52 UTC
Permalink
Hi Marc,

I guess you just have to do this "by hand", for example, to draw the text
with some offset in red and blue from two identically binned histograms:

TLatex *tex = new TLatex();
tex->SetTextSize(0.03); tex->SetTextFont(42);

// vertical offset for text
double Dy=0.01;

for (int xi=1;xi<hist1->GetNbinsX();++xi)
for (int yi=1;yi<hist1->GetNbinsY();++yi) {
double x=hist1->GetBinCenter(xi);
double y=hist1->GetBinCenter(yi);

tex->DrawLatex(x,y+Dy,Form("#color[red]{%.1f}",hist1->GetBinContent(xi,yi));

tex->DrawLatex(x,y-Dy,Form("#color[blue]{%.1f}",hist2->GetBinContent(xi,yi));
}

Cheers,
Dag
Post by Marc Escalier
Hello,
Here is a reformulation of the question, because people could think that
my request is not useful.
Actually, the real problem is for 2D histogram (i spoke of TH1 in order to
simplify the problem, but my request may appear as not useful for the
reader if one consider TH1)
If one wishes to plot a TH2 histogram with the content as "text",
then, if he wishes to make a superposition of two TH2F, the "text" will superpose.
"how to *shift* the text when the option "text" is used, in order to
prevent overlap of the text of two histograms that are drawn together"
hist2D_1->Draw("text")
hist2D_2->Draw("textsame")
-->big problem of overlap of the text...
Thank you for any help
========================
========================
Hello,
Post by Marc Escalier
in root, with an histogram, we could plot is with the text information of
the content.
Let's suppose we wish to do this, but for *two* histograms.
my problem is that the text overlap. Is there way to shift the text of an
histogram with respect to the other one ?
(i mean, let's suppose the two histograms have the *same* content.
Here is the example below is with random values, but we see any way some
overlap. My point is : how to change the *constant shift* between the peak
of a bin and the vertical position of the text in this bin)
Thank you
TH1F *hist1=new TH1F("hist1","hist1",10,0,2)
hist1->FillRandom("gaus")
hist1->Draw("text")
TH1F *hist1=new TH1F("hist2","hist2",10,0,2)
hist2->FillRandom("gaus")
hist2->Draw("textsame")
Escalier Marc
2014-10-04 07:17:25 UTC
Permalink
thank you Dag,

this is a good idea

best regards

============
============
Post by Dag Gillberg
Hi Marc,
I guess you just have to do this "by hand", for example, to draw the text with some offset in red and blue from two
TLatex *tex = new TLatex();
tex->SetTextSize(0.03); tex->SetTextFont(42);
// vertical offset for text
double Dy=0.01;
for (int xi=1;xi<hist1->GetNbinsX();++xi)
  for (int yi=1;yi<hist1->GetNbinsY();++yi) {
    double x=hist1->GetBinCenter(xi);
    double y=hist1->GetBinCenter(yi);
    tex->DrawLatex(x,y+Dy,Form("#color[red]{%.1f}",hist1->GetBinContent(xi,yi));
    tex->DrawLatex(x,y-Dy,Form("#color[blue]{%.1f}",hist2->GetBinContent(xi,yi));
  }
Cheers,
Dag
Hello,
Here is a reformulation of the question, because people could think that my request is not useful.
Actually, the real problem is for 2D histogram (i spoke of TH1 in order to simplify the problem, but my
request may appear as not useful for the reader if one consider TH1)
If one wishes to plot a TH2 histogram with the content as "text",
then, if he wishes to make a superposition of two TH2F, the "text" will superpose.
"how to *shift* the text when the option "text" is used, in order to prevent overlap of the text of two
histograms that are drawn together"
hist2D_1->Draw("text")
hist2D_2->Draw("textsame")
-->big problem of overlap of the text...
Thank you for any help
========================
========================
Hello,
in root, with an histogram, we could plot is with the text information of the content.
Let's suppose we wish to do this, but for *two* histograms.
my problem is that the text overlap. Is there way to shift the text of an histogram with
respect to the other one ?
(i mean, let's suppose the two histograms have the *same* content.
how to change the *constant shift* between the peak of a bin and the vertical position of the
text in this bin)
Thank you
TH1F *hist1=new TH1F("hist1","hist1",10,0,2)
hist1->FillRandom("gaus")
hist1->Draw("text")
TH1F *hist1=new TH1F("hist2","hist2",10,0,2)
hist2->FillRandom("gaus")
hist2->Draw("textsame")
Olivier Couet
2014-10-07 03:09:19 UTC
Permalink
Also try to grep SAMES in:
http://root.cern.ch/root/html534/THistPainter.html

It will help I guess.

On 04 Oct 2014, at 09:17, Escalier Marc <***@lal.in2p3.fr<mailto:***@lal.in2p3.fr>> wrote:

thank you Dag,

this is a good idea

best regards

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

On Sat, 4 Oct 2014, Dag Gillberg wrote:

Hi Marc,
I guess you just have to do this "by hand", for example, to draw the text with some offset in red and blue from two
identically binned histograms:
TLatex *tex = new TLatex();
tex->SetTextSize(0.03); tex->SetTextFont(42);
// vertical offset for text
double Dy=0.01;
for (int xi=1;xi<hist1->GetNbinsX();++xi)
for (int yi=1;yi<hist1->GetNbinsY();++yi) {
double x=hist1->GetBinCenter(xi);
double y=hist1->GetBinCenter(yi);
tex->DrawLatex(x,y+Dy,Form("#color[red]{%.1f}",hist1->GetBinContent(xi,yi));
tex->DrawLatex(x,y-Dy,Form("#color[blue]{%.1f}",hist2->GetBinContent(xi,yi));
}
Cheers,
Dag
On Sat, Oct 4, 2014 at 1:47 AM, Escalier Marc <***@lal.in2p3.fr<mailto:***@lal.in2p3.fr>> wrote:
Hello,

Here is a reformulation of the question, because people could think that my request is not useful.

Actually, the real problem is for 2D histogram (i spoke of TH1 in order to simplify the problem, but my
request may appear as not useful for the reader if one consider TH1)

The real problem is the following :

If one wishes to plot a TH2 histogram with the content as "text",
then, if he wishes to make a superposition of two TH2F, the "text" will superpose.

The main question is :
"how to *shift* the text when the option "text" is used, in order to prevent overlap of the text of two
histograms that are drawn together"

hist2D_1->Draw("text")
hist2D_2->Draw("textsame")

-->big problem of overlap of the text...

Thank you for any help

========================
========================
On Fri, 3 Oct 2014, Marc Escalier wrote:

Hello,

in root, with an histogram, we could plot is with the text information of the content.
Let's suppose we wish to do this, but for *two* histograms.

my problem is that the text overlap. Is there way to shift the text of an histogram with
respect to the other one ?

(i mean, let's suppose the two histograms have the *same* content.
Here is the example below is with random values, but we see any way some overlap. My point is :
how to change the *constant shift* between the peak of a bin and the vertical position of the
text in this bin)

Thank you

here is an example :

TH1F *hist1=new TH1F("hist1","hist1",10,0,2)
hist1->FillRandom("gaus")
hist1->Draw("text")

TH1F *hist1=new TH1F("hist2","hist2",10,0,2)
hist2->FillRandom("gaus")
hist2->Draw("textsame")
Marc Escalier
2014-10-07 09:12:06 UTC
Permalink
thank you Olivier

best regards

=========================
Post by Olivier Couet
http://root.cern.ch/root/html534/THistPainter.html
It will help I guess.
Post by Escalier Marc
thank you Dag,
this is a good idea
best regards
============
============
Post by Dag Gillberg
Hi Marc,
I guess you just have to do this "by hand", for example, to draw the
text with some offset in red and blue from two
TLatex *tex = new TLatex();
tex->SetTextSize(0.03); tex->SetTextFont(42);
// vertical offset for text
double Dy=0.01;
for (int xi=1;xi<hist1->GetNbinsX();++xi)
for (int yi=1;yi<hist1->GetNbinsY();++yi) {
double x=hist1->GetBinCenter(xi);
double y=hist1->GetBinCenter(yi);
tex->DrawLatex(x,y+Dy,Form("#color[red]{%.1f}",hist1->GetBinContent(xi,yi));
tex->DrawLatex(x,y-Dy,Form("#color[blue]{%.1f}",hist2->GetBinContent(xi,yi));
}
Cheers,
Dag
Hello,
Here is a reformulation of the question, because people could
think that my request is not useful.
Actually, the real problem is for 2D histogram (i spoke of TH1
in order to simplify the problem, but my
request may appear as not useful for the reader if one consider TH1)
If one wishes to plot a TH2 histogram with the content as "text",
then, if he wishes to make a superposition of two TH2F, the "text" will superpose.
"how to *shift* the text when the option "text" is used, in
order to prevent overlap of the text of two
histograms that are drawn together"
hist2D_1->Draw("text")
hist2D_2->Draw("textsame")
-->big problem of overlap of the text...
Thank you for any help
========================
========================
Hello,
in root, with an histogram, we could plot is with the
text information of the content.
Let's suppose we wish to do this, but for *two* histograms.
my problem is that the text overlap. Is there way to
shift the text of an histogram with
respect to the other one ?
(i mean, let's suppose the two histograms have the *same* content.
Here is the example below is with random values, but we
how to change the *constant shift* between the peak of a
bin and the vertical position of the
text in this bin)
Thank you
TH1F *hist1=new TH1F("hist1","hist1",10,0,2)
hist1->FillRandom("gaus")
hist1->Draw("text")
TH1F *hist1=new TH1F("hist2","hist2",10,0,2)
hist2->FillRandom("gaus")
hist2->Draw("textsame")
Loading...