diff --git a/src/decaylanguage/data/WorkingOutModel.ipynb b/src/decaylanguage/data/WorkingOutModel.ipynb deleted file mode 100644 index 52c52f73..00000000 --- a/src/decaylanguage/data/WorkingOutModel.ipynb +++ /dev/null @@ -1,682 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 27, - "source": [ - "with open(\"DECAY_CLASSIC.DEC\") as f:\n", - " txt = f.readlines()" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "markdown", - "source": [ - "Useful resources:\n", - "* https://tomassetti.me/parsing-in-python/\n", - "* https://github.com/lark-parser/lark/blob/master/docs/lark_cheatsheet.pdf\n", - "* https://github.com/lark-parser/lark/blob/9f666a74595ff8ac0f550abbb687a517fe5d495d/lark/grammars/common.lark\n", - "* https://gitlab.cern.ch/lhcb-datapkg/Gen/DecFiles/tree/master/dkfiles\n", - "* https://github.com/PMunkes/evtgen/blob/master/DECAY.DEC\n" - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 90, - "source": [ - "seen = set()\n", - "testlines = \"\"\n", - "for i, t in enumerate(txt[:222]):\n", - " t = t.strip()\n", - " if t and t[0] != \"#\":\n", - " start = t.split()[0]\n", - " if not start in seen:\n", - " print(i, t)\n", - " seen.add(start)\n", - " testlines += t + \"\\n\"" - ], - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "4 Define qoverp_incohMix_B_s0 1.0\n", - "51 Alias K*L K*0\n", - "62 ChargeConj K*L K*BL\n", - "187 yesPhotos\n", - "195 Decay Upsilon(4S)\n", - "196 0.515122645 B+ B- VSS; #[Reconstructed PDG2011]\n", - "197 0.483122645 B0 anti-B0 VSS_BMIX dm; #[Reconstructed PDG2011]\n", - "198 0.000015583 e+ e- PHOTOS VLL; #[Reconstructed PDG2011]\n", - "199 0.000015766 mu+ mu- PHOTOS VLL; #[Reconstructed PDG2011]\n", - "201 0.000084099 Upsilon(2S) pi+ pi- VVPIPI; #[Reconstructed PDG2011]\n", - "202 0.000044342 Upsilon(2S) pi0 pi0 VVPIPI; #[Reconstructed PDG2011]\n", - "203 0.000080123 Upsilon pi+ pi- VVPIPI; #[Reconstructed PDG2011]\n", - "205 0.000194392 Upsilon eta PARTWAVE 0.0 0.0 1.0 0.0 0.0 0.0; #[Reconstructed PDG2011]\n", - "208 0.000092625 gamma chi_b0(3P) HELAMP 1. 0. 1. 0.; #[Reconstructed PDG2011]\n", - "210 0.000138938 gamma chi_b1(3P) HELAMP 1. 0. 1. 0. -1. 0. -1. 0.; #[Reconstructed PDG2011]\n", - "212 0.000129084 gamma chi_b2(3P) HELAMP 2.4494897 0. 1.7320508 0. 1. 0. 1. 0. 1.7320508 0. 2.4494897 0.; #[Reconstructed PDG2011]\n", - "214 0.000002956 gamma chi_b0(2P) HELAMP 1. 0. 1. 0.; #[Reconstructed PDG2011]\n", - "216 0.000007883 gamma chi_b1(2P) HELAMP 1. 0. 1. 0. -1. 0. -1. 0.; #[Reconstructed PDG2011]\n", - "218 0.000011825 gamma chi_b2(2P) HELAMP 2.4494897 0. 1.7320508 0. 1. 0. 1. 0. 1.7320508 0. 2.4494897 0.; #[Reconstructed PDG2011]\n", - "219 0.000837571 g g g PYTHIA 4; #[Reconstructed PDG2011]\n", - "220 0.000039415 gamma g g PYTHIA 4; #[Reconstructed PDG2011]\n", - "221 Enddecay\n" - ] - } - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 145, - "source": [ - "examples = set()\n", - "models = set()\n", - "for t in txt:\n", - " t = t.split(\"#\")[0]\n", - " t = t.strip()\n", - " if \";\" in t:\n", - " ts = t.strip(\";\").split()\n", - " del ts[0]\n", - " while (\n", - " ts[0].upper() != ts[0]\n", - " or \"+\" in ts[0]\n", - " or \"'\" in ts[0]\n", - " or ts[0].endswith(\"-\")\n", - " or \"*\" in ts[0]\n", - " or ts[0].startswith(\"K_\")\n", - " or ts[0] in (\"D0\", \"K0\", \"B0\", \"D_10\", \"D(2S)0\")\n", - " ):\n", - " del ts[0]\n", - " if ts[0] == \"PHOTOS\":\n", - " del ts[0]\n", - " ts = [\n", - " \"number\" if t.replace(\".\", \"1\", 1).lstrip(\"-\").lstrip(\"+\").isdigit() else t\n", - " for t in ts\n", - " ]\n", - " examples.add(\" \".join(ts))\n", - " models.add(ts[0])" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 146, - "source": [ - "examples" - ], - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": [ - "{'BTO3PI_CP dm alpha',\n", - " 'BTOSLLALI',\n", - " 'BTOSLLBALL',\n", - " 'BTOXSGAMMA number',\n", - " 'BTOXSLL number number number number',\n", - " 'CB3PI-MPP alpha',\n", - " 'CB3PI-P00 alpha',\n", - " 'D_DALITZ',\n", - " 'ETA_DALITZ',\n", - " 'GOITY_ROBERTS',\n", - " 'HELAMP number number number number',\n", - " 'HELAMP number number number number number number number number',\n", - " 'HELAMP number number number number number number number number number number number number',\n", - " 'HQET number number number',\n", - " 'ISGW2',\n", - " 'OMEGA_DALITZ',\n", - " 'PARTWAVE number number number number number number',\n", - " 'PHSP',\n", - " 'PI0_DALITZ',\n", - " 'PYTHIA number',\n", - " 'SLN',\n", - " 'STS',\n", - " 'SVP_HELAMP number number number number',\n", - " 'SVS',\n", - " 'SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus',\n", - " 'SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus',\n", - " 'SVV_HELAMP number number number number number number',\n", - " 'TAUHADNU number number number number number',\n", - " 'TAUHADNU number number number number number number number',\n", - " 'TAULNUNU',\n", - " 'TAUSCALARNU',\n", - " 'TAUVECTORNU',\n", - " 'TSS',\n", - " 'TVS_PWAVE number number number number number number',\n", - " 'VLL',\n", - " 'VSP_PWAVE',\n", - " 'VSS',\n", - " 'VSS_BMIX dm',\n", - " 'VUB number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number number',\n", - " 'VVP number number number number number number number number',\n", - " 'VVPIPI',\n", - " 'VVS_PWAVE number number number number number number'}" - ] - }, - "metadata": {}, - "execution_count": 146 - } - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 217, - "source": [ - "from lark import Lark" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 218, - "source": [ - "for m in sorted(models):\n", - " print(f'\"{m}\"', end=\"|\")" - ], - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\"BTO3PI_CP\"|\"BTOSLLALI\"|\"BTOSLLBALL\"|\"BTOXSGAMMA\"|\"BTOXSLL\"|\"CB3PI-MPP\"|\"CB3PI-P00\"|\"D_DALITZ\"|\"ETA_DALITZ\"|\"GOITY_ROBERTS\"|\"HELAMP\"|\"HQET\"|\"ISGW2\"|\"OMEGA_DALITZ\"|\"PARTWAVE\"|\"PHSP\"|\"PI0_DALITZ\"|\"PYTHIA\"|\"SLN\"|\"STS\"|\"SVP_HELAMP\"|\"SVS\"|\"SVV_HELAMP\"|\"TAUHADNU\"|\"TAULNUNU\"|\"TAUSCALARNU\"|\"TAUVECTORNU\"|\"TSS\"|\"TVS_PWAVE\"|\"VLL\"|\"VSP_PWAVE\"|\"VSS\"|\"VSS_BMIX\"|\"VUB\"|\"VVP\"|\"VVPIPI\"|\"VVS_PWAVE\"|" - ] - } - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": null, - "source": [], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 528, - "source": [ - "l = Lark(\n", - " r\"\"\"\n", - "start : (line | _NEWLINE)+ (_END _NEWLINE*)?\n", - "line : (define | alias | chargeconj | commands | decay | cdecay | setlspw) _NEWLINE\n", - "\n", - "_END : \"End\"\n", - "\n", - "setlspw : \"SetLineshapePW\" label label label SIGNED_NUMBER\n", - "\n", - "cdecay : \"CDecay\" label\n", - "\n", - "define : \"Define\" label SIGNED_NUMBER\n", - "\n", - "alias : \"Alias\" label label\n", - "\n", - "chargeconj : \"ChargeConj\" label label\n", - "\n", - "commands : yesphotos | nophotos\n", - "yesphotos : \"yesPhotos\" \n", - "nophotos : \"noPhotos\"\n", - "\n", - "decay : \"Decay\" particle _NEWLINE (decayline | _NEWLINE )+ \"Enddecay\"\n", - "decayline : (partdecay | wholedecay) \";\" _NEWLINE\n", - "partdecay : SIGNED_NUMBER particle+ photos? model\n", - "wholedecay : SIGNED_NUMBER photos? model\n", - "photos : \"PHOTOS\"\n", - "\n", - "label : LABEL\n", - "particle : LABEL // Add full particle parsing here\n", - "\n", - "\n", - "model : model_generic\n", - "model_generic : MODEL_NAME model_options?\n", - "model_options : (SIGNED_NUMBER | LABEL)+\n", - "\n", - "// model_helamp : \"HELAMP\" (SIGNED_NUMBER SIGNED_NUMBER)+\n", - "\n", - "\n", - "// Terminal definitions\n", - "// To use a fast parser, we need to avoid conflicts\n", - "\n", - "%import common.WS_INLINE\n", - "%import common.SIGNED_NUMBER\n", - "%import common.NEWLINE -> _NEWLINE // _ means filter this out of the tree\n", - "\n", - "// We must set priorities here to use lalr - match model name above label, and label above something else\n", - "MODEL_NAME.2 : \"BTO3PI_CP\"|\"BTOSLLALI\"|\"BTOSLLBALL\"|\"BTOXSGAMMA\"|\"BTOXSLL\"|\"CB3PI-MPP\"|\"CB3PI-P00\"|\"D_DALITZ\"|\"ETA_DALITZ\"|\"GOITY_ROBERTS\"|\"HELAMP\"|\"HQET\"|\"ISGW2\"|\"OMEGA_DALITZ\"|\"PARTWAVE\"|\"PHSP\"|\"PI0_DALITZ\"|\"PYTHIA\"|\"SLN\"|\"STS\"|\"SVP_HELAMP\"|\"SVS\"|\"SVV_HELAMP\"|\"TAUHADNU\"|\"TAULNUNU\"|\"TAUSCALARNU\"|\"TAUVECTORNU\"|\"TSS\"|\"TVS_PWAVE\"|\"VLL\"|\"VSP_PWAVE\"|\"VSS\"|\"VSS_BMIX\"|\"VUB\"|\"VVP\"|\"VVPIPI\"|\"VVS_PWAVE\"\n", - "LABEL : /[a-zA-Z0-9\\/\\-+*_()']+/\n", - "COMMENT : /[#][^\\n]*/\n", - "\n", - "// We should ignore comments\n", - "%ignore COMMENT\n", - "\n", - "// Disregard spaces in text\n", - "%ignore WS_INLINE\n", - "\"\"\",\n", - " debug=True,\n", - " parser=\"lalr\",\n", - " lexer=\"auto\",\n", - ")" - ], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 529, - "source": [ - "print(testlines)\n", - "\n", - "ll = l.parse(testlines)\n", - "print(ll.pretty())" - ], - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Define qoverp_incohMix_B_s0 1.0\n", - "Alias K*L K*0\n", - "ChargeConj K*L K*BL\n", - "yesPhotos\n", - "Decay Upsilon(4S)\n", - "0.515122645 B+ B- VSS; #[Reconstructed PDG2011]\n", - "0.483122645 B0 anti-B0 VSS_BMIX dm; #[Reconstructed PDG2011]\n", - "0.000015583 e+ e- PHOTOS VLL; #[Reconstructed PDG2011]\n", - "0.000015766 mu+ mu- PHOTOS VLL; #[Reconstructed PDG2011]\n", - "0.000084099 Upsilon(2S) pi+ pi- VVPIPI; #[Reconstructed PDG2011]\n", - "0.000044342 Upsilon(2S) pi0 pi0 VVPIPI; #[Reconstructed PDG2011]\n", - "0.000080123 Upsilon pi+ pi- VVPIPI; #[Reconstructed PDG2011]\n", - "0.000194392 Upsilon eta PARTWAVE 0.0 0.0 1.0 0.0 0.0 0.0; #[Reconstructed PDG2011]\n", - "0.000092625 gamma chi_b0(3P) HELAMP 1. 0. 1. 0.; #[Reconstructed PDG2011]\n", - "0.000138938 gamma chi_b1(3P) HELAMP 1. 0. 1. 0. -1. 0. -1. 0.; #[Reconstructed PDG2011]\n", - "0.000129084 gamma chi_b2(3P) HELAMP 2.4494897 0. 1.7320508 0. 1. 0. 1. 0. 1.7320508 0. 2.4494897 0.; #[Reconstructed PDG2011]\n", - "0.000002956 gamma chi_b0(2P) HELAMP 1. 0. 1. 0.; #[Reconstructed PDG2011]\n", - "0.000007883 gamma chi_b1(2P) HELAMP 1. 0. 1. 0. -1. 0. -1. 0.; #[Reconstructed PDG2011]\n", - "0.000011825 gamma chi_b2(2P) HELAMP 2.4494897 0. 1.7320508 0. 1. 0. 1. 0. 1.7320508 0. 2.4494897 0.; #[Reconstructed PDG2011]\n", - "0.000837571 g g g PYTHIA 4; #[Reconstructed PDG2011]\n", - "0.000039415 gamma g g PYTHIA 4; #[Reconstructed PDG2011]\n", - "Enddecay\n", - "\n", - "start\n", - " line\n", - " define\n", - " label\tqoverp_incohMix_B_s0\n", - " 1.0\n", - " line\n", - " alias\n", - " label\tK*L\n", - " label\tK*0\n", - " line\n", - " chargeconj\n", - " label\tK*L\n", - " label\tK*BL\n", - " line\n", - " commands\n", - " yesphotos\n", - " line\n", - " decay\n", - " particle\tUpsilon(4S)\n", - " decayline\n", - " partdecay\n", - " 0.515122645\n", - " particle\tB+\n", - " particle\tB-\n", - " model\n", - " model_generic\tVSS\n", - " decayline\n", - " partdecay\n", - " 0.483122645\n", - " particle\tB0\n", - " particle\tanti-B0\n", - " model\n", - " model_generic\n", - " VSS\n", - " model_options\n", - " _BMIX\n", - " dm\n", - " decayline\n", - " partdecay\n", - " 0.000015583\n", - " particle\te+\n", - " particle\te-\n", - " photos\n", - " model\n", - " model_generic\tVLL\n", - " decayline\n", - " partdecay\n", - " 0.000015766\n", - " particle\tmu+\n", - " particle\tmu-\n", - " photos\n", - " model\n", - " model_generic\tVLL\n", - " decayline\n", - " partdecay\n", - " 0.000084099\n", - " particle\tUpsilon(2S)\n", - " particle\tpi+\n", - " particle\tpi-\n", - " model\n", - " model_generic\n", - " VVP\n", - " model_options\tIPI\n", - " decayline\n", - " partdecay\n", - " 0.000044342\n", - " particle\tUpsilon(2S)\n", - " particle\tpi0\n", - " particle\tpi0\n", - " model\n", - " model_generic\n", - " VVP\n", - " model_options\tIPI\n", - " decayline\n", - " partdecay\n", - " 0.000080123\n", - " particle\tUpsilon\n", - " particle\tpi+\n", - " particle\tpi-\n", - " model\n", - " model_generic\n", - " VVP\n", - " model_options\tIPI\n", - " decayline\n", - " partdecay\n", - " 0.000194392\n", - " particle\tUpsilon\n", - " particle\teta\n", - " model\n", - " model_generic\n", - " PARTWAVE\n", - " model_options\n", - " 0.0\n", - " 0.0\n", - " 1.0\n", - " 0.0\n", - " 0.0\n", - " 0.0\n", - " decayline\n", - " partdecay\n", - " 0.000092625\n", - " particle\tgamma\n", - " particle\tchi_b0(3P)\n", - " model\n", - " model_generic\n", - " HELAMP\n", - " model_options\n", - " 1.\n", - " 0.\n", - " 1.\n", - " 0.\n", - " decayline\n", - " partdecay\n", - " 0.000138938\n", - " particle\tgamma\n", - " particle\tchi_b1(3P)\n", - " model\n", - " model_generic\n", - " HELAMP\n", - " model_options\n", - " 1.\n", - " 0.\n", - " 1.\n", - " 0.\n", - " -1.\n", - " 0.\n", - " -1.\n", - " 0.\n", - " decayline\n", - " partdecay\n", - " 0.000129084\n", - " particle\tgamma\n", - " particle\tchi_b2(3P)\n", - " model\n", - " model_generic\n", - " HELAMP\n", - " model_options\n", - " 2.4494897\n", - " 0.\n", - " 1.7320508\n", - " 0.\n", - " 1.\n", - " 0.\n", - " 1.\n", - " 0.\n", - " 1.7320508\n", - " 0.\n", - " 2.4494897\n", - " 0.\n", - " decayline\n", - " partdecay\n", - " 0.000002956\n", - " particle\tgamma\n", - " particle\tchi_b0(2P)\n", - " model\n", - " model_generic\n", - " HELAMP\n", - " model_options\n", - " 1.\n", - " 0.\n", - " 1.\n", - " 0.\n", - " decayline\n", - " partdecay\n", - " 0.000007883\n", - " particle\tgamma\n", - " particle\tchi_b1(2P)\n", - " model\n", - " model_generic\n", - " HELAMP\n", - " model_options\n", - " 1.\n", - " 0.\n", - " 1.\n", - " 0.\n", - " -1.\n", - " 0.\n", - " -1.\n", - " 0.\n", - " decayline\n", - " partdecay\n", - " 0.000011825\n", - " particle\tgamma\n", - " particle\tchi_b2(2P)\n", - " model\n", - " model_generic\n", - " HELAMP\n", - " model_options\n", - " 2.4494897\n", - " 0.\n", - " 1.7320508\n", - " 0.\n", - " 1.\n", - " 0.\n", - " 1.\n", - " 0.\n", - " 1.7320508\n", - " 0.\n", - " 2.4494897\n", - " 0.\n", - " decayline\n", - " partdecay\n", - " 0.000837571\n", - " particle\tg\n", - " particle\tg\n", - " particle\tg\n", - " model\n", - " model_generic\n", - " PYTHIA\n", - " model_options\t4\n", - " decayline\n", - " partdecay\n", - " 0.000039415\n", - " particle\tgamma\n", - " particle\tg\n", - " particle\tg\n", - " model\n", - " model_generic\n", - " PYTHIA\n", - " model_options\t4\n", - "\n" - ] - } - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 460, - "source": [ - "print(*[i + 1 for i, t in enumerate(txt) if \"Enddecay\" in t])" - ], - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "193 222 1485 2702 3709 4711 4727 4730 4733 4736 4739 4742 5215 5662 5680 5697 5763 5773 5778 5782 5786 5791 5795 5942 6084 6088 6276 6281 6462 6563 6662 6669 6673 6677 6681 6696 6700 6704 6708 6713 6717 6721 6725 6742 6748 6754 6760 6768 6773 6779 6785 6789 6793 6799 6805 6813 6817 6821 6825 6831 6837 6843 6849 6865 6872 6876 6882 6888 6894 6900 6908 6911 6914 6917 6920 6923 6929 6934 6939 6943 6948 6952 6964 6976 6988 7000 7010 7020 7030 7040 7053 7066 7079 7092 7105 7114 7123 7132 7144 7153 7162 7171 7175 7179 7183 7187 7192 7196 7206 7218 7222 7225 7228 7242 7254 7278 7283 7287 7291 7301 7311 7323 7328 7332 7336 7343 7347 7351 7359 7369 7389 7396 7409 7421 7431 7437 7444 7450 7455 7461 7484 7507 7530 7553 7576 7599 7622 7645 7682 7690 7842 7940 7965 7993 8028 8086 8131 8183 8196 8200 8207 8231 8253 8278 8289 8297 8314 8332 8341 8364 8403 8407 8416 8427 8459 8472 8489 8497 8512 8531 8541 8545 8548 8551 8554 8661 8666 8669 8676 8681 8684 8688 8691 8711 8730 8734 8737 8743 8748 8752 8755 8766 8775 8781 8787 8802 8817 8825 8833 8842 8851 8865 8879 8892 8905 8918 8931 8947 8963 8974 8985 8994 9002 9010 9018 9029 9040 9047 9054 9060 9065 9069 9072 9077 9081 9087 9092 9096 9099 9107 9114 9119 9123 9129 9134 9140 9145 9151 9156 9165 9173 9181 9188 9193 9197 9206 9214 9219 9224 9229 9235 9241 9246 9252 9260 9265 9274 9351 9427 9457 9486 9520 9553 9574 9594 9599 9602 9606 9609 9613 9616 9727 9835 9849 9859 9865 9870 9877 9880 9884 9887 9892 9896 9901 9905 9910 9914 9925 9935 9940 9944 9949 9953 9958 9962 9973 9983 9988 9992 9997 10001 10006 10010 10017 10023 10027 10030 10037 10043 10047 10050 10054 10057 10061 10064 10068 10071 10075 10078 10082 10085 10090 10094 10099 10103 10108 10112 10122 10131 10140 10149 10158 10167 10176 10185 10194 10203 10212 10221 10246\n" - ] - } - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 461, - "source": [ - "for n, line in enumerate(txt):\n", - " q = line.split(\"#\")[0].strip()\n", - " if q and \"SetLineshapePW\" in q:\n", - " print(n, q)" - ], - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "6683 SetLineshapePW D_1+ D*+ pi0 2\n", - "6684 SetLineshapePW D_1+ D*0 pi+ 2\n", - "6685 SetLineshapePW D_1- D*- pi0 2\n", - "6686 SetLineshapePW D_1- anti-D*0 pi- 2\n", - "6687 SetLineshapePW D_10 D*0 pi0 2\n", - "6688 SetLineshapePW D_10 D*+ pi- 2\n", - "6689 SetLineshapePW anti-D_10 anti-D*0 pi0 2\n", - "6690 SetLineshapePW anti-D_10 D*- pi+ 2\n", - "6727 SetLineshapePW D_2*+ D*+ pi0 2\n", - "6728 SetLineshapePW D_2*+ D*0 pi+ 2\n", - "6729 SetLineshapePW D_2*- D*- pi0 2\n", - "6730 SetLineshapePW D_2*- anti-D*0 pi- 2\n", - "6731 SetLineshapePW D_2*0 D*0 pi0 2\n", - "6732 SetLineshapePW D_2*0 D*+ pi- 2\n", - "6733 SetLineshapePW anti-D_2*0 anti-D*0 pi0 2\n", - "6734 SetLineshapePW anti-D_2*0 D*- pi+ 2\n" - ] - } - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 462, - "source": [ - "print(\"\".join(txt[-5:]))" - ], - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "#0.000000007 mu+ mu- gamma gamma PHSP; #[New mode added] #[Reconstructed PDG2011]\n", - "Enddecay\n", - "\n", - "End\n", - "\n", - "\n" - ] - } - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 530, - "source": [ - "%%time\n", - "parsed = l.parse(\"\".join(txt))\n", - "bool(parsed)" - ], - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "CPU times: user 1.21 s, sys: 17.9 ms, total: 1.23 s\n", - "Wall time: 1.25 s\n" - ] - } - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": 531, - "source": [ - "parsed.children[-1]" - ], - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": [ - "Tree(line, [Tree(decay, [Tree(particle, [Token(LABEL, 'K_L0')])])])" - ] - }, - "metadata": {}, - "execution_count": 531 - } - ], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": null, - "source": [], - "outputs": [], - "metadata": {} - }, - { - "cell_type": "code", - "execution_count": null, - "source": [], - "outputs": [], - "metadata": {} - } - ], - "metadata": { - "kernelspec": { - "display_name": "Anaconda Python 3", - "language": "python", - "name": "anaconda" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.6.5" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}