CLHEP/Vector/ZMxpv.h

00001 #ifndef HEP_ZMXPV_H
00002 #define HEP_ZMXPV_H
00003 
00004 // ----------------------------------------------------------------------
00005 //
00006 //  ZMxpv.h     ZMexception's ZMthrown by classes in the PhysicsVectors
00007 //              package.  To avoid name clashes, these start with ZMxpv.
00008 //
00009 //  THIS FILE CONTAINS TWO VERSIONS OF THE NECESSARY CODE:
00010 //
00011 //  With no special defines, this file will produce code for pure CLHEP 
00012 //  building -- no ZOOM Exceptions are involved.
00013 //
00014 //  To force a build using ZOOM Exceptions where the ZMthorw macros appear,
00015 //  compile with ENABLE_ZOOM_EXCEPTIONS defined.
00016 //
00017 // ----------------------------------------------------------------------
00018 
00019 //#undef  ENABLE_ZOOM_EXCEPTIONS        // For CLHEP builds 
00020 //#define ENABLE_ZOOM_EXCEPTIONS        // For ZOOM  builds
00021 
00022 #undef  ENABLE_ZOOM_EXCEPTIONS  
00023 
00024   // Member functions of the Vector classes are capable of ZMthrow-ing the
00025   // following ZMexception's:
00026   //
00027   //    ZMxPhysicsVectors       Severe  Parent exception of all ZMexceptions
00028   //                                    particular to classes in the package.
00029   //
00030   //    ZMxpvInfiniteVector     Error
00031   //                                    Mathematical operation will lead
00032   //                                    to infinity or NAN in a component
00033   //                                    of a result vector.
00034   //    ZMxpvZeroVector         Error
00035   //                                    A zero vector was used to specify
00036   //                                    a direction based on vector.unit().
00037   //    ZMxpvTachyonic          Error
00038   //                                    A relativistic kinematic function was
00039   //                                    taken, involving a vector representing
00040   //                                    a speed at or beyond that of light (=1).
00041   //    ZMxpvSpacelike          Error
00042   //                                    A spacelike 4-vector was used in a
00043   //                                    context where its restMass or gamma
00044   //                                    needs to be computed:  The result is
00045   //                                    formally imaginary (a zero result is
00046   //                                    supplied).
00047   //    ZMxpvInfinity           Error
00048   //                                    Mathematical operation will lead
00049   //                                    to infinity as a Scalar result.
00050   //    ZMxpvNegativeMass       Error
00051   //                                    Kinematic operation, e.g. invariant
00052   //                                    mass, rendered meaningless by an input
00053   //                                    with negative time component.
00054   //    ZMxpvVectorInputFails   Error
00055   //                                    Input to a SpaceVector or Lorentz
00056   //                                    Vector failed due to bad format or EOF.
00057   //    ZMxpvParallelCols       Error
00058   //                                    Purportedly orthogonal col's supplied
00059   //                                    to form a Rotation are exactly
00060   //                                    parallel instead.
00061   //    ZMxpvImproperRotation   Error
00062   //                                    Orthogonal col's supplied form a
00063   //                                    refection (determinant -1) more
00064   //                                    nearly than rather than a rotation.
00065   //    ZMxpvImproperTransformation Error
00066   //                                    Orthogonalized rows supplied form a
00067   //                                    tachyonic boost, a reflection, or
00068   //                                    a combination of those flaws,
00069   //                                    more nearly than a proper Lorentz
00070   //                                    transformation.
00071   //    ZMxpvFixedAxis          Error
00072   //                                    Attempt to change a RotationX,
00073   //                                    RotationY, or RotationZ in such a way
00074   //                                    that the axis might no longer be X,
00075   //                                    Y, or Z respectively.
00076   //    ZMxpvIndexRange         Error
00077   //                                    When using the syntax of v(i) to get
00078   //                                    a vector component, i is out of range.
00079   //    ZMxpvNotOrthogonal      Warning
00080   //                                    Purportedly orthogonal col's supplied
00081   //                                    to form a Rotation or LT are not
00082   //                                    orthogonal within the tolerance.
00083   //    ZMxpvNotSymplectic      Warning
00084   //                                    A row supplied to form a Lorentz
00085   //                                    transformation has a value of restmass
00086   //                                    incorrect by more than the tolerance:
00087   //                                    It should be -1 for rows 1-3,
00088   //                                    +1 for row 4.
00089   //    ZMxpvAmbiguousAngle     Warning
00090   //                                    Method involves taking an angle against
00091   //                                    a reference vector of zero length, or
00092   //                                    phi in polar coordinates of a vector
00093   //                                    along the Z axis.
00094   //    ZMxpvNegativeR          Warning
00095   //                                    R of a supplied vector is negative.
00096   //                                    The mathematical operation done is
00097   //                                    still formally valid.
00098   //    ZMxpvUnusualTheta       Warning
00099   //                                    Theta supplied to construct or set
00100   //                                    a vector is outside the range [0,PI].
00101   //                                    The mathematical operation done is
00102   //                                    still formally valid.  But note that
00103   //                                    when sin(theta) < 0, phi becomes an
00104   //                                    angle against the -X axis.
00105   //______________________________________________________________________
00106 
00107 #ifndef ENABLE_ZOOM_EXCEPTIONS 
00108 
00109 //  This is the CLHEP version.  When compiled for CLHEP, the basic CLHEP 
00110 //  Vector classes will not (at least for now) depend on ZOOM Exceptions.  
00111 //  Though this header lists the various sorts of Exceptions that could be 
00112 //  thrown, ZMthrow.h in the pure CLHEP context will make ZMthrowA and 
00113 //  ZMthrowC do what CLHEP has always done:  whine to cerr about the problem 
00114 //  and exit (or continue in the ZMthrowC case).
00115 //
00116 //      If CLHEP ever embraces the ZOOM Exceptions mechanism, we will simply
00117 //      modify this file.
00118 
00119 
00120 #define ZMthrowA(A) do { HepStd::cerr << A << "\n" <<                \
00121   "at line " << __LINE__ << " in file " << __FILE__ << "\n"; \
00122   exit(-1); } while (0)
00123 
00124 #define ZMthrowC(A) do { HepStd::cerr << A << "\n" <<                \
00125   "at line " << __LINE__ << " in file " << __FILE__ << "\n"; \
00126   } while (0)
00127 
00128 #define ZMxPhysicsVectors(x) x
00129 #define ZMxpvInfiniteVector(x) x
00130 #define ZMxpvZeroVector(x) x
00131 #define ZMxpvTachyonic(x) x
00132 #define ZMxpvSpacelike(x) x
00133 #define ZMxpvInfinity(x) x
00134 #define ZMxpvNegativeMass(x) x
00135 #define ZMxpvAmbiguousAngle(x) x
00136 #define ZMxpvNegativeR(x) x
00137 #define ZMxpvUnusualTheta(x) x
00138 #define ZMxpvVectorInputFails(x) x
00139 #define ZMxpvParallelCols(x) x
00140 #define ZMxpvImproperRotation(x) x
00141 #define ZMxpvImproperTransformation(x) x
00142 #define ZMxpvIndexRange(x) x
00143 #define ZMxpvNotOrthogonal(x) x
00144 #define ZMxpvNotSymplectic(x) x
00145 #define ZMxpvFixedAxis(x) x
00146 
00147 #endif // endif for ifndef ENABLE_ZOOM_EXCEPTIONS 
00148 
00149 // =============================================================
00150 // =============================================================
00151 // =============================================================
00152 
00153 #ifdef ENABLE_ZOOM_EXCEPTIONS 
00154 
00155 //  This is the ZOOM version.  When compiled for ZOOM, even the basic CLHEP 
00156 //  Vector classes will depend on ZOOM Exceptions.  
00157 //  Though in the CLHEP context methods use ZMthrowA and ZMthrowC, these
00158 //  in the ZOOM context become ZMthrow.
00159 //
00160 //  Either this file or ZMxpvCLHEP.h is copied to become ZMxpv.h, depending 
00161 //  on whether this is a ZOOM or a CLHEP build.  
00162 //
00163 
00164 #ifndef ZMEXCEPTIONS_H
00165   #include "Exceptions/ZMexception.h"
00166   #include "Exceptions/ZMthrow.h"
00167 #endif
00168 ZM_USING_NAMESPACE( zmex )
00169 
00170 ZM_BEGIN_NAMESPACE( zmpv )      /*  namespace zmpv  {  */
00171 
00172 ZMexStandardDefinition (ZMexception, ZMxPhysicsVectors);
00173 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvInfiniteVector);
00174 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvZeroVector);
00175 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvTachyonic);
00176 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvSpacelike);
00177 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvInfinity);
00178 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvNegativeMass);
00179 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvAmbiguousAngle);
00180 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvNegativeR);
00181 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvUnusualTheta);
00182 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvVectorInputFails);
00183 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvParallelCols);
00184 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvImproperRotation);
00185 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvImproperTransformation);
00186 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvIndexRange);
00187 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvNotOrthogonal);
00188 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvNotSymplectic);
00189 ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvFixedAxis);
00190 
00191 #define ZMthrowA(A) ZMthrow(A)
00192 #define ZMthrowC(A) ZMthrow(A)
00193 
00194 ZM_END_NAMESPACE( zmpv )        /*  }  // namespace zmpv  */
00195 
00196 #endif // ENABLE_ZOOM_EXCEPTIONS
00197 
00198 #endif // HEP_ZMXPV_H

Class Library for High Energy Physics (version 1.8)