Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xml_test.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file xml_test.cc
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 <boost/property_tree/ptree.hpp>
7 #include <boost/property_tree/xml_parser.hpp>
8 #include <boost/foreach.hpp>
9 #include <boost/lexical_cast.hpp>
10 #include <boost/algorithm/string.hpp>
11 
12 #include <iostream>
13 #include <string>
14 
15 
16 #define f2cFortran
17 #define gFortran
18 #include "cfortran.h"
19 
20 using namespace boost;
21 using namespace std;
22 
23 float
24 atl_ran(int *)
25 {
26  return 0.0;
27 }
28 // This prevents cppcheck to flag the next line as error
29 // cppcheck-suppress *
30 FCALLSCFUN1 (FLOAT, atl_ran, ATL_RAN, atl_ran, PINT)
31 
32 using namespace boost::property_tree;
33 
34 int
35 main ()
36 {
37  iptree pt, null;
38 
39  std::ifstream config_file("xml_test.xml");
40  if (config_file)
41  {
42  read_xml (config_file, pt);
43  }
44 
45  iptree &it = pt.get_child("HIJING.FASTJET", null);
46  BOOST_FOREACH(iptree::value_type &v, it)
47  {
48  if (to_upper_copy(v.first) != "ALGORITHM") continue;
49  string name = v.second.get("NAME", "ANTIKT");
50  float R = v.second.get("R",0.4);
51  cout << name << " " << R << endl;
52  }
53 
54  return 0;
55 }