JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
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 mm = 1.0
 Length units: base unit is mm.
 
static const double um = 1.0e-3 * mm
 
static const double cm = 1.0e1 * mm
 
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.
 
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.
 
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.
 
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.
 
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.
 
static const double G = 1.0e-4 * T
 
static const double kG = 1.0e3 * G
 
static const double uA = 1.0
 Beam current: base unit is microamp.
 
static const double V_uA = V/uA
 Signal levels: base unit is volt, and is already defined above.
 
static const double mV_uA = 1.0e-3 * V_uA
 Signal volts per microamp.
 
static const double c = 299792458. * m / sec
 Physical constants.
 
static const double Mp = 938.272013 * MeV
 Mass of the proton.
 
static const double ppm =1e-6
 
static const double ppb =1e-9
 

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)
static const double kG
Definition QwUnits.h:118

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;
static const double G
Definition QwUnits.h:117

For Tesla we would write

cout << bx/Qw::T << "," << by/Qw::T << "," << bz/Qw::T << " T" << endl;
static const double T
Magnetic field: base unit is T.
Definition QwUnits.h:116

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;
static const double ms
Time units: base unit is ms.
Definition QwUnits.h:77
static const double Hz
Frequency units: base unit is kHz.
Definition QwUnits.h:88
static const double cm
Definition QwUnits.h:67

Enumeration Type Documentation

◆ EQwColor

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 76 of file QwColor.h.

76 {
78 kBold,
82 };
@ kDefaultBackground
Definition QwColor.h:80
@ kWhite
Definition QwColor.h:77
@ kBackBlue
Definition QwColor.h:80
@ kCyan
Definition QwColor.h:77
@ kBold
Definition QwColor.h:78
@ kBoldCyan
Definition QwColor.h:79
@ kBrown
Definition QwColor.h:77
@ kBoldWhite
Definition QwColor.h:79
@ kBoldRed
Definition QwColor.h:79
@ kBoldGreen
Definition QwColor.h:79
@ kBoldBrown
Definition QwColor.h:79
@ kBoldBlue
Definition QwColor.h:79
@ kBoldMagenta
Definition QwColor.h:79
@ kBlue
Definition QwColor.h:77
@ kRed
Definition QwColor.h:77
@ kGreen
Definition QwColor.h:77
@ kDefaultForeground
Definition QwColor.h:77
@ kBackRed
Definition QwColor.h:80
@ kBackGreen
Definition QwColor.h:80
@ kBlack
Definition QwColor.h:77
@ kMagenta
Definition QwColor.h:77
@ kNormal
Definition QwColor.h:81

Variable Documentation

◆ c

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

Physical constants.

Speed of light

Definition at line 134 of file QwUnits.h.

◆ cm

const double Qw::cm = 1.0e1 * mm
static

Definition at line 67 of file QwUnits.h.

◆ day

const double Qw::day = 24.0 * hour
static

Definition at line 83 of file QwUnits.h.

◆ deg

const double Qw::deg = deg2rad
static

Definition at line 111 of file QwUnits.h.

◆ deg2rad

const double Qw::deg2rad = pi / 180.0
static

Definition at line 108 of file QwUnits.h.

◆ e

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

Definition at line 96 of file QwUnits.h.

◆ eV

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

Definition at line 97 of file QwUnits.h.

◆ G

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

Definition at line 117 of file QwUnits.h.

◆ GeV

const double Qw::GeV = 1.0e3
static

Definition at line 100 of file QwUnits.h.

◆ GeV2

const double Qw::GeV2 = GeV * GeV
static

Definition at line 102 of file QwUnits.h.

◆ hour

const double Qw::hour = 60.0 * min
static

Definition at line 82 of file QwUnits.h.

◆ Hz

const double Qw::Hz = 1.0 / sec
static

Frequency units: base unit is kHz.

Definition at line 88 of file QwUnits.h.

Referenced by MQwMockable::LoadMockDataParameters().

◆ in

const double Qw::in = 2.54 * cm
static

Definition at line 71 of file QwUnits.h.

◆ keV

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

Definition at line 98 of file QwUnits.h.

◆ kG

const double Qw::kG = 1.0e3 * G
static

Definition at line 118 of file QwUnits.h.

◆ kHz

const double Qw::kHz = 1.0 / ms
static

Definition at line 89 of file QwUnits.h.

◆ km

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

Definition at line 69 of file QwUnits.h.

◆ m

const double Qw::m = 1.0e2 * cm
static

Definition at line 68 of file QwUnits.h.

◆ MeV

const double Qw::MeV = 1.0
static

Definition at line 99 of file QwUnits.h.

◆ MeV2

const double Qw::MeV2 = MeV * MeV
static

Definition at line 101 of file QwUnits.h.

◆ MHz

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

Definition at line 90 of file QwUnits.h.

◆ mil

const double Qw::mil = 0.001 * in
static

Definition at line 72 of file QwUnits.h.

◆ min

const double Qw::min = 60.0 * sec
static

Definition at line 81 of file QwUnits.h.

◆ mm

const double Qw::mm = 1.0
static

Length units: base unit is mm.

Definition at line 65 of file QwUnits.h.

Referenced by PromptSummaryElement::Set().

◆ Mp

const double Qw::Mp = 938.272013 * MeV
static

Mass of the proton.

Definition at line 135 of file QwUnits.h.

◆ ms

const double Qw::ms = 1.0
static

Time units: base unit is ms.

Definition at line 77 of file QwUnits.h.

Referenced by QwSubsystemArrayParity::LoadMockDataParameters().

◆ mV_uA

const double Qw::mV_uA = 1.0e-3 * V_uA
static

Signal volts per microamp.

Definition at line 129 of file QwUnits.h.

Referenced by PromptSummaryElement::Set().

◆ ns

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

Definition at line 79 of file QwUnits.h.

◆ pi

const double Qw::pi = 3.14159265
static

◆ ppb

const double Qw::ppb =1e-9
static

Definition at line 141 of file QwUnits.h.

◆ ppm

const double Qw::ppm =1e-6
static

Definition at line 140 of file QwUnits.h.

Referenced by PromptSummaryElement::Set().

◆ rad

const double Qw::rad = 1.0
static

Definition at line 110 of file QwUnits.h.

◆ rad2deg

const double Qw::rad2deg = 180.0 / pi
static

Definition at line 109 of file QwUnits.h.

◆ sec

◆ T

const double Qw::T = V * sec / (m * m)
static

Magnetic field: base unit is T.

Definition at line 116 of file QwUnits.h.

◆ uA

const double Qw::uA = 1.0
static

Beam current: base unit is microamp.

Definition at line 123 of file QwUnits.h.

Referenced by PromptSummaryElement::Set().

◆ um

const double Qw::um = 1.0e-3 * mm
static

Definition at line 66 of file QwUnits.h.

Referenced by PromptSummaryElement::Set().

◆ us

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

Definition at line 78 of file QwUnits.h.

◆ V

const double Qw::V = 1.0
static

Energy: base unit is MeV.

Definition at line 95 of file QwUnits.h.

◆ V_uA

const double Qw::V_uA = V/uA
static

Signal levels: base unit is volt, and is already defined above.

Signal volts per microamp

Definition at line 128 of file QwUnits.h.