SHiP Data Model
Event data model for the SHiP experiment: C++ data classes with ROOT dictionary support.
Loading...
Searching...
No Matches
Namespaces | Typedefs | Functions
ship Namespace Reference

Canonical ShipSoft unit vocabulary. More...

Namespaces

namespace  units
 
namespace  view
 Quantity views over the persisted data classes.
 

Typedefs

using Length = mp_units::quantity< units::mm, double >
 Canonical quantity types: double representation, storage unit baked in.
 
using Time = mp_units::quantity< units::ns, double >
 
using Energy = mp_units::quantity< units::GeV, double >
 
using Momentum = mp_units::quantity< units::GeV_per_c, double >
 
using Mass = mp_units::quantity< units::GeV_per_c2, double >
 
using Angle = mp_units::quantity< units::rad, double >
 
using MagneticField = mp_units::quantity< units::tesla, double >
 
template<typename Q >
using Vec3 = std::array< Q, 3 >
 

Functions

template<typename Q >
constexpr Q quantityOf (double v)
 Wrap a raw scalar, interpreting it in Q's canonical unit (bitwise).
 
template<typename Q >
constexpr double raw (Q q)
 Unwrap a scalar quantity to a raw double in Q's canonical unit (bitwise).
 
template<typename Q >
constexpr Vec3< Q > vecOf (std::array< double, 3 > const &v)
 Wrap a raw 3-vector, interpreting it in Q's canonical unit (bitwise).
 
template<typename Q >
constexpr std::array< double, 3 > raw (Vec3< Q > const &v)
 Unwrap a quantity 3-vector to raw doubles in Q's canonical unit (bitwise).
 

Detailed Description

Canonical ShipSoft unit vocabulary.

Storage convention (matches the data-class doxygen contracts and Key4hep): positions and lengths [mm], momenta [GeV/c], energies [GeV], times [ns]. Persisted classes keep plain doubles in these units; computation code works with the quantity types below and converts at the boundaries (see SHiP/QuantityView.hpp).

NEVER using namespace ship::units in a translation unit that includes CLHEP or Geant4 headers: G4SystemOfUnits.hh injects global mm, GeV, tesla, ... that collide with these names. Always qualify.

Typedef Documentation

◆ Angle

using ship::Angle = typedef mp_units::quantity<units::rad, double>

◆ Energy

using ship::Energy = typedef mp_units::quantity<units::GeV, double>

◆ Length

using ship::Length = typedef mp_units::quantity<units::mm, double>

Canonical quantity types: double representation, storage unit baked in.

◆ MagneticField

◆ Mass

◆ Momentum

◆ Time

using ship::Time = typedef mp_units::quantity<units::ns, double>

◆ Vec3

template<typename Q >
using ship::Vec3 = typedef std::array<Q, 3>

Function Documentation

◆ quantityOf()

template<typename Q >
constexpr Q ship::quantityOf ( double  v)
constexpr

Wrap a raw scalar, interpreting it in Q's canonical unit (bitwise).

◆ raw() [1/2]

template<typename Q >
constexpr double ship::raw ( Q  q)
constexpr

Unwrap a scalar quantity to a raw double in Q's canonical unit (bitwise).

◆ raw() [2/2]

template<typename Q >
constexpr std::array< double, 3 > ship::raw ( Vec3< Q > const v)
constexpr

Unwrap a quantity 3-vector to raw doubles in Q's canonical unit (bitwise).

◆ vecOf()

template<typename Q >
constexpr Vec3< Q > ship::vecOf ( std::array< double, 3 > const &  v)
constexpr

Wrap a raw 3-vector, interpreting it in Q's canonical unit (bitwise).