本文整理汇总了C++中Timing::getParsedLine方法的典型用法代码示例。如果您正苦于以下问题:C++ Timing::getParsedLine方法的具体用法?C++ Timing::getParsedLine怎么用?C++ Timing::getParsedLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timing
的用法示例。
在下文中一共展示了Timing::getParsedLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadAnalysisParametersHistograms
//Called when loading analysis parameters; relative to histograms
//This is the top level method; this method calls loadAnalysisParametersHistograms(ifstream, Timing::HistoSetup) depending on which histogram is requested by the user
void ParameterLoaderAnaysis::loadAnalysisParametersHistograms(ifstream & inputFileStream, AnalysisSetupUniformity &aSetupUniformity){
//Variable Declaration
bool bExitSuccess = false;
bool bSetup = false;
pair<string,string> pair_strParam; //<Field, Value>
string strName = ""; //What Histo Case should we create?
string strLine = "";
string strTmp = ""; //Used for case insensitive comparison of strName
//Loop through to find "Histo_Name" Should be the first one
while ( getlineNoSpaces(inputFileStream, strLine) ) { //Loop through file to find "Histo_Name"
//Debugging
//cout<<"loadAnalysisParametersHistograms (Top Level); strLine = " << strLine << endl;
//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 so the user has configured the file incorrectly
if ( 0 == strLine.compare(strSecEnd_Uniformity_Hiso) ) { //Section End Reached Prematurely
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms","I have reached the END of a Histogram Heading\n");
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms","\tBut I Have NOT found the 'Histo_Name' field\n");
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms","\tYou have configured this heading incorrectly, the 'Histo_Name' field is expected to be the FIRST line after the Heading\n");
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms","\tThis object has been skipped, please cross-check\n");
//Exit the Loop to find "Detector_Name"
break;
} //End Case: Section End Reached Prematurely
pair_strParam = getParsedLine(strLine,bExitSuccess);
if (bExitSuccess) { //Case: Parameter Fetched Successfully
transform(pair_strParam.first.begin(),pair_strParam.first.end(),pair_strParam.first.begin(),toupper);
if ( 0 == pair_strParam.first.compare("HISTO_NAME") ) { //Case: Name found!
//Store name locally & convert to upper case
strName = pair_strParam.second;
//Set the correct exit flag
bSetup = true;
//Exit the Loop to find "Detector_Name"
break;
} //End Case: Detector Name found!
else{ //Case: Detector Name not found!
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms","I am parsing a Histogram Heading\n");
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms","\tHowever I expected the 'Histo_Name' field to be the first line after the heading\n");
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms", ( "\tThe current line I am parsing: " + strLine ).c_str() );
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms","\tHas been skipped and may lead to undefined behavior");
} //End Case: Name not found!
}//End Case: Parameter Fetched Successfully
else{ //Case: Parameter was NOT fetched Successfully
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms","Sorry I didn't parse parameter correctly\n");
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms", ( "\tCurrent line: " + strLine ).c_str() );
} //End Case: Parameter was NOT fetched Successfully
} //Loop through file to find "Name"
//Fetch the values for the map for the correct case
if (bSetup) { //Case: Setup Correct
strTmp = strName;
transform(strTmp.begin(), strTmp.end(), strTmp.begin(), toupper);
if (0 == strTmp.compare("CLUSTADC") ) { //Case: Cluster ADC's
aSetupUniformity.histoSetup_clustADC.strHisto_Name = strName;
loadAnalysisParametersHistograms(inputFileStream, aSetupUniformity.histoSetup_clustADC);
} //End Case: Cluster ADC's
else if (0 == strTmp.compare("CLUSTMULTI") ) { //Case: Cluster Multi
aSetupUniformity.histoSetup_clustMulti.strHisto_Name = strName;
loadAnalysisParametersHistograms(inputFileStream, aSetupUniformity.histoSetup_clustMulti);
} //End Case: Cluster Multi
else if (0 == strTmp.compare("CLUSTPOS") ) { //Case: Cluster Position
aSetupUniformity.histoSetup_clustPos.strHisto_Name = strName;
loadAnalysisParametersHistograms(inputFileStream, aSetupUniformity.histoSetup_clustPos);
} //End Case: Cluster Position
else if (0 == strTmp.compare("CLUSTSIZE") ) { //Case: Cluster Size
aSetupUniformity.histoSetup_clustSize.strHisto_Name = strName;
loadAnalysisParametersHistograms(inputFileStream, aSetupUniformity.histoSetup_clustSize);
} //End Case: Cluster Size
else if (0 == strTmp.compare("CLUSTTIME") ) { //Case: Cluster Time
aSetupUniformity.histoSetup_clustTime.strHisto_Name = strName;
loadAnalysisParametersHistograms(inputFileStream, aSetupUniformity.histoSetup_clustTime);
} //End Case: Cluster Time
else{ //Case: Undefined Behavior
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms", ( "Histogram Type" + strName + " Not Recognized\n" ).c_str() );
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersHistograms", "\tI Only Support Case-Insenstive versions from this set {CLUSTADC, CLUSTMULTI, CLUSTPOS, CLUSTSIZE, CLUSTTIME}\n");
} //End Case: Undefined Behavior
} //End Case: Setup Correct
return;
} //End ParameterLoaderAnaysis::loadAnalysisParametersHistograms() - Top Level
示例2: 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
//.........这里部分代码省略.........
示例3: loadAnalysisParametersFits
void ParameterLoaderAnaysis::loadAnalysisParametersFits(ifstream & inputFileStream, HistoSetup &hSetup){
//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 strLine = ""; //Line taken from the input file
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","loadAnalysisParametersFits", "Found Fit 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_Fit ) ) break;
//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("FIT_FORMULA") ){ //Case: ADC Spectrum Fit Equation
hSetup.strFit_Formula = pair_strParam.second;
} //End Case: ADC Spectrum Fit Equation
else if( 0 == pair_strParam.first.compare("FIT_OPTION") ){ //Case: ADC Spectrum Fit Equation
hSetup.strFit_Option = pair_strParam.second;
//Ensure that the result of the fit is returned in the TFitResultPtr by included the option "S" by default
if (hSetup.strFit_Option.find("S") == std::string::npos ) {
hSetup.strFit_Option = hSetup.strFit_Option + "S";
}
} //End Case: ADC Spectrum Fit Equation
else if( 0 == pair_strParam.first.compare("FIT_PARAM_IGUESS") ){
hSetup.vec_strFit_ParamIGuess = getCharSeparatedList(pair_strParam.second,',');
}
else if( 0 == pair_strParam.first.compare("FIT_PARAM_LIMIT_MAX") ){
hSetup.vec_strFit_ParamLimit_Max = getCharSeparatedList(pair_strParam.second, ',');
}
else if( 0 == pair_strParam.first.compare("FIT_PARAM_LIMIT_MIN") ){
hSetup.vec_strFit_ParamLimit_Min = getCharSeparatedList(pair_strParam.second, ',');
}
else if( 0 == pair_strParam.first.compare("FIT_PARAM_MAP") ){
hSetup.vec_strFit_ParamMeaning = Timing::getCharSeparatedList(pair_strParam.second,',');
}
else if( 0 == pair_strParam.first.compare("FIT_RANGE") ){
hSetup.vec_strFit_Range = getCharSeparatedList(pair_strParam.second, ',');
}
else{ //Case: Parameter Not Recognized
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersFits","Error!!! Parameter Not Recognizd:\n");
//printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersUniformity",( "\t(Field,Value) = (" + pair_strParam.first "," + pair_strParam.second + ")\n" ).c_str() );
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersFits",( "\tField = " + pair_strParam.first + "\n" ).c_str() );
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersFits",( "\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","loadAnalysisParametersFits","Error!!! I didn't parse parameter correctly\n");
printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParametersFits",("\tCurrent line: " + strLine).c_str() );
} //End Case: Parameter Failed to fetch correctly
} //End Loop through Fit Heading
} //End ParameterLoaderAnaysis::loadAnalysisParametersFits