-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
108 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <iostream> | ||
|
||
#include "TFile.h" | ||
#include "TTree.h" | ||
|
||
#include "fastjet/PseudoJet.hh" | ||
#include "fastjet/ClusterSequenceArea.hh" | ||
|
||
#include "include/ProgressBar.h" | ||
|
||
#include "include/pythiaEvent.hh" | ||
#include "include/extraInfo.hh" | ||
|
||
#include "PU14/CmdLine.hh" | ||
|
||
using namespace std; | ||
using namespace fastjet; | ||
|
||
int main (int argc, char ** argv) | ||
{ | ||
// Uncomment to silence fastjet banner | ||
ClusterSequence::set_fastjet_banner_stream(NULL); | ||
|
||
CmdLine cmdline(argc,argv); | ||
// inputs read from command line | ||
unsigned int nEvent = cmdline.value<unsigned int>("-nev",1); // first argument: command line option; second argument: default value | ||
|
||
// Number of events, generated and listed ones. | ||
//unsigned int nEvent = 10000; | ||
|
||
//event generator settings | ||
double ptHat = cmdline.value<double>("-pthat",120);//120.; | ||
unsigned int tune = cmdline.value<int>("-tune",14); | ||
|
||
std::cout << "generating " << nEvent << " events with pthat = " << ptHat << " and tune = " << tune << std::endl; | ||
|
||
pythiaEvent pyt(ptHat, tune, -3.0, 3.0,false,false,false,1); | ||
|
||
ProgressBar Bar(cout, nEvent); | ||
Bar.SetStyle(-1); | ||
|
||
//output text file | ||
ofstream fout; | ||
const char *dir = getenv("PWD");//"/eos/user/m/mverweij/JetWorkshop2017/samples/"; | ||
TString outFileName = Form("%s/PythiaPhotonEventsTune%dPtHat%.0f.pu14",dir,tune,ptHat); | ||
|
||
fout.open(outFileName.Data()); | ||
|
||
unsigned int entryDiv = (nEvent > 200) ? nEvent / 200 : 1; | ||
for(unsigned int ie = 0; ie < nEvent; ie++) { | ||
Bar.Update(ie); | ||
Bar.PrintWithMod(entryDiv); | ||
|
||
//--------------------------------------------------------------------------- | ||
// produce event | ||
//--------------------------------------------------------------------------- | ||
|
||
fout << "# event " << ie << "\n"; | ||
|
||
//create pythia event | ||
std::vector<fastjet::PseudoJet> particlesSig = pyt.createPythiaEvent(); | ||
fout << "weight " << pyt.getWeight() << " pthat " << pyt.getPtHat() << "\n"; //<< " weight " << pow(15./pyt.getPtHat(),4.5) | ||
|
||
std::vector<fastjet::PseudoJet> partons = pyt.getPartonList(); | ||
for(fastjet::PseudoJet p : partons) { | ||
const int & pdgid = p.user_info<extraInfo>().pdg_id(); | ||
const int & vtx = p.user_info<extraInfo>().vertex_number(); | ||
fout << p.px() << " " << p.py() << " " << p.pz() << " " << p.m() << " " << pdgid << " " << vtx << "\n"; | ||
} | ||
|
||
for(fastjet::PseudoJet p : particlesSig) { | ||
const int & pdgid = p.user_info<extraInfo>().pdg_id(); | ||
const int & vtx = p.user_info<extraInfo>().vertex_number(); | ||
fout << p.px() << " " << p.py() << " " << p.pz() << " " << p.m() << " " << pdgid << " " << vtx << "\n"; | ||
} | ||
fout << "end\n"; | ||
|
||
//std::cout << "weight: " << std::scientific << pyt.getWeight() << std::endl; | ||
//std::cout << "pthat: " << std::fixed << pyt.getPtHat() << std::endl; | ||
} | ||
|
||
pyt.getStat(); | ||
|
||
|
||
fout.close(); | ||
|
||
std::cout << "\n Finished generating PYTHIA events" << std::endl; | ||
|
||
} |