Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 08:34:01

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2023 Wouter Deconinck
0003 
0004 #pragma once
0005 
0006 #include "algorithms/calorimetry/CalorimeterHitReco.h"
0007 #include "services/algorithms_init/AlgorithmsInit_service.h"
0008 #include "extensions/jana/JOmniFactory.h"
0009 
0010 namespace eicrecon {
0011 
0012 class CalorimeterHitReco_factory
0013     : public JOmniFactory<CalorimeterHitReco_factory, CalorimeterHitRecoConfig> {
0014 
0015 private:
0016 public:
0017   using AlgoT = eicrecon::CalorimeterHitReco;
0018 
0019 private:
0020   std::unique_ptr<AlgoT> m_algo;
0021 
0022   PodioInput<edm4hep::RawCalorimeterHit> m_raw_hits_input{this};
0023   PodioOutput<edm4eic::CalorimeterHit> m_rec_hits_output{this};
0024 
0025   ParameterRef<unsigned int> m_capADC{this, "capacityADC", config().capADC};
0026   ParameterRef<double> m_dyRangeADC{this, "dynamicRangeADC", config().dyRangeADC};
0027   ParameterRef<unsigned int> m_pedMeanADC{this, "pedestalMean", config().pedMeanADC};
0028   ParameterRef<double> m_pedSigmaADC{this, "pedestalSigma", config().pedSigmaADC};
0029   ParameterRef<double> m_resolutionTDC{this, "resolutionTDC", config().resolutionTDC};
0030   ParameterRef<double> m_thresholdFactor{this, "thresholdFactor", config().thresholdFactor};
0031   ParameterRef<double> m_thresholdValue{this, "thresholdValue", config().thresholdValue};
0032   ParameterRef<std::string> m_samplingFraction{this, "samplingFraction", config().sampFrac};
0033   ParameterRef<std::string> m_readout{this, "readout", config().readout};
0034   ParameterRef<std::string> m_layerField{this, "layerField", config().layerField};
0035   ParameterRef<std::string> m_sectorField{this, "sectorField", config().sectorField};
0036   ParameterRef<std::string> m_localDetElement{this, "localDetElement", config().localDetElement};
0037   ParameterRef<std::vector<std::string>> m_localDetFields{this, "localDetFields",
0038                                                           config().localDetFields};
0039 
0040   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0041 
0042 public:
0043   void Configure() {
0044     m_algo = std::make_unique<AlgoT>(GetPrefix());
0045     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0046     m_algo->applyConfig(config());
0047     m_algo->init();
0048   }
0049 
0050   void ChangeRun(int32_t /* run_number */) {}
0051 
0052   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0053     m_algo->process({m_raw_hits_input()}, {m_rec_hits_output().get()});
0054   }
0055 };
0056 
0057 } // namespace eicrecon