test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDLinear.cc
Go to the documentation of this file.
6 #include "CLHEP/Units/GlobalSystemOfUnits.h"
7 
9  : m_n( 1 ),
10  m_startCopyNo( 1 ),
11  m_incrCopyNo( 1 ),
12  m_theta( 0. ),
13  m_phi( 0. ),
14  m_delta( 0. )
15 {
16  LogDebug( "DDAlgorithm" ) << "DDLinear: Creating an instance.";
17 }
18 
20 {}
21 
22 void
24  const DDVectorArguments & vArgs,
25  const DDMapArguments & ,
26  const DDStringArguments & sArgs,
27  const DDStringVectorArguments & )
28 {
29  m_n = int(nArgs["N"]);
30  m_startCopyNo = int(nArgs["StartCopyNo"]);
31  m_incrCopyNo = int(nArgs["IncrCopyNo"]);
32  m_theta = nArgs["Theta"];
33  m_phi = nArgs["Phi"];
34  // FIXME: m_offset = nArgs["Offset"];
35  m_delta = nArgs["Delta"];
36  m_base = vArgs["Base"];
37 
38  LogDebug( "DDAlgorithm" ) << "DDLinear: Parameters for position"
39  << "ing:: n " << m_n << " Direction Theta, Phi, Offset, Delta "
40  << m_theta/CLHEP::deg << " "
41  << m_phi/CLHEP::deg << " "
42  // FIXME: << m_offset/CLHEP::deg
43  << " " << m_delta/CLHEP::deg
44  << " Base " << m_base[0]
45  << ", " << m_base[1] << ", " << m_base[2];
46 
47  m_childNmNs = DDSplit( sArgs["ChildName"] );
48  if( m_childNmNs.second.empty())
50 
51  DDName parentName = parent().name();
52  LogDebug( "DDAlgorithm" ) << "DDLinear: Parent " << parentName
53  << "\tChild " << m_childNmNs.first << " NameSpace "
54  << m_childNmNs.second;
55 }
56 
57 void
59 {
60  DDName mother = parent().name();
61  DDName ddname( m_childNmNs.first, m_childNmNs.second );
62  int copy = m_startCopyNo;
63 
64  DDTranslation direction( sin( m_theta ) * cos( m_phi ),
65  sin( m_theta ) * sin( m_phi ),
66  cos( m_theta ));
67 
68  DDTranslation basetr( m_base[0],
69  m_base[1],
70  m_base[2] );
71 
72  DDRotation rotation = DDRotation( "IdentityRotation" );
73  if( !rotation )
74  {
75  LogDebug( "DDAlgorithm" ) << "DDLinear: Creating a new "
76  << "rotation: IdentityRotation for " << ddname;
77 
78  rotation = DDrot( "IdentityRotation", new DDRotationMatrix());
79  }
80 
81  for( int i = 0; i < m_n; ++i )
82  {
83  DDTranslation tran = basetr + ( /*m_offset + */ double( copy ) * m_delta ) * direction;
84  cpv.position( ddname, mother, copy, tran, rotation );
85  LogDebug( "DDAlgorithm" ) << "DDLinear: " << m_childNmNs.second << ":" << m_childNmNs.first << " number "
86  << copy << " positioned in " << mother << " at "
87  << tran << " with " << rotation;
88  copy += m_incrCopyNo;
89  }
90 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
int m_startCopyNo
Definition: DDLinear.h:23
list parent
Definition: dbtoconf.py:74
double m_phi
Definition: DDLinear.h:26
int m_incrCopyNo
Definition: DDLinear.h:24
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
double m_delta
Definition: DDLinear.h:29
static std::string & ns()
type of data representation of DDCompactView
Definition: DDCompactView.h:77
std::pair< std::string, std::string > m_childNmNs
Definition: DDLinear.h:32
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
double m_theta
Definition: DDLinear.h:25
DDLinear(void)
Definition: DDLinear.cc:8
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
Definition: DDLinear.cc:23
int m_n
Definition: DDLinear.h:22
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::vector< double > m_base
Definition: DDLinear.h:30
virtual ~DDLinear(void)
Definition: DDLinear.cc:19
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
void execute(DDCompactView &cpv)
Definition: DDLinear.cc:58