Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-14 08:13:13

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
0015 #include <DD4hep/OpticalSurfaces.h>
0016 #include <DD4hep/NamedObject.h>
0017 #include <DD4hep/Detector.h>
0018 #include <DD4hep/Printout.h>
0019 #include <DD4hep/World.h>
0020 
0021 #include <DD4hep/detail/Handle.inl>
0022 
0023 // C/C++ includes
0024 
0025 using namespace dd4hep;
0026 
0027 DD4HEP_INSTANTIATE_HANDLE(TGeoSkinSurface);
0028 DD4HEP_INSTANTIATE_HANDLE(TGeoBorderSurface);
0029 DD4HEP_INSTANTIATE_HANDLE(TGeoOpticalSurface);
0030 
0031 /// Initializing constructor.
0032 OpticalSurface::OpticalSurface(Detector& detector,
0033                                const std::string& full_name,
0034                                EModel  model,
0035                                EFinish finish,
0036                                EType   type,
0037                                double  value)
0038 {
0039   std::unique_ptr<Object> obj(new Object(full_name.c_str(), model, finish, type, value));
0040   detector.manager().AddOpticalSurface(m_element=obj.release());
0041 }
0042 
0043 /// Access to tabular properties of the surface
0044 OpticalSurface::Property OpticalSurface::property(const char* nam)  const   {
0045   return access()->GetProperty(nam);
0046 }
0047 
0048 /// Access to tabular properties of the surface
0049 OpticalSurface::Property OpticalSurface::property(const std::string& nam)  const   {
0050   return access()->GetProperty(nam.c_str());
0051 }
0052 
0053 /// Initializing constructor: Creates the object and registers it to the manager
0054 SkinSurface::SkinSurface(Detector& detector, DetElement de, const std::string& nam, OpticalSurface surf, Volume vol)
0055 {
0056   if ( de.isValid() )  {
0057     if ( vol.isValid() )  {
0058       if ( surf.isValid() )  {
0059         std::unique_ptr<Object> obj(new Object(nam.c_str(), surf->GetName(), surf.ptr(), vol.ptr()));
0060         detector.surfaceManager().addSkinSurface(de, m_element=obj.release());
0061         return;
0062       }
0063       except("SkinSurface","++ Cannot create SkinSurface %s without valid optical surface!",nam.c_str());
0064     }
0065     except("SkinSurface","++ Cannot create SkinSurface %s without valid volume!",nam.c_str());
0066   }
0067   except("SkinSurface",
0068          "++ Cannot create SkinSurface %s which is not connected to a valid detector element!",nam.c_str());
0069 }
0070 
0071 /// Access surface data
0072 OpticalSurface SkinSurface::surface()  const    {
0073   return (TGeoOpticalSurface*)(access()->GetSurface());
0074 }
0075 
0076 /// Access to tabular properties of the optical surface
0077 BorderSurface::Property SkinSurface::property(const char* nam)  const    {
0078   OpticalSurface surf(surface());
0079   return surf.property(nam);
0080 }
0081 
0082 /// Access to tabular properties of the optical surface
0083 BorderSurface::Property SkinSurface::property(const std::string& nam)  const   {
0084   OpticalSurface surf(surface());
0085   return surf.property(nam.c_str());
0086 }
0087 
0088 /// Access the node of the skin surface
0089 Volume   SkinSurface::volume()   const    {
0090   return access()->GetVolume();
0091 }
0092 
0093 /// Initializing constructor: Creates the object and registers it to the manager
0094 BorderSurface::BorderSurface(Detector&      detector,
0095                              DetElement     de,
0096                              const std::string&  nam,
0097                              OpticalSurface surf,
0098                              PlacedVolume   lft,
0099                              PlacedVolume   rht)
0100 {
0101   if ( de.isValid() )  {
0102     if ( lft.isValid() && rht.isValid() )  {
0103       if ( surf.isValid() )   {
0104         std::unique_ptr<Object> obj(new Object(nam.c_str(), surf->GetName(), surf.ptr(), lft.ptr(), rht.ptr()));
0105         detector.surfaceManager().addBorderSurface(de, m_element=obj.release());
0106         return;
0107       }
0108       except("BorderSurface","++ Cannot create BorderSurface %s without valid optical surface!",nam.c_str());
0109     }
0110     except("BorderSurface","++ Cannot create BorderSurface %s without valid placements!",nam.c_str());
0111   }
0112   except("BorderSurface",
0113          "++ Cannot create BorderSurface %s which is not connected to a valid detector element!",nam.c_str());
0114 }
0115 
0116 /// Access surface data
0117 OpticalSurface BorderSurface::surface()  const    {
0118   return (TGeoOpticalSurface*)(access()->GetSurface());
0119 }
0120 
0121 /// Access to tabular properties of the optical surface
0122 BorderSurface::Property BorderSurface::property(const char* nam)  const    {
0123   OpticalSurface surf(surface());
0124   return surf.property(nam);
0125 }
0126 
0127 /// Access to tabular properties of the optical surface
0128 BorderSurface::Property BorderSurface::property(const std::string& nam)  const   {
0129   OpticalSurface surf(surface());
0130   return surf.property(nam.c_str());
0131 }
0132 
0133 /// Access the left node of the border surface
0134 PlacedVolume   BorderSurface::left()   const    {
0135   return (TGeoNode*)access()->GetNode1();
0136 }
0137 
0138 /// Access the right node of the border surface
0139 PlacedVolume   BorderSurface::right()  const    {
0140   return access()->GetNode2();
0141 }
0142