Cannot plot RooDataSet entries

Hi experts,
I have a question concerning the plotting of a dataset (RooDataSet) on RooFit. I have a dataset ‘complete_lambda.root’ which contains the values of different observables. For my analysis cuts are used to bin the data in different regions.
In this case I want to bin the dataset for the observable ‘daughter__bo0__cm__spp__bc’.
The PROBLEM arises when I set the cut of the observable larger than 1.
Here my straightforward code snippet:

import ROOT

variable_name = "M"
y = ROOT.RooRealVar(variable_name,variable_name,1.10,1.13,'GeV')

def my_dataset(path,filename, cuts,name, treename='variables'):
    branchname  = variable_name
    sigmc_chain = ROOT.TChain(treename)
    nsig = sigmc_chain.Add(path+filename)
    sigmc_chain = sigmc_chain.CopyTree(cuts)
    sigmc_ds = ROOT.RooDataSet(name,name,sigmc_chain, ROOT.RooArgSet(y))
    return sigmc_ds

def my_multiplot(data_set, canvas_name):
    canvas = ROOT.TCanvas("canvas_analysis")
    frame = y.frame()
    print('hello from inside')
    data_set.plotOn(frame)
    frame.Draw()
    return canvas

full_data = my_dataset('/home/jenegger/protonproject/','complete_lambda.root','M > 1.10 && M < 1.13 && distance > 5 && 1 < daughter__bo0__cm__spp__bc < 2',"full_ds")

d = my_multiplot(full_data,'check_momentum')
d.Draw()

I used the function sumEntries(‘M’,‘0’) to check whether therere are some events in this range but it returns the value 0.0.
When I change the range of the observable to : 0.995 < daughter__bo0__cm__spp__bc < 2
… I get lots of events
When I change the range of the observable to : 0.995 < daughter__bo0__cm__spp__bc < 1
… I also get lots of events(but less)

So I substracted the both values ( 160274.0-124433.0 = 35841.0) -> it is not equal 0!
So I really don’t understand why I can’t plot anything which occurs between the range of 1 and 2of the observable?!

I also tried to make simple plots using root_pandas and matplotlib as countercheck and there it works…
(it plots exactly 35841events)

Thanks in advance
Tobias

Hey Tobias,

I took the liberty to edit your post to frame the code in three “`”. In this way, it’s easier to read. I will have a look at the rest after lunch.

The problem is here:

This expression is not doing what you think. You want to use
&& 1 < daughter__bo0__cm__spp__bc && daughter__bo0__cm__spp__bc < 2
to have it in the range [1, 2].
I honestly don’t know how your expression is interpreted, because I don’t know the precedence (or associativity) of the operators. It might evaluate to something like
(1 < daughter__bo0__cm__spp__bc = true = 1) < 2.

StephanH thank you very much for your hint! Now it works perfectly fine. I substituted

1 < daughter__bo0__cm__spp__bc && daughter__bo0__cm__spp__bc < 2

with:

1 < daughter__bo0__cm__spp__bc && daughter__bo0__cm__spp__bc < 2

Best regards
Tobias