CMS 3D CMS Logo

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