23 std::string encoding ;
28 #define SURFACEINSTALLER_DATA UserData
29 #define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_CaloFaceEndcapSurfacePlugin
46 double thickness_inner ,
double thickness_outer,
51 _r(0),_phi0(0),_sym(0) {}
53 void setData(
double radius,
double phi0,
unsigned symmetry){
68 double ri = _r * cos( 2.*
M_PI / _sym ) ;
71 ( (point.
rho() < ri ) ||
72 (
volume()->GetShape()->Contains(
const_cast<double*
> (point.
const_array() ) ) ) ) ;
76 virtual std::vector< std::pair<dd4hep::rec::Vector3D, dd4hep::rec::Vector3D> >
getLines(
unsigned nMax){
78 std::vector< std::pair<dd4hep::rec::Vector3D, dd4hep::rec::Vector3D> > lines ;
81 const unsigned n = ( _sym ? _sym : ( nMax > 16 ? nMax : 16 ) ) ;
83 double alpha = 2.*
M_PI / n ;
85 for(
unsigned i=0 ; i < n ; ++i){
86 double gam0 = i * alpha + _phi0 ;
87 double gam1 = (i+1) * alpha + _phi0 ;
98 template <>
void Installer<UserData>::handle_arguments(
int argc,
char** argv) {
99 for(
int i=0; i<argc; ++i) {
100 char* ptr = ::strchr(argv[i],
'=');
102 std::string name( argv[i] , ptr ) ;
105 printout(dd4hep::DEBUG,
"DD4hep_CaloFaceEndcapSurfacePlugin",
"argument[%d] = %s = %f" , i, name.c_str() , value ) ;
107 if( name==
"zpos" ) data.zpos = value ;
108 else if( name==
"radius" ) data.radius = value ;
109 else if( name==
"phi0" ) data.phi0 = value ;
110 else if( name==
"symmetry") data.symmetry = value ;
111 else if( name==
"systemID") data.systemID = value ;
112 else if( name==
"encoding") data.encoding = ptr ;
114 printout(dd4hep::WARNING,
"DD4hep_CaloFaceEndcapSurfacePlugin",
"unknown parameter: %s ", name.c_str() ) ;
121 template <
typename UserData>
127 double zpos = data.zpos ;
128 double symmetry = data.symmetry ;
129 double radius = data.radius ;
130 double phi0 = data.phi0 ;
132 if( symmetry ) radius /= cos(
M_PI / symmetry ) ;
135 double inner_thickness = 1e-6 ;
136 double outer_thickness = 1e-6 ;
138 printout(dd4hep::INFO,
"DD4hep_CaloFaceEndcapSurfacePlugin",
"install tracking surfaces for : %s ", component.
name() ) ;
144 bf[
"system"] = data.systemID ;
149 dd4hep::rec::Vector3D u(1.,0.,0.),
v(0.,1.,0.), n(0.,0.,1.), o(0., 0.5*radius , zpos );
151 CaloEndcapPlane surf_pz(comp_vol,Type(Type::Helper,
Type::Sensitive), inner_thickness, outer_thickness, u,
v, n, o);
153 surf_pz->setData( radius, phi0, symmetry ) ;
156 addSurface(component,surf_pz);
158 CaloEndcapPlane surf_nz(comp_vol,Type(Type::Helper,
Type::Sensitive), inner_thickness, outer_thickness, u,
v, n, -1*o );
161 surf_nz->setData( radius, phi0, symmetry ) ;
164 addSurface(component,surf_nz);