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() ) ) ;
92 double thickness_inner ,
double thickness_outer,
97 void setData(
double length){
106 std::abs( point.
z() - origin().z() ) < _length/2. ;
113 virtual std::vector< std::pair<dd4hep::rec::Vector3D, dd4hep::rec::Vector3D> >
getLines(
unsigned nMax){
115 std::vector< std::pair<dd4hep::rec::Vector3D, dd4hep::rec::Vector3D> > lines ;
117 const unsigned n = ( nMax > 32 ? nMax/2 : 16 ) ;
119 const double z0 =
origin().
z() ;
121 for(
unsigned i=0 ; i < n ; ++i){
122 double gam0 = 2.*
M_PI * i / n ;
123 double gam1 = 2.*
M_PI * (i+1) / n ;
124 for(
double z : { z0 - _length/2. , z0 + _length/2. } ){
128 if( i % (n/4) == 0 ){
144 CaloBarrelCylinderImpl* operator->() {
return static_cast<CaloBarrelCylinderImpl*
>(
_surf ) ; }
148 template <>
void Installer<UserData>::handle_arguments(
int argc,
char** argv) {
149 for(
int i=0; i<argc; ++i) {
150 char* ptr = ::strchr(argv[i],
'=');
152 std::string name( argv[i] , ptr ) ;
155 printout(dd4hep::DEBUG,
"DD4hep_CaloFaceBarrelSurfacePlugin",
"argument[%d] = %s = %f" , i, name.c_str() , value ) ;
157 if( name==
"length" ) data.length = value ;
158 else if( name==
"radius" ) data.radius = value ;
159 else if( name==
"phi0" ) data.phi0 = value ;
160 else if( name==
"symmetry") data.symmetry = value ;
161 else if( name==
"systemID") data.systemID = value ;
162 else if( name==
"encoding") data.encoding = ptr ;
164 printout(dd4hep::WARNING,
"DD4hep_CaloFaceBarrelSurfacePlugin",
"unknown parameter: %s ", name.c_str() ) ;
171 template <
typename UserData>
176 double length = data.length ;
177 double symmetry = data.symmetry ;
178 double radius = data.radius ;
179 double phi0 = data.phi0 ;
184 double inner_thickness = 1e-6 ;
185 double outer_thickness = 1e-6 ;
187 printout(dd4hep::INFO,
"DD4hep_CaloFaceBarrelSurfacePlugin",
"install tracking surfaces for : %s ", component.
name() ) ;
193 bf[
"system"] = data.systemID ;
203 CaloBarrelCylinder surf(comp_vol,Type(Type::Cylinder,Type::Helper,
Type::Sensitive), inner_thickness, outer_thickness, o);
205 surf->setData( length ) ;
208 addSurface(component,surf);
214 double width = 2. * radius * tan(
M_PI / symmetry ) ;
216 double alpha = ( symmetry ? 2.*
M_PI / symmetry : 0. ) ;
218 for(
unsigned i=0 ; i < symmetry ; ++i){
222 double gam = phi0 + alpha/2. + i*alpha;
225 u( cos(gam+
M_PI/2.), sin(gam+
M_PI/2.), 0. ),
227 n( cos(gam) , sin(gam) , 0. ),
228 o( radius*cos(gam) , radius*sin(gam) , 0. );
230 CaloBarrelPlane surf(comp_vol,Type(Type::Helper,
Type::Sensitive), inner_thickness, outer_thickness, u,
v, n, o);
232 surf->setData( length, width ) ;
235 addSurface(component,surf);