a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
MassSpectrum.hpp
Go to the documentation of this file.
1/*
2 * MassSpectrum.hpp
3 *
4 * Created on: Jan 8, 2012
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#ifndef MASSSPECTRUM_HPP_
15#define MASSSPECTRUM_HPP_
16
17#include <iostream>
18#include <stdexcept>
19#include <map>
20#include "MassEigenstate.hpp"
21#include "SpectrumUpdater.hpp"
23
24namespace LHPC
25{
26 // this class holds a set of MassEigenstate instances & can update them with
27 // a pair of maps of codes to masses.
28 class MassSpectrum : public BOL::PushedToObserver< SpectrumUpdater >
29 {
30 public:
32 {
34 isJet = 1,
36 sizeOfEnum = 3
37 };
38 MassSpectrum( bool const isVerbose = false,
39 std::vector< bool > const* defaultFlags = NULL );
40 virtual
42
44 operator[]( int const pdgCode );
45 MassEigenstate const&
46 operator[]( int const pdgCode ) const;
48 getMassEigenstate( int const pdgCode );
49 MassEigenstate const*
50 getMassEigenstate( int const pdgCode ) const;
51 std::vector< MassEigenstate* >&
53 std::vector< MassEigenstate* > const&
56 ensureMassEigenstateExists( int const pdgCode );
59 bool
60 getVerbosity() const;
61 virtual void
63 // the default is over-ridden to call clearMassesAndDecays().
64 virtual void
65 respondToPush( SpectrumUpdater const& pushedValue );
66
67
68 protected:
69 static std::vector< bool > const defaultBoolVector;
70 static std::vector< bool > const defaultEscapesDetectorBoolVector;
71 static std::vector< bool > const defaultIsJetBoolVector;
72 static std::vector< bool > const defaultIsLightLeptonBoolVector;
73
74 static MassEigenstate&
75 findMassEigenstateReference( int const pdgCode,
76 MassEigenstateCodeToPointerMap const& codeMap );
77 static void
78 warnThatMassEigenstateWasNotFound( int const pdgCode );
79
80 std::vector< MassEigenstate* > allMassEigenstates;
81 std::vector< MassEigenstate* > unknownMassEigenstates;
83 bool const isVerbose;
85 };
86
87
88
89 inline MassEigenstate&
90 MassSpectrum::operator[]( int const pdgCode )
91 {
92 return findMassEigenstateReference( pdgCode,
93 pdgCodeMap );
94 }
95
96 inline MassEigenstate const&
97 MassSpectrum::operator[]( int const pdgCode ) const
98 {
99 return findMassEigenstateReference( pdgCode,
100 pdgCodeMap );
101 }
102
103 inline MassEigenstate*
105 {
107 pdgCodeMap );
108 }
109
110 inline MassEigenstate const*
111 MassSpectrum::getMassEigenstate( int const pdgCode ) const
112 {
114 pdgCodeMap );
115 }
116
117 inline std::vector< MassEigenstate* >&
119 {
120 return allMassEigenstates;
121 }
122
123 inline std::vector< MassEigenstate* > const&
125 {
126 return allMassEigenstates;
127 }
128
129 inline MassSpectrum&
131 {
132 for( int clearingIndex( allMassEigenstates.size() - 1 );
133 0 <= clearingIndex;
134 --clearingIndex )
135 {
136 allMassEigenstates[ clearingIndex ]->clearMassesAndDecays();
137 }
138 return *this;
139 }
140
141 inline bool
143 {
144 return isVerbose;
145 }
146
147 inline void
149 // the default is over-ridden to call clearMassesAndDecays().
150 {
152 }
153
154 inline void
156 {
157 pushedValue.updateMassEigenstates( pdgCodeMap );
158 }
159
160 inline MassEigenstate&
162 MassEigenstateCodeToPointerMap const& codeMap )
163 {
165 massEigenstatePointer( MassEigenstate::findPointerWithCode( pdgCode,
166 codeMap ) );
167 if( NULL != massEigenstatePointer )
168 {
169 return *massEigenstatePointer;
170 }
171 else
172 {
173 std::string
174 errorMessage( "MassSpectrum::findMassEigenstateReference( " );
175 errorMessage.append( BOL::StringParser::intToString( pdgCode,
176 1 ) );
177 errorMessage.append( ") out of range." );
179 throw std::out_of_range( errorMessage );
180 }
181 }
182
183 inline void
185 {
186 std::cout
187 << std::endl
188 << "LhaParsing::error! MassEigenstate::findPointerWithCode could not"
189 << " find the MassEigenstate with particle code " << pdgCode
190 << ", so it is returning a NULL pointer. MassSpectrum is throwing an"
191 << " out-of-range exception because of this.";
192 std::cout << std::endl;
193 }
194
195}
196
197#endif /* MASSSPECTRUM_HPP_ */
static std::string intToString(int inputInt, int const minimumNumberOfDigits, std::string const prefixForPositiveNumbers="+", std::string const prefixForNegativeNumbers="-", char const paddingChar='0')
static MassEigenstate * findPointerWithCode(int pdgCode, MassEigenstateCodeMap const &codeMap)
MassEigenstate & operator[](int const pdgCode)
static MassEigenstate & findMassEigenstateReference(int const pdgCode, MassEigenstateCodeToPointerMap const &codeMap)
MassSpectrum & clearMassesAndDecays()
std::vector< MassEigenstate * > unknownMassEigenstates
MassSpectrum(bool const isVerbose=false, std::vector< bool > const *defaultFlags=NULL)
static void warnThatMassEigenstateWasNotFound(int const pdgCode)
std::vector< MassEigenstate * > allMassEigenstates
MassEigenstateMapAndVectorAndBools mapAndVectorAndBools
std::vector< MassEigenstate * > & getMassEigenstateSet()
virtual void respondToObservedSignal()
static std::vector< bool > const defaultIsLightLeptonBoolVector
virtual ~MassSpectrum()
MassEigenstateCodeToPointerMap pdgCodeMap
bool const isVerbose
bool getVerbosity() const
static std::vector< bool > const defaultIsJetBoolVector
virtual void respondToPush(SpectrumUpdater const &pushedValue)
MassEigenstate * getMassEigenstate(int const pdgCode)
static std::vector< bool > const defaultBoolVector
MassEigenstate & ensureMassEigenstateExists(int const pdgCode)
static std::vector< bool > const defaultEscapesDetectorBoolVector
void updateMassEigenstates(MassEigenstateCodeToPointerMap &codeMap) const
std::map< int, MassEigenstate * > MassEigenstateCodeToPointerMap