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 ( )
inlineprivate

Definition at line 21 of file GlobalOptionMgr.h.

Referenced by getInstance().

21 { };
GlobalOptionMgr::~GlobalOptionMgr ( )
inline

Definition at line 25 of file GlobalOptionMgr.h.

References getInstance(), and setDefaultGlobalOptions().

25 { };

Member Function Documentation

ALIdouble GlobalOptionMgr::getGlobalOption ( const ALIstring sstr)

Definition at line 93 of file GlobalOptionMgr.cc.

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

Referenced by GlobalOptions(), and ALIUtils::SetLengthDimensionFactors().

94 {
95  ALIdouble val = 0.;
96  //---------- Find Global Option by name
97  std::map< ALIstring, ALIdouble, std::less<ALIstring> >::const_iterator msdcite = GlobalOptions().find( sstr );
98 
99  //---------- Dump Global Option found
100  if( ALIUtils::debug >= 6) {
101  std::cout << "Global Option " << (*msdcite).first << " = " << (*msdcite).second << std::endl;
102  }
103 
104  if ( msdcite == GlobalOptions().end() ) {
105  //---------- return 0 if GLobal Option not found
106  std::cerr << " !!! FATAL ERROR: trying to get the value of an unknown Global Option : " << sstr << std::endl;
107  abort();
108  } else {
109  //---------- return 1 if Global Option found
110  //-std::cout << "SSparam" << (*msdcite).first << (*msdcite).second << "len" << OptOList().size() << std::endl;
111  //----- set val to Global Option value
112  val = (*msdcite).second;
113  }
114 
115  return val;
116 
117 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIint debug
Definition: ALIUtils.h:36
#define end
Definition: vmac.h:39
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
ALIint GlobalOptionMgr::getGlobalOptionValue ( const ALIstring sstr,
ALIdouble val 
)

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

Definition at line 120 of file GlobalOptionMgr.cc.

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

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

121 {
122  //---------- Find Global Option by name
123  std::map< ALIstring, ALIdouble, std::less<ALIstring> >::const_iterator msdcite = GlobalOptions().find( sstr );
124 
125  //---------- Dump Global Option found
126  if( ALIUtils::debug >= 6) {
127  std::cout << "Global Option " << (*msdcite).first << " = " << (*msdcite).second << std::endl;
128  }
129 
130  if ( msdcite == GlobalOptions().end() ) {
131  //---------- return 0 if GLobal Option not found
132  return 0;
133  } else {
134  //---------- return 1 if Global Option found
135  //-std::cout << "SSparam" << (*msdcite).first << (*msdcite).second << "len" << OptOList().size() << std::endl;
136  //----- set val to Global Option value
137  val = (*msdcite).second;
138  return 1;
139  }
140 
141 }
static ALIint debug
Definition: ALIUtils.h:36
#define end
Definition: vmac.h:39
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
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(), OptOCOPS::constructSolidShape(), OptOModifiedRhomboidPrism::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(), Fit::WriteVisualisationFiles(), and ~GlobalOptionMgr().

19 {
20  if(!theInstance) {
22  }
23 
24  return theInstance;
25 }
static GlobalOptionMgr * theInstance
std::map< ALIstring, ALIdouble, std::less<ALIstring> >& GlobalOptionMgr::GlobalOptions ( )
inline

Definition at line 32 of file GlobalOptionMgr.h.

References getGlobalOption(), getGlobalOptionValue(), setGlobalOption(), theGlobalOptions, and heppy_batch::val.

Referenced by Measurement::calculateOriginalSimulatedValue(), MeasurementSensor2D::calculateSimulatedValue(), MeasurementDistancemeter3dim::calculateSimulatedValue(), MeasurementDistancemeter::calculateSimulatedValue(), MeasurementCOPS::calculateSimulatedValue(), MeasurementDiffEntry::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().

32  {
33  return theGlobalOptions;
34  }
std::map< ALIstring, ALIdouble, std::less< ALIstring > > theGlobalOptions
global options
void GlobalOptionMgr::setDefaultGlobalOptions ( )

Set the list of default global options.

Definition at line 29 of file GlobalOptionMgr.cc.

References theGlobalOptions.

Referenced by CocoaAnalyzer::CocoaAnalyzer(), and ~GlobalOptionMgr().

30 {
31  theGlobalOptions[ ALIstring("report_verbose") ] = 3;
32  theGlobalOptions[ ALIstring("debug_verbose") ] = 0;
33  // theGlobalOptions[ ALIstring("sparse") ] = 0;
34  theGlobalOptions[ ALIstring("saveMatrices") ] = 1;
35  // theGlobalOptions[ ALIstring("external_meas") ] = 0;
36  theGlobalOptions[ ALIstring("calcul_type") ] = 0;
37  theGlobalOptions[ ALIstring("length_value_dimension") ] = 0;
38  theGlobalOptions[ ALIstring("length_error_dimension") ] = 0;
39  theGlobalOptions[ ALIstring("angle_value_dimension") ] = 0;
40  theGlobalOptions[ ALIstring("angle_error_dimension") ] = 0;
41  theGlobalOptions[ ALIstring("output_length_value_dimension") ] = 0;
42  theGlobalOptions[ ALIstring("output_length_error_dimension") ] = 0;
43  theGlobalOptions[ ALIstring("output_angle_value_dimension") ] = 0;
44  theGlobalOptions[ ALIstring("output_angle_error_dimension") ] = 0;
45  theGlobalOptions[ ALIstring("checkExtraEntries") ] = 0;
46  theGlobalOptions[ ALIstring("cms_link") ] = 0;
47  theGlobalOptions[ ALIstring("cms_link_halfplanes") ] = 0;
48  theGlobalOptions[ ALIstring("cms_link_method") ] = 0;
49  theGlobalOptions[ ALIstring("range_studies") ] = 0;
50  theGlobalOptions[ ALIstring("histograms") ] = 0;
51  theGlobalOptions[ ALIstring("onlyDeriv") ] = 0;
52  theGlobalOptions[ ALIstring("onlyFirstPropagation") ] = 0;
53 
54  theGlobalOptions[ ALIstring("VisWriteVRML") ] = 0;
55  theGlobalOptions[ ALIstring("VisWriteIguana") ] = 0;
56  theGlobalOptions[ ALIstring("VisOnly") ] = 0;
57  theGlobalOptions[ ALIstring("VisWriteOptONames") ] = 1;
58  theGlobalOptions[ ALIstring("VisGlobalRotationX") ] = 0.;
59  theGlobalOptions[ ALIstring("VisGlobalRotationY") ] = 0.;
60  theGlobalOptions[ ALIstring("VisGlobalRotationZ") ] = 0.;
61  theGlobalOptions[ ALIstring("VisScale") ] = 1.;
62  theGlobalOptions[ ALIstring("tiltmeter_meas_value_dimension") ] = 0;
63  theGlobalOptions[ ALIstring("distancemeter_meas_value_dimension") ] = 0;
64  theGlobalOptions[ ALIstring("dumpDateInFittedEntries") ] = 0;
65  theGlobalOptions[ ALIstring("measurementErrorFromFile") ] = 0;
66 
67  theGlobalOptions[ ALIstring("maxNoFitIterations") ] = 50;
68  theGlobalOptions[ ALIstring("fitQualityCut") ] = 0.1;
69  theGlobalOptions[ ALIstring("relativeFitQualityCut") ] = 1.E-6;
70 
71  theGlobalOptions[ ALIstring("maxEvents") ] = 1.E6;
72 
73  //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)
74  theGlobalOptions[ ALIstring("deviffValDimf") ] = 1.;
75  theGlobalOptions[ ALIstring("deviffAngDimf") ] = 1.;
76  theGlobalOptions[ ALIstring("rotateAroundLocal") ] = 1;
77  theGlobalOptions[ ALIstring("reportOutEntriesByShortName") ] = 0;
78  theGlobalOptions[ ALIstring("reportOutReadValue") ] = 1;
79  theGlobalOptions[ ALIstring("reportOutReadSigma") ] = 1;
80  theGlobalOptions[ ALIstring("reportOutReadQuality") ] = 1;
81  theGlobalOptions[ ALIstring("maxDeviDerivative") ] = 1.E-6;
82 
83  theGlobalOptions[ ALIstring("stopAfter1stIteration") ] = 0;
84  theGlobalOptions[ ALIstring("calParamInyfMatrix") ] = 0;
85  theGlobalOptions[ ALIstring("writeXML") ] = 0;
86  theGlobalOptions[ ALIstring("dumpInAllFrames") ] = 0;
87  theGlobalOptions[ ALIstring("rootResults") ] = 0;
88  theGlobalOptions[ ALIstring("writeDBAlign") ] = 0;
89  theGlobalOptions[ ALIstring("writeDBOptAlign") ] = 0;
90 }
std::map< ALIstring, ALIdouble, std::less< ALIstring > > theGlobalOptions
global options
std::string ALIstring
Definition: CocoaGlobals.h:9
void GlobalOptionMgr::setGlobalOption ( const ALIstring  go,
const ALIdouble  val,
ALIFileIn filein 
)

Definition at line 145 of file GlobalOptionMgr.cc.

References MessageLogger_cfi::cerr, gather_cfg::cout, ALIUtils::debug, ALIFileIn::ErrorInLine(), cmsRelvalreport::exit, and theGlobalOptions.

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

146 {
147 
148  if( !setGlobalOption( gopt, val, false ) ){
149  filein.ErrorInLine();
150  std::cerr << "!!! global option not found: " << gopt << std::endl;
151  if ( ALIUtils::debug >= 3 ) {
152  std::cout << "ALLOWED GLOBAL OPTIONS:" << std::endl;
153  std::map< ALIstring, ALIdouble, std::less<ALIstring> >::iterator msdite;
154  for ( msdite = theGlobalOptions.begin();
155  msdite != theGlobalOptions.end(); ++msdite) {
156  std::cout << (*msdite).first.c_str() << std::endl;
157  }
158  }
159  exit(2);
160  }
161 
162 }
static ALIint debug
Definition: ALIUtils.h:36
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:204
bool GlobalOptionMgr::setGlobalOption ( const ALIstring  go,
const ALIdouble  val,
bool  bExit = true 
)

Definition at line 165 of file GlobalOptionMgr.cc.

References MessageLogger_cfi::cerr, end, cmsRelvalreport::exit, spr::find(), GlobalOptions(), ALIUtils::setDebugVerbosity(), ALIUtils::setReportVerbosity(), theGlobalOptions, and heppy_batch::val.

166 {
167  //----- If global option exists: set it to value read
168  if ( GlobalOptions().find( gopt ) != GlobalOptions().end() ){
169  theGlobalOptions[ gopt ] = val;
170  //------ Verbosity global options change static data
171  if( gopt == "report_verbose") {
173  }
174  if( gopt == "debug_verbose" ) {
176  }
177 
178  return true;
179  //----- if global option does not exist: error
180  } else {
181  if( bExit ) {
182  std::cerr << "!!! global option not found: " << gopt << std::endl;
183  exit(2);
184  }
185  return false;
186  }
187 
188 }
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:20
std::map< ALIstring, ALIdouble, std::less< ALIstring > > theGlobalOptions
global options
#define end
Definition: vmac.h:39
static void setDebugVerbosity(ALIint val)
Definition: ALIUtils.h:42
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
static void setReportVerbosity(ALIint val)
Definition: ALIUtils.h:39

Member Data Documentation

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

global options

Definition at line 46 of file GlobalOptionMgr.h.

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

GlobalOptionMgr * GlobalOptionMgr::theInstance = nullptr
staticprivate

Definition at line 44 of file GlobalOptionMgr.h.

Referenced by getInstance().