Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:53:39

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2023 - 2025, Chao Peng, Sylvester Joosten, Whitney Armstrong, Wouter Deconinck, Nathan Brei, Dmitry Kalinkin
0003 
0004 #pragma once
0005 
0006 #include "algorithms/calorimetry/CalorimeterHitDigi.h"
0007 #include "services/algorithms_init/AlgorithmsInit_service.h"
0008 #include "extensions/jana/JOmniFactory.h"
0009 
0010 namespace eicrecon {
0011 
0012 class CalorimeterHitDigi_factory
0013     : public JOmniFactory<CalorimeterHitDigi_factory, CalorimeterHitDigiConfig> {
0014 
0015 public:
0016   using AlgoT = eicrecon::CalorimeterHitDigi;
0017 
0018 private:
0019   std::unique_ptr<AlgoT> m_algo;
0020 
0021   PodioInput<edm4hep::EventHeader> m_event_headers_input{this};
0022   PodioInput<edm4hep::SimCalorimeterHit> m_hits_input{this};
0023   PodioOutput<edm4hep::RawCalorimeterHit> m_hits_output{this};
0024   PodioOutput<edm4eic::MCRecoCalorimeterHitAssociation> m_hit_assocs_output{this};
0025 
0026   ParameterRef<std::vector<double>> m_energyResolutions{this, "energyResolutions", config().eRes};
0027   ParameterRef<double> m_timeResolution{this, "timeResolution", config().tRes};
0028   ParameterRef<unsigned int> m_capADC{this, "capacityADC", config().capADC};
0029   ParameterRef<double> m_dyRangeADC{this, "dynamicRangeADC", config().dyRangeADC};
0030   ParameterRef<unsigned int> m_pedMeanADC{this, "pedestalMean", config().pedMeanADC};
0031   ParameterRef<double> m_pedSigmaADC{this, "pedestalSigma", config().pedSigmaADC};
0032   ParameterRef<double> m_resolutionTDC{this, "resolutionTDC", config().resolutionTDC};
0033   ParameterRef<std::string> m_corrMeanScale{this, "scaleResponse", config().corrMeanScale};
0034   ParameterRef<std::vector<std::string>> m_fields{this, "signalSumFields", config().fields};
0035   ParameterRef<std::string> m_readout{this, "readoutClass", config().readout};
0036   ParameterRef<std::string> m_readoutType{this, "readoutType", config().readoutType};
0037   ParameterRef<double> m_lightYield{this, "lightYield", config().lightYield};
0038   ParameterRef<double> m_photonDetectionEfficiency{this, "photonDetectionEfficiency",
0039                                                    config().photonDetectionEfficiency};
0040   ParameterRef<unsigned long long> m_numEffectiveSipmPixels{this, "numEffectiveSipmPixels",
0041                                                             config().numEffectiveSipmPixels};
0042 
0043   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0044 
0045 public:
0046   void Configure() {
0047     m_algo = std::make_unique<AlgoT>(GetPrefix());
0048     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0049     m_algo->applyConfig(config());
0050     m_algo->init();
0051   }
0052 
0053   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0054     m_algo->process({m_event_headers_input(), m_hits_input()},
0055                     {m_hits_output().get(), m_hit_assocs_output().get()});
0056   }
0057 };
0058 
0059 } // namespace eicrecon