[Rivet-svn] r2391 - in trunk: . bin doc pyext

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Apr 5 23:04:11 BST 2010


Author: buckley
Date: Mon Apr  5 23:04:10 2010
New Revision: 2391

Log:
Using spiresbib in rivet-mkanalysis: analysis templates made with rivet-mkanalysis will now contain a SPIRES-dumped BibTeX key and entry if possible!
This required a bit of reorganisation: spiresbib.py is now in the pyext directory and is installed by the Python setup.py script (cf. lighthisto)

Added:
   trunk/pyext/spiresbib.py
      - copied, changed from r2388, trunk/doc/spiresbib.py
Deleted:
   trunk/doc/spiresbib.py
Modified:
   trunk/ChangeLog
   trunk/bin/rivet-mkanalysis
   trunk/doc/Makefile.am
   trunk/pyext/Makefile.am
   trunk/pyext/setup.py.in

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Mon Apr  5 20:09:23 2010	(r2390)
+++ trunk/ChangeLog	Mon Apr  5 23:04:10 2010	(r2391)
@@ -1,5 +1,9 @@
 2010-04-05  Andy Buckley  <andy at insectnation.org>
 
+	* Using spiresbib in rivet-mkanalysis: analysis templates made
+	with rivet-mkanalysis will now contain a SPIRES-dumped BibTeX key
+	and entry if possible!
+
 	* Adding BibKey and BibTeX entries to analysis metadata files, and
 	updating doc build to use them rather than the time-consuming
 	SPIRES screen-scraping. Added SPIRES BibTeX dumps to all analysis

Modified: trunk/bin/rivet-mkanalysis
==============================================================================
--- trunk/bin/rivet-mkanalysis	Mon Apr  5 20:09:23 2010	(r2390)
+++ trunk/bin/rivet-mkanalysis	Mon Apr  5 23:04:10 2010	(r2391)
@@ -84,6 +84,24 @@
         "ANASPIRESID" : ANASPIRESID
         }
 
+
+    ## Try to get bib info from SPIRES
+    ANABIBKEY = "<Insert SPIRES BibTeX key>"
+    ANABIBTEX = "<Insert SPIRES BibTeX block>"
+    bibkey, bibtex = None, None
+    try:
+        import spiresbib
+        logging.debug("Getting SPIRES biblio data for '%s'" % ANANAME)
+        bibkey, bibtex = spiresbib.get_bibtex_from_spires(ANASPIRESID)
+    except Exception, e:
+        print "Oops:", e
+    if bibkey and bibtex:
+        ANABIBKEY = bibkey
+        ANABIBTEX = bibtex
+    KEYWORDS["ANABIBKEY"] = ANABIBKEY
+    KEYWORDS["ANABIBTEX"] = ANABIBTEX
+
+
     ANASRCFILE = os.path.join(ANASRCDIR, ANANAME+".cc")
     logging.debug("Writing implementation template to %s" % ANASRCFILE)
     f = open(ANASRCFILE, "w")
@@ -215,8 +233,8 @@
   and if possible what it's useful for in terms of MC validation
   and tuning. Use \LaTeX for maths like $\pT > \unit{50}{\GeV}$.
   Use single quotes around the block if required (see YAML 1.2 manual)>'
-BibKey: <Insert SPIRES BibTeX key>
-BibTeX: '<Insert SPIRES BibTeX block>'
+BibKey: %(ANABIBKEY)s
+BibTeX: '%(ANABIBTEX)s'
 ToDo:
  - <Example: Use correct jet algorithm>
  - <Example: Add simplified trigger definition>

Modified: trunk/doc/Makefile.am
==============================================================================
--- trunk/doc/Makefile.am	Mon Apr  5 20:09:23 2010	(r2390)
+++ trunk/doc/Makefile.am	Mon Apr  5 23:04:10 2010	(r2391)
@@ -7,7 +7,8 @@
   make-plots.txt rivet-manual.tex preamble.tex hepparticles.sty maybemath.sty \
   rivet-manual.pdf hepunits.sty underscore.sty microtype.sty
 
-EXTRA_DIST = $(DOCSOURCES) readplot.py spiresbib.py
+## TODO: replace readplot with lighthisto/YODA functionality
+EXTRA_DIST = $(DOCSOURCES) readplot.py
 
 if WITH_ASCIIDOC
 EXTRA_DIST += compare-histos.html make-plots.html
@@ -22,6 +23,7 @@
 	LD_LIBRARY_PATH=$(top_srcdir)/src/.libs:$(top_srcdir)/src/Tools/yaml-cpp/.libs:$(FASTJETLIBPATH):$(HEPMCLIBPATH):$(LD_LIBRARY_PATH):$(prefix)/lib \
 DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs:$(top_srcdir)/src/Tools/yaml-cpp/.libs:$(FASTJETLIBPATH):$(HEPMCLIBPATH):$(DYLD_LIBRARY_PATH):$(prefix)/lib \
 RIVET_INFO_PATH=$(top_srcdir)/data/anainfo \
+PYTHONPATH=$(top_srcdir)/pyext:$(PYTHONPATH) \
 ./mk-analysis-html analyses.html
 
 endif

Modified: trunk/pyext/Makefile.am
==============================================================================
--- trunk/pyext/Makefile.am	Mon Apr  5 20:09:23 2010	(r2390)
+++ trunk/pyext/Makefile.am	Mon Apr  5 23:04:10 2010	(r2391)
@@ -1,4 +1,4 @@
-EXTRA_DIST = rivet.i ez_setup.py lighthisto.py
+EXTRA_DIST = rivet.i ez_setup.py lighthisto.py spiresbib.py
 
 rivet_wrap.cc rivet.py: rivet.i
 	$(SWIG) -c++ -python -I$(top_srcdir)/include -o rivet_wrap.cc $<;

Modified: trunk/pyext/setup.py.in
==============================================================================
--- trunk/pyext/setup.py.in	Mon Apr  5 20:09:23 2010	(r2390)
+++ trunk/pyext/setup.py.in	Mon Apr  5 23:04:10 2010	(r2391)
@@ -25,7 +25,7 @@
 setup(name = 'rivet',
       version = '@PACKAGE_VERSION@',
       ext_modules=[ext],
-      py_modules = ['rivet', 'lighthisto'],
+      py_modules = ['rivet', 'lighthisto', 'spiresbib'],
       author = ['Andy Buckley'],
       author_email = 'andy at insectnation.org',
       url = 'http://projects.hepforge.org/rivet/',

Copied and modified: trunk/pyext/spiresbib.py (from r2388, trunk/doc/spiresbib.py)
==============================================================================
--- trunk/doc/spiresbib.py	Mon Apr  5 19:49:26 2010	(r2388, copy source)
+++ trunk/pyext/spiresbib.py	Mon Apr  5 23:04:10 2010	(r2391)
@@ -16,7 +16,7 @@
     hreq = urllib2.urlopen(spiresurl)
     bibtexhtml = hreq.read()
     hreq.close()
-    logging.debug(bibtexhtml)
+    #logging.debug(bibtexhtml)
     return bibtexhtml
 
 


More information about the Rivet-svn mailing list