3 /* A little macro filling a root
4 tree with PYTHIA6 events. Same
5 as generate_PYTHIA.C */
19 UInt_t makeSeed(int mode=0)
25 return date.GetDate();
30 UInt_t seed1 = (date.GetDate() / 1000000 * 100 +
31 date.GetTime() / 1000000);
32 UInt_t seed2 = (date.GetTime() % 10000);
33 TRanMar ranmar(seed1, seed2);
34 Int_t eat = (date.GetDate() - 19980101 + seed2 +
36 for (Int_t i = 0; i < (eat + 250000) ; i++)
38 return 2 * Int_t(ranmar.Rndm() * (TMath::Power(2,30) - 1)) + 1;
43 UInt_t seed1 = (date.GetDate() / 1000000 * 100 +
44 date.GetTime() / 1000000 + gSystem->GetPid());
46 return Int_t(rand.Rndm() * (TMath::Power(2,30) - 1)) + 1;
54 Int_t MakePythia(Int_t nEvents=10,Char_t *rfile="pythia6.root")
56 gSystem->Load("$ROOTSYS/lib/libPythia6.so");
57 gSystem->Load("$ROOTSYS/lib/libEG.so"); // Root Event Generator interface
58 gSystem->Load("$ROOTSYS/lib/libEGPythia6.so"); // Root interface to Pythia6
61 TStopwatch* stopWatch = new TStopwatch();
62 TPythia6* pythia6 = new TPythia6();
63 TClonesArray* particles = new TClonesArray("TParticle");
66 Char_t filename[1024];
67 sprintf(filename,"%s",rfile);
69 TFile* file = new TFile(filename,"RECREATE");
70 file->SetCompressionLevel(1);
71 TTree* tree = new TTree("pythia","pythia events");
72 tree->Branch("particles",&particles);
73 //tree->Branch("header",&header, "no/I:part:total:npart:nenergy:nhard:b/F:phi");
77 // select Pythia min. bias model, taken from AliPythia.C
79 pythia6->SetMSUB(92,1); // single diffraction AB-->XB
80 pythia6->SetMSUB(93,1); // single diffraction AB-->AX
81 pythia6->SetMSUB(94,1); // double diffraction
82 pythia6->SetMSUB(95,1); // low pt production
83 pythia6->SetMSTP(81,1); // multiple interactions switched on
84 pythia6->SetMSTP(82,3); // model with varying impact param. & a single Gaussian
85 pythia6->SetPARP(82,3.47); // set value pT_0 for turn-off of the cross section of
86 // multiple interaction at a reference energy = 14000 GeV
87 pythia6->SetPARP(89,14000.); // reference energy for the above parameter
88 pythia6->SetPARP(90,0.174); // set exponent for energy dependence of pT_0
90 // set fragmentation on (default)
91 pythia6->SetMSTP(111,1);
93 // don't smear the primary vertex
94 pythia6->SetMSTP(151,0);
96 //pythia6->SetMSTP(61,0);
97 //pythia6->SetMSTP(64,0);
99 pythia6->SetMRPY(1,makeSeed(3));
100 pythia6->Initialize("cms","p","p",5500);
101 //pythia6->Initialize("cms","p","p",1800);
107 for (i = 0; i < nEvents; i++) {
109 cout << "Event # " << i << " ... " << flush;
111 pythia6->GenerateEvent();
114 header.total = pythia6->ImportParticles(particles,"All");
124 //particles->Print();
125 //pythia6->Pylist(1);
129 cout << "done (" << header.total << " particles) " << flush;