File indexing completed on 2025-01-18 09:14:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <Parsers/spirit/ParsersFactory.h>
0016 #include <DDDigi/DigiMonitorOptions.h>
0017
0018
0019 namespace dd4hep {
0020
0021 namespace Parsers {
0022
0023
0024
0025
0026 std::ostream& toStream(const dd4hep::digi::H1DParams& o, std::ostream& s) {
0027 return s << "( "
0028 << '"' << o.name << '"' << " , "
0029 << '"' << o.title << '"' << " , "
0030 << o.nbin_x << " , "
0031 << o.min_x << " , "
0032 << o.max_x
0033 << " )" ;
0034 }
0035
0036
0037 template< typename Iterator, typename Skipper>
0038 class H1DParamsGrammar : public qi::grammar<Iterator, dd4hep::digi::H1DParams(), Skipper>
0039 {
0040 public:
0041
0042 typedef dd4hep::digi::H1DParams ResultT;
0043
0044 public:
0045 struct tag_name{};
0046 struct tag_title{};
0047 struct tag_nbin_x{};
0048 struct tag_min_x{};
0049 struct tag_max_x{};
0050 struct Operations {
0051
0052 template <typename A, typename B = boost::fusion::unused_type,
0053 typename C = boost::fusion::unused_type,
0054 typename D = boost::fusion::unused_type>
0055 struct result { typedef void type; };
0056
0057
0058 void operator()(dd4hep::digi::H1DParams& val, const int bin, tag_nbin_x) const {
0059 val.nbin_x = bin;
0060 }
0061
0062 void operator()(dd4hep::digi::H1DParams& val, const float x, tag_min_x) const {
0063 val.min_x = x;
0064 }
0065
0066 void operator()(dd4hep::digi::H1DParams& val, const float x, tag_max_x) const {
0067 val.max_x = x;
0068 }
0069
0070 void operator()(dd4hep::digi::H1DParams& val, const std::string& nam, tag_name) const {
0071 val.name = nam;
0072 }
0073
0074 void operator()(dd4hep::digi::H1DParams& val, const std::string& tit, tag_title) const {
0075 val.title = tit;
0076 }
0077
0078 };
0079 public:
0080 H1DParamsGrammar() : H1DParamsGrammar::base_type(para) {
0081 para = qi::lit('(')
0082 >> name[op(qi::_val, qi::_1, tag_name())]
0083 >> ','
0084 >> title[op(qi::_val, qi::_1, tag_title())]
0085 >> ','
0086 >> qi::int_[op(qi::_val, qi::_1, tag_nbin_x())]
0087 >> ','
0088 >> qi::double_[op(qi::_val, qi::_1, tag_min_x())]
0089 >> ','
0090 >> qi::double_[op(qi::_val, qi::_1, tag_max_x())]
0091 >> ')';
0092 }
0093 qi::rule<Iterator, dd4hep::digi::H1DParams(), Skipper> para;
0094 StringGrammar<Iterator, Skipper> name;
0095 StringGrammar<Iterator, Skipper> title;
0096 ph::function<Operations> op;
0097
0098 };
0099 REGISTER_GRAMMAR(dd4hep::digi::H1DParams, H1DParamsGrammar);
0100
0101 int parse(dd4hep::digi::H1DParams& result, const std::string& input) {
0102 return parse_(result, input);
0103 }
0104
0105
0106
0107
0108 std::ostream& toStream(const dd4hep::digi::H2DParams& o, std::ostream& s) {
0109 return s << "[ "
0110 << '"' << o.name << "\" , "
0111 << '"' << o.title << "\" , "
0112 << o.nbin_x << " , "
0113 << o.min_x << " , "
0114 << o.max_x << " , "
0115 << o.nbin_y << " , "
0116 << o.min_y << " , "
0117 << o.max_y
0118 << " ]" ;
0119 }
0120
0121 template< typename Iterator, typename Skipper>
0122 class H2DParamsGrammar : public qi::grammar<Iterator, dd4hep::digi::H2DParams(), Skipper>
0123 {
0124 public:
0125
0126 typedef dd4hep::digi::H2DParams ResultT;
0127
0128 public:
0129 struct tag_name{};
0130 struct tag_title{};
0131 struct tag_nbin_x{};
0132 struct tag_min_x{};
0133 struct tag_max_x{};
0134 struct tag_nbin_y{};
0135 struct tag_min_y{};
0136 struct tag_max_y{};
0137 struct Operations {
0138
0139 template <typename A, typename B = boost::fusion::unused_type,
0140 typename C = boost::fusion::unused_type,
0141 typename D = boost::fusion::unused_type>
0142 struct result { typedef void type; };
0143
0144
0145 void operator()(dd4hep::digi::H2DParams& val, const int bin, tag_nbin_x) const {
0146 val.nbin_x = bin;
0147 }
0148 void operator()(dd4hep::digi::H2DParams& val, const float x, tag_min_x) const {
0149 val.min_x = x;
0150 }
0151 void operator()(dd4hep::digi::H2DParams& val, const float x, tag_max_x) const {
0152 val.max_x = x;
0153 }
0154 void operator()(dd4hep::digi::H2DParams& val, const int bin, tag_nbin_y) const {
0155 val.nbin_y = bin;
0156 }
0157 void operator()(dd4hep::digi::H2DParams& val, const float y, tag_min_y) const {
0158 val.min_y = y;
0159 }
0160 void operator()(dd4hep::digi::H2DParams& val, const float y, tag_max_y) const {
0161 val.max_y = y;
0162 }
0163 void operator()(dd4hep::digi::H2DParams& val, const std::string& nam, tag_name) const {
0164 val.name = nam;
0165 }
0166 void operator()(dd4hep::digi::H2DParams& val, const std::string& tit, tag_title) const {
0167 val.title = tit;
0168 }
0169
0170 };
0171 public:
0172 H2DParamsGrammar() : H2DParamsGrammar::base_type(para) {
0173 para = qi::lit('[')
0174 >> name[op(qi::_val, qi::_1, tag_name())]
0175 >> ','
0176 >> title[op(qi::_val, qi::_1, tag_title())]
0177 >> ','
0178 >> qi::int_[op(qi::_val, qi::_1, tag_nbin_x())]
0179 >> ','
0180 >> qi::float_[op(qi::_val, qi::_1, tag_min_x())]
0181 >> ','
0182 >> qi::float_[op(qi::_val, qi::_1, tag_max_x())]
0183 >> ','
0184 >> qi::int_[op(qi::_val, qi::_1, tag_nbin_y())]
0185 >> ','
0186 >> qi::float_[op(qi::_val, qi::_1, tag_min_y())]
0187 >> ','
0188 >> qi::float_[op(qi::_val, qi::_1, tag_max_y())]
0189 >> ']' ;
0190 }
0191 qi::rule<Iterator, dd4hep::digi::H2DParams(), Skipper> para;
0192 StringGrammar<Iterator, Skipper> name;
0193 StringGrammar<Iterator, Skipper> title;
0194 ph::function<Operations> op;
0195
0196 };
0197 REGISTER_GRAMMAR(dd4hep::digi::H2DParams, H2DParamsGrammar);
0198
0199 int parse(dd4hep::digi::H2DParams& result, const std::string& input) {
0200 return parse_(result, input);
0201 }
0202
0203 }
0204
0205 }
0206
0207 #include "DD4hep/GrammarParsed.h"
0208 static auto s_registry = dd4hep::GrammarRegistry::pre_note<dd4hep::digi::H1DParams>()
0209 .pre_note<dd4hep::digi::H2DParams>();