Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:57

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 // Specialized generic detector constructor
0015 // 
0016 //==========================================================================
0017 // Framework include files
0018 #define  DD4HEP_USE_SURFACEINSTALL_HELPER  Lhe_PolyhedraEndcapCalorimeterSurfacePlugin
0019 #include "DD4hep/SurfaceInstaller.h"
0020 
0021 /// Install measurement surfaces
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       const TGeoHMatrix& m = par.nominal().worldTransformation();
0035       double dz = m.GetTranslation()[2];
0036       const double* trans = placementTranslation(component);
0037       double half_mod_thickness  = (mod_shape->GetZ(1)-mod_shape->GetZ(0))/2.0;
0038       double half_comp_thickness = (comp_shape->GetZ(1)-comp_shape->GetZ(0))/2.0;
0039       double si_position         = trans[2]+half_mod_thickness;
0040       double outer_thickness = half_mod_thickness - si_position;
0041       double inner_thickness = half_mod_thickness + si_position;
0042       Vector3D u(1.,0.,0.), v(0.,1.,0.), n(0.,0.,1.), o(100.,100.,0.);
0043       std::cout << " Module:    " << mod_shape.toString() << std::endl;
0044       std::cout << " Component: " << comp_shape.toString() << std::endl;
0045       std::cout << "dz:" << dz << " Si-pos:" << si_position 
0046                 << " Mod-thickness:" << half_mod_thickness 
0047                 << " Comp-thickness:" << half_comp_thickness 
0048                 << std::endl;
0049       VolPlane surf(comp_vol,Type(Type::Sensitive,Type::Measurement1D),
0050                     inner_thickness, outer_thickness, u, v, n, o);
0051       addSurface(component,surf);
0052     }
0053   }
0054 }