From 3b752938039bf4538b61be5be660c23cf3b1b7f9 Mon Sep 17 00:00:00 2001
From: nicolas <nicolas@nptool>
Date: Tue, 19 Feb 2013 16:17:04 +0000
Subject: [PATCH]  * add NPTOOL units based from the CLHEP files    + this
 allows to remove CLHEP dependency in NPLib    + this allows to remove
 Constant.h file

---
 NPAnalysis/Hyde2/Analysis.cxx         |   2 +-
 NPAnalysis/Hyde2/Analysis.h           |   2 +-
 NPLib/Physics/Constant.h              |  48 -----
 NPLib/Physics/NPBeam.cxx              |   7 +-
 NPLib/Physics/NPEnergyLoss.h          |   9 +-
 NPLib/Physics/NPGlobalSystemOfUnits.h | 118 +++++++++++
 NPLib/Physics/NPNucleus.cxx           |  33 +--
 NPLib/Physics/NPNucleus.h             |  12 +-
 NPLib/Physics/NPPhysicalConstants.h   | 140 +++++++++++++
 NPLib/Physics/NPReaction.cxx          |   8 +-
 NPLib/Physics/NPSystemOfUnits.h       | 289 ++++++++++++++++++++++++++
 11 files changed, 593 insertions(+), 75 deletions(-)
 delete mode 100755 NPLib/Physics/Constant.h
 create mode 100644 NPLib/Physics/NPGlobalSystemOfUnits.h
 create mode 100644 NPLib/Physics/NPPhysicalConstants.h
 create mode 100644 NPLib/Physics/NPSystemOfUnits.h

diff --git a/NPAnalysis/Hyde2/Analysis.cxx b/NPAnalysis/Hyde2/Analysis.cxx
index da1ba2a8c..501cfb873 100644
--- a/NPAnalysis/Hyde2/Analysis.cxx
+++ b/NPAnalysis/Hyde2/Analysis.cxx
@@ -61,7 +61,7 @@ int main(int argc,char** argv)
    RootOutput::getInstance()->GetTree()->Branch("Y",&Y,"Y/D") ;
 
    // Get HydeTracker pointer
-   HydeTracker* HYDTrack = (HydeTracker*) myDetector->GetDetector("HYDE");
+   Hyde2Tracker* HYDTrack = (Hyde2Tracker*) myDetector->GetDetector("HYDE2");
 
    // Get the input TChain and treat it
    TChain* Chain = RootInput:: getInstance() -> GetChain();
diff --git a/NPAnalysis/Hyde2/Analysis.h b/NPAnalysis/Hyde2/Analysis.h
index af67a9b02..7966fbe4e 100644
--- a/NPAnalysis/Hyde2/Analysis.h
+++ b/NPAnalysis/Hyde2/Analysis.h
@@ -8,7 +8,7 @@
 // NPA
 #include "DetectorManager.h"
 #include "NPOptionManager.h"
-#include "HydeTracker.h"
+#include "Hyde2Tracker.h"
 
 // STL C++
 #include <iostream>
diff --git a/NPLib/Physics/Constant.h b/NPLib/Physics/Constant.h
deleted file mode 100755
index f3d1c8150..000000000
--- a/NPLib/Physics/Constant.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef Constant_h
-#define Constant_h
-/*****************************************************************************
- * Copyright (C) 2009-2013    this file is part of the NPTool Project        *
- *                                                                           *
- * For the licensing terms see $NPTOOL/Licence/NPTool_Licence                *
- * For the list of contributors see $NPTOOL/Licence/Contributors             *
- *****************************************************************************/
-
-/*****************************************************************************
- * Original Author:    contact address:                                      *
- *                                                                           *
- * Creation Date  :                                                          *
- * Last update    :                                                          *
- *---------------------------------------------------------------------------*
- * Decription:                                                               *
- *                                                                           *
- *                                                                           *
- *---------------------------------------------------------------------------*
- * Comment:                                                                  *
- *                                                                           *
- *****************************************************************************/
-
-
-// Quelques constantes utiles ....
-// 
-// en MeV
-#define hbarc    197.
-
-// sans unite
-#define alpha    137.0359895
-
-// en MeV.c-2
-#define uma      931.49432
-
-// en mol-1
-#define Na       6.0221367e23
-
-// en m.s-1
-#define C        2.99792458e8
-
-// en MeV.T9-1
-#define kB       8.61735e-2
-
-// en C
-#define echarge	 1.602177e-19
-
-#endif
\ No newline at end of file
diff --git a/NPLib/Physics/NPBeam.cxx b/NPLib/Physics/NPBeam.cxx
index 3ad07979a..1bd2b7a3a 100644
--- a/NPLib/Physics/NPBeam.cxx
+++ b/NPLib/Physics/NPBeam.cxx
@@ -39,8 +39,11 @@
 #include "TDirectory.h"
 
 // Use CLHEP System of unit and Physical Constant
-#include "CLHEP/Units/GlobalSystemOfUnits.h"
-#include "CLHEP/Units/PhysicalConstants.h"
+//#include "CLHEP/Units/GlobalSystemOfUnits.h"
+//#include "CLHEP/Units/PhysicalConstants.h"
+#include "NPGlobalSystemOfUnits.h"
+#include "NPPhysicalConstants.h"
+using namespace NPUNITS;
 
 using namespace NPL;
 
diff --git a/NPLib/Physics/NPEnergyLoss.h b/NPLib/Physics/NPEnergyLoss.h
index f6810beec..49ec4322c 100644
--- a/NPLib/Physics/NPEnergyLoss.h
+++ b/NPLib/Physics/NPEnergyLoss.h
@@ -40,9 +40,12 @@ using namespace std ;
 //#include "TObject.h"
 
 // Use CLHEP System of unit and Physical Constant
-#include "CLHEP/Units/GlobalSystemOfUnits.h"
-#include "CLHEP/Units/PhysicalConstants.h"
-using namespace CLHEP ;
+//#include "CLHEP/Units/GlobalSystemOfUnits.h"
+//#include "CLHEP/Units/PhysicalConstants.h"
+//using namespace CLHEP ;
+#include "NPGlobalSystemOfUnits.h"
+#include "NPPhysicalConstants.h"
+using namespace NPUNITS;
 
 // ROOT
 #include "Math/InterpolationTypes.h"
diff --git a/NPLib/Physics/NPGlobalSystemOfUnits.h b/NPLib/Physics/NPGlobalSystemOfUnits.h
new file mode 100644
index 000000000..a8b4cc2c7
--- /dev/null
+++ b/NPLib/Physics/NPGlobalSystemOfUnits.h
@@ -0,0 +1,118 @@
+
+#include "NPSystemOfUnits.h"
+
+using NPUNITS::millimeter;
+using NPUNITS::millimeter2;
+using NPUNITS::millimeter3;
+using NPUNITS::centimeter;
+using NPUNITS::centimeter2;
+using NPUNITS::centimeter3;
+using NPUNITS::meter;
+using NPUNITS::meter2;
+using NPUNITS::meter3;
+using NPUNITS::kilometer;
+using NPUNITS::kilometer2;
+using NPUNITS::kilometer3;
+using NPUNITS::parsec;
+using NPUNITS::micrometer;
+using NPUNITS::nanometer;
+using NPUNITS::angstrom;
+using NPUNITS::fermi;
+using NPUNITS::barn;
+using NPUNITS::millibarn;
+using NPUNITS::microbarn;
+using NPUNITS::nanobarn;
+using NPUNITS::picobarn;
+using NPUNITS::mm;
+using NPUNITS::um;
+using NPUNITS::nm;
+using NPUNITS::mm2;
+using NPUNITS::mm3;
+using NPUNITS::cm;
+using NPUNITS::cm2;
+using NPUNITS::cm3;
+using NPUNITS::m;
+using NPUNITS::m2;
+using NPUNITS::m3;
+using NPUNITS::km;
+using NPUNITS::km2;
+using NPUNITS::km3;
+using NPUNITS::pc;
+using NPUNITS::radian;
+using NPUNITS::milliradian;
+using NPUNITS::degree;
+using NPUNITS::steradian;
+using NPUNITS::rad;
+using NPUNITS::mrad;
+using NPUNITS::sr;
+using NPUNITS::deg;
+using NPUNITS::nanosecond;
+using NPUNITS::second;
+using NPUNITS::millisecond;
+using NPUNITS::microsecond;
+using NPUNITS::picosecond;
+using NPUNITS::hertz;
+using NPUNITS::kilohertz;
+using NPUNITS::megahertz;
+using NPUNITS::ns;
+using NPUNITS::s;
+using NPUNITS::ms;
+using NPUNITS::eplus;
+using NPUNITS::e_SI;
+using NPUNITS::coulomb;
+using NPUNITS::megaelectronvolt;
+using NPUNITS::electronvolt;
+using NPUNITS::kiloelectronvolt;
+using NPUNITS::gigaelectronvolt;
+using NPUNITS::teraelectronvolt;
+using NPUNITS::petaelectronvolt;
+using NPUNITS::joule;
+using NPUNITS::MeV;
+using NPUNITS::eV;
+using NPUNITS::keV;
+using NPUNITS::GeV;
+using NPUNITS::TeV;
+using NPUNITS::PeV;
+using NPUNITS::kilogram;
+using NPUNITS::gram;
+using NPUNITS::milligram;
+using NPUNITS::kg;
+using NPUNITS::g;
+using NPUNITS::mg;
+using NPUNITS::watt;
+using NPUNITS::newton;
+using NPUNITS::hep_pascal;
+using NPUNITS::bar;
+using NPUNITS::atmosphere;
+using NPUNITS::ampere;
+using NPUNITS::milliampere;
+using NPUNITS::microampere;
+using NPUNITS::nanoampere;
+using NPUNITS::megavolt;
+using NPUNITS::kilovolt;
+using NPUNITS::volt;
+using NPUNITS::ohm;
+using NPUNITS::farad;
+using NPUNITS::millifarad;
+using NPUNITS::microfarad;
+using NPUNITS::nanofarad;
+using NPUNITS::picofarad;
+using NPUNITS::weber;
+using NPUNITS::tesla;
+using NPUNITS::gauss;
+using NPUNITS::kilogauss;
+using NPUNITS::henry;
+using NPUNITS::kelvin;
+using NPUNITS::mole;
+using NPUNITS::becquerel;
+using NPUNITS::curie;
+using NPUNITS::gray;
+using NPUNITS::kilogray;
+using NPUNITS::milligray;
+using NPUNITS::microgray;
+using NPUNITS::candela;
+using NPUNITS::lumen;
+using NPUNITS::lux;
+using NPUNITS::perCent;
+using NPUNITS::perThousand;
+using NPUNITS::perMillion;
diff --git a/NPLib/Physics/NPNucleus.cxx b/NPLib/Physics/NPNucleus.cxx
index 093effe98..1bc6f7f6d 100644
--- a/NPLib/Physics/NPNucleus.cxx
+++ b/NPLib/Physics/NPNucleus.cxx
@@ -21,26 +21,29 @@
  *                                                                           *
  *****************************************************************************/
 
+// NPTOOL headers
+#include "NPNucleus.h"
+using namespace NPL;
+//#include "Constant.h"
+
+// Use CLHEP System of unit and Physical Constant
+//#include "CLHEP/Units/GlobalSystemOfUnits.h"
+//#include "CLHEP/Units/PhysicalConstants.h"
+#include "NPGlobalSystemOfUnits.h"
+#include "NPPhysicalConstants.h"
+using namespace NPUNITS;
+
 // C++ headers
 #include <iostream>
 #include <fstream>
 #include <string>
 #include <cstdlib>
 #include <sstream>
-//#include <stdlib.h>
 #include <cmath>
 #include <vector>
+using namespace std;
 
 
-#include "NPNucleus.h"
-#include "Constant.h"
-
-// Use CLHEP System of unit and Physical Constant
-//#include "CLHEP/Units/GlobalSystemOfUnits.h"
-//#include "CLHEP/Units/PhysicalConstants.h"
-
-using namespace std;
-using namespace NPL;
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 
 Nucleus::Nucleus()
@@ -206,28 +209,28 @@ fNucleusName=string(fName,6);
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 
 void Nucleus::EnergyToBrho()
 {
-	fBrho = sqrt(pow(fKineticEnergy,2) + 2*fKineticEnergy*Mass()) * 1e6 * echarge / C / (GetZ() * echarge);
+	fBrho = sqrt(pow(fKineticEnergy,2) + 2*fKineticEnergy*Mass()) * 1e6 * e_SI / (c_light*1e6) / (GetZ() * e_SI);
 }
 
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 
 void Nucleus::EnergyToTof() // second/meter
 {
-	fTimeOfFlight = 1/sqrt(1-(Mass()*Mass())/(fKineticEnergy+Mass())/(fKineticEnergy+Mass()))/C;
+	fTimeOfFlight = 1/sqrt(1-(Mass()*Mass())/(fKineticEnergy+Mass())/(fKineticEnergy+Mass()))/(c_light*1e6);
 }
 
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 
 void Nucleus::TofToEnergy() 
 {
-	double Energy =  sqrt( Mass()*Mass()/(1-pow((1/(C*fTimeOfFlight)),2)) );
+	double Energy =  sqrt( Mass()*Mass()/(1-pow((1/((c_light*1e6)*fTimeOfFlight)),2)) );
 	fKineticEnergy = Energy - Mass();
 }
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 
 void Nucleus::BrhoToEnergy()
 {
-	fKineticEnergy =  sqrt( pow((fBrho*C*GetZ()*echarge)/(1e6*echarge),2) + pow(Mass(),2) ) - Mass();
+	fKineticEnergy =  sqrt( pow((fBrho*(c_light*1e6)*GetZ()*e_SI)/(1e6*e_SI),2) + pow(Mass(),2) ) - Mass();
 }
 
 
@@ -252,7 +255,7 @@ void Nucleus::BetaToGamma()
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 
 void Nucleus::BetaToVelocity() // in cm/ns
 {
-	fVelocity = C*fBeta*1e-7;
+	fVelocity = (c_light*1e6)*fBeta*1e-7;
 }
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 
diff --git a/NPLib/Physics/NPNucleus.h b/NPLib/Physics/NPNucleus.h
index ea11608b4..8134522ad 100644
--- a/NPLib/Physics/NPNucleus.h
+++ b/NPLib/Physics/NPNucleus.h
@@ -22,9 +22,15 @@
  *                                                                           *
  *                                                                           *
  *****************************************************************************/
-#define uma      931.49432
-#include <string>
+// ROOT headers
 #include "TLorentzVector.h"
+
+// NPTOOL headers
+#include "NPPhysicalConstants.h"
+using namespace NPUNITS;
+
+// C++ headers
+#include <string>
 using namespace std;
 
 namespace NPL {
@@ -111,7 +117,7 @@ namespace NPL {
     void				SetBeta(double beta)					{fBeta = beta; BetaToGamma(); BetaToEnergy(); EnergyToTof(); EnergyToBrho();BetaToVelocity();}
     
     // Nuclear mass in MeV
-    double      Mass() const {return (fAtomicWeight*uma + fMassExcess/1000.);}
+    double      Mass() const {return (fAtomicWeight*amu_c2 + fMassExcess/1000.);}
     void        Print() const   ;
   };
 }
diff --git a/NPLib/Physics/NPPhysicalConstants.h b/NPLib/Physics/NPPhysicalConstants.h
new file mode 100644
index 000000000..9b5959e96
--- /dev/null
+++ b/NPLib/Physics/NPPhysicalConstants.h
@@ -0,0 +1,140 @@
+// -*- C++ -*-
+// $Id:$
+// ----------------------------------------------------------------------
+// HEP coherent Physical Constants
+//
+// This file has been provided by Geant4 (simulation toolkit for HEP).
+//
+// The basic units are :
+//  		millimeter  
+// 		nanosecond  
+// 		Mega electron Volt  
+// 		positon charge 
+// 		degree Kelvin
+//              amount of substance (mole)
+//              luminous intensity (candela)
+// 		radian  
+//              steradian 
+//
+// Below is a non exhaustive list of Physical CONSTANTS,
+// computed in the Internal HEP System Of Units.
+//
+// Most of them are extracted from the Particle Data Book :
+//        Phys. Rev. D  volume 50 3-1 (1994) page 1233
+// 
+//        ...with a meaningful (?) name ...
+//
+// You can add your own constants.
+//
+// Author: M.Maire
+//
+// History:
+//
+// 23.02.96 Created
+// 26.03.96 Added constants for standard conditions of temperature
+//          and pressure; also added Gas threshold.
+// 29.04.08   use PDG 2006 values
+// 03.11.08   use PDG 2008 values
+
+#ifndef HEP_PHYSICAL_CONSTANTS_H
+#define HEP_PHYSICAL_CONSTANTS_H
+
+#include "NPSystemOfUnits.h"
+
+namespace NPUNITS {
+
+//
+//
+//
+static const double     pi  = 3.14159265358979323846;
+static const double  twopi  = 2*pi;
+static const double halfpi  = pi/2;
+static const double     pi2 = pi*pi;
+
+//
+// 
+//
+static const double Avogadro = 6.02214179e+23/mole;
+
+//
+// c   = 299.792458 mm/ns
+// c^2 = 898.7404 (mm/ns)^2 
+//
+static const double c_light   = 2.99792458e+8 * m/s;
+static const double c_squared = c_light * c_light;
+
+//
+// h     = 4.13566e-12 MeV*ns
+// hbar  = 6.58212e-13 MeV*ns
+// hbarc = 197.32705e-12 MeV*mm
+//
+static const double h_Planck      = 6.62606896e-34 * joule*s;
+static const double hbar_Planck   = h_Planck/twopi;
+static const double hbarc         = hbar_Planck * c_light;
+static const double hbarc_squared = hbarc * hbarc;
+
+//
+//
+//
+static const double electron_charge = - eplus; // see SystemOfUnits.h
+static const double e_squared = eplus * eplus;
+
+//
+// amu_c2 - atomic equivalent mass unit
+//        - AKA, unified atomic mass unit (u)
+// amu    - atomic mass unit
+//
+static const double electron_mass_c2 = 0.510998910 * MeV;
+static const double   proton_mass_c2 = 938.272013 * MeV;
+static const double  neutron_mass_c2 = 939.56536 * MeV;
+static const double           amu_c2 = 931.494028 * MeV;
+static const double              amu = amu_c2/c_squared;
+
+//
+// permeability of free space mu0    = 2.01334e-16 Mev*(ns*eplus)^2/mm
+// permittivity of free space epsil0 = 5.52636e+10 eplus^2/(MeV*mm)
+//
+static const double mu0      = 4*pi*1.e-7 * henry/m;
+static const double epsilon0 = 1./(c_squared*mu0);
+
+//
+// electromagnetic coupling = 1.43996e-12 MeV*mm/(eplus^2)
+//
+static const double elm_coupling           = e_squared/(4*pi*epsilon0);
+static const double fine_structure_const   = elm_coupling/hbarc;
+static const double classic_electr_radius  = elm_coupling/electron_mass_c2;
+static const double electron_Compton_length = hbarc/electron_mass_c2;
+static const double Bohr_radius = electron_Compton_length/fine_structure_const;
+
+static const double alpha_rcl2 = fine_structure_const
+                                   *classic_electr_radius
+                                   *classic_electr_radius;
+
+static const double twopi_mc2_rcl2 = twopi*electron_mass_c2
+                                             *classic_electr_radius
+                                             *classic_electr_radius;
+//
+//
+//
+static const double k_Boltzmann = 8.617343e-11 * MeV/kelvin;
+
+//
+//
+//
+static const double STP_Temperature = 273.15*kelvin;
+static const double STP_Pressure    = 1.*atmosphere;
+static const double kGasThreshold   = 10.*mg/cm3;
+
+//
+//
+//
+static const double universe_mean_density = 1.e-25*g/cm3;
+
+}  // namespace NPUNITS
+
+#endif /* HEP_PHYSICAL_CONSTANTS_H */
+
+
+
+
+
diff --git a/NPLib/Physics/NPReaction.cxx b/NPLib/Physics/NPReaction.cxx
index 1b06f63ff..637ac5f33 100644
--- a/NPLib/Physics/NPReaction.cxx
+++ b/NPLib/Physics/NPReaction.cxx
@@ -46,8 +46,12 @@
 #include "NPFunction.h"
 
 // Use CLHEP System of unit and Physical Constant
-#include "CLHEP/Units/GlobalSystemOfUnits.h"
-#include "CLHEP/Units/PhysicalConstants.h"
+//#include "CLHEP/Units/GlobalSystemOfUnits.h"
+//#include "CLHEP/Units/PhysicalConstants.h"
+#include "NPGlobalSystemOfUnits.h"
+#include "NPPhysicalConstants.h"
+using namespace NPUNITS;
+
 ClassImp(Reaction)
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/NPLib/Physics/NPSystemOfUnits.h b/NPLib/Physics/NPSystemOfUnits.h
new file mode 100644
index 000000000..f15152b04
--- /dev/null
+++ b/NPLib/Physics/NPSystemOfUnits.h
@@ -0,0 +1,289 @@
+// -*- C++ -*-
+// $Id:$
+// ----------------------------------------------------------------------
+// HEP coherent system of Units
+//
+// This file has been provided to CLHEP by Geant4 (simulation toolkit for HEP).
+//
+// The basic units are :
+// millimeter              (millimeter)
+// nanosecond              (nanosecond)
+// Mega electron Volt      (MeV)
+// positron charge         (eplus)
+// degree Kelvin           (kelvin)
+// the amount of substance (mole)
+// luminous intensity      (candela)
+// radian                  (radian)
+// steradian               (steradian)
+//
+// Below is a non exhaustive list of derived and pratical units
+// (i.e. mostly the SI units).
+// You can add your own units.
+//
+// The SI numerical value of the positron charge is defined here,
+// as it is needed for conversion factor : positron charge = e_SI (coulomb)
+//
+// The others physical constants are defined in the header file :
+//PhysicalConstants.h
+//
+// Authors: M.Maire, S.Giani
+//
+// History:
+//
+// 06.02.96   Created.
+// 28.03.96   Added miscellaneous constants.
+// 05.12.97   E.Tcherniaev: Redefined pascal (to avoid warnings on WinNT)
+// 20.05.98   names: meter, second, gram, radian, degree
+//            (from Brian.Lasiuk@yale.edu (STAR)). Added luminous units.
+// 05.08.98   angstrom, picobarn, microsecond, picosecond, petaelectronvolt
+// 01.03.01   parsec    
+// 31.01.06   kilogray, milligray, microgray    
+// 29.04.08   use PDG 2006 value of e_SI
+// 03.11.08   use PDG 2008 value of e_SI
+
+#ifndef HEP_SYSTEM_OF_UNITS_H
+#define HEP_SYSTEM_OF_UNITS_H
+
+namespace NPUNITS {
+
+  // 
+  // Length [L]
+  //
+  static const double millimeter  = 1.;                        
+  static const double millimeter2 = millimeter*millimeter;
+  static const double millimeter3 = millimeter*millimeter*millimeter;
+
+  static const double centimeter  = 10.*millimeter;   
+  static const double centimeter2 = centimeter*centimeter;
+  static const double centimeter3 = centimeter*centimeter*centimeter;
+
+  static const double meter  = 1000.*millimeter;                  
+  static const double meter2 = meter*meter;
+  static const double meter3 = meter*meter*meter;
+
+  static const double kilometer = 1000.*meter;                   
+  static const double kilometer2 = kilometer*kilometer;
+  static const double kilometer3 = kilometer*kilometer*kilometer;
+
+  static const double parsec = 3.0856775807e+16*meter;
+
+  static const double micrometer = 1.e-6 *meter;             
+  static const double  nanometer = 1.e-9 *meter;
+  static const double  angstrom  = 1.e-10*meter;
+  static const double  fermi     = 1.e-15*meter;
+
+  static const double      barn = 1.e-28*meter2;
+  static const double millibarn = 1.e-3 *barn;
+  static const double microbarn = 1.e-6 *barn;
+  static const double  nanobarn = 1.e-9 *barn;
+  static const double  picobarn = 1.e-12*barn;
+
+  // symbols
+  static const double nm  = nanometer;                        
+  static const double um  = micrometer;                        
+
+  static const double mm  = millimeter;                        
+  static const double mm2 = millimeter2;
+  static const double mm3 = millimeter3;
+
+  static const double cm  = centimeter;   
+  static const double cm2 = centimeter2;
+  static const double cm3 = centimeter3;
+
+  static const double m  = meter;                  
+  static const double m2 = meter2;
+  static const double m3 = meter3;
+
+  static const double km  = kilometer;                   
+  static const double km2 = kilometer2;
+  static const double km3 = kilometer3;
+
+  static const double pc = parsec;
+
+  //
+  // Angle
+  //
+  static const double radian      = 1.;                  
+  static const double milliradian = 1.e-3*radian;
+  static const double degree = (3.14159265358979323846/180.0)*radian;
+
+  static const double   steradian = 1.;
+  
+  // symbols
+  static const double rad  = radian;
+  static const double mrad = milliradian;
+  static const double sr   = steradian;
+  static const double deg  = degree;
+
+  //
+  // Time [T]
+  //
+  static const double nanosecond  = 1.;
+  static const double second      = 1.e+9 *nanosecond;
+  static const double millisecond = 1.e-3 *second;
+  static const double microsecond = 1.e-6 *second;
+  static const double  picosecond = 1.e-12*second;
+
+  static const double hertz = 1./second;
+  static const double kilohertz = 1.e+3*hertz;
+  static const double megahertz = 1.e+6*hertz;
+
+  // symbols
+  static const double ns = nanosecond;
+  static const double  s = second;
+  static const double ms = millisecond;
+
+  //
+  // Electric charge [Q]
+  //
+  static const double eplus = 1. ;// positron charge
+  static const double e_SI  = 1.602176487e-19;// positron charge in coulomb
+  static const double coulomb = eplus/e_SI;// coulomb = 6.24150 e+18 * eplus
+
+  //
+  // Energy [E]
+  //
+  static const double megaelectronvolt = 1. ;
+  static const double     electronvolt = 1.e-6*megaelectronvolt;
+  static const double kiloelectronvolt = 1.e-3*megaelectronvolt;
+  static const double gigaelectronvolt = 1.e+3*megaelectronvolt;
+  static const double teraelectronvolt = 1.e+6*megaelectronvolt;
+  static const double petaelectronvolt = 1.e+9*megaelectronvolt;
+
+  static const double joule = electronvolt/e_SI;// joule = 6.24150 e+12 * MeV
+
+  // symbols
+  static const double MeV = megaelectronvolt;
+  static const double  eV = electronvolt;
+  static const double keV = kiloelectronvolt;
+  static const double GeV = gigaelectronvolt;
+  static const double TeV = teraelectronvolt;
+  static const double PeV = petaelectronvolt;
+
+  //
+  // Mass [E][T^2][L^-2]
+  //
+  static const double  kilogram = joule*second*second/(meter*meter);   
+  static const double      gram = 1.e-3*kilogram;
+  static const double milligram = 1.e-3*gram;
+
+  // symbols
+  static const double  kg = kilogram;
+  static const double   g = gram;
+  static const double  mg = milligram;
+
+  //
+  // Power [E][T^-1]
+  //
+  static const double watt = joule/second;// watt = 6.24150 e+3 * MeV/ns
+
+  //
+  // Force [E][L^-1]
+  //
+  static const double newton = joule/meter;// newton = 6.24150 e+9 * MeV/mm
+
+  //
+  // Pressure [E][L^-3]
+  //
+//#define pascal hep_pascal                          // a trick to avoid warnings 
+  static const double hep_pascal = newton/m2;   // pascal = 6.24150 e+3 * MeV/mm3
+  static const double pascal     = newton/m2;   // pascal = 6.24150 e+3 * MeV/mm3
+  static const double bar        = 100000*pascal; // bar    = 6.24150 e+8 * MeV/mm3
+  static const double atmosphere = 101325*pascal; // atm    = 6.32420 e+8 * MeV/mm3
+
+  //
+  // Electric current [Q][T^-1]
+  //
+  static const double      ampere = coulomb/second; // ampere = 6.24150 e+9 * eplus/ns
+  static const double milliampere = 1.e-3*ampere;
+  static const double microampere = 1.e-6*ampere;
+  static const double  nanoampere = 1.e-9*ampere;
+
+  //
+  // Electric potential [E][Q^-1]
+  //
+  static const double megavolt = megaelectronvolt/eplus;
+  static const double kilovolt = 1.e-3*megavolt;
+  static const double     volt = 1.e-6*megavolt;
+
+  //
+  // Electric resistance [E][T][Q^-2]
+  //
+  static const double ohm = volt/ampere;// ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns)
+
+  //
+  // Electric capacitance [Q^2][E^-1]
+  //
+  static const double farad = coulomb/volt;// farad = 6.24150e+24 * eplus/Megavolt
+  static const double millifarad = 1.e-3*farad;
+  static const double microfarad = 1.e-6*farad;
+  static const double  nanofarad = 1.e-9*farad;
+  static const double  picofarad = 1.e-12*farad;
+
+  //
+  // Magnetic Flux [T][E][Q^-1]
+  //
+  static const double weber = volt*second;// weber = 1000*megavolt*ns
+
+  //
+  // Magnetic Field [T][E][Q^-1][L^-2]
+  //
+  static const double tesla     = volt*second/meter2;// tesla =0.001*megavolt*ns/mm2
+
+  static const double gauss     = 1.e-4*tesla;
+  static const double kilogauss = 1.e-1*tesla;
+
+  //
+  // Inductance [T^2][E][Q^-2]
+  //
+  static const double henry = weber/ampere;// henry = 1.60217e-7*MeV*(ns/eplus)**2
+
+  //
+  // Temperature
+  //
+  static const double kelvin = 1.;
+
+  //
+  // Amount of substance
+  //
+  static const double mole = 1.;
+
+  //
+  // Activity [T^-1]
+  //
+  static const double becquerel = 1./second ;
+  static const double curie = 3.7e+10 * becquerel;
+
+  //
+  // Absorbed dose [L^2][T^-2]
+  //
+  static const double      gray = joule/kilogram ;
+  static const double  kilogray = 1.e+3*gray;
+  static const double milligray = 1.e-3*gray;
+  static const double microgray = 1.e-6*gray;
+
+  //
+  // Luminous intensity [I]
+  //
+  static const double candela = 1.;
+
+  //
+  // Luminous flux [I]
+  //
+  static const double lumen = candela*steradian;
+
+  //
+  // Illuminance [I][L^-2]
+  //
+  static const double lux = lumen/meter2;
+
+  //
+  // Miscellaneous
+  //
+  static const double perCent     = 0.01 ;
+  static const double perThousand = 0.001;
+  static const double perMillion  = 0.000001;
+
+}  // namespace NPUNITS
+
+#endif /* HEP_SYSTEM_OF_UNITS_H */
-- 
GitLab