11 import FWCore.ParameterSet.Config
as cms
12 import relval_common_module
as common
14 from math
import pi
as PI
20 mod_id=
"["+os.path.basename(sys._getframe().f_code.co_filename)[:-3]+
"]"
27 def generate(step, evt_type, energy, evtnumber):
29 This function calls all the other functions specific for
33 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
34 common.log( func_id+
" Entering... ")
39 if evt_type
in (
"MU+",
"MU-",
"E",
"DIE",
"GAMMA",
"TAU",
"PI0",
"PI+",
"PI-"):
40 generator = _generate_PGUN\
41 (step, evt_type, energy, evtnumber)
43 elif evt_type
in (
"HZZMUMUMUMU",
"HZZEEEE",
"HZZTTTT",
"HZZLLLL",
"HGG"):
44 generator = _generate_Higgs\
45 (step, evt_type, energy, evtnumber)
47 elif evt_type
in (
"B_JETS",
"C_JETS"):
48 generator = _generate_udscb_jets\
49 (step, evt_type, energy, evtnumber)
51 elif evt_type
in (
"QCD",
"TTBAR",
"ZPJJ",
"MINBIAS",
"RS1GG",
"HpT"):
52 generator = eval(
"_generate_"+evt_type+
"(step, evt_type, energy, evtnumber)")
54 elif evt_type
in (
"ZEE",
"ZTT",
"ZMUMU"):
55 generator = _generate_Zll\
56 (step, evt_type, energy, evtnumber)
58 elif evt_type
in (
"ZPEE",
"ZPTT",
"ZPMUMU"):
59 generator = _generate_ZPll\
60 (step, evt_type, energy, evtnumber)
62 elif evt_type
in (
"WE",
"WM",
"WT"):
63 generator =
_generate_Wl(step, evt_type, energy, evtnumber)
66 raise RuntimeError(
"Event type Type not yet implemented.")
68 common.log( func_id+
" Returning Generator")
76 Here the settings for the simple generation of a muon, electron or gamma
79 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
80 common.log( func_id+
" Entering... ")
83 py_id_dict = {
"MU-":13,
94 id_string = evt_type+
" "+energy+
" nevts "+
str(evtnumber)
98 if 'pt' in energy[0:2]
or \
99 'Pt' in energy[0:2]
or \
112 part_id = cms.untracked.vint32 ()
114 part_id.append(py_id_dict[evt_type])
117 if energy.find(
'_')!=-1:
121 lower_energy = str (
int(energy) - epsilon)
122 upper_energy = str (
int(energy) + epsilon)
125 if evt_type
in (
"TAU",
"E"):
127 part_id.append(-1*part_id[0])
134 common.log( func_id+
"This is a pt particle gun ..." )
135 generator = cms.EDProducer(
"FlatRandomPtGunProducer",
136 psethack = cms.string(id_string),
137 firstRun = cms.untracked.uint32(1),
138 PGunParameters = cms.PSet(
140 MinEta = cms.double(ETA_MAX),
141 MaxEta = cms.double(ETA_MIN),
142 MinPhi = cms.double(-PI),
143 MaxPhi = cms.double(PI),
144 MinPt = cms.double(lower_energy),
145 MaxPt = cms.double(upper_energy)
147 AddAntiParticle=cms.bool(antip_flag),
148 Verbosity = cms.untracked.int32(0)
151 common.log( func_id+
" This is an Energy particle gun ..." )
152 generator = cms.EDProducer(
"FlatRandomEGunProducer",
153 psethack = cms.string(id_string),
154 firstRun = cms.untracked.uint32(1),
155 PGunParameters = cms.PSet(
157 MinEta = cms.double(ETA_MAX),
158 MaxEta = cms.double(ETA_MIN),
159 MinPhi = cms.double(-PI),
160 MaxPhi = cms.double(PI),
161 MinE = cms.double(lower_energy),
162 MaxE = cms.double(upper_energy)
164 AddAntiParticle=cms.bool(antip_flag),
165 Verbosity = cms.untracked.int32(0)
168 common.log( func_id+
" Returning Generator...")
176 Here the settings for the generation of QCD events
178 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
179 common.log( func_id+
" Entering... ")
185 generator = cms.EDFilter(
"Pythia6GeneratorFilter",
186 pythiaPylistVerbosity=cms.untracked.int32(0),
187 pythiaHepMCVerbosity=cms.untracked.bool(
False),
188 maxEventsToPrint = cms.untracked.int32(0),
189 filterEfficiency = cms.untracked.double(1),
190 PythiaParameters = cms.PSet\
191 (parameterSets = cms.vstring\
193 "processParameters"),
195 processParameters = cms.vstring(
"MSEL=1",
196 "CKIN(3)="+upper_energy,
197 "CKIN(4)="+lower_energy))
200 common.log( func_id+
" Returning Generator...")
207 Settings for MINBIAS events generation
210 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
211 common.log( func_id+
" Entering... ")
214 generator = cms.EDFilter(
"Pythia6GeneratorFilter",
215 pythiaPylistVerbosity=cms.untracked.int32(0),
216 pythiaHepMCVerbosity=cms.untracked.bool(
False),
217 maxEventsToPrint = cms.untracked.int32(0),
218 filterEfficiency = cms.untracked.double(1),
219 PythiaParameters = cms.PSet\
220 (parameterSets = cms.vstring\
222 "processParameters"),
224 processParameters = cms.vstring(
237 common.log( func_id+
" Returning Generator...")
245 Here the settings for the generation of Higgs->ZZ->ll events
246 The energy parameter is not used. According to the evt_type ("HZZMUMUMUMU"
247 or "HZZEEEE") the final state is chosen.
249 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
250 common.log( func_id+
" Entering... ")
258 if evt_type ==
"HZZEEEE":
261 elif evt_type ==
"HZZMUMUMUMU":
264 elif evt_type ==
"HZZTTTT":
267 elif evt_type ==
"HZZLLLL":
268 electron_flag=muon_flag=tau_flag=
"1"
270 elif evt_type ==
"HGG":
275 params = cms.vstring(
276 "PMAS(25,1)=%s" %energy,
304 "MDME(182,1)=%s" %electron_flag,
306 "MDME(184,1)=%s" %muon_flag,
308 "MDME(186,1)=%s" %tau_flag,
323 "MDME(223,1)=%s" %gamma_flag,
325 "MDME(225,1)=%s" %z_flag,
330 generator = cms.EDFilter(
'Pythia6GeneratorFilter',
331 pythiaPylistVerbosity=cms.untracked.int32(0),
332 pythiaHepMCVerbosity=cms.untracked.bool(
False),
333 maxEventsToPrint = cms.untracked.int32(0),
334 filterEfficiency = cms.untracked.double(1),
335 pythiaVerbosity =cms.untracked.bool(
False),
336 PythiaParameters = cms.PSet\
337 (parameterSets = cms.vstring(
'PythiaUESettings',
'processParameters'),
339 processParameters=params
343 common.log( func_id+
" Returning Generator...")
350 (step, evt_type, energy, evtnumber):
352 Here the settings necessary to udscb jets generation are added. According
353 to the flavour the Pythia parameters are changed slightly.
354 For the time being the energy parameter is not used.
356 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
357 common.log( func_id+
" Entering... ")
363 pythia_jet_settings=cms.vstring(
"MSEL=0")
364 pythia_jet_settings+=cms.vstring(
"MSUB(81)=1",
366 if evt_type ==
"C_JETS":
367 pythia_jet_settings+=cms.vstring(
"MSTP(7)=4")
368 common.log( func_id+
" Including settings for c jets")
370 pythia_jet_settings+=cms.vstring(
"MSTP(7)=5")
371 common.log( func_id+
" Including settings for b jets")
374 pythia_common=cms.vstring(
"CKIN(3)="+upper_energy,
375 "CKIN(4)="+lower_energy,
382 pythia_jet_settings+=pythia_common
385 generator = cms.EDFilter(
'Pythia6GeneratorFilter',
386 pythiaVerbosity =cms.untracked.bool(
True),
387 PythiaParameters = cms.PSet\
388 (parameterSets = cms.vstring\
389 (
"pythiaUESettings",
"pythiaJets"),
391 pythiaJets = pythia_jet_settings
395 common.log(func_id+
" Returning Generator...")
403 Here the settings for the ttbar pairs are added to the process.
406 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
407 common.log(func_id+
" Entering... ")
410 generator = cms.EDFilter(
'Pythia6GeneratorFilter',
411 pythiaPylistVerbosity=cms.untracked.int32(0),
412 pythiaHepMCVerbosity=cms.untracked.bool(
False),
413 maxEventsToPrint = cms.untracked.int32(0),
414 filterEfficiency = cms.untracked.double(1),
415 PythiaParameters = cms.PSet\
416 (parameterSets = cms.vstring\
418 'processParameters'),
423 processParameters =cms.vstring\
433 common.log(func_id+
" Returning Generator...")
441 Here the settings for the Z ee simulation are added to the process.
442 Energy parameter is not used.
445 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
446 common.log( func_id+
" Entering... ")
449 user_param_sets =
"pythiaZll"
453 if evt_type ==
"ZEE":
455 elif evt_type ==
"ZMUMU":
457 elif evt_type ==
"ZTT":
460 electron_flag=muon_flag=tau_flag=
"1"
462 pythia_param_sets = cms.vstring(
470 "MDME( 182,1) = %s" %electron_flag,
472 "MDME( 184,1) = %s" %muon_flag,
474 "MDME( 186,1) = %s" %tau_flag,
497 generator = cms.EDFilter(
'Pythia6GeneratorFilter',
498 pythiaPylistVerbosity=cms.untracked.int32(0),
499 pythiaHepMCVerbosity=cms.untracked.bool(
False),
500 maxEventsToPrint = cms.untracked.int32(0),
501 filterEfficiency = cms.untracked.double(1),
502 PythiaParameters = cms.PSet\
503 (parameterSets = cms.vstring(
'PythiaUESettings',
'processParameters'),
505 processParameters=pythia_param_sets )
508 common.log(func_id+
" Returning Generator...")
515 Here the settings for the Z ee simulation are added to the process.
516 Energy parameter is not used.
519 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
520 common.log( func_id+
" Entering... ")
528 elif evt_type ==
"WM":
530 elif evt_type ==
"WT":
534 generator = cms.EDFilter(
'Pythia6GeneratorFilter',
535 pythiaPylistVerbosity=cms.untracked.int32(0),
536 pythiaHepMCVerbosity=cms.untracked.bool(
False),
537 maxEventsToPrint = cms.untracked.int32(0),
538 filterEfficiency = cms.untracked.double(1),
539 PythiaParameters = cms.PSet\
540 (parameterSets = cms.vstring(
'PythiaUESettings',
'processParameters'),
542 processParameters=cms.vstring(
'MSEL=0 !User defined processes',
554 'MDME(206,1) = %s' %electron_flag,
555 'MDME(207,1) = %s' %muon_flag,
556 'MDME(208,1) = %s' %tau_flag,
561 common.log(func_id+
" Returning Generator...")
569 Here the settings for the Zprime to JJ simulation are added to the
573 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
574 common.log(func_id+
" Entering... ")
575 common.log( func_id+
" Returning Generator...")
578 return common.include_files(
'Configuration/JetMET/data/calorimetry-gen-Zprime_Dijets_700.cff')[0].source
584 Here the settings for the Z ee simulation are added to the process.
585 Energy parameter is not used.
588 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
589 common.log( func_id+
" Entering... ")
595 if evt_type ==
"ZPEE":
597 elif evt_type ==
"ZPMUMU":
599 elif evt_type ==
"ZPTT":
602 electron_flag=muon_flag=tau_flag=
"1"
605 generator = cms.EDFilter(
'Pythia6GeneratorFilter',
606 pythiaPylistVerbosity=cms.untracked.int32(0),
607 pythiaHepMCVerbosity=cms.untracked.bool(
False),
608 maxEventsToPrint = cms.untracked.int32(0),
609 filterEfficiency = cms.untracked.double(1),
610 PythiaParameters = cms.PSet\
611 (parameterSets = cms.vstring(
'PythiaUESettings',
'processParameters'),
614 cms.vstring(
'MSEL = 0 ',
617 'PMAS(32,1) = %s' %energy,
627 'MDME(297,1)= %s ' %electron_flag,
629 'MDME(299,1)= %s ' %muon_flag,
631 'MDME(301,1)= %s ' %tau_flag,
645 common.log(func_id+
" Returning Generator...")
653 Here the settings for the RS1 graviton into gamma gamma.
656 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
657 common.log( func_id+
" Entering... ")
660 generator = cms.EDFilter(
'Pythia6GeneratorFilter',
661 pythiaPylistVerbosity=cms.untracked.int32(0),
662 pythiaHepMCVerbosity=cms.untracked.bool(
False),
663 maxEventsToPrint = cms.untracked.int32(0),
664 filterEfficiency = cms.untracked.double(1),
665 PythiaParameters = cms.PSet\
666 (parameterSets = cms.vstring(
'PythiaUESettings',
'processParameters'),
669 cms.vstring(
'MSEL=0 ',
672 'PMAS(347,1) = %s ' %energy,
702 common.log(func_id+
" Returning Generator...")
709 Here the settings for the RS1 graviton into gamma gamma.
712 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
713 common.log( func_id+
" Entering... ")
716 generator = cms.EDFilter(
"Pythia6GeneratorFilter",
717 pythiaPylistVerbosity = cms.untracked.int32(0),
718 pythiaHepMCVerbosity = cms.untracked.bool(
False),
719 maxEventsToPrint = cms.untracked.int32(0),
720 filterEfficiency = cms.untracked.double(1.0),
721 PythiaParameters = cms.PSet(\
722 parameterSets = cms.vstring(
'PythiaUESettings',
'processParameters',
'pythiaMSSMmhmax'),
724 processParameters=cms.vstring\
758 pythiaMSSMmhmax = cms.vstring\
779 common.log(func_id+
" Returning Generator...")
787 Extract from a string of the form "lowenergy*highenergy" two
788 bounds. It checks on its consistency. If the format is unknown
791 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
792 common.log( func_id+
" Entering... ")
794 separator_list = [
"-",
800 for separator
in separator_list:
801 if energy.count(separator)==1:
802 common.log( func_id+
" Found separator in energy string...")
803 low,high = energy.split(separator)
805 common.log(func_id+
" Returning Energy...")
808 raise RuntimeError(
"Energy Format: Unrecognised energy format.")
814 The function simply returns a cms.vstring which is a summary of the
815 Pythia settings for the event generation
820 func_id=mod_id+
"["+sys._getframe().f_code.co_name+
"]"
821 common.log(func_id+
" Returning PythiaUE settings...")
823 return common.include_files(
'Configuration/Generator/data/PythiaUESettings.cfi')[0].pythiaUESettings