| 1 |
C...A simple skeleton program, illustrating a typical Pythia run: |
| 2 |
C...Z0 production at LEP 1. |
| 3 |
C...Toy task: compare multiplicity distribution with matrix elements |
| 4 |
C...and with parton showers (using same fragmentation parameters). |
| 5 |
C...This code contains modifications for HepMC3 examples |
| 6 |
C----------------------------------------------------------------- |
| 7 |
|
| 8 |
C...Preamble: declarations. |
| 9 |
|
| 10 |
C...All real arithmetic in double precision. |
| 11 |
IMPLICIT DOUBLE PRECISION(A-H, O-Z) |
| 12 |
C...Three Pythia functions return integers, so need declaring. |
| 13 |
INTEGER PYK,PYCHGE,PYCOMP |
| 14 |
|
| 15 |
C...EXTERNAL statement links PYDATA on most machines. |
| 16 |
EXTERNAL PYDATA |
| 17 |
|
| 18 |
C...Commonblocks. |
| 19 |
C...The event record. |
| 20 |
COMMON/PYJETS/N,NPAD,K(4000,5),P(4000,5),V(4000,5) |
| 21 |
C...Parameters. |
| 22 |
COMMON/PYDAT1/MSTU(200),PARU(200),MSTJ(200),PARJ(200) |
| 23 |
C...Particle properties + some flavour parameters. |
| 24 |
COMMON/PYDAT2/KCHG(500,4),PMAS(500,4),PARF(2000),VCKM(4,4) |
| 25 |
C...Decay information. |
| 26 |
COMMON/PYDAT3/MDCY(500,3),MDME(8000,2),BRAT(8000),KFDP(8000,5) |
| 27 |
C...Selection of hard scattering subprocesses. |
| 28 |
COMMON/PYSUBS/MSEL,MSELPD,MSUB(500),KFIN(2,-40:40),CKIN(200) |
| 29 |
C...Parameters. |
| 30 |
COMMON/PYPARS/MSTP(200),PARP(200),MSTI(200),PARI(200) |
| 31 |
C...Supersymmetry parameters. |
| 32 |
COMMON/PYMSSM/IMSS(0:99),RMSS(0:99) |
| 33 |
C...Generation and cross section statistics. |
| 34 |
COMMON/PYINT5/NGENPD,NGEN(0:500,3),XSEC(0:500,3) |
| 35 |
C...Random number generator information. |
| 36 |
COMMON/PYDATR/MRPY(6),RRPY(100) |
| 37 |
|
| 38 |
C...HepMC3 |
| 39 |
PARAMETER (NMXHEP=4000) |
| 40 |
COMMON /HEPEVT/ NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP), |
| 41 |
& JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP), |
| 42 |
& VHEP(4,NMXHEP) |
| 43 |
INTEGER NEVHEP,NHEP,ISTHEP,IDHEP,JMOHEP,JDAHEP |
| 44 |
DOUBLE PRECISION PHEP,VHEP |
| 45 |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| 46 |
C...These variables will be used for conversion. Block size is different |
| 47 |
C...in Pythia6 and in HepMC3, so the most simple portable way is to have |
| 48 |
C... a second block of same size as in HepMC3 and copy the content of |
| 49 |
C...block directly. |
| 50 |
PARAMETER (NMXHEPL=10000) |
| 51 |
COMMON /HEPEVTL/ NEVHEPL,NHEPL,ISTHEPL(NMXHEPL),IDHEPL(NMXHEPL), |
| 52 |
& JMOHEPL(2,NMXHEPL),JDAHEPL(2,NMXHEPL),PHEPL(5,NMXHEPL), |
| 53 |
& VHEPL(4,NMXHEPL) |
| 54 |
INTEGER NEVHEPL,NHEPL,ISTHEPL,IDHEPL,JMOHEPL,JDAHEPL |
| 55 |
DOUBLE PRECISION PHEPL,VHEPL |
| 56 |
|
| 57 |
INTEGER OUTID(2), HEPMC3STATUS |
| 58 |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| 59 |
C...Glue functions |
| 60 |
INTEGER HepMC3_new_writer,HepMC3_delete_writer |
| 61 |
INTEGER HepMC3_set_hepevt_address |
| 62 |
INTEGER HepMC3_convert_event,HepMC3_write_event,HepMC3_clear_event |
| 63 |
INTEGER HepMC3_set_attribute_int,HepMC3_set_attribute_double |
| 64 |
INTEGER HepMC3_set_pdf_info,HepMC3_set_cross_section |
| 65 |
EXTERNAL HepMC3_new_writer,HepMC3_delete_writer |
| 66 |
EXTERNAL HepMC3_set_hepevt_address |
| 67 |
EXTERNAL HepMC3_convert_event,HepMC3_write_event |
| 68 |
EXTERNAL HepMC3_clear_event |
| 69 |
EXTERNAL HepMC3_set_attribute_int,HepMC3_set_attribute_double |
| 70 |
EXTERNAL HepMC3_set_pdf_info,HepMC3_set_cross_section |
| 71 |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| 72 |
C----------------------------------------------------------------- |
| 73 |
|
| 74 |
C...First section: initialization. |
| 75 |
|
| 76 |
C...Main parameters of run: c.m. energy and number of events. |
| 77 |
ECM=91.2D0 |
| 78 |
NEV=1000 |
| 79 |
|
| 80 |
C...Select gamma*/Z0 production process. |
| 81 |
MSEL=0 |
| 82 |
MSUB(1)=1 |
| 83 |
|
| 84 |
C...Only allow Z0 decay to quarks (i.e. no leptonic final states). |
| 85 |
DO 100 IDC=MDCY(23,2),MDCY(23,2)+MDCY(23,3)-1 |
| 86 |
IF(IABS(KFDP(IDC,1)).GE.6) MDME(IDC,1)=MIN(0,MDME(IDC,1)) |
| 87 |
100 CONTINUE |
| 88 |
|
| 89 |
C...Initialize. |
| 90 |
CALL PYINIT('CMS','e+','e-',ECM) |
| 91 |
|
| 92 |
C...Check that Z0 decay channels set correctly. |
| 93 |
C CALL PYSTAT(2) |
| 94 |
|
| 95 |
C...Book histograms. |
| 96 |
CALL PYBOOK(1,'charged multiplicity ME',100,-0.5D0,99.5D0) |
| 97 |
CALL PYBOOK(2,'charged multiplicity PS',100,-0.5D0,99.5D0) |
| 98 |
C...Create output writers |
| 99 |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| 100 |
OUTID(1)=HepMC3_new_writer(0,1,'ME.hepmc'//char(0)) |
| 101 |
HEPMC3STATUS=HepMC3_new_weight(OUTID(1),'Default'//char(0)) |
| 102 |
HEPMC3STATUS=HepMC3_new_weight(OUTID(1),'weme1'//char(0)) |
| 103 |
HEPMC3STATUS=HepMC3_new_weight(OUTID(1),'weme2'//char(0)) |
| 104 |
OUTID(2)=HepMC3_new_writer(0,1,'PS.hepmc'//char(0)) |
| 105 |
HEPMC3STATUS=HepMC3_new_weight(OUTID(2),'Default'//char(0)) |
| 106 |
HEPMC3STATUS=HepMC3_new_weight(OUTID(2),'weps1'//char(0)) |
| 107 |
HEPMC3STATUS=HepMC3_new_weight(OUTID(2),'weps2'//char(0)) |
| 108 |
NEVHEP=-123456 |
| 109 |
HEPMC3STATUS=HepMC3_set_hepevt_address(NEVHEPL) |
| 110 |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| 111 |
C----------------------------------------------------------------- |
| 112 |
|
| 113 |
C...Second section: event loop. |
| 114 |
|
| 115 |
C...Outer loop over ME and PS options. |
| 116 |
DO 300 ICA=1,2 |
| 117 |
IF(ICA.EQ.1) THEN |
| 118 |
MSTP(48)=1 |
| 119 |
MSTJ(101)=2 |
| 120 |
ELSE |
| 121 |
MSTP(48)=0 |
| 122 |
ENDIF |
| 123 |
|
| 124 |
|
| 125 |
C...Begin event loop. |
| 126 |
DO 200 IEV=1,NEV |
| 127 |
CALL PYEVNT |
| 128 |
|
| 129 |
C...List first few events. |
| 130 |
IF(IEV.LE.2) CALL PYLIST(1) |
| 131 |
|
| 132 |
C...Write output |
| 133 |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| 134 |
CALL PYHEPC(1) |
| 135 |
NEVHEPL=IEV |
| 136 |
NHEPL=NHEP |
| 137 |
DO 500 J=1,NHEP |
| 138 |
ISTHEPL(J)=ISTHEP(J) |
| 139 |
IDHEPL(J)=IDHEP(J) |
| 140 |
JMOHEPL(1,J)=JMOHEP(1,J) |
| 141 |
JMOHEPL(2,J)=JMOHEP(2,J) |
| 142 |
JDAHEPL(1,J)=JDAHEP(1,J) |
| 143 |
JDAHEPL(2,J)=JDAHEP(2,J) |
| 144 |
PHEPL(1,J)=PHEP(1,J) |
| 145 |
PHEPL(2,J)=PHEP(2,J) |
| 146 |
PHEPL(3,J)=PHEP(3,J) |
| 147 |
PHEPL(4,J)=PHEP(4,J) |
| 148 |
PHEPL(5,J)=PHEP(5,J) |
| 149 |
VHEPL(1,J)=VHEP(1,J) |
| 150 |
VHEPL(2,J)=VHEP(2,J) |
| 151 |
VHEPL(3,J)=VHEP(3,J) |
| 152 |
VHEPL(4,J)=VHEP(4,J) |
| 153 |
500 CONTINUE |
| 154 |
HEPMC3STATUS=HepMC3_convert_event(OUTID(ICA)) |
| 155 |
C...Note: no explicit XS uncertainty |
| 156 |
HEPMC3STATUS=HepMC3_set_cross_section(OUTID(ICA), |
| 157 |
& 1.0E9*XSEC(0,3), |
| 158 |
& 1.0E9*XSEC(0,3)/sqrt(1.0*NGEN(0,3)), |
| 159 |
& NGEN(0,3),0) |
| 160 |
HEPMC3STATUS=HepMC3_set_pdf_info(OUTID(ICA), |
| 161 |
& MSTI(15),MSTI(16),PARI(33),PARI(34),PARI(23), |
| 162 |
& MSTP(51),MSTP(52)) |
| 163 |
C...The values below are not always meaningful |
| 164 |
HEPMC3STATUS=HepMC3_set_attribute_int(OUTID(ICA),-1, |
| 165 |
& 'mpi'//char(0)) |
| 166 |
HEPMC3STATUS=HepMC3_set_attribute_int(OUTID(ICA),MSUB, |
| 167 |
& 'signal_process_id'//char(0)) |
| 168 |
HEPMC3STATUS=HepMC3_set_attribute_int(OUTID(ICA),MRPY(1), |
| 169 |
& 'random_states1'//char(0)) |
| 170 |
HEPMC3STATUS=HepMC3_set_attribute_double(OUTID(ICA),-1, |
| 171 |
& 'alphaEM'//char(0)) |
| 172 |
HEPMC3STATUS=HepMC3_set_attribute_double(OUTID(ICA),-1, |
| 173 |
& 'alphaQCD'//char(0)) |
| 174 |
HEPMC3STATUS=HepMC3_set_attribute_double(OUTID(ICA),q2pdfeval, |
| 175 |
& 'event_scale'//char(0)) |
| 176 |
HEPMC3STATUS=HepMC3_set_weight_by_index(OUTID(ICA),1.0D0,0) |
| 177 |
if (ICA.eq.1) then |
| 178 |
HEPMC3STATUS=HepMC3_set_weight_by_name(OUTID(1), |
| 179 |
& 1.1111D0,'weme1'//char(0)) |
| 180 |
HEPMC3STATUS=HepMC3_set_weight_by_name(OUTID(1), |
| 181 |
& 1.2222D0,'weme2'//char(0)) |
| 182 |
endif |
| 183 |
if (ICA.eq.2) then |
| 184 |
HEPMC3STATUS=HepMC3_set_weight_by_name(OUTID(2), |
| 185 |
& 1.5555D0,'weps1'//char(0)) |
| 186 |
HEPMC3STATUS=HepMC3_set_weight_by_name(OUTID(2), |
| 187 |
& 1.6666D0,'weps2'//char(0)) |
| 188 |
endif |
| 189 |
|
| 190 |
C Note there should be PDF ids |
| 191 |
HEPMC3STATUS=HepMC3_write_event(OUTID(ICA)) |
| 192 |
HEPMC3STATUS=HepMC3_clear_event(OUTID(ICA)) |
| 193 |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| 194 |
C...Extract and fill event properties. |
| 195 |
CALL PYEDIT(3) |
| 196 |
CALL PYFILL(ICA,DBLE(N),1D0) |
| 197 |
C...End event loop. |
| 198 |
200 CONTINUE |
| 199 |
|
| 200 |
C...End outer loop. |
| 201 |
300 CONTINUE |
| 202 |
C...Delete output writers |
| 203 |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| 204 |
HEPMC3STATUS=HepMC3_delete_writer(OUTID(1)) |
| 205 |
HEPMC3STATUS=HepMC3_delete_writer(OUTID(2)) |
| 206 |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| 207 |
C----------------------------------------------------------------- |
| 208 |
|
| 209 |
C...Third section: produce output and end. |
| 210 |
|
| 211 |
C...Cross section table. |
| 212 |
CALL PYSTAT(1) |
| 213 |
|
| 214 |
C...Histograms. |
| 215 |
CALL PYHIST |
| 216 |
|
| 217 |
END |