Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-05 08:02:24

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 #include "services/algorithms_init/AlgorithmsInit_service.h"
0011 
0012 namespace eicrecon {
0013 
0014 class PulseNoise_factory
0015     : public JOmniFactory<PulseNoise_factory, PulseNoiseConfig> {
0016 public:
0017   using AlgoT = eicrecon::PulseNoise;
0018 
0019 private:
0020   std::unique_ptr<AlgoT> m_algo;
0021 
0022   PodioInput<edm4hep::TimeSeries> m_in_pulses{this};
0023 
0024   PodioOutput<edm4hep::TimeSeries> m_out_pulses{this};
0025 
0026   ParameterRef<size_t> m_poles{this, "poles", config().poles};
0027   ParameterRef<double> m_variance{this, "variance", config().variance};
0028   ParameterRef<double> m_alpha{this, "alpha", config().alpha};
0029   ParameterRef<double> m_scale{this, "scale", config().scale};
0030 
0031   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0032 
0033 public:
0034   void Configure() {
0035     m_algo = std::make_unique<eicrecon::PulseNoise>(GetPrefix());
0036     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0037     m_algo->applyConfig(config());
0038     m_algo->init();
0039   }
0040 
0041   void ChangeRun(int64_t run_number) {}
0042 
0043   void Process(int64_t run_number, uint64_t event_number) {
0044     m_algo->process({m_in_pulses()}, {m_out_pulses().get()});
0045   }
0046 };
0047 
0048 } // namespace eicrecon