-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBasicLoopCU.py
executable file
·71 lines (59 loc) · 2.17 KB
/
BasicLoopCU.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# File: BasicLoopCU.py
# Description: Analyzer for ntuples created by TheNtupleMaker
# Created: Fri Jun 3 16:38:31 2011 by mkntanalyzer.py
# Author: Ben Kreis
# -----------------------------------------------------------------------------
from ROOT import *
from string import *
from BasicLoopCUlib import *
import os, sys, re
# -----------------------------------------------------------------------------
# -- Procedures and functions
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
def main():
# Get number of events
nevents = stream.size()
print "Number of events:", nevents
# Notes:
#
# 1. Use
# ofile = outputFile(cmdline.outputfile, stream)
#
# to skim events to output file in addition to writing out histograms.
#
# 2. Use
# ofile.addEvent(event-weight)
#
# to specify that the current event is to be added to the output file. If
# omitted, the event-weight is taken to be 1.
#
# 3. Use
# ofile.count(cut-name, event-weight)
#
# to keep track, in the count histogram, of the number of events passing
# a given cut. If omitted, the event-weight is taken to be 1. If you want
# the counts in the count histogram to appear in a given order, specify
# the order, before entering the event loop, as in the example below
#
# ofile.count("NoCuts", 0)
# ofile.count("GoodEvent", 0)
# ofile.count("Vertex", 0)
# ofile.count("MET", 0)
ofile = outputFile(cmdline.outputfilename)
# -------------------------------------------------------------------------
# Define histograms
# -------------------------------------------------------------------------
setStyle()
# -------------------------------------------------------------------------
# Loop over events
# -------------------------------------------------------------------------
for entry in xrange(nevents):
stream.read(entry)
# -- Event selection
stream.close()
ofile.close()
# -----------------------------------------------------------------------------
main()