test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
relval_generation_module.py
Go to the documentation of this file.
1 ######################################################
2 # #
3 # relval_simulation_module #
4 # #
5 # This module is a collection of the simulation #
6 # procedues. The random number service is built #
7 # by the function random_generator_service(energy) #
8 # #
9 ######################################################
10 
11 import FWCore.ParameterSet.Config as cms
12 import relval_common_module as common
13 
14 from math import pi as PI
15 import os
16 import sys
17 
18 #---------------------------------------------------
19 # This just simplifies the use of the logger
20 mod_id="["+os.path.basename(sys._getframe().f_code.co_filename)[:-3]+"]"
21 
22 #----------------------------
23 # Some useful constants:
24 ETA_MAX=2.5
25 ETA_MIN=-2.5
26 
27 def generate(step, evt_type, energy, evtnumber):
28  """
29  This function calls all the other functions specific for
30  an event evt_type.
31  """
32 
33  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
34  common.log( func_id+" Entering... ")
35 
36  # Build the switch cases:
37 
38  # Particle Gun
39  if evt_type in ("MU+","MU-","E","DIE","GAMMA","TAU","PI0","PI+","PI-"):
40  generator = _generate_PGUN\
41  (step, evt_type, energy, evtnumber)
42 
43  elif evt_type in ("HZZMUMUMUMU", "HZZEEEE", "HZZTTTT", "HZZLLLL","HGG"):
44  generator = _generate_Higgs\
45  (step, evt_type, energy, evtnumber)
46 
47  elif evt_type in ("B_JETS", "C_JETS"):
48  generator = _generate_udscb_jets\
49  (step, evt_type, energy, evtnumber)
50 
51  elif evt_type in ("QCD","TTBAR","ZPJJ","MINBIAS","RS1GG","HpT"):
52  generator = eval("_generate_"+evt_type+"(step, evt_type, energy, evtnumber)")
53 
54  elif evt_type in ("ZEE","ZTT","ZMUMU"):
55  generator = _generate_Zll\
56  (step, evt_type, energy, evtnumber)
57 
58  elif evt_type in ("ZPEE","ZPTT","ZPMUMU"):
59  generator = _generate_ZPll\
60  (step, evt_type, energy, evtnumber)
61 
62  elif evt_type in ("WE","WM","WT"):
63  generator = _generate_Wl(step, evt_type, energy, evtnumber)
64 
65  else:
66  raise "Event type","Type not yet implemented."
67 
68  common.log( func_id+" Returning Generator")
69 
70  return generator
71 
72 #------------------------------
73 
74 def _generate_PGUN(step, evt_type, energy, evtnumber):
75  """
76  Here the settings for the simple generation of a muon, electron or gamma
77  are stated.
78  """
79  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
80  common.log( func_id+" Entering... ")
81 
82  # pythia ID: configure the ID of the particle through a dictionary
83  py_id_dict = {"MU-":13,
84  "MU+":-13,
85  "E" :11,
86  "DIE":11,
87  "TAU":15,
88  "GAMMA":22,
89  "PI+":211,
90  "PI-":-211,
91  "PI0":111}
92 
93  # Build the id string of the event name:
94  id_string = evt_type+" "+energy+" nevts "+ str(evtnumber)
95 
96  # We have to check if we want to generate a particle with pt=X or Energy=X
97  pt_flag=True
98  if 'pt' in energy[0:2] or \
99  'Pt' in energy[0:2] or \
100  'PT' in energy[0:2]:
101  energy=energy[2:]
102  else:
103  pt_flag=False
104 
105  # Energy boundaries are now set:
106  lower_energy = ""
107  upper_energy = ""
108 
109 
110 
111  # Build the partID string
112  part_id = cms.untracked.vint32 ()
113 
114  part_id.append(py_id_dict[evt_type])
115  upper_energy=''
116  lower_energy=''
117  if energy.find('_')!=-1:
118  upper_energy,lower_energy=energy_split(energy)
119  else:
120  epsilon= 0.001
121  lower_energy = str ( int(energy) - epsilon) # We want a calculation and
122  upper_energy = str ( int(energy) + epsilon) # the result as a string
123 
124  # Build the process source
125  if evt_type in ("TAU","E"):
126  # Add the corresponding opposite sign particle. Only for taus and es.
127  part_id.append(-1*part_id[0])
128 
129  antip_flag=False
130  if evt_type=="DIE":
131  antip_flag=True
132 
133  if pt_flag:
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(
139  PartID = part_id,
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)
146  ),
147  AddAntiParticle=cms.bool(antip_flag),
148  Verbosity = cms.untracked.int32(0)
149  )
150  else:
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(
156  PartID = part_id,
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)
163  ),
164  AddAntiParticle=cms.bool(antip_flag),
165  Verbosity = cms.untracked.int32(0)
166  )
167 
168  common.log( func_id+" Returning Generator...")
169 
170  return generator
171 
172 #---------------------------
173 
174 def _generate_QCD(step, evt_type, energy, evtnumber):
175  """
176  Here the settings for the generation of QCD events
177  """
178  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
179  common.log( func_id+" Entering... ")
180 
181  # Recover the energies from the string:
182  upper_energy, lower_energy = energy_split(energy)
183 
184  # Build the process source
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\
192  ("pythiaUESettings",
193  "processParameters"),
194  pythiaUESettings = user_pythia_ue_settings(),
195  processParameters = cms.vstring("MSEL=1",
196  "CKIN(3)="+upper_energy,
197  "CKIN(4)="+lower_energy))
198  )
199 
200  common.log( func_id+" Returning Generator...")
201  return generator
202 
203 #---------------------------------
204 
205 def _generate_MINBIAS(step, evt_type, energy, evtnumber):
206  """
207  Settings for MINBIAS events generation
208  """
209 
210  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
211  common.log( func_id+" Entering... ")
212 
213  # Build the process source
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\
221  ("pythiaUESettings",
222  "processParameters"),
223  pythiaUESettings = user_pythia_ue_settings(),
224  processParameters = cms.vstring(
225  "MSEL=0",
226  "MSUB(11)=1",
227  "MSUB(12)=1",
228  "MSUB(13)=1",
229  "MSUB(28)=1",
230  "MSUB(53)=1",
231  "MSUB(68)=1",
232  "MSUB(92)=1",
233  "MSUB(93)=1",
234  "MSUB(94)=1",
235  "MSUB(95)=1"))
236  )
237  common.log( func_id+" Returning Generator...")
238 
239  return generator
240 
241 #---------------------------------
242 
243 def _generate_Higgs(step, evt_type, energy, evtnumber):
244  """
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.
248  """
249  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
250  common.log( func_id+" Entering... ")
251 
252  # Choose between muon, tau or electron decay of the Z
253  z_flag="0"
254  electron_flag = "0"
255  muon_flag = "0"
256  tau_flag = "0"
257  gamma_flag="0"
258  if evt_type == "HZZEEEE":
259  electron_flag = "1"
260  z_flag="1"
261  elif evt_type == "HZZMUMUMUMU":
262  muon_flag = "1"
263  z_flag="1"
264  elif evt_type == "HZZTTTT":
265  tau_flag = "1"
266  z_flag="1"
267  elif evt_type == "HZZLLLL":
268  electron_flag=muon_flag=tau_flag= "1"
269  z_flag="1"
270  elif evt_type == "HGG":
271  gamma_flag="1"
272 
273 
274  # Prepare The Pythia params
275  params = cms.vstring(
276  "PMAS(25,1)=%s" %energy, #mass of Higgs",
277  "MSEL=0",
278  #(D=1) to select between full user control
279  #(0, then use MSUB) and some preprogrammed alternative: QCD hight pT
280  #processes (1, then ISUB=11, 12, 13, 28, 53, 68), QCD low pT processes
281  #(2, then ISUB=11, #12, 13, 28, 53, 68, 91, 92, 94, 95)",
282  #
283  #Check on possible errors during program
284  #execution",
285  "MSUB(102)=1", #ggH",
286  "MSUB(123)=1", #ZZ fusion to H",
287  "MSUB(124)=1", #WW fusion to H",
288  "CKIN(45)=5.",
289  "CKIN(46)=150.",
290  #high mass cut on secondary resonance m1 in
291  #2->1->2 process Registered by Alexandre.Nikitenko@cern.ch",
292  "CKIN(47)=5.",
293  #low mass cut on secondary resonance m2 in
294  #2->1->2 process Registered by Alexandre.Nikitenko@cern.ch",
295  "CKIN(48)=150.",
296  #high mass cut on secondary resonance m2 in
297  #2->1->2 process Registered by Alexandre.Nikitenko@cern.ch",
298  "MDME(174,1)=0", #Z decay into d dbar",
299  "MDME(175,1)=0", #Z decay into u ubar",
300  "MDME(176,1)=0", #Z decay into s sbar",
301  "MDME(177,1)=0", #Z decay into c cbar",
302  "MDME(178,1)=0", #Z decay into b bbar",
303  "MDME(179,1)=0", #Z decay into t tbar",
304  "MDME(182,1)=%s" %electron_flag,#Z decay into e- e+",
305  "MDME(183,1)=0", #Z decay into nu_e nu_ebar",
306  "MDME(184,1)=%s" %muon_flag,#Z decay into mu- mu+",
307  "MDME(185,1)=0", #Z decay into nu_mu nu_mubar",
308  "MDME(186,1)=%s" %tau_flag,#Z decay into tau- tau+",
309  "MDME(187,1)=0", #Z decay into nu_tau nu_taubar",
310  "MDME(210,1)=0", #Higgs decay into dd",
311  "MDME(211,1)=0", #Higgs decay into uu",
312  "MDME(212,1)=0", #Higgs decay into ss",
313  "MDME(213,1)=0", #Higgs decay into cc",
314  "MDME(214,1)=0", #Higgs decay into bb",
315  "MDME(215,1)=0", #Higgs decay into tt",
316  "MDME(216,1)=0", #Higgs decay into",
317  "MDME(217,1)=0", #Higgs decay into Higgs decay",
318  "MDME(218,1)=0", #Higgs decay into e nu e",
319  "MDME(219,1)=0", #Higgs decay into mu nu mu",
320  "MDME(220,1)=0", #Higgs decay into tau nu tau",
321  "MDME(221,1)=0", #Higgs decay into Higgs decay",
322  "MDME(222,1)=0", #Higgs decay into g g",
323  "MDME(223,1)=%s" %gamma_flag,#Higgs decay into gam gam",
324  "MDME(224,1)=0", #Higgs decay into gam Z",
325  "MDME(225,1)=%s" %z_flag, #Higgs decay into Z Z",
326  "MDME(226,1)=0", #Higgs decay into W W"
327  )
328 
329  # Build the process source
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'),
338  PythiaUESettings = user_pythia_ue_settings(),
339  processParameters=params
340  )
341  )
342 
343  common.log( func_id+" Returning Generator...")
344 
345  return generator
346 
347 #---------------------------------
348 
350  (step, evt_type, energy, evtnumber):
351  """
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.
355  """
356  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
357  common.log( func_id+" Entering... ")
358 
359  # Recover the energies from the string:
360  upper_energy, lower_energy = energy_split(energy)
361 
362  # According to the evt_type build the Pythia settings:
363  pythia_jet_settings=cms.vstring("MSEL=0") # User defined process
364  pythia_jet_settings+=cms.vstring("MSUB(81)=1", #qq->QQ massive
365  "MSUB(82)=1") #gg->QQ massive
366  if evt_type == "C_JETS":
367  pythia_jet_settings+=cms.vstring("MSTP(7)=4") #ccbar
368  common.log( func_id+" Including settings for c jets")
369  else:
370  pythia_jet_settings+=cms.vstring("MSTP(7)=5") #bbbar
371  common.log( func_id+" Including settings for b jets")
372 
373  # Common part to all cases
374  pythia_common=cms.vstring("CKIN(3)="+upper_energy, # Pt low cut
375  "CKIN(4)="+lower_energy, # Pt high cut
376  "CKIN(13)=0.", # eta min
377  "CKIN(14)=2.5", # etamax
378  "CKIN(15)=-2.5", # -etamin
379  "CKIN(16)=0" # -etamax
380  )
381 
382  pythia_jet_settings+=pythia_common
383 
384  # Build the process source
385  generator = cms.EDFilter('Pythia6GeneratorFilter',
386  pythiaVerbosity =cms.untracked.bool(True),
387  PythiaParameters = cms.PSet\
388  (parameterSets = cms.vstring\
389  ("pythiaUESettings","pythiaJets"),
390  pythiaUESettings = user_pythia_ue_settings(),
391  pythiaJets = pythia_jet_settings
392  )
393  )
394 
395  common.log(func_id+" Returning Generator...")
396 
397  return generator
398 
399 #-----------------------------------
400 
401 def _generate_TTBAR(step, evt_type, energy, evtnumber):
402  """
403  Here the settings for the ttbar pairs are added to the process.
404  """
405 
406  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
407  common.log(func_id+" Entering... ")
408 
409  # Build the process source
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\
417  ('pythiaUESettings',
418  'processParameters'),
419  pythiaUESettings = user_pythia_ue_settings(),
420  # Tau jets (config by A. Nikitenko)
421  # No tau -> electron
422  # No tau -> muon
423  processParameters =cms.vstring\
424  ("MSEL=0", # userdef process
425  "MSUB(81)=1", # qqbar->QQbar
426  "MSUB(82)=1", # gg to QQbar
427  "MSTP(7)=6", # flavour top
428  "PMAS(6,1)=175" # top mass
429  )
430  )
431  )
432 
433  common.log(func_id+" Returning Generator...")
434 
435  return generator
436 
437 #---------------------------------
438 
439 def _generate_Zll(step, evt_type, energy, evtnumber):
440  """
441  Here the settings for the Z ee simulation are added to the process.
442  Energy parameter is not used.
443  """
444 
445  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
446  common.log( func_id+" Entering... ")
447 
448  # Choose between muon or electron decay of the Z
449  user_param_sets = "pythiaZll"
450  electron_flag = "0"
451  muon_flag = "0"
452  tau_flag = "0"
453  if evt_type == "ZEE":
454  electron_flag = "1"
455  elif evt_type == "ZMUMU":
456  muon_flag = "1"
457  elif evt_type == "ZTT":
458  tau_flag = "1"
459  else:
460  electron_flag=muon_flag=tau_flag= "1"
461 
462  pythia_param_sets = cms.vstring(
463  "MSEL = 11 ",
464  "MDME( 174,1) = 0", #Z decay into d dbar",
465  "MDME( 175,1) = 0", #Z decay into u ubar",
466  "MDME( 176,1) = 0", #Z decay into s sbar",
467  "MDME( 177,1) = 0", #Z decay into c cbar",
468  "MDME( 178,1) = 0", #Z decay into b bbar",
469  "MDME( 179,1) = 0", #Z decay into t tbar",
470  "MDME( 182,1) = %s" %electron_flag,#Z decay into e- e+",
471  "MDME( 183,1) = 0", #Z decay into nu_e nu_ebar",
472  "MDME( 184,1) = %s" %muon_flag,#Z decay into mu- mu+",
473  "MDME( 185,1) = 0", #Z decay into nu_mu nu_mubar",
474  "MDME( 186,1) = %s" %tau_flag, #Z decay into tau- tau+",
475  "MDME( 187,1) = 0", #Z decay into nu_tau nu_taubar",
476  "MSTJ( 11) = 3", #Choice of the fragmentation function",
477  "MSTP( 2) = 1", #which order running alphaS",
478  "MSTP( 33) = 0", #(D=0) ",
479  "MSTP( 51) = 7", #structure function chosen",
480  "MSTP( 81) = 1", #multiple parton interactions 1 is
481  #Pythia default,
482  "MSTP( 82) = 4", #Defines the multi-parton model",
483  "PARJ( 71) = 10.", #for which ctau 10 mm",
484  "PARP( 82) = 1.9", #pt cutoff for multiparton interactions",
485  "PARP( 89) = 1000.", #sqrts for which PARP82 is set",
486  "PARP( 83) = 0.5", #Multiple interactions: matter distrbn
487  #parameter Registered byChris.Seez@cern.ch
488  "PARP( 84) = 0.4", #Multiple interactions: matterdistribution
489  #parameter Registered by Chris.Seez@cern.ch
490  "PARP( 90) = 0.16", #Multiple interactions:rescaling power
491  #Registered by Chris.Seez@cern.ch
492  "CKIN( 1) = 40.", #(D=2. GeV)
493  "CKIN( 2) = -1.", #(D=-1. GeV) \
494  )
495 
496  # Build the process source
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'),
504  PythiaUESettings=user_pythia_ue_settings(),
505  processParameters=pythia_param_sets )
506  )
507 
508  common.log(func_id+" Returning Generator...")
509 
510  return generator
511 #---------------------------------
512 
513 def _generate_Wl(step, evt_type, energy, evtnumber):
514  """
515  Here the settings for the Z ee simulation are added to the process.
516  Energy parameter is not used.
517  """
518 
519  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
520  common.log( func_id+" Entering... ")
521 
522  # Choose between muon or electron decay of the Z
523  electron_flag = "0"
524  muon_flag = "0"
525  tau_flag = "0"
526  if evt_type == "WE":
527  electron_flag = "1"
528  elif evt_type == "WM":
529  muon_flag = "1"
530  elif evt_type == "WT":
531  tau_flag = "1"
532 
533  # Build the process source
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'),
541  PythiaUESettings=user_pythia_ue_settings(),
542  processParameters=cms.vstring('MSEL=0 !User defined processes',
543  'MSUB(2) = 1',# !W production
544  'MDME(190,1) = 0',# !W decay into dbar u
545  'MDME(191,1) = 0',# !W decay into dbar c
546  'MDME(192,1) = 0',# !W decay into dbar t
547  'MDME(194,1) = 0',# !W decay into sbar u
548  'MDME(195,1) = 0',# !W decay into sbar c
549  'MDME(196,1) = 0',# !W decay into sbar t
550  'MDME(198,1) = 0',# !W decay into bbar u
551  'MDME(199,1) = 0',# !W decay into bbar c
552  'MDME(200,1) = 0',# !W decay into bbar t
553  'MDME(205,1) = 0',# !W decay into bbar tp
554  'MDME(206,1) = %s' %electron_flag,# !W decay into e+ nu_e
555  'MDME(207,1) = %s' %muon_flag,# !W decay into mu+ nu_mu
556  'MDME(208,1) = %s' %tau_flag,# !W decay into tau+ nu_tau
557  )
558  )
559  )
560 
561  common.log(func_id+" Returning Generator...")
562 
563  return generator
564 
565 #---------------------------------
566 
567 def _generate_ZPJJ(step, evt_type, energy, evtnumber):
568  """
569  Here the settings for the Zprime to JJ simulation are added to the
570  process.
571  """
572 
573  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
574  common.log(func_id+" Entering... ")
575  common.log( func_id+" Returning Generator...")
576  # You might wonder why this time it's not pythonised..Me too: due to the excessive fragmentation of the
577  # cfgs it's not worth to do that at the moment. It also obliges to have two functions for the ZP instead of one.
578  return common.include_files('Configuration/JetMET/data/calorimetry-gen-Zprime_Dijets_700.cff')[0].source
579 
580 #---------------------------------
581 
582 def _generate_ZPll(step, evt_type, energy, evtnumber):
583  """
584  Here the settings for the Z ee simulation are added to the process.
585  Energy parameter is not used.
586  """
587 
588  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
589  common.log( func_id+" Entering... ")
590 
591  # Choose between muon or electron decay of the Z
592  electron_flag = "0"
593  muon_flag = "0"
594  tau_flag = "0"
595  if evt_type == "ZPEE":
596  electron_flag = "1"
597  elif evt_type == "ZPMUMU":
598  muon_flag = "1"
599  elif evt_type == "ZPTT":
600  tau_flag = "1"
601  else:
602  electron_flag=muon_flag=tau_flag= "1"
603 
604  # Build the process source
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'),
612  PythiaUESettings=user_pythia_ue_settings(),
613  processParameters=\
614  cms.vstring('MSEL = 0 ',
615  'MSUB(141) = 1 ',# !ff gamma z0 Z0',
616  'MSTP(44) = 3 ',# !only select the Z process',
617  'PMAS(32,1) = %s' %energy,# !mass of Zprime',
618  'CKIN(1) = 400 ',# !(D=2. GeV)',
619  'MDME(289,1)= 0 ',# !d dbar',
620  'MDME(290,1)= 0 ',# !u ubar',
621  'MDME(291,1)= 0 ',# !s sbar',
622  'MDME(292,1)= 0 ',# !c cbar',
623  'MDME(293,1)= 0 ',# !b bar',
624  'MDME(294,1)= 0 ',# !t tbar',
625  'MDME(295,1)= 0 ',# !4th gen Q Qbar',
626  'MDME(296,1)= 0 ',# !4th gen Q Qbar',
627  'MDME(297,1)= %s ' %electron_flag,# !e e',
628  'MDME(298,1)= 0 ',# !neutrino e e',
629  'MDME(299,1)= %s ' %muon_flag,# ! mu mu',
630  'MDME(300,1)= 0 ',# !neutrino mu mu',
631  'MDME(301,1)= %s ' %tau_flag,# !tau tau',
632  'MDME(302,1)= 0 ',# !neutrino tau tau',
633  'MDME(303,1)= 0 ',# !4th generation lepton',
634  'MDME(304,1)= 0 ',# !4th generation neutrino',
635  'MDME(305,1)= 0 ',# !W W',
636  'MDME(306,1)= 0 ',# !H charged higgs',
637  'MDME(307,1)= 0 ',# !Z',
638  'MDME(308,1)= 0 ',# !Z',
639  'MDME(309,1)= 0 ',# !sm higgs',
640  'MDME(310,1)= 0 ' # !weird neutral higgs HA')
641  )
642  )
643  )
644 
645  common.log(func_id+" Returning Generator...")
646 
647  return generator
648 
649 #-----------------------------------
650 
651 def _generate_RS1GG(step, evt_type, energy, evtnumber):
652  """
653  Here the settings for the RS1 graviton into gamma gamma.
654  """
655 
656  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
657  common.log( func_id+" Entering... ")
658 
659  # Build the process source
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'),
667  PythiaUESettings=user_pythia_ue_settings(),
668  processParameters=\
669  cms.vstring('MSEL=0 ',
670  'MSUB(391) =1 ',
671  'MSUB(392) =1 ',
672  'PMAS(347,1) = %s ' %energy,# ! minv ',
673  'PARP(50) = 0.54 ',# ! 0.54 == c=0.1',
674  'MDME(4158,1)=0 ',
675  'MDME(4159,1)=0 ',
676  'MDME(4160,1)=0 ',
677  'MDME(4161,1)=0 ',
678  'MDME(4162,1)=0 ',
679  'MDME(4163,1)=0 ',
680  'MDME(4164,1)=0 ',
681  'MDME(4165,1)=0 ',
682  'MDME(4166,1)=0 ',
683  'MDME(4167,1)=0 ',
684  'MDME(4168,1)=0 ',
685  'MDME(4169,1)=0 ',
686  'MDME(4170,1)=0 ',
687  'MDME(4170,1)=0 ',
688  'MDME(4171,1)=0 ',
689  'MDME(4172,1)=0 ',
690  'MDME(4173,1)=0 ',
691  'MDME(4174,1)=0 ',
692  'MDME(4175,1)=1 ',#! gamma gamma ',
693  'MDME(4176,1)=0 ',
694  'MDME(4177,1)=0 ',
695  'MDME(4178,1)=0 ',
696  'CKIN(3)=20. ',#! minimum pt hat for hard interactions',
697  'CKIN(4)=-1. '#! maximum pt hat for hard interactions'
698  )
699  )
700  )
701 
702  common.log(func_id+" Returning Generator...")
703 
704  return generator
705 #-----------------------------------
706 
707 def _generate_HpT(step, evt_type, energy, evtnumber):
708  """
709  Here the settings for the RS1 graviton into gamma gamma.
710  """
711 
712  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
713  common.log( func_id+" Entering... ")
714 
715  # Build the process source
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'),
723  PythiaUESettings=user_pythia_ue_settings(),
724  processParameters=cms.vstring\
725  ('MSEL = 0 ',# ! user control',
726  'MSUB(401) = 1 ',# ! gg->tbH+ Registered by Alexandre.Nikitenko@cern.ch',
727  'MSUB(402) = 1 ',# ! qq->tbH+ Registered by Alexandre.Nikitenko@cern.ch',
728  'IMSS(1)= 1 ',# ! MSSM ', 'RMSS(5) = 30. ! TANBETA',
729  'RMSS(19) = 200.',# ! (D=850.) m_A',
730  'MDME(503,1)=0 ',# !Higgs(H+) decay into dbar u',
731  'MDME(504,1)=0 ',# !Higgs(H+) decay into sbar c',
732  'MDME(505,1)=0 ',# !Higgs(H+) decay into bbar t',
733  'MDME(506,1)=0 ',# !Higgs(H+) decay into b bar t',
734  'MDME(507,1)=0 ',# !Higgs(H+) decay into e+ nu_e',
735  'MDME(508,1)=0 ',# !Higgs(H+) decay into mu+ nu_mu',
736  'MDME(509,1)=1 ',# !Higgs(H+) decay into tau+ nu_tau',
737  'MDME(510,1)=0 ',# !Higgs(H+) decay into tau prime+ nu_tau',
738  'MDME(511,1)=0 ',# !Higgs(H+) decay into W+ h0',
739  'MDME(512,1)=0 ',# !Higgs(H+) decay into ~chi_10 ~chi_1+',
740  'MDME(513,1)=0 ',# !Higgs(H+) decay into ~chi_10 ~chi_2+',
741  'MDME(514,1)=0 ',# !Higgs(H+) decay into ~chi_20 ~chi_1+',
742  'MDME(515,1)=0 ',# !Higgs(H+) decay into ~chi_20 ~chi_2+',
743  'MDME(516,1)=0 ',# !Higgs(H+) decay into ~chi_30 ~chi_1+',
744  'MDME(517,1)=0 ',# !Higgs(H+) decay into ~chi_30 ~chi_2+',
745  'MDME(518,1)=0 ',# !Higgs(H+) decay into ~chi_40 ~chi_1+',
746  'MDME(519,1)=0 ',# !Higgs(H+) decay into ~chi_40 ~chi_2+',
747  'MDME(520,1)=0 ',# !Higgs(H+) decay into ~t_1 ~b_1bar',
748  'MDME(521,1)=0 ',# !Higgs(H+) decay into ~t_2 ~b_1bar',
749  'MDME(522,1)=0 ',# !Higgs(H+) decay into ~t_1 ~b_2bar',
750  'MDME(523,1)=0 ',# !Higgs(H+) decay into ~t_2 ~b_2bar',
751  'MDME(524,1)=0 ',# !Higgs(H+) decay into ~d_Lbar ~u_L',
752  'MDME(525,1)=0 ',# !Higgs(H+) decay into ~s_Lbar ~c_L',
753  'MDME(526,1)=0 ',# !Higgs(H+) decay into ~e_L+ ~nu_eL',
754  'MDME(527,1)=0 ',# !Higgs(H+) decay into ~mu_L+ ~nu_muL',
755  'MDME(528,1)=0 ',# !Higgs(H+) decay into ~tau_1+ ~nu_tauL',
756  'MDME(529,1)=0 '# !Higgs(H+) decay into ~tau_2+ ~nu_tauL'),
757  ),
758  pythiaMSSMmhmax = cms.vstring\
759  ('RMSS(2)= 200. ',# ! SU(2) gaugino mass ',
760  'RMSS(3)= 800. ',# ! SU(3) (gluino) mass ',
761  'RMSS(4)= 200. ',# ! higgsino mass parameter',
762  'RMSS(6)= 1000. ',# ! left slepton mass',
763  'RMSS(7)= 1000. ',# ! right slepton mass',
764  'RMSS(8)= 1000. ',# ! right slepton mass',
765  'RMSS(9)= 1000. ',# ! right squark mass',
766  'RMSS(10)= 1000. ',# ! left sq mass for 3th gen/heaviest stop mass',
767  'RMSS(11)= 1000. ',# ! right sbottom mass/lightest sbotoom mass',
768  'RMSS(12)= 1000. ',# ! right stop mass/lightest stop mass',
769  'RMSS(13)= 1000. ',# ! left stau mass',
770  'RMSS(14)= 1000. ',# ! right stau mass',
771  'RMSS(15)= 2449. ',# ! Ab',
772  'RMSS(16)= 2449. ',# ! At',
773  'RMSS(17)= 2449. '# ! Atau'
774  )
775  )
776  )
777 
778 
779  common.log(func_id+" Returning Generator...")
780 
781  return generator
782 
783 #---------------------------------
784 
785 def energy_split(energy):
786  """
787  Extract from a string of the form "lowenergy*highenergy" two
788  bounds. It checks on its consistency. If the format is unknown
789  the program stops.
790  """
791  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
792  common.log( func_id+" Entering... ")
793 
794  separator_list = ["-", #fault tolerance is good
795  "_",
796  "*",
797  "/",
798  ";",
799  ","]
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)
804  if float(high) > float(low):
805  common.log(func_id+" Returning Energy...")
806  return (low,high)
807 
808  raise "Energy Format: ","Unrecognised energy format."
809 
810 #-----------------------------------
811 
813  """
814  The function simply returns a cms.vstring which is a summary of the
815  Pythia settings for the event generation
816  """
817 
818 
819 
820  func_id=mod_id+"["+sys._getframe().f_code.co_name+"]"
821  common.log(func_id+" Returning PythiaUE settings...")
822 
823  return common.include_files('Configuration/Generator/data/PythiaUESettings.cfi')[0].pythiaUESettings
824