HepMC3 event record library: Units Class Reference

HepMC3 event record library

Public Types | Static Public Member Functions
Units Class Reference

## Detailed Description

Stores units-related enums and conversion functions.

Manages units used by HepMC::GenEvent

Definition at line 26 of file Units.h.

`#include <Units.h>`

## Public Types
enum | MomentumUnit { MEV , GEV }
| Momentum units. More...
enum | LengthUnit { MM , CM }
| Position units. More...

## Static Public Member Functions
static MomentumUnit | momentum_unit (const std::string &name)
| Get momentum unit based on its name.
static LengthUnit | length_unit (const std::string &name)
| Get length unit based on its name.
static std::string | name (MomentumUnit u)
| Get name of momentum unit.
static std::string | name (LengthUnit u)
| Get name of length unit.
template<typename T>
static void | convert (T &m, MomentumUnit from, MomentumUnit to)
| Convert FourVector to different momentum unit.
template<typename T>
static void | convert (T &m, LengthUnit from, LengthUnit to)
| Convert FourVector to different length unit.

## Member Enumeration Documentation

## ◆ LengthUnit

enum LengthUnit

Position units.

Definition at line 32 of file Units.h.

## ◆ MomentumUnit

enum MomentumUnit

Momentum units.

Definition at line 29 of file Units.h.

## Member Function Documentation

## ◆ convert() [1/2]

template<typename T>

void convert | ( | T & | m,
|  | LengthUnit | from,
|  | LengthUnit | to )
| inlinestatic

Convert FourVector to different length unit.

Definition at line 96 of file Units.h.

## ◆ convert() [2/2]

template<typename T>

void convert | ( | T & | m,
|  | MomentumUnit | from,
|  | MomentumUnit | to )
| inlinestatic

Convert FourVector to different momentum unit.

Definition at line 81 of file Units.h.

## ◆ length_unit()

LengthUnit length_unit | ( | const std::string & | name | ) |
| inlinestatic

Get length unit based on its name.

Definition at line 46 of file Units.h.

References HEPMC3_ERROR_LEVEL, and name().

## ◆ momentum_unit()

MomentumUnit momentum_unit | ( | const std::string & | name | ) |
| inlinestatic

Get momentum unit based on its name.

Definition at line 36 of file Units.h.

References HEPMC3_ERROR_LEVEL, and name().

## ◆ name() [1/2]

std::string name | ( | LengthUnit | u | ) |
| inlinestatic

Get name of length unit.

Definition at line 68 of file Units.h.

## ◆ name() [2/2]

std::string name | ( | MomentumUnit | u | ) |
| inlinestatic

Get name of momentum unit.

Definition at line 56 of file Units.h.

The documentation for this class was generated from the following file:

- Units.h