File indexing completed on 2025-01-18 09:55:45
0001
0002
0003
0004
0005 #pragma once
0006
0007 #include <DD4hep/Detector.h>
0008 #include <DDRec/CellIDPositionConverter.h>
0009 #include <JANA/JApplication.h>
0010 #include <JANA/Services/JServiceLocator.h>
0011 #include <gsl/pointers>
0012 #include <spdlog/logger.h>
0013 #include <memory>
0014 #include <mutex>
0015 #include <string>
0016 #include <vector>
0017
0018 class DD4hep_service : public JService
0019 {
0020 public:
0021 DD4hep_service( JApplication *app ) : m_app(app) {}
0022 virtual ~DD4hep_service();
0023
0024 virtual gsl::not_null<const dd4hep::Detector*> detector();
0025 virtual gsl::not_null<const dd4hep::rec::CellIDPositionConverter*> converter();
0026
0027 protected:
0028 void Initialize();
0029
0030 private:
0031 DD4hep_service() = default;
0032 void acquire_services(JServiceLocator *) override;
0033
0034 std::once_flag init_flag;
0035 JApplication *m_app = nullptr;
0036 std::unique_ptr<const dd4hep::Detector> m_dd4hepGeo = nullptr;
0037 std::unique_ptr<const dd4hep::rec::CellIDPositionConverter> m_cellid_converter = nullptr;
0038 std::vector<std::string> m_xml_files;
0039
0040
0041 std::string resolveFileName(const std::string &filename, char *detector_path_env);
0042
0043 std::shared_ptr<spdlog::logger> m_log;
0044 };