Auxiliary program to convert PMT QE(angle) data.
20{
22
23 string inputFile;
25
26 try {
27
28 JParser<> zap(
"Auxiliary program to convert PMT QE(angle) data.");
29
32
33 zap(argc, argv);
34 }
35 catch(const exception &error) {
36 FATAL(error.what() << endl);
37 }
38
39
40 const string DEG("deg");
41
42
43 if (inputFile != "") {
44
45 ifstream in(inputFile.c_str());
46
47 while (in.peek() == '#') {
48 in.ignore(numeric_limits<streamsize>::max(), '\n');
49 }
50
51
52
55
57
59
60 istringstream is(buffer);
61
63
64 for (
double x; is >>
x; ) {
65 energy.push_back(x);
66 }
67 }
68
70
71 istringstream is(buffer);
72
74
75 for (
double x; is >>
x; ) {
76 wavelength.push_back(x);
77 }
78 }
79
80
81
82
83
84
86
87 istringstream is(buffer);
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103 double ct;
104
105 is >> ct;
106
107
108
109 size_t i = 0;
110
111 for (
double y ; is >>
y; ++i) {
112
113 if (i != energy.size()) {
114 cout << " (*this)"
115 << noshowpos
116
117
118 <<
"[" <<
FIXED(5,2) << -ct <<
"]"
119 <<
"[" <<
FIXED(3,1) << wavelength[i] <<
"]"
120 << " = "
121 << showpos
123 << ";" << endl;
124 } else {
125
126 FATAL(
"Inconsistent data " << i <<
" != " << wavelength.size() << endl);
127 }
128 }
129
130 if (i != energy.size()) {
131
132 FATAL(
"Inconsistent data " << i <<
" != " << wavelength.size() << endl);
133 }
134 }
135
136 in.close();
137 }
138}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Auxiliary data structure for floating point format specification.