Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-15 08:53:30

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::SimCalorimeterHit> m_hits_input{this};
0022   PodioOutput<edm4hep::RawCalorimeterHit> m_hits_output{this};
0023   PodioOutput<edm4eic::MCRecoCalorimeterHitAssociation> m_hit_assocs_output{this};
0024 
0025   ParameterRef<std::vector<double>> m_energyResolutions{this, "energyResolutions", config().eRes};
0026   ParameterRef<double> m_timeResolution{this, "timeResolution", config().tRes};
0027   ParameterRef<unsigned int> m_capADC{this, "capacityADC", config().capADC};
0028   ParameterRef<double> m_dyRangeADC{this, "dynamicRangeADC", config().dyRangeADC};
0029   ParameterRef<unsigned int> m_pedMeanADC{this, "pedestalMean", config().pedMeanADC};
0030   ParameterRef<double> m_pedSigmaADC{this, "pedestalSigma", config().pedSigmaADC};
0031   ParameterRef<double> m_resolutionTDC{this, "resolutionTDC", config().resolutionTDC};
0032   ParameterRef<std::string> m_corrMeanScale{this, "scaleResponse", config().corrMeanScale};
0033   ParameterRef<std::vector<std::string>> m_fields{this, "signalSumFields", config().fields};
0034   ParameterRef<std::string> m_readout{this, "readoutClass", config().readout};
0035   ParameterRef<std::string> m_readoutType{this, "readoutType", config().readoutType};
0036   ParameterRef<double> m_lightYield{this, "lightYield", config().lightYield};
0037   ParameterRef<double> m_photonDetectionEfficiency{this, "photonDetectionEfficiency",
0038                                                    config().photonDetectionEfficiency};
0039   ParameterRef<unsigned long long> m_numEffectiveSipmPixels{this, "numEffectiveSipmPixels",
0040                                                             config().numEffectiveSipmPixels};
0041 
0042   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0043 
0044 public:
0045   void Configure() {
0046     m_algo = std::make_unique<AlgoT>(GetPrefix());
0047     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0048     m_algo->applyConfig(config());
0049     m_algo->init();
0050   }
0051 
0052   void ChangeRun(int32_t /* run_number */) {}
0053 
0054   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0055     m_algo->process({m_hits_input()}, {m_hits_output().get(), m_hit_assocs_output().get()});
0056   }
0057 };
0058 
0059 } // namespace eicrecon