CMS 3D CMS Logo

List of all members | Public Member Functions | Private 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)
 
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 Member Functions

 DDEcalEndcapTrap ()
 

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 25 of file DDEcalEndcapTrap.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file DDEcalEndcapTrap.cc.

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

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

Referenced by rotation().

Member Function Documentation

void DDEcalEndcapTrap::calculateCentres ( )

Definition at line 194 of file DDEcalEndcapTrap.cc.

References m_centre, m_corners, m_fcentre, and m_rcentre.

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

195 {
196  //
197  // Calculate crystal centre and front & rear face centres
198  //
199 
200  int ixyz, icorner;
201 
202  for (ixyz = 0; ixyz <3; ixyz++)
203  {
204  m_centre[ixyz] = 0;
205  m_fcentre[ixyz] = 0;
206  m_rcentre[ixyz] = 0;
207  }
208 
209  for (icorner=1; icorner<=4; icorner++)
210  {
211  for (ixyz=0; ixyz<3; ixyz++) {
212  m_centre[ixyz] = m_centre[ixyz] + 0.125*m_corners[3*icorner-3+ixyz];
213  m_fcentre[ixyz] = m_fcentre[ixyz] + 0.25*m_corners[3*icorner-3+ixyz];
214  }
215  }
216  for (icorner=5; icorner<=8; icorner++) {
217  for (ixyz=0; ixyz<3; ixyz++) {
218  m_centre[ixyz] = m_centre[ixyz] + 0.125*m_corners[3*icorner-3+ixyz];
219  m_rcentre[ixyz] = m_rcentre[ixyz] + 0.25*m_corners[3*icorner-3+ixyz];
220  }
221  }
222 }
double m_corners[25]
void DDEcalEndcapTrap::calculateCorners ( )
DDTranslation DDEcalEndcapTrap::centrePos ( )

Definition at line 251 of file DDEcalEndcapTrap.cc.

References m_centre.

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

252 {
253  //
254  // Return SC centre as a DDTranslation
255  //
256  return DDTranslation(m_centre[0], m_centre[1], m_centre[2]);
257 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDTranslation DDEcalEndcapTrap::cornerPos ( const int  icorner)

Definition at line 225 of file DDEcalEndcapTrap.cc.

References m_corners.

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

226 {
227  //
228  // Return specified corner as a DDTranslation
229  //
230  return DDTranslation( m_corners[3*icorner-3],
231  m_corners[3*icorner-2],
232  m_corners[3*icorner-1] );
233 }
double m_corners[25]
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void DDEcalEndcapTrap::cornerPos ( const int  icorner,
const DDTranslation cc 
)

Definition at line 236 of file DDEcalEndcapTrap.cc.

References m_corners.

238 {
239  //
240  // Save position of specified corner.
241  //
242  for (int ixyz=0; ixyz<3; ixyz++)
243  {
244  m_corners[3*icorner-3+ixyz] = ( 0==ixyz ? cornerxyz.x() :
245  ( 1==ixyz ? cornerxyz.y() :
246  cornerxyz.z() ) ) ;;
247  }
248 }
double m_corners[25]
double DDEcalEndcapTrap::elevationAngle ( const DDTranslation trans)

Definition at line 282 of file DDEcalEndcapTrap.cc.

283 {
284  //
285  // Return elevation angle (out of x-z plane) of a given translation (seen as a vector from the origin).
286  //
287  double sintheta = trans.y()/trans.r();
288  return asin(sintheta);
289 }
double DDEcalEndcapTrap::elevationAngle ( )

Definition at line 292 of file DDEcalEndcapTrap.cc.

References fcentrePos(), and rcentrePos().

Referenced by moveto().

293 {
294  //
295  // Return elevation angle (out of x-z plane) of SC in current position.
296  //
297  DDTranslation current = fcentrePos() - rcentrePos();
298  return elevationAngle(current);
299 }
DDTranslation rcentrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDTranslation fcentrePos()
DDTranslation DDEcalEndcapTrap::fcentrePos ( )

Definition at line 260 of file DDEcalEndcapTrap.cc.

References m_fcentre.

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

261 {
262  //
263  // Return SC front face centre as a DDTranslation
264  //
265  return DDTranslation( m_fcentre[0],
266  m_fcentre[1],
267  m_fcentre[2] ) ;
268 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void DDEcalEndcapTrap::moveto ( const DDTranslation frontCentre,
const DDTranslation rearCentre 
)

Definition at line 140 of file DDEcalEndcapTrap.cc.

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

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

142 {
143  //
144  // Rotate (about X then about Y) and translate supercrystal to bring axis joining front and rear face centres parallel to line connecting specified points
145  //
146 
147  // Get azimuthal and polar angles of current axis and target axis
148  double currentTheta = elevationAngle();
149  double currentPhi = polarAngle();
150  double targetTheta = elevationAngle(frontCentre-rearCentre);
151  double targetPhi = polarAngle(frontCentre-rearCentre);
152 
153  // Rotate to correct angle (X then Y)
154  // edm::LogInfo("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl;
155  // edm::LogInfo("EcalGeom") << "moveto: rearCentre " << rearCentre << std::endl;
156  // edm::LogInfo("EcalGeom") << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl;
157  // edm::LogInfo("EcalGeom") << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi << std::endl;
158  rotateX(targetTheta-currentTheta);
159  rotateY(targetPhi-currentPhi);
160 
161  // Translate SC to final position
162  DDTranslation targetCentre = 0.5*(frontCentre + rearCentre);
163  // edm::LogInfo("EcalGeom") << "moveto: translation " << targetCentre-centrePos() << std::endl;
164  translate(targetCentre-centrePos());
165 }
void rotateY(const double angle)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDTranslation centrePos()
void rotateX(const double angle)
double DDEcalEndcapTrap::polarAngle ( const DDTranslation trans)

Definition at line 302 of file DDEcalEndcapTrap.cc.

303 {
304  //
305  // Return polar angle (from x to z) of a given translation (seen as a vector from the origin).
306  //
307  double tanphi = trans.x()/trans.z();
308  return atan(tanphi);
309 }
double DDEcalEndcapTrap::polarAngle ( )

Definition at line 312 of file DDEcalEndcapTrap.cc.

References fcentrePos(), and rcentrePos().

Referenced by moveto().

313 {
314  //
315  // Return elevation angle (out of x-z plane) of SC in current position.
316  //
317  DDTranslation current = fcentrePos() - rcentrePos();
318  return polarAngle(current);
319 }
DDTranslation rcentrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDTranslation fcentrePos()
void DDEcalEndcapTrap::print ( void  )

Definition at line 322 of file DDEcalEndcapTrap.cc.

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

Referenced by rotation().

323 {
324  //
325  // Print SC coordinates for debugging
326  //
327  edm::LogInfo("EcalGeom") << "Endcap supercrystal" << std::endl;
328  for (int ic=1; ic<=8; ic++)
329  {
330  DDTranslation cc = cornerPos(ic);
331  edm::LogInfo("EcalGeom") << "Corner " << ic << " " << cc << std::endl;
332  }
333  edm::LogInfo("EcalGeom") << " Centre " << centrePos() << std::endl;
334  edm::LogInfo("EcalGeom") << " fCentre " << fcentrePos() << std::endl;
335  edm::LogInfo("EcalGeom") << " rCentre " << rcentrePos() << std::endl;
336 }
DDTranslation cornerPos(const int icorner)
DDTranslation rcentrePos()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDTranslation fcentrePos()
DDTranslation centrePos()
DDTranslation DDEcalEndcapTrap::rcentrePos ( )

Definition at line 271 of file DDEcalEndcapTrap.cc.

References m_rcentre.

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

272 {
273  //
274  // Return SC rear face centre as a DDTranslation
275  //
276  return DDTranslation( m_rcentre[0],
277  m_rcentre[1],
278  m_rcentre[2] );
279 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void DDEcalEndcapTrap::rotate ( const DDRotationMatrix rot)

Definition at line 95 of file DDEcalEndcapTrap.cc.

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

Referenced by rotateX(), and rotateY().

96 {
97  //
98  // Rotate supercrystal by specified rotation about (0,0,0)
99  //
100 
101  int icorner;
102  DDTranslation cc;
103  // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate - rotation " << rot << std::endl;
104  for (icorner=1; icorner<=8; icorner++) {
105  cc = cornerPos(icorner);
106  // edm::LogInfo("EcalGeom") << " Corner (orig) " << icorner << cc << std::endl;
107  cc = rot*cc;
108  // edm::LogInfo("EcalGeom") << " Corner (rot) " << icorner << cc << std::endl;
109  cornerPos(icorner,cc);
110  }
113 }
DDRotationMatrix m_rotation
DDTranslation cornerPos(const int icorner)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void DDEcalEndcapTrap::rotate ( const DDTranslation frontCentre,
const DDTranslation rearCentre 
)

Definition at line 85 of file DDEcalEndcapTrap.cc.

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

Definition at line 168 of file DDEcalEndcapTrap.cc.

References rotate(), and tmp.

Referenced by moveto().

169 {
170  //
171  // Rotate SC through given angle about X axis
172  //
173 
174  const CLHEP::HepRotation tmp ( CLHEP::Hep3Vector(1.,0.,0.), angle ) ;
175 
176  rotate( DDRotationMatrix( tmp.xx(), tmp.xy(), tmp.xz(),
177  tmp.yx(), tmp.yy(), tmp.yz(),
178  tmp.zx(), tmp.zy(), tmp.zz() ) );
179 }
void rotate(const DDRotationMatrix &rot)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void DDEcalEndcapTrap::rotateY ( const double  angle)

Definition at line 182 of file DDEcalEndcapTrap.cc.

References rotate(), and tmp.

Referenced by moveto().

183 {
184  //
185  // Rotate SC through given angle about Y axis
186  //
187  const CLHEP::HepRotation tmp ( CLHEP::Hep3Vector(0.,1.,0.), angle ) ;
188 
189  rotate( DDRotationMatrix( tmp.xx(), tmp.xy(), tmp.xz(),
190  tmp.yx(), tmp.yy(), tmp.yz(),
191  tmp.zx(), tmp.zy(), tmp.zz() ) );
192 }
void rotate(const DDRotationMatrix &rot)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
DDRotationMatrix DDEcalEndcapTrap::rotation ( void  )
inline

Definition at line 59 of file DDEcalEndcapTrap.h.

References DDEcalEndcapTrap(), m_rotation, and print().

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

59 {return m_rotation;}
DDRotationMatrix m_rotation
void DDEcalEndcapTrap::translate ( const DDTranslation trans)

Definition at line 123 of file DDEcalEndcapTrap.cc.

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

Referenced by DDEcalEndcapAlgo::execute().

124 {
125  //
126  // Translate supercrystal by specified amount
127  //
128 
129  DDTranslation tcorner;
130  for (int icorner=1; icorner<=8; icorner++)
131  {
132  tcorner = cornerPos(icorner) + trans;
133  cornerPos(icorner,tcorner);
134  }
136  m_translation = trans + m_translation;
137 }
DDTranslation cornerPos(const int icorner)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDTranslation m_translation
void DDEcalEndcapTrap::translate ( )

Definition at line 116 of file DDEcalEndcapTrap.cc.

References centrePos().

Referenced by DDEcalEndcapTrap(), and moveto().

117 {
118  // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::translate() not yet implemented" << std::endl;
119  translate(-1.*centrePos());
120 }
DDTranslation centrePos()

Member Data Documentation

double DDEcalEndcapTrap::m_centre[4]
private

Definition at line 73 of file DDEcalEndcapTrap.h.

Referenced by calculateCentres(), and centrePos().

double DDEcalEndcapTrap::m_corners[25]
private

Definition at line 76 of file DDEcalEndcapTrap.h.

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

double DDEcalEndcapTrap::m_fcentre[4]
private

Definition at line 74 of file DDEcalEndcapTrap.h.

Referenced by calculateCentres(), and fcentrePos().

double DDEcalEndcapTrap::m_front
private

Definition at line 66 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

int DDEcalEndcapTrap::m_hand
private

Definition at line 69 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

double DDEcalEndcapTrap::m_length
private

Definition at line 68 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

double DDEcalEndcapTrap::m_rcentre[4]
private

Definition at line 75 of file DDEcalEndcapTrap.h.

Referenced by calculateCentres(), and rcentrePos().

double DDEcalEndcapTrap::m_rear
private

Definition at line 67 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

DDRotationMatrix DDEcalEndcapTrap::m_rotation
private

Definition at line 70 of file DDEcalEndcapTrap.h.

Referenced by rotate(), and rotation().

DDTranslation DDEcalEndcapTrap::m_translation
private

Definition at line 71 of file DDEcalEndcapTrap.h.

Referenced by translate().

int DDEcalEndcapTrap::m_update
private

Definition at line 78 of file DDEcalEndcapTrap.h.