| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Polarization.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 #ifndef HEPMC_POLARIZATION_H
00003 #define HEPMC_POLARIZATION_H
00004 
00006 // Matt.Dobbs@Cern.CH, September 1999, refer to:
00007 // M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for
00008 // High Energy Physics", Computer Physics Communications (to be published).
00009 //
00010 // Polarization object for a particle. All angles are in radians.
00012 
00013 #include "HepMC/SimpleVector.h"
00014 #include <iostream>
00015 #include <cmath>
00016 
00017 namespace HepMC {
00018 
00019     static const double HepMC_pi = 3.14159265358979323846;  // copy of pi from CLHEP
00020     
00022 
00029     class Polarization {
00030 
00032         friend std::ostream& operator<<( std::ostream&, const Polarization& );
00033 
00034     public:
00036         Polarization( double theta = 0, double phi = 0 );
00038         Polarization( const Polarization& inpolar );
00040         Polarization( const ThreeVector& vec3in );
00041         virtual       ~Polarization() {}
00042 
00044         void swap( Polarization & other);
00046         Polarization& operator=( const Polarization& inpolar );
00048         bool          operator==( const Polarization& ) const;
00050         bool          operator!=( const Polarization& ) const;
00051 
00053         void          print( std::ostream& ostr = std::cout ) const;
00054     
00056         // access methods //
00058         double        theta() const;    
00059         double        phi() const;      
00060         ThreeVector   normal3d() const; 
00061 
00063         double        set_theta( double theta );
00065         double        set_phi( double phi );
00067         void          set_theta_phi( double theta, double phi );
00069         ThreeVector   set_normal3d( const ThreeVector& vec3in ); 
00070 
00071     private:
00073         double valid_theta( double theta );
00075         double valid_phi( double phi );
00076 
00077     private:
00078         double m_theta; //polar angle of polarization in radians 0< theta <pi
00079         double m_phi;   //azimuthal angle of polarization in rad. 0< phi <2pi
00080     };
00081 
00083     // INLINE Access Methods //
00085 
00086     inline double Polarization::theta() const { return m_theta; }
00087     inline double Polarization::phi() const { return m_phi; }
00088 
00090     // INLINE Operators      //
00092 
00093     inline bool Polarization::operator==( const Polarization& a ) const 
00094     {
00095         return ( a.theta() == this->theta() && a.phi() == this->phi() );
00096     }
00097 
00098     inline bool Polarization::operator!=(const Polarization& a ) const 
00099     {
00100         return !( a == *this );
00101     }
00102 
00103 } // HepMC
00104 
00105 #endif  // HEPMC_POLARIZATION_H
00106 //--------------------------------------------------------------------------
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:56:43 2011 for HepMC by doxygen 1.4.7