test
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 Member Functions | Private Attributes
DDPixFwdBlades Class Reference

#include <DDPixFwdBlades.h>

Inheritance diagram for DDPixFwdBlades:

Public Member Functions

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

Private Member Functions

void computeNippleParameters (double endcap)
 
int issueCopyNumber ()
 

Private Attributes

double ancorRadius
 
double bladeAngle
 
double bladeZShift
 
std::string childName
 
std::string childRotationName
 
std::vector< double > childTranslationVector
 
std::map< std::string, int > copyNumbers
 
double endcap
 
std::string flagSelector
 
std::string flagString
 
std::string idNameSpace
 
double jX
 
double jY
 
double jZ
 
double kX
 
double kY
 
double kZ
 
int nBlades
 
CLHEP::HepRotation * nippleRotationZMinus
 
CLHEP::HepRotation * nippleRotationZPlus
 
double nippleTranslationX
 
double nippleTranslationY
 
double nippleTranslationZ
 
double zPlane
 

Detailed Description

Definition at line 64 of file DDPixFwdBlades.h.

Constructor & Destructor Documentation

DDPixFwdBlades::DDPixFwdBlades ( )

Definition at line 31 of file DDPixFwdBlades.cc.

31 {}
DDPixFwdBlades::~DDPixFwdBlades ( )
virtual

Definition at line 32 of file DDPixFwdBlades.cc.

32 {}

Member Function Documentation

void DDPixFwdBlades::computeNippleParameters ( double  endcap)
private

Definition at line 220 of file DDPixFwdBlades.cc.

References ancorRadius, bladeAngle, bladeZShift, funct::cos(), DDrot(), SiPixelRawToDigiRegional_cfi::deltaPhi, jX, jY, jZ, kX, kY, kZ, LogDebug, nBlades, nippleRotationZMinus, nippleRotationZPlus, nippleTranslationX, nippleTranslationY, nippleTranslationZ, funct::sin(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by execute().

220  {
221 
222  double effBladeAngle = endcap * bladeAngle;
223 
224  CLHEP::Hep3Vector jC; // Point J in the "cover" blade frame
225  CLHEP::Hep3Vector kB; // Point K in the "body" blade frame
226  std::string rotNameNippleToCover;
227  std::string rotNameCoverToNipple;
228  std::string rotNameNippleToBody;
229 
230  if (endcap > 0.) {
231  jC = CLHEP::Hep3Vector(jX, jY + ancorRadius, jZ);
232  kB = CLHEP::Hep3Vector(kX, kY + ancorRadius, kZ);
233  rotNameNippleToCover = "NippleToCoverZPlus";
234  rotNameCoverToNipple = "CoverToNippleZPlus";
235  rotNameNippleToBody = "NippleToBodyZPlus";
236  } else {
237  jC = CLHEP::Hep3Vector(-jX, jY + ancorRadius, jZ);
238  kB = CLHEP::Hep3Vector(-kX, kY + ancorRadius, kZ);
239  rotNameNippleToCover = "NippleToCoverZMinus";
240  rotNameCoverToNipple = "CoverToNippleZMinus";
241  rotNameNippleToBody = "NippleToBodyZMinus";
242  }
243 
244  // Z-shift from "cover" to "body" blade frame:
245 
246  CLHEP::Hep3Vector tCB(bladeZShift*sin(effBladeAngle), 0., bladeZShift*cos(effBladeAngle));
247 
248  // Rotation from "cover" blade frame into "body" blade frame :
249 
250  double deltaPhi = endcap*(360./nBlades)*CLHEP::deg;
251  CLHEP::HepRotation rCB(CLHEP::Hep3Vector(1.*sin(effBladeAngle), 0., 1.*cos(effBladeAngle)), deltaPhi);
252 
253  // Transform vector k into "cover" blade frame :
254 
255  CLHEP::Hep3Vector kC = rCB * (kB + tCB);
256 
257  // Vector JK in the "cover" blade frame:
258 
259  CLHEP::Hep3Vector jkC = kC - jC;
260  double* jkLength = new double(jkC.mag());
261  DDConstant JK(DDName("JK", "pixfwdNipple"), jkLength);
262  LogDebug("PixelGeom") << "+++++++++++++++ DDPixFwdBlades: " << "JK Length " << *jkLength * CLHEP::mm;
263 
264  // Position of the center of a nipple in "cover" blade frame :
265 
266  CLHEP::Hep3Vector nippleTranslation((kC+jC)/2. - CLHEP::Hep3Vector(0., ancorRadius, 0.));
267  if (endcap > 0) {
268  nippleTranslationX = nippleTranslation.x();
269  nippleTranslationY = nippleTranslation.y();
270  nippleTranslationZ = nippleTranslation.z();
271  }
272  LogDebug("PixelGeom") << "Child translation : " << nippleTranslation;
273 
274  // Rotations from nipple frame to "cover" blade frame and back :
275 
276  CLHEP::Hep3Vector vZ(0.,0.,1.);
277  CLHEP::Hep3Vector axis = vZ.cross(jkC);
278  double angleCover = vZ.angle(jkC);
279  LogDebug("PixelGeom") << " Angle to Cover: " << angleCover;
280  CLHEP::HepRotation* rpCN = new CLHEP::HepRotation(axis, angleCover);
281  if (endcap > 0.) {
282  nippleRotationZPlus = rpCN;
283  } else {
284  nippleRotationZMinus = rpCN;
285  }
286  //( endcap > 0. ? nippleRotationZPlus : nippleRotationZMinus ) = rpCN;
287 
288  DDRotationMatrix* ddrpCN = new DDRotationMatrix(rpCN->xx(), rpCN->xy(), rpCN->xz(),
289  rpCN->yx(), rpCN->yy(), rpCN->yz(),
290  rpCN->zx(), rpCN->zy(), rpCN->zz() );
291 
292  DDrot(DDName(rotNameCoverToNipple, "pixfwdNipple"), ddrpCN);
293  CLHEP::HepRotation rpNC(axis, -angleCover);
294  DDRotationMatrix* ddrpNC = new DDRotationMatrix(rpNC.xx(), rpNC.xy(), rpNC.xz(),
295  rpNC.yx(), rpNC.yy(), rpNC.yz(),
296  rpNC.zx(), rpNC.zy(), rpNC.zz() );
297 
298  DDrot(DDName(rotNameNippleToCover, "pixfwdNipple"), ddrpNC);
299 
300  // Rotation from nipple frame to "body" blade frame :
301 
302  CLHEP::HepRotation rpNB( rpNC * rCB );
303  DDRotationMatrix* ddrpNB = new DDRotationMatrix(rpNB.xx(), rpNB.xy(), rpNB.xz(),
304  rpNB.yx(), rpNB.yy(), rpNB.yz(),
305  rpNB.zx(), rpNB.zy(), rpNB.zz() );
306 
307  DDrot(DDName(rotNameNippleToBody, "pixfwdNipple"), ddrpNB);
308  double angleBody = vZ.angle(rpNB * vZ);
309  LogDebug("PixelGeom") << " Angle to body : " << angleBody;
310 }
#define LogDebug(id)
double nippleTranslationZ
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double nippleTranslationX
CLHEP::HepRotation * nippleRotationZMinus
CLHEP::HepRotation * nippleRotationZPlus
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
double nippleTranslationY
a named constant corresponding to the DDL-XML tag &lt;Constant&gt; and &lt;ConstantsVector&gt; ...
Definition: DDConstant.h:15
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
void DDPixFwdBlades::execute ( DDCompactView cpv)

Definition at line 108 of file DDPixFwdBlades.cc.

References ancorRadius, bladeAngle, bladeZShift, childName, childRotationName, childTranslationVector, computeNippleParameters(), filterCSVwithJSON::copy, DDrot(), DDSplit(), SiPixelRawToDigiRegional_cfi::deltaPhi, endcap, first, flagSelector, flagString, idNameSpace, int_to_string(), issueCopyNumber(), nBlades, nippleRotationZMinus, nippleRotationZPlus, nippleTranslationX, nippleTranslationY, nippleTranslationZ, dbtoconf::parent, phi, DDCompactView::position(), idealTransformation::rotation, DDRotation::rotation(), edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, x, detailsBasic3DVector::y, detailsBasic3DVector::z, and zPlane.

108  {
109 
110  // -- Compute Nipple parameters if not already computed :
111 
112  if (!nippleRotationZPlus) {
113  computeNippleParameters(1.); // Z Plus endcap
114  computeNippleParameters(-1.); // Z Minus endcap
115  }
116  if (childName == "") return;
117 
118  // -- Signed versions of blade angle and z-shift :
119 
120  double effBladeAngle = - endcap * bladeAngle;
121  double effBladeZShift = endcap * bladeZShift;
122 
123  // -- Names of mother and child volumes :
124 
125  DDName mother = parent().name();
127 
128  // -- Get translation and rotation from "blade frame" to "child frame", if any :
129 
130  CLHEP::HepRotation childRotMatrix = CLHEP::HepRotation();
131  if (childRotationName != "") {
133  // due to conversion to ROOT::Math::Rotation3D -- Michael Case
134  DD3Vector x, y, z;
135  childRotation.rotation()->GetComponents(x, y, z); // these are the orthonormal columns.
136  CLHEP::HepRep3x3 tr(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
137  childRotMatrix = CLHEP::HepRotation(tr);
138  } else if (childName == "pixfwdNipple:PixelForwardNippleZPlus") {
139  childRotMatrix = *nippleRotationZPlus;
140  } else if (childName == "pixfwdNipple:PixelForwardNippleZMinus") {
141  childRotMatrix = *nippleRotationZMinus;
142  }
143 
144  CLHEP::Hep3Vector childTranslation;
145  if (childName == "pixfwdNipple:PixelForwardNippleZPlus") {
146  childTranslation = CLHEP::Hep3Vector(nippleTranslationX, nippleTranslationY, nippleTranslationZ);
147  } else if (childName == "pixfwdNipple:PixelForwardNippleZMinus") {
148  childTranslation = CLHEP::Hep3Vector(-nippleTranslationX, nippleTranslationY, nippleTranslationZ);
149  } else {
150  childTranslation = CLHEP::Hep3Vector(childTranslationVector[0],childTranslationVector[1],childTranslationVector[2]);
151  }
152 
153  // Create a matrix for rotation around blade axis (to "blade frame") :
154 
155  CLHEP::HepRotation bladeRotMatrix(CLHEP::Hep3Vector(0.,1.,0.),effBladeAngle);
156 
157  // Cycle over Phi positions, placing copies of the child volume :
158 
159  double deltaPhi = (360./nBlades)*CLHEP::deg;
160  int nQuarter = nBlades/4;
161  double zShiftMax = effBladeZShift*((nQuarter-1)/2.);
162 
163  for (int iBlade=0; iBlade < nBlades; iBlade++) {
164 
165  // check if this blade position should be skipped :
166 
167  if (flagString[iBlade] != flagSelector[0]) continue;
168  int copy = issueCopyNumber();
169 
170  // calculate Phi and Z shift for this blade :
171 
172  double phi = (iBlade + 0.5) * deltaPhi - 90.*CLHEP::deg;
173  int iQuarter = iBlade % nQuarter;
174  double zShift = - zShiftMax + iQuarter * effBladeZShift;
175 
176  // compute rotation matrix from mother to blade frame :
177 
178  CLHEP::HepRotation rotMatrix(CLHEP::Hep3Vector(0.,0.,1.), phi);
179  rotMatrix *= bladeRotMatrix;
180 
181  // convert translation vector from blade frame to mother frame, and add Z shift :
182 
183  CLHEP::Hep3Vector translation = rotMatrix(childTranslation + CLHEP::Hep3Vector(0., ancorRadius, 0.));
184  translation += CLHEP::Hep3Vector(0., 0., zShift + zPlane);
185 
186  // create DDRotation for placing the child if not already existent :
187 
189  std::string rotstr = DDSplit(mother).first + DDSplit(childName).first + int_to_string(copy);
190  rotation = DDRotation(DDName(rotstr, idNameSpace));
191 
192  if (!rotation) {
193  rotMatrix *= childRotMatrix;
194  DDRotationMatrix* temp = new DDRotationMatrix(rotMatrix.xx(), rotMatrix.xy(), rotMatrix.xz(),
195  rotMatrix.yx(), rotMatrix.yy(), rotMatrix.yz(),
196  rotMatrix.zx(), rotMatrix.zy(), rotMatrix.zz() );
197  rotation = DDrot(DDName(rotstr, idNameSpace), temp);
198  }
199  // position the child :
200 
201  DDTranslation ddtran(translation.x(), translation.y(), translation.z());
202  cpv.position(child, mother, copy, ddtran, rotation);
203  // LogDebug("PixelGeom") << "DDPixFwdBlades: " << child << " Copy " << copy << " positioned in " << mother << " at " << translation << " with rotation " << rotation;
204  }
205 
206  // End of cycle over Phi positions
207 
208 }
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:90
list parent
Definition: dbtoconf.py:74
double nippleTranslationZ
std::string idNameSpace
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
void computeNippleParameters(double endcap)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
std::vector< double > childTranslationVector
float float float z
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)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
std::string int_to_string(const int &in)
Definition: DDutils.cc:16
double nippleTranslationX
CLHEP::HepRotation * nippleRotationZMinus
CLHEP::HepRotation * nippleRotationZPlus
bool first
Definition: L1TdeRCT.cc:75
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::string childName
std::string flagString
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
Definition: DDAxes.h:10
double nippleTranslationY
std::string flagSelector
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
std::string childRotationName
Definition: DDAxes.h:10
void DDPixFwdBlades::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 36 of file DDPixFwdBlades.cc.

References ancorRadius, bladeAngle, bladeZShift, childName, childRotationName, childTranslationVector, copyNumbers, endcap, flagSelector, flagString, idNameSpace, jX, jY, jZ, kX, kY, kZ, nBlades, nippleRotationZMinus, nippleRotationZPlus, nippleTranslationX, nippleTranslationY, nippleTranslationZ, DDCurrentNamespace::ns(), and zPlane.

40  {
41 
42  if ( nArgs.find("Endcap") != nArgs.end() ) {
43  endcap = nArgs["Endcap"];
44  } else {
45  endcap = 1.;
46  }
47 
48  if ( sArgs.find("FlagString") != sArgs.end() ) {
49  flagString = sArgs["FlagString"];
50  flagSelector = sArgs["FlagSelector"];
51  } else {
52  flagString = "YYYYYYYYYYYYYYYYYYYYYYYY";
53  flagSelector = "Y";
54  }
55 
56  if ( sArgs.find("Child") != sArgs.end() ) {
57  childName = sArgs["Child"];
58  } else {
59  childName = "";
60  }
61 
62  if ( vArgs.find("ChildTranslation") != vArgs.end() ) {
63  childTranslationVector = vArgs["ChildTranslation"];
64  } else {
65  childTranslationVector = std::vector<double>(3, 0.);
66  }
67 
68  if ( sArgs.find("ChildRotation") != sArgs.end() ) {
69  childRotationName = sArgs["ChildRotation"];
70  } else {
71  childRotationName = "";
72  }
73 
75 
76  // -- Input geometry parameters : -----------------------------------------------------
77 
78  nBlades = 24; // Number of blades
79  bladeAngle = 20.*CLHEP::deg; // Angle of blade rotation around its axis
80  zPlane = 0.; // Common shift in Z for all blades (with respect to disk center plane)
81  bladeZShift = 6.*CLHEP::mm; // Shift in Z between the axes of two adjacent blades
82 
83  ancorRadius = 54.631*CLHEP::mm;// Distance from beam line to ancor point defining center of "blade frame"
84 
85  // Coordinates of Nipple ancor points J and K in "blade frame" :
86 
87  jX = -16.25*CLHEP::mm;
88  jY = 96.50*CLHEP::mm;
89  jZ = 1.25*CLHEP::mm;
90  kX = 16.25*CLHEP::mm;
91  kY = 96.50*CLHEP::mm;
92  kZ = -1.25*CLHEP::mm;
93 
94  // -- Static initialization : -----------------------------------------------------------
95 
98  nippleTranslationX = 0.;
99  nippleTranslationY = 0.;
100  nippleTranslationZ = 0.;
101 
102  copyNumbers.clear();
103 
104 }
std::map< std::string, int > copyNumbers
double nippleTranslationZ
std::string idNameSpace
static std::string & ns()
std::vector< double > childTranslationVector
double nippleTranslationX
CLHEP::HepRotation * nippleRotationZMinus
CLHEP::HepRotation * nippleRotationZPlus
std::string childName
std::string flagString
double nippleTranslationY
std::string flagSelector
std::string childRotationName
int DDPixFwdBlades::issueCopyNumber ( )
private

Definition at line 212 of file DDPixFwdBlades.cc.

References childName, and copyNumbers.

Referenced by execute().

212  {
213  if (copyNumbers.count(childName) == 0) copyNumbers[childName] = 0;
214  return ++copyNumbers[childName];
215 }
std::map< std::string, int > copyNumbers
std::string childName

Member Data Documentation

double DDPixFwdBlades::ancorRadius
private

Definition at line 94 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), execute(), and initialize().

double DDPixFwdBlades::bladeAngle
private

Definition at line 90 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), execute(), and initialize().

double DDPixFwdBlades::bladeZShift
private

Definition at line 92 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), execute(), and initialize().

std::string DDPixFwdBlades::childName
private

Definition at line 112 of file DDPixFwdBlades.h.

Referenced by execute(), initialize(), and issueCopyNumber().

std::string DDPixFwdBlades::childRotationName
private

Definition at line 115 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

std::vector<double> DDPixFwdBlades::childTranslationVector
private

Definition at line 114 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

std::map<std::string, int> DDPixFwdBlades::copyNumbers
private

Definition at line 121 of file DDPixFwdBlades.h.

Referenced by initialize(), and issueCopyNumber().

double DDPixFwdBlades::endcap
private

Definition at line 107 of file DDPixFwdBlades.h.

Referenced by execute(), geometryXMLparser.CSCAlignable::index(), and initialize().

std::string DDPixFwdBlades::flagSelector
private

Definition at line 110 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

std::string DDPixFwdBlades::flagString
private

Definition at line 109 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

std::string DDPixFwdBlades::idNameSpace
private

Definition at line 119 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

double DDPixFwdBlades::jX
private

Definition at line 98 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and initialize().

double DDPixFwdBlades::jY
private

Definition at line 99 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and initialize().

double DDPixFwdBlades::jZ
private

Definition at line 100 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and initialize().

double DDPixFwdBlades::kX
private

Definition at line 101 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and initialize().

double DDPixFwdBlades::kY
private

Definition at line 102 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and initialize().

double DDPixFwdBlades::kZ
private

Definition at line 103 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and initialize().

int DDPixFwdBlades::nBlades
private

Definition at line 89 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), execute(), and initialize().

CLHEP::HepRotation* DDPixFwdBlades::nippleRotationZMinus
private

Definition at line 124 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), execute(), and initialize().

CLHEP::HepRotation* DDPixFwdBlades::nippleRotationZPlus
private

Definition at line 123 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), execute(), and initialize().

double DDPixFwdBlades::nippleTranslationX
private

Definition at line 125 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), execute(), and initialize().

double DDPixFwdBlades::nippleTranslationY
private

Definition at line 125 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), execute(), and initialize().

double DDPixFwdBlades::nippleTranslationZ
private

Definition at line 125 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), execute(), and initialize().

double DDPixFwdBlades::zPlane
private

Definition at line 91 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().