This repository has been archived by the owner on Jun 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventCounter.py~
71 lines (50 loc) · 1.78 KB
/
EventCounter.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
#! /usr/bin/env python
###################################################################
## ##
## Name: TWrate.py ##
## Author: Kevin Nash ##
## Date: 6/5/2012 ##
## Purpose: This program creates eta binned tags and probes ##
## as a function of Pt for data and MC for use with ##
## TWrate_Maker.py. ##
## ##
###################################################################
import os
import glob
import math
from math import sqrt,exp
import ROOT
from ROOT import std,ROOT,TFile,TLorentzVector,TMath,gROOT, TF1,TH1F,TH1D,TH2F,TH2D
from ROOT import TVector
from ROOT import TFormula
import sys
from DataFormats.FWLite import Events, Handle
from optparse import OptionParser
from array import *
parser = OptionParser()
parser.add_option('-b', '--bx', metavar='F', type='string', action='store',
default = '25ns',
dest = 'bx',
help = 'bunch crossing 50ns or 25ns')
parser.add_option('-s', '--set', metavar='F', type='string', action='store',
default = 'data',
dest = 'set',
help = 'data or ttbar')
(options, args) = parser.parse_args()
print "Options summary"
print "=================="
for opt,value in options.__dict__.items():
#print str(option)+ ": " + str(options[option])
print str(opt) +': '+ str(value)
print "=================="
print ""
#If running on the grid we access the script within a tarred directory
import Bstar_Functions
from Bstar_Functions import *
#Based on what set we want to analyze, we find all Ntuple root files
i = options.set
files = Load_Ntuples(i,options.bx)
print "File loaded"
events = Events(files)
totevents = events.size()
print i + ": " + str(totevents) + ' Events total'