CMS 3D CMS Logo

Functions
example Namespace Reference

Functions

def eventLoop (filename)
 

Detailed Description

Example L1TNtuple analysis program

Function Documentation

def example.eventLoop (   filename)

Definition at line 20 of file example.py.

20 def eventLoop(filename):
21  f = ROOT.TFile(filename)
22 
23  treeL1 = f.Get("l1NtupleProducer/L1Tree")
24  treeTow = f.Get("l1CaloTowerTreeProducer/L1CaloTowerTree")
25 # tree_l1ex = f.Get("l1ExtraTreeProducer/L1ExtraTree")
26  treeL1up = f.Get("l1UpgradeTreeProducer/L1UpgradeTree")
27 
28  treeJet = f.Get("l1JetRecoTreeProducer/JetRecoTree")
29 # treeEG = f.Get("l1EGRecoTreeProducer/EGRecoTree")
30 # treeTau = f.Get("l1TauRecoTreeProducer/TauRecoTree")
31 # treeMu = f.Get("l1MuonRecoTreeProducer/MuonRecoTree")
32 
33  treeL1.AddFriend(treeTow)
34 # treeL1.AddFriend(treeL1ex)
35  treeL1.AddFriend(treeL1up)
36  treeL1.AddFriend(treeJet)
37 
38 
39  for jentry, event in enumerate(tree):
40  if jentry >= nevents:
41  break
42 
43  event = treeL1.Event
44  eventSim = treeL1.Simulation
45  eventRCT = treeL1.RCT
46  eventGCT = treeL1.GCT
47  eventDTTF = treeL1.DTTF
48  eventCSCTF = treeL1.CSCTF
49  eventGMT = treeL1.GMT
50  eventGT = treeL1.GT
51 
52  eventCaloTP = treeTow.CaloTP
53  eventTower = treeTow.L1CaloTower
54 
55  eventL1Up = treeL1up.L1Upgrade
56 
57  eventJet = treeJet.Jet
58 
59 # eventEG = treeEG.EG
60 
61 # eventTau = treeTau.Tau
62 
63 # eventMuon = treeMu.Mu
64 
65 
66  # Print hists to file
67  c = ROOT.TCanvas()
68 
69 
70  h.Draw("")
71  h.SetTitleOffset(0.55, 'Z')
72  c.Print("plot.pdf")
73 
74  f.Close() # make sure I go last! otherwise your hists will be NoneType
75 
76 
def eventLoop(filename)
Definition: example.py:20