** Warning **
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=lxr at /lxr/lib/LXR/Common.pm line 1113.
Last-Modified: Sat, 23 May 2025 23:49:09 GMT
Content-Type: text/html; charset=utf-8
/CMSSW_15_1_X_2025-05-23-2300/Geometry/ForwardGeometry/src/IdealZDCTrapezoid.cc
File indexing completed on 2024-04-06 12:14:38
0001 #include "Geometry /ForwardGeometry /interface /IdealZDCTrapezoid.h "
0002 #include <cmath>
0003
0004 typedef CaloCellGeometry ::CCGFloat CCGFloat ;
0005 typedef CaloCellGeometry ::Pt3D Pt3D ;
0006 typedef CaloCellGeometry ::Pt3DVec Pt3DVec ;
0007
0008 IdealZDCTrapezoid ::IdealZDCTrapezoid () : CaloCellGeometry () {}
0009
0010 IdealZDCTrapezoid ::IdealZDCTrapezoid (const IdealZDCTrapezoid & idzt) : CaloCellGeometry (idzt) { *this = idzt; }
0011
0012 IdealZDCTrapezoid & IdealZDCTrapezoid ::operator =(const IdealZDCTrapezoid & idzt) {
0013 if (&idzt != this )
0014 CaloCellGeometry ::operator =(idzt);
0015 return *this ;
0016 }
0017
0018 IdealZDCTrapezoid ::IdealZDCTrapezoid (const GlobalPoint & faceCenter, CornersMgr * mgr , const CCGFloat * parm )
0019 : CaloCellGeometry (faceCenter, mgr , parm ) {
0020 initSpan ();
0021 }
0022
0023 IdealZDCTrapezoid ::~IdealZDCTrapezoid () {}
0024
0025 CCGFloat IdealZDCTrapezoid ::an () const { return param ()[0]; }
0026
0027 CCGFloat IdealZDCTrapezoid ::dx () const { return param ()[1]; }
0028
0029 CCGFloat IdealZDCTrapezoid ::dy () const { return param ()[2]; }
0030
0031 CCGFloat IdealZDCTrapezoid ::dz () const { return param ()[3]; }
0032
0033 CCGFloat IdealZDCTrapezoid ::ta () const { return tan (an ()); }
0034
0035 CCGFloat IdealZDCTrapezoid ::dt () const { return dy () * ta (); }
0036
0037 void IdealZDCTrapezoid ::vocalCorners (Pt3DVec & vec , const CCGFloat * pv , Pt3D & ref ) const { localCorners (vec , pv , ref ); }
0038
0039 void IdealZDCTrapezoid ::localCorners (Pt3DVec & lc , const CCGFloat * pv , Pt3D & ref ) {
0040 assert (8 == lc .size ());
0041 assert (nullptr != pv );
0042
0043 const CCGFloat an (pv [0]);
0044 const CCGFloat dx (pv [1]);
0045 const CCGFloat dy (pv [2]);
0046 const CCGFloat dz (pv [3]);
0047 const CCGFloat ta (tan (an ));
0048 const CCGFloat dt (dy * ta );
0049
0050 lc [0] = Pt3D (-dx , -dy , +dz + dt );
0051 lc [1] = Pt3D (-dx , +dy , +dz - dt );
0052 lc [2] = Pt3D (+dx , +dy , +dz - dt );
0053 lc [3] = Pt3D (+dx , -dy , +dz + dt );
0054 lc [4] = Pt3D (-dx , -dy , -dz + dt );
0055 lc [5] = Pt3D (-dx , +dy , -dz - dt );
0056 lc [6] = Pt3D (+dx , +dy , -dz - dt );
0057 lc [7] = Pt3D (+dx , -dy , -dz + dt );
0058
0059 ref = 0.25 * (lc [0] + lc [1] + lc [2] + lc [3]);
0060 }
0061
0062 void IdealZDCTrapezoid ::initCorners (CaloCellGeometry ::CornersVec & corners ) {
0063 if (corners .uninitialized ()) {
0064 const GlobalPoint & p (getPosition ());
0065 const CCGFloat zsign (0 < p .z () ? 1. : -1.);
0066 const Pt3D gf (p .x (), p .y (), p .z ());
0067
0068 Pt3D lf ;
0069 Pt3DVec lc (8, Pt3D (0, 0, 0));
0070 localCorners (lc , param (), lf );
0071 const Pt3D lb (lf .x (), lf .y (), lf .z () - 2. * dz ());
0072 const Pt3D ls (lf .x () - dx (), lf .y (), lf .z ());
0073
0074 const Pt3D gb (gf .x (), gf .y (), gf .z () + 2. * zsign * dz ());
0075
0076 const Pt3D gs (gf .x () - zsign * dx (), gf .y (), gf .z ());
0077
0078 const HepGeom ::Transform3D tr (lf , lb , ls , gf , gb , gs );
0079
0080 for (unsigned int i (0); i != 8; ++i ) {
0081 const Pt3D gl (tr * lc [i ]);
0082 corners [i ] = GlobalPoint (gl .x (), gl .y (), gl .z ());
0083 }
0084 }
0085 }
0086
0087 std ::ostream& operator <<(std ::ostream& s , const IdealZDCTrapezoid & cell ) {
0088 s << "Center: " << cell .getPosition () << std ::endl ;
0089 s << "TiltAngle = " << cell .an () * 180. / M_PI << " deg, dx = " << cell .dx () << ", dy = " << cell .dy ()
0090 << ", dz = " << cell .dz () << std ::endl ;
0091 return s ;
0092 }