10 #include "Pythia8/Pythia.h"
12 using namespace Pythia8;
15 #include "fastjet/PseudoJet.hh"
16 #include "fastjet/ClusterSequence.hh"
17 #include "fastjet/CDFMidPointPlugin.hh"
18 #include "fastjet/CDFJetCluPlugin.hh"
19 #include "fastjet/D0RunIIConePlugin.hh"
26 double pTfirstJet(
const Event& event,
int nJetMin,
double Rparam) {
28 double yPartonMax = 4.;
31 fastjet::Strategy strategy = fastjet::Best;
32 fastjet::RecombinationScheme recombScheme = fastjet::E_scheme;
33 fastjet::JetDefinition *jetDef = NULL;
35 if(event[3].colType() != 0 || event[4].colType() != 0)
36 jetDef =
new fastjet::JetDefinition(fastjet::kt_algorithm, Rparam,
37 recombScheme, strategy);
40 jetDef =
new fastjet::JetDefinition(fastjet::ee_kt_algorithm,
41 recombScheme, strategy);
43 std::vector <fastjet::PseudoJet> fjInputs;
48 for (
int i = 0; i <
event.size(); ++i) {
50 if ( !event[i].isFinal()
51 ||
event[i].isLepton()
52 ||
event[i].id() == 23
53 || abs(event[i].
id()) == 24
54 || abs(event[i].y()) > yPartonMax)
58 fjInputs.push_back( fastjet::PseudoJet (event[i].px(),
59 event[i].py(), event[i].pz(),event[i].e() ) );
63 if (
int(fjInputs.size()) == 0) {
69 fastjet::ClusterSequence clustSeq(fjInputs, *jetDef);
71 double pTFirst = sqrt(clustSeq.exclusive_dmerge_max(nJetMin-1));
83 int main(
int argc,
char* argv[] ){
87 cerr <<
" Unexpected number of command-line arguments ("<<argc<<
"). \n"
88 <<
" You are expected to provide the arguments" << endl
89 <<
" 1. Input file for settings" << endl
90 <<
" 2. Full name of the input LHE file (with path)" << endl
91 <<
" 3. Path for output histogram files" << endl
92 <<
" Program stopped. " << endl;
102 pythia.readFile(argv[1]);
103 string iPath = string(argv[2]);
104 string oPath = string(argv[3]);
106 int nEvent = pythia.mode(
"Main:numberOfEvents");
109 pythia.settings.forceParm(
"SpaceShower:pT0Ref",0.);
112 Hist histPTFirst(
"pT of first jet",100,0.,100.);
113 Hist histPTSecond(
"pT of second jet",100,0.,100.);
114 Hist histPTThird(
"pT of third jet",100,0.,100.);
117 pythia.init(iPath,
false);
119 if(pythia.flag(
"Main:showChangedSettings")) {
120 pythia.settings.listChanged();
124 for(
int iEvent=0; iEvent<nEvent; ++iEvent ){
127 if( ! pythia.next())
continue;
130 double weight = pythia.info.mergingWeight();
134 double pTfirst = pTfirstJet(pythia.event,1, 0.4);
135 double pTsecnd = pTfirstJet(pythia.event,2, 0.4);
136 double pTthird = pTfirstJet(pythia.event,3, 0.4);
137 histPTFirst.fill( pTfirst, weight);
138 histPTSecond.fill( pTsecnd, weight);
139 histPTThird.fill( pTthird, weight);
141 if(iEvent%1000 == 0) cout << iEvent << endl;
150 * pythia.info.sigmaGen()
151 * 1./ double(nEvent);
154 histPTSecond *= norm;
158 string jetsInLHEF = iPath.substr(iPath.size()-5, iPath.size());
159 jetsInLHEF = jetsInLHEF.substr(0, jetsInLHEF.size()-4);
168 suffix << jetsInLHEF <<
"_wv.dat";
171 write.open( (
char*)(oPath +
"PTjet1_" + suffix.str()).c_str());
172 histPTFirst.table(write);
175 write.open( (
char*)(oPath +
"PTjet2_" + suffix.str()).c_str());
176 histPTSecond.table(write);
179 write.open( (
char*)(oPath +
"PTjet3_" + suffix.str()).c_str());
180 histPTThird.table(write);