File indexing completed on 2025-07-01 08:57:57
0001
0002 #include <JANA/JApplication.h>
0003 #include <JANA/Components/JOmniFactory.h>
0004 #include <JANA/Components/JOmniFactoryGeneratorT.h>
0005 #include <PodioDatamodel/ExampleClusterCollection.h>
0006
0007
0008 struct PodioClusteringConfig {
0009 double scale = 1.0;
0010 double offset = 0.0;
0011 };
0012
0013 struct PodioClusteringFactory : public JOmniFactory<PodioClusteringFactory, PodioClusteringConfig> {
0014
0015 PodioInput<ExampleCluster> m_protoclusters_in {this};
0016 PodioOutput<ExampleCluster> m_clusters_out {this};
0017
0018 ParameterRef<double> m_scale {this, "scale", config().scale, "Scaling factor"};
0019 ParameterRef<double> m_offset {this, "offset", config().offset, "Amount to offset [mm]"};
0020
0021 void Configure() {
0022 }
0023
0024 void ChangeRun(int32_t ) {
0025 }
0026
0027 void Execute(int32_t , uint64_t ) {
0028
0029 auto cs = std::make_unique<ExampleClusterCollection>();
0030
0031 for (auto protocluster : *m_protoclusters_in()) {
0032 auto cluster = cs->create();
0033 cluster.energy((m_scale() * protocluster.energy()) + m_offset());
0034 }
0035
0036 m_clusters_out() = std::move(cs);
0037 }
0038 };
0039
0040