18 #include <TObjString.h>
20 #include <TStopwatch.h>
32 const std::string& treeName,
33 const std::string& branchName,
35 : mPrintInterval(printInterval)
44 throw std::runtime_error(
"No file provided");
46 if (!file->IsWritable()) {
47 throw std::runtime_error(
"File is not writable");
50 mTree =
new TTree(treeName.c_str(),
"PYTHIA 6 events");
53 catch(std::exception&
e) {
54 std::cout <<
"Caught exception in erhic::Pythia6::Pythia6() - " <<
55 e.what() << std::endl;
67 TPythia6* pythia = TPythia6::Instance();
71 const int initialNGenerated = pythia->GetMSTI(5);
72 const int initialNTrials = pythia->GetPyint5()->NGEN[2][0];
73 TBranch* branch =
mTree->GetBranch(
"event");
77 mNGenerated += pythia->GetMSTI(5) - initialNGenerated;
78 const int trials = pythia->GetPyint5()->NGEN[2][0] - initialNTrials;
81 double time = timer.RealTime();
82 std::cout <<
mTree->GetEntries() <<
" events in " <<
83 time <<
" seconds (+" << time - lastTime <<
")" << std::endl;
96 ss << pythia->GetPARI(1) * 1000.;
98 TObjString(s.c_str()).Write(
"crossSection");
104 TObjString(s.c_str()).Write(
"nEvents");
110 TObjString(s.c_str()).Write(
"nTrials");