20 int main(
int argc,
char* argv[])
26 isFortranFile = argv[1];
35 vector<int> labelVector;
36 vector<float> valueVector;
40 cout <<
"Read file created by TestMillePede." << endl;
43 vInput.open(
"shifts.txt");
44 if (!vInput.is_open()) {
45 cout <<
"Could not open the input file." << endl;
49 vInput >> label >> value;
53 labelVector.push_back(label);
54 valueVector.push_back(value);
60 cout <<
"Read file created by pede." << endl;
63 vInput.open(
"shifts.txt");
64 if (!vInput.is_open()) {
65 cout <<
"Could not open the input file." << endl;
69 vInput >> label >> value >> value2;
73 int label1 = 10 + label * 2;
74 labelVector.push_back(label1);
75 valueVector.push_back(value);
77 labelVector.push_back(label1);
78 valueVector.push_back(value2);
83 for (
int c = 0; c < (int)labelVector.size(); ++c) {
84 cout <<
"c, label,value:" << c <<
", " << labelVector[c] <<
", " << valueVector[c] << endl;
87 std::vector<int>::iterator result;
89 result = std::max_element(labelVector.begin(), labelVector.end());
91 int maxValue = *result;
93 float origShifts[maxValue + 1];
94 float recoShifts[maxValue + 1];
96 for (
int i = 0; i < maxValue + 1; ++i) {
101 for (
int i = 0; i < labelVector.size(); ++i) {
102 origShifts[labelVector[i]] = valueVector[i];
109 float dummy1, dummy2, dummy3, dummy4;
110 vInput1.open(
"millepede.res");
111 if (!vInput1.is_open()) {
112 cout <<
"Could not open the input file." << endl;
116 vInput1 >> label >> value >> dummy1 >> dummy2 >> dummy3;
117 if (!vInput1.good()) {
120 labelVector.push_back(label);
121 valueVector.push_back(value);
122 cout << label <<
", " << value << endl;
126 for (
int c = 0; c < (int)labelVector.size(); ++c) {
127 cout <<
"c, label,value:" << c <<
", " << labelVector[c] <<
", " << valueVector[c] << endl;
130 for (
int i = 0; i < labelVector.size(); ++i) {
131 recoShifts[labelVector[i]] = valueVector[i];
134 for (
int i = 0; i < labelVector.size(); ++i) {
135 recoShifts[labelVector[i]] = valueVector[i];
138 int numBadValues = 0;
142 for (
int i = 0; i < maxValue + 1; ++i) {
143 float diff = recoShifts[i] + origShifts[i];
144 float percent = fabs(diff / origShifts[i]) * 100;
146 cout << i <<
" : " << recoShifts[i] <<
", " << origShifts[i] <<
", " << diff <<
", " << percent << endl;
159 cout << numBadValues <<
" corrections with a deviation > 1%" << endl;
160 cout << percent2 <<
" corrections with a deviation > 2%" << endl;
161 cout << percent3 <<
" corrections with a deviation > 3%" << endl;
162 cout << percent4 <<
" corrections with a deviation > 4%" << endl;