-
Notifications
You must be signed in to change notification settings - Fork 3
/
TreeProducer.py
65 lines (49 loc) · 2.75 KB
/
TreeProducer.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
import ROOT
import math
import numpy as np
from TreeProducerCommon import *
ptrange = np.arange(3, 15, 1).tolist()
class TreeProducer(TreeProducerCommon):
"""Class to create a custom output file & tree; as well as create and contain branches."""
def __init__(self, name, **kwargs):
print('TreeProducer is called for', name)
super(TreeProducer, self).__init__(name,**kwargs)
self.addBranch('nmuons_eta1p5', 'i')
self.addBranch('nmuons_eta2p4', 'i')
self.addBranch('nelectrons_eta1p0', 'i')
self.addBranch('nelectrons_eta1p5', 'i')
self.addBranch('nelectrons_eta2p4', 'i')
self.addBranch('mu1_eta1p5_pt', 'f')
self.addBranch('mu1_eta1p5_eta', 'f')
self.addBranch('mu1_eta1p5_phi', 'f')
self.addBranch('mu1_eta2p4_pt', 'f')
self.addBranch('mu1_eta2p4_eta', 'f')
self.addBranch('mu1_eta2p4_phi', 'f')
self.addBranch('e1_eta1p0_pt', 'f')
self.addBranch('e1_eta1p0_eta', 'f')
self.addBranch('e1_eta1p0_phi', 'f')
self.addBranch('e2_eta1p0_pt', 'f')
self.addBranch('e2_eta1p0_eta', 'f')
self.addBranch('e2_eta1p0_phi', 'f')
self.addBranch('e1_eta1p5_pt', 'f')
self.addBranch('e1_eta1p5_eta', 'f')
self.addBranch('e1_eta1p5_phi', 'f')
self.addBranch('e2_eta1p5_pt', 'f')
self.addBranch('e2_eta1p5_eta', 'f')
self.addBranch('e2_eta1p5_phi', 'f')
self.addBranch('e1_eta2p4_pt', 'f')
self.addBranch('e1_eta2p4_eta', 'f')
self.addBranch('e1_eta2p4_phi', 'f')
self.addBranch('e2_eta2p4_pt', 'f')
self.addBranch('e2_eta2p4_eta', 'f')
self.addBranch('e2_eta2p4_phi', 'f')
self.addBranch('instL', 'f')
self.addBranch('npu', 'f')
for pt in ptrange:
self.addBranch('doubleE' + str(pt) + '_eta1p0', '?')
self.addBranch('dyn_doubleE' + str(pt) + '_eta1p0' , '?')
self.addBranch('doubleE' + str(pt) + '_eta1p5', '?')
for pt1 in ptrange:
for pt2 in ptrange:
if pt2 >= pt1: continue
self.addBranch('E' + str(pt1) + '_eta1p0_E' + str(pt2) + '_eta1p0', '?')