Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-07-03 07:05:28

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