CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DDTrackerRingAlgo Class Reference

#include <DDTrackerRingAlgo.h>

Inheritance diagram for DDTrackerRingAlgo:

Public Member Functions

 DDTrackerRingAlgo ()
 
void execute (DDCompactView &cpv)
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
 
virtual ~DDTrackerRingAlgo ()
 

Private Attributes

std::vector< double > center
 
std::string childName
 
double delta
 
std::string idNameSpace
 
int incrCopyNo
 
bool isFlipped
 
bool isZPlus
 
int n
 
double radius
 
double rangeAngle
 
double startAngle
 
int startCopyNo
 
double tiltAngle
 

Detailed Description

Definition at line 41 of file DDTrackerRingAlgo.h.

Constructor & Destructor Documentation

DDTrackerRingAlgo::DDTrackerRingAlgo ( )

Definition at line 22 of file DDTrackerRingAlgo.cc.

References LogDebug.

22  {
23  LogDebug("TrackerGeom") << "DDTrackerRingAlgo info: Creating an instance";
24 }
#define LogDebug(id)
DDTrackerRingAlgo::~DDTrackerRingAlgo ( )
virtual

Definition at line 26 of file DDTrackerRingAlgo.cc.

26 {}

Member Function Documentation

void DDTrackerRingAlgo::execute ( DDCompactView cpv)

Definition at line 71 of file DDTrackerRingAlgo.cc.

References center, class-composition::child, childName, filterCSVwithJSON::copy, funct::cos(), dbl_to_string(), DDrot(), DDSplit(), delta, plotBeamSpotDB::first, i, idNameSpace, incrCopyNo, isFlipped, isZPlus, LogDebug, DDRotation::matrix(), n, confdb::parent, phi, DDCompactView::position(), radius, edm::second(), funct::sin(), startAngle, startCopyNo, AlCaHLTBitMon_QueryRunRegistry::string, theta(), and tiltAngle.

71  {
72 
73  DDRotation flipRot, tiltRot, phiRot, globalRot; // Identity
74  DDRotationMatrix flipMatrix, tiltMatrix, phiRotMatrix, globalRotMatrix; // Identity matrix
75  std::string rotstr = "RTrackerRingAlgo";
76 
77  // flipMatrix calculus
78  if (isFlipped) {
79  std::string flipRotstr = rotstr + "Flip";
80  flipRot = DDRotation(DDName(flipRotstr, idNameSpace));
81  if (!flipRot) {
82  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << flipRotstr
83  << "\t90., 180., "
84  << "90., 90., "
85  << "180., 0.";
86  flipRot = DDrot(DDName(flipRotstr, idNameSpace),
87  90.*CLHEP::deg, 180.*CLHEP::deg, 90.*CLHEP::deg, 90.*CLHEP::deg, 180.*CLHEP::deg, 0.);
88  }
89  flipMatrix = *flipRot.matrix();
90  }
91  // tiltMatrix calculus
92  if (isZPlus) {
93  std::string tiltRotstr = rotstr + "Tilt" + dbl_to_string(tiltAngle/CLHEP::deg) + "ZPlus";
94  tiltRot = DDRotation(DDName(tiltRotstr, idNameSpace));
95  if (!tiltRot) {
96  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << tiltRotstr
97  << "\t90., 90., "
98  << tiltAngle/CLHEP::deg << ", 180., "
99  << 90. - tiltAngle/CLHEP::deg << ", 0.";
100  tiltRot = DDrot(DDName(tiltRotstr, idNameSpace),
101  90.*CLHEP::deg, 90.*CLHEP::deg, tiltAngle, 180.*CLHEP::deg, 90.*CLHEP::deg - tiltAngle, 0.);
102  }
103  tiltMatrix = *tiltRot.matrix();
104  if (isFlipped) { tiltMatrix *= flipMatrix; }
105  }
106  else {
107  std::string tiltRotstr = rotstr + "Tilt" + dbl_to_string(tiltAngle/CLHEP::deg) + "ZMinus";
108  tiltRot = DDRotation(DDName(tiltRotstr, idNameSpace));
109  if (!tiltRot) {
110  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << tiltRotstr
111  << "\t90., 90., "
112  << tiltAngle/CLHEP::deg << ", 0., "
113  << 90. + tiltAngle/CLHEP::deg << ", 0.";
114  tiltRot = DDrot(DDName(tiltRotstr, idNameSpace),
115  90.*CLHEP::deg, 90.*CLHEP::deg, tiltAngle, 0., 90.*CLHEP::deg + tiltAngle, 0.);
116  }
117  tiltMatrix = *tiltRot.matrix();
118  if (isFlipped) { tiltMatrix *= flipMatrix; }
119  }
120 
121  // Loops for all phi values
122  DDName mother = parent().name();
124  double theta = 90.*CLHEP::deg;
125  int copy = startCopyNo;
126  double phi = startAngle;
127 
128  for (int i=0; i<n; i++) {
129 
130  // phiRotMatrix calculus
131  double phix = phi;
132  double phiy = phix + 90.*CLHEP::deg;
133  double phideg = phix/CLHEP::deg;
134  if (phideg != 0) {
135  std::string phiRotstr = rotstr + "Phi" + dbl_to_string(phideg*10.);
136  phiRot = DDRotation(DDName(phiRotstr, idNameSpace));
137  if (!phiRot) {
138  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << phiRotstr
139  << "\t90., " << phix/CLHEP::deg
140  << ", 90.," << phiy/CLHEP::deg
141  <<", 0., 0.";
142  phiRot = DDrot(DDName(phiRotstr, idNameSpace), theta, phix, theta, phiy, 0., 0.);
143  }
144  phiRotMatrix = *phiRot.matrix();
145  }
146 
147  // globalRot def
148  std::string globalRotstr = rotstr + "Phi" + dbl_to_string(phideg*10.) + "Tilt" + dbl_to_string(tiltAngle/CLHEP::deg);
149  if (isZPlus) {
150  globalRotstr += "ZPlus";
151  if (isFlipped) { globalRotstr += "Flip"; }
152  }
153  else {
154  globalRotstr += "ZMinus";
155  if (isFlipped) { globalRotstr += "Flip"; }
156  }
157  globalRot = DDRotation(DDName(globalRotstr, idNameSpace));
158  if (!globalRot) {
159  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new "
160  << "rotation: " << globalRotstr;
161  globalRotMatrix = phiRotMatrix * tiltMatrix;
162  globalRot = DDrot(DDName(globalRotstr, idNameSpace), new DDRotationMatrix(globalRotMatrix));
163  }
164 
165  // translation def
166  double xpos = radius*cos(phi) + center[0];
167  double ypos = radius*sin(phi) + center[1];
168  double zpos = center[2];
169  DDTranslation tran(xpos, ypos, zpos);
170 
171  // Positions child with respect to parent
172  cpv.position(child, mother, copy, tran, globalRot);
173  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test " << child << " number "
174  << copy << " positioned in " << mother << " at "
175  << tran << " with " << globalRot;
176 
177  copy += incrCopyNo;
178  phi += delta;
179  }
180 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
parent
Definition: confdb.py:1052
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:14
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
Definition: DDutils.cc:12
std::string idNameSpace
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
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
DDRotationMatrix * matrix()
Definition: DDTransform.h:94
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
std::vector< double > center
void DDTrackerRingAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 28 of file DDTrackerRingAlgo.cc.

References center, childName, delta, idNameSpace, incrCopyNo, isFlipped, isZPlus, LogDebug, n, DDCurrentNamespace::ns(), confdb::parent, radius, rangeAngle, startAngle, startCopyNo, and tiltAngle.

32  {
33 
34  n = int(nArgs["N"]);
35  startCopyNo = int(nArgs["StartCopyNo"]);
36  incrCopyNo = int(nArgs["IncrCopyNo"]);
37  rangeAngle = nArgs["RangeAngle"];
38  startAngle = nArgs["StartAngle"];
39  radius = nArgs["Radius"];
40  center = vArgs["Center"];
41  isZPlus = bool(nArgs["IsZPlus"]);
42  tiltAngle = nArgs["TiltAngle"];
43  isFlipped = bool(nArgs["IsFlipped"]);
44 
45  if (fabs(rangeAngle-360.0*CLHEP::deg)<0.001*CLHEP::deg) {
46  delta = rangeAngle/double(n);
47  } else {
48  if (n > 1) {
49  delta = rangeAngle/double(n-1);
50  } else {
51  delta = 0.;
52  }
53  }
54 
55  LogDebug("TrackerGeom") << "DDTrackerRingAlgo debug: Parameters for position"
56  << "ing:: n " << n << " Start, Range, Delta "
57  << startAngle/CLHEP::deg << " "
58  << rangeAngle/CLHEP::deg << " " << delta/CLHEP::deg
59  << " Radius " << radius << " Centre " << center[0]
60  << ", " << center[1] << ", "<<center[2];
61 
63  childName = sArgs["ChildName"];
64 
65  DDName parentName = parent().name();
66  LogDebug("TrackerGeom") << "DDTrackerRingAlgo debug: Parent " << parentName
67  << "\tChild " << childName << " NameSpace "
68  << idNameSpace;
69 }
#define LogDebug(id)
parent
Definition: confdb.py:1052
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:14
static std::string & ns()
std::string idNameSpace
std::vector< double > center

Member Data Documentation

std::vector<double> DDTrackerRingAlgo::center
private

Definition at line 64 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

std::string DDTrackerRingAlgo::childName
private

Definition at line 71 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

double DDTrackerRingAlgo::delta
private

Definition at line 68 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

std::string DDTrackerRingAlgo::idNameSpace
private

Definition at line 70 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

int DDTrackerRingAlgo::incrCopyNo
private

Definition at line 60 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

bool DDTrackerRingAlgo::isFlipped
private

Definition at line 67 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

bool DDTrackerRingAlgo::isZPlus
private

Definition at line 65 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

int DDTrackerRingAlgo::n
private

Definition at line 58 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

double DDTrackerRingAlgo::radius
private

Definition at line 63 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

double DDTrackerRingAlgo::rangeAngle
private

Definition at line 61 of file DDTrackerRingAlgo.h.

Referenced by initialize().

double DDTrackerRingAlgo::startAngle
private

Definition at line 62 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

int DDTrackerRingAlgo::startCopyNo
private

Definition at line 59 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().

double DDTrackerRingAlgo::tiltAngle
private

Definition at line 66 of file DDTrackerRingAlgo.h.

Referenced by execute(), and initialize().