ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/dasu/UltraFastSim/generateData.cc
(Generate patch)

Comparing UserCode/dasu/UltraFastSim/generateData.cc (file contents):
Revision 1.6 by dasu, Tue Feb 15 21:56:55 2011 UTC vs.
Revision 1.11 by dasu, Thu Feb 24 07:34:29 2011 UTC

# Line 13 | Line 13 | using namespace std;
13   #include "Pythia.h"
14   using namespace Pythia8;
15  
16 + #include "TROOT.h"
17 + #include "TFile.h"
18 +
19   #include "UltraFastSim.h"
20 < #include "Analysis.h"
20 > #include "bbHAnalysis.h"
21 > #include "ZHAnalysis.h"
22  
23   int main(int argc, char **argv) {
24    // Generator. Process selection. LHC initialization. Histogram.
# Line 26 | Line 30 | int main(int argc, char **argv) {
30      {
31        cerr << "Command syntax: " << argv[0] << " ZHmmbb[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
32        cerr << "or              " << argv[0] << " ZHeebb[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
33 +      cerr << "or              " << argv[0] << " ZZmmbb[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
34        cerr << "or              " << argv[0] << " BBHmh[...] " << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
35        cerr << "or              " << argv[0] << " BBAmh[...] " << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
36        cerr << "or              " << argv[0] << " Zee[...]   " << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
# Line 154 | Line 159 | int main(int argc, char **argv) {
159            pythia.readString("15:onIfAny = 13");
160          }
161        }
162 +     else if(strncmp(argv[1], "ZZmmbb", 6) == 0)
163 +       {
164 +         pythia.readString("WeakDoubleBoson:ffbar2gmZgmZ = on");
165 +         pythia.readString("23:onMode = 0");
166 +         pythia.readString("23:onIfAny = 5 13");   // Let the Z decay to bQuarks or muons
167 +       }
168      else
169        {
170          cerr << "Unknown process type " << argv[1] << " - aborting" << endl;
# Line 161 | Line 172 | int main(int argc, char **argv) {
172        }
173    }
174  
175 +  string name(argv[1]);
176 +  name += ".root";
177 +  TFile *outFile = TFile::Open(name.c_str(), "recreate");
178 +
179    // Initialize pythia
180  
181    pythia.init( 2212, 2212, 14000.);
# Line 178 | Line 193 | int main(int argc, char **argv) {
193    // Ultra Fast Simulator
194  
195    UltraFastSim ufs(rndmPtr);
196 <  Analysis analysis(argv[1], &ufs);
196 >  bbHAnalysis bbH(outFile, &pythia, &ufs, true);
197 >  ZHAnalysis ZH; // outFile, &pythia, &ufs, true);
198 >  ZH.BookTree();
199  
200    // Begin event loop
201    for (int iEvent = 0; iEvent < nEvents; ) {
# Line 194 | Line 211 | int main(int argc, char **argv) {
211      if(meanPileupEventCount > 0) pileupEventCount = meanPileupEventCount; // * rmdmPtr->pois(); (not available yet)
212      for (int puEvent = 0; puEvent < pileupEventCount; ) {
213        if(!pileupPythia.next()) continue;
214 +      double vx = rndmPtr->gauss()*2.; // Mean beam spread is 2 mm in x-y and 75 mm in z
215 +      double vy = rndmPtr->gauss()*2.;
216 +      double vz = rndmPtr->gauss()*75.;
217        for(int i = 0; i < pileupPythia.event.size(); i++) {
218          Particle& particle = pileupPythia.event[i];
219 +        particle.xProd(vx+particle.xProd());
220 +        particle.yProd(vy+particle.yProd());
221 +        particle.zProd(vz+particle.zProd());
222          if(particle.status() > 0) {
223            if(particle.isVisible()) {
224              if(particle.pT() > 0.5) {
# Line 215 | Line 238 | int main(int argc, char **argv) {
238          exit(1);
239        }
240  
241 <    cout << "Number of Gen Chrgd = " << ufs.chargedHadronList().size() << endl;
219 <    cout << "Number of Gen Neutr = " << ufs.neutralHadronList().size() << endl;
220 <    cout << "Number of Gen Phtns = " << ufs.photonList().size() << endl;
221 <    cout << "Number of Gen Elcns = " << ufs.electronList().size() << endl;
222 <    cout << "Number of Gen Muons = " << ufs.muonList().size() << endl;
223 <    cout << "Number of Gen Taus =  " << ufs.genTauList().size() << endl;
224 <    cout << "Number of taus =      " << ufs.tauList().size() << endl;
225 <    cout << "Number of c Quarks =  " << ufs.cQuarkList().size() << endl;
226 <    cout << "Number of b Quarks =  " << ufs.bQuarkList().size() << endl;
227 <    cout << "Number of Jets =      " << ufs.jetList().size() << endl;
228 <    cout << "Number of bJets =     " << ufs.bJetList().size() << endl;
229 <    cout << endl;
230 <
231 <    // Run analysis
241 >    // Run bbHAnalysis
242  
243 <    if(!analysis.run())
243 >    if(!bbH.run())
244        {
245 <        cerr << "Analysis failed - aborting" << endl;
245 >        cerr << "bbH Analysis failed - aborting" << endl;
246          exit(2);
247        }
248  
249 +    // Run ZHAnalysis
250 +
251 +    if(!ZH.Run(&ufs))
252 +      {
253 +        cerr << "ZH Analysis failed - aborting" << endl;
254 +        exit(3);
255 +      }
256 +
257      // End of event loop. Statistics. Histogram. Done.
258  
259      if(!(iEvent % 100)) cout << "Processed event " << iEvent << endl;
# Line 248 | Line 266 | int main(int argc, char **argv) {
266    pythia.statistics();
267    pileupPythia.statistics();
268  
269 +  bbH.end();
270 +
271 +  outFile->cd();
272 +  outFile->Write();
273 +  outFile->Close();
274 +
275    return 0;
276  
277   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines