72 #define SURFACEINSTALLER_DATA UserData
73 #define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_GenericSurfaceInstallerPlugin
77 template <>
void Installer<UserData>::handle_arguments(
int argc,
char** argv) {
94 for(
int i=0; i<argc; ++i) {
96 char* ptr = ::strchr(argv[i],
'=');
98 std::string name( argv[i] , ptr ) ;
100 std::cout <<
"DD4hep_GenericSurfaceInstallerPlugin: argument[" << i <<
"] = " << name
101 <<
" = " << value << std::endl;
102 if( name==
"dimension" ) data.dimension = value ;
103 if( name==
"u_x" ) data.uvector[0]=value ;
104 if( name==
"u_y" ) data.uvector[1]=value ;
105 if( name==
"u_z" ) data.uvector[2]=value ;
106 if( name==
"v_x" ) data.vvector[0]=value ;
107 if( name==
"v_y" ) data.vvector[1]=value ;
108 if( name==
"v_z" ) data.vvector[2]=value ;
109 if( name==
"n_x" ) data.nvector[0]=value ;
110 if( name==
"n_y" ) data.nvector[1]=value ;
111 if( name==
"n_z" ) data.nvector[2]=value ;
112 if( name==
"o_x" ) data.ovector[0]=value ;
113 if( name==
"o_y" ) data.ovector[1]=value ;
114 if( name==
"o_z" ) data.ovector[2]=value ;
118 std::cout <<
"DD4hep_GenericSurfaceInstallerPlugin: vectors: ";
119 std::cout <<
"u( "<<data.uvector[0]<<
" , "<<data.uvector[1]<<
" , "<<data.uvector[2]<<
") ";
120 std::cout <<
"v( "<<data.vvector[0]<<
" , "<<data.vvector[1]<<
" , "<<data.vvector[2]<<
") ";
121 std::cout <<
"n( "<<data.nvector[0]<<
" , "<<data.nvector[1]<<
" , "<<data.nvector[2]<<
") ";
122 std::cout <<
"o( "<<data.ovector[0]<<
" , "<<data.ovector[1]<<
" , "<<data.ovector[2]<<
") "<<std::endl;
127 template <
typename UserData>
135 if ( !comp_shape.
isValid() || !mod_shape.isValid() ) {
136 invalidInstaller(
"DD4hep_GenericSurfaceInstallerPlugin: Components and/or modules are not boxes -- invalid shapes");
138 }
else if ( !handleUsingCache(component,comp_vol) ) {
139 const double* trans = placementTranslation(component);
140 double half_module_thickness = 0.;
141 double sensitive_z_position = 0.;
143 if (data.nvector[0] !=0 && data.nvector[1] ==0 && data.nvector[2] ==0){
144 half_module_thickness = mod_shape->GetDX();
145 sensitive_z_position = data.nvector[0]>0 ? trans[0] : -trans[0];
146 }
else if (data.nvector[1] !=0 && data.nvector[0] ==0 && data.nvector[2] ==0){
147 half_module_thickness = mod_shape->GetDY();
148 sensitive_z_position = data.nvector[1]>0 ? trans[1] : -trans[1];
150 }
else if (data.nvector[2] !=0 && data.nvector[0] ==0 && data.nvector[1] ==0){
151 half_module_thickness = mod_shape->GetDZ();
152 sensitive_z_position = data.nvector[2]>0 ? trans[2] : -trans[2];
155 throw std::runtime_error(
"**** dd4hep_GenericSurfaceInstallerPlugin: normal vector unsupported! It has to be "
156 "perpenidcular to one of the box sides, i.e. only one non-zero component.") ;
159 double inner_thickness = half_module_thickness + sensitive_z_position;
160 double outer_thickness = half_module_thickness - sensitive_z_position;
164 Vector3D u(data.uvector[0],data.uvector[1],data.uvector[2]);
165 Vector3D
v(data.vvector[0],data.vvector[1],data.vvector[2]);
166 Vector3D n(data.nvector[0],data.nvector[1],data.nvector[2]);
167 Vector3D o(data.ovector[0],data.ovector[1],data.ovector[2]);
170 if( data.dimension == 1 ) {
171 type.setProperty( Type::Measurement1D ,
true ) ;
172 }
else if( data.dimension != 2 ) {
173 throw std::runtime_error(
"**** dd4hep_GenericSurfaceInstallerPlugin: no or wrong "
174 "'dimension' argument given - has to be 1 or 2") ;
176 VolPlane surf(comp_vol, type, inner_thickness, outer_thickness, u,
v, n, o);
177 addSurface(component,surf);