CMS 3D CMS Logo

DDBHMAngular.cc
Go to the documentation of this file.
1 // File: DDBHMAngular.cc
3 // Description: Position inside the mother according to phi
5 
6 #include <cmath>
7 #include <algorithm>
8 
9 #include "DDBHMAngular.h"
15 #include "CLHEP/Units/GlobalSystemOfUnits.h"
16 
18  LogDebug("BHMGeom") << "DDBHMAngular test: Creating an instance";
19 }
20 
22 
24  const DDVectorArguments & ,
25  const DDMapArguments & ,
26  const DDStringArguments & sArgs,
27  const DDStringVectorArguments & ) {
28 
29  units = int (nArgs["number"]);
30  rr = nArgs["radius"];
31  dphi = nArgs["deltaPhi"];
32  LogDebug("BHMGeom") << "DDBHMAngular debug: Parameters for positioning-- "
33  << units << " copies at radius " << rr/CLHEP::cm
34  << " cm with delta(phi) " << dphi/CLHEP::deg;
35 
36  rotMat = sArgs["Rotation"];
37  childName = sArgs["ChildName"];
38  LogDebug("BHMGeom") << "DDBHMAngular debug: Parent " << parent().name()
39  << "\tChild " << childName << "\tRotation matrix "
40  << rotMat;
41 }
42 
44 
46  DDName parentName = parent().name();
47  std::string rotstr = DDSplit(rotMat).first;
49  if (rotstr != "NULL") {
50  std::string rotns = DDSplit(rotMat).second;
51  rot = DDRotation(DDName(rotstr, rotns));
52  }
53 
54  for (int jj=0; jj<units; jj++) {
55  double driverX(0), driverY(0), driverZ(0);
56  if (jj<16){
57  driverX = rr*cos((jj+0.5)*dphi);
58  driverY = sqrt(rr*rr-driverX*driverX);
59  } else if (jj==16) {
60  driverX = rr*cos(15.5*dphi);
61  driverY =-sqrt(rr*rr-driverX*driverX);
62  } else if (jj==17) {
63  driverX = rr*cos(14.5*dphi);
64  driverY =-sqrt(rr*rr-driverX*driverX);
65  } else if (jj==18) {
66  driverX = rr*cos(0.5*dphi);
67  driverY =-sqrt(rr*rr-driverX*driverX);
68  } else if (jj==19) {
69  driverX = rr*cos(1.5*dphi);
70  driverY =-sqrt(rr*rr-driverX*driverX);
71  }
72  DDTranslation tran(driverX, driverY, driverZ);
73 
74  cpv.position(child, parentName, jj+1, tran, rot);
75  LogDebug("BHMGeom") << "DDBHMAngular test: " << child << " number " <<jj+1
76  << " positioned in " << parentName << " at " << tran
77  << " with " << rot;
78  }
79 }
#define LogDebug(id)
virtual ~DDBHMAngular()
Definition: DDBHMAngular.cc:21
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:16
type of data representation of DDCompactView
Definition: DDCompactView.h:90
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
Definition: DDBHMAngular.cc:23
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
U second(std::pair< T, U > const &p)
T sqrt(T t)
Definition: SSEVec.h:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void execute(DDCompactView &cpv)
Definition: DDBHMAngular.cc:43
std::string rotMat
Definition: DDBHMAngular.h:30
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
std::string childName
Definition: DDBHMAngular.h:31