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.7 by dasu, Wed Feb 16 00:33:49 2011 UTC vs.
Revision 1.12 by mmhl, Thu Feb 24 20:17:12 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 > #include "bbHAnalysis.cc"
23 > //#include "ZHAnalysis.cc"
24  
25   int main(int argc, char **argv) {
26    // Generator. Process selection. LHC initialization. Histogram.
# Line 26 | Line 32 | int main(int argc, char **argv) {
32      {
33        cerr << "Command syntax: " << argv[0] << " ZHmmbb[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
34        cerr << "or              " << argv[0] << " ZHeebb[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
35 +      cerr << "or              " << argv[0] << " ZZmmbb[...]" << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
36        cerr << "or              " << argv[0] << " BBHmh[...] " << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
37        cerr << "or              " << argv[0] << " BBAmh[...] " << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
38        cerr << "or              " << argv[0] << " Zee[...]   " << " <nEvents> [RandomSeed] [meanPileupEventCount]" << endl;
# Line 154 | Line 161 | int main(int argc, char **argv) {
161            pythia.readString("15:onIfAny = 13");
162          }
163        }
164 +     else if(strncmp(argv[1], "ZZmmbb", 6) == 0)
165 +       {
166 +         pythia.readString("WeakDoubleBoson:ffbar2gmZgmZ = on");
167 +         pythia.readString("23:onMode = 0");
168 +         pythia.readString("23:onIfAny = 5 13");   // Let the Z decay to bQuarks or muons
169 +       }
170      else
171        {
172          cerr << "Unknown process type " << argv[1] << " - aborting" << endl;
# Line 161 | Line 174 | int main(int argc, char **argv) {
174        }
175    }
176  
177 +  string name(argv[1]);
178 +  name += ".root";
179 +  TFile *outFile = TFile::Open(name.c_str(), "recreate");
180 +
181    // Initialize pythia
182  
183    pythia.init( 2212, 2212, 14000.);
# Line 178 | Line 195 | int main(int argc, char **argv) {
195    // Ultra Fast Simulator
196  
197    UltraFastSim ufs(rndmPtr);
198 <  Analysis analysis(argv[1], &pythia, &ufs, true);
198 >  bbHAnalysis bbH(outFile, &pythia, &ufs, true);
199 >  //ZHAnalysis ZH; // outFile, &pythia, &ufs, true);
200 >  //ZH.BookTree();
201  
202    // Begin event loop
203    for (int iEvent = 0; iEvent < nEvents; ) {
# Line 194 | Line 213 | int main(int argc, char **argv) {
213      if(meanPileupEventCount > 0) pileupEventCount = meanPileupEventCount; // * rmdmPtr->pois(); (not available yet)
214      for (int puEvent = 0; puEvent < pileupEventCount; ) {
215        if(!pileupPythia.next()) continue;
216 +      double vx = rndmPtr->gauss()*2.; // Mean beam spread is 2 mm in x-y and 75 mm in z
217 +      double vy = rndmPtr->gauss()*2.;
218 +      double vz = rndmPtr->gauss()*75.;
219        for(int i = 0; i < pileupPythia.event.size(); i++) {
220          Particle& particle = pileupPythia.event[i];
221 +        particle.xProd(vx+particle.xProd());
222 +        particle.yProd(vy+particle.yProd());
223 +        particle.zProd(vz+particle.zProd());
224          if(particle.status() > 0) {
225            if(particle.isVisible()) {
226              if(particle.pT() > 0.5) {
# Line 215 | Line 240 | int main(int argc, char **argv) {
240          exit(1);
241        }
242  
243 <    // Run analysis
243 >    // Run bbHAnalysis
244  
245 <    if(!analysis.run())
245 >    if(!bbH.run())
246        {
247 <        cerr << "Analysis failed - aborting" << endl;
247 >        cerr << "bbH Analysis failed - aborting" << endl;
248          exit(2);
249        }
250  
251 +    // Run ZHAnalysis
252 +
253 +    /* if(!ZH.Run(&ufs))
254 +      {
255 +        cerr << "ZH Analysis failed - aborting" << endl;
256 +        exit(3);
257 +      }
258 +    */
259      // End of event loop. Statistics. Histogram. Done.
260  
261      if(!(iEvent % 100)) cout << "Processed event " << iEvent << endl;
# Line 235 | Line 268 | int main(int argc, char **argv) {
268    pythia.statistics();
269    pileupPythia.statistics();
270  
271 +  bbH.end();
272 +
273 +  outFile->cd();
274 +  outFile->Write();
275 +  outFile->Close();
276 +
277    return 0;
278  
279   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines