ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
main.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file main.cc
1 //
2 // Inspired by code from ATLAS. Thanks!
3 //
4 
5 #include "flowAfterburner.h"
6 
7 #include <HepMC/GenEvent.h>
8 #include <HepMC/IO_BaseClass.h>
9 #include <HepMC/IO_GenEvent.h>
10 
12 
13 #include <boost/version.hpp> // to get BOOST_VERSION
14 #if (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && (BOOST_VERSION == 106000 || BOOST_VERSION == 106700 || BOOST_VERSION == 107000))
15 #pragma GCC diagnostic ignored "-Wshadow"
16 #pragma GCC diagnostic ignored "-Wunused-parameter"
17 #pragma message "ignoring bogus gcc warning in boost header ptree.hpp"
18 #include <boost/property_tree/ptree.hpp>
19 #pragma GCC diagnostic warning "-Wshadow"
20 #pragma GCC diagnostic warning "-Wunused-parameter"
21 #else
22 #include <boost/property_tree/ptree.hpp>
23 #endif
24 
25 #include <boost/operators.hpp>
26 #include <boost/property_tree/xml_parser.hpp>
27 
28 #include <sstream>
29 #include <string>
30 #include <utility> // for swap
31 
32 namespace CLHEP
33 {
34 class HepRandomEngine;
35 }
36 
38 
39 int main()
40 {
41  using namespace boost::property_tree;
42  iptree pt;
43  // These values (coded here or in the xml file are used only in the
44  // flowAfterburner executable. If you want to adjust them in the flow
45  // module of our simulations you need to change
46  // generators/phhepmc/HepMCFlowAfterBurner.cc
47  // for the default and/or the values set in the macro
48 
49  std::ifstream config_file("flowAfterburner.xml");
50 
51  if (config_file)
52  {
53  // Read XML configuration file.
54  read_xml(config_file, pt);
55  }
56  long randomSeed = pt.get("FLOWAFTERBURNER.RANDOM.SEED", 11793);
57  engine = new CLHEP::MTwistEngine(randomSeed);
58 
59  std::string input = pt.get("FLOWAFTERBURNER.INPUT", "sHijing.dat");
60  std::string output = pt.get("FLOWAFTERBURNER.OUTPUT", "flowAfterburner.dat");
61 
62  float mineta = pt.get("FLOWAFTERBURNER.CUTS.MINETA", -5.0);
63  float maxeta = pt.get("FLOWAFTERBURNER.CUTS.MAXETA", 5.0);
64 
65  float minpt = pt.get("FLOWAFTERBURNER.CUTS.MINPT", 0.0);
66  float maxpt = pt.get("FLOWAFTERBURNER.CUTS.MAXPT", 100.0);
67 
68  std::string algorithmName = pt.get("FLOWAFTERBURNER.ALGORITHM", "MINBIAS");
69 
70  // Open input file.
71  HepMC::IO_GenEvent ascii_in(input.c_str(), std::ios::in);
72  HepMC::IO_GenEvent ascii_out(output.c_str(), std::ios::out);
73  HepMC::GenEvent *evt;
74 
75  while (ascii_in >> evt)
76  {
77  flowAfterburner(evt, engine, algorithmName, mineta, maxeta, minpt, maxpt);
78 
79  ascii_out << evt;
80  delete evt;
81  }
82 }