CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTECOptoHybAlgo.cc
Go to the documentation of this file.
1 // File: DDTECOptoHybAlgo.cc
3 // Description: Placing cooling pieces in the petal material of a TEC petal
5 
6 #include <cmath>
7 #include <algorithm>
8 
14 #include "CLHEP/Units/GlobalPhysicalConstants.h"
15 #include "CLHEP/Units/GlobalSystemOfUnits.h"
16 
17 
19  LogDebug("TECGeom") << "DDTECOptoHybAlgo info: Creating an instance";
20 }
21 
23 
25  const DDVectorArguments & vArgs,
26  const DDMapArguments & ,
27  const DDStringArguments & sArgs,
28  const DDStringVectorArguments & ) {
29 
31  childName = sArgs["ChildName"];
32 
33  DDName parentName = parent().name();
34 
35  LogDebug("TECGeom") << "DDTECOptoHybAlgo debug: Parent " << parentName
36  << " Child " << childName << " NameSpace " <<idNameSpace;
37 
38  optoHeight = nArgs["OptoHeight"];
39  optoWidth = nArgs["OptoWidth"];
40  rpos = nArgs["Rpos"];
41  zpos = nArgs["Zpos"];
42  startCopyNo = int (nArgs["StartCopyNo"]);
43  angles = vArgs["Angles"];
44 
45  LogDebug("TECGeom") << "DDTECOptoHybAlgo debug: Height of the Hybrid "
46  << optoHeight << " and Width " << optoWidth
47  <<"Rpos " << rpos << " Zpos " << zpos
48  << " StartCopyNo " << startCopyNo << " Number "
49  << angles.size();
50 
51  for (int i = 0; i < (int)(angles.size()); i++)
52  LogDebug("TECGeom") << "\tAngles[" << i << "] = " << angles[i];
53 
54 }
55 
57 
58  LogDebug("TECGeom") << "==>> Constructing DDTECOptoHybAlgo...";
59 
60  DDName mother = parent().name();
62 
63  // given r positions are for the lower left corner
64  rpos += optoHeight/2;
65  int copyNo = startCopyNo;
66  for (int i = 0; i < (int)(angles.size()); i++) {
67  double phix = -angles.at(i);
68  // given phi positions are for the lower left corner
69  phix += asin(optoWidth/2/rpos);
70  double xpos = rpos * cos(phix);
71  double ypos = rpos * sin(phix);
72  DDTranslation tran(xpos, ypos, zpos);
73 
75  double phiy = phix + 90.*CLHEP::deg;
76  double phideg = phix/CLHEP::deg;
77  if (phideg != 0) {
78  std::string rotstr= DDSplit(childName).first+dbl_to_string(phideg*1000.);
79  rotation = DDRotation(DDName(rotstr, idNameSpace));
80  if (!rotation) {
81  double theta = 90.*CLHEP::deg;
82  LogDebug("TECGeom") << "DDTECOptoHybAlgo test: Creating a new "
83  << "rotation: " << rotstr << "\t90., "
84  << phix/CLHEP::deg << ", 90.," << phiy/CLHEP::deg
85  << ", 0, 0";
86  rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy,
87  0., 0.);
88  }
89  }
90 
91  cpv.position(child, mother, copyNo, tran, rotation);
92  LogDebug("TECGeom") << "DDTECOptoHybAlgo test " << child << " number "
93  << copyNo << " positioned in " << mother << " at "
94  << tran << " with " << rotation;
95  copyNo++;
96  }
97 
98  LogDebug("TECGeom") << "<<== End of DDTECOptoHybAlgo construction ...";
99 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
virtual ~DDTECOptoHybAlgo()
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
std::string idNameSpace
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
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)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool first
Definition: L1TdeRCT.cc:94
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:91
void execute(DDCompactView &cpv)
std::string childName
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 > angles