File indexing completed on 2025-10-27 09:06:28
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 void ChangeRun(int32_t) {};
0049
0050
0051 using ConfigType = ConfigT;
0052
0053
0054
0055 JLogger& logger() { return m_logger; }
0056
0057
0058 ConfigT& config() { return m_config; }
0059
0060
0061
0062 void Summarize(JComponentSummary& summary) const override {
0063
0064 auto* mfs = new JComponentSummary::Component(
0065 "OmniFactory", GetPrefix(), GetTypeName(), GetLevel(), GetPluginName());
0066
0067 SummarizeInputs(*mfs);
0068 SummarizeOutputs(*mfs);
0069 summary.Add(mfs);
0070 }
0071
0072 };
0073
0074 }
0075
0076 using jana::components::JOmniFactory;
0077
0078