Skip to content

Instantly share code, notes, and snippets.

@ndawe
Created July 17, 2013 00:09
Show Gist options
  • Save ndawe/6016436 to your computer and use it in GitHub Desktop.
Save ndawe/6016436 to your computer and use it in GitHub Desktop.
import ROOT
ROOT.gSystem.Load('GoodRunsLists/StandAlone/libGoodRunsLists.so')
from ROOT import Root
grl_str = '''\
<?xml version="1.0"?>
<!DOCTYPE LumiRangeCollection SYSTEM "http://atlas-runquery.cern.ch/LumiRangeCollection.dtd">
<!-- This document was created by goodruns: http://pypi.python.org/pypi/goodruns/ on 2013-07-16 at 08:24:28 -->
<LumiRangeCollection>
<NamedLumiRange>
<Name>GRL</Name>
<Version>1.0</Version>
<LumiBlockCollection>
<Run>1</Run>
<LBRange Start="1" End="100"/>
</LumiBlockCollection>
</NamedLumiRange>
</LumiRangeCollection>
'''
grl_str_rev = '''\
<?xml version="1.0"?>
<!DOCTYPE LumiRangeCollection SYSTEM "http://atlas-runquery.cern.ch/LumiRangeCollection.dtd">
<!-- This document was created by goodruns: http://pypi.python.org/pypi/goodruns/ on 2013-07-16 at 08:24:28 -->
<LumiRangeCollection>
<NamedLumiRange>
<Name>GRL</Name>
<Version>1.0</Version>
<LumiBlockCollection>
<Run>1</Run>
<LBRange End="100" Start="1"/>
</LumiBlockCollection>
</NamedLumiRange>
</LumiRangeCollection>
'''
for s in (grl_str, grl_str_rev):
reader = Root.TGoodRunsListReader()
reader.AddXMLString(s)
reader.Interpret()
grl = reader.GetMergedGoodRunsList()
print grl.HasRunLumiBlock(1, 101)
writer = Root.TGoodRunsListWriter()
writer.SetGoodRunsList(grl)
print writer.GetXMLString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment