hepmc - Blame information for rev 43

Subversion Repositories:
Rev:
Rev Author Line No. Line
2 garren 1 //--------------------------------------------------------------------------
2 #ifndef HEPMC_POLARIZATION_H
3 #define HEPMC_POLARIZATION_H
4  
5 //////////////////////////////////////////////////////////////////////////
6 // Matt.Dobbs@Cern.CH, September 1999, refer to:
7 // M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for
8 // High Energy Physics", Computer Physics Communications (to be published).
9 //
10 // Polarization object for a particle. All angles are in radians.
11 //////////////////////////////////////////////////////////////////////////
12  
43 garren 13 #include "HepMC/SimpleVector.h"
2 garren 14 #include <iostream>
15 #include <cmath>
16  
17 namespace HepMC {
18  
21 garren 19     static const double HepMC_pi = 3.14159265358979323846;  // copy of pi from CLHEP
2 garren 20  
21     class Polarization {
22  
23         friend std::ostream& operator<<( std::ostream&, const Polarization& );
24  
25     public:
26         Polarization( double theta = 0, double phi = 0 );
27         Polarization( const Polarization& inpolar );
43 garren 28         Polarization( const ThreeVector& vec3in );
2 garren 29         virtual       ~Polarization() {}
30  
31         Polarization& operator=( const Polarization& inpolar );
32         bool          operator==( const Polarization& ) const;
33         bool          operator!=( const Polarization& ) const;
34  
35         void          print( std::ostream& ostr = std::cout ) const;
36  
37         ////////////////////
38         // access methods //
39         ////////////////////
40         double        theta() const;    // returns polar angle in radians
41         double        phi() const;      // returns azimuthal angle in radians
43 garren 42         ThreeVector   normal3d() const; // unit 3 vector for easy manipulation
2 garren 43  
44         double        set_theta( double theta );
45         double        set_phi( double phi );
46         void          set_theta_phi( double theta, double phi );
47         // sets polarization according to direction of 3 vec
43 garren 48         ThreeVector   set_normal3d( const ThreeVector& vec3in );
2 garren 49  
50     private:
51         double m_theta; //polar angle of polarization in radians 0< theta <pi
52         double m_phi;   //azimuthal angle of polarization in rad. 0< phi <2pi
53     };
54  
55     ///////////////////////////
56     // INLINE Access Methods //
57     ///////////////////////////
58  
59     inline double Polarization::theta() const { return m_theta; }
60     inline double Polarization::phi() const { return m_phi; }
61  
62     ///////////////////////////
63     // INLINE Operators      //
64     ///////////////////////////
65  
66     inline bool Polarization::operator==( const Polarization& a ) const
67     {
68         return ( a.theta() == this->theta() && a.phi() == this->phi() );
69     }
70  
71     inline bool Polarization::operator!=(const Polarization& a ) const
72     {
73         return !( a == *this );
74     }
75  
76 } // HepMC
77  
78 #endif  // HEPMC_POLARIZATION_H
79 //--------------------------------------------------------------------------