23 std::string encoding ;
29 #define SURFACEINSTALLER_DATA UserData
30 #define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_CaloFaceBarrelSurfacePlugin
41 double _length, _width ;
46 double thickness_inner ,
double thickness_outer,
51 _length(0),_width(0) {}
53 void setData(
double length,
double width){
65 std::abs( uvVec[0] ) < _width/2. && std::abs( uvVec[1] ) < _length/2. ;
69 virtual std::vector< std::pair<dd4hep::rec::Vector3D, dd4hep::rec::Vector3D> >
getLines(
unsigned){
71 std::vector< std::pair<dd4hep::rec::Vector3D, dd4hep::rec::Vector3D> > lines ;
73 lines.push_back( std::make_pair(
origin()+_width/2.*
u()+_length/2.*
v(),
origin()-_width/2.*
u()+_length/2.*
v() ) ) ;
74 lines.push_back( std::make_pair(
origin()-_width/2.*
u()+_length/2.*
v(),
origin()-_width/2.*
u()-_length/2.*
v() ) ) ;
75 lines.push_back( std::make_pair(
origin()-_width/2.*
u()-_length/2.*
v(),
origin()+_width/2.*
u()-_length/2.*
v() ) ) ;
76 lines.push_back( std::make_pair(
origin()+_width/2.*
u()-_length/2.*
v(),
origin()+_width/2.*
u()+_length/2.*
v() ) ) ;
85 template <>
void Installer<UserData>::handle_arguments(
int argc,
char** argv) {
86 for(
int i=0; i<argc; ++i) {
87 char* ptr = ::strchr(argv[i],
'=');
89 std::string name( argv[i] , ptr ) ;
92 printout(dd4hep::DEBUG,
"DD4hep_CaloFaceBarrelSurfacePlugin",
"argument[%d] = %s = %f" , i, name.c_str() , value ) ;
94 if( name==
"length" ) data.length = value ;
95 else if( name==
"radius" ) data.radius = value ;
96 else if( name==
"phi0" ) data.phi0 = value ;
97 else if( name==
"symmetry") data.symmetry = value ;
98 else if( name==
"systemID") data.systemID = value ;
99 else if( name==
"encoding") data.encoding = ptr ;
101 printout(dd4hep::WARNING,
"DD4hep_CaloFaceBarrelSurfacePlugin",
"unknown parameter: %s ", name.c_str() ) ;
108 template <
typename UserData>
113 double length = data.length ;
114 double symmetry = data.symmetry ;
115 double radius = data.radius ;
116 double phi0 = data.phi0 ;
121 double width = 2. * radius * tan(
M_PI / symmetry ) ;
123 double inner_thickness = 1e-6 ;
124 double outer_thickness = 1e-6 ;
126 printout(dd4hep::INFO,
"DD4hep_CaloFaceBarrelSurfacePlugin",
"install tracking surfaces for : %s ", component.
name() ) ;
132 bf[
"system"] = data.systemID ;
135 double alpha = ( symmetry ? 2.*
M_PI / symmetry : 0. ) ;
137 for(
unsigned i=0 ; i < symmetry ; ++i){
141 double gam = phi0 + alpha/2. + i*alpha;
144 u( cos(gam+
M_PI/2.), sin(gam+
M_PI/2.), 0. ),
146 n( cos(gam) , sin(gam) , 0. ),
147 o( radius*cos(gam) , radius*sin(gam) , 0. );
149 CaloBarrelPlane surf(comp_vol,Type(Type::Helper,
Type::Sensitive), inner_thickness, outer_thickness, u,
v, n, o);
151 surf->setData( length, width ) ;
154 addSurface(component,surf);