diff --git a/devscripts/MigrateSpiresToInspire/README b/devscripts/MigrateSpiresToInspire/README new file mode 100644 --- /dev/null +++ b/devscripts/MigrateSpiresToInspire/README @@ -0,0 +1,5 @@ +* Requires rivetenv.sh to be sourced + +./mkList.sh +python bs_inspire.py spires_list.raw +./addKeys.py translation.txt /home/hschulz/src/rivet-hg2/data/anainfo diff --git a/devscripts/MigrateSpiresToInspire/SED.sh b/devscripts/MigrateSpiresToInspire/SED.sh new file mode 100755 --- /dev/null +++ b/devscripts/MigrateSpiresToInspire/SED.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +old=${1} +new=${2} + +old=CDF_2009_S8383952 +new=CDF_2009_I856131 + + +#cd src/Analyses/ +#sed -i "s|${old}|${new}|g" ${old}.cc +#sed -i "s|${old}|${new}|g" Makefile.am +#hg mv ${old}.cc ${new}.cc +#cd - + +#cd data/anainfo +#sed -i "s|${old}|${new}|g" ${old}.info +#sed -i "s|${old}|${new}|g" Makefile.am +#hg mv ${old}.info ${new}.info +#cd - + +#cd data/plotinfo +#sed -i "s|${old}|${new}|g" ${old}.plot +#sed -i "s|${old}|${new}|g" Makefile.am +#hg mv ${old}.plot ${new}.plot +#cd - + +#cd data/refdata +#sed -i "s|${old}|${new}|g" ${old}.yoda +#sed -i "s|${old}|${new}|g" Makefile.am +#hg mv ${old}.yoda ${new}.yoda +#cd - diff --git a/devscripts/MigrateSpiresToInspire/addKeys.py b/devscripts/MigrateSpiresToInspire/addKeys.py new file mode 100755 --- /dev/null +++ b/devscripts/MigrateSpiresToInspire/addKeys.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +import os, sys + +def mkSed(ana, iid, path=None): + cmd = 'sed -i "/SpiresID/a InspireID: %s" '%iid + if path is not None: + cmd += os.path.join(path,"%s.info"%ana) + else: + cmd += "%s.info"%ana + + return cmd + + +with open(sys.argv[1]) as f: + T=[i.split() for i in f] + + +for t in T: + os.system(mkSed(t[0], t[1], sys.argv[2])) + + diff --git a/devscripts/MigrateSpiresToInspire/bs_inspire.py b/devscripts/MigrateSpiresToInspire/bs_inspire.py new file mode 100644 --- /dev/null +++ b/devscripts/MigrateSpiresToInspire/bs_inspire.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + + + +def getInSpireKey(ananame): + searchstring = ananame.split("_S")[-1].split("_")[0] + + import urllib2 + searchpage = urllib2.urlopen('http://inspire-hep.net/search?p=find+key+%s'%searchstring).read() + + from BeautifulSoup import BeautifulSoup + soup = BeautifulSoup(searchpage) + soup.prettify() + result = "" + for anchor in soup.findAll('a', href=True): + if anchor['href'].startswith("http://inspirehep.net/record/"): + result = anchor['href'] + break + + if result == "": + print ananame, "Gone Wrong" + return str(result.split('/')[-1]) + + + + +import os, sys + +with open(sys.argv[1]) as f: + SLIST=[i.strip() for i in f] + +ILIST = [getInSpireKey(s) for s in SLIST] + +with open("translation.txt", "w") as f: + for num , I in enumerate(ILIST): + f.write("%s\t%s\n"%(SLIST[num], I)) + +from IPython import embed + +embed() diff --git a/devscripts/MigrateSpiresToInspire/mkList.sh b/devscripts/MigrateSpiresToInspire/mkList.sh new file mode 100755 --- /dev/null +++ b/devscripts/MigrateSpiresToInspire/mkList.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +rivet --list-analyses | grep -v EXAMPLE_ |grep -v MC_ |grep -v _I | grep _S | cut -d " " -f 1 > spires_list.raw diff --git a/devscripts/MigrateSpiresToInspire/spires_list.raw b/devscripts/MigrateSpiresToInspire/spires_list.raw new file mode 100644 --- /dev/null +++ b/devscripts/MigrateSpiresToInspire/spires_list.raw @@ -0,0 +1,148 @@ +ALEPH_1991_S2435284 +ALEPH_1996_S3196992 +ALEPH_1996_S3486095 +ALEPH_1999_S4193598 +ALEPH_2001_S4656318 +ALEPH_2002_S4823664 +ALEPH_2004_S5765862 +ALICE_2010_S8624100 +ALICE_2010_S8625980 +ALICE_2010_S8706239 +ALICE_2011_S8909580 +ALICE_2011_S8945144 +ARGUS_1993_S2653028 +ARGUS_1993_S2669951 +ARGUS_1993_S2789213 +ATLAS_2010_S8591806 +ATLAS_2010_S8817804 +ATLAS_2010_S8894728 +ATLAS_2010_S8914702 +ATLAS_2010_S8918562 +ATLAS_2010_S8919674 +ATLAS_2011_S8924791 +ATLAS_2011_S8971293 +ATLAS_2011_S8983313 +ATLAS_2011_S8994773 +ATLAS_2011_S9002537 +ATLAS_2011_S9019561 +ATLAS_2011_S9035664 +ATLAS_2011_S9041966 +ATLAS_2011_S9108483 +ATLAS_2011_S9120807 +ATLAS_2011_S9126244 +ATLAS_2011_S9128077 +ATLAS_2011_S9131140 +ATLAS_2011_S9212183 +ATLAS_2011_S9212353 +ATLAS_2011_S9225137 +BABAR_2005_S6181155 +BABAR_2007_S6895344 +BABAR_2007_S7266081 +BELLE_2001_S4598261 +CDF_1988_S1865951 +CDF_1990_S2089246 +CDF_1993_S2742446 +CDF_1994_S2952106 +CDF_1996_S3108457 +CDF_1996_S3349578 +CDF_1996_S3418421 +CDF_1997_S3541940 +CDF_1998_S3618439 +CDF_2000_S4155203 +CDF_2000_S4266730 +CDF_2001_S4517016 +CDF_2001_S4563131 +CDF_2001_S4751469 +CDF_2002_S4796047 +CDF_2004_S5839831 +CDF_2005_S6080774 +CDF_2005_S6217184 +CDF_2006_S6450792 +CDF_2006_S6653332 +CDF_2007_S7057202 +CDF_2008_S7540469 +CDF_2008_S7541902 +CDF_2008_S7782535 +CDF_2008_S7828950 +CDF_2008_S8093652 +CDF_2008_S8095620 +CDF_2009_S8233977 +CDF_2009_S8436959 +CDF_2010_S8591881_DY +CDF_2010_S8591881_QCD +CLEO_2004_S5809304 +CMS_2010_S8547297 +CMS_2010_S8656010 +CMS_2011_S8884919 +CMS_2011_S8941262 +CMS_2011_S8950903 +CMS_2011_S8957746 +CMS_2011_S8968497 +CMS_2011_S8973270 +CMS_2011_S8978280 +CMS_2011_S9086218 +CMS_2011_S9088458 +CMS_2011_S9120041 +CMS_2011_S9215166 +D0_1996_S3214044 +D0_1996_S3324664 +D0_2000_S4480767 +D0_2001_S4674421 +D0_2004_S5992206 +D0_2006_S6438750 +D0_2007_S7075677 +D0_2008_S6879055 +D0_2008_S7554427 +D0_2008_S7662670 +D0_2008_S7719523 +D0_2008_S7837160 +D0_2008_S7863608 +D0_2009_S8202443 +D0_2009_S8320160 +D0_2009_S8349509 +D0_2010_S8566488 +D0_2010_S8570965 +D0_2010_S8671338 +D0_2010_S8821313 +DELPHI_1995_S3137023 +DELPHI_1996_S3430090 +DELPHI_1999_S3960137 +DELPHI_2000_S4328825 +E735_1998_S3905616 +H1_1994_S2919893 +H1_1995_S3167097 +H1_2000_S4129130 +JADE_1998_S3612880 +JADE_OPAL_2000_S4300807 +LHCB_2010_S8758301 +OPAL_1993_S2692198 +OPAL_1994_S2927284 +OPAL_1995_S3198391 +OPAL_1996_S3257789 +OPAL_1997_S3396100 +OPAL_1997_S3608263 +OPAL_1998_S3702294 +OPAL_1998_S3749908 +OPAL_1998_S3780481 +OPAL_2000_S4418603 +OPAL_2001_S4553896 +OPAL_2002_S5361494 +OPAL_2004_S6132243 +SFM_1984_S1178091 +SLD_1996_S3398250 +SLD_1999_S3743934 +SLD_2002_S4869273 +SLD_2004_S5693039 +STAR_2006_S6500200 +STAR_2006_S6860818 +STAR_2006_S6870392 +STAR_2008_S7869363 +STAR_2008_S7993412 +TASSO_1990_S2148048 +UA1_1990_S2044935 +UA5_1982_S875503 +UA5_1986_S1583476 +UA5_1987_S1640666 +UA5_1988_S1867512 +UA5_1989_S1926373 +ZEUS_2001_S4815815 diff --git a/devscripts/MigrateSpiresToInspire/translation.txt b/devscripts/MigrateSpiresToInspire/translation.txt new file mode 100644 --- /dev/null +++ b/devscripts/MigrateSpiresToInspire/translation.txt @@ -0,0 +1,148 @@ +ALEPH_1991_S2435284 319520 +ALEPH_1996_S3196992 398193 +ALEPH_1996_S3486095 428072 +ALEPH_1999_S4193598 507422 +ALEPH_2001_S4656318 558327 +ALEPH_2002_S4823664 569165 +ALEPH_2004_S5765862 636645 +ALICE_2010_S8624100 852450 +ALICE_2010_S8625980 852264 +ALICE_2010_S8706239 860416 +ALICE_2011_S8909580 881474 +ALICE_2011_S8945144 885104 +ARGUS_1993_S2653028 340894 +ARGUS_1993_S2669951 342061 +ARGUS_1993_S2789213 356616 +ATLAS_2010_S8591806 849050 +ATLAS_2010_S8817804 871366 +ATLAS_2010_S8894728 879407 +ATLAS_2010_S8914702 882463 +ATLAS_2010_S8918562 882098 +ATLAS_2010_S8919674 882534 +ATLAS_2011_S8924791 882984 +ATLAS_2011_S8971293 889546 +ATLAS_2011_S8983313 890749 +ATLAS_2011_S8994773 891834 +ATLAS_2011_S9002537 892704 +ATLAS_2011_S9019561 894578 +ATLAS_2011_S9035664 896268 +ATLAS_2011_S9041966 897002 +ATLAS_2011_S9108483 914491 +ATLAS_2011_S9120807 916832 +ATLAS_2011_S9126244 917526 +ATLAS_2011_S9128077 917599 +ATLAS_2011_S9131140 917931 +ATLAS_2011_S9212183 930002 +ATLAS_2011_S9212353 930005 +ATLAS_2011_S9225137 939504 +BABAR_2005_S6181155 679961 +BABAR_2007_S6895344 725377 +BABAR_2007_S7266081 756323 +BELLE_2001_S4598261 554520 +CDF_1988_S1865951 263320 +CDF_1990_S2089246 283352 +CDF_1993_S2742446 354237 +CDF_1994_S2952106 374155 +CDF_1996_S3108457 393345 +CDF_1996_S3349578 418504 +CDF_1996_S3418421 423414 +CDF_1997_S3541940 442265 +CDF_1998_S3618439 448075 +CDF_2000_S4155203 505738 +CDF_2000_S4266730 511377 +CDF_2001_S4517016 538041 +CDF_2001_S4563131 552797 +CDF_2001_S4751469 564673 +CDF_2002_S4796047 567774 +CDF_2004_S5839831 647490 +CDF_2005_S6080774 667384 +CDF_2005_S6217184 682179 +CDF_2006_S6450792 699933 +CDF_2006_S6653332 717572 +CDF_2007_S7057202 743342 +CDF_2008_S7540469 768451 +CDF_2008_S7541902 768579 +CDF_2008_S7782535 787780 +CDF_2008_S7828950 790693 +CDF_2008_S8093652 805902 +CDF_2008_S8095620 806082 +CDF_2009_S8233977 817466 +CDF_2009_S8436959 834437 +CDF_2010_S8591881_DY 849042 +CDF_2010_S8591881_QCD 849042 +CLEO_2004_S5809304 645209 +CMS_2010_S8547297 845323 +CMS_2010_S8656010 855299 +CMS_2011_S8884919 879315 +CMS_2011_S8941262 884811 +CMS_2011_S8950903 885663 +CMS_2011_S8957746 886332 +CMS_2011_S8968497 889175 +CMS_2011_S8973270 889807 +CMS_2011_S8978280 890166 +CMS_2011_S9086218 902309 +CMS_2011_S9088458 912560 +CMS_2011_S9120041 916908 +CMS_2011_S9215166 930319 +D0_1996_S3214044 399364 +D0_1996_S3324664 416886 +D0_2000_S4480767 535017 +D0_2001_S4674421 559624 +D0_2004_S5992206 659398 +D0_2006_S6438750 698784 +D0_2007_S7075677 744624 +D0_2008_S6879055 724239 +D0_2008_S7554427 769689 +D0_2008_S7662670 779574 +D0_2008_S7719523 782968 +D0_2008_S7837160 791230 +D0_2008_S7863608 792812 +D0_2009_S8202443 815094 +D0_2009_S8320160 824127 +D0_2009_S8349509 826756 +D0_2010_S8566488 846483 +D0_2010_S8570965 846997 +D0_2010_S8671338 856972 +D0_2010_S8821313 871787 +DELPHI_1995_S3137023 394716 +DELPHI_1996_S3430090 424112 +DELPHI_1999_S3960137 482816 +DELPHI_2000_S4328825 524693 +E735_1998_S3905616 480349 +H1_1994_S2919893 372350 +H1_1995_S3167097 396365 +H1_2000_S4129130 503947 +JADE_1998_S3612880 447560 +JADE_OPAL_2000_S4300807 513337 +LHCB_2010_S8758301 865584 +OPAL_1993_S2692198 343181 +OPAL_1994_S2927284 372772 +OPAL_1995_S3198391 398320 +OPAL_1996_S3257789 402487 +OPAL_1997_S3396100 421978 +OPAL_1997_S3608263 447146 +OPAL_1998_S3702294 467092 +OPAL_1998_S3749908 470419 +OPAL_1998_S3780481 472637 +OPAL_2000_S4418603 529898 +OPAL_2001_S4553896 552446 +OPAL_2002_S5361494 601225 +OPAL_2004_S6132243 669402 +SFM_1984_S1178091 196601 +SLD_1996_S3398250 422172 +SLD_1999_S3743934 469925 +SLD_2002_S4869273 582951 +SLD_2004_S5693039 630327 +STAR_2006_S6500200 709170 +STAR_2006_S6860818 722757 +STAR_2006_S6870392 723509 +STAR_2008_S7869363 793126 +STAR_2008_S7993412 810030 +TASSO_1990_S2148048 294755 +UA1_1990_S2044935 280412 +UA5_1982_S875503 176647 +UA5_1986_S1583476 233599 +UA5_1987_S1640666 244829 +UA5_1988_S1867512 263399 +UA5_1989_S1926373 267179 +ZEUS_2001_S4815815 568665