CMS 3D CMS Logo

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

#include <DDEcalEndcapTrap.h>

Public Member Functions

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

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 DDEcalEndcapTrap.h.

Constructor & Destructor Documentation

◆ DDEcalEndcapTrap() [1/2]

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

Definition at line 12 of file DDEcalEndcapTrap.cc.

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

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

◆ DDEcalEndcapTrap() [2/2]

DDEcalEndcapTrap::DDEcalEndcapTrap ( )
delete

Member Function Documentation

◆ calculateCentres()

void DDEcalEndcapTrap::calculateCentres ( )

Definition at line 176 of file DDEcalEndcapTrap.cc.

176  {
177  //
178  // Calculate crystal centre and front & rear face centres
179  //
180 
181  int ixyz, icorner;
182 
183  for (ixyz = 0; ixyz < 3; ixyz++) {
184  m_centre[ixyz] = 0;
185  m_fcentre[ixyz] = 0;
186  m_rcentre[ixyz] = 0;
187  }
188 
189  for (icorner = 1; icorner <= 4; 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_fcentre[ixyz] = m_fcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz];
193  }
194  }
195  for (icorner = 5; icorner <= 8; icorner++) {
196  for (ixyz = 0; ixyz < 3; ixyz++) {
197  m_centre[ixyz] = m_centre[ixyz] + 0.125 * m_corners[3 * icorner - 3 + ixyz];
198  m_rcentre[ixyz] = m_rcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz];
199  }
200  }
201 }

References m_centre, m_corners, m_fcentre, and m_rcentre.

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

◆ calculateCorners()

void DDEcalEndcapTrap::calculateCorners ( )

◆ centrePos()

DDTranslation DDEcalEndcapTrap::centrePos ( )

Definition at line 220 of file DDEcalEndcapTrap.cc.

220  {
221  //
222  // Return SC centre as a DDTranslation
223  //
224  return DDTranslation(m_centre[0], m_centre[1], m_centre[2]);
225 }

References m_centre.

Referenced by algorithm(), DDEcalEndcapAlgo::EEPositionCRs(), DDEcalEndcapAlgo::execute(), moveto(), print(), and translate().

◆ cornerPos() [1/2]

DDTranslation DDEcalEndcapTrap::cornerPos ( const int  icorner)

Definition at line 203 of file DDEcalEndcapTrap.cc.

203  {
204  //
205  // Return specified corner as a DDTranslation
206  //
207  return DDTranslation(m_corners[3 * icorner - 3], m_corners[3 * icorner - 2], m_corners[3 * icorner - 1]);
208 }

References m_corners.

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

◆ cornerPos() [2/2]

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

Definition at line 210 of file DDEcalEndcapTrap.cc.

210  {
211  //
212  // Save position of specified corner.
213  //
214  for (int ixyz = 0; ixyz < 3; ixyz++) {
215  m_corners[3 * icorner - 3 + ixyz] = (0 == ixyz ? cornerxyz.x() : (1 == ixyz ? cornerxyz.y() : cornerxyz.z()));
216  ;
217  }
218 }

References m_corners.

◆ elevationAngle() [1/2]

double DDEcalEndcapTrap::elevationAngle ( )

Definition at line 249 of file DDEcalEndcapTrap.cc.

249  {
250  //
251  // Return elevation angle (out of x-z plane) of SC in current position.
252  //
253  DDTranslation current = fcentrePos() - rcentrePos();
254  return elevationAngle(current);
255 }

References fcentrePos(), and rcentrePos().

Referenced by moveto().

◆ elevationAngle() [2/2]

double DDEcalEndcapTrap::elevationAngle ( const DDTranslation trans)

Definition at line 241 of file DDEcalEndcapTrap.cc.

241  {
242  //
243  // Return elevation angle (out of x-z plane) of a given translation (seen as a vector from the origin).
244  //
245  double sintheta = trans.y() / trans.r();
246  return asin(sintheta);
247 }

◆ fcentrePos()

DDTranslation DDEcalEndcapTrap::fcentrePos ( )

Definition at line 227 of file DDEcalEndcapTrap.cc.

227  {
228  //
229  // Return SC front face centre as a DDTranslation
230  //
231  return DDTranslation(m_fcentre[0], m_fcentre[1], m_fcentre[2]);
232 }

References m_fcentre.

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

◆ moveto()

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

Definition at line 132 of file DDEcalEndcapTrap.cc.

132  {
133  //
134  // Rotate (about X then about Y) and translate supercrystal to bring axis joining front and rear face centres parallel to line connecting specified points
135  //
136 
137  // Get azimuthal and polar angles of current axis and target axis
138  double currentTheta = elevationAngle();
139  double currentPhi = polarAngle();
140  double targetTheta = elevationAngle(frontCentre - rearCentre);
141  double targetPhi = polarAngle(frontCentre - rearCentre);
142 
143  // Rotate to correct angle (X then Y)
144  // edm::LogInfo("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl;
145  // edm::LogInfo("EcalGeom") << "moveto: rearCentre " << rearCentre << std::endl;
146  // edm::LogInfo("EcalGeom") << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl;
147  // edm::LogInfo("EcalGeom") << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi << std::endl;
148  rotateX(targetTheta - currentTheta);
149  rotateY(targetPhi - currentPhi);
150 
151  // Translate SC to final position
152  DDTranslation targetCentre = 0.5 * (frontCentre + rearCentre);
153  // edm::LogInfo("EcalGeom") << "moveto: translation " << targetCentre-centrePos() << std::endl;
154  translate(targetCentre - centrePos());
155 }

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

Referenced by algorithm(), DDEcalEndcapAlgo::EEPositionCRs(), and DDEcalEndcapAlgo::execute().

◆ polarAngle() [1/2]

double DDEcalEndcapTrap::polarAngle ( )

Definition at line 265 of file DDEcalEndcapTrap.cc.

265  {
266  //
267  // Return elevation angle (out of x-z plane) of SC in current position.
268  //
269  DDTranslation current = fcentrePos() - rcentrePos();
270  return polarAngle(current);
271 }

References fcentrePos(), and rcentrePos().

Referenced by moveto().

◆ polarAngle() [2/2]

double DDEcalEndcapTrap::polarAngle ( const DDTranslation trans)

Definition at line 257 of file DDEcalEndcapTrap.cc.

257  {
258  //
259  // Return polar angle (from x to z) of a given translation (seen as a vector from the origin).
260  //
261  double tanphi = trans.x() / trans.z();
262  return atan(tanphi);
263 }

◆ print()

void DDEcalEndcapTrap::print ( void  )

Definition at line 273 of file DDEcalEndcapTrap.cc.

273  {
274  //
275  // Print SC coordinates for debugging
276  //
277  edm::LogInfo("EcalGeom") << "Endcap supercrystal" << std::endl;
278  for (int ic = 1; ic <= 8; ic++) {
279  DDTranslation cc = cornerPos(ic);
280  edm::LogInfo("EcalGeom") << "Corner " << ic << " " << cc << std::endl;
281  }
282  edm::LogInfo("EcalGeom") << " Centre " << centrePos() << std::endl;
283  edm::LogInfo("EcalGeom") << " fCentre " << fcentrePos() << std::endl;
284  edm::LogInfo("EcalGeom") << " rCentre " << rcentrePos() << std::endl;
285 }

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

◆ rcentrePos()

DDTranslation DDEcalEndcapTrap::rcentrePos ( )

Definition at line 234 of file DDEcalEndcapTrap.cc.

234  {
235  //
236  // Return SC rear face centre as a DDTranslation
237  //
238  return DDTranslation(m_rcentre[0], m_rcentre[1], m_rcentre[2]);
239 }

References m_rcentre.

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

◆ rotate() [1/2]

void DDEcalEndcapTrap::rotate ( const DDRotationMatrix rot)

Definition at line 94 of file DDEcalEndcapTrap.cc.

94  {
95  //
96  // Rotate supercrystal by specified rotation about (0,0,0)
97  //
98 
99  int icorner;
101  // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate - rotation " << rot << std::endl;
102  for (icorner = 1; icorner <= 8; icorner++) {
103  cc = cornerPos(icorner);
104  // edm::LogInfo("EcalGeom") << " Corner (orig) " << icorner << cc << std::endl;
105  cc = rot * cc;
106  // edm::LogInfo("EcalGeom") << " Corner (rot) " << icorner << cc << std::endl;
107  cornerPos(icorner, cc);
108  }
111 }

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

Referenced by rotateX(), and rotateY().

◆ rotate() [2/2]

void DDEcalEndcapTrap::rotate ( const DDTranslation frontCentre,
const DDTranslation rearCentre 
)

Definition at line 86 of file DDEcalEndcapTrap.cc.

86  {
87  //
88  // Rotate supercrystal to bring front and rear face centres to specified points
89  //
90  edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate(DDTranslation,DDTranslation) - not yet implemented"
91  << std::endl;
92 }

◆ rotateX()

void DDEcalEndcapTrap::rotateX ( const double  angle)

Definition at line 157 of file DDEcalEndcapTrap.cc.

157  {
158  //
159  // Rotate SC through given angle about X axis
160  //
161 
162  const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(1., 0., 0.), angle);
163 
164  rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz()));
165 }

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

Referenced by moveto().

◆ rotateY()

void DDEcalEndcapTrap::rotateY ( const double  angle)

Definition at line 167 of file DDEcalEndcapTrap.cc.

167  {
168  //
169  // Rotate SC through given angle about Y axis
170  //
171  const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(0., 1., 0.), angle);
172 
173  rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz()));
174 }

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

Referenced by moveto().

◆ rotation()

DDRotationMatrix DDEcalEndcapTrap::rotation ( void  )
inline

Definition at line 35 of file DDEcalEndcapTrap.h.

35 { return m_rotation; }

References m_rotation.

Referenced by algorithm(), DDEcalEndcapAlgo::EEPositionCRs(), and DDEcalEndcapAlgo::execute().

◆ translate() [1/2]

void DDEcalEndcapTrap::translate ( )

Definition at line 113 of file DDEcalEndcapTrap.cc.

113  {
114  // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::translate() not yet implemented" << std::endl;
115  translate(-1. * centrePos());
116 }

References centrePos().

Referenced by DDEcalEndcapTrap(), and moveto().

◆ translate() [2/2]

void DDEcalEndcapTrap::translate ( const DDTranslation trans)

Definition at line 118 of file DDEcalEndcapTrap.cc.

118  {
119  //
120  // Translate supercrystal by specified amount
121  //
122 
123  DDTranslation tcorner;
124  for (int icorner = 1; icorner <= 8; icorner++) {
125  tcorner = cornerPos(icorner) + trans;
126  cornerPos(icorner, tcorner);
127  }
129  m_translation = trans + m_translation;
130 }

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

Referenced by algorithm(), and DDEcalEndcapAlgo::execute().

Member Data Documentation

◆ m_centre

double DDEcalEndcapTrap::m_centre[4]
private

Definition at line 42 of file DDEcalEndcapTrap.h.

Referenced by calculateCentres(), and centrePos().

◆ m_corners

double DDEcalEndcapTrap::m_corners[25]
private

Definition at line 45 of file DDEcalEndcapTrap.h.

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

◆ m_fcentre

double DDEcalEndcapTrap::m_fcentre[4]
private

Definition at line 43 of file DDEcalEndcapTrap.h.

Referenced by calculateCentres(), and fcentrePos().

◆ m_front

double DDEcalEndcapTrap::m_front
private

Definition at line 46 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

◆ m_hand

int DDEcalEndcapTrap::m_hand
private

Definition at line 50 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

◆ m_length

double DDEcalEndcapTrap::m_length
private

Definition at line 48 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

◆ m_rcentre

double DDEcalEndcapTrap::m_rcentre[4]
private

Definition at line 44 of file DDEcalEndcapTrap.h.

Referenced by calculateCentres(), and rcentrePos().

◆ m_rear

double DDEcalEndcapTrap::m_rear
private

Definition at line 47 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

◆ m_rotation

DDRotationMatrix DDEcalEndcapTrap::m_rotation
private

Definition at line 39 of file DDEcalEndcapTrap.h.

Referenced by rotate(), and rotation().

◆ m_translation

DDTranslation DDEcalEndcapTrap::m_translation
private

Definition at line 40 of file DDEcalEndcapTrap.h.

Referenced by translate().

◆ m_update

int DDEcalEndcapTrap::m_update
private

Definition at line 51 of file DDEcalEndcapTrap.h.

DDEcalEndcapTrap::m_corners
double m_corners[25]
Definition: DDEcalEndcapTrap.h:45
DDEcalEndcapTrap::m_length
double m_length
Definition: DDEcalEndcapTrap.h:48
DDEcalEndcapTrap::m_fcentre
double m_fcentre[4]
Definition: DDEcalEndcapTrap.h:43
DDEcalEndcapTrap::m_hand
int m_hand
Definition: DDEcalEndcapTrap.h:50
DDEcalEndcapTrap::m_centre
double m_centre[4]
Definition: DDEcalEndcapTrap.h:42
DDEcalEndcapTrap::calculateCentres
void calculateCentres()
Definition: DDEcalEndcapTrap.cc:176
DDEcalEndcapTrap::m_rcentre
double m_rcentre[4]
Definition: DDEcalEndcapTrap.h:44
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
DDEcalEndcapTrap::m_translation
DDTranslation m_translation
Definition: DDEcalEndcapTrap.h:40
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDEcalEndcapTrap::rcentrePos
DDTranslation rcentrePos()
Definition: DDEcalEndcapTrap.cc:234
DDEcalEndcapTrap::rotate
void rotate(const DDRotationMatrix &rot)
Definition: DDEcalEndcapTrap.cc:94
DDEcalEndcapTrap::m_rotation
DDRotationMatrix m_rotation
Definition: DDEcalEndcapTrap.h:39
DDEcalEndcapTrap::fcentrePos
DDTranslation fcentrePos()
Definition: DDEcalEndcapTrap.cc:227
DDEcalEndcapTrap::translate
void translate()
Definition: DDEcalEndcapTrap.cc:113
DDEcalEndcapTrap::elevationAngle
double elevationAngle()
Definition: DDEcalEndcapTrap.cc:249
DDEcalEndcapTrap::m_front
double m_front
Definition: DDEcalEndcapTrap.h:46
DDEcalEndcapTrap::polarAngle
double polarAngle()
Definition: DDEcalEndcapTrap.cc:265
cc
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
DDEcalEndcapTrap::rotateY
void rotateY(const double angle)
Definition: DDEcalEndcapTrap.cc:167
DDEcalEndcapTrap::centrePos
DDTranslation centrePos()
Definition: DDEcalEndcapTrap.cc:220
DDEcalEndcapTrap::rotateX
void rotateX(const double angle)
Definition: DDEcalEndcapTrap.cc:157
DDEcalEndcapTrap::cornerPos
DDTranslation cornerPos(const int icorner)
Definition: DDEcalEndcapTrap.cc:203
DDEcalEndcapTrap::m_rear
double m_rear
Definition: DDEcalEndcapTrap.h:47