Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:30:21

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck
0003 
0004 //
0005 //  GeoSvc.h
0006 //
0007 //
0008 //  Created by Julia Hrdinka on 30/03/15.
0009 //
0010 //
0011 
0012 #ifndef GEOSVC_H
0013 #define GEOSVC_H
0014 
0015 // Interface
0016 #include <k4Interface/IGeoSvc.h>
0017 
0018 // Gaudi
0019 #include "GaudiKernel/MsgStream.h"
0020 #include "GaudiKernel/Service.h"
0021 #include "GaudiKernel/ServiceHandle.h"
0022 
0023 // DD4Hep
0024 #include "DD4hep/Detector.h"
0025 #include "DDRec/CellIDPositionConverter.h"
0026 #include "DDRec/SurfaceManager.h"
0027 #include "DDRec/Surface.h"
0028 #include "DD4hep/DD4hepUnits.h"
0029 
0030 
0031 
0032 class GeoSvc : public extends<Service, IGeoSvc> {
0033 private:
0034 
0035   /** DD4hep detector interface class.
0036    * This is the main dd4hep detector handle.
0037    * <a href="https://dd4hep.web.cern.ch/dd4hep/reference/classdd4hep_1_1Detector.html">See DD4hep Detector documentation</a>
0038    */
0039   dd4hep::Detector* m_dd4hepGeo = nullptr;
0040 
0041   /// XML-files with the detector description
0042   Gaudi::Property<std::vector<std::string>> m_xmlFileNames{
0043       this, "detectors", {}, "Detector descriptions XML-files"};
0044 
0045   Gaudi::Property<std::string> _{
0046       this, "materials", "", "(unused)"};
0047 
0048   /// Gaudi logging output
0049   MsgStream m_log;
0050 
0051 public:
0052   GeoSvc(const std::string& name, ISvcLocator* svc);
0053 
0054   virtual ~GeoSvc();
0055 
0056   virtual StatusCode initialize() final;
0057 
0058   virtual StatusCode finalize() final;
0059 
0060   /** Build the dd4hep geometry.
0061    * This function generates the DD4hep geometry.
0062    */
0063   StatusCode buildDD4HepGeo();
0064 
0065   /** Get the top level DetElement.
0066    *   DD4hep Geometry
0067    */
0068   virtual dd4hep::DetElement getDD4HepGeo() override;
0069 
0070   /** Get the main dd4hep Detector.
0071    * Returns the pointer to the main dd4hep detector class.
0072    * <a href="https://dd4hep.web.cern.ch/dd4hep/reference/classdd4hep_1_1Detector.html">See DD4hep Detector documentation</a>
0073    */
0074   virtual dd4hep::Detector* getDetector() override;
0075   virtual dd4hep::Detector* lcdd() {
0076     return getDetector();
0077   };
0078   virtual G4VUserDetectorConstruction* getGeant4Geo() override {
0079     assert(false && "getGeant4Geo() noy implemented");
0080     return nullptr; 
0081   };
0082   virtual std::string constantAsString(std::string const& name) override {
0083     assert(false && "constantsAsString() noy implemented");
0084     (void)name;
0085     return "";
0086   };
0087 
0088 };
0089 
0090 #endif // GEOSVC_H