File indexing completed on 2026-04-01 07:48:53
0001
0002
0003
0004 #pragma once
0005
0006 #include <edm4eic/EDM4eicVersion.h>
0007 #include "algorithms/calorimetry/CalorimeterHitDigi.h"
0008 #include "services/algorithms_init/AlgorithmsInit_service.h"
0009 #include "extensions/jana/JOmniFactory.h"
0010
0011 namespace eicrecon {
0012
0013 class CalorimeterHitDigi_factory
0014 : public JOmniFactory<CalorimeterHitDigi_factory, CalorimeterHitDigiConfig> {
0015
0016 public:
0017 using AlgoT = eicrecon::CalorimeterHitDigi;
0018
0019 private:
0020 std::unique_ptr<AlgoT> m_algo;
0021
0022 PodioInput<edm4hep::EventHeader> m_event_headers_input{this};
0023 PodioInput<edm4hep::SimCalorimeterHit> m_hits_input{this};
0024 PodioOutput<edm4hep::RawCalorimeterHit> m_hits_output{this};
0025 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0026 PodioOutput<edm4eic::MCRecoCalorimeterHitLink> m_links_output{this};
0027 #endif
0028 PodioOutput<edm4eic::MCRecoCalorimeterHitAssociation> m_hit_assocs_output{this};
0029
0030 ParameterRef<std::vector<double>> m_energyResolutions{this, "energyResolutions", config().eRes};
0031 ParameterRef<double> m_timeResolution{this, "timeResolution", config().tRes};
0032 ParameterRef<unsigned int> m_capADC{this, "capacityADC", config().capADC};
0033 ParameterRef<double> m_dyRangeADC{this, "dynamicRangeADC", config().dyRangeADC};
0034 ParameterRef<unsigned int> m_pedMeanADC{this, "pedestalMean", config().pedMeanADC};
0035 ParameterRef<double> m_pedSigmaADC{this, "pedestalSigma", config().pedSigmaADC};
0036 ParameterRef<double> m_resolutionTDC{this, "resolutionTDC", config().resolutionTDC};
0037 ParameterRef<std::string> m_corrMeanScale{this, "scaleResponse", config().corrMeanScale};
0038 ParameterRef<std::vector<std::string>> m_fields{this, "signalSumFields", config().fields};
0039 ParameterRef<std::string> m_readout{this, "readoutClass", config().readout};
0040 ParameterRef<std::string> m_readoutType{this, "readoutType", config().readoutType};
0041 ParameterRef<double> m_lightYield{this, "lightYield", config().lightYield};
0042 ParameterRef<double> m_photonDetectionEfficiency{this, "photonDetectionEfficiency",
0043 config().photonDetectionEfficiency};
0044 ParameterRef<unsigned long long> m_numEffectiveSipmPixels{this, "numEffectiveSipmPixels",
0045 config().numEffectiveSipmPixels};
0046
0047 Service<AlgorithmsInit_service> m_algorithmsInit{this};
0048
0049 public:
0050 void Configure() {
0051 m_algo = std::make_unique<AlgoT>(GetPrefix());
0052 m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0053 m_algo->applyConfig(config());
0054 m_algo->init();
0055 }
0056
0057 void Process(int32_t , uint64_t ) {
0058 m_algo->process({m_event_headers_input(), m_hits_input()}, {m_hits_output().get(),
0059 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0060 m_links_output().get(),
0061 #endif
0062 m_hit_assocs_output().get()});
0063 }
0064 };
0065
0066 }