Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:07:32

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 <spdlog/logger.h>
0012 #include <map>
0013 #include <memory>
0014 #include <mutex>
0015 #include <string>
0016 
0017 #include "ActsGeo.h"
0018 #include "IrtGeo.h"
0019 #include "ReadoutGeo.h"
0020 
0021 class RichGeo_service : public JService {
0022 public:
0023   RichGeo_service(JApplication* /* app */) {}
0024   virtual ~RichGeo_service();
0025 
0026   // return pointer to the main DD4hep Detector
0027   virtual const dd4hep::Detector* GetDD4hepGeo() { return m_dd4hepGeo; };
0028 
0029   // return pointers to geometry bindings; initializes the bindings upon the first time called
0030   virtual richgeo::IrtGeo* GetIrtGeo(std::string detector_name);
0031   virtual const richgeo::ActsGeo* GetActsGeo(std::string detector_name);
0032   virtual std::shared_ptr<richgeo::ReadoutGeo> GetReadoutGeo(std::string detector_name,
0033                                                              std::string readout_class);
0034 
0035 private:
0036   RichGeo_service() = default;
0037   void acquire_services(JServiceLocator*) override;
0038 
0039   std::mutex m_init_lock;
0040   std::map<std::string, std::once_flag> m_init_irt;
0041   std::map<std::string, std::once_flag> m_init_acts;
0042   std::map<std::string, std::once_flag> m_init_readout;
0043 
0044   const dd4hep::Detector* m_dd4hepGeo                     = nullptr;
0045   const dd4hep::rec::CellIDPositionConverter* m_converter = nullptr;
0046   richgeo::IrtGeo* m_irtGeo                               = nullptr;
0047   richgeo::ActsGeo* m_actsGeo                             = nullptr;
0048   std::shared_ptr<richgeo::ReadoutGeo> m_readoutGeo;
0049 
0050   std::shared_ptr<spdlog::logger> m_log;
0051 };