Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-10517

RooFit::CutRange is buggy with multiple range

    XMLWordPrintable

    Details

      Description

      Please find a minimum example that proves that RooFit::CutRange is buggy with multiple ranges.

      This has important consequences for fits in multiple ranges, that I may report a bit later, after this bug report is considered.

       

      Here is a minimum reproducible example :

       

      #include <iostream>
       
      #include <RooAbsData.h>
      #include <RooAbsPdf.h>
      #include <RooDataSet.h>
      #include <RooExponential.h>
      #include <RooGenericPdf.h>
      #include <RooRealVar.h>
       
      using namespace RooFit;
       
      using namespace std;
       
      int ProofBugRoofit()
      {
       RooRealVar *roorealvar_m_yy=new RooRealVar("m_yy","m_yy",105,160);
       roorealvar_m_yy->setBins(55);
       
      //blinding regions
       roorealvar_m_yy->setRange("sideband_low_m_yy",105,120);
       roorealvar_m_yy->setRange("sideband_high_m_yy",130,160);
       
      RooRealVar *roorealvar_exp_slope=new RooRealVar("exp_slope","exp slope",-3,-100,100,"GeV^\{-1}");
       
      RooAbsPdf *Pdf_Bkg_exp=new RooGenericPdf("Pdf_Bkg_exp","Pdf_Bkg_exp","exp(@1*(@0-100.)/100.)",RooArgList(*roorealvar_m_yy,*roorealvar_exp_slope));
       
      RooAbsData *absdata_toy_tempo;
       absdata_toy_tempo=(RooDataSet *)Pdf_Bkg_exp->generate(RooArgSet(*roorealvar_m_yy),RooFit::NumEvents(1000));
       
      RooAbsData *absdata_reduced;
       
      cout << "nb events=" << absdata_toy_tempo->sumEntries() << endl;
       cout << "reduce 1=" << absdata_toy_tempo->reduce(RooFit::Cut("m_yy<120 || m_yy>130"))->sumEntries() << endl;
       cout << "reduce 2=" << absdata_toy_tempo->reduce("m_yy<120 || m_yy>130")->sumEntries() << endl;
       cout << "reduce buggy=" << absdata_toy_tempo->reduce(RooFit::CutRange("sideband_low_m_yy,sideband_high_m_yy"))->sumEntries() << endl;
       
      return 0;
      }
      
      

      -->This gives :

      nb events=1000
      reduce 1=780
      reduce 2=780
      reduce buggy=1000 <-----This is impossible if there is no bug

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                shageboe Stephan Hageboeck
                Reporter:
                escalier Marc Escalier
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: