Does G4 have a recommended way to apply patches locally?

Geant4 Version: 10.07.p04, 11.4.1


With many thanks to Gabriele and Dmitri for the fix in Bugzilla #2714 (https://geant4-forum.web.cern.ch/t/stale-pointers-in-parallel-worlds), we have been trying to apply this fix within our local simulation framework. I have a mechanism for that in place (left over from the Geant4 v9 → v10 transition!), but it really only works if the patch applies purely to a .cc file.

I’ve discovered that, because of G4MultiNavigator.hh transclusion, there are half a dozen additional classes in G4 which need to be recompiled. As near as I can tell, this means I need to modify our unpacked Geant4 installations, and rebuild them with the Bugzilla #2714 (Geant4 MR #5647) mods applied, to both Geant4 11.4.1 and the Very Old 10.07.p04 release.

Does Geant4 have a “recommended” way for large collaborations to do this? I should be able to use the changes from the MR to generate patch (diff -p) files for the two releases, and we could then apply that at our various CDMS computing sites. Is that what y’all would recommend, especially for 10.07.p04 support? Do you have a way to make a patch file for me that way?

Hi Mike, I can only really speak for how ATLAS handles this (Geant4 itself doesn’t have a recommended practice here, though I think the ATLAS approach is a good one). Here, a fork is made of the Geant4 GitLab repo:

(the GitHub mirror could equally be used). Branches are created from each release tested/used in production, with subsequent ATLAS specific or from upstream Geant4 patches applied to these. ATLAS specific tags are then made (basically adding a “tweak” version number) to specific points on that. The general idea can be seen here:

and:

Patches from diff/format-patch are then easy to apply and keep track of (doesn’t solve the rebuilding problem, that’s a packaging/deployment issue).

Anyway, irrespective of the method, for now I think all that would be needed is to for @gcosmo to create a patch from the internal MR and attach that to the Bugzilla ticket. Without knowing the details, that might need finessing to apply to older versions of course (this is where Git comes in handy to manage things through diff/conflicts).

Okay, thank you very much, Ben! Making a fork from GitLab seems like a reasonable approach (CDMS uses GitLab as well, so we could do this under the SuperCDMS workspace). With access to geant4-dev, I was able to save the diff-patch myself for 11.4.1 and apply it. I was also able to manually build a diff-patch for 10.07.p04 from my local installation.