Skip to content

Instantly share code, notes, and snippets.

@mgmarino
Created April 27, 2011 11:20
Show Gist options
  • Save mgmarino/944074 to your computer and use it in GitHub Desktop.
Save mgmarino/944074 to your computer and use it in GitHub Desktop.
Pulser file
import ROOT
class MGMPulserFile:
_mydict = None
@classmethod
def get_event(cls, timestamp ):
if not cls._mydict: cls.setup_file()
return cls._mydict[ timestamp ]
@classmethod
def setup_file(cls):
if cls._mydict: return
print "Initializing pulser file"
myfile = ROOT.TFile("pulser_in_onefile.root")
thetree = myfile.Get("soudan_wf_analysis")
cls._mydict = dict([( an_event.timestamp,
( an_event.pulser_chunk_one, an_event.pulser_chunk_two ))
for an_event in thetree])
print MGMPulserFile.get_event(3342897306437)
print MGMPulserFile.get_event(3342816988609)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment