File indexing completed on 2026-05-31 08:41:20
0001
0002
0003
0004
0005 #pragma once
0006
0007
0008
0009
0010
0011
0012
0013 #include <JANA/JEvent.h>
0014 #include <JANA/JFactory.h>
0015
0016 namespace jana::components {
0017
0018 struct EmptyConfig {};
0019
0020 template <typename FacT, typename ConfigT=EmptyConfig>
0021 class JOmniFactory : public JFactory {
0022 private:
0023
0024 ConfigT m_config;
0025
0026 public:
0027
0028 JOmniFactory() {
0029 SetCallbackStyle(CallbackStyle::LegacyMode);
0030 }
0031
0032 void Init() override {
0033 static_cast<FacT*>(this)->Configure();
0034 }
0035
0036 void BeginRun(const std::shared_ptr<const JEvent>& event) override {
0037
0038 static_cast<FacT*>(this)->ChangeRun(event->GetRunNumber());
0039 }
0040
0041 void Process(const std::shared_ptr<const JEvent>& event) override {
0042 static_cast<FacT*>(this)->Execute(event->GetRunNumber(), event->GetEventNumber());
0043 }
0044
0045
0046
0047 using JFactory::ChangeRun;
0048 virtual void ChangeRun(int32_t) {};
0049
0050 using ConfigType = ConfigT;
0051
0052
0053
0054 JLogger& logger() { return m_logger; }
0055
0056
0057 ConfigT& config() { return m_config; }
0058
0059
0060
0061 void Summarize(JComponentSummary& summary) const override {
0062
0063 auto* mfs = new JComponentSummary::Component(
0064 "OmniFactory", GetPrefix(), GetTypeName(), GetLevel(), GetPluginName());
0065
0066 SummarizeInputs(*mfs);
0067 SummarizeOutputs(*mfs);
0068 summary.Add(mfs);
0069 }
0070
0071 };
0072
0073 }
0074
0075 using jana::components::JOmniFactory;
0076
0077