Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:16:38

0001 // Allows the user to generate hijing events and store the results in
0002 // a HepMC file.
0003 //
0004 // Inspired by code from ATLAS.  Thanks!
0005 //
0006 #include <boost/algorithm/string.hpp>
0007 #include <boost/foreach.hpp>
0008 #include <boost/lexical_cast.hpp>
0009 #include <boost/property_tree/ptree.hpp>
0010 #include <boost/property_tree/xml_parser.hpp>
0011 
0012 #include <iostream>
0013 #include <string>
0014 
0015 #define f2cFortran
0016 #define gFortran
0017 
0018 #pragma GCC diagnostic push
0019 #pragma GCC diagnostic ignored "-Wunused-function"
0020 #include "cfortran.h"
0021 #pragma GCC diagnostic pop
0022 
0023 using namespace boost;
0024 using namespace std;
0025 
0026 float atl_ran(int * /*unused*/)
0027 {
0028   return 0.0;
0029 }
0030 // This prevents cppcheck to flag the next line as error
0031 // cppcheck-suppress *
0032 FCALLSCFUN1(FLOAT, atl_ran, ATL_RAN, atl_ran, PINT)
0033 
0034 using namespace boost::property_tree;
0035 
0036 // NOLINTNEXTLINE(bugprone-exception-escape)
0037 int main()
0038 {
0039   iptree pt, null;
0040 
0041   std::ifstream config_file("xml_test.xml");
0042   if (config_file)
0043   {
0044     read_xml(config_file, pt);
0045   }
0046 
0047   iptree &it = pt.get_child("HIJING.FASTJET", null);
0048   BOOST_FOREACH (iptree::value_type &v, it)
0049   {
0050     if (to_upper_copy(v.first) != "ALGORITHM")
0051     {
0052       continue;
0053     }
0054     string name = v.second.get("NAME", "ANTIKT");
0055     float R = v.second.get("R", 0.4);
0056     cout << name << " " << R << endl;
0057   }
0058 
0059   return 0;
0060 }