CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

GlobalOptionMgr Class Reference

#include <GlobalOptionMgr.h>

List of all members.

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
std::map< ALIstring, ALIdouble,
std::less< ALIstring > > & 
GlobalOptions ()
void setDefaultGlobalOptions ()
 Set the list of default global options.
void setGlobalOption (const ALIstring go, const ALIdouble val, ALIFileIn &filein)
bool setGlobalOption (const ALIstring go, const ALIdouble val, bool bExit=1)
 ~GlobalOptionMgr ()

Static Public Member Functions

static GlobalOptionMgrgetInstance ()

Private Member Functions

 GlobalOptionMgr ()

Private Attributes

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

Static Private Attributes

static GlobalOptionMgrtheInstance = 0

Detailed Description

Definition at line 18 of file GlobalOptionMgr.h.


Constructor & Destructor Documentation

GlobalOptionMgr::GlobalOptionMgr ( ) [inline, private]

Definition at line 21 of file GlobalOptionMgr.h.

Referenced by getInstance().

{ };
GlobalOptionMgr::~GlobalOptionMgr ( ) [inline]

Definition at line 25 of file GlobalOptionMgr.h.

{ };

Member Function Documentation

ALIdouble GlobalOptionMgr::getGlobalOption ( const ALIstring sstr)

Definition at line 93 of file GlobalOptionMgr.cc.

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

Referenced by ALIUtils::SetLengthDimensionFactors().

{
  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 
)

----- 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(), OptORisleyPrism::constructSolidShape(), OptOMirror::constructSolidShape(), OptOTiltmeter::constructSolidShape(), OptOCubeSplitter::constructSolidShape(), OptOLens::constructSolidShape(), OptOModifiedRhomboidPrism::constructSolidShape(), OptOCameraDetector::constructSolidShape(), OptOScreen::constructSolidShape(), OptOXLaser::constructSolidShape(), OpticalObject::constructSolidShape(), OptODistancemeter::constructSolidShape(), OptOCOPS::constructSolidShape(), OptODistancemeter3dim::constructSolidShape(), OptOOpticalSquare::constructSolidShape(), OptOSource::constructSolidShape(), OptOPinhole::constructSolidShape(), OptOSensor2D::constructSolidShape(), OptOLaser::constructSolidShape(), OptOPlateSplitter::constructSolidShape(), Entry::fill(), Entry::fillFromInputFileSigma(), Fit::FillMatricesWithCalibratedParameters(), OpticalObject::findExtraEntryValue(), Fit::fitNextEvent(), and Fit::getInstance().

{
  //---------- 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;
  } 

}
GlobalOptionMgr * GlobalOptionMgr::getInstance ( ) [static]

Definition at line 18 of file GlobalOptionMgr.cc.

References GlobalOptionMgr(), and theInstance.

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

{
  if(!theInstance) {
    theInstance = new GlobalOptionMgr;
  }

  return theInstance;
}
std::map< ALIstring, ALIdouble, std::less<ALIstring> >& GlobalOptionMgr::GlobalOptions ( ) [inline]
void GlobalOptionMgr::setDefaultGlobalOptions ( )

Set the list of default global options.

Definition at line 29 of file GlobalOptionMgr.cc.

References theGlobalOptions.

Referenced by CocoaAnalyzer::CocoaAnalyzer().

{
  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") ] = 0;
  theGlobalOptions[ ALIstring("dumpInAllFrames") ] = 0;
  theGlobalOptions[ ALIstring("rootResults") ] = 0;
  theGlobalOptions[ ALIstring("writeDBAlign") ] = 0;
  theGlobalOptions[ ALIstring("writeDBOptAlign") ] = 0;
}
bool GlobalOptionMgr::setGlobalOption ( const ALIstring  go,
const ALIdouble  val,
bool  bExit = 1 
)

Definition at line 165 of file GlobalOptionMgr.cc.

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

{
  //----- 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 1;
    //----- if global option does not exist: error
  } else {
    if( bExit ) {
      std::cerr << "!!! global option not found: " << gopt << std::endl;
      exit(2);
    }
    return 0;
  }
  
}
void GlobalOptionMgr::setGlobalOption ( const ALIstring  go,
const ALIdouble  val,
ALIFileIn filein 
)

Definition at line 145 of file GlobalOptionMgr.cc.

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

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

{

  if( !setGlobalOption( gopt, val, 0 ) ){
    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);
  }

}

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

Definition at line 44 of file GlobalOptionMgr.h.

Referenced by getInstance().