HighLAND
psyche
psycheCore
v3r12
src
UnitsParser.hxx
1
#ifndef UnitsParser_h
2
#define UnitsParser_h
3
#include "TString.h"
4
#include <iostream>
5
#include <string>
6
#include <fstream>
7
#include <map>
8
9
/// This class provides a method for converting a
10
/// string like "1.5 cm" into a double with the
11
/// appropriate unit. To do so it defines a set
12
/// of units, using the same base units as in
13
/// oaEvent/src/HEPUnits.hxx: ie mm, ns, MeV...
14
/// Only a fairly limited set of units is defined.
15
class
UnitsParser
{
16
17
public
:
18
19
/// Constructor that creates the list of units.
20
/// Try not to call this too often.
21
UnitsParser
();
22
~
UnitsParser
();
23
24
/// Converts a string like "1.5 cm" into a double
25
/// with the appropriate units.
26
std::string
Convert2DoubleWithUnit
(std::string line);
27
28
/// Prints all the defined units.
29
void
PrintListOfUnits
();
30
31
private
:
32
33
/// Internal map of unit ==> conversion factor.
34
std::map<std::string, double>
units
;
35
};
36
37
#endif
UnitsParser::Convert2DoubleWithUnit
std::string Convert2DoubleWithUnit(std::string line)
Definition:
UnitsParser.cxx:159
UnitsParser::UnitsParser
UnitsParser()
Definition:
UnitsParser.cxx:8
units
Definition:
HEPConstants.cxx:4
UnitsParser::PrintListOfUnits
void PrintListOfUnits()
Prints all the defined units.
Definition:
UnitsParser.cxx:185
UnitsParser
Definition:
UnitsParser.hxx:15
Generated by
1.8.13