#!/usr/bin/env python

import os
import subprocess
import EventApps
#from ROOT import *
import ROOT

import optparse

#
ROOT.gROOT.LoadMacro('hltstruct.h+')

myfile = ROOT.TFile("r155112_test.root","RECREATE")

if __name__ == "__main__":
  tree = ROOT.TTree("hltresult","hltresults")
  s = ROOT.hltstruct()
  tree._s = s
  tree.Branch("L2Result",ROOT.AddressOf(s,'l2result'),"l2result/F")
  tree.Branch("EFResult",ROOT.AddressOf(s,'efresult'),"efresult/F")
  tree.Branch("EventNumber",ROOT.AddressOf(s,'eventnumber'),"eventnumber/I")
  tree.Branch("L1Identifier",ROOT.AddressOf(s,'l1identifier'),"l1identifier/l")
  tree.Branch("GlobalIdentifier",ROOT.AddressOf(s,'globalid'),"globalidentifier/l")
  tree.Branch("Type",s.type)
  tree.Branch("Typesize",s.typesize)

  #myfile = ROOT.TFile("r155112_test.root","RECREATE")
  for f in range(1,100):
    s.l2result = f
    tree.Fill()
  myfile.Write()
  myfile.Close()
