test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDHCalTBZposAlgo.cc
Go to the documentation of this file.
1 // File: DDHCalTBZposAlgo.cc
3 // Description: Position inside the mother by shifting along Z given by eta
5 
6 #include <cmath>
7 #include <algorithm>
8 
9 namespace std{} using namespace std;
10 
16 #include "CLHEP/Units/GlobalSystemOfUnits.h"
17 
19  LogDebug("HCalGeom") << "DDHCalTBZposAlgo test: Creating an instance";
20 }
21 
23 
25  const DDVectorArguments & ,
26  const DDMapArguments & ,
27  const DDStringArguments & sArgs,
28  const DDStringVectorArguments & ) {
29 
30  eta = nArgs["Eta"];
31  theta = 2.0*atan(exp(-eta));
32  shiftX = nArgs["ShiftX"];
33  shiftY = nArgs["ShiftY"];
34  zoffset = nArgs["Zoffset"];
35  dist = nArgs["Distance"];
36  tilt = nArgs["TiltAngle"];
37  copyNumber = int (nArgs["Number"]);
38  LogDebug("HCalGeom") << "DDHCalTBZposAlgo debug: Parameters for position"
39  << "ing--" << " Eta " << eta << "\tTheta "
40  << theta/CLHEP::deg << "\tShifts " << shiftX << ", "
41  << shiftY << " along x, y axes; \tZoffest " << zoffset
42  << "\tRadial Distance " << dist << "\tTilt angle "
43  << tilt/CLHEP::deg << "\tcopyNumber " << copyNumber;
44 
45  idNameSpace = DDCurrentNamespace::ns();
46  childName = sArgs["ChildName"];
47  DDName parentName = parent().name();
48  LogDebug("HCalGeom") << "DDHCalTBZposAlgo debug: Parent " << parentName
49  << "\tChild " << childName << " NameSpace "
50  << idNameSpace;
51 }
52 
54 
55  DDName mother = parent().name();
56  DDName child(DDSplit(childName).first, DDSplit(childName).second);
57 
58  double thetax = 90.*CLHEP::deg - theta;
59  double z = zoffset + dist*tan(thetax);
60  double x = shiftX - shiftY*sin(tilt);
61  double y = shiftY*cos(tilt);
62  DDTranslation tran(x,y,z);
64  double tiltdeg = tilt/CLHEP::deg;
65  int itilt = int(tiltdeg+0.1);
66  if (itilt != 0) {
67  std::string rotstr = "R";
68  if (tiltdeg < 100) rotstr = "R0";
69  rotstr = rotstr + std::to_string(tiltdeg);
70  rot = DDRotation(DDName(rotstr, idNameSpace));
71  if (!rot) {
72  LogDebug("HCalGeom") << "DDHCalAngular test: Creating a new rotation "
73  << DDName(rotstr,idNameSpace) << "\t90, " << tiltdeg
74  << ", 90, " << (tiltdeg+90) << ", 0, 0";
75  rot = DDrot(DDName(rotstr, idNameSpace), 90*CLHEP::deg, tilt,
76  90*CLHEP::deg, (90*CLHEP::deg+tilt), 0.0, 0.0);
77  }
78  }
79  cpv.position(child, mother, copyNumber, tran, rot);
80  LogDebug("HCalGeom") << "DDHCalTBZposAlgo test: " << child << " number "
81  << copyNumber << " positioned in " << mother
82  << " at " << tran << " with " << rot;
83 }
#define LogDebug(id)
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)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
static std::string & ns()
type of data representation of DDCompactView
Definition: DDCompactView.h:90
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)
T x() const
Cartesian x coordinate.
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
void execute(DDCompactView &cpv)
virtual ~DDHCalTBZposAlgo()