ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xml_test.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file xml_test.C
1 // Allows the user to generate hijing events and store the results in
2 // a HepMC file.
3 //
4 // Inspired by code from ATLAS. Thanks!
5 //
6 #include <iostream>
7 #include <cstdlib>
8 #include <string>
9 #include <memory>
10 #include <vector>
11 #include <numeric>
12 #include <cmath>
13 
14 #include <boost/property_tree/ptree.hpp>
15 #include <boost/property_tree/xml_parser.hpp>
16 #include <boost/foreach.hpp>
17 #include <boost/lexical_cast.hpp>
18 #include <boost/algorithm/string.hpp>
19 
20 #define f2cFortran
21 #define gFortran
22 #include "cfortran.h"
23 
24 using namespace boost;
25 using namespace std;
26 
27 float
28 atl_ran(int *)
29 {
30  return 0.0;
31 }
32 // This prevents cppcheck to flag the next line as error
33 // cppcheck-suppress *
34 FCALLSCFUN1 (FLOAT, atl_ran, ATL_RAN, atl_ran, PINT)
35 
36 using namespace boost::property_tree;
37 
38 int
39 main ()
40 {
41  iptree pt, null;
42 
43  std::ifstream config_file("xml_test.xml");
44  if (config_file)
45  {
46  read_xml (config_file, pt);
47  }
48 
49  iptree &it = pt.get_child("HIJING.FASTJET", null);
50  BOOST_FOREACH(iptree::value_type &v, it)
51  {
52  if (to_upper_copy(v.first) != "ALGORITHM") continue;
53  string name = v.second.get("NAME", "ANTIKT");
54  float R = v.second.get("R",0.4);
55  cout << name << " " << R << endl;
56  }
57 
58  return 0;
59 }