-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathleptons_cfg.py
51 lines (46 loc) · 1.48 KB
/
leptons_cfg.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
import heppy.framework.config as cfg
# Use a Selector to select leptons from the output of papas simulation.
# Currently, we're treating electrons and muons transparently.
# we could use two different instances for the Selector module
# to get separate collections of electrons and muons
# help(Selector) for more information
from heppy.analyzers.Selector import Selector
leptons = cfg.Analyzer(
Selector,
'sel_leptons',
output = 'leptons',
input_objects = 'rec_particles',
filter_func = lambda ptc: ptc.e() > 5. and abs(ptc.pdgid()) in [11, 13]
)
# Compute lepton isolation w/r other particles in the event.
# help(IsolationAnalyzer) for more information
from heppy.analyzers.IsolationAnalyzer import IsolationAnalyzer
from heppy.particles.isolation import EtaPhiCircle
iso_leptons = cfg.Analyzer(
IsolationAnalyzer,
candidates = 'leptons',
particles = 'rec_particles',
iso_area = EtaPhiCircle(0.4)
)
sel_iso_leptons = cfg.Analyzer(
Selector,
'sel_iso_leptons',
output = 'sel_iso_leptons',
input_objects = 'leptons',
# filter_func = relative_isolation
filter_func = lambda lep : (lep.iso_211.sumpt + lep.iso_22.sumpt + lep.iso_130.sumpt) / lep.pt() < 0.5
)
from heppy.analyzers.EventFilter import EventFilter
n_leptons = cfg.Analyzer(
EventFilter,
'n_leptons',
input_objects = 'sel_iso_leptons',
min_number = 0,
veto = False
)
isolated_leptons_sequence = [
leptons,
iso_leptons,
sel_iso_leptons,
n_leptons,
]