Commit 03e6eed0 authored by Ewelina Maria Lobodzinska's avatar Ewelina Maria Lobodzinska
Browse files

add common files for some generators, define env. variables MCUTILSVER and...

add common files for some generators, define env. variables MCUTILSVER and HEPUTILSVER in TruthUtils
parent a7719da5
......@@ -46,5 +46,5 @@ atlas_add_component( Hijing_i
LINK_LIBRARIES ${HIJING_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GeneratorFortranCommonLib GeneratorModulesLib AthenaKernel StoreGateLib SGtests GaudiKernel GeneratorObjects TruthUtils Hijing_iLib )
# Install files from the package:
atlas_install_joboptions( share/*.py )
atlas_install_joboptions( share/common/*.py )
from Hijing_i.Hijing_iConf import Hijing
genSeq += Hijing()
## evgenConfig setup -- use reduced number of events for HI
evgenConfig.generators += ["Hijing"]
evgenConfig.minevents = 250
## Set default HIJING random number seeds
# TODO: Isn't this reset anyway in EvgenJobTransforms/share/Generate_randomseeds.py?
if not hasattr(svcMgr, 'AtRndmGenSvc'):
from AthenaServices.AthenaServicesConf import AtRndmGenSvc
svcMgr += AtRndmGenSvc()
svcMgr.AtRndmGenSvc.Seeds = \
["HIJING 327213897 979111713", "HIJING_INIT 31452781 78713307"]
## Extra stream persistency
evgenConfig.doNotSaveItems += ["McEventCollection#*"]
evgenConfig.extraSaveItems += ["McEventCollection#GEN_EVENT"]
evgenConfig.extraSaveItems += ["HijingEventParams#*"]
###############################################################
#
# An example of job options file for Hijing generation of
# Pb + Pb collisions at 5520 GeV/(colliding nucleon pair)
#
# Brian Cole
# Mikhail Leltchouk
# Andrzej Olszewski
#
# February 2007
#
# more examples in https://twiki.cern.ch/twiki/bin/view/Atlas/AtlasHICSC2007
#
#==============================================================
# General Application Configuration options
#--------------------------------------------------------------
include( "AthenaPoolCnvSvc/WriteAthenaPool_jobOptions.py" )
from AthenaCommon.Configurable import Configurable
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
# configuring the Athena application for a 'generator' job
import AthenaCommon.AtlasUnixGeneratorJob
# make sure we are loading the ParticleProperty service
from PartPropSvc.PartPropSvcConf import PartPropSvc
svcMgr += PartPropSvc()
#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------
from AthenaCommon.AlgSequence import AlgSequence
topAlg = AlgSequence()
from Hijing_i.Hijing_iConf import Hijing
topAlg += Hijing()
theApp.ExtSvc += ["AtRndmGenSvc"]
# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
svcMgr.MessageSvc.OutputLevel = 4
svcMgr.MessageSvc.defaultLimit = 100000
#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 5
# Set run number (default 0 causes problems)
svcMgr.EventSelector.RunNumber = 12345
#--------------------------------------------------------------
# Algorithms Private Options
#--------------------------------------------------------------
import random
# Generate seeds
#
seed1 = random.randint(2<<15-1,1<<31-1)
seed2 = random.randint(2<<15-1,1<<31-1)
seed1 &= 0xfffffffe
seed2 &= 0xfffffffe
if not hasattr(svcMgr, 'AtRndmGenSvc'):
from AthenaServices.AthenaServicesConf import AtRndmGenSvc
svcMgr += AtRndmGenSvc()
svcMgr.AtRndmGenSvc.Seeds = \
["HIJING "+str(seed1)+" "+str(seed2), "HIJING_INIT 53240261 53827126"]
Hijing = Algorithm( "Hijing" )
Hijing.Initialize = ["efrm 5520.", "frame CMS", "proj A", "targ A",
"iap 208", "izp 82", "iat 208", "izt 82",
# Simulation of minimum-bias events
"bmin 0.", "bmax 20.",
# Maximum pt of hard or semihard scatterings in GeV,
# if negative (or commented as below) there is no up-limit.
### "hipr1 9 10.",
# Turns OFF jet quenching:
"ihpr2 4 0",
# Jan24,06 turns ON decays charm and bottom but not pi0, lambda, ...
"ihpr2 12 2",
# Turns ON retaining of particle history - truth information:
"ihpr2 21 1"]
#---------------------------------------------------------------
# Pool Persistency
#---------------------------------------------------------------
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
#--- Stream1 ---
Stream1 = AthenaPoolOutputStream( "Stream1" )
theApp.Dlls += [ "GeneratorObjectsAthenaPoolPoolCnv" ]
PoolSvc = Service( "PoolSvc" )
# 2101 == EventInfo
# 133273 == MCTruth (HepMC)
# 54790518 == HijigEventParams
Stream1.ItemList += [ "2101#*" ]
Stream1.ItemList += [ "133273#*" ]
Stream1.ItemList += [ "54790518#*" ]
Stream1.OutputFile = "hijing.pool.root"
#==============================================================
#
# End of job options file
#
###############################################################
###############################################################
#
# Job options file
#
#==============================================================
#--------------------------------------------------------------
# General Application Configuration options
#--------------------------------------------------------------
include( "AthenaPoolCnvSvc/WriteAthenaPool_jobOptions.py" )
from AthenaCommon.Configurable import Configurable
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
# configuring the Athena application for a 'generator' job
import AthenaCommon.AtlasUnixGeneratorJob
# make sure we are loading the ParticleProperty service
from PartPropSvc.PartPropSvcConf import PartPropSvc
svcMgr += PartPropSvc()
#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------
from AthenaCommon.AlgSequence import AlgSequence
topAlg = AlgSequence()
from Hijing_i.Hijing_iConf import Hijing
topAlg += Hijing()
from TruthExamples.TruthExamplesConf import DumpMC
topAlg += DumpMC()
theApp.ExtSvc += ["AtRndmGenSvc"]
# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
svcMgr.MessageSvc.OutputLevel = 4
svcMgr.MessageSvc.defaultLimit = 100000
#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 5
# Set run number (default 0 causes problems)
svcMgr.EventSelector.RunNumber = 12345
#--------------------------------------------------------------
# Algorithms Private Options
#--------------------------------------------------------------
if not hasattr(svcMgr, 'AtRndmGenSvc'):
from AthenaServices.AthenaServicesConf import AtRndmGenSvc
svcMgr += AtRndmGenSvc()
svcMgr.AtRndmGenSvc.Seeds = ["HIJING 4789899 989240512", "HIJING_INIT 889223465 78782321"]
#svcMgr.AtRndmGenSvc.ReadFromFile = True
# Hijing = Algorithm( "Hijing" )
# Hijing.Initialize = ["efrm 200", "frame CMS", "proj A", "targ A",
# "iap 197", "izp 79", "iat 197", "izt 79"]
# Hijing.wide = FALSE # Allow the random events to be anywhere in the beampipe
# Hijing.randomizeVertices = TRUE # Randomize vertices within the beampipe - default x,y = 0,0
# Hijing.selectVertex = TRUE # Allows manual vertex settings. Please set x, y, and z.
# Hijing.x = 10.0 #mm - X vertex setting - overridden by randomization.
# Hijing.y = 10.0 #mm - Y vertex setting - overridden by randomization.
# Hijing.z = 10000.0 #mm - Z vertex setting - overridden by randomization.
# Hijing.vertexOffsetCut = 1.0E-7 # default
# Hijing.partonStoreMinPt = 5.0 # default
# Hijing.keepSpectators = true # default
#---------------------------------------------------------------
# Ntuple service output
#---------------------------------------------------------------
#==============================================================
#
# End of job options file
#
###############################################################
......@@ -10,8 +10,8 @@ find_package( MadGraph )
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
atlas_install_generic( share/*.dat share/lhapdf-config share/fastjet-config
atlas_install_joboptions( share/common/*.py )
atlas_install_generic( share/file/*.dat share/lhapdf-config share/fastjet-config
DESTINATION share
EXECUTABLE )
......
......@@ -10,7 +10,7 @@ find_package( FastJet )
if( FASTJET_FOUND AND MADGRAPH_FOUND )
get_filename_component( _fastjetPath "${FASTJET_INCLUDE_DIR}" DIRECTORY )
set( MADGRAPHCONTROLENVIRONMENT_ENVIRONMENT
FORCESET FASTJETPATH ${_fastjetPath}
FORCESET FASTJETPATH ${_fastjetPath}
FORCESET MADGRAPHVER ${MADGRAPH5AMC_VERSION})
unset( _fastjetPath )
endif()
......
from MadGraphControl.MadGraphUtils import *
#
## 2 inputs parameters, mass of Zp (zpm), 1 coupling gzpmul
##
## Example 1: 15.0GeV Zp with coupling to muon only pp --> 2mu+Zp --> 4mu
##
## zpm=15.0
## gzpmul=3.000000e-01
##
gzpel=0.000000e+00
gzper=0.000000e+00
gzpmur=gzpmul
gzptal=0.000000e+00
gzptar=0.000000e+00
maxjetflavor=5
## safe factor applied to nevents, to account for the filter efficiency
safefactor=1.1
fcard = open('proc_card_mg5.dat', 'w')
fcard.write("""
import model Leptophilic_UFO
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~
set group_subprocesses Auto
set ignore_six_quark_processes False
set gauge unitary
set complex_mass_scheme False
generate p p > mu+ mu- Zp, Zp > mu+ mu-
output -f
""")
fcard.close()
beamEnergy=-999
if hasattr(runArgs,'ecmEnergy'):
beamEnergy = runArgs.ecmEnergy / 2.
else:
raise RuntimeError("No center of mass energy found.")
#---------------------------------------------------------------------------
# MG5 run Card
#---------------------------------------------------------------------------
#
# ptj default value 20GeV, using ktdurham just in case its lower than 20GeV
#
extras = {
'pdlabel' : "'lhapdf'",
'lhaid' : '260000',
'lhe_version' : '3.0',
'maxjetflavor' : maxjetflavor,
'asrwgtflavor' : maxjetflavor,
'cut_decays' : 'F',
'use_syst' : 'T',
'sys_scalefact' :'1 0.5 2',
'sys_alpsfact' : 'None',
'sys_matchscale' : 'None',
'sys_pdf' : 'None',#NNPDF23_lo_as_0130_qed'
}
process_dir = new_process()
build_run_card(run_card_old=get_default_runcard(process_dir),run_card_new='run_card.dat',
nevts=int(runArgs.maxEvents*safefactor),rand_seed=runArgs.randomSeed,beamEnergy=beamEnergy, extras=extras)
#---------------------------------------------------------------------------
# MG5 param Card
#---------------------------------------------------------------------------
paramcard = subprocess.Popen(['get_files','-data','MadGraph_param_card_Leptophilic_muOnly.dat'])
paramcard.wait()
if not os.access('MadGraph_param_card_Leptophilic_muOnly.dat',os.R_OK):
print 'ERROR: Could not get param card'
## params is a dictionary of dictionaries (each dictionary is a
## separate block)
## parameters for newcoup
params={}
ncoups={}
ncoups['GZpeL']=gzpel
ncoups['GZpeR']=gzper
ncoups['GZpmuL']=gzpmul
ncoups['GZpmuR']=gzpmur
ncoups['GZptaL']=gzptal
ncoups['GZptaR']=gzptar
params['ZPINPUTS']=ncoups
## mass parameters
masses={}
masses['999888']=zpm
str_param_card='param_card.dat'
build_param_card(param_card_old='MadGraph_param_card_Leptophilic_muOnly.dat',
param_card_new=str_param_card,
masses=masses,
params=params)
print_cards()
runName='run_01'
generate(run_card_loc='run_card.dat',param_card_loc=str_param_card,mode=2,njobs=1,run_name=runName,proc_dir=process_dir)
outputDS=arrange_output(run_name=runName,proc_dir=process_dir,outputDS=runName+'._00001.events.tar.gz', saveProcDir=True)
import os
if 'ATHENA_PROC_NUMBER' in os.environ:
evgenLog.info('Noticed that you have run with an athena MP-like whole-node setup. Will re-configure now to make sure that the remainder of the job runs serially.')
njobs = os.environ.pop('ATHENA_PROC_NUMBER')
# Try to modify the opts underfoot
if not hasattr(opts,'nprocs'): mglog.warning('Did not see option!')
else: opts.nprocs = 0
print opts
#### Shower
evgenConfig.description = "Leptophilic Zprime, https://arxiv.org/pdf/1411.7394.pdf"
evgenConfig.keywords = ["BSM","Zprime","4muon"]
evgenConfig.process = "pp --> 2mu+Zp --> 4mu around Z peak"
evgenConfig.contact = ["Tiesheng Dai <tiesheng.dai@cern.ch>"]
runArgs.inputGeneratorFile=outputDS
include("Pythia8_i/Pythia8_A14_NNPDF23LO_EvtGen_Common.py")
include("Pythia8_i/Pythia8_MadGraph.py")
genSeq.Pythia8.Commands += [
'23:onMode = off'
]
from MadGraphControl.MadGraphUtils import *
# General settings
nevents=6000
gridpack_dir=None
gridpack_mode=False
#runName='run_01'
### DSID lists (extensions can include systematics samples)
WZ_EW=[364499]
if runArgs.runNumber in WZ_EW:
name='VBS_ew_lvlljj'
process="pp>WZ>lvll~"
gridpack_mode=True
gridpack_dir='madevent/'
else:
raise RuntimeError("runNumber %i not recognised in these jobOptions."%runArgs.runNumber)
stringy = 'madgraph.'+str(runArgs.runNumber)+'.MadGraph_'+str(name)
fcard = open('proc_card_mg5.dat','w')
fcard.write("""
import model sm-no_b_mass
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+ ta+
define l- = e- mu- ta-
generate p p > l+ l- l+ vl j j QCD=0 @1
add process p p > l+ l- l- vl~ j j QCD=0 @2
output -f
""")
fcard.close()
beamEnergy=-999
if hasattr(runArgs,'ecmEnergy'):
beamEnergy = runArgs.ecmEnergy / 2.
else:
raise RuntimeError("No center of mass energy found.")
process_dir = new_process(grid_pack=gridpack_dir)
#Fetch default LO run_card.dat and set parameters
extras = {'lhe_version':'3.0',
'cut_decays' :'F',
'pdlabel' : "'lhapdf'",
'lhaid' : 260000,
'sys_pdf' : 'NNPDF30_nlo_as_0118',
'gridpack' : 'T',
'ptj' : '10.0',
'ptb' : '10.0',
'pta' : '10.0',
'ptl' : '10.0',
'etaj' : '-1.0',
'etab' : '-1.0',
'etal' : '-1.0',
'drjj' : '0.2',
'drbb' : '0.2',
'drll' : '0.1',
'draa' : '0.4',
'drbj' : '0.1',
'draj' : '0.4',
'drjl' : '0.1',
'dral' : '0.4',
'mmjj' : '20.0',
'mmbb' : '20.0',
'mmaa' : '0.0',
'mmll' : '0.0',
'mmnl' : '10.0',
'use_syst' : 'T',
}
build_run_card(run_card_old=get_default_runcard(proc_dir=process_dir),run_card_new='run_card.dat',
nevts=nevents,rand_seed=runArgs.randomSeed,beamEnergy=beamEnergy,extras=extras)
print_cards()
runName='VBS_ew_lvlljj'
#madspin_card_loc='madspin_card.dat'
#mscard = open(madspin_card_loc,'w')
#mscard.write("""#************************************************************
#* MadSpin *
#* *
#* P. Artoisenet, R. Frederix, R. Rietkerk, O. Mattelaer *
#* *
#* Part of the MadGraph5_aMC@NLO Framework: *
#* The MadGraph5_aMC@NLO Development Team - Find us at *
#* https://server06.fynu.ucl.ac.be/projects/madgraph *
#* *
#************************************************************
#Some options (uncomment to apply)
#
# set seed 1
# set Nevents_for_max_weigth 75 # number of events for the estimate of the max. weight
# set BW_cut 15 # cut on how far the particle can be off-shell
# set max_weight_ps_point 400 # number of PS to estimate the maximum for each event
#
#set seed %i
# specify the decay for the final state particles
#decay t > w+ b, w+ > all all
#decay t~ > w- b~, w- > all all
#decay w+ > all all
#decay w- > all all
#decay z > all all
# running the actual code
#launch"""%runArgs.randomSeed)
#mscard.close()
#print_cards()
generate(run_card_loc='run_card.dat',param_card_loc=None,mode=0,njobs=1,proc_dir=process_dir,run_name=runName,
grid_pack=gridpack_mode,gridpack_dir=gridpack_dir,nevents=nevents,random_seed=runArgs.randomSeed)
#grid_pack=gridpack_mode,gridpack_dir=gridpack_dir,
#madspin_card_loc=madspin_card_loc,
#arrange_output(run_name=runName,proc_dir=process_dir,outputDS=runName+'._00001.events.tar.gz',lhe_version=3,saveProcDir=True)
arrange_output(run_name=runName,proc_dir=process_dir,outputDS=runName+'._00001.events.tar.gz')
############################
# Shower JOs will go here
import os
if 'ATHENA_PROC_NUMBER' in os.environ:
njobs = os.environ.pop('ATHENA_PROC_NUMBER')
# Try to modify the opts underfoot
if not hasattr(opts,'nprocs'): print 'Warning: Did not see option!'
else: opts.nprocs = 0
print opts
include("Pythia8_i/Pythia8_A14_NNPDF23LO_EvtGen_Common.py")
include("Pythia8_i/Pythia8_MadGraph.py")
#include("Pythia8_i/Pythia8_LHEF.py")
#include("Pythia8_i/Pythia8_EvtGen.py")
genSeq.Pythia8.Commands += [
"Init:showAllParticleData = on",
"Next:numberShowLHA = 10",
"Next:numberShowEvent = 10"]
evgenConfig.generators = ["MadGraph", "Pythia8", "EvtGen"]
evgenConfig.inputfilecheck = runName
runArgs.inputGeneratorFile=runName+'._00001.events.tar.gz'
evgenConfig.contact = ['Louis Helary <Louis.Helary@cern.ch>','Benjamin Freund <benjamin.freund@cern.ch>']
#evgenConfig.keywords+=keyword
#evgenConfig.description = description
evgenConfig.description = 'VBS_WZ'
evgenConfig.keywords+=['SM','VBS']
runArgs.inputGeneratorFile=name+'._00001.events.tar.gz'
from MadGraphControl.MadGraphUtils import *
# General settings
minevents=5000
nevents=20000
mode=0
DSID_3top_SM =[304014]
if runArgs.runNumber in DSID_3top_SM:
mgproc="""generate p p > t t~ t w- QED=3 \nadd process p p > t t~ t~ w+ QED=3 \nadd process p p > t t~ t j QED=4 \nadd process p p > t t~ t~ j QED=4"""
name="3topSM"
keyword=['SM','top']
else:
raise RuntimeError("runNumber %i not recognised in these jobOptions."%runArgs.runNumber)
stringy = 'madgraph.'+str(runArgs.runNumber)+'.MadGraph_'+str(name)
fcard = open('proc_card_mg5.dat','w')
fcard.write("""
import model sm
define p = g u c d s u~ c~ d~ s~
define p = p b b~
define j = g u c d s u~ c~ d~ s~
define j = j b b~
"""+mgproc+"""
output -f
""")
fcard.close()
beamEnergy=-999
if hasattr(runArgs,'ecmEnergy'):
beamEnergy = runArgs.ecmEnergy / 2.
else:
raise RuntimeError("No center of mass energy found.")
pdflabel="nn23lo1"
#Fetch default LO run_card.dat and set parameters
extras = { 'lhe_version' : '2.0',
'pdlabel' : "'"+pdflabel+"'" }
build_run_card(run_card_old=get_default_runcard(),run_card_new='run_card.dat',
nevts=nevents,rand_seed=runArgs.randomSeed,beamEnergy=beamEnergy,
extras=extras)
print_cards()
process_dir = new_process()
generate(run_card_loc='run_card.dat',param_card_loc=None,mode=mode,proc_dir=process_dir)
arrange_output(proc_dir=process_dir,outputDS=stringy+'._00001.events.tar.gz')
#### Shower
evgenConfig.process = "3top_SM"
evgenConfig.description = 'MadGraph_'+str(name)
evgenConfig.keywords+=keyword
evgenConfig.inputfilecheck = stringy
evgenConfig.minevents = minevents
evgenConfig.contact= ["lserkin@cern.ch", "michele.pinamonti@gmail.com"]
runArgs.inputGeneratorFile=stringy+'._00001.events.tar.gz'