~ubuntu-branches/ubuntu/trusty/pythia8/trusty-proposed

« back to all changes in this revision

Viewing changes to examples/main09.cc

  • Committer: Package Import Robot
  • Author(s): Lifeng Sun
  • Date: 2012-05-22 11:43:00 UTC
  • Revision ID: package-import@ubuntu.com-20120522114300-0jvsv2vl4o2bo435
Tags: upstream-8.1.65
ImportĀ upstreamĀ versionĀ 8.1.65

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// main09.cc is a part of the PYTHIA event generator.
 
2
// Copyright (C) 2012 Torbjorn Sjostrand.
 
3
// PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
 
4
// Please respect the MCnet Guidelines, see GUIDELINES for details.
 
5
 
 
6
// Generate a predetermined second hard interaction.
 
7
 
 
8
#include "Pythia.h"
 
9
 
 
10
using namespace Pythia8;
 
11
 
 
12
int main() {
 
13
 
 
14
  // Generator. 
 
15
  Pythia pythia;
 
16
  Event& event   = pythia.event;
 
17
 
 
18
  // Select first hard process (just a small sample of possibilities).
 
19
  //pythia.readString("HardQCD:all = on");
 
20
  pythia.readString("Top:all = on");
 
21
  //pythia.readString("WeakSingleBoson:ffbar2gmZ = on");
 
22
  //pythia.readString("WeakSingleBoson:ffbar2W = on");
 
23
 
 
24
  // Select second hard process (complete list of options).
 
25
  pythia.readString("SecondHard:generate = on");
 
26
  //pythia.readString("SecondHard:TwoJets = on");
 
27
  pythia.readString("SecondHard:PhotonAndJet = on");
 
28
  //pythia.readString("SecondHard:TwoPhotons = on");
 
29
  //pythia.readString("SecondHard:SingleGmZ = on");
 
30
  //pythia.readString("SecondHard:SingleW = on");
 
31
  //pythia.readString("SecondHard:TwoBJets = on");
 
32
  
 
33
  // Kinematics cuts, common for the two. 
 
34
  pythia.readString("PhaseSpace:mHatMin = 40.");
 
35
  pythia.readString("PhaseSpace:pTHatMin = 20.");
 
36
  
 
37
  // Initialize for LHC at 8 TeV.
 
38
  pythia.readString("Beams:eCM = 8000.");  
 
39
  pythia.init();
 
40
 
 
41
  // Histogram.
 
42
  Hist pTfirst("pT first collision",    100, 0., 400.);
 
43
  Hist pTsecond("pT second collision",  100, 0., 200.);
 
44
  Hist pTdiff("pT first-second collision", 100, -100., 300.);
 
45
  Hist nMult("number of multiparton interactions", 100, -0.5, 99.5);
 
46
  Hist bMore("b enhancement factor",    100, 0., 10.);
 
47
  Hist nChg("charged multiplicity", 100, -0.5, 999.5);
 
48
 
 
49
  // Generate events.
 
50
  for (int iev = 0; iev < 1000; ++iev) {
 
51
    pythia.next();
 
52
 
 
53
    // Histogram pT.
 
54
    double pT1 = pythia.info.pTMPI(0);
 
55
    double pT2 = pythia.info.pTMPI(1);
 
56
    pTfirst.fill( pT1 );
 
57
    pTsecond.fill( pT2 );
 
58
    pTdiff.fill( pT1 - pT2 );
 
59
 
 
60
    // Histogram multiparton interactions
 
61
    double nMPI = pythia.info.nMPI();
 
62
    nMult.fill( nMPI );
 
63
    bMore.fill( pythia.info.enhanceMPI() );
 
64
 
 
65
    // Histogram charged multiplicity.
 
66
    int nCharged = 0;
 
67
    for (int i = 0; i < event.size(); ++i) 
 
68
      if (event[i].isFinal() && event[i].isCharged()) ++nCharged; 
 
69
    nChg.fill( nCharged );
 
70
 
 
71
  }
 
72
 
 
73
  // Compare full statistics listing with what is set in info.
 
74
  pythia.stat();
 
75
  cout << scientific << setprecision(3) << "\n From pythia.info: sigma = " 
 
76
       << pythia.info.sigmaGen() << " +- " << pythia.info.sigmaErr()
 
77
       << endl;
 
78
 
 
79
  // Print histograms.
 
80
  cout << pTfirst << pTsecond << pTdiff << nMult << bMore << nChg;
 
81
 
 
82
  // Done. 
 
83
  return 0;
 
84
}