Project

General

Profile

Fhiclcpp types in detail » History » Version 35

Kyle Knoepfel, 11/17/2015 01:32 PM

1 1 Kyle Knoepfel
h1. @fhiclcpp@ types in detail
2 1 Kyle Knoepfel
3 34 Kyle Knoepfel
{{toc}}
4 1 Kyle Knoepfel
5 9 Kyle Knoepfel
----
6 9 Kyle Knoepfel
7 17 Kyle Knoepfel
h1(#ctors). Parameter constructors
8 1 Kyle Knoepfel
9 18 Kyle Knoepfel
h2(#ctors_rules). %{color:blue}General rules%
10 1 Kyle Knoepfel
11 1 Kyle Knoepfel
For each of the @fhiclcpp@ types, the following rules apply:
12 12 Kyle Knoepfel
* The @Name@ argument is required.
13 12 Kyle Knoepfel
* If there is more than one argument, the @Name@ argument must be first in the list.
14 12 Kyle Knoepfel
* If there are three arguments, the relative order of the @Comment@ argument and default-value argument is not important.
15 12 Kyle Knoepfel
<pre><code class="cpp">
16 12 Kyle Knoepfel
Atom<int> val { Name("val"), Comment("Some parameter"), 9 }; // is equivalent to
17 12 Kyle Knoepfel
Atom<int> val { Name("val"), 9, Comment("Some parameter") };
18 12 Kyle Knoepfel
</code></pre>
19 32 Kyle Knoepfel
* Neither the @Table<T>@ parameter nor any of the @Optional*@ parameters support a default value.
20 1 Kyle Knoepfel
21 18 Kyle Knoepfel
h2(#atom). %{color:blue}@Atom<T>@%
22 7 Kyle Knoepfel
23 1 Kyle Knoepfel
<pre><code class="cpp">
24 1 Kyle Knoepfel
Atom<int> var { Name("var") };
25 1 Kyle Knoepfel
Atom<int> var { Name("var"), 9 };
26 7 Kyle Knoepfel
Atom<int> var { Name("var"), Comment("A parameter description") };
27 1 Kyle Knoepfel
Atom<int> var { Name("var"), Comment("A parameter description"), 9 };
28 1 Kyle Knoepfel
</code></pre>
29 1 Kyle Knoepfel
30 33 Kyle Knoepfel
h2(#opt_atom). %{color:blue}@OptionalAtom<T>@%
31 33 Kyle Knoepfel
32 33 Kyle Knoepfel
<pre><code class="cpp">
33 33 Kyle Knoepfel
OptionalAtom<int> var { Name("var") };
34 33 Kyle Knoepfel
OptionalAtom<int> var { Name("var"), Comment("A parameter description") };
35 33 Kyle Knoepfel
</code></pre>
36 33 Kyle Knoepfel
37 33 Kyle Knoepfel
h2(#opt_vector). %{color:blue}@OptionalSequence<T>@%
38 33 Kyle Knoepfel
39 33 Kyle Knoepfel
This class template is used for unbounded sequences.  See the two caveats below.
40 33 Kyle Knoepfel
41 33 Kyle Knoepfel
<pre><code class="cpp">
42 33 Kyle Knoepfel
OptionalSequence<int> seq { Name("seq") };
43 33 Kyle Knoepfel
OptionalSequence<int> seq { Name("seq"), Comment("A sequence") };
44 33 Kyle Knoepfel
</code></pre>
45 33 Kyle Knoepfel
46 33 Kyle Knoepfel
h2(#opt_array). %{color:blue}@OptionalSequence<T,std::size_t>@%
47 33 Kyle Knoepfel
48 33 Kyle Knoepfel
This class template is used for sequences of a specific length, known at compile time.
49 33 Kyle Knoepfel
50 33 Kyle Knoepfel
<pre><code class="cpp">
51 33 Kyle Knoepfel
OptionalSequence<int,3u> seq { Name("seq") };
52 33 Kyle Knoepfel
OptionalSequence<int,3u> seq { Name("seq"), Comment("A sequence") };
53 33 Kyle Knoepfel
</code></pre>
54 33 Kyle Knoepfel
55 33 Kyle Knoepfel
h2(#opt_table). %{color:blue}@OptionalTable<T>@%
56 33 Kyle Knoepfel
57 33 Kyle Knoepfel
<pre><code class="cpp">
58 33 Kyle Knoepfel
OptionalTable<T> config { Name("config") };
59 33 Kyle Knoepfel
OptionalTable<T> config { Name("config"), Comment("This describes the table") };
60 33 Kyle Knoepfel
</code></pre>
61 33 Kyle Knoepfel
62 33 Kyle Knoepfel
h2(#opt_tuple). %{color:blue}@OptionalTuple<T...>@%
63 33 Kyle Knoepfel
64 33 Kyle Knoepfel
<pre><code class="cpp">
65 33 Kyle Knoepfel
OptionalTuple<string,bool> tuple { Name("tuple") };
66 33 Kyle Knoepfel
OptionalTuple<string,bool> tuple { Name("tuple"), Comment("A tuple") };
67 33 Kyle Knoepfel
</code></pre>
68 33 Kyle Knoepfel
69 18 Kyle Knoepfel
h2(#vector). %{color:blue}@Sequence<T>@%
70 1 Kyle Knoepfel
71 18 Kyle Knoepfel
This class template is used for unbounded sequences.  See the two caveats below.
72 18 Kyle Knoepfel
73 1 Kyle Knoepfel
<pre><code class="cpp">
74 7 Kyle Knoepfel
Sequence<int> seq { Name("seq") };
75 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Comment("A sequence") };
76 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Sequence<int>{ 4, 5, 6, 7 } };
77 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), { 4, 5, 6, 7 } };
78 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Comment("A sequence"), Sequence<int>{ 4, 5, 6, 7 } };
79 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Comment("A sequence"), { 4, 5, 6, 7 } };
80 1 Kyle Knoepfel
</code></pre>
81 1 Kyle Knoepfel
82 1 Kyle Knoepfel
h3(#make_empty). @Sequence<T>::make_empty()@
83 1 Kyle Knoepfel
84 8 Kyle Knoepfel
Due to the implementation details of the unbounded sequence, the following:
85 1 Kyle Knoepfel
86 8 Kyle Knoepfel
<pre><code class="cpp">
87 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Sequence<int>{} }; // Don't do this.
88 1 Kyle Knoepfel
</code></pre>
89 1 Kyle Knoepfel
90 18 Kyle Knoepfel
_does not_ represent an empty sequence.  If you would like an empty sequence as a default value, use the following:
91 1 Kyle Knoepfel
92 1 Kyle Knoepfel
<pre><code class="cpp">
93 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Sequence<int>::make_empty() };
94 1 Kyle Knoepfel
</code></pre>
95 1 Kyle Knoepfel
96 18 Kyle Knoepfel
h3(#narrowing). Precaution regarding narrowing conversions and @std::initializer_list@ objects
97 1 Kyle Knoepfel
98 19 Kyle Knoepfel
The following configuration will trigger a compilation warning:
99 19 Kyle Knoepfel
100 19 Kyle Knoepfel
<pre><code class="cpp">
101 19 Kyle Knoepfel
Sequence<int> seq1 { Name("seq1"), Sequence<int>{ 1, 2.4e-4 } };
102 19 Kyle Knoepfel
Sequence<int> seq2 { Name("seq2"), { 1, 2.4e-4 } };
103 19 Kyle Knoepfel
</code></pre>
104 19 Kyle Knoepfel
105 19 Kyle Knoepfel
that looks similar to this:
106 18 Kyle Knoepfel
107 18 Kyle Knoepfel
<pre>
108 18 Kyle Knoepfel
warning: narrowing conversion of ‘2.4000000000000001e-4’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
109 18 Kyle Knoepfel
</pre>
110 1 Kyle Knoepfel
111 1 Kyle Knoepfel
For build systems that convert compile-time warnings to errors, this will result in a build failure.  The warning results from the nature of an @std::initializer_list@ object, signified by @'{1, 2.4e-4}'@, which is used to initialize the sequence objects.  For @std::initializer_list@ objects, narrowing conversions are not allowed--that is, converting a @double@ to an @int@ is an example of narrowing that results in loss of information.  This is the most likely example of where you may find a narrowing conversion.
112 1 Kyle Knoepfel
113 1 Kyle Knoepfel
h2(#array). %{color:blue}@Sequence<T,std::size_t>@%
114 1 Kyle Knoepfel
115 1 Kyle Knoepfel
This class template is used for sequences of a specific length, known at compile time.
116 1 Kyle Knoepfel
117 1 Kyle Knoepfel
<pre><code class="cpp">
118 1 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq") };
119 18 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), Comment("A sequence") };
120 17 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), Sequence<int,3u>{ 4, 5, 6 } };
121 18 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), { 4, 5, 6 } };
122 18 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), Comment("A sequence"), Sequence<int,3u>{ 4, 5, 6 } };
123 1 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), Comment("A sequence"), { 4, 5, 6 } };
124 1 Kyle Knoepfel
</code></pre>
125 1 Kyle Knoepfel
126 1 Kyle Knoepfel
The warning regarding narrowing conversions [[Fhiclcpp_types_in_detail#narrowing|above]] applies for bounded sequences as well.
127 1 Kyle Knoepfel
128 33 Kyle Knoepfel
h2(#table). %{color:blue}@Table<T>@%
129 33 Kyle Knoepfel
130 33 Kyle Knoepfel
<pre><code class="cpp">
131 33 Kyle Knoepfel
Table<T> config { Name("config") };
132 33 Kyle Knoepfel
Table<T> config { Name("config"), Comment("This describes the table") };
133 33 Kyle Knoepfel
</code></pre>
134 33 Kyle Knoepfel
135 1 Kyle Knoepfel
h2(#tuple). %{color:blue}@Tuple<T...>@%
136 1 Kyle Knoepfel
137 1 Kyle Knoepfel
<pre><code class="cpp">
138 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple") };
139 18 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), Comment("A tuple") };
140 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), Tuple<string,bool>{"explicit?", true} };
141 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), {"compact?", true } };
142 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), Comment("A tuple"), Tuple<string,bool>{ "Particle physics is neat.", true } };
143 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), Comment("A tuple"), { "This is false", false } };
144 1 Kyle Knoepfel
</code></pre>
145 1 Kyle Knoepfel
146 1 Kyle Knoepfel
----
147 1 Kyle Knoepfel
148 35 Kyle Knoepfel
h1(#return). Standard parameters - return types
149 35 Kyle Knoepfel
150 35 Kyle Knoepfel
|{background:#fba}. *@fhiclcpp@ parameter*|{background:#fba}. *Function call*|{background:#fba}. *Return type*|
151 35 Kyle Knoepfel
|\3{background:#ddd}. _Simple @fhiclcpp@ parameters_|
152 35 Kyle Knoepfel
|@Atom<std::string> label@; |@label()@| @std::string const&@|
153 35 Kyle Knoepfel
|/2.@Sequence<int> counts@; | @counts()@ | @std::vector<int>@|
154 35 Kyle Knoepfel
|@counts(1)@ | @int@ |
155 35 Kyle Knoepfel
|/2.@Sequence<double, 3u> point@;| @point()@ | @std::array<double, 3u>@|
156 35 Kyle Knoepfel
|@point(0)@ | @double@ |
157 35 Kyle Knoepfel
|/3.@Tuple<std::string, double> assoc;@|@assoc()@| @std::tuple<std::string, double>@|
158 35 Kyle Knoepfel
|@assoc.get<0>()@|@std::string@|
159 35 Kyle Knoepfel
|@assoc.get<double>()@|@double@|
160 35 Kyle Knoepfel
|@Table<Config> config;@|@config()@|@Config const&@|
161 35 Kyle Knoepfel
|\3{background:#ddd}. _Nested @fhiclcpp@ parameters_|
162 35 Kyle Knoepfel
|/2.@Sequence< Sequence<int> > datasets;@ | @datasets()@ | @std::vector< std::vector<int> >@ |
163 35 Kyle Knoepfel
| @datasets(17)@ | @std::vector<int>@ |
164 35 Kyle Knoepfel
|/2.@Sequence< Sequence<int>, 2u > twoDatasets;@ | @twoDatasets()@ | @std::array< std::vector<int>, 2u >@ |
165 35 Kyle Knoepfel
|@twoDatasets(1)@ | @std::vector<int>@ |
166 35 Kyle Knoepfel
|/2.@Sequence< Sequence<int, 2u> > intPairs;@ | @intPairs()@ | @std::vector< std::array<int, 2u> >@ |
167 35 Kyle Knoepfel
|@intPairs(42)@ | @std::array<int, 2u>@|
168 35 Kyle Knoepfel
|/2.@Sequence< Tuple<std::string, int, bool> > triplets;@ | @triplets()@ | @std::vector< std::tuple<std::string, int, bool> >@ |
169 35 Kyle Knoepfel
|@triplets(3)@ | @std::tuple<std::string, int, bool>@ |
170 35 Kyle Knoepfel
|/2.@Sequence< Table<Config> > manyConfigTables;@ | @manyConfigTables()@ | @std::vector< Config >@ |
171 35 Kyle Knoepfel
|@manyConfigTables(6)@ | @Config const&@ |
172 35 Kyle Knoepfel
|/5.@Tuple< std::string, Table<Config> > configAssoc;@ | @configAssoc()@ | @std::tuple< std::string, Config >@ |
173 35 Kyle Knoepfel
|@configAssoc.get<0>()@ | @std::string@ |
174 35 Kyle Knoepfel
|@configAssoc.get<std::string>()@ | @std::string@ |
175 35 Kyle Knoepfel
|@configAssoc.get<1>()@ | @Config@ |
176 35 Kyle Knoepfel
|@configAssoc.get< Table<Config> >()@ | @Config@ |
177 35 Kyle Knoepfel
|/3.@Tuple< Tuple<std::string,bool>, Sequence<int> > awkward;@ | @awkward()@ | @std::tuple< std::tuple<std::string, bool>, std::vector<int> >@ |
178 35 Kyle Knoepfel
|@awkward.get<0>()@|@std::tuple<std::string,bool>@|
179 35 Kyle Knoepfel
|@awkward.get<1>()@|@std::vector<int>@|
180 35 Kyle Knoepfel
181 35 Kyle Knoepfel
h1(#opt_arg). @Optional@ parameters - argument types
182 1 Kyle Knoepfel
183 1 Kyle Knoepfel
|{background:#fba}. *@fhiclcpp@ parameter*|{background:#fba}. *Function call*|{background:#fba}. *Return type*|
184 1 Kyle Knoepfel
|\3{background:#ddd}. _Simple @fhiclcpp@ parameters_|
185 1 Kyle Knoepfel
|@Atom<std::string> label@; |@label()@| @std::string const&@|
186 1 Kyle Knoepfel
|/2.@Sequence<int> counts@; | @counts()@ | @std::vector<int>@|
187 1 Kyle Knoepfel
|@counts(1)@ | @int@ |
188 1 Kyle Knoepfel
|/2.@Sequence<double, 3u> point@;| @point()@ | @std::array<double, 3u>@|
189 1 Kyle Knoepfel
|@point(0)@ | @double@ |
190 1 Kyle Knoepfel
|/3.@Tuple<std::string, double> assoc;@|@assoc()@| @std::tuple<std::string, double>@|
191 1 Kyle Knoepfel
|@assoc.get<0>()@|@std::string@|
192 1 Kyle Knoepfel
|@assoc.get<double>()@|@double@|
193 8 Kyle Knoepfel
|@Table<Config> config;@|@config()@|@Config const&@|
194 8 Kyle Knoepfel
|\3{background:#ddd}. _Nested @fhiclcpp@ parameters_|
195 8 Kyle Knoepfel
|/2.@Sequence< Sequence<int> > datasets;@ | @datasets()@ | @std::vector< std::vector<int> >@ |
196 8 Kyle Knoepfel
| @datasets(17)@ | @std::vector<int>@ |
197 8 Kyle Knoepfel
|/2.@Sequence< Sequence<int>, 2u > twoDatasets;@ | @twoDatasets()@ | @std::array< std::vector<int>, 2u >@ |
198 8 Kyle Knoepfel
|@twoDatasets(1)@ | @std::vector<int>@ |
199 8 Kyle Knoepfel
|/2.@Sequence< Sequence<int, 2u> > intPairs;@ | @intPairs()@ | @std::vector< std::array<int, 2u> >@ |
200 8 Kyle Knoepfel
|@intPairs(42)@ | @std::array<int, 2u>@|
201 8 Kyle Knoepfel
|/2.@Sequence< Tuple<std::string, int, bool> > triplets;@ | @triplets()@ | @std::vector< std::tuple<std::string, int, bool> >@ |
202 1 Kyle Knoepfel
|@triplets(3)@ | @std::tuple<std::string, int, bool>@ |
203 1 Kyle Knoepfel
|/2.@Sequence< Table<Config> > manyConfigTables;@ | @manyConfigTables()@ | @std::vector< Config >@ |
204 7 Kyle Knoepfel
|@manyConfigTables(6)@ | @Config const&@ |
205 1 Kyle Knoepfel
|/5.@Tuple< std::string, Table<Config> > configAssoc;@ | @configAssoc()@ | @std::tuple< std::string, Config >@ |
206 7 Kyle Knoepfel
|@configAssoc.get<0>()@ | @std::string@ |
207 10 Kyle Knoepfel
|@configAssoc.get<std::string>()@ | @std::string@ |
208 10 Kyle Knoepfel
|@configAssoc.get<1>()@ | @Config@ |
209 11 Kyle Knoepfel
|@configAssoc.get< Table<Config> >()@ | @Config@ |
210 10 Kyle Knoepfel
|/3.@Tuple< Tuple<std::string,bool>, Sequence<int> > awkward;@ | @awkward()@ | @std::tuple< std::tuple<std::string, bool>, std::vector<int> >@ |
211 10 Kyle Knoepfel
|@awkward.get<0>()@|@std::tuple<std::string,bool>@|
212 14 Kyle Knoepfel
|@awkward.get<1>()@|@std::vector<int>@|
213 14 Kyle Knoepfel
214 14 Kyle Knoepfel
----
215 1 Kyle Knoepfel
216 22 Kyle Knoepfel
h1(#table_func). Additional functions for @Table<T>@
217 21 Kyle Knoepfel
218 21 Kyle Knoepfel
The @Table@ template offers a few extra functions that the user can call: 
219 21 Kyle Knoepfel
220 21 Kyle Knoepfel
<pre><code class="cpp">
221 21 Kyle Knoepfel
fhicl::ParameterSet const& get_PSet() const;
222 21 Kyle Knoepfel
223 21 Kyle Knoepfel
void print_allowed_configuration(std::ostream& os,
224 21 Kyle Knoepfel
                                 std::string const& tab = std::string(3,' ') ) const;
225 21 Kyle Knoepfel
226 21 Kyle Knoepfel
// Expert-level functions
227 21 Kyle Knoepfel
void validate_ParameterSet(fhicl::ParameterSet const& pset,
228 21 Kyle Knoepfel
                           std::set<std::string> const& keysToIgnore = {} );
229 21 Kyle Knoepfel
230 21 Kyle Knoepfel
</code></pre>
231 21 Kyle Knoepfel
232 21 Kyle Knoepfel
h3(#get_pset). @get_PSet@
233 21 Kyle Knoepfel
234 21 Kyle Knoepfel
A call to this function returns a @const@ reference to the @ParameterSet@ object that was used to fill the values of the individual @Table@ members.  This is helpful for users who need to interact with the @ParameterSet@ object itself.
235 21 Kyle Knoepfel
236 21 Kyle Knoepfel
h3(#print). @print_allowed_configuration@
237 21 Kyle Knoepfel
238 21 Kyle Knoepfel
For any @Table<Config>@ object, @print_allowed_configuration@ will fill a user-supplied @std::ostream@ object with the allowed configuration as defined by the @Config@ struct.  The optional second argument specifies the number of spaces per indentation.  The default is 3 spaces but is, of course, user-configurable.
239 21 Kyle Knoepfel
240 24 Kyle Knoepfel
----
241 1 Kyle Knoepfel
242 28 Kyle Knoepfel
%{color:red} _[ *N.B.* The following function should not normally be invoked by users. It is meant to be called only in contexts outside of @art@.  Please consult artists@fnal.gov for guidance.]_%
243 24 Kyle Knoepfel
244 21 Kyle Knoepfel
h3(#validate). @validate_ParameterSet@ (expert)
245 21 Kyle Knoepfel
246 1 Kyle Knoepfel
This function is intended for experts who need to validate the @pset@ object themselves.  The @keysToIgnore@ variable represents a set of keys for which the validation step will ignore.  The validation function will ignore any nested keys as well--i.e. if a user specifies an ignorable key as @table1@, the (e.g.) @table1.someAtom@ key would be ignored in addition to just the @table1@ name.  An indexed parameter (e.g.) @seq[1]@ is considered a nested parameter of its parent @seq@.  Providing or not providing the ignorable key in a configuration will lead to no error upon validation of the @ParameterSet@.
247 21 Kyle Knoepfel
248 24 Kyle Knoepfel
Should the validation step fail, an exception is thrown of type @fhicl::detail::validationException@.  This behavior is not currently configurable.
249 21 Kyle Knoepfel
250 25 Kyle Knoepfel
----
251 25 Kyle Knoepfel
252 17 Kyle Knoepfel
h1(#common_acc). Common parameter accessors
253 14 Kyle Knoepfel
254 14 Kyle Knoepfel
Each of the @fhiclcpp@ types has the following accessors:
255 14 Kyle Knoepfel
<pre><code class="cpp">
256 14 Kyle Knoepfel
std::string key()            const;
257 30 Kyle Knoepfel
std::string name()           const;
258 14 Kyle Knoepfel
std::string comment()        const;
259 14 Kyle Knoepfel
bool        has_default()    const;
260 30 Kyle Knoepfel
bool        is_optional()    const;
261 14 Kyle Knoepfel
par_type    parameter_type() const;
262 14 Kyle Knoepfel
</code></pre>
263 14 Kyle Knoepfel
264 14 Kyle Knoepfel
To call these functions, the difference in syntax is crucial:
265 14 Kyle Knoepfel
266 14 Kyle Knoepfel
<pre><code class="cpp">
267 14 Kyle Knoepfel
Atom<int> val { Name("val") };
268 14 Kyle Knoepfel
269 14 Kyle Knoepfel
auto key1 = val.key();   //   correct
270 14 Kyle Knoepfel
auto key2 = val().key(); // ! compile-time ERROR - 'val()' is an int, which has no accessor called 'key()' 
271 14 Kyle Knoepfel
</code></pre>
272 14 Kyle Knoepfel
273 17 Kyle Knoepfel
h2. @key()@
274 14 Kyle Knoepfel
275 14 Kyle Knoepfel
A call to @key()@ returns the _full_ key, including all enclosing tables.  For example, consider a module that is designed to allow the following configuration:
276 14 Kyle Knoepfel
<pre><code class="ruby">
277 14 Kyle Knoepfel
pset: {
278 14 Kyle Knoepfel
  list: [ { particle: electron },
279 14 Kyle Knoepfel
          { particle: muon } ]
280 14 Kyle Knoepfel
}
281 31 Kyle Knoepfel
</code></pre>For a suitably declared set of @fhiclcpp@ parameters, the returned key corresponding to "muon" would be @pset.list[1].particle@.
282 1 Kyle Knoepfel
283 30 Kyle Knoepfel
h2. @name()@
284 14 Kyle Knoepfel
285 30 Kyle Knoepfel
The name is the most-nested name in the key.  For the above "muon" parameter, a key of @pset.list[1].particle@ has a corresponding name of @particle@.  If the parameter in question were @pset.list[1]@, the name would be[1] @list[1]@.
286 1 Kyle Knoepfel
287 30 Kyle Knoepfel
fn1. Technically, this is inaccurate -- sequence elements do not have names.  However, for the sake of parameter identification, a sequence element has a name whose value is the sequence name with the appropriate sequence element index/indices appended.
288 30 Kyle Knoepfel
289 17 Kyle Knoepfel
h2. @comment()@
290 14 Kyle Knoepfel
291 14 Kyle Knoepfel
Returns the comment supplied as the string literal in (e.g.) @Comment("Here is the comment")@.  If no @Comment@ argument is provided in the @fhiclcpp@ parameter constructor, a call to this function returns an empty string.
292 14 Kyle Knoepfel
293 17 Kyle Knoepfel
h2. @has_default()@
294 14 Kyle Knoepfel
295 1 Kyle Knoepfel
Returns @true@ or @false@ depending on whether the user supplied a default value for the parameter.
296 1 Kyle Knoepfel
297 30 Kyle Knoepfel
h2. @is_optional()@
298 30 Kyle Knoepfel
299 30 Kyle Knoepfel
Returns @true@ or @false@ depending on whether the parameter is of an @Optional*@ @fhiclcpp@ type.
300 30 Kyle Knoepfel
301 1 Kyle Knoepfel
h2. @parameter_type()@
302 1 Kyle Knoepfel
303 1 Kyle Knoepfel
Returns an enumeration value based on the parameter type:
304 1 Kyle Knoepfel
305 14 Kyle Knoepfel
<pre><code class="cpp">
306 14 Kyle Knoepfel
enum class par_type {
307 30 Kyle Knoepfel
  ATOM,        // (Optional)Atom<T>
308 30 Kyle Knoepfel
  TABLE,       // (Optional)Table<T>
309 30 Kyle Knoepfel
  SEQ_VECTOR,  // (Optional)Sequence<T>
310 30 Kyle Knoepfel
  SEQ_ARRAY,   // (Optional)Sequence<T,std::size_t>
311 30 Kyle Knoepfel
  TUPLE,       // (Optional)Tuple<T...>
312 14 Kyle Knoepfel
  NTYPES       // Signifies invalid parameter 
313 14 Kyle Knoepfel
};
314 14 Kyle Knoepfel
</code></pre>