eic / eic/EDM4eic

Ambiguous overloads for Vector3f operators in edm4hep and edm4eic

Open
#56 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
4
Forks
7
Avg merge
1d 8h
Merged PRs (30d)
3

Description

### Environment: (where does this bug occur, have you tried other environments)
- Which branch (often `main` for latest released): 3.0.1
- Which version (or `HEAD` for the most recent on git): 3.0.1
- Any specific OS or system where the issue occurs? on my local system
- Any special versions of ROOT or Geant4? nothing special, edm4hep-0.9, edm4eic-3.0.1, no modifications

### Steps to reproduce: (give a step by step account of how to trigger the bug)
1. Attempt to compile EICrecon

### Expected Result: (what do you expect when you execute the steps above)
Compilation should not fail due to ambiguous overloads in the data models.

### Actual Result: (what do you get when you execute the steps above)
```
/home/wdconinc/git/EICrecon/src/algorithms/pid/ParticlesWithPID.cc: In member function ‘bool eicrecon::ParticlesWithPID::linkCherenkovPID(edm4eic::MutableReconstructedParticle&, const edm4eic::CherenkovParticleIDCollection&, edm4hep::ParticleIDCollection&)’:
/home/wdconinc/git/EICrecon/src/algorithms/pid/ParticlesWithPID.cc:263:69: error: ambiguous overload for ‘operator/’ (operand types are ‘const edm4hep::Vector3f’ and ‘std::size_t’ {aka ‘long unsigned int’})
263 | in_track_p = in_track_p + ( in_track_point.momentum / in_track.points_size() );
| ~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
| | |
| const edm4hep::Vector3f std::size_t {aka long unsigned int}
In file included from /home/wdconinc/git/EICrecon/src/algorithms/pid/ParticlesWithPID.cc:6:
/opt/local/include/edm4eic/vector_utils.h:153:34: note: candidate: ‘V operator/(const V&, double) [with V = edm4hep::Vector3f]’
153 | template V operator/(const V& v, const double d) {
| ^~~~~~~~
In file included from /home/wdconinc/git/EICrecon/src/algorithms/pid/ParticlesWithPID.cc:7:
/opt/local/include/edm4hep/utils/vector_utils.h:266:20: note: candidate: ‘constexpr V edm4hep::operator/(const V&, double) [with V = Vector3f]’
266 | inline constexpr V operator/(const V& v, const double d) {
| ^~~~~~~~
```

### Additional Context
I consider this a bug on the edm4eic side, since we should be able to reuse the edm4hep vector utils. I also wonder why this suddenly doesn't work anymore (I'm experimenting with c++20 support, so maybe template resolution rules are slightly different such that constexpr is now treated as different from non-constexpr).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the EICrecon compilation failure at ParticlesWithPID.cc:263. Compare the operator overloads shown in edm4eic/vector_utils.h and edm4hep/utils/vector_utils.h, then verify that compiling the affected data-model use no longer reports an ambiguous Vector3f division overload.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.