a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
SinglyIndexedMultipleEntriesBlock.hpp
Go to the documentation of this file.
1/*
2 * SinglyIndexedMultipleEntriesBlock.hpp
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#ifndef SINGLYINDEXEDMULTIPLEENTRIESBLOCK_HPP_
15#define SINGLYINDEXEDMULTIPLEENTRIESBLOCK_HPP_
16
17#include "../../MEC/ExtendedMass.hpp"
20
21namespace LHPC
22{
23 namespace SLHA
24 {
25 /* this template class interprets all the blocks with the same name, though
26 * differing scale values, which are interpreted as having a single int
27 * index which does not have to have entries for each value (nor even
28 * necessarily positive index values), allowing for multiple entries with
29 * the same index.
30 */
31 template< class ValueClass >
33 ValueClass,
34 InterpreterClass::MultipleSinglyIndexed< ValueClass > >
35 {
36 public:
38 ValueClass const& defaultUnsetValue,
39 bool const isVerbose = false,
40 int const indexDigits = 5 );
41 virtual
43
44 std::list< ValueClass* >
45 operator()( int const soughtIndex );
46 // this returns operator() of the lowest-scale interpreter.
47 std::list< ValueClass const* >
48 operator()( int const soughtIndex ) const;
49 // const version of above.
50 bool
51 hasEntry( int const soughtIndex ) const;
52 // this returns hasEntry( soughtIndex ) of the lowest-scale interpreter.
53 virtual bool
54 isFmassBlock() const;
55 // this returns false. only a specific derived class should over-ride it
56 // to return true if it is actually an interpreter for a FMASS block.
57 virtual std::multimap< int, RunningConstant > const*
58 getFmassMap() const;
59 // this returns NULL. only a specific derived class should over-ride it
60 // to return a non-NULL pointer.
61 virtual bool
62 isFmasserrBlock() const;
63 // this returns false. only a specific derived class should over-ride it
64 // to return true if it is actually an interpreter for a FMASS block.
65 virtual std::multimap< int, RunningConstantError > const*
66 getFmasserrMap() const;
67 // this returns NULL. only a specific derived class should over-ride it
68 // to return a non-NULL pointer.
69
70
71 protected:
74 };
75
76
77
78
79
80 template< class ValueClass >
81 inline
84 std::string const& blockName,
85 ValueClass const& defaultUnsetValue,
86 bool const isVerbose,
87 int const indexDigits ) :
88 IndexedBlockTemplate< ValueClass,
89 InterpreterClass::MultipleSinglyIndexed< ValueClass > >(
90 blockName,
91 defaultUnsetValue,
92 isVerbose,
93 std::vector< int >( 1,
94 indexDigits ) ),
95 isFmassBlockFlag( false ),
96 isFmasserrBlockFlag( false )
97 {
98 if( this->nameMatches( "FMASS" ) )
99 {
100 isFmassBlockFlag = true;
101 }
102 else if( this->nameMatches( "FMASSERR" ) )
103 {
104 isFmasserrBlockFlag = true;
105 }
106 }
107
108 template< class ValueClass >
109 inline
111 >::~SinglyIndexedMultipleEntriesBlock()
112 {
113 // does nothing.
114 }
115
116
117 template< class ValueClass >
118 inline std::list< ValueClass* >
120 int const soughtIndex )
121 // this returns operator() of the lowest-scale interpreter.
122 {
123 return this->dataBlocks[ this->lowestScaleIndex ]( soughtIndex );
124 }
125
126 template< class ValueClass >
127 inline std::list< ValueClass const* >
129 int const soughtIndex ) const
130 // const version of above.
131 {
132 return this->dataBlocks[ this->lowestScaleIndex ]( soughtIndex );
133 }
134
135 template< class ValueClass >
136 inline bool
138 int const soughtIndex ) const
139 // this returns hasEntry( soughtIndex ) of the lowest-scale interpreter.
140 {
141 return
142 this->dataBlocks[ this->lowestScaleIndex ].hasEntry( soughtIndex );
143 }
144
145 template< class ValueClass >
146 inline bool
148 // this returns false. only a specific derived class should over-ride it
149 // to return true if it is actually an interpreter for an FMASS block.
150 {
151 return isFmassBlockFlag;
152 }
153
154 template< class ValueClass >
155 inline std::multimap< int, RunningConstant > const*
157 // this returns NULL. only a specific derived class should over-ride it
158 // to return a non-NULL pointer.
159 {
160 return NULL;
161 }
162
163 template<>
164 inline std::multimap< int, RunningConstant > const*
166 // this over-rides the default to return a non-NULL pointer if appropriate.
167 {
168 if( isFmassBlockFlag )
169 {
170 return &(this->dataBlocks[ this->lowestScaleIndex ].getValueMap());
171 }
172 else
173 {
174 return NULL;
175 }
176 }
177
178 template< class ValueClass >
179 inline bool
181 // this returns false. only a specific derived class should over-ride it
182 // to return true if it is actually an interpreter for an FMASS block.
183 {
184 return isFmasserrBlockFlag;
185 }
186
187 template< class ValueClass >
188 inline std::multimap< int, RunningConstantError > const*
190 // this returns NULL. only a specific derived class should over-ride it
191 // to return a non-NULL pointer.
192 {
193 return NULL;
194 }
195
196 template<>
197 inline std::multimap< int, RunningConstantError > const*
199 ) const
200 // this over-rides the default to return a non-NULL pointer if appropriate.
201 {
202 if( isFmasserrBlockFlag )
203 {
204 return &(this->dataBlocks[ this->lowestScaleIndex ].getValueMap());
205 }
206 else
207 {
208 return NULL;
209 }
210 }
211
212 } // end of SLHA namespace
213
214} // end of LHPC namespace
215
216#endif /* SINGLYINDEXEDMULTIPLEENTRIESBLOCK_HPP_ */
bool nameMatches(std::string const &nameToCompare) const
virtual std::multimap< int, RunningConstantError > const * getFmasserrMap() const
SinglyIndexedMultipleEntriesBlock(std::string const &blockName, ValueClass const &defaultUnsetValue, bool const isVerbose=false, int const indexDigits=5)
std::list< ValueClass * > operator()(int const soughtIndex)
virtual std::multimap< int, RunningConstant > const * getFmassMap() const
ValueClass const defaultUnsetValue
Definition: SlhaBlock.hpp:139