Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-11 09:08:35

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2023 - 2024 Wouter Deconinck, Yann Bedfer
0003 
0004 #pragma once
0005 
0006 #include <edm4eic/EDM4eicVersion.h>
0007 #include "algorithms/digi/MPGDTrackerDigi.h"
0008 #include "services/algorithms_init/AlgorithmsInit_service.h"
0009 #include "extensions/jana/JOmniFactory.h"
0010 #include "services/geometry/acts/ACTSGeo_service.h"
0011 
0012 namespace eicrecon {
0013 
0014 class MPGDTrackerDigi_factory
0015     : public JOmniFactory<MPGDTrackerDigi_factory, MPGDTrackerDigiConfig> {
0016 
0017 public:
0018   using AlgoT = eicrecon::MPGDTrackerDigi;
0019 
0020 private:
0021   std::unique_ptr<AlgoT> m_algo;
0022 
0023   PodioInput<edm4hep::EventHeader> m_event_headers_input{this};
0024   PodioInput<edm4hep::SimTrackerHit> m_sim_hits_input{this};
0025 
0026   PodioOutput<edm4eic::RawTrackerHit> m_raw_hits_output{this};
0027   PodioOutput<edm4eic::MCRecoTrackerHitLink> m_links_output{this};
0028   PodioOutput<edm4eic::MCRecoTrackerHitAssociation> m_assoc_output{this};
0029 
0030   Service<ACTSGeo_service> m_ACTSGeoSvc{this};
0031 
0032   ParameterRef<double> m_threshold{this, "threshold", config().threshold};
0033   ParameterRef<double> m_timeResolution{this, "timeResolution", config().timeResolution};
0034   ParameterRef<std::array<double, 2>> m_stripResolutions{
0035       this, "stripResolutions", config().stripResolutions, "Space resolutions for p/n strips"};
0036   ParameterRef<std::array<int, 2>> m_stripNumbers{this, "stripNumbers", config().stripNumbers,
0037                                                   "Number of p/n strips per module"};
0038   ParameterRef<std::string> m_readout{this, "readoutClass", config().readout};
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 Process(int32_t /* run_number */, uint64_t /* event_number */) {
0049     m_algo->process({m_event_headers_input(), m_sim_hits_input()},
0050                     {m_raw_hits_output().get(), m_links_output().get(), m_assoc_output().get()});
0051   }
0052 };
0053 
0054 } // namespace eicrecon