From 48a599fc8adcbfe414d27643b53e7adfacbb3367 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Tue, 5 Aug 2025 21:04:16 -0400 Subject: [PATCH 1/3] Support both old and new versions of JOmniFactory::PreInit --- src/extensions/jana/JOmniFactory.h | 33 +++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/extensions/jana/JOmniFactory.h b/src/extensions/jana/JOmniFactory.h index ffd391eaee..cbfff91e37 100644 --- a/src/extensions/jana/JOmniFactory.h +++ b/src/extensions/jana/JOmniFactory.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #if SPDLOG_VERSION >= 11400 && (!defined(SPDLOG_NO_TLS) || !SPDLOG_NO_TLS) @@ -40,20 +41,46 @@ class JOmniFactory : public jana::components::JOmniFactory { std::shared_ptr m_logger; public: + + // This PreInit is needed for JANA2 <= 2.4.3 inline void PreInit(std::string tag, JEventLevel level, std::vector input_collection_names, std::vector input_collection_levels, std::vector output_collection_names) { - // PreInit using the underlying JANA JOmniFactory - JANA_JOmniFactory::PreInit(tag, level, input_collection_names, input_collection_levels, - output_collection_names); + if constexpr (JVersion::major*10000 + JVersion::minor*100 + JVersion::patch < 20403) { + // PreInit using the underlying JANA JOmniFactory + JANA_JOmniFactory::PreInit(tag, level, input_collection_names, input_collection_levels, + output_collection_names); + } // But obtain our own logger (defines the parameter option) m_logger = this->GetApplication()->template GetService()->logger(this->GetPrefix()); } + // This PreInit is needed for JANA2 >= 2.4.3 + inline void PreInit(std::string tag, + JEventLevel level, + std::vector input_collection_names, + std::vector input_collection_levels, + std::vector> variadic_input_collection_names, + std::vector variadic_input_collection_levels, + std::vector output_collection_names, + std::vector> variadic_output_collection_names + ) { + // PreInit using the underlying JANA JOmniFactory + if constexpr (JVersion::major*10000 + JVersion::minor*100 + JVersion::patch >= 20403) { + JANA_JOmniFactory::PreInit(tag, level, input_collection_names, input_collection_levels, + variadic_input_collection_names, variadic_input_collection_levels, + output_collection_names, variadic_output_collection_names); + } + + // But obtain our own logger (defines the parameter option) + m_logger = this->GetApplication()->template GetService()->logger(this->GetPrefix()); +} + + virtual void ChangeRun(int32_t /* run_number */) override {}; virtual void Execute(int32_t run_number, uint64_t event_number) { From d38c9bf59d5f1200c02d3fa5a5ff7c751e819c29 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Wed, 6 Aug 2025 15:04:03 -0400 Subject: [PATCH 2/3] Specify variadic input and output names the JANA2 2.4.3 way Use preprocessor instead of constexpr if --- src/detectors/DRICH/DRICH.cc | 29 ++++-- src/detectors/EEMC/EEMC.cc | 33 +++++-- src/detectors/LOWQ2/LOWQ2.cc | 147 +++++++++++++++++++++-------- src/global/beam/beam.cc | 41 +++++--- src/global/reco/reco.cc | 51 +++++++--- src/global/tracking/tracking.cc | 161 ++++++++++++++++++++++---------- 6 files changed, 333 insertions(+), 129 deletions(-) diff --git a/src/detectors/DRICH/DRICH.cc b/src/detectors/DRICH/DRICH.cc index a81ee46572..7006315891 100644 --- a/src/detectors/DRICH/DRICH.cc +++ b/src/detectors/DRICH/DRICH.cc @@ -131,8 +131,16 @@ void InitPlugin(JApplication* app) { "DRICHGasTracks", {"CentralCKFTracks", "CentralCKFActsTrajectories", "CentralCKFActsTracks"}, {"DRICHGasTracks"}, gas_track_cfg)); - app->Add(new JOmniFactoryGeneratorT( - "DRICHMergedTracks", {"DRICHAerogelTracks", "DRICHGasTracks"}, {"DRICHMergedTracks"}, {})); +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "DRICHMergedTracks", {"DRICHAerogelTracks", "DRICHGasTracks"}, {"DRICHMergedTracks"}, {})); +#else + app->Add(new JOmniFactoryGeneratorT( { + .tag = "DRICHMergedTracks", + .variadic_input_names = {{"DRICHAerogelTracks", "DRICHGasTracks"}}, + .output_names = {"DRICHMergedTracks"} + })); +#endif // PID algorithm app->Add(new JOmniFactoryGeneratorT( @@ -142,10 +150,19 @@ void InitPlugin(JApplication* app) { {"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"}, irt_cfg)); // merge aerogel and gas PID results - app->Add(new JOmniFactoryGeneratorT( - "DRICHMergedIrtCherenkovParticleID", - {"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"}, - {"DRICHMergedIrtCherenkovParticleID"}, merge_cfg)); +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "DRICHMergedIrtCherenkovParticleID", + {"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"}, + {"DRICHMergedIrtCherenkovParticleID"}, merge_cfg)); +#else + app->Add(new JOmniFactoryGeneratorT({ + .tag = "DRICHMergedIrtCherenkovParticleID", + .variadic_input_names = {{"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"}}, + .output_names = {"DRICHMergedIrtCherenkovParticleID"}, + .configs = merge_cfg + })); +#endif // clang-format on } diff --git a/src/detectors/EEMC/EEMC.cc b/src/detectors/EEMC/EEMC.cc index 4af56e3d95..c063d6a127 100644 --- a/src/detectors/EEMC/EEMC.cc +++ b/src/detectors/EEMC/EEMC.cc @@ -179,18 +179,31 @@ void InitPlugin(JApplication* app) { "EcalEndcapNParticleIDInput_features", "EcalEndcapNParticleIDTarget", })); - app->Add(new JOmniFactoryGeneratorT( - "EcalEndcapNParticleIDInference", +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "EcalEndcapNParticleIDInference", { - "EcalEndcapNParticleIDInput_features", - }, - { - "EcalEndcapNParticleIDOutput_label", - "EcalEndcapNParticleIDOutput_probability_tensor", - }, + "EcalEndcapNParticleIDInput_features", + }, + { + "EcalEndcapNParticleIDOutput_label", + "EcalEndcapNParticleIDOutput_probability_tensor", + }, { - .modelPath = "calibrations/onnx/EcalEndcapN_pi_rejection.onnx", - })); + .modelPath = "calibrations/onnx/EcalEndcapN_pi_rejection.onnx", + })); +#else + app->Add(new JOmniFactoryGeneratorT({ + .tag="EcalEndcapNParticleIDInference", + .variadic_input_names={{ "EcalEndcapNParticleIDInput_features", }}, + .variadic_output_names={{ + "EcalEndcapNParticleIDOutput_label", + "EcalEndcapNParticleIDOutput_probability_tensor", + }}, + .configs={ + .modelPath = "calibrations/onnx/EcalEndcapN_pi_rejection.onnx", + }})); +#endif app->Add(new JOmniFactoryGeneratorT( "EcalEndcapNParticleIDPostML", { diff --git a/src/detectors/LOWQ2/LOWQ2.cc b/src/detectors/LOWQ2/LOWQ2.cc index 06d376a21f..2d3f1becbd 100644 --- a/src/detectors/LOWQ2/LOWQ2.cc +++ b/src/detectors/LOWQ2/LOWQ2.cc @@ -133,20 +133,44 @@ void InitPlugin(JApplication* app) { } } - app->Add(new JOmniFactoryGeneratorT>( - "TaggerTrackerSplitHits", {"TaggerTrackerRecHits"}, geometryDivisionCollectionNames, - { - .function = GeometrySplit{geometryDivisions, readout, geometryLabels}, - })); +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT>( + "TaggerTrackerSplitHits", {"TaggerTrackerRecHits"}, geometryDivisionCollectionNames, + { + .function = GeometrySplit{geometryDivisions, readout, geometryLabels}, + })); +#else + app->Add(new JOmniFactoryGeneratorT>({ + .tag="TaggerTrackerSplitHits", + .input_names={"TaggerTrackerRecHits"}, + .variadic_output_names = {geometryDivisionCollectionNames}, + .configs={ + .function = GeometrySplit{geometryDivisions, readout, geometryLabels}, + }})); +#endif + +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "TaggerTrackerClustering", geometryDivisionCollectionNames, outputClusterCollectionNames, + { + .readout = "TaggerTrackerHits", + .x_field = "x", + .y_field = "y", + .hit_time_limit = 10 * edm4eic::unit::ns, + })); +#else + app->Add(new JOmniFactoryGeneratorT({ + .tag = "TaggerTrackerClustering", + .variadic_input_names = {geometryDivisionCollectionNames}, + .variadic_output_names = {outputClusterCollectionNames}, + .configs = { + .readout = "TaggerTrackerHits", + .x_field = "x", + .y_field = "y", + .hit_time_limit = 10 * edm4eic::unit::ns, + }})); +#endif - app->Add(new JOmniFactoryGeneratorT( - "TaggerTrackerClustering", geometryDivisionCollectionNames, outputClusterCollectionNames, - { - .readout = "TaggerTrackerHits", - .x_field = "x", - .y_field = "y", - .hit_time_limit = 10 * edm4eic::unit::ns, - })); // Linear tracking for each module, loop over modules for (std::size_t i = 0; i < moduleIDs.size(); i++) { @@ -154,30 +178,62 @@ void InitPlugin(JApplication* app) { std::string outputTrackAssociationTag = outputTrackAssociationTags[i]; std::vector inputClusterTags = moduleClusterTags[i]; - inputClusterTags.emplace_back("TaggerTrackerRawHitAssociations"); - - app->Add(new JOmniFactoryGeneratorT( - outputTrackTag, {inputClusterTags}, {outputTrackTag, outputTrackAssociationTag}, - { - .layer_hits_max = 200, - .chi2_max = 0.001, - .n_layer = 4, - .restrict_direction = true, - .optimum_theta = -M_PI + 0.026, - .optimum_phi = 0, - .step_angle_tolerance = 0.05, - })); +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + inputClusterTags.emplace_back("TaggerTrackerRawHitAssociations"); + app->Add(new JOmniFactoryGeneratorT( + outputTrackTag, {inputClusterTags}, {outputTrackTag, outputTrackAssociationTag}, + { + .layer_hits_max = 200, + .chi2_max = 0.001, + .n_layer = 4, + .restrict_direction = true, + .optimum_theta = -M_PI + 0.026, + .optimum_phi = 0, + .step_angle_tolerance = 0.05, + })); +#else + app->Add(new JOmniFactoryGeneratorT({ + .tag = outputTrackTag, + .input_names = {"TaggerTrackerRawHitAssociations"}, + .variadic_input_names = {inputClusterTags}, + .output_names = {outputTrackTag, outputTrackAssociationTag}, + .configs = { + .layer_hits_max = 200, + .chi2_max = 0.001, + .n_layer = 4, + .restrict_direction = true, + .optimum_theta = -M_PI + 0.026, + .optimum_phi = 0, + .step_angle_tolerance = 0.05, + }})); +#endif } - // Combine the tracks from each module into one collection - app->Add(new JOmniFactoryGeneratorT>( - "TaggerTrackerLocalTracks", outputTrackTags, {"TaggerTrackerLocalTracks"})); +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + // Combine the tracks from each module into one collection + app->Add(new JOmniFactoryGeneratorT>( + "TaggerTrackerLocalTracks", outputTrackTags, {"TaggerTrackerLocalTracks"})); + + // Combine the associations from each module into one collection + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "TaggerTrackerLocalTrackAssociations", outputTrackAssociationTags, + {"TaggerTrackerLocalTrackAssociations"})); +#else + // Combine the tracks from each module into one collection + app->Add(new JOmniFactoryGeneratorT>({ + .tag="TaggerTrackerLocalTracks", + .variadic_input_names={outputTrackTags}, + .output_names = {"TaggerTrackerLocalTracks"}})); - // Combine the associations from each module into one collection - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "TaggerTrackerLocalTrackAssociations", outputTrackAssociationTags, - {"TaggerTrackerLocalTrackAssociations"})); + // Combine the associations from each module into one collection + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>({ + .tag="TaggerTrackerLocalTrackAssociations", + .variadic_input_names = {outputTrackAssociationTags}, + .output_names = {"TaggerTrackerLocalTrackAssociations"} + })); +#endif // Project tracks onto a plane app->Add(new JOmniFactoryGeneratorT( @@ -197,12 +253,23 @@ void InitPlugin(JApplication* app) { { .beamE = 10.0, })); - app->Add(new JOmniFactoryGeneratorT( - "TaggerTrackerTransportationInference", {"TaggerTrackerFeatureTensor"}, - {"TaggerTrackerPredictionTensor"}, - { - .modelPath = "calibrations/onnx/TaggerTrackerTransportation.onnx", - })); + +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "TaggerTrackerTransportationInference", {"TaggerTrackerFeatureTensor"}, + {"TaggerTrackerPredictionTensor"}, + { + .modelPath = "calibrations/onnx/TaggerTrackerTransportation.onnx", + })); +#else + app->Add(new JOmniFactoryGeneratorT({ + .tag= "TaggerTrackerTransportationInference", + .variadic_input_names = {{"TaggerTrackerFeatureTensor"}}, + .variadic_output_names = {{"TaggerTrackerPredictionTensor"}}, + .configs = { + .modelPath = "calibrations/onnx/TaggerTrackerTransportation.onnx", + }})); +#endif app->Add(new JOmniFactoryGeneratorT( "TaggerTrackerTransportationPostML", {"TaggerTrackerPredictionTensor", "MCBeamElectrons"}, {"TaggerTrackerReconstructedParticles"}, diff --git a/src/global/beam/beam.cc b/src/global/beam/beam.cc index 813a76c893..e489c6a3f5 100644 --- a/src/global/beam/beam.cc +++ b/src/global/beam/beam.cc @@ -34,16 +34,35 @@ void InitPlugin(JApplication* app) { std::vector> values{{4, 11}, {4, 2212}, {4, 2112}, {1, 11}, {1, 2212}, {1, 2112}}; - app->Add(new JOmniFactoryGeneratorT>( - "BeamParticles", {"MCParticles"}, outCollections, - { - .function = - ValueSplit<&edm4hep::MCParticle::getGeneratorStatus, &edm4hep::MCParticle::getPDG>{ - values}, - })); - - // Combine beam protons and neutrons into beam hadrons - app->Add(new JOmniFactoryGeneratorT>( - "MCBeamHadrons", {"MCBeamProtons", "MCBeamNeutrons"}, {"MCBeamHadrons"})); +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + + app->Add(new JOmniFactoryGeneratorT>( + "BeamParticles", {"MCParticles"}, outCollections, + { + .function = + ValueSplit<&edm4hep::MCParticle::getGeneratorStatus, &edm4hep::MCParticle::getPDG>{ + values}, + })); + + // Combine beam protons and neutrons into beam hadrons + app->Add(new JOmniFactoryGeneratorT>( + "MCBeamHadrons", {"MCBeamProtons", "MCBeamNeutrons"}, {"MCBeamHadrons"})); + +#else + + app->Add(new JOmniFactoryGeneratorT>({ + .tag = "BeamParticles", + .input_names = {"MCParticles"}, + .variadic_output_names = {outCollections}, + .configs = { + .function = + ValueSplit<&edm4hep::MCParticle::getGeneratorStatus, &edm4hep::MCParticle::getPDG>{values} + }})); + + app->Add(new JOmniFactoryGeneratorT>({ + .tag="MCBeamHadrons", + .variadic_input_names = {{"MCBeamProtons", "MCBeamNeutrons"}}, + .output_names = {"MCBeamHadrons"}})); +#endif } } diff --git a/src/global/reco/reco.cc b/src/global/reco/reco.cc index 531645e886..5fa4069a8d 100644 --- a/src/global/reco/reco.cc +++ b/src/global/reco/reco.cc @@ -70,16 +70,32 @@ void InitPlugin(JApplication* app) { app->Add(new JOmniFactoryGeneratorT( "GeneratedParticles", {"MCParticles"}, {"GeneratedParticles"})); - app->Add(new JOmniFactoryGeneratorT>( - "EcalClusters", {"EcalEndcapNClusters", "EcalBarrelScFiClusters", "EcalEndcapPClusters"}, - {"EcalClusters"})); - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "EcalClusterAssociations", - {"EcalEndcapNClusterAssociations", "EcalBarrelScFiClusterAssociations", - "EcalEndcapPClusterAssociations"}, - {"EcalClusterAssociations"})); +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT>( + "EcalClusters", {"EcalEndcapNClusters", "EcalBarrelScFiClusters", "EcalEndcapPClusters"}, + {"EcalClusters"})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "EcalClusterAssociations", + {"EcalEndcapNClusterAssociations", "EcalBarrelScFiClusterAssociations", + "EcalEndcapPClusterAssociations"}, + {"EcalClusterAssociations"})); +#else + app->Add(new JOmniFactoryGeneratorT>({ + .tag="EcalClusters", + .variadic_input_names={{"EcalEndcapNClusters", "EcalBarrelScFiClusters", "EcalEndcapPClusters"}}, + .output_names={"EcalClusters"} + })); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>({ + .tag="EcalClusterAssociations", + .variadic_input_names={{"EcalEndcapNClusterAssociations", "EcalBarrelScFiClusterAssociations", + "EcalEndcapPClusterAssociations"}}, + .output_names={"EcalClusterAssociations"}})); +#endif app->Add(new JOmniFactoryGeneratorT( "ReconstructedParticlesWithAssoc", @@ -119,10 +135,19 @@ void InitPlugin(JApplication* app) { "InclusiveKinematicsESigma", {"MCParticles", "ScatteredElectronsTruth", "HadronicFinalState"}, {"InclusiveKinematicsESigma"})); - // InclusiveKinematicseSigma is deprecated and will be removed, use InclusiveKinematicsESigma instead - app->Add(new JOmniFactoryGeneratorT>( - "InclusiveKinematicseSigma_legacy", {"InclusiveKinematicsESigma"}, - {"InclusiveKinematicseSigma"})); + +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + // InclusiveKinematicseSigma is deprecated and will be removed, use InclusiveKinematicsESigma instead + app->Add(new JOmniFactoryGeneratorT>( + "InclusiveKinematicseSigma_legacy", {"InclusiveKinematicsESigma"}, + {"InclusiveKinematicseSigma"})); +#else + // InclusiveKinematicseSigma is deprecated and will be removed, use InclusiveKinematicsESigma instead + app->Add(new JOmniFactoryGeneratorT>({ + .tag="InclusiveKinematicseSigma_legacy", + .variadic_input_names={{"InclusiveKinematicsESigma"}}, + .output_names={"InclusiveKinematicseSigma"}})); +#endif app->Add(new JOmniFactoryGeneratorT< InclusiveKinematicsReconstructed_factory>( diff --git a/src/global/tracking/tracking.cc b/src/global/tracking/tracking.cc index d320446a63..7d2e3412a0 100644 --- a/src/global/tracking/tracking.cc +++ b/src/global/tracking/tracking.cc @@ -51,35 +51,69 @@ void InitPlugin(JApplication* app) { std::vector> thetaRanges{{0, 50 * dd4hep::mrad}, {50 * dd4hep::mrad, 180 * dd4hep::deg}}; - app->Add(new JOmniFactoryGeneratorT>( - "CentralB0TrackTruthSeeds", {"TrackTruthSeeds"}, - {"B0TrackerTruthSeeds", "CentralTrackerTruthSeeds"}, - { - .function = RangeSplit<&edm4eic::TrackParameters::getTheta>(thetaRanges), - })); + +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT>( + "CentralB0TrackTruthSeeds", {"TrackTruthSeeds"}, + {"B0TrackerTruthSeeds", "CentralTrackerTruthSeeds"}, + { + .function = RangeSplit<&edm4eic::TrackParameters::getTheta>(thetaRanges), + })); +#else + app->Add(new JOmniFactoryGeneratorT>({ + .tag="CentralB0TrackTruthSeeds", + .input_names={"TrackTruthSeeds"}, + .variadic_output_names={{"B0TrackerTruthSeeds", "CentralTrackerTruthSeeds"}}, + .configs={ + .function = RangeSplit<&edm4eic::TrackParameters::getTheta>(thetaRanges), + }})); +#endif // CENTRAL TRACKER - // Tracker hits collector - app->Add(new JOmniFactoryGeneratorT>( - "CentralTrackingRecHits", - {"SiBarrelTrackerRecHits", "SiBarrelVertexRecHits", "SiEndcapTrackerRecHits", - "TOFBarrelRecHits", "TOFEndcapRecHits", "MPGDBarrelRecHits", "OuterMPGDBarrelRecHits", - "BackwardMPGDEndcapRecHits", "ForwardMPGDEndcapRecHits"}, - {"CentralTrackingRecHits"} // Output collection name - )); - - // Tracker hit associations collector - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "CentralTrackingRawHitAssociations", - {"SiBarrelRawHitAssociations", "SiBarrelVertexRawHitAssociations", - "SiEndcapTrackerRawHitAssociations", "TOFBarrelRawHitAssociations", - "TOFEndcapRawHitAssociations", "MPGDBarrelRawHitAssociations", - "OuterMPGDBarrelRawHitAssociations", "BackwardMPGDEndcapRawHitAssociations", - "ForwardMPGDEndcapRawHitAssociations"}, - {"CentralTrackingRawHitAssociations"} // Output collection name - )); +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + // Tracker hits collector + app->Add(new JOmniFactoryGeneratorT>( + "CentralTrackingRecHits", + {"SiBarrelTrackerRecHits", "SiBarrelVertexRecHits", "SiEndcapTrackerRecHits", + "TOFBarrelRecHits", "TOFEndcapRecHits", "MPGDBarrelRecHits", "OuterMPGDBarrelRecHits", + "BackwardMPGDEndcapRecHits", "ForwardMPGDEndcapRecHits"}, + {"CentralTrackingRecHits"} // Output collection name + )); + + // Tracker hit associations collector + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "CentralTrackingRawHitAssociations", + {"SiBarrelRawHitAssociations", "SiBarrelVertexRawHitAssociations", + "SiEndcapTrackerRawHitAssociations", "TOFBarrelRawHitAssociations", + "TOFEndcapRawHitAssociations", "MPGDBarrelRawHitAssociations", + "OuterMPGDBarrelRawHitAssociations", "BackwardMPGDEndcapRawHitAssociations", + "ForwardMPGDEndcapRawHitAssociations"}, + {"CentralTrackingRawHitAssociations"} // Output collection name + )); +#else + // Tracker hits collector + app->Add(new JOmniFactoryGeneratorT>({ + .tag="CentralTrackingRecHits", + .variadic_input_names={{"SiBarrelTrackerRecHits", "SiBarrelVertexRecHits", "SiEndcapTrackerRecHits", + "TOFBarrelRecHits", "TOFEndcapRecHits", "MPGDBarrelRecHits", "OuterMPGDBarrelRecHits", + "BackwardMPGDEndcapRecHits", "ForwardMPGDEndcapRecHits"}}, + .output_names={"CentralTrackingRecHits"} // Output collection name + })); + + // Tracker hit associations collector + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>({ + .tag="CentralTrackingRawHitAssociations", + .variadic_input_names={{"SiBarrelRawHitAssociations", "SiBarrelVertexRawHitAssociations", + "SiEndcapTrackerRawHitAssociations", "TOFBarrelRawHitAssociations", + "TOFEndcapRawHitAssociations", "MPGDBarrelRawHitAssociations", + "OuterMPGDBarrelRawHitAssociations", "BackwardMPGDEndcapRawHitAssociations", + "ForwardMPGDEndcapRawHitAssociations"}}, + .output_names={"CentralTrackingRawHitAssociations"} // Output collection name + })); +#endif app->Add(new JOmniFactoryGeneratorT( "CentralTrackerMeasurements", {"CentralTrackingRecHits"}, {"CentralTrackerMeasurements"})); @@ -349,29 +383,58 @@ void InitPlugin(JApplication* app) { }, {})); - // Add Low-Q2, central and B0 tracks - app->Add(new JOmniFactoryGeneratorT>( - "CombinedTracks", {"CentralCKFTracks", "B0TrackerCKFTracks", "TaggerTrackerTracks"}, - {"CombinedTracks"})); - - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "CombinedTrackAssociations", - {"CentralCKFTrackAssociations", "B0TrackerCKFTrackAssociations", - "TaggerTrackerTrackAssociations"}, - {"CombinedTrackAssociations"})); - - app->Add(new JOmniFactoryGeneratorT>( - "CombinedTruthSeededTracks", - {"CentralCKFTruthSeededTracks", "B0TrackerCKFTruthSeededTracks", "TaggerTrackerTracks"}, - {"CombinedTruthSeededTracks"})); - - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "CombinedTruthSeededTrackAssociations", - {"CentralCKFTruthSeededTrackAssociations", "B0TrackerCKFTruthSeededTrackAssociations", - "TaggerTrackerTrackAssociations"}, - {"CombinedTruthSeededTrackAssociations"})); + +#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + + // Add Low-Q2, central and B0 tracks + app->Add(new JOmniFactoryGeneratorT>( + "CombinedTracks", {"CentralCKFTracks", "B0TrackerCKFTracks", "TaggerTrackerTracks"}, + {"CombinedTracks"})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "CombinedTrackAssociations", + {"CentralCKFTrackAssociations", "B0TrackerCKFTrackAssociations", + "TaggerTrackerTrackAssociations"}, + {"CombinedTrackAssociations"})); + + app->Add(new JOmniFactoryGeneratorT>( + "CombinedTruthSeededTracks", + {"CentralCKFTruthSeededTracks", "B0TrackerCKFTruthSeededTracks", "TaggerTrackerTracks"}, + {"CombinedTruthSeededTracks"})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "CombinedTruthSeededTrackAssociations", + {"CentralCKFTruthSeededTrackAssociations", "B0TrackerCKFTruthSeededTrackAssociations", + "TaggerTrackerTrackAssociations"}, + {"CombinedTruthSeededTrackAssociations"})); +#else + // Add Low-Q2, central and B0 tracks + app->Add(new JOmniFactoryGeneratorT>({ + .tag="CombinedTracks", + .variadic_input_names={{"CentralCKFTracks", "B0TrackerCKFTracks", "TaggerTrackerTracks"}}, + .output_names={"CombinedTracks"}})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>({ + .tag="CombinedTrackAssociations", + .variadic_input_names={{"CentralCKFTrackAssociations", "B0TrackerCKFTrackAssociations", + "TaggerTrackerTrackAssociations"}}, + .output_names={"CombinedTrackAssociations"}})); + + app->Add(new JOmniFactoryGeneratorT>({ + .tag="CombinedTruthSeededTracks", + .variadic_input_names={{"CentralCKFTruthSeededTracks", "B0TrackerCKFTruthSeededTracks", "TaggerTrackerTracks"}}, + .output_names={"CombinedTruthSeededTracks"}})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>({ + .tag="CombinedTruthSeededTrackAssociations", + .variadic_input_names={{"CentralCKFTruthSeededTrackAssociations", "B0TrackerCKFTruthSeededTrackAssociations", + "TaggerTrackerTrackAssociations"}}, + .output_names={"CombinedTruthSeededTrackAssociations"}})); +#endif app->Add(new JOmniFactoryGeneratorT( "ChargedTruthSeededParticlesWithAssociations", From 5c8605a02abe142f98ca8d6d59f276319577d942 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 Aug 2025 18:51:53 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/detectors/DRICH/DRICH.cc | 37 +++-- src/detectors/EEMC/EEMC.cc | 44 +++--- src/detectors/LOWQ2/LOWQ2.cc | 190 +++++++++++++------------ src/extensions/jana/JOmniFactory.h | 35 +++-- src/global/beam/beam.cc | 44 +++--- src/global/reco/reco.cc | 67 +++++---- src/global/tracking/tracking.cc | 213 +++++++++++++++-------------- 7 files changed, 313 insertions(+), 317 deletions(-) diff --git a/src/detectors/DRICH/DRICH.cc b/src/detectors/DRICH/DRICH.cc index 7006315891..ae3c5de88f 100644 --- a/src/detectors/DRICH/DRICH.cc +++ b/src/detectors/DRICH/DRICH.cc @@ -131,15 +131,14 @@ void InitPlugin(JApplication* app) { "DRICHGasTracks", {"CentralCKFTracks", "CentralCKFActsTrajectories", "CentralCKFActsTracks"}, {"DRICHGasTracks"}, gas_track_cfg)); -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - app->Add(new JOmniFactoryGeneratorT( - "DRICHMergedTracks", {"DRICHAerogelTracks", "DRICHGasTracks"}, {"DRICHMergedTracks"}, {})); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "DRICHMergedTracks", {"DRICHAerogelTracks", "DRICHGasTracks"}, {"DRICHMergedTracks"}, {})); #else - app->Add(new JOmniFactoryGeneratorT( { - .tag = "DRICHMergedTracks", - .variadic_input_names = {{"DRICHAerogelTracks", "DRICHGasTracks"}}, - .output_names = {"DRICHMergedTracks"} - })); + app->Add(new JOmniFactoryGeneratorT( + {.tag = "DRICHMergedTracks", + .variadic_input_names = {{"DRICHAerogelTracks", "DRICHGasTracks"}}, + .output_names = {"DRICHMergedTracks"}})); #endif // PID algorithm @@ -150,18 +149,18 @@ void InitPlugin(JApplication* app) { {"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"}, irt_cfg)); // merge aerogel and gas PID results -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - app->Add(new JOmniFactoryGeneratorT( - "DRICHMergedIrtCherenkovParticleID", - {"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"}, - {"DRICHMergedIrtCherenkovParticleID"}, merge_cfg)); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "DRICHMergedIrtCherenkovParticleID", + {"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"}, + {"DRICHMergedIrtCherenkovParticleID"}, merge_cfg)); #else - app->Add(new JOmniFactoryGeneratorT({ - .tag = "DRICHMergedIrtCherenkovParticleID", - .variadic_input_names = {{"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"}}, - .output_names = {"DRICHMergedIrtCherenkovParticleID"}, - .configs = merge_cfg - })); + app->Add(new JOmniFactoryGeneratorT( + {.tag = "DRICHMergedIrtCherenkovParticleID", + .variadic_input_names = {{"DRICHAerogelIrtCherenkovParticleID", + "DRICHGasIrtCherenkovParticleID"}}, + .output_names = {"DRICHMergedIrtCherenkovParticleID"}, + .configs = merge_cfg})); #endif // clang-format on diff --git a/src/detectors/EEMC/EEMC.cc b/src/detectors/EEMC/EEMC.cc index c063d6a127..755c3984f9 100644 --- a/src/detectors/EEMC/EEMC.cc +++ b/src/detectors/EEMC/EEMC.cc @@ -179,30 +179,32 @@ void InitPlugin(JApplication* app) { "EcalEndcapNParticleIDInput_features", "EcalEndcapNParticleIDTarget", })); -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - app->Add(new JOmniFactoryGeneratorT( - "EcalEndcapNParticleIDInference", +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "EcalEndcapNParticleIDInference", { - "EcalEndcapNParticleIDInput_features", - }, - { - "EcalEndcapNParticleIDOutput_label", - "EcalEndcapNParticleIDOutput_probability_tensor", - }, + "EcalEndcapNParticleIDInput_features", + }, + { + "EcalEndcapNParticleIDOutput_label", + "EcalEndcapNParticleIDOutput_probability_tensor", + }, { - .modelPath = "calibrations/onnx/EcalEndcapN_pi_rejection.onnx", - })); + .modelPath = "calibrations/onnx/EcalEndcapN_pi_rejection.onnx", + })); #else - app->Add(new JOmniFactoryGeneratorT({ - .tag="EcalEndcapNParticleIDInference", - .variadic_input_names={{ "EcalEndcapNParticleIDInput_features", }}, - .variadic_output_names={{ - "EcalEndcapNParticleIDOutput_label", - "EcalEndcapNParticleIDOutput_probability_tensor", - }}, - .configs={ - .modelPath = "calibrations/onnx/EcalEndcapN_pi_rejection.onnx", - }})); + app->Add(new JOmniFactoryGeneratorT( + {.tag = "EcalEndcapNParticleIDInference", + .variadic_input_names = {{ + "EcalEndcapNParticleIDInput_features", + }}, + .variadic_output_names = {{ + "EcalEndcapNParticleIDOutput_label", + "EcalEndcapNParticleIDOutput_probability_tensor", + }}, + .configs = { + .modelPath = "calibrations/onnx/EcalEndcapN_pi_rejection.onnx", + }})); #endif app->Add(new JOmniFactoryGeneratorT( "EcalEndcapNParticleIDPostML", diff --git a/src/detectors/LOWQ2/LOWQ2.cc b/src/detectors/LOWQ2/LOWQ2.cc index 2d3f1becbd..2268fb4361 100644 --- a/src/detectors/LOWQ2/LOWQ2.cc +++ b/src/detectors/LOWQ2/LOWQ2.cc @@ -133,106 +133,104 @@ void InitPlugin(JApplication* app) { } } -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - app->Add(new JOmniFactoryGeneratorT>( - "TaggerTrackerSplitHits", {"TaggerTrackerRecHits"}, geometryDivisionCollectionNames, - { - .function = GeometrySplit{geometryDivisions, readout, geometryLabels}, - })); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT>( + "TaggerTrackerSplitHits", {"TaggerTrackerRecHits"}, geometryDivisionCollectionNames, + { + .function = GeometrySplit{geometryDivisions, readout, geometryLabels}, + })); #else - app->Add(new JOmniFactoryGeneratorT>({ - .tag="TaggerTrackerSplitHits", - .input_names={"TaggerTrackerRecHits"}, - .variadic_output_names = {geometryDivisionCollectionNames}, - .configs={ - .function = GeometrySplit{geometryDivisions, readout, geometryLabels}, - }})); + app->Add(new JOmniFactoryGeneratorT>( + {.tag = "TaggerTrackerSplitHits", + .input_names = {"TaggerTrackerRecHits"}, + .variadic_output_names = {geometryDivisionCollectionNames}, + .configs = { + .function = GeometrySplit{geometryDivisions, readout, geometryLabels}, + }})); #endif -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - app->Add(new JOmniFactoryGeneratorT( - "TaggerTrackerClustering", geometryDivisionCollectionNames, outputClusterCollectionNames, - { - .readout = "TaggerTrackerHits", - .x_field = "x", - .y_field = "y", - .hit_time_limit = 10 * edm4eic::unit::ns, - })); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "TaggerTrackerClustering", geometryDivisionCollectionNames, outputClusterCollectionNames, + { + .readout = "TaggerTrackerHits", + .x_field = "x", + .y_field = "y", + .hit_time_limit = 10 * edm4eic::unit::ns, + })); #else - app->Add(new JOmniFactoryGeneratorT({ - .tag = "TaggerTrackerClustering", - .variadic_input_names = {geometryDivisionCollectionNames}, - .variadic_output_names = {outputClusterCollectionNames}, - .configs = { - .readout = "TaggerTrackerHits", - .x_field = "x", - .y_field = "y", - .hit_time_limit = 10 * edm4eic::unit::ns, - }})); + app->Add(new JOmniFactoryGeneratorT( + {.tag = "TaggerTrackerClustering", + .variadic_input_names = {geometryDivisionCollectionNames}, + .variadic_output_names = {outputClusterCollectionNames}, + .configs = { + .readout = "TaggerTrackerHits", + .x_field = "x", + .y_field = "y", + .hit_time_limit = 10 * edm4eic::unit::ns, + }})); #endif - // Linear tracking for each module, loop over modules for (std::size_t i = 0; i < moduleIDs.size(); i++) { std::string outputTrackTag = outputTrackTags[i]; std::string outputTrackAssociationTag = outputTrackAssociationTags[i]; std::vector inputClusterTags = moduleClusterTags[i]; -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - inputClusterTags.emplace_back("TaggerTrackerRawHitAssociations"); - app->Add(new JOmniFactoryGeneratorT( - outputTrackTag, {inputClusterTags}, {outputTrackTag, outputTrackAssociationTag}, - { - .layer_hits_max = 200, - .chi2_max = 0.001, - .n_layer = 4, - .restrict_direction = true, - .optimum_theta = -M_PI + 0.026, - .optimum_phi = 0, - .step_angle_tolerance = 0.05, - })); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + inputClusterTags.emplace_back("TaggerTrackerRawHitAssociations"); + app->Add(new JOmniFactoryGeneratorT( + outputTrackTag, {inputClusterTags}, {outputTrackTag, outputTrackAssociationTag}, + { + .layer_hits_max = 200, + .chi2_max = 0.001, + .n_layer = 4, + .restrict_direction = true, + .optimum_theta = -M_PI + 0.026, + .optimum_phi = 0, + .step_angle_tolerance = 0.05, + })); #else - app->Add(new JOmniFactoryGeneratorT({ - .tag = outputTrackTag, - .input_names = {"TaggerTrackerRawHitAssociations"}, - .variadic_input_names = {inputClusterTags}, - .output_names = {outputTrackTag, outputTrackAssociationTag}, - .configs = { - .layer_hits_max = 200, - .chi2_max = 0.001, - .n_layer = 4, - .restrict_direction = true, - .optimum_theta = -M_PI + 0.026, - .optimum_phi = 0, - .step_angle_tolerance = 0.05, - }})); + app->Add(new JOmniFactoryGeneratorT( + {.tag = outputTrackTag, + .input_names = {"TaggerTrackerRawHitAssociations"}, + .variadic_input_names = {inputClusterTags}, + .output_names = {outputTrackTag, outputTrackAssociationTag}, + .configs = { + .layer_hits_max = 200, + .chi2_max = 0.001, + .n_layer = 4, + .restrict_direction = true, + .optimum_theta = -M_PI + 0.026, + .optimum_phi = 0, + .step_angle_tolerance = 0.05, + }})); #endif } -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - // Combine the tracks from each module into one collection - app->Add(new JOmniFactoryGeneratorT>( - "TaggerTrackerLocalTracks", outputTrackTags, {"TaggerTrackerLocalTracks"})); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + // Combine the tracks from each module into one collection + app->Add(new JOmniFactoryGeneratorT>( + "TaggerTrackerLocalTracks", outputTrackTags, {"TaggerTrackerLocalTracks"})); - // Combine the associations from each module into one collection - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "TaggerTrackerLocalTrackAssociations", outputTrackAssociationTags, - {"TaggerTrackerLocalTrackAssociations"})); + // Combine the associations from each module into one collection + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "TaggerTrackerLocalTrackAssociations", outputTrackAssociationTags, + {"TaggerTrackerLocalTrackAssociations"})); #else - // Combine the tracks from each module into one collection - app->Add(new JOmniFactoryGeneratorT>({ - .tag="TaggerTrackerLocalTracks", - .variadic_input_names={outputTrackTags}, - .output_names = {"TaggerTrackerLocalTracks"}})); + // Combine the tracks from each module into one collection + app->Add(new JOmniFactoryGeneratorT>( + {.tag = "TaggerTrackerLocalTracks", + .variadic_input_names = {outputTrackTags}, + .output_names = {"TaggerTrackerLocalTracks"}})); - // Combine the associations from each module into one collection - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>({ - .tag="TaggerTrackerLocalTrackAssociations", - .variadic_input_names = {outputTrackAssociationTags}, - .output_names = {"TaggerTrackerLocalTrackAssociations"} - })); + // Combine the associations from each module into one collection + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + {.tag = "TaggerTrackerLocalTrackAssociations", + .variadic_input_names = {outputTrackAssociationTags}, + .output_names = {"TaggerTrackerLocalTrackAssociations"}})); #endif // Project tracks onto a plane @@ -253,22 +251,22 @@ void InitPlugin(JApplication* app) { { .beamE = 10.0, })); - -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - app->Add(new JOmniFactoryGeneratorT( - "TaggerTrackerTransportationInference", {"TaggerTrackerFeatureTensor"}, - {"TaggerTrackerPredictionTensor"}, - { - .modelPath = "calibrations/onnx/TaggerTrackerTransportation.onnx", - })); + +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT( + "TaggerTrackerTransportationInference", {"TaggerTrackerFeatureTensor"}, + {"TaggerTrackerPredictionTensor"}, + { + .modelPath = "calibrations/onnx/TaggerTrackerTransportation.onnx", + })); #else - app->Add(new JOmniFactoryGeneratorT({ - .tag= "TaggerTrackerTransportationInference", - .variadic_input_names = {{"TaggerTrackerFeatureTensor"}}, - .variadic_output_names = {{"TaggerTrackerPredictionTensor"}}, - .configs = { - .modelPath = "calibrations/onnx/TaggerTrackerTransportation.onnx", - }})); + app->Add(new JOmniFactoryGeneratorT( + {.tag = "TaggerTrackerTransportationInference", + .variadic_input_names = {{"TaggerTrackerFeatureTensor"}}, + .variadic_output_names = {{"TaggerTrackerPredictionTensor"}}, + .configs = { + .modelPath = "calibrations/onnx/TaggerTrackerTransportation.onnx", + }})); #endif app->Add(new JOmniFactoryGeneratorT( "TaggerTrackerTransportationPostML", {"TaggerTrackerPredictionTensor", "MCBeamElectrons"}, diff --git a/src/extensions/jana/JOmniFactory.h b/src/extensions/jana/JOmniFactory.h index cbfff91e37..062481e302 100644 --- a/src/extensions/jana/JOmniFactory.h +++ b/src/extensions/jana/JOmniFactory.h @@ -41,17 +41,16 @@ class JOmniFactory : public jana::components::JOmniFactory { std::shared_ptr m_logger; public: - // This PreInit is needed for JANA2 <= 2.4.3 inline void PreInit(std::string tag, JEventLevel level, std::vector input_collection_names, std::vector input_collection_levels, std::vector output_collection_names) { - if constexpr (JVersion::major*10000 + JVersion::minor*100 + JVersion::patch < 20403) { - // PreInit using the underlying JANA JOmniFactory - JANA_JOmniFactory::PreInit(tag, level, input_collection_names, input_collection_levels, - output_collection_names); + if constexpr (JVersion::major * 10000 + JVersion::minor * 100 + JVersion::patch < 20403) { + // PreInit using the underlying JANA JOmniFactory + JANA_JOmniFactory::PreInit(tag, level, input_collection_names, input_collection_levels, + output_collection_names); } // But obtain our own logger (defines the parameter option) @@ -60,26 +59,24 @@ class JOmniFactory : public jana::components::JOmniFactory { } // This PreInit is needed for JANA2 >= 2.4.3 - inline void PreInit(std::string tag, - JEventLevel level, + inline void PreInit(std::string tag, JEventLevel level, std::vector input_collection_names, std::vector input_collection_levels, std::vector> variadic_input_collection_names, std::vector variadic_input_collection_levels, std::vector output_collection_names, - std::vector> variadic_output_collection_names - ) { - // PreInit using the underlying JANA JOmniFactory - if constexpr (JVersion::major*10000 + JVersion::minor*100 + JVersion::patch >= 20403) { - JANA_JOmniFactory::PreInit(tag, level, input_collection_names, input_collection_levels, - variadic_input_collection_names, variadic_input_collection_levels, - output_collection_names, variadic_output_collection_names); - } - - // But obtain our own logger (defines the parameter option) - m_logger = this->GetApplication()->template GetService()->logger(this->GetPrefix()); -} + std::vector> variadic_output_collection_names) { + // PreInit using the underlying JANA JOmniFactory + if constexpr (JVersion::major * 10000 + JVersion::minor * 100 + JVersion::patch >= 20403) { + JANA_JOmniFactory::PreInit(tag, level, input_collection_names, input_collection_levels, + variadic_input_collection_names, variadic_input_collection_levels, + output_collection_names, variadic_output_collection_names); + } + // But obtain our own logger (defines the parameter option) + m_logger = + this->GetApplication()->template GetService()->logger(this->GetPrefix()); + } virtual void ChangeRun(int32_t /* run_number */) override {}; diff --git a/src/global/beam/beam.cc b/src/global/beam/beam.cc index e489c6a3f5..acc78771d9 100644 --- a/src/global/beam/beam.cc +++ b/src/global/beam/beam.cc @@ -34,35 +34,33 @@ void InitPlugin(JApplication* app) { std::vector> values{{4, 11}, {4, 2212}, {4, 2112}, {1, 11}, {1, 2212}, {1, 2112}}; -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - app->Add(new JOmniFactoryGeneratorT>( - "BeamParticles", {"MCParticles"}, outCollections, - { - .function = - ValueSplit<&edm4hep::MCParticle::getGeneratorStatus, &edm4hep::MCParticle::getPDG>{ - values}, - })); + app->Add(new JOmniFactoryGeneratorT>( + "BeamParticles", {"MCParticles"}, outCollections, + { + .function = + ValueSplit<&edm4hep::MCParticle::getGeneratorStatus, &edm4hep::MCParticle::getPDG>{ + values}, + })); - // Combine beam protons and neutrons into beam hadrons - app->Add(new JOmniFactoryGeneratorT>( - "MCBeamHadrons", {"MCBeamProtons", "MCBeamNeutrons"}, {"MCBeamHadrons"})); + // Combine beam protons and neutrons into beam hadrons + app->Add(new JOmniFactoryGeneratorT>( + "MCBeamHadrons", {"MCBeamProtons", "MCBeamNeutrons"}, {"MCBeamHadrons"})); #else - app->Add(new JOmniFactoryGeneratorT>({ - .tag = "BeamParticles", - .input_names = {"MCParticles"}, - .variadic_output_names = {outCollections}, - .configs = { - .function = - ValueSplit<&edm4hep::MCParticle::getGeneratorStatus, &edm4hep::MCParticle::getPDG>{values} - }})); + app->Add(new JOmniFactoryGeneratorT>( + {.tag = "BeamParticles", + .input_names = {"MCParticles"}, + .variadic_output_names = {outCollections}, + .configs = {.function = ValueSplit<&edm4hep::MCParticle::getGeneratorStatus, + &edm4hep::MCParticle::getPDG>{values}}})); - app->Add(new JOmniFactoryGeneratorT>({ - .tag="MCBeamHadrons", - .variadic_input_names = {{"MCBeamProtons", "MCBeamNeutrons"}}, - .output_names = {"MCBeamHadrons"}})); + app->Add(new JOmniFactoryGeneratorT>( + {.tag = "MCBeamHadrons", + .variadic_input_names = {{"MCBeamProtons", "MCBeamNeutrons"}}, + .output_names = {"MCBeamHadrons"}})); #endif } } diff --git a/src/global/reco/reco.cc b/src/global/reco/reco.cc index 5fa4069a8d..023965fe56 100644 --- a/src/global/reco/reco.cc +++ b/src/global/reco/reco.cc @@ -70,31 +70,31 @@ void InitPlugin(JApplication* app) { app->Add(new JOmniFactoryGeneratorT( "GeneratedParticles", {"MCParticles"}, {"GeneratedParticles"})); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT>( + "EcalClusters", {"EcalEndcapNClusters", "EcalBarrelScFiClusters", "EcalEndcapPClusters"}, + {"EcalClusters"})); -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - app->Add(new JOmniFactoryGeneratorT>( - "EcalClusters", {"EcalEndcapNClusters", "EcalBarrelScFiClusters", "EcalEndcapPClusters"}, - {"EcalClusters"})); - - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "EcalClusterAssociations", - {"EcalEndcapNClusterAssociations", "EcalBarrelScFiClusterAssociations", - "EcalEndcapPClusterAssociations"}, - {"EcalClusterAssociations"})); + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "EcalClusterAssociations", + {"EcalEndcapNClusterAssociations", "EcalBarrelScFiClusterAssociations", + "EcalEndcapPClusterAssociations"}, + {"EcalClusterAssociations"})); #else - app->Add(new JOmniFactoryGeneratorT>({ - .tag="EcalClusters", - .variadic_input_names={{"EcalEndcapNClusters", "EcalBarrelScFiClusters", "EcalEndcapPClusters"}}, - .output_names={"EcalClusters"} - })); - - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>({ - .tag="EcalClusterAssociations", - .variadic_input_names={{"EcalEndcapNClusterAssociations", "EcalBarrelScFiClusterAssociations", - "EcalEndcapPClusterAssociations"}}, - .output_names={"EcalClusterAssociations"}})); + app->Add(new JOmniFactoryGeneratorT>( + {.tag = "EcalClusters", + .variadic_input_names = {{"EcalEndcapNClusters", "EcalBarrelScFiClusters", + "EcalEndcapPClusters"}}, + .output_names = {"EcalClusters"}})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + {.tag = "EcalClusterAssociations", + .variadic_input_names = {{"EcalEndcapNClusterAssociations", + "EcalBarrelScFiClusterAssociations", + "EcalEndcapPClusterAssociations"}}, + .output_names = {"EcalClusterAssociations"}})); #endif app->Add(new JOmniFactoryGeneratorT( @@ -135,18 +135,17 @@ void InitPlugin(JApplication* app) { "InclusiveKinematicsESigma", {"MCParticles", "ScatteredElectronsTruth", "HadronicFinalState"}, {"InclusiveKinematicsESigma"})); - -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - // InclusiveKinematicseSigma is deprecated and will be removed, use InclusiveKinematicsESigma instead - app->Add(new JOmniFactoryGeneratorT>( - "InclusiveKinematicseSigma_legacy", {"InclusiveKinematicsESigma"}, - {"InclusiveKinematicseSigma"})); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + // InclusiveKinematicseSigma is deprecated and will be removed, use InclusiveKinematicsESigma instead + app->Add(new JOmniFactoryGeneratorT>( + "InclusiveKinematicseSigma_legacy", {"InclusiveKinematicsESigma"}, + {"InclusiveKinematicseSigma"})); #else - // InclusiveKinematicseSigma is deprecated and will be removed, use InclusiveKinematicsESigma instead - app->Add(new JOmniFactoryGeneratorT>({ - .tag="InclusiveKinematicseSigma_legacy", - .variadic_input_names={{"InclusiveKinematicsESigma"}}, - .output_names={"InclusiveKinematicseSigma"}})); + // InclusiveKinematicseSigma is deprecated and will be removed, use InclusiveKinematicsESigma instead + app->Add(new JOmniFactoryGeneratorT>( + {.tag = "InclusiveKinematicseSigma_legacy", + .variadic_input_names = {{"InclusiveKinematicsESigma"}}, + .output_names = {"InclusiveKinematicseSigma"}})); #endif app->Add(new JOmniFactoryGeneratorT< diff --git a/src/global/tracking/tracking.cc b/src/global/tracking/tracking.cc index 7d2e3412a0..f4a7d52d4a 100644 --- a/src/global/tracking/tracking.cc +++ b/src/global/tracking/tracking.cc @@ -52,67 +52,69 @@ void InitPlugin(JApplication* app) { std::vector> thetaRanges{{0, 50 * dd4hep::mrad}, {50 * dd4hep::mrad, 180 * dd4hep::deg}}; -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - app->Add(new JOmniFactoryGeneratorT>( - "CentralB0TrackTruthSeeds", {"TrackTruthSeeds"}, - {"B0TrackerTruthSeeds", "CentralTrackerTruthSeeds"}, - { - .function = RangeSplit<&edm4eic::TrackParameters::getTheta>(thetaRanges), - })); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + app->Add(new JOmniFactoryGeneratorT>( + "CentralB0TrackTruthSeeds", {"TrackTruthSeeds"}, + {"B0TrackerTruthSeeds", "CentralTrackerTruthSeeds"}, + { + .function = RangeSplit<&edm4eic::TrackParameters::getTheta>(thetaRanges), + })); #else - app->Add(new JOmniFactoryGeneratorT>({ - .tag="CentralB0TrackTruthSeeds", - .input_names={"TrackTruthSeeds"}, - .variadic_output_names={{"B0TrackerTruthSeeds", "CentralTrackerTruthSeeds"}}, - .configs={ - .function = RangeSplit<&edm4eic::TrackParameters::getTheta>(thetaRanges), - }})); + app->Add(new JOmniFactoryGeneratorT>( + {.tag = "CentralB0TrackTruthSeeds", + .input_names = {"TrackTruthSeeds"}, + .variadic_output_names = {{"B0TrackerTruthSeeds", "CentralTrackerTruthSeeds"}}, + .configs = { + .function = RangeSplit<&edm4eic::TrackParameters::getTheta>(thetaRanges), + }})); #endif // CENTRAL TRACKER -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - // Tracker hits collector - app->Add(new JOmniFactoryGeneratorT>( - "CentralTrackingRecHits", - {"SiBarrelTrackerRecHits", "SiBarrelVertexRecHits", "SiEndcapTrackerRecHits", - "TOFBarrelRecHits", "TOFEndcapRecHits", "MPGDBarrelRecHits", "OuterMPGDBarrelRecHits", - "BackwardMPGDEndcapRecHits", "ForwardMPGDEndcapRecHits"}, - {"CentralTrackingRecHits"} // Output collection name - )); - - // Tracker hit associations collector - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "CentralTrackingRawHitAssociations", - {"SiBarrelRawHitAssociations", "SiBarrelVertexRawHitAssociations", - "SiEndcapTrackerRawHitAssociations", "TOFBarrelRawHitAssociations", - "TOFEndcapRawHitAssociations", "MPGDBarrelRawHitAssociations", - "OuterMPGDBarrelRawHitAssociations", "BackwardMPGDEndcapRawHitAssociations", - "ForwardMPGDEndcapRawHitAssociations"}, - {"CentralTrackingRawHitAssociations"} // Output collection name - )); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + // Tracker hits collector + app->Add(new JOmniFactoryGeneratorT>( + "CentralTrackingRecHits", + {"SiBarrelTrackerRecHits", "SiBarrelVertexRecHits", "SiEndcapTrackerRecHits", + "TOFBarrelRecHits", "TOFEndcapRecHits", "MPGDBarrelRecHits", "OuterMPGDBarrelRecHits", + "BackwardMPGDEndcapRecHits", "ForwardMPGDEndcapRecHits"}, + {"CentralTrackingRecHits"} // Output collection name + )); + + // Tracker hit associations collector + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "CentralTrackingRawHitAssociations", + {"SiBarrelRawHitAssociations", "SiBarrelVertexRawHitAssociations", + "SiEndcapTrackerRawHitAssociations", "TOFBarrelRawHitAssociations", + "TOFEndcapRawHitAssociations", "MPGDBarrelRawHitAssociations", + "OuterMPGDBarrelRawHitAssociations", "BackwardMPGDEndcapRawHitAssociations", + "ForwardMPGDEndcapRawHitAssociations"}, + {"CentralTrackingRawHitAssociations"} // Output collection name + )); #else - // Tracker hits collector - app->Add(new JOmniFactoryGeneratorT>({ - .tag="CentralTrackingRecHits", - .variadic_input_names={{"SiBarrelTrackerRecHits", "SiBarrelVertexRecHits", "SiEndcapTrackerRecHits", - "TOFBarrelRecHits", "TOFEndcapRecHits", "MPGDBarrelRecHits", "OuterMPGDBarrelRecHits", - "BackwardMPGDEndcapRecHits", "ForwardMPGDEndcapRecHits"}}, - .output_names={"CentralTrackingRecHits"} // Output collection name - })); - - // Tracker hit associations collector - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>({ - .tag="CentralTrackingRawHitAssociations", - .variadic_input_names={{"SiBarrelRawHitAssociations", "SiBarrelVertexRawHitAssociations", - "SiEndcapTrackerRawHitAssociations", "TOFBarrelRawHitAssociations", - "TOFEndcapRawHitAssociations", "MPGDBarrelRawHitAssociations", - "OuterMPGDBarrelRawHitAssociations", "BackwardMPGDEndcapRawHitAssociations", - "ForwardMPGDEndcapRawHitAssociations"}}, - .output_names={"CentralTrackingRawHitAssociations"} // Output collection name - })); + // Tracker hits collector + app->Add(new JOmniFactoryGeneratorT>({ + .tag = "CentralTrackingRecHits", + .variadic_input_names = {{"SiBarrelTrackerRecHits", "SiBarrelVertexRecHits", + "SiEndcapTrackerRecHits", "TOFBarrelRecHits", "TOFEndcapRecHits", + "MPGDBarrelRecHits", "OuterMPGDBarrelRecHits", + "BackwardMPGDEndcapRecHits", "ForwardMPGDEndcapRecHits"}}, + .output_names = {"CentralTrackingRecHits"} // Output collection name + })); + + // Tracker hit associations collector + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>({ + .tag = "CentralTrackingRawHitAssociations", + .variadic_input_names = {{"SiBarrelRawHitAssociations", "SiBarrelVertexRawHitAssociations", + "SiEndcapTrackerRawHitAssociations", "TOFBarrelRawHitAssociations", + "TOFEndcapRawHitAssociations", "MPGDBarrelRawHitAssociations", + "OuterMPGDBarrelRawHitAssociations", + "BackwardMPGDEndcapRawHitAssociations", + "ForwardMPGDEndcapRawHitAssociations"}}, + .output_names = {"CentralTrackingRawHitAssociations"} // Output collection name + })); #endif app->Add(new JOmniFactoryGeneratorT( @@ -383,57 +385,58 @@ void InitPlugin(JApplication* app) { }, {})); - -#if (10000*JANA_VERSION_MAJOR + 100*JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 - - // Add Low-Q2, central and B0 tracks - app->Add(new JOmniFactoryGeneratorT>( - "CombinedTracks", {"CentralCKFTracks", "B0TrackerCKFTracks", "TaggerTrackerTracks"}, - {"CombinedTracks"})); - - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "CombinedTrackAssociations", - {"CentralCKFTrackAssociations", "B0TrackerCKFTrackAssociations", - "TaggerTrackerTrackAssociations"}, - {"CombinedTrackAssociations"})); - - app->Add(new JOmniFactoryGeneratorT>( - "CombinedTruthSeededTracks", - {"CentralCKFTruthSeededTracks", "B0TrackerCKFTruthSeededTracks", "TaggerTrackerTracks"}, - {"CombinedTruthSeededTracks"})); - - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>( - "CombinedTruthSeededTrackAssociations", - {"CentralCKFTruthSeededTrackAssociations", "B0TrackerCKFTruthSeededTrackAssociations", - "TaggerTrackerTrackAssociations"}, - {"CombinedTruthSeededTrackAssociations"})); +#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403 + + // Add Low-Q2, central and B0 tracks + app->Add(new JOmniFactoryGeneratorT>( + "CombinedTracks", {"CentralCKFTracks", "B0TrackerCKFTracks", "TaggerTrackerTracks"}, + {"CombinedTracks"})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "CombinedTrackAssociations", + {"CentralCKFTrackAssociations", "B0TrackerCKFTrackAssociations", + "TaggerTrackerTrackAssociations"}, + {"CombinedTrackAssociations"})); + + app->Add(new JOmniFactoryGeneratorT>( + "CombinedTruthSeededTracks", + {"CentralCKFTruthSeededTracks", "B0TrackerCKFTruthSeededTracks", "TaggerTrackerTracks"}, + {"CombinedTruthSeededTracks"})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + "CombinedTruthSeededTrackAssociations", + {"CentralCKFTruthSeededTrackAssociations", "B0TrackerCKFTruthSeededTrackAssociations", + "TaggerTrackerTrackAssociations"}, + {"CombinedTruthSeededTrackAssociations"})); #else - // Add Low-Q2, central and B0 tracks - app->Add(new JOmniFactoryGeneratorT>({ - .tag="CombinedTracks", - .variadic_input_names={{"CentralCKFTracks", "B0TrackerCKFTracks", "TaggerTrackerTracks"}}, - .output_names={"CombinedTracks"}})); - - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>({ - .tag="CombinedTrackAssociations", - .variadic_input_names={{"CentralCKFTrackAssociations", "B0TrackerCKFTrackAssociations", - "TaggerTrackerTrackAssociations"}}, - .output_names={"CombinedTrackAssociations"}})); - - app->Add(new JOmniFactoryGeneratorT>({ - .tag="CombinedTruthSeededTracks", - .variadic_input_names={{"CentralCKFTruthSeededTracks", "B0TrackerCKFTruthSeededTracks", "TaggerTrackerTracks"}}, - .output_names={"CombinedTruthSeededTracks"}})); - - app->Add(new JOmniFactoryGeneratorT< - CollectionCollector_factory>({ - .tag="CombinedTruthSeededTrackAssociations", - .variadic_input_names={{"CentralCKFTruthSeededTrackAssociations", "B0TrackerCKFTruthSeededTrackAssociations", - "TaggerTrackerTrackAssociations"}}, - .output_names={"CombinedTruthSeededTrackAssociations"}})); + // Add Low-Q2, central and B0 tracks + app->Add(new JOmniFactoryGeneratorT>( + {.tag = "CombinedTracks", + .variadic_input_names = {{"CentralCKFTracks", "B0TrackerCKFTracks", "TaggerTrackerTracks"}}, + .output_names = {"CombinedTracks"}})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + {.tag = "CombinedTrackAssociations", + .variadic_input_names = {{"CentralCKFTrackAssociations", "B0TrackerCKFTrackAssociations", + "TaggerTrackerTrackAssociations"}}, + .output_names = {"CombinedTrackAssociations"}})); + + app->Add(new JOmniFactoryGeneratorT>( + {.tag = "CombinedTruthSeededTracks", + .variadic_input_names = {{"CentralCKFTruthSeededTracks", "B0TrackerCKFTruthSeededTracks", + "TaggerTrackerTracks"}}, + .output_names = {"CombinedTruthSeededTracks"}})); + + app->Add(new JOmniFactoryGeneratorT< + CollectionCollector_factory>( + {.tag = "CombinedTruthSeededTrackAssociations", + .variadic_input_names = {{"CentralCKFTruthSeededTrackAssociations", + "B0TrackerCKFTruthSeededTrackAssociations", + "TaggerTrackerTrackAssociations"}}, + .output_names = {"CombinedTruthSeededTrackAssociations"}})); #endif app->Add(new JOmniFactoryGeneratorT(