EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
DD4hep_service.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (C) 2022, 2023 Whitney Armstrong, Wouter Deconinck, David Lawrence
3//
4
5#pragma once
6
7#include <DD4hep/Detector.h>
8#include <DDRec/CellIDPositionConverter.h>
9#include <JANA/JApplicationFwd.h>
10#include <JANA/JServiceFwd.h>
11#include <spdlog/logger.h>
12#include <gsl/pointers>
13#include <memory>
14#include <mutex>
15#include <string>
16#include <vector>
17
18class DD4hep_service : public JService {
19public:
20 DD4hep_service(JApplication* app) : m_app(app) {}
21 virtual ~DD4hep_service();
22
23 virtual gsl::not_null<const dd4hep::Detector*> detector();
24 virtual gsl::not_null<const dd4hep::rec::CellIDPositionConverter*> converter();
25
26protected:
27 void Initialize();
28
29private:
30 DD4hep_service() = default;
31 void acquire_services(JServiceLocator*) override;
32
33 std::once_flag init_flag;
34 JApplication* m_app = nullptr;
35 std::unique_ptr<const dd4hep::Detector> m_dd4hepGeo = nullptr;
36 std::unique_ptr<const dd4hep::rec::CellIDPositionConverter> m_cellid_converter = nullptr;
37 std::vector<std::string> m_xml_files;
38
40 static std::string resolveFileName(const std::string& filename, char* detector_path_env);
41
42 std::shared_ptr<spdlog::logger> m_log;
43};
Definition DD4hep_service.h:18
virtual ~DD4hep_service()
Definition DD4hep_service.cc:45
DD4hep_service(JApplication *app)
Definition DD4hep_service.h:20
void Initialize()
Definition DD4hep_service.cc:85
virtual gsl::not_null< const dd4hep::Detector * > detector()
Definition DD4hep_service.cc:61
virtual gsl::not_null< const dd4hep::rec::CellIDPositionConverter * > converter()
Definition DD4hep_service.cc:72