1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
// COCOA class implementation file
//Id: GlobalOptionMgr.cc
//CAT: ALIUtils
//
// History: v1.0
// Pedro Arce
#include <fstream>
#include "Alignment/CocoaUtilities/interface/GlobalOptionMgr.h"
#include <iostream>
#include <iomanip>
#include "Alignment/CocoaUtilities/interface/ALIUtils.h"
#include "Alignment/CocoaUtilities/interface/ALIFileIn.h"
#include <cstdlib>
GlobalOptionMgr* GlobalOptionMgr::theInstance = nullptr;
GlobalOptionMgr* GlobalOptionMgr::getInstance() {
if (!theInstance) {
theInstance = new GlobalOptionMgr;
}
return theInstance;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void GlobalOptionMgr::setDefaultGlobalOptions() {
theGlobalOptions[ALIstring("report_verbose")] = 3;
theGlobalOptions[ALIstring("debug_verbose")] = 0;
// theGlobalOptions[ ALIstring("sparse") ] = 0;
theGlobalOptions[ALIstring("saveMatrices")] = 1;
// theGlobalOptions[ ALIstring("external_meas") ] = 0;
theGlobalOptions[ALIstring("calcul_type")] = 0;
theGlobalOptions[ALIstring("length_value_dimension")] = 0;
theGlobalOptions[ALIstring("length_error_dimension")] = 0;
theGlobalOptions[ALIstring("angle_value_dimension")] = 0;
theGlobalOptions[ALIstring("angle_error_dimension")] = 0;
theGlobalOptions[ALIstring("output_length_value_dimension")] = 0;
theGlobalOptions[ALIstring("output_length_error_dimension")] = 0;
theGlobalOptions[ALIstring("output_angle_value_dimension")] = 0;
theGlobalOptions[ALIstring("output_angle_error_dimension")] = 0;
theGlobalOptions[ALIstring("checkExtraEntries")] = 0;
theGlobalOptions[ALIstring("cms_link")] = 0;
theGlobalOptions[ALIstring("cms_link_halfplanes")] = 0;
theGlobalOptions[ALIstring("cms_link_method")] = 0;
theGlobalOptions[ALIstring("range_studies")] = 0;
theGlobalOptions[ALIstring("histograms")] = 0;
theGlobalOptions[ALIstring("onlyDeriv")] = 0;
theGlobalOptions[ALIstring("onlyFirstPropagation")] = 0;
theGlobalOptions[ALIstring("VisWriteVRML")] = 0;
theGlobalOptions[ALIstring("VisWriteIguana")] = 0;
theGlobalOptions[ALIstring("VisOnly")] = 0;
theGlobalOptions[ALIstring("VisWriteOptONames")] = 1;
theGlobalOptions[ALIstring("VisGlobalRotationX")] = 0.;
theGlobalOptions[ALIstring("VisGlobalRotationY")] = 0.;
theGlobalOptions[ALIstring("VisGlobalRotationZ")] = 0.;
theGlobalOptions[ALIstring("VisScale")] = 1.;
theGlobalOptions[ALIstring("tiltmeter_meas_value_dimension")] = 0;
theGlobalOptions[ALIstring("distancemeter_meas_value_dimension")] = 0;
theGlobalOptions[ALIstring("dumpDateInFittedEntries")] = 0;
theGlobalOptions[ALIstring("measurementErrorFromFile")] = 0;
theGlobalOptions[ALIstring("maxNoFitIterations")] = 50;
theGlobalOptions[ALIstring("fitQualityCut")] = 0.1;
theGlobalOptions[ALIstring("relativeFitQualityCut")] = 1.E-6;
theGlobalOptions[ALIstring("maxEvents")] = 1.E6;
//dimension factor to multiply the values in the files that give you the deviatin when traversing an ALMY. Files have numbers in microns, so it has to be 1 if 'length_value_dimension 2', 0.001 if 'length_value_dimension 1' (the same for angles)
theGlobalOptions[ALIstring("deviffValDimf")] = 1.;
theGlobalOptions[ALIstring("deviffAngDimf")] = 1.;
theGlobalOptions[ALIstring("rotateAroundLocal")] = 1;
theGlobalOptions[ALIstring("reportOutEntriesByShortName")] = 0;
theGlobalOptions[ALIstring("reportOutReadValue")] = 1;
theGlobalOptions[ALIstring("reportOutReadSigma")] = 1;
theGlobalOptions[ALIstring("reportOutReadQuality")] = 1;
theGlobalOptions[ALIstring("maxDeviDerivative")] = 1.E-6;
theGlobalOptions[ALIstring("stopAfter1stIteration")] = 0;
theGlobalOptions[ALIstring("calParamInyfMatrix")] = 0;
theGlobalOptions[ALIstring("writeXML")] = 1;
theGlobalOptions[ALIstring("dumpInAllFrames")] = 0;
theGlobalOptions[ALIstring("rootResults")] = 0;
theGlobalOptions[ALIstring("writeDBAlign")] = 0;
theGlobalOptions[ALIstring("writeDBOptAlign")] = 0;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ALIdouble GlobalOptionMgr::getGlobalOption(const ALIstring& sstr) {
ALIdouble val = 0.;
//---------- Find Global Option by name
std::map<ALIstring, ALIdouble, std::less<ALIstring> >::const_iterator msdcite = GlobalOptions().find(sstr);
//---------- Dump Global Option found
if (ALIUtils::debug >= 6) {
std::cout << "Global Option " << (*msdcite).first << " = " << (*msdcite).second << std::endl;
}
if (msdcite == GlobalOptions().end()) {
//---------- return 0 if GLobal Option not found
std::cerr << " !!! FATAL ERROR: trying to get the value of an unknown Global Option : " << sstr << std::endl;
abort();
} else {
//---------- return 1 if Global Option found
//-std::cout << "SSparam" << (*msdcite).first << (*msdcite).second << "len" << OptOList().size() << std::endl;
//----- set val to Global Option value
val = (*msdcite).second;
}
return val;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ALIint GlobalOptionMgr::getGlobalOptionValue(const ALIstring& sstr, ALIdouble& val) {
//---------- Find Global Option by name
std::map<ALIstring, ALIdouble, std::less<ALIstring> >::const_iterator msdcite = GlobalOptions().find(sstr);
//---------- Dump Global Option found
if (ALIUtils::debug >= 6) {
std::cout << "Global Option " << (*msdcite).first << " = " << (*msdcite).second << std::endl;
}
if (msdcite == GlobalOptions().end()) {
//---------- return 0 if GLobal Option not found
return 0;
} else {
//---------- return 1 if Global Option found
//-std::cout << "SSparam" << (*msdcite).first << (*msdcite).second << "len" << OptOList().size() << std::endl;
//----- set val to Global Option value
val = (*msdcite).second;
return 1;
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void GlobalOptionMgr::setGlobalOption(const ALIstring gopt, const ALIdouble val, ALIFileIn& filein) {
if (!setGlobalOption(gopt, val, false)) {
filein.ErrorInLine();
std::cerr << "!!! global option not found: " << gopt << std::endl;
if (ALIUtils::debug >= 3) {
std::cout << "ALLOWED GLOBAL OPTIONS:" << std::endl;
std::map<ALIstring, ALIdouble, std::less<ALIstring> >::iterator msdite;
for (msdite = theGlobalOptions.begin(); msdite != theGlobalOptions.end(); ++msdite) {
std::cout << (*msdite).first.c_str() << std::endl;
}
}
exit(2);
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
bool GlobalOptionMgr::setGlobalOption(const ALIstring gopt, const ALIdouble val, bool bExit) {
//----- If global option exists: set it to value read
if (GlobalOptions().find(gopt) != GlobalOptions().end()) {
theGlobalOptions[gopt] = val;
//------ Verbosity global options change static data
if (gopt == "report_verbose") {
ALIUtils::setReportVerbosity(ALIint(val));
}
if (gopt == "debug_verbose") {
ALIUtils::setDebugVerbosity(ALIint(val));
}
return true;
//----- if global option does not exist: error
} else {
if (bExit) {
std::cerr << "!!! global option not found: " << gopt << std::endl;
exit(2);
}
return false;
}
}
|