{"id":353,"date":"2014-03-20T17:05:00","date_gmt":"2014-03-20T16:05:00","guid":{"rendered":"http:\/\/www.graverini.net\/elena\/?page_id=353"},"modified":"2017-11-13T13:11:24","modified_gmt":"2017-11-13T12:11:24","slug":"install-pythia","status":"publish","type":"page","link":"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/","title":{"rendered":"Install Pythia"},"content":{"rendered":"<p>Not all versions of Pythia are compatible with every version of ROOT. In my case, I wanted to use Pythia8 from ROOT&#8217;s command line (i.e. its interpreter &#8220;cling&#8221;, &#8220;cint&#8221; for older versions). To accomplish this it is necessary to create a dictionary that will serve as an interface between ROOT and Pythia. I only managed to get it working using the pair ROOT 5.99\/05 &#8212; Pythia8 180.<\/p>\n<p>The steps to get this working are basically three: get pythia, recompile root, build the dictionary.<\/p>\n<h6>1) Get Pythia<\/h6>\n<p>Download and untar a specific release from <a href=\"http:\/\/home.thep.lu.se\/~torbjorn\/Pythia.html\" title=\"the Pythia homepage\" target=\"_blank\">http:\/\/home.thep.lu.se\/~torbjorn\/Pythia.html<\/a>:<br \/>\n<code>wget http:\/\/home.thep.lu.se\/~torbjorn\/pythia8\/pythia8180.tgz<\/code><br \/>\n<code>tar xvfz pythia8180.tgz<\/code><br \/>\n<code>cd pythia8180<\/code><br \/>\nUse the -fPIC configure flag only on 64bit systems:<br \/>\n<code>.\/configure --enable-shared -fPIC<\/code><br \/>\n<strong>Note: for more recent versions of Pythia (e.g. 8230) -fPIC is replaced by &#8211;enable-64bit!<\/strong><br \/>\nFind out the number N of cores of your machine.<br \/>\n<code>make -j N<\/code><br \/>\nSetup the environment:<br \/>\n<code>echo \"export PYTHIA8=$PWD\" &gt;&gt; $HOME\/.bashrc<\/code><br \/>\n<code>echo \"export PYTHIA8DATA=$PYTHIA8\/xmldoc\" &gt;&gt; $HOME\/.bashrc<\/code><br \/>\n<code>sudo ldconfig<\/code><br \/>\n<code>source $HOME\/.bashrc<\/code><\/p>\n<h6>2) Recompile ROOT:<\/h6>\n<p>Follow the steps on <a href=\"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-root\/\" title=\"Install ROOT\" target=\"_blank\">this page<\/a> to install ROOT 5.99\/05.<br \/>\n<code>cd $ROOTSYS<\/code><br \/>\nI also had to enable the GSL libraries, so:<br \/>\n<code>.\/configure --all --with-gsl-incdir=\"\/usr\/local\/include\/gsl\" --with-gsl-libdir=\"\/usr\/local\/lib\" --enable-pythia8 --with-pythia8-incdir=$PYTHIA8\/include --with-pythia8-libdir=$PYTHIA8\/lib<\/code><br \/>\notherwise leave out the gsl configuration flags.<br \/>\n<code>make -j N<\/code><\/p>\n<h6>3) Build the Pythia8 dictionary:<\/h6>\n<p><code>cd $PYTHIA8<\/code><br \/>\n<code>mkdir PythiaDict && cd PythiaDict<\/code><br \/>\nDownload the following files:<br \/>\n<code>wget http:\/\/www.graverini.net\/elena\/content\/repo\/pythiaROOT.h<\/code><br \/>\n<code>wget http:\/\/www.graverini.net\/elena\/content\/repo\/pythiaLinkdef.h<\/code><br \/>\nBuild the dictionary:<br \/>\n<code>rootcint -f pythiaDict.cxx -c -I$PYTHIA8\/include pythiaROOT.h pythiaLinkdef.h<\/code><br \/>\n<code>g++ -I$PYTHIA8\/include `root-config --glibs` `root-config --cflags` -shared -fPIC -o pythiaDict.so pythiaDict.cxx<\/code><br \/>\nNow open the folder where you wish to work and create a rootlogon.C file (a macro that will be executed every time you start ROOT):<br \/>\n<code>cd path\/to\/my\/work\/folder<\/code><br \/>\n<code>gedit rootlogon.C<\/code><br \/>\nEnter:<\/p>\n<pre lang=\"C\">{\r\n    gSystem->Load(\"$PYTHIA8\/lib\/libpythia8\");\r\n    gSystem->Load(\"libEG\");\r\n    gSystem->Load(\"libEGPythia8\");\r\n    gSystem->Load(\"$PYTHIA8\/PythiaDict\/pythiaDict.so\");\r\n}\r\n<\/pre>\n<p>Save and exit.<br \/>\nNow try to use it:<br \/>\n<code>root -l<\/code><br \/>\n<code>.x $ROOTSYS\/tutorials\/pythia\/pithia8.C<\/code><br \/>\nor<br \/>\n<code>TPythia8 *tpy = new TPythia8()<\/code><br \/>\n<code>Pythia8::Pythia *p = tpy->Pythia8()<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Not all versions of Pythia are compatible with every version of ROOT. In my case, I wanted to use Pythia8 from ROOT&#8217;s command line (i.e. its interpreter &#8220;cling&#8221;, &#8220;cint&#8221; for older versions). To accomplish this it is necessary to create&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":100,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Install Pythia<\/title>\n<meta name=\"description\" content=\"How to install Pythia 8 and to use it as a plugin to ROOT.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Install Pythia\" \/>\n<meta property=\"og:description\" content=\"How to install Pythia 8 and to use it as a plugin to ROOT.\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/\" \/>\n<meta property=\"og:site_name\" content=\"Elena Graverini\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-13T12:11:24+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.graverini.net\/elena\/wp-content\/uploads\/2013\/12\/Penguins.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/\",\"url\":\"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/\",\"name\":\"Install Pythia\",\"isPartOf\":{\"@id\":\"https:\/\/www.graverini.net\/elena\/#website\"},\"datePublished\":\"2014-03-20T16:05:00+00:00\",\"dateModified\":\"2017-11-13T12:11:24+00:00\",\"description\":\"How to install Pythia 8 and to use it as a plugin to ROOT.\",\"breadcrumb\":{\"@id\":\"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.graverini.net\/elena\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Computing\",\"item\":\"http:\/\/www.graverini.net\/elena\/computing\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Physics software\",\"item\":\"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Install Pythia\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.graverini.net\/elena\/#website\",\"url\":\"https:\/\/www.graverini.net\/elena\/\",\"name\":\"Elena Graverini\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.graverini.net\/elena\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Install Pythia","description":"How to install Pythia 8 and to use it as a plugin to ROOT.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/","og_locale":"en_GB","og_type":"article","og_title":"Install Pythia","og_description":"How to install Pythia 8 and to use it as a plugin to ROOT.","og_url":"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/","og_site_name":"Elena Graverini","article_modified_time":"2017-11-13T12:11:24+00:00","og_image":[{"width":1024,"height":768,"url":"http:\/\/www.graverini.net\/elena\/wp-content\/uploads\/2013\/12\/Penguins.jpg","type":"image\/jpeg"}],"twitter_misc":{"Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/","url":"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/","name":"Install Pythia","isPartOf":{"@id":"https:\/\/www.graverini.net\/elena\/#website"},"datePublished":"2014-03-20T16:05:00+00:00","dateModified":"2017-11-13T12:11:24+00:00","description":"How to install Pythia 8 and to use it as a plugin to ROOT.","breadcrumb":{"@id":"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/install-pythia\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.graverini.net\/elena\/"},{"@type":"ListItem","position":2,"name":"Computing","item":"http:\/\/www.graverini.net\/elena\/computing\/"},{"@type":"ListItem","position":3,"name":"Physics software","item":"http:\/\/www.graverini.net\/elena\/computing\/physics-software\/"},{"@type":"ListItem","position":4,"name":"Install Pythia"}]},{"@type":"WebSite","@id":"https:\/\/www.graverini.net\/elena\/#website","url":"https:\/\/www.graverini.net\/elena\/","name":"Elena Graverini","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.graverini.net\/elena\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"}]}},"_links":{"self":[{"href":"http:\/\/www.graverini.net\/elena\/wp-json\/wp\/v2\/pages\/353"}],"collection":[{"href":"http:\/\/www.graverini.net\/elena\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.graverini.net\/elena\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.graverini.net\/elena\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.graverini.net\/elena\/wp-json\/wp\/v2\/comments?post=353"}],"version-history":[{"count":18,"href":"http:\/\/www.graverini.net\/elena\/wp-json\/wp\/v2\/pages\/353\/revisions"}],"predecessor-version":[{"id":564,"href":"http:\/\/www.graverini.net\/elena\/wp-json\/wp\/v2\/pages\/353\/revisions\/564"}],"up":[{"embeddable":true,"href":"http:\/\/www.graverini.net\/elena\/wp-json\/wp\/v2\/pages\/100"}],"wp:attachment":[{"href":"http:\/\/www.graverini.net\/elena\/wp-json\/wp\/v2\/media?parent=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}