File indexing completed on 2025-10-30 07:56:31
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 
0018 #define  DD4HEP_USE_SURFACEINSTALL_HELPER  DD4hep_PolyhedraEndcapCalorimeterSurfacePlugin
0019 #include "DD4hep/SurfaceInstaller.h"
0020 
0021 
0022 template <typename UserData> 
0023 void Installer<UserData>::install(dd4hep::DetElement component, dd4hep::PlacedVolume pv)   {
0024   dd4hep::Volume comp_vol = pv.volume();
0025   if ( comp_vol.isSensitive() )  {  
0026     dd4hep::Volume mod_vol = parentVolume(component);
0027     dd4hep::PolyhedraRegular comp_shape(comp_vol.solid()), mod_shape(mod_vol.solid());
0028 
0029     if ( !comp_shape.isValid() || !mod_shape.isValid() )   {
0030       invalidInstaller("Components and/or modules are not Trapezoid -- invalid shapes");
0031     }
0032     else if ( !handleUsingCache(component,comp_vol) )  {
0033       dd4hep::DetElement par = component.parent();
0034       dd4hep::Alignment  nom = par.nominal();
0035       const TGeoHMatrix& m = nom.worldTransformation();
0036       double dz = m.GetTranslation()[2];
0037       const double* trans = placementTranslation(component);
0038       double half_mod_thickness  = (mod_shape->GetZ(1)-mod_shape->GetZ(0))/2.0;
0039       double half_comp_thickness = (comp_shape->GetZ(1)-comp_shape->GetZ(0))/2.0;
0040       double si_position         = trans[2]+half_mod_thickness;
0041       double outer_thickness = half_mod_thickness - si_position;
0042       double inner_thickness = half_mod_thickness + si_position;
0043       Vector3D u(1.,0.,0.), v(0.,1.,0.), n(0.,0.,1.), o(100.,100.,0.);
0044       std::cout << " Module:    " << mod_shape.toString() << std::endl;
0045       std::cout << " Component: " << comp_shape.toString() << std::endl;
0046       std::cout << "dz:" << dz << " Si-pos:" << si_position 
0047                 << " Mod-thickness:" << half_mod_thickness 
0048                 << " Comp-thickness:" << half_comp_thickness 
0049                 << std::endl;
0050       VolPlane surf(comp_vol,Type(Type::Sensitive,Type::Measurement1D),
0051                     inner_thickness, outer_thickness, u, v, n, o);
0052       addSurface(component,surf);
0053     }
0054   }
0055 }