def __init__(self, filename): self.filename = filename self.file = ROOT.TFile(filename, 'RECREATE') self.T = ROOT.TTree('T', 'Chroma events') self.ev = ROOT.Event() self.T.Branch('ev', self.ev)
def __init__(self, filename, detector=None): self.filename = filename self.file = ROOT.TFile(filename, 'RECREATE') if detector is not None: ch_info = ROOT.TTree('CH', 'Chroma channel info') ch_pos = ROOT.TVector3() ch_type = array.array( 'i', [0]) ch_info.Branch('pos',ch_pos) ch_info.Branch('type',ch_type,'type/I') for pos,chtype in zip(detector.channel_index_to_position, detector.channel_index_to_channel_type): ch_pos.SetXYZ(*pos) ch_type[0] = chtype ch_info.Fill() ch_info.Write() self.T = ROOT.TTree('T', 'Chroma events') self.ev = ROOT.Event() self.T.Branch('ev', self.ev)