Skip to content

Commit

Permalink
add W+jet configs
Browse files Browse the repository at this point in the history
  • Loading branch information
mverwe committed Apr 20, 2020
1 parent 0c4ce08 commit 5f5994b
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ COMMONSRC =
F77SRC =
COMMONOBJ =

PROGSRC = runConstituentSubtraction.cc runConversionQPYTHIA.cc runCreatePythiaEvents.cc runCreatePythiaEventsPartonLevel.cc runCreateThermalEvents.cc runCSVariations.cc runFromFile.cc runHybridJetAnalysis.cc runJetPerformance.cc runJetProfile.cc runJetProfileJewelSub.cc runJewelSub.cc runSDGenVarious.cc runSDGenVariousJewelSub.cc runSharedLayerSubtraction.cc runSimpleJetAnalysis.cc runtest.cc
PROGOBJ = runConstituentSubtraction.o runConversionQPYTHIA.o runCreatePythiaEvents.o runCreatePythiaEventsPartonLevel.o runCreateThermalEvents.o runCSVariations.o runFromFile.o runHybridJetAnalysis.o runJetPerformance.o runJetProfile.o runJetProfileJewelSub.o runJewelSub.o runSDGenVarious.o runSDGenVariousJewelSub.o runSharedLayerSubtraction.o runSimpleJetAnalysis.o runtest.o
PROGSRC = runConstituentSubtraction.cc runConversionQPYTHIA.cc runCreatePythiaEvents.cc runCreatePythiaEvents10000E-W-320.cc runCreatePythiaEventsPartonLevel.cc runCreatePythiaEventsWJet.cc runCreateThermalEvents.cc runCSVariations.cc runFromFile.cc runHybridJetAnalysis.cc runJetPerformance.cc runJetProfile.cc runJetProfileJewelSub.cc runJewelSub.cc runSDGenVarious.cc runSDGenVariousJewelSub.cc runSharedLayerSubtraction.cc runSimpleJetAnalysis.cc runtest.cc
PROGOBJ = runConstituentSubtraction.o runConversionQPYTHIA.o runCreatePythiaEvents.o runCreatePythiaEvents10000E-W-320.o runCreatePythiaEventsPartonLevel.o runCreatePythiaEventsWJet.o runCreateThermalEvents.o runCSVariations.o runFromFile.o runHybridJetAnalysis.o runJetPerformance.o runJetProfile.o runJetProfileJewelSub.o runJewelSub.o runSDGenVarious.o runSDGenVariousJewelSub.o runSharedLayerSubtraction.o runSimpleJetAnalysis.o runtest.o

INCLUDE +=
LIBRARIES += -LPU14 -lPU14 -lz


all: runConstituentSubtraction runConversionQPYTHIA runCreatePythiaEvents runCreatePythiaEventsPartonLevel runCreateThermalEvents runCSVariations runFromFile runHybridJetAnalysis runJetPerformance runJetProfile runJetProfileJewelSub runJewelSub runSDGenVarious runSDGenVariousJewelSub runSharedLayerSubtraction runSimpleJetAnalysis runtest
all: runConstituentSubtraction runConversionQPYTHIA runCreatePythiaEvents runCreatePythiaEvents10000E-W-320 runCreatePythiaEventsPartonLevel runCreatePythiaEventsWJet runCreateThermalEvents runCSVariations runFromFile runHybridJetAnalysis runJetPerformance runJetProfile runJetProfileJewelSub runJewelSub runSDGenVarious runSDGenVariousJewelSub runSharedLayerSubtraction runSimpleJetAnalysis runtest


runConstituentSubtraction: runConstituentSubtraction.o $(COMMONOBJ)
Expand All @@ -52,9 +52,15 @@ runConversionQPYTHIA: runConversionQPYTHIA.o $(COMMONOBJ)
runCreatePythiaEvents: runCreatePythiaEvents.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runCreatePythiaEvents10000E-W-320: runCreatePythiaEvents10000E-W-320.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runCreatePythiaEventsPartonLevel: runCreatePythiaEventsPartonLevel.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runCreatePythiaEventsWJet: runCreatePythiaEventsWJet.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runCreateThermalEvents: runCreateThermalEvents.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

Expand Down Expand Up @@ -102,7 +108,7 @@ clean:
rm -vf $(COMMONOBJ) $(PROGOBJ)

realclean: clean
rm -vf runConstituentSubtraction runConversionQPYTHIA runCreatePythiaEvents runCreatePythiaEventsPartonLevel runCreateThermalEvents runCSVariations runFromFile runHybridJetAnalysis runJetPerformance runJetProfile runJetProfileJewelSub runJewelSub runSDGenVarious runSDGenVariousJewelSub runSharedLayerSubtraction runSimpleJetAnalysis runtest
rm -vf runConstituentSubtraction runConversionQPYTHIA runCreatePythiaEvents runCreatePythiaEvents10000E-W-320 runCreatePythiaEventsPartonLevel runCreatePythiaEventsWJet runCreateThermalEvents runCSVariations runFromFile runHybridJetAnalysis runJetPerformance runJetProfile runJetProfileJewelSub runJewelSub runSDGenVarious runSDGenVariousJewelSub runSharedLayerSubtraction runSimpleJetAnalysis runtest

.cc.o: $<
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
Expand Down Expand Up @@ -135,10 +141,17 @@ runConversionQPYTHIA.o: PU14/CmdLine.hh
runCreatePythiaEvents.o: include/ProgressBar.h include/pythiaEvent.hh
runCreatePythiaEvents.o: include/extraInfo.hh include/extraInfo.hh
runCreatePythiaEvents.o: PU14/CmdLine.hh
runCreatePythiaEvents10000E-W-320.o: include/ProgressBar.h
runCreatePythiaEvents10000E-W-320.o: include/pythiaEventW.hh
runCreatePythiaEvents10000E-W-320.o: include/extraInfo.hh
runCreatePythiaEvents10000E-W-320.o: include/extraInfo.hh PU14/CmdLine.hh
runCreatePythiaEventsPartonLevel.o: include/ProgressBar.h
runCreatePythiaEventsPartonLevel.o: include/pythiaEvent.hh
runCreatePythiaEventsPartonLevel.o: include/extraInfo.hh include/extraInfo.hh
runCreatePythiaEventsPartonLevel.o: PU14/CmdLine.hh
runCreatePythiaEventsWJet.o: include/ProgressBar.h include/pythiaEventWJet.hh
runCreatePythiaEventsWJet.o: include/extraInfo.hh include/extraInfo.hh
runCreatePythiaEventsWJet.o: PU14/CmdLine.hh
runCreateThermalEvents.o: include/ProgressBar.h include/thermalEvent.hh
runCreateThermalEvents.o: include/extraInfo.hh PU14/CmdLine.hh
runCSVariations.o: include/ProgressBar.h PU14/EventMixer.hh PU14/CmdLine.hh
Expand Down
109 changes: 109 additions & 0 deletions include/pythiaEventW.hh
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
110 changes: 110 additions & 0 deletions include/pythiaEventWJet.hh
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
88 changes: 88 additions & 0 deletions runCreatePythiaEventsWJet.cc
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;

}

0 comments on commit 5f5994b

Please sign in to comment.