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 (const int hand, const double front, const double rear, const double length)
 
 DDEcalEndcapTrap ()=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 rotate (const DDTranslation &frontCentre, const DDTranslation &rearCentre)
 
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 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.

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

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 }
double m_corners[25]

◆ DDEcalEndcapTrap() [2/2]

DDEcalEndcapTrap::DDEcalEndcapTrap ( )
delete

Member Function Documentation

◆ calculateCentres()

void DDEcalEndcapTrap::calculateCentres ( )

Definition at line 191 of file DDEcalEndcapTrap.cc.

References m_centre, m_corners, m_fcentre, and m_rcentre.

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

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 }
double m_corners[25]

◆ calculateCorners()

void DDEcalEndcapTrap::calculateCorners ( )

◆ centrePos()

DDTranslation DDEcalEndcapTrap::centrePos ( )

Definition at line 235 of file DDEcalEndcapTrap.cc.

References m_centre.

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

235  {
236  //
237  // Return SC centre as a DDTranslation
238  //
239  return DDTranslation(m_centre[0], m_centre[1], m_centre[2]);
240 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ cornerPos() [1/2]

DDTranslation DDEcalEndcapTrap::cornerPos ( const int  icorner)

Definition at line 218 of file DDEcalEndcapTrap.cc.

References m_corners.

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

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 }
double m_corners[25]
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ cornerPos() [2/2]

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

Definition at line 225 of file DDEcalEndcapTrap.cc.

References m_corners.

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 }
double m_corners[25]

◆ elevationAngle() [1/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 }

◆ elevationAngle() [2/2]

double DDEcalEndcapTrap::elevationAngle ( )

Definition at line 264 of file DDEcalEndcapTrap.cc.

References fcentrePos(), and rcentrePos().

Referenced by moveto().

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 }
DDTranslation rcentrePos()
DDTranslation fcentrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ fcentrePos()

DDTranslation DDEcalEndcapTrap::fcentrePos ( )

Definition at line 242 of file DDEcalEndcapTrap.cc.

References m_fcentre.

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

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 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ moveto()

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

Definition at line 141 of file DDEcalEndcapTrap.cc.

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

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

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 }
Log< level::Info, true > LogVerbatim
void rotateY(const double angle)
DDTranslation centrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void rotateX(const double angle)

◆ polarAngle() [1/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 }

◆ polarAngle() [2/2]

double DDEcalEndcapTrap::polarAngle ( )

Definition at line 280 of file DDEcalEndcapTrap.cc.

References fcentrePos(), and rcentrePos().

Referenced by moveto().

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 }
DDTranslation rcentrePos()
DDTranslation fcentrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ print()

void DDEcalEndcapTrap::print ( void  )

Definition at line 288 of file DDEcalEndcapTrap.cc.

References gpuPixelDoublets::cc, centrePos(), cornerPos(), fcentrePos(), and rcentrePos().

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 }
Log< level::Info, true > LogVerbatim
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
DDTranslation cornerPos(const int icorner)
DDTranslation rcentrePos()
DDTranslation fcentrePos()
DDTranslation centrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ rcentrePos()

DDTranslation DDEcalEndcapTrap::rcentrePos ( )

Definition at line 249 of file DDEcalEndcapTrap.cc.

References m_rcentre.

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

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 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ rotate() [1/2]

void DDEcalEndcapTrap::rotate ( const DDRotationMatrix rot)

Definition at line 95 of file DDEcalEndcapTrap.cc.

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

Referenced by rotateX(), and rotateY().

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 }
Log< level::Info, true > LogVerbatim
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
DDRotationMatrix m_rotation
DDTranslation cornerPos(const int icorner)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ 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::LogWarning("EcalGeom") << "DDEcalEndcapTrap::rotate(DDTranslation,DDTranslation) - not yet implemented";
93 }
Log< level::Warning, false > LogWarning

◆ rotateX()

void DDEcalEndcapTrap::rotateX ( const double  angle)

Definition at line 172 of file DDEcalEndcapTrap.cc.

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

Referenced by moveto().

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 }
void rotate(const DDRotationMatrix &rot)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
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 DDEcalEndcapTrap::rotateY ( const double  angle)

Definition at line 182 of file DDEcalEndcapTrap.cc.

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

Referenced by moveto().

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 }
void rotate(const DDRotationMatrix &rot)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
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 DDEcalEndcapTrap::rotation ( void  )
inline

Definition at line 35 of file DDEcalEndcapTrap.h.

References m_rotation.

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

35 { return m_rotation; }
DDRotationMatrix m_rotation

◆ translate() [1/2]

void DDEcalEndcapTrap::translate ( const DDTranslation trans)

Definition at line 127 of file DDEcalEndcapTrap.cc.

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

Referenced by DDEcalEndcapAlgo::execute().

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 }
DDTranslation cornerPos(const int icorner)
DDTranslation m_translation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ translate() [2/2]

void DDEcalEndcapTrap::translate ( )

Definition at line 120 of file DDEcalEndcapTrap.cc.

References centrePos().

Referenced by DDEcalEndcapTrap(), and moveto().

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

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.