ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/dasu/UltraFastSim/generateData.cc
Revision: 1.2
Committed: Wed Feb 9 07:20:36 2011 UTC (14 years, 3 months ago) by dasu
Content type: text/plain
Branch: MAIN
Changes since 1.1: +10 -0 lines
Log Message:
Added shell for bTagData

File Contents

# Content
1 // This simple program generates various signal processes for
2 // MSSM bbPhi process and its backgrounds.
3 // It includes the mixing of required level of pileup.
4 // It then takes pythia output and runs it through very simplistic
5 // detector simulation using parameterizations, including making
6 // isolated light leptons, photons, composite tau, jet and b-tagged
7 // jet objects.
8 // It saves the output in root format for later analysis.
9
10 using namespace std;
11 #include <math.h>
12
13 #include "Pythia.h"
14 using namespace Pythia8;
15
16 #include "UltraFastSim.h"
17
18 int main(int argc, char **argv) {
19 // Generator. Process selection. LHC initialization. Histogram.
20 Pythia pythia;
21 int nEvents = 0;
22 int runNumber = 0;
23 int meanPileupEventCount = 0;
24 if(argc < 3 || argc > 5)
25 {
26 cerr << "Command syntax: " << argv[0] << " BBA[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
27 cerr << "or " << argv[0] << " ZLL[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
28 cerr << "or " << argv[0] << " TLN[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
29 cerr << "or " << argv[0] << " WLN[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
30 exit(1);
31 }
32 else {
33 nEvents = atoi(argv[2]);
34 if(argc >= 4) runNumber = atoi(argv[3]);
35 if(argc >= 5) meanPileupEventCount = atoi(argv[4]);
36 if(strncmp(argv[1], "ZLL", 3) == 0)
37 {
38 pythia.readString("WeakSingleBoson:ffbar2gmZ = on");
39 pythia.readString("PhaseSpace:mHatMin = 60.");
40 pythia.readString("PhaseSpace:mHatMax = -1");
41 pythia.readString("23:onMode = 0"); // Z decays to leptons only
42 pythia.readString("23:onIfAny = 11 13 15");
43 pythia.readString("15:onMode = 2"); // tau- decays to electrons and muons - second tau decays in all modes
44 pythia.readString("15:onIfAny = 11 13");
45 }
46 else if(strncmp(argv[1], "WLN", 3) == 0)
47 {
48 pythia.readString("WeakSingleBoson:ffbar2W = on");
49 pythia.readString("24:onMode = 0"); // W decays to light leptons only
50 pythia.readString("24:onIfAny = 11 13");
51 }
52 else if(strncmp(argv[1], "TLN", 3) == 0)
53 {
54 pythia.readString("Top:all = on");
55 pythia.readString("24:onMode = 2"); // W+ decays to light leptons only
56 pythia.readString("24:onIfAny = 11 13");
57 }
58 else if(strncmp(argv[1], "BBA", 3) == 0)
59 {
60 pythia.readString("Higgs:useBSM = on");
61 pythia.readString("HiggsBSM:gg2A3bbbar = on");
62 pythia.readString("36:onMode = 0"); // A0(H_3) decays only to tau-pairs
63 pythia.readString("36:onIfAny = 15");
64 }
65 else
66 {
67 cerr << "Unknown process type " << argv[1] << " - aborting" << endl;
68 exit(1);
69 }
70 }
71
72 // Initialize pythia
73
74 pythia.init( 2212, 2212, 14000.);
75 pythia.particleData.listAll();
76 Rndm * rndmPtr = &pythia.rndm;
77 rndmPtr->init(runNumber);
78
79 // Pileup pythia
80
81 Pythia pileupPythia;
82 pileupPythia.readString("SoftQCD:minBias = on");
83 pileupPythia.init( 2212, 2212, 14000.);
84 pileupPythia.rndm.init(runNumber);
85
86 // Ultra Fast Simulator
87
88 UltraFastSim ufs(rndmPtr);
89
90 // Begin event loop
91 for (int iEvent = 0; iEvent < nEvents; ) {
92
93 // Generate event. Skip if error. List first one.
94 if (!pythia.next()) continue;
95
96 // Add pileup
97
98 int pileupEventCount = 0;
99 if(meanPileupEventCount > 0) pileupEventCount = meanPileupEventCount; // * rmdmPtr->pois(); (not available yet)
100 for (int puEvent = 0; puEvent < pileupEventCount; ) {
101 if(!pileupPythia.next()) continue;
102 for(int i = 0; i < pileupPythia.event.size(); i++) {
103 Particle& particle = pileupPythia.event[i];
104 if(particle.status() > 0) {
105 if(particle.isVisible()) {
106 if(particle.pT() > 0.5) {
107 pythia.event.append(particle);
108 }
109 }
110 }
111 }
112 puEvent++;
113 }
114
115 // Ultra fast simulation
116
117 if(!ufs.run(pythia.event))
118 {
119 cerr << "Ultra fast simulation failed - aborting" << endl;
120 exit(1);
121 }
122
123 cout << "Number of Particles = " << ufs.particleList().size() << endl;
124 cout << "Number of Gen Elecs = " << ufs.electronList().size() << endl;
125 cout << "Number of Gen Muons = " << ufs.muonList().size() << endl;
126 cout << "Number of Gen Taus = " << ufs.genTauList().size() << endl;
127 cout << "Number of b Quarks = " << ufs.bQuarkList().size() << endl;
128 cout << "Number of Jets = " << ufs.sortedJetList().size() << endl;
129 cout << "Number of bJets = " << ufs.bJetList().size() << endl;
130 cout << "Number of taus = " << ufs.tauList().size() << endl;
131 cout << endl;
132
133 // End of event loop. Statistics. Histogram. Done.
134
135 if(!(iEvent % 100)) cout << "Processed event " << iEvent << endl;
136 iEvent++;
137
138 }
139
140 // Save output
141
142 pythia.statistics();
143 pileupPythia.statistics();
144
145 return 0;
146
147 }