Skip to content

Commit e049b21

Browse files
Factory updates and unification (#1704)
* move library dyn loading into Process where it is called now Framework/PluginFactory and SimCore/Factory have the same responsibilities and so we should (hopefully) be able to replace one with the other * add enable_exports property * dont compile unrelated stuff just tring to make testing faster * change justfile to be able to have parallel builds don't plan to merge this, just helping myself for testing * add status messages and a static counter inside the class * try manually loading the SDs library * compiling libraries as *dependencies* of SimCore functions This only works for Clang and not for GCC. For Clang, I _think_ this works because it uniquely defines a single source of truth of the static variable for the compiler. For GCC, we get an "undefined symbol error" when attempting to load the PhotoNuclearModels library. The symbol is the implementation of the *base* class which resides in SimCore and not SimCore_PhotoNuclearModels so I'm going to try moving the base class into the specific library now. * move PhotoNuclearModel base class into PhotoNuclearModels library * move SensitiveDetector base class into SDs library * move PrimaryGenerator base class into Generators library * remove previous manual loading * move XsecBiasingOperator base class into BiasOperators library * re-enable all parts of ldmx-sw for further testing * add ecal_pn test for Biasing UserActions, clang compilation * move Factory singleton instance into Prototype class This allows there to be exactly one TU where the `static` variable is defined. Before, when the `static Factory` was in the header with the templated class itself, I believe it was being erroneously _defined_ in multiple TUs. Now that it is only ever defined in one TU, the dynamic factory appears to be working with both GCC and Clang with LTO. * Revert "add enable_exports property" This reverts commit bff8047. This additional property is not necessary and I think removing it helps make the CMake code a bit more understandable. Trying to keep things clean. * mv SimCore/Factory to Framework/Factory * SHOULD REVERT: shortening test configs since I'm just testing loading * replace PluginFactory with templated Factory * move registration macro definition to Factory level remove ParserFactory now that it is redundant, replace with framework::Factory * better exclude rules for doxygen * rename macros to align with our coding rules/habits * re-enable testing * clang-format after all these changes * update links and docs of Factory * revert developing changes to test configs and justfile * drop one level of macro indirection The newer FACTORY_REGISTRATION macro does not need to separate the namespace from the class name in order to function, so I am dropping the *_NS macros from Framework and dropping the NS argument from the UserAction macro. This was simple enough syntax to rewrite with sed which made it easy enough for me to do. sed '/^DECLARE_/ s/_NS//; /^DECLARE_/ s/,\s*/::/' Only applying this to files where I knew a declaration took place. * should be able to run tests with clang-lto build now * Apply clang-format * add more detailed things to check to UnableToCreate error * add C++20 standard flag to from-file compilation command * add extra space for readability * update documentation comment on Analyzer::beforeNewRun * cleanup SimCore/CMakeLists.txt since I'm already here isolate SimCore::Geo and remove unnecessary registered_targets link * update Factory to return [[nodiscard]] std::optional This helps us make sure that we are checking that the factory successfully created the object we asked for. Additionally, I separated out the warehouse_ into its own derived Factory (FactoryWithWarehouse) that can be used simply by using a different macro. This is nice since many of the prototypes that use the factory already have a central storage location for the objects and don't need the warehouse carrying around copies of the pointers itself. * Apply clang-format --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent f8c7c0f commit e049b21

File tree

221 files changed

+1028
-1220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+1028
-1220
lines changed

.github/workflows/compile_clang_lto.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ jobs:
2929
run: |
3030
just install-denv init configure-clang-lto-fail-on-warning
3131
just build
32+
just test

Biasing/src/Biasing/DeepEcalProcessFilter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,4 @@ void DeepEcalProcessFilter::NewStage() {
120120
}
121121
} // namespace biasing
122122

123-
DECLARE_ACTION(biasing, DeepEcalProcessFilter)
123+
DECLARE_ACTION(biasing::DeepEcalProcessFilter)

Biasing/src/Biasing/EcalDarkBremFilter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@ void EcalDarkBremFilter::AbortEvent(const std::string& reason) const {
141141
}
142142
} // namespace biasing
143143

144-
DECLARE_ACTION(biasing, EcalDarkBremFilter)
144+
DECLARE_ACTION(biasing::EcalDarkBremFilter)

Biasing/src/Biasing/EcalProcessFilter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,4 @@ void EcalProcessFilter::stepping(const G4Step* step) {
188188
}
189189
} // namespace biasing
190190

191-
DECLARE_ACTION(biasing, EcalProcessFilter)
191+
DECLARE_ACTION(biasing::EcalProcessFilter)

Biasing/src/Biasing/MidShowerDiMuonBkgdFilter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,4 @@ void MidShowerDiMuonBkgdFilter::AbortEvent(const std::string& reason) const {
119119
}
120120
} // namespace biasing
121121

122-
DECLARE_ACTION(biasing, MidShowerDiMuonBkgdFilter)
122+
DECLARE_ACTION(biasing::MidShowerDiMuonBkgdFilter)

Biasing/src/Biasing/MidShowerNuclearBkgdFilter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ void MidShowerNuclearBkgdFilter::AbortEvent(const std::string& reason) const {
117117
}
118118
} // namespace biasing
119119

120-
DECLARE_ACTION(biasing, MidShowerNuclearBkgdFilter)
120+
DECLARE_ACTION(biasing::MidShowerNuclearBkgdFilter)

Biasing/src/Biasing/NonFiducialFilter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@ void NonFiducialFilter::EndOfEventAction(const G4Event*) {
108108
}
109109
} // namespace biasing
110110

111-
DECLARE_ACTION(biasing, NonFiducialFilter)
111+
DECLARE_ACTION(biasing::NonFiducialFilter)

Biasing/src/Biasing/PhotoNuclearProductsFilter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ void PhotoNuclearProductsFilter::stepping(const G4Step* step) {
7878
}
7979
} // namespace biasing
8080

81-
DECLARE_ACTION(biasing, PhotoNuclearProductsFilter)
81+
DECLARE_ACTION(biasing::PhotoNuclearProductsFilter)

Biasing/src/Biasing/PhotoNuclearTopologyFilters.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ void PhotoNuclearTopologyFilter::stepping(const G4Step* step) {
7777

7878
} // namespace biasing
7979

80-
DECLARE_ACTION(biasing, NothingHardFilter)
81-
DECLARE_ACTION(biasing, SingleNeutronFilter)
80+
DECLARE_ACTION(biasing::NothingHardFilter)
81+
DECLARE_ACTION(biasing::SingleNeutronFilter)

Biasing/src/Biasing/PrimaryToEcalFilter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ void PrimaryToEcalFilter::stepping(const G4Step* step) {
6060

6161
} // namespace biasing
6262

63-
DECLARE_ACTION(biasing, PrimaryToEcalFilter)
63+
DECLARE_ACTION(biasing::PrimaryToEcalFilter)

0 commit comments

Comments
 (0)