#include <DDAngular.h>
Public Member Functions | |
DDAngular (void) | |
void | execute (DDCompactView &cpv) |
void | initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) |
virtual | ~DDAngular (void) |
Private Member Functions | |
DD3Vector | fUnitVector (double theta, double phi) |
Private Attributes | |
std::vector< double > | m_center |
std::pair< std::string, std::string > | m_childNmNs |
double | m_delta |
std::string | m_idNameSpace |
int | m_incrCopyNo |
int | m_n |
double | m_radius |
double | m_rangeAngle |
std::vector< double > | m_rotateSolid |
DDRotationMatrix | m_solidRot |
double | m_startAngle |
int | m_startCopyNo |
Definition at line 8 of file DDAngular.h.
DDAngular::DDAngular | ( | void | ) |
Definition at line 8 of file DDAngular.cc.
References LogDebug.
: m_n( 1 ), m_startCopyNo( 1 ), m_incrCopyNo( 1 ), m_startAngle( 0. ), m_rangeAngle( 360*deg ), m_radius( 0. ), m_delta( 0. ) { LogDebug( "DDAlgorithm" ) << "DDAngular: Creating an instance."; }
DDAngular::~DDAngular | ( | void | ) | [virtual] |
Definition at line 20 of file DDAngular.cc.
{}
void DDAngular::execute | ( | DDCompactView & | cpv | ) |
Definition at line 99 of file DDAngular.cc.
References filterCSVwithJSON::copy, funct::cos(), dbl_to_string(), DDcreateRotationMatrix(), DDrot(), i, LogDebug, m_center, m_childNmNs, m_delta, m_idNameSpace, m_incrCopyNo, m_n, m_radius, m_solidRot, m_startAngle, m_startCopyNo, dbtoconf::parent, phi, DDCompactView::position(), idealTransformation::rotation, funct::sin(), and theta().
{ DDName mother = parent().name(); DDName ddname( m_childNmNs.first, m_childNmNs.second ); double theta = 90.*CLHEP::deg; int copy = m_startCopyNo; double phi = m_startAngle; for( int i = 0; i < m_n; ++i ) { double phix = phi; double phiy = phix + 90. * CLHEP::deg; double phideg = phix / CLHEP::deg; std::string rotstr = m_childNmNs.first + "_" + dbl_to_string( phideg * 10.); DDRotation rotation = DDRotation( DDName( rotstr, m_idNameSpace )); if( !rotation ) { LogDebug( "DDAlgorithm" ) << "DDAngular: Creating a new " << "rotation: " << rotstr << "\t90., " << phix / CLHEP::deg << ", 90.," << phiy / CLHEP::deg << ", 0, 0"; rotation = DDrot( DDName( rotstr, m_idNameSpace ), new DDRotationMatrix(( *DDcreateRotationMatrix( theta, phix, theta, phiy, 0., 0. ) * m_solidRot ))); } double xpos = m_radius * cos( phi ) + m_center[0]; double ypos = m_radius * sin( phi ) + m_center[1]; double zpos = m_center[2]; DDTranslation tran( xpos, ypos, zpos ); cpv.position( ddname, mother, copy, tran, rotation ); LogDebug( "DDAlgorithm" ) << "DDAngular: child " << m_childNmNs.second << ":" << m_childNmNs.first << " number " << copy << " positioned in " << mother << " at " << tran << " with " << rotation << "\n"; copy += m_incrCopyNo; phi += m_delta; } }
DD3Vector DDAngular::fUnitVector | ( | double | theta, |
double | phi | ||
) | [private] |
Definition at line 141 of file DDAngular.cc.
References funct::cos(), and funct::sin().
Referenced by initialize().
void DDAngular::initialize | ( | const DDNumericArguments & | nArgs, |
const DDVectorArguments & | vArgs, | ||
const DDMapArguments & | mArgs, | ||
const DDStringArguments & | sArgs, | ||
const DDStringVectorArguments & | vsArgs | ||
) |
Definition at line 24 of file DDAngular.cc.
References DDSplit(), fUnitVector(), i, LogDebug, m_center, m_childNmNs, m_delta, m_idNameSpace, m_incrCopyNo, m_n, m_radius, m_rangeAngle, m_rotateSolid, m_solidRot, m_startAngle, m_startCopyNo, DDCurrentNamespace::ns(), dbtoconf::parent, and groupFilesInBlocks::temp.
{ m_n = int(nArgs["N"]); m_startCopyNo = int(nArgs["StartCopyNo"]); m_incrCopyNo = int(nArgs["IncrCopyNo"]); m_rangeAngle = nArgs["RangeAngle"]; m_startAngle = nArgs["StartAngle"]; m_radius = nArgs["Radius"]; m_center = vArgs["Center"]; m_rotateSolid = vArgs["RotateSolid"]; m_solidRot = DDRotationMatrix(); if( fabs( m_rangeAngle - 360.0 * CLHEP::deg ) < 0.001 * CLHEP::deg ) { m_delta = m_rangeAngle / double( m_n ); } else { if( m_n > 1 ) { m_delta = m_rangeAngle / double( m_n - 1 ); } else { m_delta = 0.; } } LogDebug( "DDAlgorithm" ) << "DDAngular: Parameters for position" << "ing:: n " << m_n << " Start, Range, Delta " << m_startAngle/CLHEP::deg << " " << m_rangeAngle/CLHEP::deg << " " << m_delta/CLHEP::deg << " Radius " << m_radius << " Centre " << m_center[0] << ", " << m_center[1] << ", " << m_center[2]; //======= collect data concerning the rotation of the solid typedef parE_type::mapped_type::size_type sz_type; sz_type sz = m_rotateSolid.size(); if( sz%3 ) { LogDebug( "DDAlgorithm" ) << "\trotateSolid must occur 3*n times (defining n subsequent rotations)\n" << "\t currently it appears " << sz << " times!\n"; } for( sz_type i = 0; i < sz; i += 3 ) { if(( m_rotateSolid[i] > 180. * deg ) || ( m_rotateSolid[i] < 0. )) { LogDebug( "DDAlgorithm" ) << "\trotateSolid \'theta\' must be in range [0,180*deg]\n" << "\t currently it is " << m_rotateSolid[i]/deg << "*deg in rotateSolid[" << double(i) << "]!\n"; } DDAxisAngle temp( fUnitVector( m_rotateSolid[i], m_rotateSolid[i + 1] ), m_rotateSolid[i + 2] ); LogDebug( "DDAlgorithm" ) << " rotsolid[" << i << "] axis=" << temp.Axis() << " rot.angle=" << temp.Angle()/deg; m_solidRot = temp * m_solidRot; } m_idNameSpace = DDCurrentNamespace::ns(); // m_childName = sArgs["ChildName"]; m_childNmNs = DDSplit( sArgs["ChildName"] ); if( m_childNmNs.second.empty()) m_childNmNs.second = DDCurrentNamespace::ns(); DDName parentName = parent().name(); LogDebug( "DDAlgorithm" ) << "DDAngular: Parent " << parentName << "\tChild " << m_childNmNs.first << "\tNameSpace " << m_childNmNs.second; }
std::vector<double> DDAngular::m_center [private] |
Definition at line 32 of file DDAngular.h.
Referenced by execute(), and initialize().
std::pair<std::string, std::string> DDAngular::m_childNmNs [private] |
Definition at line 36 of file DDAngular.h.
Referenced by execute(), and initialize().
double DDAngular::m_delta [private] |
Definition at line 31 of file DDAngular.h.
Referenced by execute(), and initialize().
std::string DDAngular::m_idNameSpace [private] |
Definition at line 35 of file DDAngular.h.
Referenced by execute(), and initialize().
int DDAngular::m_incrCopyNo [private] |
Definition at line 27 of file DDAngular.h.
Referenced by execute(), and initialize().
int DDAngular::m_n [private] |
Definition at line 25 of file DDAngular.h.
Referenced by execute(), and initialize().
double DDAngular::m_radius [private] |
Definition at line 30 of file DDAngular.h.
Referenced by execute(), and initialize().
double DDAngular::m_rangeAngle [private] |
Definition at line 29 of file DDAngular.h.
Referenced by initialize().
std::vector<double> DDAngular::m_rotateSolid [private] |
Definition at line 33 of file DDAngular.h.
Referenced by initialize().
DDRotationMatrix DDAngular::m_solidRot [private] |
Definition at line 39 of file DDAngular.h.
Referenced by execute(), and initialize().
double DDAngular::m_startAngle [private] |
Definition at line 28 of file DDAngular.h.
Referenced by execute(), and initialize().
int DDAngular::m_startCopyNo [private] |
Definition at line 26 of file DDAngular.h.
Referenced by execute(), and initialize().