CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDEcalEndcapTrapX Class Reference

#include <DDEcalEndcapTrapX.h>

Public Member Functions

void calculateCentres ()
 
void calculateCorners ()
 
DDTranslation centrePos ()
 
DDTranslation cornerPos (const int icorner)
 
void cornerPos (const int icorner, const DDTranslation &cc)
 
 DDEcalEndcapTrapX (const int hand, const double front, const double rear, const double length)
 
 DDEcalEndcapTrapX ()=delete
 
double elevationAngle (const DDTranslation &trans)
 
double elevationAngle ()
 
DDTranslation fcentrePos ()
 
void moveto (const DDTranslation &frontCentre, const DDTranslation &rearCentre)
 
double polarAngle (const DDTranslation &trans)
 
double polarAngle ()
 
void print ()
 
DDTranslation rcentrePos ()
 
void rotate (const DDRotationMatrix &rot)
 
void rotateX (const double angle)
 
void rotateY (const double angle)
 
DDRotationMatrix rotation ()
 
void translate (const DDTranslation &trans)
 
void translate ()
 

Private Attributes

double m_centre [4]
 
double m_corners [25]
 
double m_fcentre [4]
 
double m_front
 
int m_hand
 
double m_length
 
double m_rcentre [4]
 
double m_rear
 
DDRotationMatrix m_rotation
 
DDTranslation m_translation
 
int m_update
 

Detailed Description

Definition at line 11 of file DDEcalEndcapTrapX.h.

Constructor & Destructor Documentation

◆ DDEcalEndcapTrapX() [1/2]

DDEcalEndcapTrapX::DDEcalEndcapTrapX ( const int  hand,
const double  front,
const double  rear,
const double  length 
)

Definition at line 7 of file DDEcalEndcapTrapX.cc.

References calculateCentres(), m_corners, m_front, m_hand, m_length, m_rear, and translate().

7  {
8  //
9  // Initialise corners of supercrystal.
10 
11  // Start out with bottom surface on (x,z) plane, front face in (x,y) plane.
12 
13  double xsign;
14 
15  if (hand == 2) {
16  xsign = -1.;
17  } else {
18  xsign = 1.;
19  }
20 
21  m_hand = hand;
22  m_front = front;
23  m_rear = rear;
24  m_length = length;
25 
26  int icorner;
27  icorner = 1;
28  m_corners[3 * icorner - 3] = xsign * front;
29  m_corners[3 * icorner - 2] = front;
30  m_corners[3 * icorner - 1] = 0.;
31  icorner = 2;
32  m_corners[3 * icorner - 3] = xsign * front;
33  m_corners[3 * icorner - 2] = 0.;
34  m_corners[3 * icorner - 1] = 0.;
35  icorner = 3;
36  m_corners[3 * icorner - 3] = 0.;
37  m_corners[3 * icorner - 2] = 0.;
38  m_corners[3 * icorner - 1] = 0.;
39  icorner = 4;
40  m_corners[3 * icorner - 3] = 0.;
41  m_corners[3 * icorner - 2] = front;
42  m_corners[3 * icorner - 1] = 0.;
43 
44  icorner = 5;
45  m_corners[3 * icorner - 3] = xsign * rear;
46  m_corners[3 * icorner - 2] = rear;
47  m_corners[3 * icorner - 1] = length;
48  icorner = 6;
49  m_corners[3 * icorner - 3] = xsign * rear;
50  m_corners[3 * icorner - 2] = 0.;
51  m_corners[3 * icorner - 1] = length;
52  icorner = 7;
53  m_corners[3 * icorner - 3] = 0.;
54  m_corners[3 * icorner - 2] = 0.;
55  m_corners[3 * icorner - 1] = length;
56  icorner = 8;
57  m_corners[3 * icorner - 3] = 0.;
58  m_corners[3 * icorner - 2] = rear;
59  m_corners[3 * icorner - 1] = length;
60 
62 
63  // Move centre of SC to (0,0,0)
64 
65  translate();
66 
67  // Rotate into standard position (face centres on z axis)
68 
69  // this->rotate();
70 
72 }

◆ DDEcalEndcapTrapX() [2/2]

DDEcalEndcapTrapX::DDEcalEndcapTrapX ( )
delete

Member Function Documentation

◆ calculateCentres()

void DDEcalEndcapTrapX::calculateCentres ( )

Definition at line 170 of file DDEcalEndcapTrapX.cc.

References m_centre, m_corners, m_fcentre, and m_rcentre.

Referenced by DDEcalEndcapTrapX(), rotate(), and translate().

170  {
171  //
172  // Calculate crystal centre and front & rear face centres
173  //
174 
175  int ixyz, icorner;
176 
177  for (ixyz = 0; ixyz < 3; ixyz++) {
178  m_centre[ixyz] = 0;
179  m_fcentre[ixyz] = 0;
180  m_rcentre[ixyz] = 0;
181  }
182 
183  for (icorner = 1; icorner <= 4; icorner++) {
184  for (ixyz = 0; ixyz < 3; ixyz++) {
185  m_centre[ixyz] = m_centre[ixyz] + 0.125 * m_corners[3 * icorner - 3 + ixyz];
186  m_fcentre[ixyz] = m_fcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz];
187  }
188  }
189  for (icorner = 5; icorner <= 8; icorner++) {
190  for (ixyz = 0; ixyz < 3; ixyz++) {
191  m_centre[ixyz] = m_centre[ixyz] + 0.125 * m_corners[3 * icorner - 3 + ixyz];
192  m_rcentre[ixyz] = m_rcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz];
193  }
194  }
195 }

◆ calculateCorners()

void DDEcalEndcapTrapX::calculateCorners ( )

◆ centrePos()

DDTranslation DDEcalEndcapTrapX::centrePos ( )

Definition at line 214 of file DDEcalEndcapTrapX.cc.

References m_centre.

Referenced by algorithm(), moveto(), print(), and translate().

214  {
215  //
216  // Return SC centre as a Translation
217  //
218  return DDTranslation(m_centre[0], m_centre[1], m_centre[2]);
219 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ cornerPos() [1/2]

DDTranslation DDEcalEndcapTrapX::cornerPos ( const int  icorner)

Definition at line 197 of file DDEcalEndcapTrapX.cc.

References m_corners.

Referenced by print(), rotate(), and translate().

197  {
198  //
199  // Return specified corner as a Translation
200  //
201  return DDTranslation(m_corners[3 * icorner - 3], m_corners[3 * icorner - 2], m_corners[3 * icorner - 1]);
202 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ cornerPos() [2/2]

void DDEcalEndcapTrapX::cornerPos ( const int  icorner,
const DDTranslation cc 
)

Definition at line 204 of file DDEcalEndcapTrapX.cc.

References m_corners.

204  {
205  //
206  // Save position of specified corner.
207  //
208  for (int ixyz = 0; ixyz < 3; ixyz++) {
209  m_corners[3 * icorner - 3 + ixyz] = (0 == ixyz ? cornerxyz.x() : (1 == ixyz ? cornerxyz.y() : cornerxyz.z()));
210  ;
211  }
212 }

◆ elevationAngle() [1/2]

double DDEcalEndcapTrapX::elevationAngle ( const DDTranslation trans)

Definition at line 235 of file DDEcalEndcapTrapX.cc.

235  {
236  //
237  // Return elevation angle (out of x-z plane) of a given translation (seen as a vector from the origin).
238  //
239  double sintheta = trans.y() / trans.r();
240  return asin(sintheta);
241 }

◆ elevationAngle() [2/2]

double DDEcalEndcapTrapX::elevationAngle ( )

Definition at line 243 of file DDEcalEndcapTrapX.cc.

References fcentrePos(), and rcentrePos().

Referenced by moveto().

243  {
244  //
245  // Return elevation angle (out of x-z plane) of SC in current position.
246  //
247  DDTranslation current = fcentrePos() - rcentrePos();
248  return elevationAngle(current);
249 }
DDTranslation fcentrePos()
DDTranslation rcentrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ fcentrePos()

DDTranslation DDEcalEndcapTrapX::fcentrePos ( )

Definition at line 221 of file DDEcalEndcapTrapX.cc.

References m_fcentre.

Referenced by elevationAngle(), polarAngle(), and print().

221  {
222  //
223  // Return SC front face centre as a Translation
224  //
225  return DDTranslation(m_fcentre[0], m_fcentre[1], m_fcentre[2]);
226 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ moveto()

void DDEcalEndcapTrapX::moveto ( const DDTranslation frontCentre,
const DDTranslation rearCentre 
)

Definition at line 120 of file DDEcalEndcapTrapX.cc.

References centrePos(), elevationAngle(), polarAngle(), rotateX(), rotateY(), and translate().

Referenced by algorithm().

120  {
121  //
122  // Rotate (about X then about Y) and translate supercrystal to bring axis joining front and rear face centres parallel to line connecting specified points
123  //
124 
125  // Get azimuthal and polar angles of current axis and target axis
126  double currentTheta = elevationAngle();
127  double currentPhi = polarAngle();
128  double targetTheta = elevationAngle(frontCentre - rearCentre);
129  double targetPhi = polarAngle(frontCentre - rearCentre);
130 
131  // Rotate to correct angle (X then Y)
132 #ifdef EDM_ML_DEBUG
133  edm::LogVerbatim("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl
134  << "moveto: rearCentre " << rearCentre << std::endl
135  << "moveto: X rotation: " << targetTheta << " " << currentTheta << " "
136  << targetTheta - currentTheta << std::endl
137  << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " "
138  << " " << targetPhi - currentPhi << std::endl;
139 #endif
140  rotateX(targetTheta - currentTheta);
141  rotateY(targetPhi - currentPhi);
142 
143  // Translate SC to final position
144  DDTranslation targetCentre = 0.5 * (frontCentre + rearCentre);
145 #ifdef EDM_ML_DEBUG
146  edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre - centrePos();
147 #endif
148  translate(targetCentre - centrePos());
149 }
Log< level::Info, true > LogVerbatim
DDTranslation centrePos()
void rotateX(const double angle)
void rotateY(const double angle)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ polarAngle() [1/2]

double DDEcalEndcapTrapX::polarAngle ( const DDTranslation trans)

Definition at line 251 of file DDEcalEndcapTrapX.cc.

251  {
252  //
253  // Return polar angle (from x to z) of a given translation (seen as a vector from the origin).
254  //
255  double tanphi = trans.x() / trans.z();
256  return atan(tanphi);
257 }

◆ polarAngle() [2/2]

double DDEcalEndcapTrapX::polarAngle ( )

Definition at line 259 of file DDEcalEndcapTrapX.cc.

References fcentrePos(), and rcentrePos().

Referenced by moveto().

259  {
260  //
261  // Return elevation angle (out of x-z plane) of SC in current position.
262  //
263  DDTranslation current = fcentrePos() - rcentrePos();
264  return polarAngle(current);
265 }
DDTranslation fcentrePos()
DDTranslation rcentrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ print()

void DDEcalEndcapTrapX::print ( void  )

Definition at line 267 of file DDEcalEndcapTrapX.cc.

References centrePos(), cornerPos(), fcentrePos(), and rcentrePos().

267  {
268  //
269  // Print SC coordinates for debugging
270  //
271  edm::LogVerbatim("EcalGeom") << "Endcap supercrystal";
272  for (int ic = 1; ic <= 8; ic++) {
273  DDTranslation cc = cornerPos(ic);
274  edm::LogVerbatim("EcalGeom") << "Corner " << ic << " " << cc << std::endl;
275  }
276  edm::LogVerbatim("EcalGeom") << " Centre " << centrePos() << std::endl
277  << " fCentre " << fcentrePos() << std::endl
278  << " rCentre " << rcentrePos();
279 }
Log< level::Info, true > LogVerbatim
DDTranslation centrePos()
DDTranslation fcentrePos()
DDTranslation cornerPos(const int icorner)
DDTranslation rcentrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ rcentrePos()

DDTranslation DDEcalEndcapTrapX::rcentrePos ( )

Definition at line 228 of file DDEcalEndcapTrapX.cc.

References m_rcentre.

Referenced by elevationAngle(), polarAngle(), and print().

228  {
229  //
230  // Return SC rear face centre as a Translation
231  //
232  return DDTranslation(m_rcentre[0], m_rcentre[1], m_rcentre[2]);
233 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ rotate()

void DDEcalEndcapTrapX::rotate ( const DDRotationMatrix rot)

Definition at line 74 of file DDEcalEndcapTrapX.cc.

References calculateCentres(), cornerPos(), m_rotation, and makeMuonMisalignmentScenario::rot.

Referenced by rotateX(), and rotateY().

74  {
75  //
76  // Rotate supercrystal by specified rotation about (0,0,0)
77  //
78 
79  int icorner;
80  DDTranslation cc;
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrapX::rotate - rotation " << rot;
83 #endif
84  for (icorner = 1; icorner <= 8; icorner++) {
85  cc = cornerPos(icorner);
86 #ifdef EDM_ML_DEBUG
87  edm::LogVerbatim("EcalGeom") << " Corner (orig) " << icorner << cc;
88 #endif
89  cc = rot * cc;
90 #ifdef EDM_ML_DEBUG
91  edm::LogVerbatim("EcalGeom") << " Corner (rot) " << icorner << cc;
92 #endif
93  cornerPos(icorner, cc);
94  }
97 }
DDRotationMatrix m_rotation
Log< level::Info, true > LogVerbatim
DDTranslation cornerPos(const int icorner)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ rotateX()

void DDEcalEndcapTrapX::rotateX ( const double  angle)

Definition at line 151 of file DDEcalEndcapTrapX.cc.

References angle(), rotate(), and createJobs::tmp.

Referenced by moveto().

151  {
152  //
153  // Rotate SC through given angle about X axis
154  //
155 
156  const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(1., 0., 0.), angle);
157 
158  rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz()));
159 }
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
void rotate(const DDRotationMatrix &rot)
tmp
align.sh
Definition: createJobs.py:716
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

◆ rotateY()

void DDEcalEndcapTrapX::rotateY ( const double  angle)

Definition at line 161 of file DDEcalEndcapTrapX.cc.

References angle(), rotate(), and createJobs::tmp.

Referenced by moveto().

161  {
162  //
163  // Rotate SC through given angle about Y axis
164  //
165  const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(0., 1., 0.), angle);
166 
167  rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz()));
168 }
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
void rotate(const DDRotationMatrix &rot)
tmp
align.sh
Definition: createJobs.py:716
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

◆ rotation()

DDRotationMatrix DDEcalEndcapTrapX::rotation ( void  )
inline

Definition at line 34 of file DDEcalEndcapTrapX.h.

References m_rotation.

Referenced by algorithm().

34 { return m_rotation; }
DDRotationMatrix m_rotation

◆ translate() [1/2]

void DDEcalEndcapTrapX::translate ( const DDTranslation trans)

Definition at line 106 of file DDEcalEndcapTrapX.cc.

References calculateCentres(), cornerPos(), and m_translation.

Referenced by algorithm().

106  {
107  //
108  // Translate supercrystal by specified amount
109  //
110 
111  DDTranslation tcorner;
112  for (int icorner = 1; icorner <= 8; icorner++) {
113  tcorner = cornerPos(icorner) + trans;
114  cornerPos(icorner, tcorner);
115  }
117  m_translation = trans + m_translation;
118 }
DDTranslation m_translation
DDTranslation cornerPos(const int icorner)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ translate() [2/2]

void DDEcalEndcapTrapX::translate ( )

Definition at line 99 of file DDEcalEndcapTrapX.cc.

References centrePos().

Referenced by DDEcalEndcapTrapX(), and moveto().

99  {
100 #ifdef EDM_ML_DEBUG
101  edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrapX::translate() not yet implemented";
102 #endif
103  translate(-1. * centrePos());
104 }
Log< level::Info, true > LogVerbatim
DDTranslation centrePos()

Member Data Documentation

◆ m_centre

double DDEcalEndcapTrapX::m_centre[4]
private

Definition at line 41 of file DDEcalEndcapTrapX.h.

Referenced by calculateCentres(), and centrePos().

◆ m_corners

double DDEcalEndcapTrapX::m_corners[25]
private

Definition at line 44 of file DDEcalEndcapTrapX.h.

Referenced by calculateCentres(), cornerPos(), and DDEcalEndcapTrapX().

◆ m_fcentre

double DDEcalEndcapTrapX::m_fcentre[4]
private

Definition at line 42 of file DDEcalEndcapTrapX.h.

Referenced by calculateCentres(), and fcentrePos().

◆ m_front

double DDEcalEndcapTrapX::m_front
private

Definition at line 45 of file DDEcalEndcapTrapX.h.

Referenced by DDEcalEndcapTrapX().

◆ m_hand

int DDEcalEndcapTrapX::m_hand
private

Definition at line 49 of file DDEcalEndcapTrapX.h.

Referenced by DDEcalEndcapTrapX().

◆ m_length

double DDEcalEndcapTrapX::m_length
private

Definition at line 47 of file DDEcalEndcapTrapX.h.

Referenced by DDEcalEndcapTrapX().

◆ m_rcentre

double DDEcalEndcapTrapX::m_rcentre[4]
private

Definition at line 43 of file DDEcalEndcapTrapX.h.

Referenced by calculateCentres(), and rcentrePos().

◆ m_rear

double DDEcalEndcapTrapX::m_rear
private

Definition at line 46 of file DDEcalEndcapTrapX.h.

Referenced by DDEcalEndcapTrapX().

◆ m_rotation

DDRotationMatrix DDEcalEndcapTrapX::m_rotation
private

Definition at line 38 of file DDEcalEndcapTrapX.h.

Referenced by rotate(), and rotation().

◆ m_translation

DDTranslation DDEcalEndcapTrapX::m_translation
private

Definition at line 39 of file DDEcalEndcapTrapX.h.

Referenced by translate().

◆ m_update

int DDEcalEndcapTrapX::m_update
private

Definition at line 50 of file DDEcalEndcapTrapX.h.