MadGraphControl_Pythia8EvtGen_SMEFTNLO_ZZ.py 19.6 KB
Newer Older
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
from MadGraphControl.MadGraphUtils import *

from MadGraphControl.MadGraphUtils import *
from MadGraphControl import MadGraphUtils
MadGraphUtils.MADGRAPH_CATCH_ERRORS=False
import math


import os, shutil, copy
### get MC job-options filename
FIRST_DIR = (os.environ['JOBOPTSEARCHPATH']).split(":")[0]
jofiles = [f for f in os.listdir(FIRST_DIR) if (f.startswith('mc') and f.endswith('.py'))]

#---------------------------------------------------------------------------
# General Settings
#  need to provide the following in the top JO:
#    EFTorder: order of the calculation, 0 for SM only, 1 for EFT linear term, 2 for EFT quadratic term, 3 for all
#    EFTop: EFT parameter name
#    EFTval: value of the EFT parameter, 1 by default 
#    dogg:  loop-induced or not
#    doNLO: LO or NLO model
#---------------------------------------------------------------------------
mode=0 # 0: single core; 1: cluster; 2: multicore
cluster_type="condor"
cluster_queue=None
if mode!=1:
  cluster_type=None
  cluster_queue=None

gridpack_mode=False

## safe factor applied to nevents, to account for the filter efficiency
safefactor = 1.1
nevents = runArgs.maxEvents*safefactor if runArgs.maxEvents>0 else safefactor*evgenConfig.nEventsPerJob
nevents = int(nevents)

## EFT parameters
dim6_ops_LO = {
  'dim6'    : ['cpG'],
  'dim62f'  : ['ctp','cpt']
}

dim6_ops_NLO = {
  'dim6'    : ['cpG'],
  'dim62f'  : ['ctp','cpt']
}

# the block DIM64F2L not available for NLO, some parameters not available for NLO
if doNLO:
  dim6_ops=copy.deepcopy(dim6_ops_NLO)
else:
  dim6_ops=copy.deepcopy(dim6_ops_LO)

# check user defined EFT operator names
l_EFTop=[]
l_EFTval=[]
if EFTop:    
  if "," in EFTop:
    for op in EFTop.split(","): l_EFTop.append(op)
  else: l_EFTop.append(EFTop)

  for op in l_EFTop:
    op_found = 0
    for bl in dim6_ops.keys():
      for aop in dim6_ops[bl]:
        if aop.upper() == op.upper():
          op_found = 1
          break
    if not op_found:
      raise RuntimeError("EFT parameter %s not avaiable." % op)

if EFTval:    
  if "," in EFTval:
    for val in EFTval.split(","): l_EFTval.append(val)
  else: l_EFTval.append(EFTval)
else:
  # use default value 1
  for ie, op in enumerate(l_EFTop): l_EFTval.append(1)

#---------------------------------------------------------------------------
# Process
#---------------------------------------------------------------------------

# model with restrictions: SM, LO, NLO
model_name_SM = "SMEFTatNLO"
model_name_LO = model_name_SM+"-cpG_ctp_cpt"
model_name_NLO = model_name_SM+"-cpG_ctp_cpt"
model_name = model_name_SM
# production mode
prod_str = "p p"
if dogg:
  prod_str = "g g"
# lepton final states
decay_str = ""
if doZZ<=0:
  if do2l2v:
    decay_str = "l+ l- vl vl~ / l+ l- vl vl~ w+ w- g"
  else:
    decay_str = "l+ l- l+ l- / g"


if EFTorder==0: ## SM
  if doZZ==1: ## on-shell ZZ
    proc_str = "generate %s > z z QCD=2 QED=2 NP=0" % (prod_str)
  elif doZZ==2: ## HZZ
    proc_str = "generate p p > h > z z QCD=2 QED=2 NP=0"
  elif doZZ==3: ## no Higgs
    proc_str = "generate %s > z z / h QCD=2 QED=2 NP=0" % (prod_str)
  elif doZZ==-1: ## H4l
    proc_str = "generate %s > h > %s QCD=2 QED=4 NP=0" % (prod_str, decay_str)
  else:  ## off-shell ll
    proc_str = "generate %s > %s QCD=2 QED=4 NP=0" % (prod_str, decay_str)
else:
  if EFTorder==1: ## linear
    if doZZ==1: ## on-shell ZZ
      proc_str = "generate %s > z z QCD=2 QED=2 NP=2 NP^2==2" % (prod_str)
    elif doZZ==2: ## HZZ
      proc_str = "generate %s > h > z z QCD=2 QED=2 NP=2 NP^2==2" % (prod_str)
    elif doZZ==3: ## no Higgs
      proc_str = "generate %s > z z / h QCD=2 QED=2 NP=2 NP^2==2" % (prod_str)
    elif doZZ==-1: ## H4l
      proc_str = "generate %s > h > %s QCD=2 QED=4 NP=2 NP^2==2" % (prod_str, decay_str)
    else:
      proc_str = "generate %s > %s QCD=2 QED=4 NP=2 NP^2==2" % (prod_str, decay_str)
  elif EFTorder==2: ## quadratic
    if doZZ==1: ## on-shell ZZ
      proc_str = "generate %s > z z QCD=2 QED=2 NP=2 NP^2==4" % (prod_str)
    elif doZZ==2: ## HZZ
      proc_str = "generate %s > h > z z QCD=2 QED=2 NP=2 NP^2==4" % (prod_str)
    elif doZZ==3: ## no Higgs
      proc_str = "generate %s > z z / h QCD=2 QED=2 NP=2 NP^2==4" % (prod_str)
    elif doZZ==-1: ## H4l
      proc_str = "generate %s > h > %s QCD=2 QED=4 NP=2 NP^2==4" % (prod_str, decay_str)
    else:
      proc_str = "generate %s > %s QCD=2 QED=4 NP=2 NP^2==4" % (prod_str, decay_str)
  elif EFTorder==3: ## All
    if doZZ==1: ## on-shell ZZ
      proc_str = "generate %s > z z QCD=2 QED=2 NP=2" % (prod_str)
    elif doZZ==2: ## HZZ
      proc_str = "generate %s > h > z z QCD=2 QED=2 NP=2" % (prod_str)
    elif doZZ==3: ## no Higgs
      proc_str = "generate %s > z z / h QCD=2 QED=2 NP=2" % (prod_str)
    elif doZZ==-1: ## H4l
      proc_str = "generate %s > h > %s QCD=2 QED=4 NP=2" % (prod_str, decay_str)
    else:
      proc_str = "generate %s > %s QCD=2 QED=4 NP=2" % (prod_str, decay_str)

  if doNLO:
    model_name = model_name_NLO
  else:
    model_name = model_name_LO

# QCD order: None, "[QCD]", "[noborn=QCD]"
if QCDmode:
  proc_str += " "+QCDmode

# use model files locally, to fix cpG
#mgmodels='/cvmfs/atlas.cern.ch/repo/sw/Generators/madgraph/models/latest/'
mgmodels='/cvmfs/atlas.cern.ch/repo/sw/Generators/madgraph/models/latest'
model_name_LO_org = mgmodels+"/" + model_name_SM+"-cpG_ctp_cpt"
model_name_NLO_org = mgmodels+"/" + model_name_SM+"-cpG_ctp_cpt"
model_name_custom = mgmodels+"/"+model_name_SM+"-cpG_ctp_cpt"

restricted_model=model_name
model_path='/cvmfs/atlas.cern.ch/repo/sw/Generators/madgraph/models/latest'
if fixModel:
  ## copy model files to local
  model_name_def=model_name.split('-')[0]
  local_dir='mgmodels_local'
  if os.path.exists(local_dir):
    shutil.rmtree(local_dir)
  os.mkdir(local_dir)
  local_model=local_dir+'/'+model_name_def
  shutil.copytree(mgmodels+model_name_def,local_model)

  ## fix cpG
  tmp_cards=['restrict_LO.dat', 'restrict_NLO.dat']
  for tmp_card in tmp_cards:
    rst_card=local_model+'/'+tmp_card
    if os.access(rst_card,os.R_OK):
      rst_card_old = local_model+"/"+tmp_card.replace(".dat", "Full.dat")
      mglog.info('Modifying %s to turn off cpG' % tmp_card)
      os.rename(rst_card, rst_card_old)

      oldCard = open(rst_card_old, 'r')
      newCard = open(rst_card, 'w')
      for line in iter(oldCard):
        if "cpG" in line: line=line.replace('0.8e-04', '0.0e-04')
        newCard.write(line.strip()+'\n')
      oldCard.close()
      newCard.close()

  #model_path="./%s" % local_dir
  model_path="/cvmfs/atlas.cern.ch/repo/sw/Generators/madgraph/models/latest"
  restricted_model="%s/%s" % (model_path, model_name)
  ## update model names which might be used later for reweighting
  model_path=os.getcwd()+"/" + local_dir
  model_name_LO = model_path+"/" + model_name_SM+"-LO"
  model_name_NLO = model_path+"/" + model_name_SM+"-NLO"

  model_name_LO_org = model_path+"/" + model_name_SM+"-LOFull"
  model_name_NLO_org = model_path+"/" + model_name_SM+"-NLOFull"
  
  
  ## remove cpG
  if 'dim6' in dim6_ops and 'cpG' in dim6_ops['dim6']:
    dim6_ops['dim6'].remove('cpG')

restricted_model="%s/%s" % (model_path, model_name)

if not is_gen_from_gridpack():
    process = """
    set max_npoint_for_channel 4
    import model %s
    define p = g u c d s b u~ c~ d~ s~ b~
    define j = g u c d s b u~ c~ d~ s~ b~
    define l+ = e+ mu+
    define l- = e- mu-
    %s
    output -f
    """ % (restricted_model, proc_str)
    
    process_dir = new_process(process)
else:
    process_dir = MADGRAPH_GRIDPACK_LOCATION


beamEnergy=-999
if hasattr(runArgs,'ecmEnergy'):
  beamEnergy = runArgs.ecmEnergy / 2.
else: 
  raise RuntimeError("No center of mass energy found.")

#----------------------------------------------------------------------------
# Random Seed
#----------------------------------------------------------------------------
randomSeed = 0
if hasattr(runArgs,'randomSeed'): randomSeed = runArgs.randomSeed

#---------------------------------------------------------------------------
# Number of Events
#---------------------------------------------------------------------------
skip_events=0
if hasattr(runArgs,'skipEvents'): skip_events=runArgs.skipEvents

#---------------------------------------------------------------------------
# MG5 run Card
#---------------------------------------------------------------------------

extras = {
    'asrwgtflavor':"5",
    'lhe_version':"3.0",
    'ptj':"0",
    'ptb':"0",
    'pta':"0",
    'ptl':"3",
    'etaj':"-1",
    'etab':"-1",
    'etaa':"-1",
    'etal':"3.0",
    'drjj':"0",
    'mmll':"0",
    'draa':"0",
    'draj':"0",
    'use_syst':"False",
    'scalefact':'1.0',
    'drjl':"0",
    'dral':"0",
    'drll':"0.04",
    'maxjetflavor':"5" ,
    'cut_decays'  :'T',
    'auto_ptj_mjj': 'F',
    'nevents'     : nevents,
}
## m4l cut for 4l
if (doZZ==0 or doZZ==-1) and (not do2l2v):
  extras['mmnl'] = "130"
## settings for NLO
# call MadGraphUtils.is_NLO_run to make sure it's really an NLO run
if is_NLO_run(process_dir=process_dir):
  extras = {
    'lhe_version':"3.0",
    'parton_shower' :'PYTHIA8',
    'ptl':"3",
    'etal':"3.0",
    'ptj':"0",
    'etaj':"-1",
    'mll':"0",
    'mll_sf':"0",
    'drll':"0.04",
    'drll_sf':"0.04",
    'jetalgo':'-1',
    'jetradius' : '0.4',
    'maxjetflavor':"5" ,
    'nevents'     : nevents,
  }

modify_run_card(process_dir=process_dir,runArgs=runArgs,settings=extras)


# Set up batch jobs
if mode==1 and (not is_gen_from_gridpack()):
  modify_config_card(process_dir=process_dir,settings={'cluster_type':cluster_type,'cluster_queue':cluster_queue})
else:
  modify_config_card(process_dir=process_dir)


#---------------------------------------------------------------------------
# MG5 param Card
#---------------------------------------------------------------------------
if EFTorder>0: 
    # Set SMEFT@NLO parameters
    ## params is a dictionary of dictionaries (each dictionary is a separate block)
    params = dict() 
    
    # initial setting, disable all EFT parameters
    for bl in dim6_ops.keys():
      params[bl] = dict()
      for op in dim6_ops[bl]:
        params[bl][op] = '1.000000e-20'

    params['dim6']['Lambda'] = '1000.'
    # set the EFT operator under test
    for ie, op in enumerate(l_EFTop):
      val = l_EFTval[ie]
      for bl in dim6_ops.keys():
        if op in dim6_ops[bl]:
          params[bl][op] = val
    
    modify_param_card(process_dir=process_dir,params=params)


# Build reweight_card.dat
if doReweight:
  # Create reweighting card
  reweight_card_loc=process_dir+'/Cards/reweight_card.dat'
  rwcard = open(reweight_card_loc,'w')

  ## parameters to reweight
  # format is [ 'paramName1_paraValue1', ...] for 1D reweighting
  # or [ 'paramName1_paraValue1--paramName2_paraValue2', ...] for 2D reweighting, etc
  dict_para_rwt={}
  for rw_name in reweights:
    dict_para_rwt[rw_name]=[]
    for param in rw_name.split('--'):
      param_name, value = param.split('_')
      dict_para_rwt[rw_name].append([param_name, value])

  ## model
  curr_model_name=model_name ## keep track of the model used for the previous reweighting

  # !!! NLO model has to be used for interference (either tree*loop or loop*loop)
  dim6_ops=copy.deepcopy(dim6_ops_NLO)

  ## linear
  if doReweight==1 or doReweight==3:
    if doZZ==1: ## on-shell ZZ
      proc_str = "%s > z z QCD=2 QED=2 NP=2 NP^2==2" % (prod_str)
    elif doZZ==2: ## HZZ
      proc_str = "%s > h > z z QCD=2 QED=2 NP=2 NP^2==2" % (prod_str)
    elif doZZ==3: ## no Higgs
      proc_str = "%s > z z / h QCD=2 QED=2 NP=2 NP^2==2" % (prod_str)
    elif doZZ==-1: ## H4l
      proc_str = "%s > %s QCD=2 QED=4 NP=2 NP^2==2" % (prod_str, decay_str)
    else:
      proc_str = "%s > %s QCD=2 QED=4 NP=2 NP^2==2" % (prod_str, decay_str)
    ## launch reweighting
    for rw_name in dict_para_rwt.keys():
      # check if the reweighting parameter is included in the model or not
      skipop=1
      hasCPG=False ## special treatment for cpG (tree level)
      for param in dict_para_rwt[rw_name]:
        [param_name, value] = param
        if param_name.upper() == "CPG": hasCPG=True
        for bl in dim6_ops.keys():
          if param_name in dim6_ops[bl]:
            skipop=0
            break
      if skipop and (not hasCPG): continue 

      # change process
      ## cpG: tree*loop
      if hasCPG:
        # locally fixed model has cpG removed, need to use the original one
        # only update the model if it's different than the nominal one
        if curr_model_name != model_name_NLO_org: 

          curr_model_name=model_name_NLO_org

        rwcard.write("""
change process %s [virt=QCD]
""" % proc_str)

      ## others: loop*loop
      else:
        # use locally fixed model with cpG removed
        # only update the model if it's different than the nominal one
        if curr_model_name != model_name_NLO: 
          rwcard.write("""
change model %s
""" % model_name_NLO)
          curr_model_name=model_name_NLO

        rwcard.write("""
change process %s %s
""" % (proc_str, QCDmode))


      # launch reweighting
      rwcard.write("launch --rwgt_name=%s_lin\n" % rw_name)

      params = dict() 
      # initial setting, disable all EFT parameters
      for bl in dim6_ops.keys():
        params[bl] = dict()
        for op in dim6_ops[bl]:
          params[bl][op] = '1.000000e-20'
    
      params['dim6']['Lambda'] = '1000.'
      # set the EFT operator under test
      for param in dict_para_rwt[rw_name]:
        [param_name, value] = param
        for bl in dim6_ops.keys():
          if param_name in dim6_ops[bl] or (bl=="dim6" and param_name.upper() == "CPG"):
            params[bl][param_name] = value
    
      rwcard.write("set dim6 8 1.0\n")
      rwcard.write("set dim62f 15 1.0e-20\n")
      rwcard.write("set dim62f 19 1.0e-20")

  ## quadratic
  if doReweight==2 or doReweight==3:
    dim6_ops=copy.deepcopy(dim6_ops_NLO)

    if doZZ==1: ## on-shell ZZ
      proc_str = "%s > z z QCD=2 QED=2 NP=2 NP^2==4" % (prod_str)
    elif doZZ==2: ## HZZ
      proc_str = "%s > h > z z QCD=2 QED=2 NP=2 NP^2==4" % (prod_str)
    elif doZZ==3: ## no Higgs
      proc_str = "%s > z z / h QCD=2 QED=2 NP=2 NP^2==4" % (prod_str)
    elif doZZ==-1: ## H4l
      proc_str = "%s > h > %s QCD=2 QED=4 NP=2 NP^2==4" % (prod_str, decay_str)
    else:
      proc_str = "%s > %s QCD=2 QED=4 NP=2 NP^2==4" % (prod_str, decay_str)
    ## launch reweighting
    for rw_name in dict_para_rwt.keys():
      # check if the reweighting parameter is included in the model or not
      skipop=1
      hasCPG=False ## special treatment for cpG (tree level)
      hasCPGonly=True  ## for cpG*cXX (tree*loop)
      for param in dict_para_rwt[rw_name]:
        [param_name, value] = param
        if param_name.upper() == "CPG": hasCPG=True
        else: hasCPGonly=False
        for bl in dim6_ops.keys():
          if param_name in dim6_ops[bl]:
            skipop=0
            break
      if skipop and (not hasCPG): continue 

      # change process
      ## cpG: tree*tree
      if hasCPG and hasCPGonly:
        # TODO: this does not work, better to run it directly, not via reweighting
        continue
        # LO or NLO
        ## NLO
        if doNLO:
          rwcard.write("""
change mode NLO
""")
          # locally fixed model has cpG removed, need to use the original one
          # only update the model if it's different than the nominal one
          dim6_ops=copy.deepcopy(dim6_ops_NLO)
          if curr_model_name != model_name_NLO_org: 
            rwcard.write("""
change model %s
""" % model_name_NLO_org)
            curr_model_name=model_name_NLO_org
        
          # change the process accordingly for cpG*cpG at NLO
          if doZZ==1: ## on-shell ZZ
            tmp_proc_str = "p p > z z QCD=2 QED=2 NP=2 NP^2==4 [QCD]"
          elif doZZ==2: ## HZZ
            tmp_proc_str = "p p > h > z z QCD=2 QED=2 NP=2 NP^2==4 [QCD]"
          elif doZZ==3: ## no Higgs
            tmp_proc_str = "p p > z z / h QCD=2 QED=2 NP=2 NP^2==4 [QCD]"
          elif doZZ==-1: ## H4l
            tmp_proc_str = "g g > h > %s QCD=2 QED=4 NP=2 NP^2==4 [QCD]" % (decay_str)
          else:
            tmp_proc_str = "g g > %s QCD=2 QED=4 NP=2 NP^2==4 [QCD]" % (decay_str)
        
          rwcard.write("""
change process %s
""" % tmp_proc_str)

        ## LO
        else:
          dim6_ops=copy.deepcopy(dim6_ops_LO)
          if curr_model_name != model_name_LO_org:
            rwcard.write("""
change model %s
""" % model_name_LO_org)
            curr_model_name=model_name_LO_org
        
          rwcard.write("""
change process %s
""" % proc_str)

      ## cpG*cXX: tree*loop
      elif hasCPG:
        # NLO model has to be used here
        # locally fixed model has cpG removed, need to use the original one
        # only update the model if it's different than the nominal one
        dim6_ops=copy.deepcopy(dim6_ops_NLO)
        if curr_model_name != model_name_NLO_org: 
          rwcard.write("""
change model %s
""" % model_name_NLO_org)
          curr_model_name=model_name_NLO_org
      
        rwcard.write("""
change process %s [virt=QCD]
""" % (proc_str))

      ## others: loop*loop
      else:
        # NLO model has to be used here
        dim6_ops=copy.deepcopy(dim6_ops_NLO)
        if curr_model_name != model_name_NLO: 
          rwcard.write("""
change model %s
""" % model_name_NLO)
          curr_model_name=model_name_NLO
      
        rwcard.write("""
change process %s %s
""" % (proc_str, QCDmode))

      # launch reweighting
      rwcard.write("launch --rwgt_name=%s_quad\n" % rw_name)
    
      params = dict() 
      # initial setting, disable all EFT parameters
      for bl in dim6_ops.keys():
        params[bl] = dict()
        for op in dim6_ops[bl]:
          params[bl][op] = '1.000000e-20'
    
      params['dim6']['Lambda'] = '1000.'
      # set the EFT operator under test
      for param in dict_para_rwt[rw_name]:
        [param_name, value] = param
        for bl in dim6_ops.keys():
          if param_name in dim6_ops[bl] or (bl=="dim6" and param_name.upper() == "CPG"):
            params[bl][param_name] = value
    
      rwcard.write("set dim6 8 1.0\n") #cpG
      rwcard.write("set dim62f 15 1.0e-20\n") #cpt 
      rwcard.write("set dim62f 19 1.0") #ctp

  rwcard.close()

print_cards()

#---------------------------------------------------------------------------
# MG5 process (lhe) generation
#---------------------------------------------------------------------------

generate(process_dir=process_dir,runArgs=runArgs,grid_pack=gridpack_mode)

arrange_output(process_dir=process_dir,runArgs=runArgs,lhe_version=3,saveProcDir=True)

# Helper for resetting process number
check_reset_proc_number(opts)


#---------------------------------------------------------------------------
# Shower
#---------------------------------------------------------------------------

include("Pythia8_i/Pythia8_A14_NNPDF23LO_EvtGen_Common.py")
include("Pythia8_i/Pythia8_aMcAtNlo.py")

## Z boson decay
if doZZ:
  if do2l2v:
    genSeq.Pythia8.Commands += [ 
                             '23:onMode = off', #decay of Z
                             '23:mMin = 2.0',
                             '23:onIfAny = 11 13',
                             '23:onIfAny = 12 14 16' ]
  else:
    genSeq.Pythia8.Commands += [ 
                             '23:onMode = off', #decay of Z
                             '23:mMin = 2.0',
                             '23:onIfAny = 11 13',
                             '23:onIfAny = 11 13' ]

#--------------------------------------------------------------
# Evgen
#--------------------------------------------------------------
evgenConfig.generators = ["MadGraph", "Pythia8", "EvtGen"]
evgenConfig.description = "offshell ZZ with SMEFTNLO"
evgenConfig.keywords = ["SM","ZZ"]
evgenConfig.process = "p p > z z"
evgenConfig.contact = ["Lailin Xu <lailin.xu@cern.ch>, Jay Sandesara <jay.ajitbhai.sandesara@cern.ch>, Yingjie Wei <yingjie.wei@cern.ch>"]