1 #include "Pythia8/Pythia.h"
2 #include "Pythia8Plugins/HepMC2.h"
16 pythiaengine.readString(
"Beams:eCM = 200.");
17 pythiaengine.readString(
"HardQCD:all = on");
18 pythiaengine.readString(
"PhaseSpace:pTHatMin = 4");
19 pythiaengine.readString(
"Random::setSeed = on");
20 pythiaengine.readString(
"Random::seed =0");
24 string tfilename = filename+
"_analysis.root";
25 TFile *outFile =
new TFile(tfilename.c_str(),
"RECREATE");
26 TTree *photonTree =
new TTree(
"photonTree",
"phat phirn tree");
27 photonTree->SetAutoSave(300);
28 vector<float> photon_pT;
29 photonTree->Branch(
"photon_pT",&photon_pT);
30 TTree *nophotonTree =
new TTree(
"nophotonTree",
"phat phirn tree");
31 unsigned noPhotonEvents=0;
32 nophotonTree->Branch(
"n",&noPhotonEvents);
34 for (
int iEvent = 0; iEvent <
nEvents; ++iEvent)
36 if (!pythiaengine.next()){
37 cout<<
"pythia.next() failed"<<
"\n";
42 for(
unsigned ipart=0; ipart!=pythiaengine.event.size(); ipart++){
43 if(pythiaengine.event[ipart].id()==22&&pythiaengine.event[ipart].isFinal()&&pythiaengine.event[ipart].pT()>10
44 &&TMath::Abs(pythiaengine.event[ipart].eta()))photon_pT.push_back(pythiaengine.event[ipart].pT());
46 if (photon_pT.size()>0)photonTree->Fill();
63 int main(
int argc,
char const *argv[] )
65 string fileOut =
string(argv[1]);
66 bool signalOnly=
false;
67 if(argv[2][0]==
'1'||argv[2][0]==
't')signalOnly=
true;
68 long nEvents =strtol(argv[2],NULL,10);
70 cout<<
"All done"<<endl;