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 14 of file DDEcalEndcapTrap.cc.

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

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 191 of file DDEcalEndcapTrap.cc.

191  {
192  //
193  // Calculate crystal centre and front & rear face centres
194  //
195 
196  int ixyz, icorner;
197 
198  for (ixyz = 0; ixyz < 3; ixyz++) {
199  m_centre[ixyz] = 0;
200  m_fcentre[ixyz] = 0;
201  m_rcentre[ixyz] = 0;
202  }
203 
204  for (icorner = 1; icorner <= 4; icorner++) {
205  for (ixyz = 0; ixyz < 3; ixyz++) {
206  m_centre[ixyz] = m_centre[ixyz] + 0.125 * m_corners[3 * icorner - 3 + ixyz];
207  m_fcentre[ixyz] = m_fcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz];
208  }
209  }
210  for (icorner = 5; icorner <= 8; icorner++) {
211  for (ixyz = 0; ixyz < 3; ixyz++) {
212  m_centre[ixyz] = m_centre[ixyz] + 0.125 * m_corners[3 * icorner - 3 + ixyz];
213  m_rcentre[ixyz] = m_rcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz];
214  }
215  }
216 }

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 235 of file DDEcalEndcapTrap.cc.

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

References m_centre.

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

◆ cornerPos() [1/2]

DDTranslation DDEcalEndcapTrap::cornerPos ( const int  icorner)

Definition at line 218 of file DDEcalEndcapTrap.cc.

218  {
219  //
220  // Return specified corner as a DDTranslation
221  //
222  return DDTranslation(m_corners[3 * icorner - 3], m_corners[3 * icorner - 2], m_corners[3 * icorner - 1]);
223 }

References m_corners.

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

◆ cornerPos() [2/2]

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

Definition at line 225 of file DDEcalEndcapTrap.cc.

225  {
226  //
227  // Save position of specified corner.
228  //
229  for (int ixyz = 0; ixyz < 3; ixyz++) {
230  m_corners[3 * icorner - 3 + ixyz] = (0 == ixyz ? cornerxyz.x() : (1 == ixyz ? cornerxyz.y() : cornerxyz.z()));
231  ;
232  }
233 }

References m_corners.

◆ elevationAngle() [1/2]

double DDEcalEndcapTrap::elevationAngle ( )

Definition at line 264 of file DDEcalEndcapTrap.cc.

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

References fcentrePos(), and rcentrePos().

Referenced by moveto().

◆ elevationAngle() [2/2]

double DDEcalEndcapTrap::elevationAngle ( const DDTranslation trans)

Definition at line 256 of file DDEcalEndcapTrap.cc.

256  {
257  //
258  // Return elevation angle (out of x-z plane) of a given translation (seen as a vector from the origin).
259  //
260  double sintheta = trans.y() / trans.r();
261  return asin(sintheta);
262 }

◆ fcentrePos()

DDTranslation DDEcalEndcapTrap::fcentrePos ( )

Definition at line 242 of file DDEcalEndcapTrap.cc.

242  {
243  //
244  // Return SC front face centre as a DDTranslation
245  //
246  return DDTranslation(m_fcentre[0], m_fcentre[1], m_fcentre[2]);
247 }

References m_fcentre.

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

◆ moveto()

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

Definition at line 141 of file DDEcalEndcapTrap.cc.

141  {
142  //
143  // Rotate (about X then about Y) and translate supercrystal to bring axis joining front and rear face centres parallel to line connecting specified points
144  //
145 
146  // Get azimuthal and polar angles of current axis and target axis
147  double currentTheta = elevationAngle();
148  double currentPhi = polarAngle();
149  double targetTheta = elevationAngle(frontCentre - rearCentre);
150  double targetPhi = polarAngle(frontCentre - rearCentre);
151 
152  // Rotate to correct angle (X then Y)
153 #ifdef EDM_ML_DEBUG
154  edm::LogVerbatim("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl
155  << "moveto: rearCentre " << rearCentre << std::endl
156  << "moveto: X rotation: " << targetTheta << " " << currentTheta << " "
157  << targetTheta - currentTheta << std::endl
158  << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " "
159  << " " << targetPhi - currentPhi;
160 #endif
161  rotateX(targetTheta - currentTheta);
162  rotateY(targetPhi - currentPhi);
163 
164  // Translate SC to final position
165  DDTranslation targetCentre = 0.5 * (frontCentre + rearCentre);
166 #ifdef EDM_ML_DEBUG
167  edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre - centrePos();
168 #endif
169  translate(targetCentre - centrePos());
170 }

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

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

◆ polarAngle() [1/2]

double DDEcalEndcapTrap::polarAngle ( )

Definition at line 280 of file DDEcalEndcapTrap.cc.

280  {
281  //
282  // Return elevation angle (out of x-z plane) of SC in current position.
283  //
284  DDTranslation current = fcentrePos() - rcentrePos();
285  return polarAngle(current);
286 }

References fcentrePos(), and rcentrePos().

Referenced by moveto().

◆ polarAngle() [2/2]

double DDEcalEndcapTrap::polarAngle ( const DDTranslation trans)

Definition at line 272 of file DDEcalEndcapTrap.cc.

272  {
273  //
274  // Return polar angle (from x to z) of a given translation (seen as a vector from the origin).
275  //
276  double tanphi = trans.x() / trans.z();
277  return atan(tanphi);
278 }

◆ print()

void DDEcalEndcapTrap::print ( void  )

Definition at line 288 of file DDEcalEndcapTrap.cc.

288  {
289  //
290  // Print SC coordinates for debugging
291  //
292  edm::LogVerbatim("EcalGeom") << "Endcap supercrystal";
293  for (int ic = 1; ic <= 8; ic++) {
294  DDTranslation cc = cornerPos(ic);
295  edm::LogVerbatim("EcalGeom") << "Corner " << ic << " " << cc;
296  }
297  edm::LogVerbatim("EcalGeom") << " Centre " << centrePos() << std::endl
298  << " fCentre " << fcentrePos() << std::endl
299  << " rCentre " << rcentrePos();
300 }

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

◆ rcentrePos()

DDTranslation DDEcalEndcapTrap::rcentrePos ( )

Definition at line 249 of file DDEcalEndcapTrap.cc.

249  {
250  //
251  // Return SC rear face centre as a DDTranslation
252  //
253  return DDTranslation(m_rcentre[0], m_rcentre[1], m_rcentre[2]);
254 }

References m_rcentre.

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

◆ rotate() [1/2]

void DDEcalEndcapTrap::rotate ( const DDRotationMatrix rot)

Definition at line 95 of file DDEcalEndcapTrap.cc.

95  {
96  //
97  // Rotate supercrystal by specified rotation about (0,0,0)
98  //
99 
100  int icorner;
102 #ifdef EDM_ML_DEBUG
103  edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrap::rotate - rotation " << rot;
104 #endif
105  for (icorner = 1; icorner <= 8; icorner++) {
106  cc = cornerPos(icorner);
107 #ifdef EDM_ML_DEBUG
108  edm::LogVerbatim("EcalGeom") << " Corner (orig) " << icorner << cc;
109 #endif
110  cc = rot * cc;
111 #ifdef EDM_ML_DEBUG
112  edm::LogVerbatim("EcalGeom") << " Corner (rot) " << icorner << cc;
113 #endif
114  cornerPos(icorner, cc);
115  }
118 }

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 88 of file DDEcalEndcapTrap.cc.

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

◆ rotateX()

void DDEcalEndcapTrap::rotateX ( const double  angle)

Definition at line 172 of file DDEcalEndcapTrap.cc.

172  {
173  //
174  // Rotate SC through given angle about X axis
175  //
176 
177  const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(1., 0., 0.), angle);
178 
179  rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz()));
180 }

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

Referenced by moveto().

◆ rotateY()

void DDEcalEndcapTrap::rotateY ( const double  angle)

Definition at line 182 of file DDEcalEndcapTrap.cc.

182  {
183  //
184  // Rotate SC through given angle about Y axis
185  //
186  const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(0., 1., 0.), angle);
187 
188  rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz()));
189 }

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 DDEcalEndcapAlgo::EEPositionCRs(), and DDEcalEndcapAlgo::execute().

◆ translate() [1/2]

void DDEcalEndcapTrap::translate ( )

Definition at line 120 of file DDEcalEndcapTrap.cc.

120  {
121 #ifdef EDM_ML_DEBUG
122  edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrap::translate() not yet implemented";
123 #endif
124  translate(-1. * centrePos());
125 }

References centrePos().

Referenced by DDEcalEndcapTrap(), and moveto().

◆ translate() [2/2]

void DDEcalEndcapTrap::translate ( const DDTranslation trans)

Definition at line 127 of file DDEcalEndcapTrap.cc.

127  {
128  //
129  // Translate supercrystal by specified amount
130  //
131 
132  DDTranslation tcorner;
133  for (int icorner = 1; icorner <= 8; icorner++) {
134  tcorner = cornerPos(icorner) + trans;
135  cornerPos(icorner, tcorner);
136  }
138  m_translation = trans + m_translation;
139 }

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

Referenced by 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:191
DDEcalEndcapTrap::m_rcentre
double m_rcentre[4]
Definition: DDEcalEndcapTrap.h:44
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:249
DDEcalEndcapTrap::rotate
void rotate(const DDRotationMatrix &rot)
Definition: DDEcalEndcapTrap.cc:95
DDEcalEndcapTrap::m_rotation
DDRotationMatrix m_rotation
Definition: DDEcalEndcapTrap.h:39
DDEcalEndcapTrap::fcentrePos
DDTranslation fcentrePos()
Definition: DDEcalEndcapTrap.cc:242
DDEcalEndcapTrap::translate
void translate()
Definition: DDEcalEndcapTrap.cc:120
DDEcalEndcapTrap::elevationAngle
double elevationAngle()
Definition: DDEcalEndcapTrap.cc:264
DDEcalEndcapTrap::m_front
double m_front
Definition: DDEcalEndcapTrap.h:46
DDEcalEndcapTrap::polarAngle
double polarAngle()
Definition: DDEcalEndcapTrap.cc:280
cc
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
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:182
DDEcalEndcapTrap::centrePos
DDTranslation centrePos()
Definition: DDEcalEndcapTrap.cc:235
DDEcalEndcapTrap::rotateX
void rotateX(const double angle)
Definition: DDEcalEndcapTrap.cc:172
DDEcalEndcapTrap::cornerPos
DDTranslation cornerPos(const int icorner)
Definition: DDEcalEndcapTrap.cc:218
DDEcalEndcapTrap::m_rear
double m_rear
Definition: DDEcalEndcapTrap.h:47