Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:03:05

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 
0011 namespace eicrecon {
0012 
0013 class CalorimeterHitReco_factory : public JOmniFactory<CalorimeterHitReco_factory, CalorimeterHitRecoConfig> {
0014 
0015 private:
0016 public:
0017     using AlgoT = eicrecon::CalorimeterHitReco;
0018 private:
0019     std::unique_ptr<AlgoT> m_algo;
0020 
0021     PodioInput<edm4hep::RawCalorimeterHit> m_raw_hits_input {this};
0022     PodioOutput<edm4eic::CalorimeterHit> m_rec_hits_output {this};
0023 
0024     ParameterRef<unsigned int> m_capADC {this, "capacityADC", config().capADC};
0025     ParameterRef<double> m_dyRangeADC {this, "dynamicRangeADC", config().dyRangeADC};
0026     ParameterRef<unsigned int> m_pedMeanADC {this, "pedestalMean", config().pedMeanADC};
0027     ParameterRef<double> m_pedSigmaADC {this, "pedestalSigma", config().pedSigmaADC};
0028     ParameterRef<double> m_resolutionTDC {this, "resolutionTDC", config().resolutionTDC};
0029     ParameterRef<double> m_thresholdFactor {this, "thresholdFactor", config().thresholdFactor};
0030     ParameterRef<double> m_thresholdValue {this, "thresholdValue", config().thresholdValue};
0031     ParameterRef<std::string> m_samplingFraction {this, "samplingFraction", config().sampFrac};
0032     ParameterRef<std::string> m_readout {this, "readout", config().readout};
0033     ParameterRef<std::string> m_layerField {this, "layerField", config().layerField};
0034     ParameterRef<std::string> m_sectorField {this, "sectorField", config().sectorField};
0035     ParameterRef<std::string> m_localDetElement {this, "localDetElement", config().localDetElement};
0036     ParameterRef<std::vector<std::string>> m_localDetFields {this, "localDetFields", config().localDetFields};
0037 
0038     Service<AlgorithmsInit_service> m_algorithmsInit {this};
0039 
0040 public:
0041     void Configure() {
0042         m_algo = std::make_unique<AlgoT>(GetPrefix());
0043         m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0044         m_algo->applyConfig(config());
0045         m_algo->init();
0046     }
0047 
0048     void ChangeRun(int64_t run_number) {
0049     }
0050 
0051     void Process(int64_t run_number, uint64_t event_number) {
0052         m_algo->process({m_raw_hits_input()}, {m_rec_hits_output().get()});
0053     }
0054 };
0055 
0056 } // eicrecon