Binding problem

why this?

Detaching from program: /proc/9266/exe, process 9266
Traceback (most recent call last):
  File "myCut.py", line 145, in <module>
    main()
  File "myCut.py", line 138, in main
    runCutPrintEach(data_signal,cuts)
  File "myCut.py", line 65, in runCutPrintEach
    for passati in runCutEach(tree,cuts):
  File "myCut.py", line 48, in runCutEach
    passati.append({'n':tree.Draw("",cut),'name':cut.GetName()} )
TypeError: none of the 3 overloaded methods succeeded. Full details:
  void TTree::Draw(Option_t* opt) =>
    takes at most 1 arguments (2 given)
  problem in C++; program state has been reset
  Long64_t TTree::Draw(const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0) =>
    could not convert argument 2 (expected string or Unicode object, TCut found)

and this:

Long64_t Draw(const char* varexp, const TCut& selection, Option_t* option = “”,Long64_t nentries = 1000000000, Long64_t firstentry = 0)

why it’s not considered??

Do you have an example to reproduce?

now not… maybe I find something

Have you thought about using TTree::GetEntries instead?

Hi,

the method that you want is considered, but it crashes on the C++ side: “problem in C++; program state has been reset.” Please re-run the code under gdb to get a stack trace.

Cheers,
Wim

I think the problem is that he is calling TTree::Draw() with an empty first parameter?

yes, the problem is that TTree::GetEntries take a const char* and I’m using TCut.

Not sure how that causes a problem … Anyway, the TCut& overload of Draw() simply calls .GetTitle() on the TCut object and passes that to the char* overload (which should then crash in the same way).

Cheers,
Wim