Skip to content

Upgrade to WireTracker_info#83

Merged
jmcarcell merged 12 commits into
key4hep:mainfrom
sfranchel:sfranche-dev-wti
Jun 25, 2026
Merged

Upgrade to WireTracker_info#83
jmcarcell merged 12 commits into
key4hep:mainfrom
sfranchel:sfranche-dev-wti

Conversation

@sfranchel

Copy link
Copy Markdown
Contributor

BEGINRELEASENOTES

  • Update code to use WireTracker info instead of DCH, allowing for easier compatibility with other trackers

ENDRELEASENOTES

Updating DCH digitizers and part of the tracking code to use the WireTracker_info structure allowing to share more easily code between Drift Chamber and Straw Tubes tracker.

This PR will need first the changes in k4geo to be merged:
key4hep/k4geo#581

ccing @s6anloes

@sfranchel sfranchel changed the title Sfranche dev wti Upgrade to WireTracker_info May 12, 2026
@s6anloes

Copy link
Copy Markdown
Collaborator

Thanks for this PR!
I have asked @andread3vita to take a look at the changes in GenFit

@andread3vita

andread3vita commented May 12, 2026

Copy link
Copy Markdown
Contributor

Hi! When I run the ctest for the TrackFitter after compiling your version of k4geo, I get the following error:

GenfitTrackFitter  WARNING DCH_info unexpected error: ObjectExtensions::extension: The object has no extension of type 4491726DD2577FF6.. This may indicate missing drift chamber or configuration issues.
9: ApplicationMgr        INFO Application Manager Initialized successfully
9: ApplicationMgr        INFO Application Manager Started successfully
9: 
9: TUnixSystem::Di...   FATAL segmentation violation

Do I need to do anything else before running the fitter with WireTracker_info?

@s6anloes

Copy link
Copy Markdown
Collaborator

Hi! When I run the ctest for the TrackFitter after compiling your version of k4geo, I get the following error:

GenfitTrackFitter  WARNING DCH_info unexpected error: ObjectExtensions::extension: The object has no extension of type 4491726DD2577FF6.. This may indicate missing drift chamber or configuration issues.
9: ApplicationMgr        INFO Application Manager Initialized successfully
9: ApplicationMgr        INFO Application Manager Started successfully
9: 
9: TUnixSystem::Di...   FATAL segmentation violation

Do I need to do anything else before running the fitter with WireTracker_info?

@sfranchel , it seems you missed to change the extension type in your k4geo PR.
Specifically these lines (maybe some others as well):
https://github.com/sfranchel/k4geo/blob/21cb58f05b884f12235fef3e20a41cf52dfd7681/detector/tracker/DriftChamber_o1_v02.cpp#L42
https://github.com/sfranchel/k4geo/blob/21cb58f05b884f12235fef3e20a41cf52dfd7681/detector/tracker/DriftChamber_o1_v02.cpp#L485

Could you update there?

@s6anloes

Copy link
Copy Markdown
Collaborator

Ah sorry, nevermind. The new WireTracker_info is in the same namespace, I missed that. Then I'm not sure what the problem that @andread3vita is seeing is ...

@sfranchel

Copy link
Copy Markdown
Contributor Author

Thank you @andread3vita and @s6anloes for looking into this, I'll try replicate the error on my side and investigate the issue. Will report here updates.

@s6anloes s6anloes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have investigated the failing GenFit test a bit and have found a solution.
I will comment all the files that need to be changed, also in key4hep/k4geo#581 .
TODO: check also if digitiser is impacted

Comment thread Tracking/components/GenfitTrackFitter.cpp Outdated
Comment thread Tracking/components/GenfitTrackFitter.cpp Outdated
Comment thread Tracking/include/genfit_interfaces/GenfitTrack.h Outdated
Comment thread Tracking/include/genfit_interfaces/GenfitTrack.h Outdated
Comment thread Tracking/src/genfit_interfaces/GenfitTrack.cpp Outdated
Comment thread Tracking/include/genfit_interfaces/GenfitWireMeasurement.h Outdated
Comment thread Tracking/src/genfit_interfaces/GenfitWireMeasurement.cpp Outdated
Comment thread Tracking/src/genfit_interfaces/GenfitWireMeasurement.cpp Outdated
@sfranchel

sfranchel commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

I have investigated the failing GenFit test a bit and have found a solution. I will comment all the files that need to be changed, also in key4hep/k4geo#581 . TODO: check also if digitiser is impacted

Many thanks @s6anloes for pinning down the issue! Based on your suggestions I have updated the way that the DCH_info pointers are retrieved, and it seems to be working now. All ctests are passing locally! 🥳

@andread3vita

Copy link
Copy Markdown
Contributor

Hi @sfranchel! I confirm that this PR does not affect the fitter. It looks good to me!

@SanghyunKo SanghyunKo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one small comment on the Vector3D typedef, and another major request on catching the section cellID encoding scheme.

Comment thread DCHdigi/include/DCHdigi_v01.h Outdated
Comment thread DCHdigi/include/DCHdigi_v02.h Outdated
Comment thread DCHdigi/src/DCHdigi_v01.cpp Outdated
Comment thread DCHdigi/src/DCHdigi_v01.cpp
Comment thread DCHdigi/src/DCHdigi_v01.cpp Outdated
Comment thread DCHdigi/CMakeLists.txt
Comment thread Tracking/src/genfit_interfaces/GenfitWireMeasurement.cpp Outdated

@SanghyunKo SanghyunKo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_dc_decoder can be nullptr when the tracker is not a wire tracker:

try {
std::string DCH_name(m_DCH_name.value());
dd4hep::DetElement DCH_DE = m_geoSvc->getDetector()->detectors().at(DCH_name);
m_dch_info = DCH_DE.extension<dd4hep::rec::DCH_info>();
dd4hep::SensitiveDetector dch_sd = m_geoSvc->getDetector()->sensitiveDetector(DCH_name);
dd4hep::Readout dch_readout = dch_sd.readout();
m_dc_decoder = dch_readout.idSpec().decoder();
std::string desc = m_dc_decoder->fieldDescription();
std::set<std::string> fields;
std::stringstream ss(desc);
std::string token;
while (std::getline(ss, token, ',')) {
auto pos = token.find(':');
if (pos != std::string::npos) {
fields.insert(token.substr(0, pos));
}
}
if (!(fields.count("superlayer") && fields.count("layer") && fields.count("nphi"))) {
warning() << "DCH decoder missing required fields: " << desc << endmsg;
throw std::runtime_error("Invalid DCH decoder");
}
} catch (const std::exception& e) {
warning() << "DCH_info unexpected error: " << e.what()
<< ". This may indicate missing drift chamber or configuration issues." << endmsg;
}

(not a practical use-case, but safer to guard from nullptr since it is allowed in principle)

Comment thread Tracking/src/genfit_interfaces/GenfitTrack.cpp Outdated
@SanghyunKo

Copy link
Copy Markdown
Collaborator

Now looks good to me :)

sfranchel and others added 7 commits June 18, 2026 17:28
Ensure that polymorphism work with WireTracker_info subclasses

Co-authored-by: Andreas Loeschcke Centeno <53434935+s6anloes@users.noreply.github.com>
* use a try catch for retrival of sector
* get the dch pointer via dinamic cast of the WireTracker_info_struct
* fix  v1  of the dch digitizer
* update some comments and function naming
Co-authored-by: Sanghyun Ko <37464245+SanghyunKo@users.noreply.github.com>
@s6anloes

Copy link
Copy Markdown
Collaborator

TFile::TFile ERROR file /k4rectracker/DCHdigi/test/test_DCHdigi/dch_proton_10GeV_.root does not exist

It seems the tests are failing because the CI_TYPE environment variable in DCHdigi/test/test_DCHdigi/test_DCHdigi.sh is not correctly filled:
ddsim --steeringFile sim_steering.py --outputFile 'dch_proton_10GeV_${CI_TYPE}.root' -N 10 --runType batch --random.seed 42

@jmcarcell , do you have experience with this problem?

@sfranchel

sfranchel commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Hi @s6anloes that CI_TYPE was a naive attempt to make sure the correct files are considered during the CI running. But that was very poorly implemented and would have required a bit more changes. So I removed it for now... In any case, at the moment I see CI tests passing locally when compiling with the nightly release.

@s6anloes

Copy link
Copy Markdown
Collaborator

Okay so now the tests fail for alma9 and ubuntu26, but run for ubuntu24.
The problem seems to be the k4geo that is found.

For ubuntu24:
-- Found k4geo: /cvmfs/sw-nightlies.hsf.org/key4hep/releases/2026-06-22/x86_64-ubuntu24.04-gcc13.3.0-opt/k4geo/e62aebd647d04585521b19098e80f5ff71b7cd8e_develop-prkriy/lib/cmake/k4geo/k4geoConfig.cmake

For alma9:
-- Found k4geo: /cvmfs/sft-nightlies.cern.ch/lcg/views/devkey-head/Sat/x86_64-el9-gcc14-opt/lib/cmake/k4geo/k4geoConfig.cmake

Could it be a problem with the new lcg stacks of key4hep, @jmcarcell @andresailer ?
The new WireTracker_info class that is now utilised by the drift chamber is present though in the lcg nightly:

$ echo $K4GEO
/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/devkey-head/Sat/k4geo/HEAD/x86_64-el9-gcc14-opt/share/k4geo

$ ls /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/devkey-head/Sat/k4geo/HEAD/x86_64-el9-gcc14-opt/include/detectorCommon/
DetUtils_k4geo.h  WireTracker_info.h  xtalk_neighbors_moduleThetaMergedSegmentation.h

@jmcarcell

Copy link
Copy Markdown
Member

Okay so now the tests fail for alma9 and ubuntu26, but run for ubuntu24. The problem seems to be the k4geo that is found.

For ubuntu24: -- Found k4geo: /cvmfs/sw-nightlies.hsf.org/key4hep/releases/2026-06-22/x86_64-ubuntu24.04-gcc13.3.0-opt/k4geo/e62aebd647d04585521b19098e80f5ff71b7cd8e_develop-prkriy/lib/cmake/k4geo/k4geoConfig.cmake

For alma9: -- Found k4geo: /cvmfs/sft-nightlies.cern.ch/lcg/views/devkey-head/Sat/x86_64-el9-gcc14-opt/lib/cmake/k4geo/k4geoConfig.cmake

Could it be a problem with the new lcg stacks of key4hep, @jmcarcell @andresailer ? The new WireTracker_info class that is now utilised by the drift chamber is present though in the lcg nightly:

$ echo $K4GEO
/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/devkey-head/Sat/k4geo/HEAD/x86_64-el9-gcc14-opt/share/k4geo

$ ls /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/devkey-head/Sat/k4geo/HEAD/x86_64-el9-gcc14-opt/include/detectorCommon/
DetUtils_k4geo.h  WireTracker_info.h  xtalk_neighbors_moduleThetaMergedSegmentation.h

Ignore this for now, may be related to https://gitlab.cern.ch/gaudi/Gaudi/-/work_items/398.

@s6anloes

Copy link
Copy Markdown
Collaborator

Ignore this for now

What exactly do you mean with 'this'?
Do you mean we should ignore my assumption that it has anything to do with the spack vs lcg build of key4hep, and try to find a solution based on the link you provided?

Or do you mean we should ignore the failing test, because it should run locally, meaning we can go ahead and merge?

Or do we ignore in the sense that we have to wait until it is fixed on the Gaudi side?

@jmcarcell

Copy link
Copy Markdown
Member

That you can merge, if it's that issue in Gaudi then once this PR lands in the builds then CI should work fine.

@s6anloes s6anloes enabled auto-merge (squash) June 25, 2026 09:03
@s6anloes s6anloes disabled auto-merge June 25, 2026 09:04
@s6anloes

Copy link
Copy Markdown
Collaborator

I don't have permission to merge until the checks succeed it appears.
Can you do it, @jmcarcell ?
Thanks!

@jmcarcell jmcarcell merged commit 8973e46 into key4hep:main Jun 25, 2026
3 of 6 checks passed
@sfranchel sfranchel deleted the sfranche-dev-wti branch June 25, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants