Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROOT vecops deltaphi type error in RDataFrames #17394

Open
1 task done
jd550179 opened this issue Jan 9, 2025 · 1 comment
Open
1 task done

ROOT vecops deltaphi type error in RDataFrames #17394

jd550179 opened this issue Jan 9, 2025 · 1 comment
Assignees
Labels

Comments

@jd550179
Copy link

jd550179 commented Jan 9, 2025

Check duplicate issues.

  • Checked for duplicates

Description

When calculating the deltaPhi between two scalars we get the following error:

df = df.Define("dPhiHbbHtautau", f"ROOT::VecOps::DeltaPhi<float, float>(HbbFourVector_{systematic.suffix}.Phi(), LLFourVector_{systematic.suffix}.Phi() )")

raceback (most recent call last):
  File "/user/jdegens/analysis/dihiggs/plotting/HHARD/bin/bbttManager.py", line 26, in <module>
    analysis_manager.run_analyses_local()  # runs all rdf simultaneously
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/user/jdegens/analysis/dihiggs/plotting/HHARD/python/utils/wrappers.py", line 12, in timeit_wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/user/jdegens/analysis/dihiggs/plotting/HHARD/python/managers/AnalysisManager.py", line 199, in run_analyses_local
    R.RDF.RunGraphs(dfs)
cppyy.gbl.std.runtime_error: unsigned int ROOT::RDF::RunGraphs(vector<ROOT::RDF::RResultHandle>) =>
    runtime_error: RDataFrame: type mismatch: column "dPhiHbbHtautau" is being used as float but the Define or Vary node advertises it as double

I am not exactly sure what the error is but if I do:

ROOT::VecOps::DeltaPhi<float, float>(HbbFourVector_{systematic.suffix}.Phi(), LLFourVector_{systematic.suffix}.Phi() )"

it runs without an error. Also this fixes the error:

df = df.Define("deltaphi", f"(float) ROOT::VecOps::DeltaPhi<float, float>(HbbFourVector_{systematic.suffix}.Phi(), LLFourVector_{systematic.suffix}.Phi() )")

There is probably something wrong with the type of the output of deltaPhi. We also use deltaR calls and we dont see this problem. It was observed in v32.0.08 and was not there previously in v30.

Reproducer

I dont have an easy reproducer at the moment...

ROOT version

ROOT Version: 6.32.08
Built for linuxx8664gcc on Dec 03 2024, 17:12:25
From tags/6-32-08@6-32-08

Installation method

views

Operating system

linux alma9

Additional context

No response

@vepadulano
Copy link
Member

Dear @jd550179 ,

Thanks for reaching out! The DeltaPhi function return type is the common type between the types of the operands. Judging by your calls to .Phi() in the expression, I'm inferring both operands are of type double, so also DeltaPhi returns a double. The error then is quite clear:

column "dPhiHbbHtautau" is being used as float but the Define or Vary node advertises it as double

It means that the column you are defining with the return value of DeltaPhi has type double but somewhere else in the computation graph it's being used as float. The most probable cause is that you are using this column as parameter to some other expression and there the type mismatch happens. Could you check where else in your analysis you're using that column? Then we could reason about it together better.

And just for confirmation, calling ROOT::VecOps::DeltaPhi<float, float> forces the return type to be float, so clearly that error will disappear, although it doesn't remove the underlying cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants