Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add utils/include/edm4eic/unit_system.h #35

Merged
merged 6 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ target_include_directories(edm4eic_utils

install(FILES
include/edm4eic/analysis_utils.h
include/edm4eic/unit_system.h
include/edm4eic/vector_utils.h
include/edm4eic/vector_utils_legacy.h
DESTINATION include/edm4eic
Expand Down
46 changes: 46 additions & 0 deletions utils/include/edm4eic/unit_system.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2023 Dmitry Kalinkin

#pragma once

namespace edm4eic {

namespace unit {

//
// This provides definition for a unique unit system for this EDM. It is
// neither Geant, nor TGeo. The DD4hep, by default, uses a system matching
// the TGeo one.
//
// +------------+---------------------|-----------------+
// | Geant | TGeo | EDM4hep/EDM4eic |
// +------------+---------------------|-----------------+
// | milimeter | centimeter | milimeter |
// | nanosecond | second | nanosecond |
// | MeV | GeV | GeV |
// +------------+---------------------|-----------------+
//

// distance
static constexpr double mm = 1.0; // millimeter
static constexpr double cm = 1e1 * mm; // centimeter
static constexpr double um = 1e-3 * mm; // micrometer
static constexpr double nm = 1e-6 * mm; // nanometer
static constexpr double m = 1e3 * mm; // meter

// time
static constexpr double ns = 1.0; // nanosecond
static constexpr double s = 1e9 * ns; // second
static constexpr double ms = 1e6 * ns; // milisecond
static constexpr double us = 1e3 * ns; // microsecond
static constexpr double ps = 1e-3 * ns; // picosecond

// energy
static constexpr double GeV = 1.0; // giga electron volt
static constexpr double MeV = 1e-3 * GeV; // mega electron volt
static constexpr double keV = 1e-6 * GeV; // kilo electron volt
static constexpr double eV = 1e-9 * GeV; // electron volt

}

}