Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-05-12 08:47:53

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2025 Simon Gardner
0003 
0004 #pragma once
0005 
0006 #include <iostream>
0007 
0008 #include "algorithms/digi/PulseNoise.h"
0009 #include "extensions/jana/JOmniFactory.h"
0010 
0011 namespace eicrecon {
0012 
0013 class PulseNoise_factory : public JOmniFactory<PulseNoise_factory, PulseNoiseConfig> {
0014 public:
0015   using AlgoT = eicrecon::PulseNoise;
0016 
0017 private:
0018   std::unique_ptr<AlgoT> m_algo;
0019 
0020 #if EDM4EIC_VERSION_MAJOR > 8 || (EDM4EIC_VERSION_MAJOR == 8 && EDM4EIC_VERSION_MINOR >= 1)
0021   PodioInput<edm4eic::SimPulse> m_in_pulses{this};
0022   PodioOutput<edm4eic::SimPulse> m_out_pulses{this};
0023 #else
0024   PodioInput<edm4hep::TimeSeries> m_in_pulses{this};
0025   PodioOutput<edm4hep::TimeSeries> m_out_pulses{this};
0026 #endif
0027 
0028   ParameterRef<std::size_t> m_poles{this, "poles", config().poles};
0029   ParameterRef<double> m_variance{this, "variance", config().variance};
0030   ParameterRef<double> m_alpha{this, "alpha", config().alpha};
0031   ParameterRef<double> m_scale{this, "scale", config().scale};
0032 
0033   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0034 
0035 public:
0036   void Configure() {
0037     m_algo = std::make_unique<eicrecon::PulseNoise>(GetPrefix());
0038     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0039     m_algo->applyConfig(config());
0040     m_algo->init();
0041   }
0042 
0043   void ChangeRun(int32_t /* run_number */) {}
0044 
0045   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0046     m_algo->process({m_in_pulses()}, {m_out_pulses().get()});
0047   }
0048 };
0049 
0050 } // namespace eicrecon