9 # include <TApplication.h>
11 # include <TMCParticle.h>
12 # include <TObjArray.h>
13 # include <TPythia6.h>
39 TDataSet *fillathenaEvent(TPythia6 &pythia);
40 int P2ATest(
int nEvent=5,
int compress=1);
42 int P2ATest(
int nEvent,
int compress)
46 printf(
"\nUsage: root LoadPythia.C 'P2ATest.C(nEvent)'\n");
47 printf(
"----- where nEvent - the total number of the events to generate\n");
57 TFileIter MCFile(
"pythia.root",
"RECREATE",
"pythia.root", compress);
63 Pythia.SetMSTP(48, 1);
64 Pythia.SetMSTJ(11, 3);
65 Pythia.SetPARJ(50+4, -0.07);
66 Pythia.SetPARJ(50+5, -0.006);
67 Pythia.SetPARJ(50+5, -0.000001);
68 Pythia.SetPMAS(6, 1, 174.3);
69 Pythia.SetPMAS(25, 1, 120.0);
70 Pythia.SetMSTP(61, 1);
71 Pythia.SetMSTP(71, 1);
72 Pythia.SetMSTP(81, 1);
73 Pythia.SetMSTP(111, 1);
74 Pythia.SetMSTP(82, 3);
75 Pythia.SetPARP(82, 2.41);
76 Pythia.SetMRPY(1, 88158204);
78 Pythia.SetMSUB(26, 1);
79 Pythia.SetMDCY(24, 1, 1);
80 Pythia.SetMDCY(25, 1, 1);
84 startdecay = Pythia.GetMDCY(24, 2);
85 enddecay = Pythia.GetMDCY(24, 2) + Pythia.GetMDCY(24, 3);
86 for ( i=startdecay; i<enddecay; i++ ) Pythia.SetMDME(i, 1, 0);
90 startdecay = Pythia.GetMDCY(25, 2);
91 enddecay = Pythia.GetMDCY(25, 2) + Pythia.GetMDCY(25, 3);
92 for ( i=startdecay; i<enddecay; i++ ) Pythia.SetMDME(i, 1, 0);
96 Pythia.SetMDME(206, 1, 1);
97 Pythia.SetMDME(207, 1, 1);
98 Pythia.SetMDME(208, 1, 1);
102 Pythia.SetMDME(214, 1, 1);
106 Pythia.Initialize(
"CMS",
"p",
"pbar", 2000.0);
116 for ( i=0; i<NEvents; i++ ) {
118 if ( i%10 == 0 ) cout <<
"Event No.: " << i << endl;
120 Pythia.GenerateEvent();
126 ioTime.Start(kFALSE);
127 TDataSet *mcEvent = fillathenaEvent(Pythia);
132 MCFile.NextEventPut(mcEvent,runNumber,eventNumber);
138 printf(
" Full time: "); fulltime.Print();
139 printf(
" I/O time: "); ioTime.Print();
140 printf(
"\nUsage: root LoadPythia.C 'P2ATest.C(nEvent)'\n");
141 printf(
"----- where nEvent - the total number of the events to generate\n");
145 TDataSet *fillathenaEvent(TPythia6 &pythia)
149 Pyjets_t* pythiaParticle = pythia.GetPyjets();
150 Int_t nParticle = pythia.GetN();
152 for (
int i=0;i<nParticle;i++)
155 memset(&particle,0,
sizeof(particle));
156 particle.momentum[0] = pythiaParticle->P[0][i];
157 particle.momentum[1] = pythiaParticle->P[1][i];
158 particle.momentum[2] = pythiaParticle->P[2][i];
159 particle.momentum[3] = pythiaParticle->P[3][i];
160 particle.mass = pythiaParticle->P[4][i];
162 particle.status = pythiaParticle->K[0][i];
163 particle.pdg_id = pythiaParticle->K[1][i];
164 particle.parent = pythiaParticle->K[2][i];
165 particle.firstChild = pythiaParticle->K[3][i];
166 particle.lastChild = pythiaParticle->K[4][i];
168 particle.vertex[0] = pythiaParticle->V[0][i];
169 particle.vertex[1] = pythiaParticle->V[1][i];
170 particle.vertex[2] = pythiaParticle->V[2][i];
171 particle.vertex[3] = pythiaParticle->V[3][i];
173 particle.lifetime = pythiaParticle->V[4][i];
174 particles->
AddAt(&particle);
177 mcEvent->Add(particles);
virtual Int_t AddAt(const void *c)