当前位置: 首页>>代码示例>>C++>>正文


C++ Timing::stoiSafe方法代码示例

本文整理汇总了C++中Timing::stoiSafe方法的典型用法代码示例。如果您正苦于以下问题:C++ Timing::stoiSafe方法的具体用法?C++ Timing::stoiSafe怎么用?C++ Timing::stoiSafe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Timing的用法示例。


在下文中一共展示了Timing::stoiSafe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadAnalysisParametersUniformity

//Uniformity
//Loads parameters defined in file read by inputFileStream and sets tehm to the aSetupUniformity
//Note this should only be called within the Uniformity heading if the user has configured the file correctly
void ParameterLoaderAnaysis::loadAnalysisParametersUniformity(ifstream &inputFileStream, AnalysisSetupUniformity &aSetupUniformity){
    //Variable Declaration
    bool bExitSuccess = false;
    
    pair<string,string> pair_strParam; //Input file is setup in <Field, Value> pairs; not used here yet but placeholder
    
    //string strField = "";   //From input file we have <Field,Value> pairs
    string strLine = "";    //Line taken from the input file
    //string strHeading = ""; //For storing detector heading
    
    vector<string> vec_strList; //For storing char separated input; not used here yet but placeholder
    
    if (bVerboseMode_IO) { //Case: User Requested Verbose Error Messages - I/O
        printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersUniformity", "Found Uniformity Heading");
    } //End Case: User Requested Verbose Error Messages - I/O
    
    while ( getlineNoSpaces(inputFileStream, strLine) ) {
        //Does the user want to comment out this line?
        if ( 0 == strLine.compare(0,1,"#") ) continue;
        
        //Do we reach the end of the section?
        if ( 0 == strLine.compare(strSecEnd_Uniformity ) ) break;
        
        //Should we be storing histogram/fit setup parameters?
        if ( 0 == strLine.compare(strSecBegin_Uniformity_Fit) ) { //Case: Fit Setup
            loadAnalysisParametersFits(inputFileStream, aSetupUniformity.histoSetup_clustADC);
	    continue; //Tell it to move to the next loop iteration (e.g. line in file)
        } //End Case: Fit Setup
        else if( 0 == strLine.compare(strSecBegin_Uniformity_Histo) ){ //Case: Histo Setup
            loadAnalysisParametersHistograms(inputFileStream, aSetupUniformity);
	    continue; //Tell it to move to the next loop iteration (e.g. line in file)
        } //End Case: Histo Setup
        
        //Debugging
        cout<<"strLine: = " << strLine.c_str() << endl;
        
        //Parse the line
        pair_strParam = getParsedLine(strLine,bExitSuccess);
        
        if (bExitSuccess) { //Case: Parameter Fetched Correctly
            //transform(pair_strParam.first.begin(), pair_strParam.second.end(),pair_strParam.first.begin(),toupper);
            
            string strTmp = pair_strParam.first;
            transform(strTmp.begin(), strTmp.end(), strTmp.begin(), toupper);
            
            pair_strParam.first = strTmp;
            
            //cout<<pair_strParam.first<<"\t"<<pair_strParam.second;

            if ( 0 == pair_strParam.first.compare("CUT_ADC_MIN") ) {
                aSetupUniformity.selClust.iCut_ADCNoise = stoiSafe(pair_strParam.first,pair_strParam.second);
                //cout<<"\t"<<aSetupUniformity.selClust.iCut_ADCNoise<<endl;
            } //End Case: Minimum ADC Value
            else if( 0 == pair_strParam.first.compare("CUT_CLUSTERMULTI_MIN") ){ //Case: Min Cluster Multiplicity
                aSetupUniformity.selClust.iCut_MultiMin = stoiSafe(pair_strParam.first,pair_strParam.second);
            } //End Case: Max Cluster Multiplicity
            else if( 0 == pair_strParam.first.compare("CUT_CLUSTERMULTI_MAX") ){
                aSetupUniformity.selClust.iCut_MultiMax = stoiSafe(pair_strParam.first,pair_strParam.second);
            } //End Case:
            else if( 0 == pair_strParam.first.compare("CUT_CLUSTERSIZE_MIN") ) {
                aSetupUniformity.selClust.iCut_SizeMin = stoiSafe(pair_strParam.first,pair_strParam.second);
                //cout<<"\t"<<aSetupUniformity.selClust.iCut_SizeMin<<endl;
            } //End Case: Min Cluster Size
            else if( 0 == pair_strParam.first.compare("CUT_CLUSTERSIZE_MAX") ) {
                aSetupUniformity.selClust.iCut_SizeMax = stoiSafe(pair_strParam.first,pair_strParam.second);
                //cout<<"\t"<<aSetupUniformity.selClust.iCut_SizeMax<<endl;
            } //End Case: Max Cluster Size
            else if( 0 == pair_strParam.first.compare("CUT_CLUSTERTIME_MIN") ) {
                aSetupUniformity.selClust.iCut_TimeMin = stoiSafe(pair_strParam.first,pair_strParam.second);
                //cout<<"\t"<<aSetupUniformity.selClust.iCut_TimeMin<<endl;
            } //End Case: Min Cluster Time
            else if( 0 == pair_strParam.first.compare("CUT_CLUSTERTIME_MAX") ) {
                aSetupUniformity.selClust.iCut_TimeMax = stoiSafe(pair_strParam.first,pair_strParam.second);
                //cout<<"\t"<<aSetupUniformity.selClust.iCut_TimeMax<<endl;
            } //End Case: Max Cluster Time
            if( 0 == pair_strParam.first.compare("EVENT_FIRST") ){ //Case: ADC Spectrum Fit Equation
                aSetupUniformity.iEvt_First = stoiSafe(pair_strParam.second);
            } //End Case: ADC Spectrum Fit Equation
            else if( 0 == pair_strParam.first.compare("EVENT_TOTAL") ){ //Case: ADC Spectrum Fit Equation
                aSetupUniformity.iEvt_Total = stoiSafe(pair_strParam.second);
            } //End Case: ADC Spectrum Fit Equation
            else if( 0 == pair_strParam.first.compare("UNIFORMITY_GRANULARITY") ){ //Case: Uniformity Granularity
                aSetupUniformity.iUniformityGranularity = stoiSafe(pair_strParam.first,pair_strParam.second);
            } //End Case: Uniformity Granularity
            else if( 0 == pair_strParam.first.compare("UNIFORMITY_TOLERANCE") ){ //Case: Uniformity Granularity
                aSetupUniformity.fUniformityTolerance = stofSafe(pair_strParam.first,pair_strParam.second);
            } //End Case: Uniformity Granularity
            else{ //Case: Parameter Not Recognized
                printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersUniformity","Error!!! Parameter Not Recognizd:\n");
                printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersUniformity",( "\tField = " + pair_strParam.first + "\n" ).c_str() );
                printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersUniformity",( "\tValue = " + pair_strParam.second + "\n" ).c_str() );
            } //End Case: Parameter Not Recognized
        } //End Case: Parameter Fetched Correctly
        else{ //Case: Parameter Failed to fetch correctly
            printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersUniformity","Error!!!  I didn't parse parameter correctly\n");
            printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersUniformity",("\tCurrent line: " + strLine).c_str() );
        } //End Case: Parameter Failed to fetch correctly
//.........这里部分代码省略.........
开发者ID:jhallan,项目名称:CMS_GEM_Analysis_Framework,代码行数:101,代码来源:ParameterLoaderAnaysis.cpp


注:本文中的Timing::stoiSafe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。