a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
FlavorObservableError.cpp
Go to the documentation of this file.
1/*
2 * FlavorObservableError.cpp
3 *
4 * Created on: Apr 1, 2012 (really!)
5 * Author: Ben O'Leary (benjamin.oleary@gmail.com)
6 * Copyright 2012 Ben O'Leary
7 *
8 * This file is part of LesHouchesParserClasses, released under the
9 * GNU General Public License. Please see the accompanying
10 * README.LHPC_CPP.txt file for a full list of files, brief documentation
11 * on how to use these classes, and further details on the license.
12 */
13
14#include "SLHA.hpp"
15
16namespace LHPC
17{
19 minusUncertainty( BOL::UsefulStuff::notANumber ),
20 plusUncertainty( BOL::UsefulStuff::notANumber ),
21 evaluationScale( BOL::UsefulStuff::notANumber ),
22 daughterParticleCodes()
23 {
24 // just an initialization list.
25 }
26
28 FlavorObservableError const& copySource ) :
29 minusUncertainty( copySource.minusUncertainty ),
30 plusUncertainty( copySource.plusUncertainty ),
31 evaluationScale( copySource.evaluationScale ),
32 daughterParticleCodes( copySource.daughterParticleCodes )
33 {
34 // just an initialization list.
35 }
36
38 {
39 // does nothing.
40 }
41
42
43 void
44 FlavorObservableError::setFromString( std::string const& valuesString )
45 {
46 std::string firstRemainder;
47 std::string secondRemainder;
50 valuesString,
51 &firstRemainder,
55 firstRemainder,
56 &secondRemainder,
60 secondRemainder,
61 &firstRemainder,
63 int numberOfDaughterParticles( BOL::StringParser::stringToInt(
65 firstRemainder,
66 &secondRemainder,
68 firstRemainder.assign( BOL::StringParser::trimFromFrontAndBack(
69 secondRemainder,
72 while( !(firstRemainder.empty()) )
73 {
76 firstRemainder,
77 &secondRemainder,
79 firstRemainder.assign( BOL::StringParser::trimFromFrontAndBack(
80 secondRemainder,
82 }
83 if( ( 0 < numberOfDaughterParticles )
84 &&
85 ( (size_t)numberOfDaughterParticles != daughterParticleCodes.size() ) )
86 {
87 std::cout
88 << std::endl
89 << "LHPC::warning! An FOBSERR line declared a different number of"
90 << " daughter particles ( " << numberOfDaughterParticles << " ) to the"
91 << " actual number of daughter particle codes it had ( "
92 << daughterParticleCodes.size()
93 << " )! The declared number is being ignored in favor of the number of"
94 << " codes read in.";
95 std::cout << std::endl;
96 }
97 }
98
99 std::string
101 {
102 std::string
104 9,
105 3 ) );
106 returnString.append( FlavorObservable::spacesBetweenCodes,
107 ' ' );
109 9,
110 3 ) );
111 returnString.append( FlavorObservable::spacesBetweenCodes,
112 ' ' );
114 9,
115 3 ) );
116 for( std::list< int >::const_iterator
117 daughterIterator( daughterParticleCodes.begin() );
118 daughterParticleCodes.end() != daughterIterator;
119 ++daughterIterator )
120 {
121 returnString.append( FlavorObservable::spacesBetweenCodes,
122 ' ' );
124 *daughterIterator,
126 "" ) );
127 }
128 return returnString;
129 }
130
131}
static std::string firstWordOf(std::string const &stringToParse, std::string *const remainderString=NULL, std::string const &separatorChars=whitespaceChars)
static std::string const whitespaceAndNewlineChars
static std::string trimFromFrontAndBack(std::string const &stringToTrim, std::string const &charsToTrim=whitespaceAndNewlineChars)
static double stringToDouble(std::string const &stringToInterpret)
static std::string doubleToString(double inputDouble, int const numberOfMantissaDigits, int const numberOfExponentDigits, std::string const prefixForPositiveNumbers="+", std::string const prefixForNegativeNumbers="-", std::string const positiveExponentPrefix="+", std::string const negativeExponentPrefix="-", std::string const exponentCharacter="E")
static std::string intToSpacePaddedString(int inputInt, int const minimumNumberOfChars, std::string const prefixForPositiveNumbers="+", std::string const prefixForNegativeNumbers="-")
static int stringToInt(std::string const &stringToInterpret)
void setFromString(std::string const &valuesString)
static int const spacesBetweenCodes
static int const minimumDigitsForCodes