Overload error with TTree::Draw

Hello,

I am having some trouble using the TTree::Draw function within pyroot, which gives me the following error.

TypeError: none of the 3 overloaded methods succeeded. Full details:
  void TTree::Draw(const char* opt) =>
    takes at most 1 arguments (3 given)
  Long64_t TTree::Draw(const char* varexp, const TCut& selection, const char* option = """", Long64_t nentries = 1000000000, Long64_t firstentry = 0) =>
    could not convert argument 2
  Long64_t TTree::Draw(const char* varexp, const char* selection, const char* option = """", Long64_t nentries = 1000000000, Long64_t firstentry = 0) =>
    problem in C++; program state has been reset

What confuses me is that this error seems to happen for some of the “varexp” and “selection” string, and I wasn’t able to find a pattern between cases working/failing strings. For example, adding a dummy “& V_pt > -15” (V_pt is always > 0) to the varexp seems to solve the problem in some cases.

Does someone know what the issue is, and how it can be solved ? Unfortunately I can not send the code, as it is part of a large framework. I am using ROOT 6.02/05.

Many thanks,

Gael
error.txt (48.9 KB)

do you have the same problem if you use the TTree::Draw command in C++ ?
(just to clarify if it is Python specific).

Yes. Making the plot interactively with

root root://t3dcachedb03.psi.ch:1094//pnfs/psi.ch/cms/trivcat/store/user/gaperrin/VHbb/ZllHbb13TeV_V24/tmpv9/tmp_8812028b9abb40a1560f44031b692131a9838da69480b5ee4405c458.root
gROOT->LoadMacro("../interface/VHbbNameSpace_h.so")
tree->Draw("HCSV_reg_mass","((VHbb::puWeight_ichep(nTrueInt)*sign(genWeight)*bTagWeightICHEP*(eleweight[0]*weight_Eff_eletriglooseBCD[0]*muweight[0]*weight_Eff_mutriglooseICHEP[0]))*(1))*((V_mass > 10 & (V_mass < 75 || V_mass > 120) & Jet_btagCSV[hJCidx[0]] > 0.935 & Jet_btagCSV[hJCidx[1]] > 0.46  & sys_BasicCuts) & (run <= 276811) & V_pt > 20 & V_pt > 30 & 1& (Sum$(GenJet_pt>20 && abs(GenJet_eta)<2.4 && GenJet_numBHadrons>0)==1))", "goff,e")

also leads to a

*** Break *** segmentation violation

Another remark: if I modify the cut within the Draw function above, replacing “& V_pt > 20 & V_pt > 30 &” by
"& V_pt > 30 &", the drawing works fine. This is strange because both cuts should be equivalent.

"& V_pt > 20 & V_pt > 30 &"As a side note, in C++ (and in TTree::Draw) a single & is a bitwise and operation, you most likely meant:

Cheers,
Philippe.

Hello Philippe,

Ah, your right ! I was always using single “&” instead of “&&” in pyroot. I have rerun the tests using double “&&” everywhere, but the result is the same as before.

The following command lead to a segmentation violation

root root://t3dcachedb03.psi.ch:1094//pnfs/psi.ch/cms/trivcat/store/user/gaperrin/VHbb/ZllHbb13TeV_V24/tmpv9/tmp_8812028b9abb40a1560f44031b692131a9838da69480b5ee4405c458.root
gROOT->LoadMacro("../interface/VHbbNameSpace_h.so")
tree->Draw("HCSV_reg_mass","((VHbb::puWeight_ichep(nTrueInt)*sign(genWeight)*bTagWeightICHEP*(eleweight[0]*weight_Eff_eletriglooseBCD[0]*muweight[0]*weight_Eff_mutriglooseICHEP[0]))*(1))*((V_mass > 10 && (V_mass < 75 || V_mass > 120) && Jet_btagCSV[hJCidx[0]] > 0.935 && Jet_btagCSV[hJCidx[1]] > 0.46  && sys_BasicCuts) && (run <= 276811) && V_pt > 20 && V_pt > 30 && 1&& (Sum$(GenJet_pt>20 && abs(GenJet_eta)<2.4 && GenJet_numBHadrons>0)==1))", "goff,e")
*** Break *** segmentation violation

while this one (after substituting “&& V_pt > 20 && V_pt > 30 &&” -> “&& V_pt > 30 &&”) is working

root root://t3dcachedb03.psi.ch:1094//pnfs/psi.ch/cms/trivcat/store/user/gaperrin/VHbb/ZllHbb13TeV_V24/tmpv9/tmp_8812028b9abb40a1560f44031b692131a9838da69480b5ee4405c458.root
gROOT->LoadMacro("../interface/VHbbNameSpace_h.so")
tree->Draw("HCSV_reg_mass","((VHbb::puWeight_ichep(nTrueInt)*sign(genWeight)*bTagWeightICHEP*(eleweight[0]*weight_Eff_eletriglooseBCD[0]*muweight[0]*weight_Eff_mutriglooseICHEP[0]))*(1))*((V_mass > 10 && (V_mass < 75 || V_mass > 120) && Jet_btagCSV[hJCidx[0]] > 0.935 && Jet_btagCSV[hJCidx[1]] > 0.46  && sys_BasicCuts) && (run <= 276811) && V_pt > 30 && 1&& (Sum$(GenJet_pt>20 && abs(GenJet_eta)<2.4 && GenJet_numBHadrons>0)==1))", "goff,e")

I have attached the root file and VHbbNameSpace.h macro such that one can reproduce this error.

Best,

Gael
VHbbNameSpace.h (34.4 KB)
tmp_8812028b9abb40a1560f44031b692131a9838da69480b5ee4405c458.root (440 KB)