Go to the documentation of this file.00001
00002
00003 import ROOT
00004 import sys
00005 from DataFormats.FWLite import Events, Handle
00006
00007 files = ["patTuple.root"]
00008 events = Events (files)
00009 handle = Handle ("std::vector<pat::Muon>")
00010
00011
00012
00013 label = ("cleanPatMuons")
00014
00015 f = ROOT.TFile("analyzerPython.root", "RECREATE")
00016 f.cd()
00017
00018 muonPt = ROOT.TH1F("muonPt", "pt", 100, 0.,300.)
00019 muonEta = ROOT.TH1F("muonEta","eta", 100, -3., 3.)
00020 muonPhi = ROOT.TH1F("muonPhi","phi", 100, -5., 5.)
00021
00022
00023 i = 0
00024 for event in events:
00025 i = i + 1
00026 print i
00027
00028 event.getByLabel (label, handle)
00029
00030 muons = handle.product()
00031
00032 for muon in muons :
00033 muonPt.Fill( muon.pt() )
00034 muonEta.Fill( muon.eta() )
00035 muonPhi.Fill( muon.phi() )
00036
00037
00038 f.cd()
00039
00040 muonPt.Write()
00041 muonEta.Write()
00042 muonPhi.Write()
00043
00044 f.Close()