Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-18 09:18:17

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 
0025 float atl_ran(int * /*unused*/)
0026 {
0027   return 0.0;
0028 }
0029 // This prevents cppcheck to flag the next line as error
0030 // cppcheck-suppress *
0031 FCALLSCFUN1(FLOAT, atl_ran, ATL_RAN, atl_ran, PINT)
0032 
0033 
0034 int main() // NOLINT(bugprone-exception-escape)
0035 {
0036   boost::property_tree::iptree pt;
0037   boost::property_tree::iptree null;
0038 
0039   std::ifstream config_file("xml_test.xml");
0040   if (config_file)
0041   {
0042     read_xml(config_file, pt);
0043   }
0044 
0045   boost::property_tree::iptree &it = pt.get_child("HIJING.FASTJET", null);
0046   BOOST_FOREACH (boost::property_tree::iptree::value_type &v, it)
0047   {
0048     if (boost::to_upper_copy(v.first) != "ALGORITHM")
0049     {
0050       continue;
0051     }
0052     std::string name = v.second.get("NAME", "ANTIKT");
0053     float R = v.second.get("R", 0.4);
0054     std::cout << name << " " << R << std::endl;
0055   }
0056 
0057   return 0;
0058 }