Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 08:34:31

0001 // Copyright (C) 2022, 2023, Christopher Dilks
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 #pragma once
0005 
0006 #include <DD4hep/Detector.h>
0007 #include <DDRec/CellIDPositionConverter.h>
0008 // JANA
0009 #include <JANA/JApplicationFwd.h>
0010 #include <JANA/JServiceFwd.h>
0011 #include <JANA/Services/JServiceLocator.h>
0012 #include <spdlog/logger.h>
0013 #include <map>
0014 #include <memory>
0015 #include <mutex>
0016 #include <string>
0017 
0018 #include "ActsGeo.h"
0019 #include "IrtGeo.h"
0020 #include "ReadoutGeo.h"
0021 
0022 class RichGeo_service : public JService {
0023 public:
0024   RichGeo_service(JApplication* /* app */) {}
0025   virtual ~RichGeo_service();
0026 
0027   // return pointer to the main DD4hep Detector
0028   virtual const dd4hep::Detector* GetDD4hepGeo() { return m_dd4hepGeo; };
0029 
0030   // return pointers to geometry bindings; initializes the bindings upon the first time called
0031   virtual richgeo::IrtGeo* GetIrtGeo(std::string detector_name);
0032   virtual const richgeo::ActsGeo* GetActsGeo(std::string detector_name);
0033   virtual std::shared_ptr<richgeo::ReadoutGeo> GetReadoutGeo(std::string detector_name,
0034                                                              std::string readout_class);
0035 
0036 private:
0037   RichGeo_service() = default;
0038   void acquire_services(JServiceLocator*) override;
0039 
0040   std::mutex m_init_lock;
0041   std::map<std::string, std::once_flag> m_init_irt;
0042   std::map<std::string, std::once_flag> m_init_acts;
0043   std::map<std::string, std::once_flag> m_init_readout;
0044 
0045   const dd4hep::Detector* m_dd4hepGeo                     = nullptr;
0046   const dd4hep::rec::CellIDPositionConverter* m_converter = nullptr;
0047   richgeo::IrtGeo* m_irtGeo                               = nullptr;
0048   richgeo::ActsGeo* m_actsGeo                             = nullptr;
0049   std::shared_ptr<richgeo::ReadoutGeo> m_readoutGeo;
0050 
0051   std::shared_ptr<spdlog::logger> m_log;
0052 };