-
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
4 changed files
with
324 additions
and
4 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,109 @@ | ||
#ifndef pythiaEventW_h | ||
#define pythiaEventW_h | ||
|
||
#include <iostream> | ||
#include <vector> | ||
#include <string> | ||
#include <algorithm> | ||
#include <fstream> | ||
|
||
#include "Pythia8/Pythia.h" | ||
|
||
#include "extraInfo.hh" | ||
|
||
//using namespace std; | ||
|
||
//--------------------------------------------------------------- | ||
// Description | ||
// This class generates a pythia8 event | ||
// Author: M. Verweij | ||
//--------------------------------------------------------------- | ||
|
||
class pythiaEventW { | ||
|
||
private : | ||
Pythia8::Pythia pythia; | ||
double pthat_; | ||
unsigned int tune_; | ||
double rapMin_; | ||
double rapMax_; | ||
bool partonLevel_; | ||
|
||
std::vector<fastjet::PseudoJet> partons; | ||
|
||
public : | ||
pythiaEventW(double pthat = 120., unsigned int tune = 14, double rapMin = -3., double rapMax = 3., bool partonLevel = false); | ||
std::vector<fastjet::PseudoJet> createPythiaEvent(); | ||
|
||
std::vector<fastjet::PseudoJet> getPartonList() const { return partons; } | ||
|
||
}; | ||
|
||
pythiaEventW::pythiaEventW(double pthat, unsigned int tune, double rapMin, double rapMax, bool partonLevel) : | ||
pthat_(pthat), tune_(tune), rapMin_(rapMin), rapMax_(rapMax), partonLevel_(partonLevel) | ||
{ | ||
|
||
// Generator. LHC process and output selection. Initialization. | ||
// tunes: http://home.thep.lu.se/~torbjorn/pythia82html/Tunes.html | ||
pythia.readString("Beams:idA = 2212"); | ||
pythia.readString("Beams:idB = 2212"); | ||
pythia.readString("Beams:eCM = 5002."); | ||
//pythia.readString("HardQCD:all = on"); | ||
pythia.readString(Form("PhaseSpace:pTHatMin = %.1f",pthat_)); | ||
pythia.readString("Next:numberShowInfo = 0"); | ||
pythia.readString("Next:numberShowProcess = 0"); | ||
pythia.readString("Next:numberShowEvent = 0"); | ||
pythia.readString(Form("Tune:pp = %d",tune_)); | ||
pythia.readString("Random:setSeed = on"); | ||
pythia.readString("WeakDoubleBoson:ffbar2WW=on"); | ||
pythia.readString("24:onIfAny = 1 2 3 4 5"); | ||
pythia.readString("310:mayDecay = off"); | ||
pythia.readString("3122:mayDecay = off"); | ||
pythia.readString("3112:mayDecay = off"); | ||
pythia.readString("3212:mayDecay = off"); | ||
pythia.readString("3222:mayDecay = off"); | ||
pythia.readString("3312:mayDecay = off"); | ||
pythia.readString("3322:mayDecay = off"); | ||
pythia.readString("3334:mayDecay = off"); | ||
|
||
pythia.readString("Random:seed = 0"); | ||
if(partonLevel_) { | ||
pythia.readString("HadronLevel:all = off"); | ||
} | ||
|
||
|
||
pythia.init(); | ||
} | ||
|
||
std::vector<fastjet::PseudoJet> pythiaEventW::createPythiaEvent() { | ||
|
||
pythia.next(); //generate next event | ||
|
||
std::vector<fastjet::PseudoJet> particles; | ||
partons.clear(); //empty list before storing partons of new event | ||
|
||
pythia.event.list(); | ||
|
||
for (int i = 0; i < pythia.event.size(); ++i) { | ||
if (pythia.event[i].isFinal()) { | ||
fastjet::PseudoJet p(pythia.event[i].px(),pythia.event[i].py(),pythia.event[i].pz(),pythia.event[i].e()); | ||
p.set_user_info(new extraInfo(pythia.event[i].id(), 0)); | ||
if(p.rap()>rapMin_ && p.rap()<rapMax_) | ||
particles.push_back(p); | ||
} else if (pythia.event[i].status()==-23) { | ||
fastjet::PseudoJet p(pythia.event[i].px(),pythia.event[i].py(),pythia.event[i].pz(),pythia.event[i].e()); | ||
p.set_user_info(new extraInfo(pythia.event[i].id(), -1)); | ||
partons.push_back(p); | ||
} | ||
|
||
//if(abs(pythia.event[i].id())<7) { | ||
// std::cout << "px: " << pythia.event[i].px() << " py: " << pythia.event[i].py() << " pz: " << pythia.event[i].pz() << " status: " << pythia.event[i].status() << " id: " << pythia.event[i].id() << std::endl; | ||
//} | ||
|
||
} | ||
|
||
return particles; | ||
} | ||
|
||
|
||
#endif |
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,110 @@ | ||
#ifndef pythiaEventW_h | ||
#define pythiaEventW_h | ||
|
||
#include <iostream> | ||
#include <vector> | ||
#include <string> | ||
#include <algorithm> | ||
#include <fstream> | ||
|
||
#include "Pythia8/Pythia.h" | ||
|
||
#include "extraInfo.hh" | ||
|
||
//using namespace std; | ||
|
||
//--------------------------------------------------------------- | ||
// Description | ||
// This class generates a pythia8 event | ||
// Author: M. Verweij | ||
//--------------------------------------------------------------- | ||
|
||
class pythiaEventWJet { | ||
|
||
private : | ||
Pythia8::Pythia pythia; | ||
double pthat_; | ||
unsigned int tune_; | ||
double rapMin_; | ||
double rapMax_; | ||
bool partonLevel_; | ||
|
||
std::vector<fastjet::PseudoJet> partons; | ||
|
||
public : | ||
pythiaEventWJet(double pthat = 120., unsigned int tune = 14, double rapMin = -3., double rapMax = 3., bool partonLevel = false); | ||
std::vector<fastjet::PseudoJet> createPythiaEvent(); | ||
|
||
std::vector<fastjet::PseudoJet> getPartonList() const { return partons; } | ||
|
||
}; | ||
|
||
pythiaEventWJet::pythiaEventWJet(double pthat, unsigned int tune, double rapMin, double rapMax, bool partonLevel) : | ||
pthat_(pthat), tune_(tune), rapMin_(rapMin), rapMax_(rapMax), partonLevel_(partonLevel) | ||
{ | ||
|
||
// Generator. LHC process and output selection. Initialization. | ||
// tunes: http://home.thep.lu.se/~torbjorn/pythia82html/Tunes.html | ||
pythia.readString("Beams:idA = 2212"); | ||
pythia.readString("Beams:idB = 2212"); | ||
pythia.readString("Beams:eCM = 5002."); | ||
//pythia.readString("HardQCD:all = on"); | ||
pythia.readString(Form("PhaseSpace:pTHatMin = %.1f",pthat_)); | ||
pythia.readString("Next:numberShowInfo = 0"); | ||
pythia.readString("Next:numberShowProcess = 0"); | ||
pythia.readString("Next:numberShowEvent = 0"); | ||
pythia.readString(Form("Tune:pp = %d",tune_)); | ||
pythia.readString("Random:setSeed = on"); | ||
pythia.readString("WeakBosonAndParton:qqbar2Wg=on"); | ||
pythia.readString("WeakBosonAndParton:qg2Wq=on"); | ||
pythia.readString("24:onIfAny = 1 2 3 4 5"); | ||
pythia.readString("310:mayDecay = off"); | ||
pythia.readString("3122:mayDecay = off"); | ||
pythia.readString("3112:mayDecay = off"); | ||
pythia.readString("3212:mayDecay = off"); | ||
pythia.readString("3222:mayDecay = off"); | ||
pythia.readString("3312:mayDecay = off"); | ||
pythia.readString("3322:mayDecay = off"); | ||
pythia.readString("3334:mayDecay = off"); | ||
|
||
pythia.readString("Random:seed = 0"); | ||
if(partonLevel_) { | ||
pythia.readString("HadronLevel:all = off"); | ||
} | ||
|
||
|
||
pythia.init(); | ||
} | ||
|
||
std::vector<fastjet::PseudoJet> pythiaEventWJet::createPythiaEvent() { | ||
|
||
pythia.next(); //generate next event | ||
|
||
std::vector<fastjet::PseudoJet> particles; | ||
partons.clear(); //empty list before storing partons of new event | ||
|
||
pythia.event.list(); | ||
|
||
for (int i = 0; i < pythia.event.size(); ++i) { | ||
if (pythia.event[i].isFinal()) { | ||
fastjet::PseudoJet p(pythia.event[i].px(),pythia.event[i].py(),pythia.event[i].pz(),pythia.event[i].e()); | ||
p.set_user_info(new extraInfo(pythia.event[i].id(), 0)); | ||
if(p.rap()>rapMin_ && p.rap()<rapMax_) | ||
particles.push_back(p); | ||
} else if (pythia.event[i].status()==-23) { | ||
fastjet::PseudoJet p(pythia.event[i].px(),pythia.event[i].py(),pythia.event[i].pz(),pythia.event[i].e()); | ||
p.set_user_info(new extraInfo(pythia.event[i].id(), -1)); | ||
partons.push_back(p); | ||
} | ||
|
||
//if(abs(pythia.event[i].id())<7) { | ||
// std::cout << "px: " << pythia.event[i].px() << " py: " << pythia.event[i].py() << " pz: " << pythia.event[i].pz() << " status: " << pythia.event[i].status() << " id: " << pythia.event[i].id() << std::endl; | ||
//} | ||
|
||
} | ||
|
||
return particles; | ||
} | ||
|
||
|
||
#endif |
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,88 @@ | ||
#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/pythiaEventWJet.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",320);//120.; | ||
unsigned int tune = cmdline.value<int>("-tune",14); | ||
|
||
std::cout << "generating " << nEvent << " events with pthat = " << ptHat << " and tune = " << tune << std::endl; | ||
|
||
pythiaEventWJet pyt(ptHat, tune, -3.0, 3.0, true); | ||
|
||
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/10000EWB%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); | ||
|
||
Bar.Update(ie); | ||
Bar.PrintWithMod(entryDiv); | ||
|
||
//--------------------------------------------------------------------------- | ||
// produce event | ||
//--------------------------------------------------------------------------- | ||
|
||
std::cout << "# event " << ie << "\n"; | ||
fout << "# event " << ie << "\n"; | ||
|
||
//create pythia event | ||
std::vector<fastjet::PseudoJet> particlesSig = pyt.createPythiaEvent(); | ||
|
||
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"; | ||
} | ||
|
||
fout.close(); | ||
|
||
std::cout << "\n Finished generating PYTHIA events" << std::endl; | ||
|
||
} |