Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/detectors/DRICH/DRICH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,15 @@ 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<MergeTrack_factory>(
"DRICHMergedTracks", {"DRICHAerogelTracks", "DRICHGasTracks"}, {"DRICHMergedTracks"}, {}));
#else
app->Add(new JOmniFactoryGeneratorT<MergeTrack_factory>(
{.tag = "DRICHMergedTracks",
.variadic_input_names = {{"DRICHAerogelTracks", "DRICHGasTracks"}},
.output_names = {"DRICHMergedTracks"}}));
#endif

// PID algorithm
app->Add(new JOmniFactoryGeneratorT<IrtCherenkovParticleID_factory>(
Expand All @@ -142,10 +149,19 @@ 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<MergeCherenkovParticleID_factory>(
"DRICHMergedIrtCherenkovParticleID",
{"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"},
{"DRICHMergedIrtCherenkovParticleID"}, merge_cfg));
#else
app->Add(new JOmniFactoryGeneratorT<MergeCherenkovParticleID_factory>(
{.tag = "DRICHMergedIrtCherenkovParticleID",
.variadic_input_names = {{"DRICHAerogelIrtCherenkovParticleID",
"DRICHGasIrtCherenkovParticleID"}},
.output_names = {"DRICHMergedIrtCherenkovParticleID"},
.configs = merge_cfg}));
#endif

// clang-format on
}
Expand Down
15 changes: 15 additions & 0 deletions src/detectors/EEMC/EEMC.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ void InitPlugin(JApplication* app) {
"EcalEndcapNParticleIDInput_features",
"EcalEndcapNParticleIDTarget",
}));
#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403
app->Add(new JOmniFactoryGeneratorT<ONNXInference_factory>(
"EcalEndcapNParticleIDInference",
{
Expand All @@ -191,6 +192,20 @@ void InitPlugin(JApplication* app) {
{
.modelPath = "calibrations/onnx/EcalEndcapN_pi_rejection.onnx",
}));
#else
app->Add(new JOmniFactoryGeneratorT<ONNXInference_factory>(
{.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<CalorimeterParticleIDPostML_factory>(
"EcalEndcapNParticleIDPostML",
{
Expand Down
67 changes: 66 additions & 1 deletion src/detectors/LOWQ2/LOWQ2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,23 @@ void InitPlugin(JApplication* app) {
}
}

#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403
app->Add(new JOmniFactoryGeneratorT<SubDivideCollection_factory<edm4eic::TrackerHit>>(
"TaggerTrackerSplitHits", {"TaggerTrackerRecHits"}, geometryDivisionCollectionNames,
{
.function = GeometrySplit{geometryDivisions, readout, geometryLabels},
}));
#else
app->Add(new JOmniFactoryGeneratorT<SubDivideCollection_factory<edm4eic::TrackerHit>>(
{.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<FarDetectorTrackerCluster_factory>(
"TaggerTrackerClustering", geometryDivisionCollectionNames, outputClusterCollectionNames,
{
Expand All @@ -147,15 +158,27 @@ void InitPlugin(JApplication* app) {
.y_field = "y",
.hit_time_limit = 10 * edm4eic::unit::ns,
}));
#else
app->Add(new JOmniFactoryGeneratorT<FarDetectorTrackerCluster_factory>(
{.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<std::string> inputClusterTags = moduleClusterTags[i];

#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403
inputClusterTags.emplace_back("TaggerTrackerRawHitAssociations");

app->Add(new JOmniFactoryGeneratorT<FarDetectorLinearTracking_factory>(
outputTrackTag, {inputClusterTags}, {outputTrackTag, outputTrackAssociationTag},
{
Expand All @@ -167,8 +190,25 @@ void InitPlugin(JApplication* app) {
.optimum_phi = 0,
.step_angle_tolerance = 0.05,
}));
#else
app->Add(new JOmniFactoryGeneratorT<FarDetectorLinearTracking_factory>(
{.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<CollectionCollector_factory<edm4eic::Track, true>>(
"TaggerTrackerLocalTracks", outputTrackTags, {"TaggerTrackerLocalTracks"}));
Expand All @@ -178,6 +218,20 @@ void InitPlugin(JApplication* app) {
CollectionCollector_factory<edm4eic::MCRecoTrackParticleAssociation, true>>(
"TaggerTrackerLocalTrackAssociations", outputTrackAssociationTags,
{"TaggerTrackerLocalTrackAssociations"}));
#else
// Combine the tracks from each module into one collection
app->Add(new JOmniFactoryGeneratorT<CollectionCollector_factory<edm4eic::Track, true>>(
{.tag = "TaggerTrackerLocalTracks",
.variadic_input_names = {outputTrackTags},
.output_names = {"TaggerTrackerLocalTracks"}}));

// Combine the associations from each module into one collection
app->Add(new JOmniFactoryGeneratorT<
CollectionCollector_factory<edm4eic::MCRecoTrackParticleAssociation, true>>(
{.tag = "TaggerTrackerLocalTrackAssociations",
.variadic_input_names = {outputTrackAssociationTags},
.output_names = {"TaggerTrackerLocalTrackAssociations"}}));
#endif

// Project tracks onto a plane
app->Add(new JOmniFactoryGeneratorT<FarDetectorLinearProjection_factory>(
Expand All @@ -197,12 +251,23 @@ void InitPlugin(JApplication* app) {
{
.beamE = 10.0,
}));

#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403
app->Add(new JOmniFactoryGeneratorT<ONNXInference_factory>(
"TaggerTrackerTransportationInference", {"TaggerTrackerFeatureTensor"},
{"TaggerTrackerPredictionTensor"},
{
.modelPath = "calibrations/onnx/TaggerTrackerTransportation.onnx",
}));
#else
app->Add(new JOmniFactoryGeneratorT<ONNXInference_factory>(
{.tag = "TaggerTrackerTransportationInference",
.variadic_input_names = {{"TaggerTrackerFeatureTensor"}},
.variadic_output_names = {{"TaggerTrackerPredictionTensor"}},
.configs = {
.modelPath = "calibrations/onnx/TaggerTrackerTransportation.onnx",
}}));
#endif
app->Add(new JOmniFactoryGeneratorT<FarDetectorTransportationPostML_factory>(
"TaggerTrackerTransportationPostML", {"TaggerTrackerPredictionTensor", "MCBeamElectrons"},
{"TaggerTrackerReconstructedParticles"},
Expand Down
28 changes: 26 additions & 2 deletions src/extensions/jana/JOmniFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <JANA/Components/JOmniFactory.h>
#include <JANA/JMultifactory.h>
#include <JANA/JEvent.h>
#include <JANA/JVersion.h>
#include <spdlog/spdlog.h>
#include <spdlog/version.h>
#if SPDLOG_VERSION >= 11400 && (!defined(SPDLOG_NO_TLS) || !SPDLOG_NO_TLS)
Expand All @@ -40,14 +41,37 @@ class JOmniFactory : public jana::components::JOmniFactory<AlgoT, ConfigT> {
std::shared_ptr<spdlog::logger> m_logger;

public:
// This PreInit is needed for JANA2 <= 2.4.3
inline void PreInit(std::string tag, JEventLevel level,
std::vector<std::string> input_collection_names,
std::vector<JEventLevel> input_collection_levels,
std::vector<std::string> 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<Log_service>()->logger(this->GetPrefix());
}

// This PreInit is needed for JANA2 >= 2.4.3
inline void PreInit(std::string tag, JEventLevel level,
std::vector<std::string> input_collection_names,
std::vector<JEventLevel> input_collection_levels,
std::vector<std::vector<std::string>> variadic_input_collection_names,
std::vector<JEventLevel> variadic_input_collection_levels,
std::vector<std::string> output_collection_names,
std::vector<std::vector<std::string>> variadic_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) {
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 =
Expand Down
17 changes: 17 additions & 0 deletions src/global/beam/beam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void InitPlugin(JApplication* app) {
std::vector<std::vector<int>> 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

app->Add(new JOmniFactoryGeneratorT<SubDivideCollection_factory<edm4hep::MCParticle>>(
"BeamParticles", {"MCParticles"}, outCollections,
{
Expand All @@ -45,5 +47,20 @@ void InitPlugin(JApplication* app) {
// Combine beam protons and neutrons into beam hadrons
app->Add(new JOmniFactoryGeneratorT<CollectionCollector_factory<edm4hep::MCParticle, true>>(
"MCBeamHadrons", {"MCBeamProtons", "MCBeamNeutrons"}, {"MCBeamHadrons"}));

#else

app->Add(new JOmniFactoryGeneratorT<SubDivideCollection_factory<edm4hep::MCParticle>>(
{.tag = "BeamParticles",
.input_names = {"MCParticles"},
.variadic_output_names = {outCollections},
.configs = {.function = ValueSplit<&edm4hep::MCParticle::getGeneratorStatus,
&edm4hep::MCParticle::getPDG>{values}}}));

app->Add(new JOmniFactoryGeneratorT<CollectionCollector_factory<edm4hep::MCParticle, true>>(
{.tag = "MCBeamHadrons",
.variadic_input_names = {{"MCBeamProtons", "MCBeamNeutrons"}},
.output_names = {"MCBeamHadrons"}}));
#endif
}
}
24 changes: 24 additions & 0 deletions src/global/reco/reco.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void InitPlugin(JApplication* app) {
app->Add(new JOmniFactoryGeneratorT<MC2ReconstructedParticle_factory>(
"GeneratedParticles", {"MCParticles"}, {"GeneratedParticles"}));

#if (10000 * JANA_VERSION_MAJOR + 100 * JANA_VERSION_MINOR + JANA_VERSION_PATCH) < 20403
app->Add(new JOmniFactoryGeneratorT<CollectionCollector_factory<edm4eic::Cluster, true>>(
"EcalClusters", {"EcalEndcapNClusters", "EcalBarrelScFiClusters", "EcalEndcapPClusters"},
{"EcalClusters"}));
Expand All @@ -80,6 +81,21 @@ void InitPlugin(JApplication* app) {
{"EcalEndcapNClusterAssociations", "EcalBarrelScFiClusterAssociations",
"EcalEndcapPClusterAssociations"},
{"EcalClusterAssociations"}));
#else
app->Add(new JOmniFactoryGeneratorT<CollectionCollector_factory<edm4eic::Cluster, true>>(
{.tag = "EcalClusters",
.variadic_input_names = {{"EcalEndcapNClusters", "EcalBarrelScFiClusters",
"EcalEndcapPClusters"}},
.output_names = {"EcalClusters"}}));

app->Add(new JOmniFactoryGeneratorT<
CollectionCollector_factory<edm4eic::MCRecoClusterParticleAssociation, true>>(
{.tag = "EcalClusterAssociations",
.variadic_input_names = {{"EcalEndcapNClusterAssociations",
"EcalBarrelScFiClusterAssociations",
"EcalEndcapPClusterAssociations"}},
.output_names = {"EcalClusterAssociations"}}));
#endif

app->Add(new JOmniFactoryGeneratorT<MatchClusters_factory>(
"ReconstructedParticlesWithAssoc",
Expand Down Expand Up @@ -119,10 +135,18 @@ 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<CollectionCollector_factory<edm4eic::InclusiveKinematics>>(
"InclusiveKinematicseSigma_legacy", {"InclusiveKinematicsESigma"},
{"InclusiveKinematicseSigma"}));
#else
// InclusiveKinematicseSigma is deprecated and will be removed, use InclusiveKinematicsESigma instead
app->Add(new JOmniFactoryGeneratorT<CollectionCollector_factory<edm4eic::InclusiveKinematics>>(
{.tag = "InclusiveKinematicseSigma_legacy",
.variadic_input_names = {{"InclusiveKinematicsESigma"}},
.output_names = {"InclusiveKinematicseSigma"}}));
#endif

app->Add(new JOmniFactoryGeneratorT<
InclusiveKinematicsReconstructed_factory<InclusiveKinematicsSigma>>(
Expand Down
Loading
Loading