QwAnalysis
Qw Namespace Reference

Enumerations

enum  EQwColor {
  kBlack, kRed, kGreen, kBrown,
  kBlue, kMagenta, kCyan, kWhite,
  kDefaultForeground, kBold, kBoldRed, kBoldGreen,
  kBoldBrown, kBoldBlue, kBoldMagenta, kBoldCyan,
  kBoldWhite, kBackRed, kBackGreen, kBackBlue,
  kDefaultBackground, kNormal
}
 

Variables

static const double cm = 1.0
 Length units: base unit is mm. More...
 
static const double mm = 0.1 * cm
 
static const double m = 1.0e2 * cm
 
static const double km = 1.0e3 * m
 
static const double in = 2.54 * cm
 
static const double mil = 0.001 * in
 
static const double ms = 1.0
 Time units: base unit is ms. More...
 
static const double us = 1.0e-3 * ms
 
static const double ns = 1.0e-6 * ms
 
static const double sec = 1.0e3 * ms
 
static const double min = 60.0 * sec
 
static const double hour = 60.0 * min
 
static const double day = 24.0 * hour
 
static const double Hz = 1.0 / sec
 Frequency units: base unit is kHz. More...
 
static const double kHz = 1.0 / ms
 
static const double MHz = 1.0e3 * kHz
 
static const double V = 1.0
 Energy: base unit is MeV. More...
 
static const double e = 1.0e-6
 
static const double eV = 1.0e-6
 
static const double keV = 1.0e-3
 
static const double MeV = 1.0
 
static const double GeV = 1.0e3
 
static const double MeV2 = MeV * MeV
 
static const double GeV2 = GeV * GeV
 
static const double pi = 3.14159265
 Angles: base unit is radian. More...
 
static const double deg2rad = pi / 180.0
 
static const double rad2deg = 180.0 / pi
 
static const double rad = 1.0
 
static const double deg = deg2rad
 
static const double T = V * sec / (m * m)
 Magnetic field: base unit is T. More...
 
static const double G = 1.0e-4 * T
 
static const double kG = 1.0e3 * G
 
static const double c = 299792458. * m / sec
 Physical constants. More...
 
static const double Mp = 938.272013 * MeV
 Mass of the proton. More...
 

Detailed Description

Units in the QwAnalysis framework

As more and more analyzers start contributing code to the Qweak analysis code, it is important to use some conventions to avoid confusion. One of the conventions is the use of a standard system of coordinates. The other is a unified set of units. This way we will avoid errors when angles are not converted from degrees to radians, or centimeters and inches are in mixed up.

The basic units in the QwAnalysis framework are:

  • Length: cm
  • Time: ms
  • Energy: MeV
  • Angles: rad
  • Magnetic field: T

How are these units to be used? Any variable that is being used inside subsystems and especially when passing information to other subsystems should have values in these units.

This does not mean that every single constant has to be defined in these units, or that output has to use these units. A set of conversion constants is defined to make life easier.

Take as an example the magnetic field map. The values stored in the map file by the external program are in kG. To convert those values, we would write:

* double bx, by, bz;
* mapfile >> bx >> by >> bz; // read values
* bx *= Qw::kG; by *= Qw::kG; bz *= Qw::kG; // define the units (kG)
*

From now on, the values in bx, by, bz are in standard Qweak units (T). To write out the values in Gauss we write:

* cout << bx/Qw::G << "," << by/Qw::G << "," << bz/Qw::G << " G" << endl;
*

For Tesla we would write

* cout << bx/Qw::T << "," << by/Qw::T << "," << bz/Qw::T << " T" << endl;
*

If there are hard-coded values in the analyzer (which should be avoided), we should use these units to define them:

* const double position_r3 = 398.8 * Qw::cm;
* const double helicity_window = 1.0 * Qw::ms;
* const double noise_frequency = 60.0 * Qw::Hz;
*

Enumeration Type Documentation

Enumerator
kBlack 
kRed 
kGreen 
kBrown 
kBlue 
kMagenta 
kCyan 
kWhite 
kDefaultForeground 
kBold 
kBoldRed 
kBoldGreen 
kBoldBrown 
kBoldBlue 
kBoldMagenta 
kBoldCyan 
kBoldWhite 
kBackRed 
kBackGreen 
kBackBlue 
kDefaultBackground 
kNormal 

Definition at line 72 of file QwColor.h.

Variable Documentation

const double Qw::c = 299792458. * m / sec
static

Physical constants.

Speed of light

Definition at line 118 of file QwUnits.h.

Referenced by DrawTreeLineVDC(), QwTrackingTreeSort::globalconnectiv(), and QwRayTracer::IntegrateRK().

const double Qw::day = 24.0 * hour
static

Definition at line 78 of file QwUnits.h.

const double Qw::deg2rad = pi / 180.0
static

Definition at line 103 of file QwUnits.h.

const double Qw::eV = 1.0e-6
static

Definition at line 92 of file QwUnits.h.

const double Qw::G = 1.0e-4 * T
static
const double Qw::GeV2 = GeV * GeV
static

Definition at line 97 of file QwUnits.h.

Referenced by QwEvent::CalculateKinematics(), and QwTreeEventBuffer::GetSpecificEvent().

const double Qw::hour = 60.0 * min
static

Definition at line 77 of file QwUnits.h.

Referenced by main().

const double Qw::Hz = 1.0 / sec
static

Frequency units: base unit is kHz.

Definition at line 83 of file QwUnits.h.

Referenced by main().

const double Qw::keV = 1.0e-3
static

Definition at line 93 of file QwUnits.h.

const double Qw::kG = 1.0e3 * G
static
const double Qw::kHz = 1.0 / ms
static

Definition at line 84 of file QwUnits.h.

const double Qw::km = 1.0e3 * m
static

Definition at line 64 of file QwUnits.h.

const double Qw::MeV2 = MeV * MeV
static

Definition at line 96 of file QwUnits.h.

const double Qw::MHz = 1.0e3 * kHz
static

Definition at line 85 of file QwUnits.h.

const double Qw::mil = 0.001 * in
static

Definition at line 67 of file QwUnits.h.

const double Qw::mm = 0.1 * cm
static

Definition at line 62 of file QwUnits.h.

const double Qw::Mp = 938.272013 * MeV
static
const double Qw::ms = 1.0
static

Time units: base unit is ms.

Definition at line 72 of file QwUnits.h.

Referenced by QwParameterFile::GetParameterFileContents(), and main().

const double Qw::ns = 1.0e-6 * ms
static

Definition at line 74 of file QwUnits.h.

const double Qw::rad2deg = 180.0 / pi
static

Definition at line 104 of file QwUnits.h.

const double Qw::sec = 1.0e3 * ms
static

Definition at line 75 of file QwUnits.h.

Referenced by main().

const double Qw::us = 1.0e-3 * ms
static

Definition at line 73 of file QwUnits.h.

const double Qw::V = 1.0
static

Energy: base unit is MeV.

Definition at line 90 of file QwUnits.h.