I am trying to make a ratio plot using two histograms and I saw an example here: ROOT: tutorials/hist/ratioplot1.C File Reference
There is a line calling h1->Sumw2();
I am confused about why do we want to call sumw2 for h1 but not for h2 given the h2 will be scaled afterwards?
Is there a reason for doing that or it’s a typo?
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
See the notes on TH1::Scale.
Thank you for your reply! So that means calling Scale for h2 automatically calls Sumw2 for h2 so we don’t need to call it explicitly. Will things go wrong if I call Sumw2 multiple times or call Sumw2 together with Scale?
Hi @Ang-Li-95; I think you might get a warning “Sum of squares of weights structure already created”.
if (! MyHisto->GetSumw2N()) MyHisto->Sumw2(kTRUE);