00001
00002 #include <iostream>
00003
00004 struct Pyjets_t {
00005 int N;
00006 int NPAD;
00007 int K[5][4000];
00008 double P[5][4000];
00009 double V[5][4000];
00010 };
00011
00012 struct pythia_particle {
00013 Int_t status;
00014 Int_t pdg_id;
00015 Int_t parent;
00016 Int_t firstChild;
00017 Int_t lastChild;
00018 Float_t momentum[4];
00019 Float_t mass;
00020 Float_t vertex[4];
00021 Float_t lifetime;
00022
00023 void print() {
00024 cout <<" --- New Particle --- "<<endl;
00025 cout <<"status: "<<status<<" pdg_id: "<<pdg_id<<" parent: "
00026 <<parent<<" fChild: "<<firstChild<<" lChild: "<<lastChild<<endl;
00027 cout <<"px: "<<momentum[0]<<" py: "<<momentum[1]<<" pz: "<<momentum[2]<<" e: "
00028 <<momentum[3]<<" mass: "<<mass<<endl;
00029 cout <<"vX: "<<vertex[0]<<" vY: "<<vertex[1]<<" vZ: "<<vertex[2]<<" t: "
00030 <<vertex[3]<<" tau: "<<lifetime<<endl;
00031 }
00032
00033 };
00034
00035 void PythiaTest(int nEvents=1)
00036 {
00037 gSystem->Load("$PYTHIA/libPythia6.so");
00038 gSystem->Load("libEG");
00039 gSystem->Load("libEGPythia6.so");
00040
00041 TPythia6* p6 = new TPythia6();
00042
00043
00044 p6->SetMSEL(0);
00045 p6->SetMSTP(48, 1);
00046 p6->SetMSTJ(11, 3);
00047 p6->SetPARJ(50+4, -0.07);
00048 p6->SetPARJ(50+5, -0.006);
00049 p6->SetPARJ(50+5, -0.000001);
00050 p6->SetPMAS(6, 1, 174.3);
00051 p6->SetPMAS(25, 1, 120.0);
00052 p6->SetMSTP(61, 1);
00053 p6->SetMSTP(71, 1);
00054 p6->SetMSTP(81, 1);
00055 p6->SetMSTP(111, 1);
00056 p6->SetMSTP(82, 3);
00057 p6->SetPARP(82, 2.41);
00058 p6->SetMRPY(1, 88158204);
00059
00060 p6->SetMSUB(26, 1);
00061 p6->SetMDCY(24, 1, 1);
00062 p6->SetMDCY(25, 1, 1);
00063
00064
00065 int startdecay = p6->GetMDCY(24, 2);
00066 int enddecay = p6->GetMDCY(24, 2) + p6->GetMDCY(24, 3);
00067 for ( i=startdecay; i<enddecay; i++ ) p6->SetMDME(i, 1, 0);
00068
00069
00070
00071 startdecay = p6->GetMDCY(25, 2);
00072 enddecay = p6->GetMDCY(25, 2) + p6->GetMDCY(25, 3);
00073 for ( i=startdecay; i<enddecay; i++ ) p6->SetMDME(i, 1, 0);
00074
00075
00076
00077 p6->SetMDME(206, 1, 1);
00078 p6->SetMDME(207, 1, 1);
00079 p6->SetMDME(208, 1, 1);
00080
00081
00082
00083 p6->SetMDME(214, 1, 1);
00084
00085
00086
00087 p6->Initialize("CMS", "p", "pbar", 2000.0);
00088
00089 for ( i=0; i<nEvents; i++ ) {
00090
00091 if ( i%10 == 0 ) cout << "Event No.: " << i << endl;
00092
00093 p6->GenerateEvent();
00094
00095 Pyjets_t* pythiaParticle = p6->GetPyjets();
00096
00097 Int_t nParticle = p6->GetN();
00098
00099 for (int i=0;i<nParticle;i++) {
00100 pythia_particle particle;
00101 memset(&particle,0,sizeof(particle));
00102
00103 particle.momentum[0] = pythiaParticle->P[0][i];
00104 particle.momentum[1] = pythiaParticle->P[1][i];
00105 particle.momentum[2] = pythiaParticle->P[2][i];
00106 particle.momentum[3] = pythiaParticle->P[3][i];
00107 particle.mass = pythiaParticle->P[4][i];
00108
00109 particle.status = pythiaParticle->K[0][i];
00110 particle.pdg_id = pythiaParticle->K[1][i];
00111 particle.parent = pythiaParticle->K[2][i];
00112 particle.firstChild = pythiaParticle->K[3][i];
00113 particle.lastChild = pythiaParticle->K[4][i];
00114
00115 particle.vertex[0] = pythiaParticle->V[0][i];
00116 particle.vertex[1] = pythiaParticle->V[1][i];
00117 particle.vertex[2] = pythiaParticle->V[2][i];
00118 particle.vertex[3] = pythiaParticle->V[3][i];
00119
00120 particle.lifetime = pythiaParticle->V[4][i];
00121
00122 particle.print();
00123 }
00124
00125 }
00126
00127
00128 }
00129