| 1 | // ----------------------------------------------------------------------
|
|---|
| 2 | //
|
|---|
| 3 | // ZMxpv.cc Support for Vector package in the ZOOM context, where
|
|---|
| 4 | // probelmatic conditions are handled via ZOOM Exceptions.
|
|---|
| 5 | //
|
|---|
| 6 | // In the CLHEP context (that is, unless ENABLE_ZOOM_EXCEPTIONS
|
|---|
| 7 | // is defined) this file is content-free.
|
|---|
| 8 | //
|
|---|
| 9 | // ZMexception's are ZMthrown by classes in the PhysicsVectors
|
|---|
| 10 | // package. (To avoid name clashes, these start with ZMxpv.)
|
|---|
| 11 | // Each possible such exception must be provided with some
|
|---|
| 12 | // defining properties: thowe are in this file.
|
|---|
| 13 | //
|
|---|
| 14 | // History:
|
|---|
| 15 | // 19-Nov-1997 MF Initial version, to enable the ZMthrow exceptions
|
|---|
| 16 | // in SpaceVector.
|
|---|
| 17 | // 15-Jun-1998 WEB Added namespace support
|
|---|
| 18 | // 08-Jan-2001 MF Moved into CLHEP
|
|---|
| 19 | // 09-Oct-2003 MF Major addition: Exception class defs for CLHEP case
|
|---|
| 20 | //
|
|---|
| 21 | // ----------------------------------------------------------------------
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | #include "CLHEP/Vector/ZMxpv.h"
|
|---|
| 25 |
|
|---|
| 26 | #ifndef ENABLE_ZOOM_EXCEPTIONS
|
|---|
| 27 |
|
|---|
| 28 | CLHEP_vector_exception::CLHEP_vector_exception
|
|---|
| 29 | ( const std::string & s ) throw() : message(s) {}
|
|---|
| 30 |
|
|---|
| 31 | const char*
|
|---|
| 32 | CLHEP_vector_exception::what() const throw() {
|
|---|
| 33 | static std::string answer;
|
|---|
| 34 | answer = name();
|
|---|
| 35 | answer += ": ";
|
|---|
| 36 | answer += message;
|
|---|
| 37 | return answer.c_str();
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | #define CLHEP_vector_exception_methods(NAME) \
|
|---|
| 41 | NAME::NAME(const std::string & s) throw() : CLHEP_vector_exception(s) {} \
|
|---|
| 42 | const char* NAME::name() const throw() { \
|
|---|
| 43 | return #NAME; \
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | CLHEP_vector_exception_methods( ZMxPhysicsVectors )
|
|---|
| 47 | CLHEP_vector_exception_methods( ZMxpvSpacelike )
|
|---|
| 48 | CLHEP_vector_exception_methods( ZMxpvNegativeMass )
|
|---|
| 49 | CLHEP_vector_exception_methods( ZMxpvVectorInputFails )
|
|---|
| 50 | CLHEP_vector_exception_methods( ZMxpvIndexRange )
|
|---|
| 51 | CLHEP_vector_exception_methods( ZMxpvFixedAxis )
|
|---|
| 52 |
|
|---|
| 53 | CLHEP_vector_exception_methods( ZMxpvTachyonic )
|
|---|
| 54 | CLHEP_vector_exception_methods( ZMxpvZeroVector )
|
|---|
| 55 | CLHEP_vector_exception_methods( ZMxpvImproperTransformation )
|
|---|
| 56 | CLHEP_vector_exception_methods( ZMxpvInfiniteVector )
|
|---|
| 57 | CLHEP_vector_exception_methods( ZMxpvInfinity )
|
|---|
| 58 | CLHEP_vector_exception_methods( ZMxpvImproperRotation )
|
|---|
| 59 | CLHEP_vector_exception_methods( ZMxpvAmbiguousAngle )
|
|---|
| 60 |
|
|---|
| 61 | CLHEP_vector_exception_methods( ZMxpvNegativeR )
|
|---|
| 62 | CLHEP_vector_exception_methods( ZMxpvUnusualTheta )
|
|---|
| 63 | CLHEP_vector_exception_methods( ZMxpvParallelCols )
|
|---|
| 64 | CLHEP_vector_exception_methods( ZMxpvNotOrthogonal )
|
|---|
| 65 | CLHEP_vector_exception_methods( ZMxpvNotSymplectic )
|
|---|
| 66 |
|
|---|
| 67 | #endif // endif for ifndef ENABLE_ZOOM_EXCEPTIONS
|
|---|
| 68 |
|
|---|
| 69 | // ========================================================================
|
|---|
| 70 | // ========================================================================
|
|---|
| 71 | // ========================================================================
|
|---|
| 72 |
|
|---|
| 73 | #ifdef ENABLE_ZOOM_EXCEPTIONS
|
|---|
| 74 |
|
|---|
| 75 | ZM_BEGIN_NAMESPACE( zmpv ) /* namespace zmpv { */
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | ZMexClassInfo ZMxPhysicsVectors::_classInfo (
|
|---|
| 79 | "ZMxPhysicsVectors",
|
|---|
| 80 | "PhysicsVectors",
|
|---|
| 81 | ZMexSEVERE );
|
|---|
| 82 | // General Exception in a PhysicsVectors routine
|
|---|
| 83 |
|
|---|
| 84 | ZMexClassInfo ZMxpvInfiniteVector::_classInfo (
|
|---|
| 85 | "InfiniteVector",
|
|---|
| 86 | "PhysicsVectors",
|
|---|
| 87 | ZMexERROR );
|
|---|
| 88 | // Infinite vector component
|
|---|
| 89 |
|
|---|
| 90 | ZMexClassInfo ZMxpvZeroVector::_classInfo (
|
|---|
| 91 | "ZeroVector",
|
|---|
| 92 | "PhysicsVectors",
|
|---|
| 93 | ZMexERROR );
|
|---|
| 94 | // Zero Vector cannot be converted to Unit Vector
|
|---|
| 95 |
|
|---|
| 96 | ZMexClassInfo ZMxpvTachyonic::_classInfo (
|
|---|
| 97 | "Tachyonic",
|
|---|
| 98 | "PhysicsVectors",
|
|---|
| 99 | ZMexERROR );
|
|---|
| 100 | // Relativistic method using vector representing speed greater than light
|
|---|
| 101 |
|
|---|
| 102 | ZMexClassInfo ZMxpvSpacelike::_classInfo (
|
|---|
| 103 | "Spacelike",
|
|---|
| 104 | "PhysicsVectors",
|
|---|
| 105 | ZMexERROR );
|
|---|
| 106 | // Spacelike 4-vector used in context where rest mass or gamma needs computing
|
|---|
| 107 |
|
|---|
| 108 | ZMexClassInfo ZMxpvInfinity::_classInfo (
|
|---|
| 109 | "Infinity",
|
|---|
| 110 | "PhysicsVectors",
|
|---|
| 111 | ZMexERROR );
|
|---|
| 112 | // Mathematical operation will lead to infinity as a Scalar result
|
|---|
| 113 |
|
|---|
| 114 | ZMexClassInfo ZMxpvNegativeMass::_classInfo (
|
|---|
| 115 | "NegativeMass",
|
|---|
| 116 | "PhysicsVectors",
|
|---|
| 117 | ZMexERROR );
|
|---|
| 118 | // Kinematic operation was rendered meaningless by an input with negative t
|
|---|
| 119 |
|
|---|
| 120 | ZMexClassInfo ZMxpvAmbiguousAngle::_classInfo (
|
|---|
| 121 | "AmbiguousAngle",
|
|---|
| 122 | "PhysicsVectors",
|
|---|
| 123 | ZMexWARNING );
|
|---|
| 124 | // Angle requested ill-defined, due to null or collinear vectors
|
|---|
| 125 |
|
|---|
| 126 | ZMexClassInfo ZMxpvNegativeR::_classInfo (
|
|---|
| 127 | "NegativeR",
|
|---|
| 128 | "PhysicsVectors",
|
|---|
| 129 | ZMexWARNING );
|
|---|
| 130 | // Negative value supplied for vector magnitude
|
|---|
| 131 |
|
|---|
| 132 | ZMexClassInfo ZMxpvUnusualTheta::_classInfo (
|
|---|
| 133 | "UnusualTheta",
|
|---|
| 134 | "PhysicsVectors",
|
|---|
| 135 | ZMexWARNING );
|
|---|
| 136 | // Theta supplied for polar coordinates outside of [0,PI]
|
|---|
| 137 |
|
|---|
| 138 | ZMexClassInfo ZMxpvVectorInputFails::_classInfo (
|
|---|
| 139 | "VectorInputFails",
|
|---|
| 140 | "PhysicsVectors",
|
|---|
| 141 | ZMexERROR );
|
|---|
| 142 | // Theta supplied for polar coordinates outside of [0,PI]
|
|---|
| 143 |
|
|---|
| 144 | ZMexClassInfo ZMxpvParallelCols::_classInfo (
|
|---|
| 145 | "ParallelCols",
|
|---|
| 146 | "PhysicsVectors",
|
|---|
| 147 | ZMexERROR );
|
|---|
| 148 | // Col's supplied to form a Rotation are parallel instead of orthogonal
|
|---|
| 149 |
|
|---|
| 150 | ZMexClassInfo ZMxpvImproperRotation::_classInfo (
|
|---|
| 151 | "ImproperRotation",
|
|---|
| 152 | "PhysicsVectors",
|
|---|
| 153 | ZMexERROR );
|
|---|
| 154 | // Col's supplied to form a Rotation form a (rotation+reflection) instead
|
|---|
| 155 |
|
|---|
| 156 | ZMexClassInfo ZMxpvImproperTransformation::_classInfo (
|
|---|
| 157 | "ImproperRotation",
|
|---|
| 158 | "PhysicsVectors",
|
|---|
| 159 | ZMexERROR );
|
|---|
| 160 | // Rows supplied to form a LorentzTransformation form tachyonic or reflection
|
|---|
| 161 |
|
|---|
| 162 | ZMexClassInfo ZMxpvNotOrthogonal::_classInfo (
|
|---|
| 163 | "NotOrthogonal",
|
|---|
| 164 | "PhysicsVectors",
|
|---|
| 165 | ZMexWARNING );
|
|---|
| 166 | // Col's supplied to form a Rotation or LorentzTransformation are not orthogonal
|
|---|
| 167 |
|
|---|
| 168 | ZMexClassInfo ZMxpvNotSymplectic::_classInfo (
|
|---|
| 169 | "NotSymplectic",
|
|---|
| 170 | "PhysicsVectors",
|
|---|
| 171 | ZMexWARNING );
|
|---|
| 172 | // A row supplied as part of a LorentzTransformation has wrong restmass()
|
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 | ZMexClassInfo ZMxpvFixedAxis::_classInfo (
|
|---|
| 176 | "FixedAxis",
|
|---|
| 177 | "PhysicsVectors",
|
|---|
| 178 | ZMexERROR );
|
|---|
| 179 | // An attempt to change the axis is of a rotation fixed to be about X Y or Z.
|
|---|
| 180 |
|
|---|
| 181 | ZMexClassInfo ZMxpvIndexRange::_classInfo (
|
|---|
| 182 | "IndexRange",
|
|---|
| 183 | "PhysicsVectors",
|
|---|
| 184 | ZMexERROR );
|
|---|
| 185 | // An attempt to access a vector in the p(i) notation, where i is out of range.
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 | ZM_END_NAMESPACE( zmpv ) /* } // namespace zmpv */
|
|---|
| 189 |
|
|---|
| 190 | #endif // endif for ifdef ENAMBLE_ZOOM_EXCEPTIONS
|
|---|