hepmc - Diff between revs 43 and 65
Subversion Repositories:
| Rev 43 | Rev 65 | |||
|---|---|---|---|---|
| Line 43... | Line 43... | |||
| 43 | outvec.setPhi( phi() ); // sets theta keeping mag and phi constant | 43 | outvec.setPhi( phi() ); // sets theta keeping mag and phi constant | |
| 44 | return outvec; | 44 | return outvec; | |
| 45 | } | 45 | } | |
| 46 | 46 | |||
| 47 | double Polarization::set_theta( double theta ) { | 47 | double Polarization::set_theta( double theta ) { | |
| 48 | // Theta is restricted to be between 0 --> pi | - | ||
| 49 | // if an out of range value is given, it is translated to this range. | - | ||
| - | 48 | /// Theta is restricted to be between 0 --> pi | ||
| - | 49 | /// if an out of range value is given, it is translated to this range. | ||
| 50 | theta = ( theta>0 ? theta : -theta ); // this is just absolute value. | 50 | theta = ( theta>0 ? theta : -theta ); // this is just absolute value. | |
| 51 | // translate to 0 < theta < 2pi | 51 | // translate to 0 < theta < 2pi | |
| 52 | theta = ( theta/(2*HepMC_pi) - int(theta/(2*HepMC_pi)) ) | 52 | theta = ( theta/(2*HepMC_pi) - int(theta/(2*HepMC_pi)) ) | |
| 53 | * 2*HepMC_pi; | 53 | * 2*HepMC_pi; | |
| 54 | if ( theta > HepMC_pi ) theta = 2*HepMC_pi - theta; | 54 | if ( theta > HepMC_pi ) theta = 2*HepMC_pi - theta; | |
| 55 | return m_theta = theta; | 55 | return m_theta = theta; | |
| 56 | } | 56 | } | |
| 57 | 57 | |||
| 58 | double Polarization::set_phi( double phi ) { | 58 | double Polarization::set_phi( double phi ) { | |
| 59 | // Phi is restricted to be between 0 --> 2pi | - | ||
| 60 | // if an out of range value is given, it is translated to this range. | - | ||
| - | 59 | /// Phi is restricted to be between 0 --> 2pi | ||
| - | 60 | /// if an out of range value is given, it is translated to this range. | ||
| 61 | // | 61 | // | |
| 62 | // translate to -2pi < phi < 2pi | 62 | // translate to -2pi < phi < 2pi | |
| 63 | phi = ( phi/(2*HepMC_pi) - int(phi/(2*HepMC_pi)) ) * 2*HepMC_pi; | 63 | phi = ( phi/(2*HepMC_pi) - int(phi/(2*HepMC_pi)) ) * 2*HepMC_pi; | |
| 64 | if ( phi < 0 ) phi = 2*HepMC_pi + phi; // translates to 0 < phi < 2pi | 64 | if ( phi < 0 ) phi = 2*HepMC_pi + phi; // translates to 0 < phi < 2pi | |
| 65 | return m_phi = phi; | 65 | return m_phi = phi; | |
| Line 79... | Line 79... | |||
| 79 | ///////////// | 79 | ///////////// | |
| 80 | // Friends // | 80 | // Friends // | |
| 81 | ///////////// | 81 | ///////////// | |
| 82 | 82 | |||
| 83 | std::ostream& operator<<( std::ostream& ostr, const Polarization& polar ) { | 83 | std::ostream& operator<<( std::ostream& ostr, const Polarization& polar ) { | |
| - | 84 | /// write theta and phi to the output stream | ||
| 84 | return ostr << "(" << polar.theta() | 85 | return ostr << "(" << polar.theta() | |
| 85 | << "," << polar.phi() << ")"; | 86 | << "," << polar.phi() << ")"; | |
| 86 | } | 87 | } | |
| 87 | 88 | |||
| 88 | } // HepMC | 89 | } // HepMC | |
