forked from cbernet/fcc-ee-higgs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalysis_ee_ZH_nunubb_cfg.py
277 lines (235 loc) · 7.46 KB
/
analysis_ee_ZH_nunubb_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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
'''Example configuration file for an ee->ZH->mumubb analysis in heppy, with the FCC-ee
While studying this file, open it in ipython as well as in your editor to
get more information:
ipython
from analysis_ee_ZH_cfg import *
'''
import os
import sys
import copy
import heppy.framework.config as cfg
import logging
# next 2 lines necessary to deal with reimports from ipython
logging.shutdown()
reload(logging)
# global logging level for the heppy framework.
# in addition, all the analyzers declared below have their own logger,
# an each of them can be set to a different logging level.
logging.basicConfig(level=logging.WARNING)
# setting the random seed for reproducible results
import heppy.statistics.rrandom as random
# do not forget to comment out the following line if you want to produce and combine
# several samples of events
random.seed(0xdeadbeef)
# loading the FCC event data model library to decode
# the format of the events in the input file
# help(Events) for more information
from ROOT import gSystem
gSystem.Load("libdatamodelDict")
from EventStore import EventStore as Events
# setting the event printout
# help(Event) for more information
from heppy.framework.event import Event
# comment the following line to see all the collections stored in the event
# if collection is listed then print loop.event.papasevent will include the collections
Event.print_patterns=['zeds*', 'higgs*', 'jets*', 'bquarks', 'recoil*', 'collections']
# definition of the collider
# help(Collider) for more information
from heppy.configuration import Collider
Collider.BEAMS = 'ee'
Collider.SQRTS = 240.
jet_correction = True
mode = 'pythia/ee_to_ZH_Oct30'
nfiles = 1
from heppy.papas.detectors.CLIC import clic
from heppy.papas.detectors.CMS import cms
detector = clic
### definition of input samples
### from components.ZH_Znunu import components as cps
##from fcc_ee_higgs.components.all import load_components
##cps = load_components(mode='pythia')
from fcc_datasets.fcc_component import FCCComponent
zz = FCCComponent(
'pythia/ee_to_ZZ_Sep12_A_2',
splitFactor=1
)
zh = FCCComponent(
'pythia/ee_to_ZH_Oct30',
splitFactor=1
)
ffbar = FCCComponent(
'pythia/ee_to_ffbar_Sep12_B_4',
splitFactor=1
)
ww = FCCComponent(
'pythia/ee_to_WW_Dec6_large',
splitFactor=1
)
from fcc_ee_higgs.components.tools import get_components
selectedComponents = get_components(mode, [zh], nfiles)
# read FCC EDM events from the input root file(s)
# do help(Reader) for more information
from heppy.analyzers.fcc.Reader import Reader
source = cfg.Analyzer(
Reader,
gen_particles = 'GenParticle',
gen_vertices = 'GenVertex'
)
# gen bosons
from fcc_ee_higgs.analyzers.GenResonanceAnalyzer import GenResonanceAnalyzer
gen_bosons = cfg.Analyzer(
GenResonanceAnalyzer,
pdgids=[23, 25],
statuses=[62],
# decay_pdgids=[11, 13],
verbose=False
)
# importing the papas simulation and reconstruction sequence,
# as well as the detector used in papas
# check papas_cfg.py for more information
from heppy.test.papas_cfg import papas, pfreconstruct, papas_sequence
from heppy.test.papas_cfg import papasdisplaycompare as display
papas.detector = detector
display.detector = detector
pfreconstruct.detector = detector
sqrts = Collider.SQRTS
from heppy.analyzers.RecoilBuilder import RecoilBuilder
missing_energy = cfg.Analyzer(
RecoilBuilder,
instance_label = 'missing_energy',
output = 'missing_energy',
sqrts = sqrts,
to_remove = 'jets'
)
missing_energy_rescaled = cfg.Analyzer(
RecoilBuilder,
instance_label = 'missing_energy_rescaled',
output = 'missing_energy_rescaled',
sqrts = sqrts,
to_remove = 'jets_rescaled'
)
# Make jets from the particles not used to build the best zed.
# Here the event is forced into 2 jets to target ZH, H->b bbar)
# help(JetClusterizer) for more information
from heppy.analyzers.fcc.JetClusterizer import JetClusterizer
jets = cfg.Analyzer(
JetClusterizer,
output = 'jets',
particles = 'rec_particles',
fastjet_args = dict( njets = 2 ),
njets_required=False
)
if jet_correction:
from heppy.analyzers.JetEnergyCorrector import JetEnergyCorrector
jets_cor = cfg.Analyzer(
JetEnergyCorrector,
input_jets='jets',
detector=detector
)
jets = cfg.Sequence(jets, jets_cor)
from fcc_ee_higgs.analyzers.ZHnunubbJetRescaler import ZHnunubbJetRescaler
jet_rescaling = cfg.Analyzer(
ZHnunubbJetRescaler,
output='jets_rescaled',
jets='jets',
verbose=False
)
# b tagging
from heppy.test.btag_parametrized_cfg import btag_parametrized, btag
##from heppy.analyzers.roc import cms_roc
##btag.roc = None
##
##def is_bjet(jet):
## return jet.tags['b'] == 1
##bjets = cfg.Analyzer(
## Selector,
## 'bjets',
## output = 'bjets',
## input_objects = 'jets',
## filter_func = lambda jet: jet.tags['b'] == 1
##)
##
##onebjet = cfg.Analyzer(
## EventFilter ,
## 'onebjet',
## input_objects = 'bjets',
## min_number = 1,
## veto = False
##)
# Build Higgs candidates from pairs of jets.
from heppy.analyzers.ResonanceBuilder import ResonanceBuilder
higgses_rescaled = cfg.Analyzer(
ResonanceBuilder,
output = 'higgses_rescaled',
leg_collection = 'jets_rescaled',
pdgid = 25
)
higgses = cfg.Analyzer(
ResonanceBuilder,
output = 'higgses',
leg_collection = 'jets',
pdgid = 25
)
# Just a basic analysis-specific event Selection module.
# this module implements a cut-flow counter
# After running the example as
# heppy_loop.py Trash/ analysis_ee_ZH_cfg.py -f -N 100
# this counter can be found in:
# Trash/example/heppy.analyzers.examples.zh.selection.Selection_cuts/cut_flow.txt
# Counter cut_flow :
# All events 100 1.00 1.0000
# At least 2 leptons 87 0.87 0.8700
# Both leptons e>30 79 0.91 0.7900
# For more information, check the code of the Selection class
# in heppy/analyzers/examples/zh/selection.py
from heppy.analyzers.examples.zh.selection import Selection
selection = cfg.Analyzer(
Selection,
instance_label='cuts'
)
# Analysis-specific ntuple producer
# please have a look at the code of the ZHTreeProducer class,
# in heppy/analyzers/examples/zh/ZHTreeProducer.py
from fcc_ee_higgs.analyzers.ZHTreeProducer import ZHTreeProducer
tree = cfg.Analyzer(
ZHTreeProducer,
particles=[],
jet_collections = ['jets', 'jets_rescaled'],
resonances=['higgses', 'higgses_rescaled'],
misenergy = ['missing_energy', 'missing_energy_rescaled']
)
from heppy.analyzers.PDebugger import PDebugger
pdebug = cfg.Analyzer(
PDebugger,
output_to_stdout = False, #optional
debug_filename = os.getcwd()+'/python_physics_debug.log' #optional argument
)
# definition of a sequence of analyzers,
# the analyzers will process each event in this order
sequence = cfg.Sequence(
source,
gen_bosons,
papas_sequence,
jets,
missing_energy,
jet_rescaling,
btag_parametrized,
# bjets,
# onebjet,
missing_energy_rescaled,
higgses,
higgses_rescaled,
# selection,
tree,
# display
)
# Specifics to read FCC events
from ROOT import gSystem
gSystem.Load("libdatamodelDict")
from EventStore import EventStore as Events
config = cfg.Config(
components = selectedComponents,
sequence = sequence,
services = [],
events_class = Events
)