Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:56

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 #include <sstream>
0025 #include <iomanip>
0026 
0027 using namespace dd4hep;
0028 
0029 DD4HEP_INSTANTIATE_HANDLE(TGeoSkinSurface);
0030 DD4HEP_INSTANTIATE_HANDLE(TGeoBorderSurface);
0031 DD4HEP_INSTANTIATE_HANDLE(TGeoOpticalSurface);
0032 
0033 /// Initializing constructor.
0034 OpticalSurface::OpticalSurface(Detector& detector,
0035                                const std::string& full_name,
0036                                EModel  model,
0037                                EFinish finish,
0038                                EType   type,
0039                                double  value)
0040 {
0041   std::unique_ptr<Object> obj(new Object(full_name.c_str(), model, finish, type, value));
0042   detector.manager().AddOpticalSurface(m_element=obj.release());
0043 }
0044 
0045 /// Access to tabular properties of the surface
0046 OpticalSurface::Property OpticalSurface::property(const char* nam)  const   {
0047   return access()->GetProperty(nam);
0048 }
0049 
0050 /// Access to tabular properties of the surface
0051 OpticalSurface::Property OpticalSurface::property(const std::string& nam)  const   {
0052   return access()->GetProperty(nam.c_str());
0053 }
0054 
0055 /// Initializing constructor: Creates the object and registers it to the manager
0056 SkinSurface::SkinSurface(Detector& detector, DetElement de, const std::string& nam, OpticalSurface surf, Volume vol)
0057 {
0058   if ( de.isValid() )  {
0059     if ( vol.isValid() )  {
0060       if ( surf.isValid() )  {
0061         std::unique_ptr<Object> obj(new Object(nam.c_str(), surf->GetName(), surf.ptr(), vol.ptr()));
0062         detector.surfaceManager().addSkinSurface(de, m_element=obj.release());
0063         return;
0064       }
0065       except("SkinSurface","++ Cannot create SkinSurface %s without valid optical surface!",nam.c_str());
0066     }
0067     except("SkinSurface","++ Cannot create SkinSurface %s without valid volume!",nam.c_str());
0068   }
0069   except("SkinSurface",
0070          "++ Cannot create SkinSurface %s which is not connected to a valid detector element!",nam.c_str());
0071 }
0072 
0073 /// Access surface data
0074 OpticalSurface SkinSurface::surface()  const    {
0075   return (TGeoOpticalSurface*)(access()->GetSurface());
0076 }
0077 
0078 /// Access to tabular properties of the optical surface
0079 BorderSurface::Property SkinSurface::property(const char* nam)  const    {
0080   OpticalSurface surf(surface());
0081   return surf.property(nam);
0082 }
0083 
0084 /// Access to tabular properties of the optical surface
0085 BorderSurface::Property SkinSurface::property(const std::string& nam)  const   {
0086   OpticalSurface surf(surface());
0087   return surf.property(nam.c_str());
0088 }
0089 
0090 /// Access the node of the skin surface
0091 Volume   SkinSurface::volume()   const    {
0092   return access()->GetVolume();
0093 }
0094 
0095 /// Initializing constructor: Creates the object and registers it to the manager
0096 BorderSurface::BorderSurface(Detector&      detector,
0097                              DetElement     de,
0098                              const std::string&  nam,
0099                              OpticalSurface surf,
0100                              PlacedVolume   lft,
0101                              PlacedVolume   rht)
0102 {
0103   if ( de.isValid() )  {
0104     if ( lft.isValid() && rht.isValid() )  {
0105       if ( surf.isValid() )   {
0106         std::unique_ptr<Object> obj(new Object(nam.c_str(), surf->GetName(), surf.ptr(), lft.ptr(), rht.ptr()));
0107         detector.surfaceManager().addBorderSurface(de, m_element=obj.release());
0108         return;
0109       }
0110       except("BorderSurface","++ Cannot create BorderSurface %s without valid optical surface!",nam.c_str());
0111     }
0112     except("BorderSurface","++ Cannot create BorderSurface %s without valid placements!",nam.c_str());
0113   }
0114   except("BorderSurface",
0115          "++ Cannot create BorderSurface %s which is not connected to a valid detector element!",nam.c_str());
0116 }
0117 
0118 /// Access surface data
0119 OpticalSurface BorderSurface::surface()  const    {
0120   return (TGeoOpticalSurface*)(access()->GetSurface());
0121 }
0122 
0123 /// Access to tabular properties of the optical surface
0124 BorderSurface::Property BorderSurface::property(const char* nam)  const    {
0125   OpticalSurface surf(surface());
0126   return surf.property(nam);
0127 }
0128 
0129 /// Access to tabular properties of the optical surface
0130 BorderSurface::Property BorderSurface::property(const std::string& nam)  const   {
0131   OpticalSurface surf(surface());
0132   return surf.property(nam.c_str());
0133 }
0134 
0135 /// Access the left node of the border surface
0136 PlacedVolume   BorderSurface::left()   const    {
0137   return (TGeoNode*)access()->GetNode1();
0138 }
0139 
0140 /// Access the right node of the border surface
0141 PlacedVolume   BorderSurface::right()  const    {
0142   return access()->GetNode2();
0143 }
0144