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

patches to ldmx-sw following compiler update #1640

Merged
merged 32 commits into from
Mar 5, 2025
Merged

Conversation

tomeichlersmith
Copy link
Member

@tomeichlersmith tomeichlersmith commented Feb 28, 2025

I am updating ldmx-sw, here are the details.

What are the issues that this addresses?

This is following up on LDMX-Software/dev-build-context#103 . I will maintain an checklist here of patches that I need to make before I feel comfortable merging.

configure-quick

The configure-quick build does not enable as many warnings, but I still get the big ones so its a helpful place to start. After I patch these up, I can move to a configuration that enables more warnings (e.g. our standard configure).

  • std::iterator is deprecated, need to find replacement for HgcrocDigiCollection no replacement, just remove it and the callers deduce if the iterator class has the required functions
  • update configure Python for the specific python version included in Ubuntu 24.04
  • overflow potential in recon::PFTruthProducer when using ldmx::SimParticle::getParents
  • the HcalDigiPipelineTest is now failing 812 / 1000 of the test energies. All of the test hits being reconstructed return a daq_pe of 0 rather than something close to the real value. The tests below 40PE are passing because 0 is within 40 of the true value. I don't think this is as apocalyptic as it seems because the PR validations all pass and those include distributions on non-zero PE hits in the HCal. I am guessing it has to do with how the test is creating the hits or how Catch2 is working with the new compiler.
  • we got a new Boost, so maybe
    // This we may be able to remove after boost update
    #define BOOST_BIND_GLOBAL_PLACEHOLDERS
    can be removed

configure

The regular configure build enables additional warnings and clang tidy.

  • remove std::move in Process::getDummy - compiler can use copy elision to place the construction where it is first used
  • potential null pointer dereference in copy constructor of RunHeader which is inlined from importRunHeaders
  • dangling reference to temporary channel and msg_level in Logger
  • dangling pointer to unnamed temporary from using {} as default for logRules
  • some warnings from Catch2 internals, probably should upgrade Catch2 version we are using...
    • still there after locally updating to Catch2 3.8.0, its only in the NtupleManagerTest and comes from calling some match code NtuplemanagerTest.cxx:124-132
    • originates from using Catch::Matchers::UnorderedEquals, not sure if I'm misusing it though
  • nPos set but not used in EventReadoutProducer.cxx:64
  • taking absolute value of a bool in TrigScintTrackProducer.cxx:333
  • the address of overlayEvent_ will never be NULL
  • potential null pointer dereference from G4PrimaryVertex.hh
  • potential null pointer dereference in Kaonphysics::DumpDecayDetails (lots of them)
  • particleIndex set but not used in LHEReader and LHEPrimaryGenerator
  • memory use after freed inside Geant4 in EcalSD if certain conditions are met
  • potential null pointer dereference using G4String copy constructor
  • potential null pointer dereference calling GetLogicalVolume in a lot of the user actions
  • TaggerHitFilter same memory used after free as EcalSD
  • potential null pointer derefernece Recon/DBScanClusterBuilder.cxx:132, would be null dereference if size is zero

tomeichlersmith and others added 6 commits February 28, 2025 09:58
- copy over refactor from LDMX-Softwar/fire and merge in our improvements
- build into submodule
- still need to test that it works after refactor and update to the
  newer Python C API
@tvami
Copy link
Member

tvami commented Mar 1, 2025

Can you add

// This we may be able to remove after boost update

to the TODO list?

tomeichlersmith and others added 22 commits March 3, 2025 09:36
all tests compiling, Framework test passing the run
remove deprecated functions and use PyConfig style configuration before
the initialization of the python interpreter
- only open config file once
- close python interpreter if an exception is thrown after it is opened
we do not want python to parse the argv for us, we are already parsing
it and so when python parses it, the first argument is dropped as if it
was the 'python' command calling a script
this is only because we erroneously have a list of parents for sim
particles when all sim particles only ever have exactly one parent
we have been well established for only using the container for building
ldmx-sw for several years now. Additionally, this check is difficult to
maintain because there isn't a standardized way to check whether you are
in a container. The CI and I get this warning when using podman because
podman does not create either of the files listed in this check.
it is not used anywhere in the tests
- don't try to hold a reference, just use safe_extract in place when needed or copy
- define an empty object for logRules so that it is alive long enough to be used
older compilers didn't catch this because the code _does_ increment nPos
within the loop over adc values, but it never accesses its value for
something else
check for overlay event below when calling `nextEvent` on the overlay
@tomeichlersmith
Copy link
Member Author

I can't figure out the Hcal testing right now (I was hoping the additional warnings would point me towards something but they did not) and I want to wait on the nullptr dereferencing related to other developments, so I am marking this as Ready for Review.

The changes are all "small" in the sense that they are not expected to affect the physics. The previous PR Validation run did not show any differences and I am expecting the same again.

@tomeichlersmith tomeichlersmith marked this pull request as ready for review March 4, 2025 15:57
Comment on lines +39 to +40
Parameters run(const std::string& root_object, const std::string& pythonScript,
char* args[], int nargs);
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm sneaking in a refactor of the Configure/Python ecosystem that does a few things:

  1. Removes the extraneous ConfigurePython class in favor of a function that runs the python script and returns a Parameters of the configuration extracted.
  2. Updates Parameters to have shorter add and get methods.
  3. Promotes the "root object" that is used to extract the configuration to the argument so that hypothetically other programs could be written that use the same configuration system but with a different python object (e.g. https://github.com/LDMX-Software/ldmx-tb-online/tree/main/reformat could be brought in as a submodule with its own executable if we desired).

if (fabs(track.getCentroid() - nextTrack.getCentroid() <
3 * maxDelta_)) {
if (fabs(track.getCentroid() - nextTrack.getCentroid()) <
3 * maxDelta_) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@bryngemark I think this is just a misplaced closing parentheses since the newer compiler warned me that fabs(bool) doesn't make any sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

i agree with this change

Copy link
Member

@tvami tvami left a comment

Choose a reason for hiding this comment

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

Looks really good, I have a question and a small suggestion

@tvami tvami marked this pull request as draft March 4, 2025 21:04
@tvami tvami marked this pull request as ready for review March 4, 2025 21:04
Copy link
Contributor

@bryngemark bryngemark left a comment

Choose a reason for hiding this comment

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

Looks good to me. Not sure what to think about the HCal digi errors, ask an HCal code expert if you want a real opinion on that

@tomeichlersmith tomeichlersmith merged commit 96024b7 into trunk Mar 5, 2025
13 checks passed
@tomeichlersmith tomeichlersmith deleted the os-update branch March 5, 2025 16:33
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.

3 participants