CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDLinear Class Reference

#include <DDLinear.h>

List of all members.

Public Member Functions

 DDLinear (void)
void execute (DDCompactView &cpv)
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
virtual ~DDLinear (void)

Private Attributes

std::vector< double > m_base
std::pair< std::string,
std::string > 
m_childNmNs
double m_delta
int m_incrCopyNo
int m_n
double m_phi
int m_startCopyNo
double m_theta

Detailed Description

Definition at line 7 of file DDLinear.h.


Constructor & Destructor Documentation

DDLinear::DDLinear ( void  )

Definition at line 8 of file DDLinear.cc.

References LogDebug.

  : m_n( 1 ),
    m_startCopyNo( 1 ),
    m_incrCopyNo( 1 ),
    m_theta( 0. ),
    m_phi( 0. ),
    m_delta( 0. )
{
  LogDebug( "DDAlgorithm" ) << "DDLinear: Creating an instance.";
}
DDLinear::~DDLinear ( void  ) [virtual]

Definition at line 19 of file DDLinear.cc.

{}

Member Function Documentation

void DDLinear::execute ( DDCompactView cpv)

Definition at line 58 of file DDLinear.cc.

References filterCSVwithJSON::copy, funct::cos(), DDrot(), i, LogDebug, m_base, m_childNmNs, m_delta, m_incrCopyNo, m_n, m_phi, m_startCopyNo, m_theta, dbtoconf::parent, DDCompactView::position(), idealTransformation::rotation, and funct::sin().

{
  DDName mother = parent().name();
  DDName ddname( m_childNmNs.first, m_childNmNs.second );
  int    copy   = m_startCopyNo;

  DDTranslation direction( sin( m_theta ) * cos( m_phi ),
                           sin( m_theta ) * sin( m_phi ),
                           cos( m_theta ));
                 
  DDTranslation basetr( m_base[0],
                        m_base[1],
                        m_base[2] );                      
                            
  DDRotation rotation = DDRotation( "IdentityRotation" );
  if( !rotation )
  {
    LogDebug( "DDAlgorithm" ) << "DDLinear: Creating a new "
                              << "rotation: IdentityRotation for " << ddname;
        
    rotation = DDrot( "IdentityRotation", new DDRotationMatrix());
  }
  
  for( int i = 0; i < m_n; ++i )
  {
    DDTranslation tran = basetr + ( /*m_offset + */ double( copy ) * m_delta ) * direction;           
    cpv.position( ddname, mother, copy, tran, rotation );
    LogDebug( "DDAlgorithm" ) << "DDLinear: " << m_childNmNs.second << ":" << m_childNmNs.first << " number " 
                              << copy << " positioned in " << mother << " at "
                              << tran << " with " << rotation;
    copy += m_incrCopyNo;
  }
}
void DDLinear::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 23 of file DDLinear.cc.

References DDSplit(), LogDebug, m_base, m_childNmNs, m_delta, m_incrCopyNo, m_n, m_phi, m_startCopyNo, m_theta, DDCurrentNamespace::ns(), and dbtoconf::parent.

{
  m_n           = int(nArgs["N"]);
  m_startCopyNo = int(nArgs["StartCopyNo"]);
  m_incrCopyNo  = int(nArgs["IncrCopyNo"]);
  m_theta       = nArgs["Theta"];
  m_phi         = nArgs["Phi"];
  // FIXME: m_offset      = nArgs["Offset"];
  m_delta       = nArgs["Delta"];
  m_base        = vArgs["Base"];

  LogDebug( "DDAlgorithm" ) << "DDLinear: Parameters for position"
                            << "ing:: n " << m_n << " Direction Theta, Phi, Offset, Delta " 
                            << m_theta/CLHEP::deg << " " 
                            << m_phi/CLHEP::deg << " "
    // FIXME: << m_offset/CLHEP::deg
                            << " " << m_delta/CLHEP::deg
                            << " Base " << m_base[0] 
                            << ", " << m_base[1] << ", " << m_base[2];
  
  m_childNmNs   = DDSplit( sArgs["ChildName"] );
  if( m_childNmNs.second.empty())
    m_childNmNs.second = DDCurrentNamespace::ns();
  
  DDName parentName = parent().name();
  LogDebug( "DDAlgorithm" ) << "DDLinear: Parent " << parentName 
                            << "\tChild " << m_childNmNs.first << " NameSpace "
                            << m_childNmNs.second;
}

Member Data Documentation

std::vector<double> DDLinear::m_base [private]

Definition at line 30 of file DDLinear.h.

Referenced by execute(), and initialize().

std::pair<std::string, std::string> DDLinear::m_childNmNs [private]

Definition at line 32 of file DDLinear.h.

Referenced by execute(), and initialize().

double DDLinear::m_delta [private]

Definition at line 29 of file DDLinear.h.

Referenced by execute(), and initialize().

int DDLinear::m_incrCopyNo [private]

Definition at line 24 of file DDLinear.h.

Referenced by execute(), and initialize().

int DDLinear::m_n [private]

Definition at line 22 of file DDLinear.h.

Referenced by execute(), and initialize().

double DDLinear::m_phi [private]

Definition at line 26 of file DDLinear.h.

Referenced by execute(), and initialize().

int DDLinear::m_startCopyNo [private]

Definition at line 23 of file DDLinear.h.

Referenced by execute(), and initialize().

double DDLinear::m_theta [private]

Definition at line 25 of file DDLinear.h.

Referenced by execute(), and initialize().