CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDPixFwdDiskAlgo.cc
Go to the documentation of this file.
1 // File: DDPixFwdDiskAlgo.cc
3 // Description: Position n copies at given z-values
5 
6 #include <cmath>
7 #include <algorithm>
8 
14 #include "CLHEP/Units/PhysicalConstants.h"
15 #include "CLHEP/Units/SystemOfUnits.h"
16 
18  LogDebug("TrackerGeom") <<"DDPixFwdDiskAlgo info: Creating an instance";
19 }
20 
22 
24  const DDVectorArguments & vArgs,
25  const DDMapArguments & ,
26  const DDStringArguments & sArgs,
27  const DDStringVectorArguments & vsArgs) {
28 
29  startCopyNo = int(nArgs["StartCopyNo"]);
30  nBlades = int(nArgs["NumberOfBlades"]);
31  bladeAngle = nArgs["BladeAngle"];
32  bladeTilt = nArgs["BladeTilt"];
33  zPlane = nArgs["BladeCommonZ"];
34  bladeZShift = vArgs["BladeZShift"];
35  anchorR = nArgs["AnchorRadius"];
36 
38  childName = sArgs["ChildName"];
39  rotName = sArgs["RotationName"];
40  flagString = sArgs["FlagString"];
41  DDName parentName = parent().name();
42  LogDebug("TrackerGeom") << "DDPixFwdDiskAlgo debug: Parent " << parentName
43  << "\tChild " << childName << " NameSpace "
44  << idNameSpace << "\tRot Name " << rotName
45  << "\tCopyNo (Start/Total) " << startCopyNo << ", "
46  << nBlades << "\tAngles " << bladeAngle/CLHEP::deg
47  << ", " << bladeTilt/CLHEP::deg << "\tZshifts "
48  << zPlane << "\tAmnchor Radius " << anchorR;
49 
50  for (int iBlade=0; iBlade<nBlades; ++iBlade) {
51  LogDebug("TrackerGeom") << "DDPixFwdDiskAlgo: Blade " << iBlade
52  << " flag " << flagString[iBlade] << " zshift "
53  << bladeZShift[iBlade];
54  }
55 }
56 
58 
59  int copy = startCopyNo;
60  DDName mother = parent().name();
62  std::string flagSelector = "Y";
63 
64  double deltaPhi = (360./nBlades)*CLHEP::deg;
65  std::string rotns = DDSplit(rotName).second;
66  for (int iBlade=0; iBlade<nBlades; ++iBlade) {
67 
68  if (flagString[iBlade] == flagSelector[0]) {
69  std::string rotstr = DDSplit(rotName).first +dbl_to_string(double(copy));
70 
71  double phi = (iBlade+0.5)*deltaPhi;
72 // double phi = (iBlade+0.5)*deltaPhi - 90.*CLHEP::deg;
73  double phix = std::atan2(std::sin(phi)*std::cos(bladeAngle),
75  double thetx= std::acos(-std::sin(bladeAngle));
76  double phiy = std::atan2((std::cos(phi)*std::cos(bladeTilt)+std::sin(phi)
78  (-std::sin(phi)*std::cos(bladeTilt)+std::cos(phi)
80  double thety= std::acos(std::cos(bladeAngle)*std::sin(bladeTilt));
81  double phiz = std::atan2((-std::cos(phi)*std::sin(bladeTilt)+std::sin(phi)
85  double thetz= std::acos(std::cos(bladeAngle)*std::cos(bladeTilt));
86  DDRotation rot = DDRotation(DDName(rotstr, rotns));
87  if (!rot) {
88  LogDebug("TrackerGeom") << "DDPixFwdDiskAlgo test: Creating a new "
89  << "rotation: " << rotstr << "\t"
90  << thetx/CLHEP::deg << ", " << phix/CLHEP::deg
91  << ", " << thety/CLHEP::deg << ", "
92  << phiy/CLHEP::deg << ", " << thetz/CLHEP::deg
93  << ", " << phiz/CLHEP::deg;
94  LogDebug("TrackerGeom") << "Rotation Matrix (" << phi/CLHEP::deg << ", " << bladeAngle/CLHEP::deg << ", " << bladeTilt/CLHEP::deg << ") " << std::cos(phi)*std::cos(bladeAngle) << ", " << (-std::sin(phi)*std::cos(bladeTilt)+std::cos(phi)*std::sin(bladeAngle)*std::sin(bladeTilt)) << ", " << (std::sin(phi)*std::sin(bladeTilt)+std::cos(phi)*std::sin(bladeAngle)*std::cos(bladeTilt)) << ", " << std::sin(phi)*std::cos(bladeAngle) << ", " << (std::cos(phi)*std::cos(bladeTilt)+std::sin(phi)*std::sin(bladeAngle)*std::sin(bladeTilt)) << ", " << (-std::cos(phi)*std::sin(bladeTilt)+std::sin(phi)*std::sin(bladeAngle)*std::cos(bladeTilt)) << ", " << -std::sin(bladeAngle) << ", " << std::cos(bladeAngle)*std::sin(bladeTilt) << ", " << std::cos(bladeAngle)*std::cos(bladeTilt);
95  rot = DDrot(DDName(rotstr, rotns), thetx,phix, thety,phiy, thetz,phiz);
96  }
97  double xpos = anchorR*(-std::sin(phi)*std::cos(bladeTilt)+std::cos(phi)
99  double ypos = anchorR*(std::cos(phi)*std::cos(bladeTilt)+std::sin(phi)
102  bladeZShift[iBlade];
103  DDTranslation tran(xpos, ypos, zpos);
104  cpv.position (child, mother, copy, tran, rot);
105  LogDebug("TrackerGeom") << "DDPixFwdDiskAlgo test: " << child
106  << " number " << copy << " positioned in "
107  << mother << " at " << tran << " with " << rot;
108  }
109  copy++;
110  }
111 }
#define LogDebug(id)
std::string flagString
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
list parent
Definition: dbtoconf.py:74
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
static std::string & ns()
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
Definition: DDutils.cc:12
type of data representation of DDCompactView
Definition: DDCompactView.h:77
virtual ~DDPixFwdDiskAlgo()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
U second(std::pair< T, U > const &p)
void execute(DDCompactView &cpv)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::string childName
bool first
Definition: L1TdeRCT.cc:79
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::string rotName
std::string idNameSpace
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
std::vector< double > bladeZShift
Definition: DDAxes.h:10