CMS 3D CMS Logo

DDEcalEndcapTrap Class Reference

#include <Geometry/EcalCommonData/interface/DDEcalEndcapTrap.h>

List of all members.

Public Member Functions

void calculateCentres ()
void calculateCorners ()
DDTranslation centrePos ()
void cornerPos (const int icorner, const DDTranslation cc)
DDTranslation cornerPos (const int icorner)
 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 DDTranslation frontCentre, const DDTranslation rearCentre)
void rotate (const DDRotationMatrix rot)
void rotateX (const double angle)
void rotateY (const double angle)
DDRotationMatrix rotation ()
void translate ()
void translate (const DDTranslation trans)

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 26 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().

00009 {
00010   //
00011   //  Initialise corners of supercrystal.
00012 
00013   // Start out with bottom surface on (x,z) plane, front face in (x,y) plane.
00014 
00015   double xsign;
00016 
00017   if (hand==2) {
00018    xsign = -1.;
00019   } else {
00020     xsign = 1.;
00021   }
00022 
00023   m_hand = hand;
00024   m_front = front;
00025   m_rear = rear;
00026   m_length = length;
00027 
00028   int icorner;
00029   icorner = 1;
00030   m_corners[3*icorner-3] = xsign*front;
00031   m_corners[3*icorner-2] = front;
00032   m_corners[3*icorner-1] = 0.;
00033   icorner = 2;
00034   m_corners[3*icorner-3] = xsign*front;
00035   m_corners[3*icorner-2] = 0.;
00036   m_corners[3*icorner-1] = 0.;
00037   icorner = 3;
00038   m_corners[3*icorner-3] = 0.;
00039   m_corners[3*icorner-2] = 0.;
00040   m_corners[3*icorner-1] = 0.;
00041   icorner = 4;
00042   m_corners[3*icorner-3] = 0.;
00043   m_corners[3*icorner-2] = front;
00044   m_corners[3*icorner-1] = 0.;
00045 
00046   icorner = 5;
00047   m_corners[3*icorner-3] = xsign*rear;
00048   m_corners[3*icorner-2] = rear;
00049   m_corners[3*icorner-1] = length;
00050   icorner = 6;
00051   m_corners[3*icorner-3] = xsign*rear;
00052   m_corners[3*icorner-2] = 0.;
00053   m_corners[3*icorner-1] = length;
00054   icorner = 7;
00055   m_corners[3*icorner-3] = 0.;
00056   m_corners[3*icorner-2] = 0.;
00057   m_corners[3*icorner-1] = length;
00058   icorner = 8;
00059   m_corners[3*icorner-3] = 0.;
00060   m_corners[3*icorner-2] = rear;
00061   m_corners[3*icorner-1] = length;
00062   
00063   calculateCentres();
00064 
00065   // Move centre of SC to (0,0,0)
00066 
00067   translate();
00068 
00069   // Rotate into standard position (face centres on z axis)
00070 
00071   //  this->rotate();
00072 
00073   calculateCentres();
00074 }

DDEcalEndcapTrap::DDEcalEndcapTrap (  )  [private]


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().

00195 {
00196   //
00197   //  Calculate crystal centre and front & rear face centres
00198   //
00199 
00200   int ixyz, icorner;
00201 
00202   for (ixyz = 0; ixyz <3; ixyz++) 
00203   {
00204     m_centre[ixyz] = 0;
00205     m_fcentre[ixyz] = 0;
00206     m_rcentre[ixyz] = 0;
00207   }
00208 
00209   for (icorner=1; icorner<=4; icorner++) 
00210   {
00211     for (ixyz=0; ixyz<3; ixyz++) {
00212        m_centre[ixyz] = m_centre[ixyz] + 0.125*m_corners[3*icorner-3+ixyz];
00213        m_fcentre[ixyz] = m_fcentre[ixyz] + 0.25*m_corners[3*icorner-3+ixyz];
00214     }
00215   }
00216   for (icorner=5; icorner<=8; icorner++) {
00217     for (ixyz=0; ixyz<3; ixyz++) {
00218        m_centre[ixyz] = m_centre[ixyz] + 0.125*m_corners[3*icorner-3+ixyz];
00219        m_rcentre[ixyz] = m_rcentre[ixyz] +  0.25*m_corners[3*icorner-3+ixyz];
00220     }
00221   }
00222 }

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().

00252 {
00253   //
00254   //  Return SC centre as a DDTranslation
00255   //
00256    return DDTranslation(m_centre[0], m_centre[1], m_centre[2]);
00257 }

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

Definition at line 236 of file DDEcalEndcapTrap.cc.

References m_corners.

00238 {
00239   //
00240   //  Save position of specified corner.
00241   //
00242   for (int ixyz=0; ixyz<3; ixyz++) 
00243   {
00244      m_corners[3*icorner-3+ixyz] = ( 0==ixyz ? cornerxyz.x() :
00245                                      ( 1==ixyz ? cornerxyz.y() :
00246                                        cornerxyz.z() ) ) ;;
00247   }
00248 }

DDTranslation DDEcalEndcapTrap::cornerPos ( const int  icorner  ) 

Definition at line 225 of file DDEcalEndcapTrap.cc.

References m_corners.

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

00226 {
00227   //
00228   //  Return specified corner as a DDTranslation
00229   //
00230   return DDTranslation( m_corners[3*icorner-3],
00231                         m_corners[3*icorner-2],
00232                         m_corners[3*icorner-1]  );
00233 }

double DDEcalEndcapTrap::elevationAngle (  ) 

Definition at line 292 of file DDEcalEndcapTrap.cc.

References fcentrePos(), and rcentrePos().

Referenced by moveto().

00293 {
00294   //
00295   //  Return elevation angle (out of x-z plane) of SC in current position.
00296   //
00297   DDTranslation current = fcentrePos() - rcentrePos();
00298   return elevationAngle(current);
00299 }

double DDEcalEndcapTrap::elevationAngle ( const DDTranslation  trans  ) 

Definition at line 282 of file DDEcalEndcapTrap.cc.

00283 {
00284   //
00285   //  Return elevation angle (out of x-z plane) of a given translation (seen as a vector from the origin).
00286   //
00287   double sintheta = trans.y()/trans.r();
00288   return asin(sintheta);
00289 }

DDTranslation DDEcalEndcapTrap::fcentrePos (  ) 

Definition at line 260 of file DDEcalEndcapTrap.cc.

References m_fcentre.

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

00261 {
00262   //
00263   //  Return SC front face centre as a DDTranslation
00264   //
00265    return DDTranslation( m_fcentre[0], 
00266                          m_fcentre[1], 
00267                          m_fcentre[2]  ) ;
00268 }

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().

00142 {
00143   //
00144   //  Rotate (about X then about Y) and translate supercrystal to bring axis joining front and rear face centres parallel to line connecting specified points
00145   //
00146 
00147   //  Get azimuthal and polar angles of current axis and target axis
00148   double currentTheta = elevationAngle();
00149   double currentPhi   = polarAngle();
00150   double targetTheta  = elevationAngle(frontCentre-rearCentre);
00151   double targetPhi    = polarAngle(frontCentre-rearCentre);
00152 
00153   //  Rotate to correct angle (X then Y)
00154   // edm::LogInfo("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl;
00155   // edm::LogInfo("EcalGeom") << "moveto: rearCentre  " << rearCentre << std::endl;
00156   // edm::LogInfo("EcalGeom") << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl;
00157   // edm::LogInfo("EcalGeom") << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi << std::endl;
00158   rotateX(targetTheta-currentTheta);
00159   rotateY(targetPhi-currentPhi);
00160 
00161   //  Translate SC to final position
00162   DDTranslation targetCentre = 0.5*(frontCentre + rearCentre);
00163   // edm::LogInfo("EcalGeom") << "moveto: translation " << targetCentre-centrePos() << std::endl;
00164   translate(targetCentre-centrePos());
00165 }

double DDEcalEndcapTrap::polarAngle (  ) 

Definition at line 312 of file DDEcalEndcapTrap.cc.

References fcentrePos(), and rcentrePos().

Referenced by moveto().

00313 {
00314   //
00315   //  Return elevation angle (out of x-z plane) of SC in current position.
00316   //
00317   DDTranslation current = fcentrePos() - rcentrePos();
00318   return polarAngle(current);
00319 }

double DDEcalEndcapTrap::polarAngle ( const DDTranslation  trans  ) 

Definition at line 302 of file DDEcalEndcapTrap.cc.

00303 {
00304   //
00305   //  Return polar angle (from x to z) of a given translation (seen as a vector from the origin).
00306   //
00307   double tanphi = trans.x()/trans.z();
00308   return atan(tanphi);
00309 }

void DDEcalEndcapTrap::print ( void   ) 

Definition at line 322 of file DDEcalEndcapTrap.cc.

References centrePos(), cornerPos(), lat::endl(), fcentrePos(), and rcentrePos().

00323 {
00324   //
00325   //  Print SC coordinates for debugging
00326   //
00327   edm::LogInfo("EcalGeom") << "Endcap supercrystal" << std::endl;
00328    for (int ic=1; ic<=8; ic++) 
00329    {
00330       DDTranslation cc = cornerPos(ic);
00331       edm::LogInfo("EcalGeom") << "Corner " << ic << " " << cc << std::endl;
00332    }
00333    edm::LogInfo("EcalGeom") << "    Centre " << centrePos() << std::endl;
00334    edm::LogInfo("EcalGeom") << "   fCentre " << fcentrePos() << std::endl;
00335    edm::LogInfo("EcalGeom") << "   rCentre " << rcentrePos() << std::endl;
00336 }

DDTranslation DDEcalEndcapTrap::rcentrePos (  ) 

Definition at line 271 of file DDEcalEndcapTrap.cc.

References m_rcentre.

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

00272 {
00273   //
00274   //  Return SC rear face centre as a DDTranslation
00275   //
00276   return DDTranslation( m_rcentre[0], 
00277                         m_rcentre[1], 
00278                         m_rcentre[2]  );
00279 }

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

Definition at line 85 of file DDEcalEndcapTrap.cc.

References lat::endl().

00087 {
00088   //
00089   //  Rotate supercrystal to bring front and rear face centres to specified points
00090   //
00091   edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate(DDTranslation,DDTranslation) - not yet implemented" << std::endl;
00092 }

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().

00096 {
00097   //
00098   //  Rotate supercrystal by specified rotation about (0,0,0)
00099   //
00100 
00101   int icorner;
00102   DDTranslation cc;
00103   //  edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate - rotation " << rot << std::endl;
00104   for (icorner=1; icorner<=8; icorner++) {
00105      cc = cornerPos(icorner);
00106      //     edm::LogInfo("EcalGeom") << "   Corner (orig) " << icorner << cc << std::endl;
00107      cc = rot*cc;
00108      //     edm::LogInfo("EcalGeom") << "   Corner (rot)  " << icorner << cc << std::endl;
00109      cornerPos(icorner,cc);
00110   }
00111   m_rotation = rot*m_rotation;
00112   calculateCentres();
00113 }

void DDEcalEndcapTrap::rotateX ( const double  angle  ) 

Definition at line 168 of file DDEcalEndcapTrap.cc.

References rotate(), and tmp.

Referenced by moveto().

00169 {
00170   //
00171   //  Rotate SC through given angle about X axis
00172   //
00173 
00174    const HepRotation tmp ( Hep3Vector(1.,0.,0.), angle ) ;
00175 
00176    rotate( DDRotationMatrix( tmp.xx(), tmp.xy(), tmp.xz(),
00177                              tmp.yx(), tmp.yy(), tmp.yz(),
00178                              tmp.zx(), tmp.zy(), tmp.zz()  ) );
00179 }

void DDEcalEndcapTrap::rotateY ( const double  angle  ) 

Definition at line 182 of file DDEcalEndcapTrap.cc.

References rotate(), and tmp.

Referenced by moveto().

00183 {
00184    //
00185    //  Rotate SC through given angle about Y axis
00186    //
00187    const HepRotation tmp ( Hep3Vector(0.,1.,0.), angle ) ;
00188 
00189    rotate( DDRotationMatrix( tmp.xx(), tmp.xy(), tmp.xz(),
00190                              tmp.yx(), tmp.yy(), tmp.yz(),
00191                              tmp.zx(), tmp.zy(), tmp.zz()  ) );
00192 }

DDRotationMatrix DDEcalEndcapTrap::rotation ( void   )  [inline]

Definition at line 60 of file DDEcalEndcapTrap.h.

References m_rotation.

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

00060 {return m_rotation;}

void DDEcalEndcapTrap::translate (  ) 

Definition at line 116 of file DDEcalEndcapTrap.cc.

References centrePos().

Referenced by DDEcalEndcapTrap(), and moveto().

00117 {
00118   //  edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::translate() not yet implemented" << std::endl;
00119    translate(-1.*centrePos());
00120 }

void DDEcalEndcapTrap::translate ( const DDTranslation  trans  ) 

Definition at line 123 of file DDEcalEndcapTrap.cc.

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

Referenced by DDEcalEndcapAlgo::execute().

00124 {
00125   //
00126   //  Translate supercrystal by specified amount
00127   //
00128 
00129   DDTranslation tcorner;
00130   for (int icorner=1; icorner<=8; icorner++) 
00131   {
00132     tcorner = cornerPos(icorner) + trans;
00133     cornerPos(icorner,tcorner);
00134   }
00135   calculateCentres();
00136   m_translation = trans + m_translation;
00137 }


Member Data Documentation

double DDEcalEndcapTrap::m_centre[4] [private]

Definition at line 74 of file DDEcalEndcapTrap.h.

Referenced by calculateCentres(), and centrePos().

double DDEcalEndcapTrap::m_corners[25] [private]

Definition at line 77 of file DDEcalEndcapTrap.h.

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

double DDEcalEndcapTrap::m_fcentre[4] [private]

Definition at line 75 of file DDEcalEndcapTrap.h.

Referenced by calculateCentres(), and fcentrePos().

double DDEcalEndcapTrap::m_front [private]

Definition at line 67 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

int DDEcalEndcapTrap::m_hand [private]

Definition at line 70 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

double DDEcalEndcapTrap::m_length [private]

Definition at line 69 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

double DDEcalEndcapTrap::m_rcentre[4] [private]

Definition at line 76 of file DDEcalEndcapTrap.h.

Referenced by calculateCentres(), and rcentrePos().

double DDEcalEndcapTrap::m_rear [private]

Definition at line 68 of file DDEcalEndcapTrap.h.

Referenced by DDEcalEndcapTrap().

DDRotationMatrix DDEcalEndcapTrap::m_rotation [private]

Definition at line 71 of file DDEcalEndcapTrap.h.

Referenced by rotate(), and rotation().

DDTranslation DDEcalEndcapTrap::m_translation [private]

Definition at line 72 of file DDEcalEndcapTrap.h.

Referenced by translate().

int DDEcalEndcapTrap::m_update [private]

Definition at line 79 of file DDEcalEndcapTrap.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:54 2009 for CMSSW by  doxygen 1.5.4