Created
April 27, 2011 11:20
-
-
Save mgmarino/944074 to your computer and use it in GitHub Desktop.
Pulser file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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