#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 |
Definition at line 25 of file DDEcalEndcapTrap.h.
DDEcalEndcapTrap::DDEcalEndcapTrap | ( | const int | hand, |
const double | front, | ||
const double | rear, | ||
const double | length | ||
) |
Definition at line 5 of file DDEcalEndcapTrap.cc.
References calculateCentres(), prof2calltree::front, m_corners, m_front, m_hand, m_length, m_rear, and translate().
{ // // Initialise corners of supercrystal. // Start out with bottom surface on (x,z) plane, front face in (x,y) plane. double xsign; if (hand==2) { xsign = -1.; } else { xsign = 1.; } m_hand = hand; m_front = front; m_rear = rear; m_length = length; int icorner; icorner = 1; m_corners[3*icorner-3] = xsign*front; m_corners[3*icorner-2] = front; m_corners[3*icorner-1] = 0.; icorner = 2; m_corners[3*icorner-3] = xsign*front; m_corners[3*icorner-2] = 0.; m_corners[3*icorner-1] = 0.; icorner = 3; m_corners[3*icorner-3] = 0.; m_corners[3*icorner-2] = 0.; m_corners[3*icorner-1] = 0.; icorner = 4; m_corners[3*icorner-3] = 0.; m_corners[3*icorner-2] = front; m_corners[3*icorner-1] = 0.; icorner = 5; m_corners[3*icorner-3] = xsign*rear; m_corners[3*icorner-2] = rear; m_corners[3*icorner-1] = length; icorner = 6; m_corners[3*icorner-3] = xsign*rear; m_corners[3*icorner-2] = 0.; m_corners[3*icorner-1] = length; icorner = 7; m_corners[3*icorner-3] = 0.; m_corners[3*icorner-2] = 0.; m_corners[3*icorner-1] = length; icorner = 8; m_corners[3*icorner-3] = 0.; m_corners[3*icorner-2] = rear; m_corners[3*icorner-1] = length; calculateCentres(); // Move centre of SC to (0,0,0) translate(); // Rotate into standard position (face centres on z axis) // this->rotate(); calculateCentres(); }
DDEcalEndcapTrap::DDEcalEndcapTrap | ( | ) | [private] |
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().
{ // // Calculate crystal centre and front & rear face centres // int ixyz, icorner; for (ixyz = 0; ixyz <3; ixyz++) { m_centre[ixyz] = 0; m_fcentre[ixyz] = 0; m_rcentre[ixyz] = 0; } for (icorner=1; icorner<=4; icorner++) { for (ixyz=0; ixyz<3; ixyz++) { m_centre[ixyz] = m_centre[ixyz] + 0.125*m_corners[3*icorner-3+ixyz]; m_fcentre[ixyz] = m_fcentre[ixyz] + 0.25*m_corners[3*icorner-3+ixyz]; } } for (icorner=5; icorner<=8; icorner++) { for (ixyz=0; ixyz<3; ixyz++) { m_centre[ixyz] = m_centre[ixyz] + 0.125*m_corners[3*icorner-3+ixyz]; m_rcentre[ixyz] = m_rcentre[ixyz] + 0.25*m_corners[3*icorner-3+ixyz]; } } }
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().
{ // // Return SC centre as a DDTranslation // return DDTranslation(m_centre[0], m_centre[1], m_centre[2]); }
DDTranslation DDEcalEndcapTrap::cornerPos | ( | const int | icorner | ) |
Definition at line 225 of file DDEcalEndcapTrap.cc.
References m_corners.
Referenced by print(), rotate(), and translate().
{ // // Return specified corner as a DDTranslation // return DDTranslation( m_corners[3*icorner-3], m_corners[3*icorner-2], m_corners[3*icorner-1] ); }
void DDEcalEndcapTrap::cornerPos | ( | const int | icorner, |
const DDTranslation | cc | ||
) |
Definition at line 236 of file DDEcalEndcapTrap.cc.
References m_corners.
{ // // Save position of specified corner. // for (int ixyz=0; ixyz<3; ixyz++) { m_corners[3*icorner-3+ixyz] = ( 0==ixyz ? cornerxyz.x() : ( 1==ixyz ? cornerxyz.y() : cornerxyz.z() ) ) ;; } }
double DDEcalEndcapTrap::elevationAngle | ( | ) |
Definition at line 292 of file DDEcalEndcapTrap.cc.
References cond::rpcobimon::current, fcentrePos(), and rcentrePos().
Referenced by moveto().
{ // // Return elevation angle (out of x-z plane) of SC in current position. // DDTranslation current = fcentrePos() - rcentrePos(); return elevationAngle(current); }
double DDEcalEndcapTrap::elevationAngle | ( | const DDTranslation | trans | ) |
Definition at line 282 of file DDEcalEndcapTrap.cc.
{ // // Return elevation angle (out of x-z plane) of a given translation (seen as a vector from the origin). // double sintheta = trans.y()/trans.r(); return asin(sintheta); }
DDTranslation DDEcalEndcapTrap::fcentrePos | ( | ) |
Definition at line 260 of file DDEcalEndcapTrap.cc.
References m_fcentre.
Referenced by elevationAngle(), polarAngle(), and print().
{ // // Return SC front face centre as a DDTranslation // return DDTranslation( m_fcentre[0], m_fcentre[1], m_fcentre[2] ) ; }
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().
{ // // Rotate (about X then about Y) and translate supercrystal to bring axis joining front and rear face centres parallel to line connecting specified points // // Get azimuthal and polar angles of current axis and target axis double currentTheta = elevationAngle(); double currentPhi = polarAngle(); double targetTheta = elevationAngle(frontCentre-rearCentre); double targetPhi = polarAngle(frontCentre-rearCentre); // Rotate to correct angle (X then Y) // edm::LogInfo("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl; // edm::LogInfo("EcalGeom") << "moveto: rearCentre " << rearCentre << std::endl; // edm::LogInfo("EcalGeom") << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl; // edm::LogInfo("EcalGeom") << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi << std::endl; rotateX(targetTheta-currentTheta); rotateY(targetPhi-currentPhi); // Translate SC to final position DDTranslation targetCentre = 0.5*(frontCentre + rearCentre); // edm::LogInfo("EcalGeom") << "moveto: translation " << targetCentre-centrePos() << std::endl; translate(targetCentre-centrePos()); }
double DDEcalEndcapTrap::polarAngle | ( | const DDTranslation | trans | ) |
Definition at line 302 of file DDEcalEndcapTrap.cc.
{ // // Return polar angle (from x to z) of a given translation (seen as a vector from the origin). // double tanphi = trans.x()/trans.z(); return atan(tanphi); }
double DDEcalEndcapTrap::polarAngle | ( | ) |
Definition at line 312 of file DDEcalEndcapTrap.cc.
References cond::rpcobimon::current, fcentrePos(), and rcentrePos().
Referenced by moveto().
{ // // Return elevation angle (out of x-z plane) of SC in current position. // DDTranslation current = fcentrePos() - rcentrePos(); return polarAngle(current); }
void DDEcalEndcapTrap::print | ( | void | ) |
Definition at line 322 of file DDEcalEndcapTrap.cc.
References centrePos(), cornerPos(), fcentrePos(), and rcentrePos().
{ // // Print SC coordinates for debugging // edm::LogInfo("EcalGeom") << "Endcap supercrystal" << std::endl; for (int ic=1; ic<=8; ic++) { DDTranslation cc = cornerPos(ic); edm::LogInfo("EcalGeom") << "Corner " << ic << " " << cc << std::endl; } edm::LogInfo("EcalGeom") << " Centre " << centrePos() << std::endl; edm::LogInfo("EcalGeom") << " fCentre " << fcentrePos() << std::endl; edm::LogInfo("EcalGeom") << " rCentre " << rcentrePos() << std::endl; }
DDTranslation DDEcalEndcapTrap::rcentrePos | ( | ) |
Definition at line 271 of file DDEcalEndcapTrap.cc.
References m_rcentre.
Referenced by elevationAngle(), polarAngle(), and print().
{ // // Return SC rear face centre as a DDTranslation // return DDTranslation( m_rcentre[0], m_rcentre[1], m_rcentre[2] ); }
void DDEcalEndcapTrap::rotate | ( | const DDTranslation | frontCentre, |
const DDTranslation | rearCentre | ||
) |
Definition at line 85 of file DDEcalEndcapTrap.cc.
{ // // Rotate supercrystal to bring front and rear face centres to specified points // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate(DDTranslation,DDTranslation) - not yet implemented" << std::endl; }
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().
{ // // Rotate supercrystal by specified rotation about (0,0,0) // int icorner; DDTranslation cc; // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate - rotation " << rot << std::endl; for (icorner=1; icorner<=8; icorner++) { cc = cornerPos(icorner); // edm::LogInfo("EcalGeom") << " Corner (orig) " << icorner << cc << std::endl; cc = rot*cc; // edm::LogInfo("EcalGeom") << " Corner (rot) " << icorner << cc << std::endl; cornerPos(icorner,cc); } m_rotation = rot*m_rotation; calculateCentres(); }
void DDEcalEndcapTrap::rotateX | ( | const double | angle | ) |
Definition at line 168 of file DDEcalEndcapTrap.cc.
Referenced by moveto().
void DDEcalEndcapTrap::rotateY | ( | const double | angle | ) |
Definition at line 182 of file DDEcalEndcapTrap.cc.
Referenced by moveto().
DDRotationMatrix DDEcalEndcapTrap::rotation | ( | void | ) | [inline] |
Definition at line 59 of file DDEcalEndcapTrap.h.
References m_rotation.
Referenced by DDEcalEndcapAlgo::EEPositionCRs(), and DDEcalEndcapAlgo::execute().
{return 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().
{ // // Translate supercrystal by specified amount // DDTranslation tcorner; for (int icorner=1; icorner<=8; icorner++) { tcorner = cornerPos(icorner) + trans; cornerPos(icorner,tcorner); } calculateCentres(); m_translation = trans + m_translation; }
void DDEcalEndcapTrap::translate | ( | ) |
Definition at line 116 of file DDEcalEndcapTrap.cc.
References centrePos().
Referenced by DDEcalEndcapTrap(), and moveto().
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.