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

fix: move remaining JChainFactory algorithms to JChainMultifactory #1142

Merged
merged 22 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9ae7d12
fix: move remaining JChainFactory algorithms to JChainMultifactory
wdconinc Nov 23, 2023
6a12336
fix: move from explicit LogLevel to InitLogger in TrackerMeasurements
wdconinc Nov 23, 2023
c917d0e
fix: include SpdlogMixin when using InitLogger
wdconinc Nov 23, 2023
1c5da0a
fix: iwyu fixes in MergeCherenkovParticleID_factory.cc
wdconinc Nov 24, 2023
b5b61ac
fix: iwyu fixes in MergeCherenkovParticleID_factory.h
wdconinc Nov 24, 2023
93b6d8c
fix: iwyu fixes in MergeTrack_factory.cc
wdconinc Nov 24, 2023
421cd2b
fix: iwyu fixes in MergeTrack_factory.h
wdconinc Nov 24, 2023
3aec32e
fix: iwyu fixes in MC2SmearedParticle_factory.cc
wdconinc Nov 24, 2023
3eb2425
fix: iwyu fixes in MC2SmearedParticle_factory.h
wdconinc Nov 24, 2023
68899dd
fix: iwyu fixes in IterativeVertexFinder_factory.cc
wdconinc Nov 24, 2023
a6ca9bc
fix: iwyu fixes in IterativeVertexFinder_factory.h
wdconinc Nov 24, 2023
4e23019
fix: iwyu fixes in TrackParamTruthInit_factory.cc
wdconinc Nov 24, 2023
b97bf63
fix: iwyu fixes in TrackParamTruthInit_factory.h
wdconinc Nov 24, 2023
c63c285
fix: iwyu fixes in TrackProjector_factory.cc
wdconinc Nov 24, 2023
37a7583
fix: iwyu fixes in TrackProjector_factory.h
wdconinc Nov 24, 2023
54998bc
fix: iwyu fixes in TrackSeeding_factory.cc
wdconinc Nov 24, 2023
85f5eee
fix: iwyu fixes in TrackSeeding_factory.h
wdconinc Nov 24, 2023
3319d10
fix: iwyu fixes in TrackerMeasurementFromHits_factory.cc
wdconinc Nov 24, 2023
b10991b
fix: iwyu fixes in TrackerMeasurementFromHits_factory.h
wdconinc Nov 25, 2023
0d2babd
fix: don't move logger; don't shadow the m_log from SpdlogMixin
wdconinc Nov 28, 2023
8822c55
fix: rm JChainFactory
wdconinc Nov 29, 2023
9aa7e9f
fix: use GetInputTags() in TrackerMeasurementFromHits_factory
wdconinc Nov 30, 2023
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
2 changes: 1 addition & 1 deletion src/algorithms/tracking/TrackerMeasurementFromHits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace eicrecon {
std::shared_ptr<spdlog::logger> logger) {
m_dd4hepGeo = detector;
m_converter = converter;
m_log = std::move(logger);
m_log = logger;
m_acts_context = std::move(acts_context);
m_detid_b0tracker = m_dd4hepGeo->constant<int>("B0Tracker_Station_1_ID");
}
Expand Down
16 changes: 10 additions & 6 deletions src/detectors/DRICH/DRICH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "algorithms/digi/PhotoMultiplierHitDigiConfig.h"
#include "algorithms/pid/IrtCherenkovParticleIDConfig.h"
#include "algorithms/pid/MergeParticleIDConfig.h"
#include "extensions/jana/JChainFactoryGeneratorT.h"
#include "extensions/jana/JChainMultifactoryGeneratorT.h"
// factories
#include "global/digi/PhotoMultiplierHitDigi_factory.h"
Expand Down Expand Up @@ -117,9 +116,12 @@ extern "C" {
track_cfg,
app
));
app->Add(new JChainFactoryGeneratorT<MergeTrack_factory>(
app->Add(new JChainMultifactoryGeneratorT<MergeTrack_factory>(
"DRICHMergedTracks",
{"DRICHAerogelTracks", "DRICHGasTracks"},
"DRICHMergedTracks"
{"DRICHMergedTracks"},
{},
app
));

// PID algorithm
Expand All @@ -136,10 +138,12 @@ extern "C" {
));

// merge aerogel and gas PID results
app->Add(new JChainFactoryGeneratorT<MergeCherenkovParticleID_factory>(
{"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"},
app->Add(new JChainMultifactoryGeneratorT<MergeCherenkovParticleID_factory>(
"DRICHMergedIrtCherenkovParticleID",
merge_cfg
{"DRICHAerogelIrtCherenkovParticleID", "DRICHGasIrtCherenkovParticleID"},
{"DRICHMergedIrtCherenkovParticleID"},
merge_cfg,
app
));

// clang-format on
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This directory holds additional helper methods and classes for the used frameworks and libraries

- jana - JANA2 extension classes such as JChainFactory
- jana - JANA2 extension classes such as JChainMultifactory
- spdlog - parsing spdlog classes
- string - std::string extensions such as trim()

Expand Down
59 changes: 0 additions & 59 deletions src/extensions/jana/JChainFactoryGeneratorT.h

This file was deleted.

79 changes: 0 additions & 79 deletions src/extensions/jana/JChainFactoryT.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/extensions/jana/JChainMultifactoryT.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#include <vector>

#include "datamodel_glue.h"
#include <JANA/JEvent.h>
#include <JANA/JMultifactory.h>
#include "algorithms/interfaces/WithPodConfig.h"
#include "extensions/jana/JChainFactoryT.h" // Just to pull in struct NoConfig


template <typename ConfigT = eicrecon::NoConfig>
Expand Down
11 changes: 3 additions & 8 deletions src/global/pid/MergeCherenkovParticleID_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
#include "MergeCherenkovParticleID_factory.h"

#include <JANA/JApplication.h>
#include <JANA/JException.h>
#include <fmt/core.h>
#include <spdlog/logger.h>
#include <exception>

#include "services/io/podio/JFactoryPodioT.h"
#include "datamodel_glue.h"

//-----------------------------------------------------------------------------
void eicrecon::MergeCherenkovParticleID_factory::Init() {
Expand All @@ -17,7 +18,6 @@ void eicrecon::MergeCherenkovParticleID_factory::Init() {
auto app = GetApplication();
auto plugin = GetPluginName();
auto prefix = plugin + ":" + GetTag();
InitDataTags(prefix);

// services
InitLogger(app, prefix, "info");
Expand All @@ -36,11 +36,6 @@ void eicrecon::MergeCherenkovParticleID_factory::Init() {
m_algo.AlgorithmInit(m_log);
}

//-----------------------------------------------------------------------------
void eicrecon::MergeCherenkovParticleID_factory::BeginRun(const std::shared_ptr<const JEvent> &event) {
m_algo.AlgorithmChangeRun();
}

//-----------------------------------------------------------------------------
void eicrecon::MergeCherenkovParticleID_factory::Process(const std::shared_ptr<const JEvent> &event) {

Expand All @@ -54,7 +49,7 @@ void eicrecon::MergeCherenkovParticleID_factory::Process(const std::shared_ptr<c
// call the MergeParticleID algorithm
try {
auto merged_pids = m_algo.AlgorithmProcess(cherenkov_pids);
SetCollection(std::move(merged_pids));
SetCollection<edm4eic::CherenkovParticleID>(GetOutputTags()[0], std::move(merged_pids));
}
catch(std::exception &e) {
throw JException(e.what());
Expand Down
19 changes: 9 additions & 10 deletions src/global/pid/MergeCherenkovParticleID_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#pragma once

#include <JANA/JEvent.h>
#include <JANA/JException.h>
#include <edm4eic/CherenkovParticleIDCollection.h>
#include <cstddef>
#include <memory>
Expand All @@ -19,31 +18,31 @@
#include "algorithms/pid/MergeParticleID.h"
#include "algorithms/pid/MergeParticleIDConfig.h"
// JANA
#include "extensions/jana/JChainFactoryT.h"
#include "extensions/jana/JChainMultifactoryT.h"
// services
#include "extensions/spdlog/SpdlogMixin.h"

namespace eicrecon {

class MergeCherenkovParticleID_factory :
public JChainFactoryT<edm4eic::CherenkovParticleID, MergeParticleIDConfig>,
public JChainMultifactoryT<MergeParticleIDConfig>,
public SpdlogMixin
{

public:

explicit MergeCherenkovParticleID_factory(
std::vector<std::string> default_input_tags,
MergeParticleIDConfig cfg
):
JChainFactoryT<edm4eic::CherenkovParticleID, MergeParticleIDConfig>(std::move(default_input_tags), cfg) {}
std::string tag,
const std::vector<std::string>& input_tags,
const std::vector<std::string>& output_tags,
MergeParticleIDConfig cfg)
: JChainMultifactoryT<MergeParticleIDConfig>(std::move(tag), input_tags, output_tags, cfg) {
DeclarePodioOutput<edm4eic::CherenkovParticleID>(GetOutputTags()[0]);
}

/** One time initialization **/
void Init() override;

/** On run change preparations **/
void BeginRun(const std::shared_ptr<const JEvent> &event) override;

/** Event by event processing **/
void Process(const std::shared_ptr<const JEvent> &event) override;

Expand Down
10 changes: 3 additions & 7 deletions src/global/pid/MergeTrack_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

#include "MergeTrack_factory.h"

#include <JANA/JException.h>
#include <fmt/core.h>
#include <spdlog/logger.h>
#include <exception>

#include "services/io/podio/JFactoryPodioT.h"
#include "datamodel_glue.h"

//-----------------------------------------------------------------------------
void eicrecon::MergeTrack_factory::Init() {
Expand All @@ -16,7 +17,6 @@ void eicrecon::MergeTrack_factory::Init() {
auto *app = GetApplication();
auto plugin = GetPluginName();
auto prefix = plugin + ":" + GetTag();
InitDataTags(prefix);

// services
InitLogger(app, prefix, "info");
Expand All @@ -25,10 +25,6 @@ void eicrecon::MergeTrack_factory::Init() {

}

//-----------------------------------------------------------------------------
void eicrecon::MergeTrack_factory::BeginRun(const std::shared_ptr<const JEvent> &event) {
}

//-----------------------------------------------------------------------------
void eicrecon::MergeTrack_factory::Process(const std::shared_ptr<const JEvent> &event) {

Expand All @@ -42,7 +38,7 @@ void eicrecon::MergeTrack_factory::Process(const std::shared_ptr<const JEvent> &
// call the MergeTracks algorithm
try {
auto out_track_collection = m_algo.AlgorithmProcess(in_track_collections);
SetCollection(std::move(out_track_collection));
SetCollection<edm4eic::TrackSegment>(GetOutputTags()[0], std::move(out_track_collection));
}
catch(std::exception &e) {
throw JException(e.what());
Expand Down
18 changes: 10 additions & 8 deletions src/global/pid/MergeTrack_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#pragma once

#include <JANA/JEvent.h>
#include <JANA/JException.h>
#include <edm4eic/TrackSegmentCollection.h>
#include <cstddef>
#include <memory>
Expand All @@ -14,30 +13,33 @@
#include <vector>

// algorithms
#include "algorithms/interfaces/WithPodConfig.h"
#include "algorithms/pid/MergeTracks.h"
// JANA
#include "extensions/jana/JChainFactoryT.h"
#include "extensions/jana/JChainMultifactoryT.h"
// services
#include "extensions/spdlog/SpdlogMixin.h"

namespace eicrecon {

class MergeTrack_factory :
public JChainFactoryT<edm4eic::TrackSegment>,
public JChainMultifactoryT<NoConfig>,
public SpdlogMixin
{

public:

explicit MergeTrack_factory(std::vector<std::string> default_input_tags) :
JChainFactoryT<edm4eic::TrackSegment>(std::move(default_input_tags)) {}
explicit MergeTrack_factory(
std::string tag,
const std::vector<std::string>& input_tags,
const std::vector<std::string>& output_tags)
: JChainMultifactoryT<NoConfig>(std::move(tag), input_tags, output_tags) {
DeclarePodioOutput<edm4eic::TrackSegment>(GetOutputTags()[0]);
}

/** One time initialization **/
void Init() override;

/** On run change preparations **/
void BeginRun(const std::shared_ptr<const JEvent> &event) override;

/** Event by event processing **/
void Process(const std::shared_ptr<const JEvent> &event) override;

Expand Down
Loading
Loading