CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
GlobalOptionMgr Class Reference

#include <GlobalOptionMgr.h>

Public Member Functions

ALIdouble getGlobalOption (const ALIstring &sstr)
 
int getGlobalOptionValue (const ALIstring &sstr, ALIdouble &val)
 --— Search a string in theGlobalOptions and return 1 if found More...
 
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions ()
 
void setDefaultGlobalOptions ()
 Set the list of default global options. More...
 
void setGlobalOption (const ALIstring go, const ALIdouble val, ALIFileIn &filein)
 
bool setGlobalOption (const ALIstring go, const ALIdouble val, bool bExit=true)
 
 ~GlobalOptionMgr ()
 

Static Public Member Functions

static GlobalOptionMgrgetInstance ()
 

Private Member Functions

 GlobalOptionMgr ()
 

Private Attributes

std::map< ALIstring, ALIdouble, std::less< ALIstring > > theGlobalOptions
 global options More...
 

Static Private Attributes

static GlobalOptionMgrtheInstance = nullptr
 

Detailed Description

Definition at line 18 of file GlobalOptionMgr.h.

Constructor & Destructor Documentation

◆ GlobalOptionMgr()

GlobalOptionMgr::GlobalOptionMgr ( )
inlineprivate

Definition at line 20 of file GlobalOptionMgr.h.

Referenced by getInstance().

20 {};

◆ ~GlobalOptionMgr()

GlobalOptionMgr::~GlobalOptionMgr ( )
inline

Definition at line 24 of file GlobalOptionMgr.h.

24 {};

Member Function Documentation

◆ getGlobalOption()

ALIdouble GlobalOptionMgr::getGlobalOption ( const ALIstring sstr)

Definition at line 90 of file GlobalOptionMgr.cc.

References DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, mps_fire::end, GlobalOptions(), and heppy_batch::val.

Referenced by ALIUtils::SetLengthDimensionFactors().

90  {
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 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIint debug
Definition: ALIUtils.h:34
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()

◆ getGlobalOptionValue()

ALIint GlobalOptionMgr::getGlobalOptionValue ( const ALIstring sstr,
ALIdouble val 
)

--— Search a string in theGlobalOptions and return 1 if found

Definition at line 115 of file GlobalOptionMgr.cc.

References gather_cfg::cout, ALIUtils::debug, mps_fire::end, GlobalOptions(), and heppy_batch::val.

Referenced by Model::CMSLinkDeleteOptOs(), OptOCameraDetector::constructSolidShape(), OptORisleyPrism::constructSolidShape(), OptOXLaser::constructSolidShape(), OptOPinhole::constructSolidShape(), OptOScreen::constructSolidShape(), OptOLens::constructSolidShape(), OptOSource::constructSolidShape(), OptOLaser::constructSolidShape(), OptOTiltmeter::constructSolidShape(), OptODistancemeter3dim::constructSolidShape(), OptODistancemeter::constructSolidShape(), OptOOpticalSquare::constructSolidShape(), OptOPlateSplitter::constructSolidShape(), OptOModifiedRhomboidPrism::constructSolidShape(), OptOMirror::constructSolidShape(), OptOCubeSplitter::constructSolidShape(), OptOCOPS::constructSolidShape(), OptOSensor2D::constructSolidShape(), OpticalObject::constructSolidShape(), Entry::fill(), Entry::fillFromInputFileSigma(), Fit::FillMatricesWithCalibratedParameters(), OpticalObject::findExtraEntryValue(), Fit::fitNextEvent(), and Fit::getInstance().

115  {
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 }
static ALIint debug
Definition: ALIUtils.h:34
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()

◆ getInstance()

GlobalOptionMgr * GlobalOptionMgr::getInstance ( )
static

Definition at line 18 of file GlobalOptionMgr.cc.

References GlobalOptionMgr(), and theInstance.

Referenced by Measurement::calculateOriginalSimulatedValue(), MeasurementSensor2D::calculateSimulatedValue(), MeasurementDistancemeter::calculateSimulatedValue(), MeasurementDistancemeter3dim::calculateSimulatedValue(), MeasurementCOPS::calculateSimulatedValue(), MeasurementDiffEntry::calculateSimulatedValue(), Model::CMSLinkDeleteOptOs(), CocoaAnalyzer::CocoaAnalyzer(), OptOCameraDetector::constructSolidShape(), OptORisleyPrism::constructSolidShape(), OptOXLaser::constructSolidShape(), OptOLens::constructSolidShape(), OptOPinhole::constructSolidShape(), OptOScreen::constructSolidShape(), OptOLaser::constructSolidShape(), OptOSource::constructSolidShape(), OptOTiltmeter::constructSolidShape(), OptODistancemeter::constructSolidShape(), OptODistancemeter3dim::constructSolidShape(), OptOOpticalSquare::constructSolidShape(), OptOPlateSplitter::constructSolidShape(), OptOCubeSplitter::constructSolidShape(), OptOMirror::constructSolidShape(), OptOModifiedRhomboidPrism::constructSolidShape(), OptOCOPS::constructSolidShape(), OptOSensor2D::constructSolidShape(), OpticalObject::constructSolidShape(), Fit::CreateMatrices(), EntryAngleAffAngles::displace(), OpticalObject::displaceRmGlobOriginal(), OpticalObject::displaceRmGlobOriginalOriginal(), CocoaDBMgr::DumpCocoaResults(), Entry::fill(), DeviationSensor2D::fillData(), Measurement::fillData(), Entry::fillFromInputFileSigma(), Fit::FillMatricesWithCalibratedParameters(), OpticalObject::findExtraEntryValue(), Fit::fitNextEvent(), Fit::fitParameters(), Fit::getInstance(), FittedEntriesManager::MakeHistos(), Fit::PropagateErrors(), Model::readMeasurementsFromFile(), CocoaDaqReaderText::ReadNextEvent(), Model::readSystemDescription(), ALIUtils::SetAngleDimensionFactors(), MeasurementDistancemeter3dim::setConversionFactor(), MeasurementDistancemeter::setConversionFactor(), MeasurementTiltmeter::setConversionFactor(), Fit::setFittableEntries(), ALIUtils::SetLengthDimensionFactors(), ALIUtils::SetOutputAngleDimensionFactors(), ALIUtils::SetOutputLengthDimensionFactors(), OpticalObject::SetRMGlobFromRMLocal(), Fit::startFit(), OptOUserDefined::userDefinedBehaviour(), and Fit::WriteVisualisationFiles().

18  {
19  if (!theInstance) {
21  }
22 
23  return theInstance;
24 }
static GlobalOptionMgr * theInstance

◆ GlobalOptions()

std::map<ALIstring, ALIdouble, std::less<ALIstring> >& GlobalOptionMgr::GlobalOptions ( )
inline

Definition at line 31 of file GlobalOptionMgr.h.

References theGlobalOptions.

Referenced by Measurement::calculateOriginalSimulatedValue(), MeasurementSensor2D::calculateSimulatedValue(), MeasurementDistancemeter3dim::calculateSimulatedValue(), MeasurementDistancemeter::calculateSimulatedValue(), MeasurementDiffEntry::calculateSimulatedValue(), MeasurementCOPS::calculateSimulatedValue(), Fit::CreateMatrices(), EntryAngleAffAngles::displace(), OpticalObject::displaceRmGlobOriginal(), OpticalObject::displaceRmGlobOriginalOriginal(), CocoaDBMgr::DumpCocoaResults(), DeviationSensor2D::fillData(), Measurement::fillData(), Fit::fitNextEvent(), Fit::fitParameters(), getGlobalOption(), getGlobalOptionValue(), FittedEntriesManager::MakeHistos(), Fit::PropagateErrors(), Model::readMeasurementsFromFile(), CocoaDaqReaderText::ReadNextEvent(), ALIUtils::SetAngleDimensionFactors(), MeasurementDistancemeter::setConversionFactor(), MeasurementDistancemeter3dim::setConversionFactor(), MeasurementTiltmeter::setConversionFactor(), Fit::setFittableEntries(), setGlobalOption(), ALIUtils::SetLengthDimensionFactors(), ALIUtils::SetOutputAngleDimensionFactors(), ALIUtils::SetOutputLengthDimensionFactors(), OpticalObject::SetRMGlobFromRMLocal(), Fit::startFit(), OptOUserDefined::userDefinedBehaviour(), and Fit::WriteVisualisationFiles().

31 { return theGlobalOptions; }
std::map< ALIstring, ALIdouble, std::less< ALIstring > > theGlobalOptions
global options

◆ setDefaultGlobalOptions()

void GlobalOptionMgr::setDefaultGlobalOptions ( )

Set the list of default global options.

Definition at line 27 of file GlobalOptionMgr.cc.

References theGlobalOptions.

Referenced by CocoaAnalyzer::CocoaAnalyzer().

27  {
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 }
std::map< ALIstring, ALIdouble, std::less< ALIstring > > theGlobalOptions
global options
std::string ALIstring
Definition: CocoaGlobals.h:9

◆ setGlobalOption() [1/2]

void GlobalOptionMgr::setGlobalOption ( const ALIstring  go,
const ALIdouble  val,
ALIFileIn filein 
)

Definition at line 137 of file GlobalOptionMgr.cc.

References DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, ALIFileIn::ErrorInLine(), beamvalidation::exit(), theGlobalOptions, and heppy_batch::val.

Referenced by CocoaAnalyzer::CocoaAnalyzer(), and Model::readSystemDescription().

137  {
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 }
static ALIint debug
Definition: ALIUtils.h:34
std::map< ALIstring, ALIdouble, std::less< ALIstring > > theGlobalOptions
global options
void setGlobalOption(const ALIstring go, const ALIdouble val, ALIFileIn &filein)
void ErrorInLine()
Definition: ALIFileIn.cc:196
def exit(msg="")

◆ setGlobalOption() [2/2]

bool GlobalOptionMgr::setGlobalOption ( const ALIstring  go,
const ALIdouble  val,
bool  bExit = true 
)

Definition at line 153 of file GlobalOptionMgr.cc.

References DMR_cfg::cerr, mps_fire::end, beamvalidation::exit(), spr::find(), GlobalOptions(), ALIUtils::setDebugVerbosity(), ALIUtils::setReportVerbosity(), theGlobalOptions, and heppy_batch::val.

153  {
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 }
int ALIint
Definition: CocoaGlobals.h:15
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::map< ALIstring, ALIdouble, std::less< ALIstring > > theGlobalOptions
global options
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
static void setDebugVerbosity(ALIint val)
Definition: ALIUtils.h:38
static void setReportVerbosity(ALIint val)
Definition: ALIUtils.h:37
def exit(msg="")

Member Data Documentation

◆ theGlobalOptions

std::map<ALIstring, ALIdouble, std::less<ALIstring> > GlobalOptionMgr::theGlobalOptions
private

global options

Definition at line 43 of file GlobalOptionMgr.h.

Referenced by GlobalOptions(), setDefaultGlobalOptions(), and setGlobalOption().

◆ theInstance

GlobalOptionMgr * GlobalOptionMgr::theInstance = nullptr
staticprivate

Definition at line 41 of file GlobalOptionMgr.h.

Referenced by getInstance().