Notes on Building ShawnGenerator

Below are the series of steps I used to create my "ShawnGenerator". This generator is based upon source code from Loek Hooft van Huysduynen.

First setup to use ATLAS software. On AGLT2 this is provided by CVMFS. We simply run:

source /usr/local/bin/setup/cvmfs_atlas.sh asetup 16.6.5

This prepares the environment for ATLAS Release 16.6.5

I then created a directory ~ATLAS/DarkMatter to work from. I 'cd' there and create a testarea directory:

mkdir testarea

At this point you need to setup your .asetup file in your home directory. You can just run setupATLAS to create a draft version. I changed the testarea to:

testarea: /afs/atlas.umich.edu/home/smckee/ATLAS/DarkMatter/testarea

I then 'cd' there and get the source code.

co svn+ssh://mckee@svn.cern.ch/reps/atlasusr/lhooftva/ParticleGenerator/trunk ParticleGenerator

In the directory ParticleGenerator/cmt, add a version.cmt file which has the line ParticleGenerator-00-00-00 to suppress warning messages
echo "ParticleGenerator-00-00-00" >> version.cmt

I put in my code changes to modify the existing ParticleGenerator into "ShawnGenerator". Basically I just patch the default ParticleGenerator to allow the creation of a scalar particle which can be simply decayed in the rest frame and the results boosted back into the lab frame. You can pick an particle ID for the parent and force decays into electrons or muons. The regular ParticleGenerator commands can be used to control the details of the scalar generated.

Once the changes are in place compile the code
cmt config
make
source setup.sh

Then you can run it from the cmt directory with
athena job.py

Here is an example job.py:
###############################################################
#
# Job options file for testing ParticleGenerator with user-supplied histograms.
#
#==============================================================
import os


import AthenaCommon.AtlasUnixGeneratorJob

from AthenaCommon.AppMgr import theApp
from AthenaCommon.AppMgr import ServiceMgr

#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------
#load relevant libraries
from PartPropSvc.PartPropSvcConf import PartPropSvc
ServiceMgr += PartPropSvc()

# The following is needed to load the Athena Random
# Number Generation Service.
from AthenaServices.AthenaServicesConf import AtRanluxGenSvc
ServiceMgr += AtRanluxGenSvc()
ServiceMgr.AtRanluxGenSvc.Seeds = ["SINGLE 2040160768 443921183"]
# AtRanluxGenSvc.ReadFromFile = TRUE                                            


#--------------------------------------------------------------
# ParticleGenerator parameters
#--------------------------------------------------------------


from AthenaCommon.AlgSequence import AlgSequence
job=AlgSequence()

# get the configurable class
from ParticleGenerator.ParticleGeneratorConf import ShawnGenerator
job += ShawnGenerator()

theApp.EvtMax = 1000


# For VERBOSE output from ShawnGenerator.
job.ShawnGenerator.OutputLevel = DEBUG
#muons = 13, electrons = 11
job.ShawnGenerator.decayParticle = 13
job.ShawnGenerator.parentMass = 2500. # in Mev
job.ShawnGenerator.orders = [
    "pdgcode:  constant 441",
    "e: flat 25000. 50000.",
    "vertZ: gaussian 0 50",
    "eta: flat -2.5 2.5",
    "phi: flat -3.14159 3.14159"
    ]

#---------------------------------------------------------------
# Pool Persistency
#---------------------------------------------------------------

from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
Stream1 = AthenaPoolOutputStream( "Stream1" )
Stream1.ItemList += ["2101#*", "133273#*" ]
Stream1.ForceRead=TRUE

Stream1.OutputFile = "ShawnGenerator.pool.root"


#-- PrintMC
PrintMC = Algorithm( "PrintMC" )
theApp.TopAlg += ["PrintMC"]

#event SVC key
PrintMC.McEventKey = "GEN_EVENT"
# do you want output at all? TRUE/FALSE
PrintMC.VerboseOutput = TRUE
# Event print style Vertex(traditional)/Barcode(barcode ordered)
PrintMC.PrintStyle = "Barcode"
# First and last event to print, if no last events => job end are printed
PrintMC.FirstEvent = 1
PrintMC.LastEvent = 2

PrintMC.OutputLevel=6

This topic: AGLT2 > WebHome > ShawnGenerator
Topic revision: 17 Aug 2011, ShawnMcKee
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback