Esempio n. 1
0
 def shoot(self):
     "Return a vector of sampled particles"
     p1 = PG.SampledParticle(11, self.mom1.shoot())
     eta1 = p1.mom.Eta()
     phi1 = p1.mom.Phi()
     # TODO: will phi be properly wrapped into range?
     mom2 = PG.PtEtaMPhiSampler(pt=25000,
                                eta=[eta1 - 0.5, eta1 + 0.5],
                                phi=[phi1 - 0.5, phi1 + 0.5])
     p2 = PG.SampledParticle(11, mom2.shoot())
     return [p1, p2]
 def shoot(self):
     "Return a vector of sampled particles from the provided pT--eta histogram"
     particles = []
     for i in xrange(self.numparticles):
         ptrand, etarand = self.hist.GetRandom()
         ptrand *= 1000  # NB. This _particular_ histogram is in GeV, but Athena needs MeV!
         # TODO: Provide 4-mom construction functions to avoid building this one-time sampler
         pid = self.pid()
         mom = PG.PtEtaMPhiSampler(pt=ptrand,
                                   eta=etarand,
                                   mass=PG.MASSES[abs(pid)])
         p = PG.SampledParticle(pid, mom())
         #print p.mom.Pt(), "\t", p.mom.Eta(), "\t", p.mom.Phi(), "\t", p.mom.M()
         particles.append(p)
     return particles
Esempio n. 3
0
    def shoot(self):
        pid = self.pid()
        shift_z = self.shift_z

        mom = self.mom1.shoot()
        pos_temp = mom.Vect().Unit()

        # Would it hit the barrel, or the endcap?
        if abs(pos_temp.Z()) / 3550. < pos_temp.Perp(
        ) / 1148.:  # Hit the barrel!
            pos_temp *= 1148. / pos_temp.Perp()
        else:  # Hit the endcap!
            pos_temp *= 3550. / abs(pos_temp.Z())

        # Shift position of vector in the Z direction
        pos_temp_2 = ROOT.TVector3()
        pos_temp_2.SetXYZ(pos_temp.X(), pos_temp.Y(), pos_temp.Z() + shift_z)
        pos_temp_2 *= 1. / pos_temp_2.Mag()
        # reduce magnitude of vector

        # recalculate; Would it hit the barrel, or the endcap?
        if abs(pos_temp_2.Z()) / 3550. < pos_temp_2.Perp() / 1148.:
            pos_temp_2 *= 1148. / pos_temp_2.Perp()
        else:
            pos_temp_2 *= 3550. / abs(pos_temp_2.Z())

        pos = ROOT.TLorentzVector(pos_temp_2.X(), pos_temp_2.Y(),
                                  pos_temp_2.Z(), 0)

        return [PG.SampledParticle(pid, mom, pos)]
Esempio n. 4
0
    def __init__(self,
                 pid,
                 eta=[-2.5, 2.5],
                 phi=[0, PG.TWOPI],
                 mu1=0.5,
                 kT1=0.1,
                 mu2=200,
                 kT2=20,
                 y0=0.005,
                 PtMin=0,
                 PtMax=3e3,
                 nBins=None):
        """ 
    Parameters for the MVA-shaped spectrum : higher density in the < 100 GeV range
    PtMin = 0 # minimum Pt
    PtMax = 3000 # maximum Pt (3 TeV)
    nBins # number of bins (one every 100 MeV by default)
    mu1 = 0.5		# mu1,kT1 : smooth but steep ramp-up from 0 to 1 GeV (requested by TauCP)
    kT1 = 0.1
    mu2 = 200		# mu2,kT2 : smooth, slow ramp-down in the 100-300 GeV range
    kT2 = 20
    y0 = 0.005		# y0 : baseline for low-density at high ET up to PtMax
    """
        self.m = PG.MASSES[abs(pid)]
        self.eta = eta
        self.phi = phi

        # Create and fill a very fine-grained histogram
        from ROOT import TH1D
        etSpectrumFullRange = TH1D(
            "ETSpectrumFullRange",
            "Reference ET spectrum for egamma MVA calib",
            int(nBins or (PtMax - PtMin) * 10), PtMin, PtMax)
        for i in xrange(etSpectrumFullRange.GetNbinsX()):
            x = etSpectrumFullRange.GetBinCenter(i + 1)
            y1 = dbnFermiDirac(x, mu1, kT1)
            y2 = dbnFermiDirac(x, mu2, kT2)
            y = y0 - y1 + y2
            etSpectrumFullRange.SetBinContent(i + 1, y)
        self.hist = PG.TH1(etSpectrumFullRange)  #< wrap *after* populating
Esempio n. 5
0
## Simulation flags
athenaCommonFlags.PoolEvgenInput.set_Off()
athenaCommonFlags.SkipEvents.set_Off()
from G4AtlasApps.SimFlags import simFlags
simFlags.load_atlas_flags()
simFlags.SimLayout.set_On()
simFlags.SimLayout = 'ATLAS-R2-2015-03-01-00_VALIDATION'

## Enable the EtaPhi, VertexSpread and VertexRange checks
simFlags.EventFilter.set_On()

## Use single particle generator
import AthenaCommon.AtlasUnixGeneratorJob
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = PG.CyclicSeqSampler([-11, 11])
pg.sampler.mom = PG.PtEtaMPhiSampler(pt=10000, eta=[-3, 3])
job += pg

include("G4AtlasApps/fragment.SimCopyWeights.py")

## Release GeoModel memory once sim is configured
simFlags.ReleaseGeoModel = False

include("G4AtlasApps/G4Atlas.flat.configuration.py")

## Add the G4 sim to the alg sequence after the generator
from AthenaCommon.CfgGetter import getAlgorithm
job += getAlgorithm("G4AtlasAlg", tryDefaultConfigurable=True)
Esempio n. 6
0
printfunc ('SINGLE PARTICLE GENERATOR')
## Run ParticleGenerator
# One neutron and one photon per side
import AthenaCommon.AtlasUnixGeneratorJob
from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")
pg.sampler.pid = PG.CyclicSeqSampler([2112, 22, 2112, 22])
esampler = PG.CyclicSeqSampler([1360000, 500000, 1360000, 500000])
thsampler = PG.CyclicSeqSampler([0, 0, PG.PI, PG.PI])
pg.sampler.mom = PG.EThetaMPhiSampler(energy=esampler, theta=thsampler)
job += pg

include("G4AtlasApps/fragment.SimCopyWeights.py")

printfunc ("As this is a single particle generator job turn off VertexPositioner")
simFlags.EventFilter.get_Value()['VertexPositioner'] = False
simFlags.EventFilter.get_Value()['BeamEffectTransformation'] = False
simFlags.EventFilter.get_Value()['PrimaryEventRotations'] = False
simFlags.VertexFromCondDB= False

try:
    include('ForwardTransportSvc/preInclude.ForwardTransportFlags_3.5TeV_0000.55m_nominal_v01.py')
except:
    printfunc ("forwardTransportFlags not available in this release.")

include('ForwardTransportSvc/ForwardTransportSvcConfig.ZDC.py')
#--- Simulation flags -----------------------------------------
from G4AtlasApps.SimFlags import simFlags
simFlags.load_atlas_flags()  # Going to use an ATLAS layout
simFlags.SimLayout = myGeo
simFlags.EventFilter.set_Off()

myMinEta = -6.0
myMaxEta = 6.0

myPDG = 999  # 999 = Geantinos, 13 = Muons

include("GeneratorUtils/StdEvgenSetup.py")
theApp.EvtMax = myMaxEvent

import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = myPDG
pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[myMinEta, myMaxEta])
topSeq += pg

simFlags.RandomSeedOffset = myRandomOffset

### new rel17 (check Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py for details)
simFlags.RandomSeedList.addSeed("SINGLE", myRandomSeed1, myRandomSeed2)

from RngComps.RngCompsConf import AtRndmGenSvc
myAtRndmGenSvc = AtRndmGenSvc()
myAtRndmGenSvc.Seeds = [
    "SINGLE " + str(myRandomSeed1) + " " + str(myRandomSeed2)
]
myAtRndmGenSvc.OutputLevel = VERBOSE
Esempio n. 8
0
from AthenaCommon.AlgSequence import AlgSequence
topSeq = AlgSequence()

import AthenaCommon.AtlasUnixGeneratorJob
spgorders = ['pdgcode: constant 13',
             'vertX: constant 0.0',
             'vertY: constant 0.0',
             'vertZ: constant 0.0',
             't: constant 0.0',
             'eta: flat -1.1 -2.7',
             'phi: flat  0 6.28318',
             'e: constant 10000']

import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")
pg.sampler.pid = 13
pg.sampler.mom = PG.PtEtaMPhiSampler(pt=50000, eta=[-3,3])
topSeq += pg

from AthenaServices.AthenaServicesConf import AtRanluxGenSvc
ServiceMgr += AtRanluxGenSvc()
ServiceMgr.AtRanluxGenSvc.Seeds = ["SINGLE 2040160768 443921183"]

if (doFastCheck) :
  def test_preInit():
    printfunc ("CALLBACK AT PREINIT")
  def test_postInit():
    printfunc ("CALLBACK AT POSTINIT")
  def use_geometry_check():
    printfunc ("CALLBACK use_geometry_check")
Esempio n. 9
0
evgenConfig.description = "Single geantino with flat eta-phi and E = 10 GeV"
evgenConfig.keywords = ["singleParticle"]

include("MC15JobOptions/ParticleGun_Common.py")

import ParticleGun as PG

genSeq.ParticleGun.sampler.pid = 999
genSeq.ParticleGun.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=0)
genSeq.ParticleGun.sampler.pos = PG.PosSampler(x=0.0,
                                               y=0.0,
                                               z=[2528.64, 2542.69],
                                               t=0.0)
print 'SINGLE PARTICLE GENERATOR'

## Run ParticleGun
import AthenaCommon.AtlasUnixGeneratorJob

from AthenaCommon.AlgSequence import AlgSequence
topSeq = AlgSequence()

import ParticleGun as PG
from G4AtlasApps.SimFlags import simFlags
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = PG.CyclicSeqSampler([-13, 13])
#pg.sampler.mom = PG.PtEtaMPhiSampler(pt=[5000000,7000000] , eta=[-2.9,2.9])
pg.sampler.mom = PG.PtEtaMPhiSampler(pt=[5000000, 7000000], eta=[1.0, 1.3])
topSeq += pg

try:
    from GeneratorModules.GeneratorModulesConf import CopyEventWeight
    topSeq += CopyEventWeight(TruthCollKey="GEN_EVENT")
except:
    include("G4AtlasApps/fragment.SimCopyWeights.py")
Esempio n. 11
0
G4Svc.FADSMacro = "env.mac:H6G4LArCal.mac:PhysicsList.mac:Filters.mac"
# ParticleGun
# -----------------
import AthenaCommon.AtlasUnixGeneratorJob

include("GeneratorUtils/StdEvgenSetup.py")
import ParticleGun as PG
try:
    ParticleGeneratorPDG = ' constant ' + ParticlePDG
    particl = int(ParticlePDG)
except:
    log.warning('tbH6Generator: You are running geantino')
    ParticleGeneratorPDG = ' constant 999'
    particl = 999
# - Energy
try:
    ParticleGeneratorEnergy = ' constant ' + repr(Energy)
    energy = float(Energy)
except:
    log.warning('Unknown energy. Set 200 GeV')
    ParticleGeneratorEnergy = ' constant 200000'
    energy = 200000.

pg = PG.ParticleGun()
ps = PG.ConstEnergySampler(pid=particl,
                           energy=energy,
                           eta=PG.UniformSampler(-6.0, 6.0))
pg.samplers.append(ps)
topSeq += pg
#--------------------------------------------------------------
Esempio n. 12
0
    "/MUONALIGN/TGC/SIDEC"
]

from AtlasGeoModel.MuonGM import GeoModelSvc
#GeoModelSvc.MuonVersionOverride = "MuonSpectrometer-R.07.01"
MuonDetectorTool = GeoModelSvc.DetectorTools["MuonDetectorTool"]
MuonDetectorTool.UseConditionDb = 1
MuonDetectorTool.OutputLevel = VERBOSE

from AthenaServices.AthenaServicesConf import AtRanluxGenSvc
ServiceMgr += AtRanluxGenSvc()
ServiceMgr.AtRanluxGenSvc.Seeds = ["SINGLE 2040160768 443921183"]

## Run ParticleGun
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = (999)
pg.sampler.pos = PG.PosSampler(x=0, y=0, z=0, t=0)
pg.sampler.mom = PG.EEtaMPhiSampler(energy=100000,
                                    eta=[-3, 3],
                                    phi=[-PG.PI, PG.PI])
topSeq += pg

include("G4AtlasApps/G4Atlas.flat.configuration.py")

## Add G4 sim framework alg sequence
from AthenaCommon.CfgGetter import getAlgorithm
topSeq += getAlgorithm("G4AtlasAlg", tryDefaultConfigurable=True)
topSeq.G4AtlasAlg.InputTruthCollection = "GEN_EVENT"

#---  Output printout level -----------------------------------
Esempio n. 13
0
## Common setup for ParticleGun
import ParticleGun as PG
genSeq += PG.ParticleGun()
evgenConfig.generators += ["ParticleGun"]
Esempio n. 14
0
#--- Simulation flags -----------------------------------------
from G4AtlasApps.SimFlags import simFlags
simFlags.load_atlas_flags() # Going to use an ATLAS layout
simFlags.SimLayout = myGeo
simFlags.EventFilter.set_Off()

myMinEta = -2.5
myMaxEta =  2.5

myPDG    = 999   # 999 = Geantinos, 13 = Muons

include("GeneratorUtils/StdEvgenSetup.py")
theApp.EvtMax = 20000

import ParticleGun as PG
pg = PG.ParticleGun()
pg.sampler.pid = 999
pg.randomSeed = 123456
pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[myMinEta,myMaxEta])
topSeq += pg

simFlags.RandomSeedOffset = myRandomOffset
simFlags.RandomSeedList.addSeed( "SINGLE", myRandomSeed1, myRandomSeed2 )

from RngComps.RngCompsConf import AtRndmGenSvc
myAtRndmGenSvc = AtRndmGenSvc()
myAtRndmGenSvc.Seeds = ["SINGLE "+str(myRandomSeed1)+" "+str(myRandomSeed2) ]
myAtRndmGenSvc.OutputLevel 	= VERBOSE
myAtRndmGenSvc.EventReseeding   = False
ServiceMgr += myAtRndmGenSvc
Esempio n. 15
0
# simFlags.InitFunctions.add_function("postInit", test_postInit)

## Change the field stepper or use verbose G4 tracking
# from G4AtlasApps import callbacks
# simFlags.InitFunctions.add_function("postInit", callbacks.use_simplerunge_stepper)
# simFlags.InitFunctions.add_function("postInit", callbacks.use_verbose_tracking)

## Use single particle generator
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolEvgenInput.set_Off()
athenaCommonFlags.SkipEvents.set_Off()

## Set particle gun parameters
import AthenaCommon.AtlasUnixGeneratorJob
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = 11
pg.sampler.mom = PG.EEtaMPhiSampler(energy=params['pg_E'],
                                    eta=params['pg_eta'])
pg.sampler.pos = PG.PosSampler(x=params['pg_x'],
                               y=params['pg_y'],
                               z=params['pg_z'],
                               t=params['pg_z'])
topSeq += pg

## Dump truth information
# from TruthExamples.TruthExamplesConf import DumpMC
# topSeq += DumpMC()

StoreGateSvc = Service("StoreGateSvc")
StoreGateSvc.Dump = True
Esempio n. 16
0
#--- Simulation flags -----------------------------------------
from G4AtlasApps.SimFlags import simFlags
simFlags.load_atlas_flags()
simFlags.SimLayout.set_On()
# simFlags.SimLayout = 'ATLAS-SLHC-01-01-00_VALIDATION'
simFlags.SimLayout = 'ATLAS-SLHC-01-03-00_VALIDATION'
simFlags.RandomSeed = JobSpecs_Seed1
#  sets the EtaPhi, VertexSpread and VertexRange checks on
simFlags.EventFilter.set_Off()

from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolEvgenInput.set_Off()
import AthenaCommon.AtlasUnixGeneratorJob
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = 999  #Geantino
if 'pt' == str(myPt):
    pg.sampler.mom = PG.PtEtaMPhiSampler(pt=myMomentum, eta=[-5, 5])
else:
    printfunc('not sure what you want to do here')
#pg.sampler.mom = PG.EEtaMPhiSampler(energy=50000, eta=[-3,3])
topSeq += pg
printfunc(topSeq.ParticleGun)

try:
    include("G4AtlasApps/fragment.SimCopyWeights.py")
except:
    from GeneratorModules.GeneratorModulesConf import CopyEventWeight
    topSeq += CopyEventWeight(TruthCollKey="GEN_EVENT")
Esempio n. 17
0
include("InDetSLHC_Example/geometry.py")

from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolHitsOutput = 'HITS.pool.root'
athenaCommonFlags.EvtMax = 100000

from AthenaCommon.AlgSequence import AlgSequence
topSeq = AlgSequence()

simFlags.EventFilter.set_Off()
simFlags.MagneticField.set_Off()

athenaCommonFlags.PoolEvgenInput.set_Off()
import AthenaCommon.AtlasUnixGeneratorJob
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = 999
pg.sampler.pos = PG.PosSampler(x=0.0, y=0.0, z=[0.0, 0.0], t=0.0)
import math
pg.sampler.mom = PG.EEtaMPhiSampler(energy=50000,
                                    eta=[-5., 5.],
                                    phi=[0., 2 * math.pi])
topSeq += pg

MessageSvc.Format = "% F%40W%S%7W%R%T %0W%M"
MessageSvc.defaultLimit = 500

from AthenaCommon.AppMgr import ServiceMgr

if not hasattr(ServiceMgr, 'THistSvc'):
    from GaudiSvc.GaudiSvcConf import THistSvc
Esempio n. 18
0
    from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
    GeoModelSvc = GeoModelSvc()
    from AtlasGeoModel import TileGM
    GeoModelSvc.DetectorTools["TileDetectorTool"].Ushape = TileUshape

from AthenaCommon.AlgSequence import AlgSequence

topSeq = AlgSequence()

## Set Overall per-Algorithm time-limit on the AlgSequence
topSeq.TimeOut = 43200 * Units.s

if not athenaCommonFlags.PoolEvgenInput.statusOn:
    import AthenaCommon.AtlasUnixGeneratorJob
    import ParticleGun as PG
    pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                        randomStream="SINGLE")

    # 50 GeV pions
    #pg.sampler.pid = 211
    #pg.sampler.pos = PG.PosSampler(x=-27500, y=[-10,15], z=[-15,15], t=-27500)
    #pg.sampler.mom = PG.EEtaMPhiSampler(energy=50000, eta=0, phi=0)

    # 100 GeV electrons - use for sampling faction calculation
    #pg.sampler.pid = 11
    #pg.sampler.pos = PG.PosSampler(x=-27500, y=[-20,20], z=[-15,15], t=-27500)
    #pg.sampler.mom = PG.EEtaMPhiSampler(energy=100000, eta=0, phi=0)

    if not 'PID' in dir():
        PID = 11
    if not 'E' in dir():
        E = 100000
#  sets the EtaPhi, VertexSpread and VertexRange checks on
#SimFlags.SimLayout.set_On()            # default value
SimFlags.EventFilter.set_Off()

from AthenaCommon.JobProperties import jobproperties
jobproperties.Global.ConditionsTag = ConditionsTag
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit

from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
GeoModelSvc = GeoModelSvc()
GeoModelSvc.MuonVersionOverride = "MuonSpectrometer-R.07.00"

#--- ParticleGun ----------------------------------------------
import ParticleGun as PG
pg = PG.ParticleGun()
#pg.sampler.pid = (13, -13)
pg.sampler.pid = 999
#pg.sampler.mom = PG.PtEtaMPhiSampler(pt=1000000, eta=[-1.1,1.1], phi=[-PG.PI, PG.PI])
pg.sampler.mom = PG.PtEtaMPhiSampler(pt=100000,
                                     eta=[-1.1, 1.1],
                                     phi=[3.49, 5.934])
topSeq += pg

#---  Output printout level -----------------------------------
#output threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL)
MessageSvc = Service("MessageSvc")
MessageSvc.OutputLevel = 3

#==============================================================
# Job configuration
Esempio n. 20
0
    include("G4DebuggingTools/VolumeDebugger_options.py")
    #simFlags.OptionalUserActionList.addAction('G4UA::VolumeDebuggerTool')
    simFlags.UserActionConfig.addConfig('G4UA::VolumeDebuggerTool',"OutputPath","./Tile.gdml")
    simFlags.UserActionConfig.addConfig('G4UA::VolumeDebuggerTool',"TargetVolume","CALO::CALO") #You can set this to whatever volume you like

#--- Generator flags ------------------------------------------

## Use single particle generator
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolEvgenInput.set_Off()
athenaCommonFlags.SkipEvents.set_Off()

## Use single particle generator
import AthenaCommon.AtlasUnixGeneratorJob
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")

if not 'PID' in dir():
    PID=211
if not 'E' in dir():
    E=100000
pg.sampler.pid = PID
pg.sampler.pos = PG.PosSampler(x=0, y=0, z=0, t=0)
pg.sampler.mom = PG.EEtaMPhiSampler(energy=E, eta=[-1.8,1.8], phi=[0,6.28318])

topSeq += pg

#--- Final step -----------------------------------------------

# This should only be used when evgen is run in the simulation step
include('G4AtlasApps/fragment.SimCopyWeights.py')
Esempio n. 21
0
#! -*- python -*-

# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration

include("GeneratorUtils/StdEvgenSetup.py")
theApp.EvtMax = 100

import ParticleGun as PG
pg = PG.ParticleGun()
pg.randomSeed = 123456
pg.sampler.pid = (2112, 22, 2112, 22)
pg.sampler.mom = PG.EThetaMPhiSampler(energy=(1360000, 500000, 1360000,
                                              500000),
                                      theta=(0, 0, PG.PI, PG.PI))
pg.sampler.pos = PG.PosSampler(x=[-120, -100], y=[-10, 10], z=203950)
topSeq += pg

include("GeneratorUtils/postJO.CopyWeights.py")
include("GeneratorUtils/postJO.PoolOutput.py")
include("GeneratorUtils/postJO.DumpMC.py")
evgenConfig.description = "Single geantino with flat eta-phi and E = 10 GeV"
evgenConfig.keywords = ["singleParticle"]

include("MC15JobOptions/ParticleGun_Common.py")

import ParticleGun as PG
genSeq.ParticleGun.sampler.pid = 999
genSeq.ParticleGun.sampler.mom = PG.EThetaMPhiSampler(energy=10000, theta=0)
genSeq.ParticleGun.sampler.pos = PG.PosSampler(x=[271.5, 272.5],
                                               y=0,
                                               z=0,
                                               t=0.0)
Esempio n. 23
0
#--- AthenaCommon flags ---------------------------------------
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolEvgenInput.set_Off()  ### is this necessary?
athenaCommonFlags.PoolHitsOutput = 'Hits.pool.root'

#--- Simulation flags -----------------------------------------
from G4AtlasApps.SimFlags import simFlags
simFlags.load_atlas_flags()  # Going to use an ATLAS layout
simFlags.SimLayout = myGeo
simFlags.EventFilter.set_Off()

include("GeneratorUtils/StdEvgenSetup.py")
theApp.EvtMax = 50000

import ParticleGun as PG
pg = PG.ParticleGun()
pg.sampler.pid = (-13, 13)
pg.sampler.mom = PG.PtEtaMPhiSampler(pt=5000, eta=[-3.5, 3.5])
topSeq += pg

simFlags.RandomSeedOffset = myRandomOffset
simFlags.RandomSeedList.addSeed("ParticleGun", myRandomSeed1, myRandomSeed2)

from RngComps.RngCompsConf import AtRndmGenSvc
myAtRndmGenSvc = AtRndmGenSvc()
myAtRndmGenSvc.Seeds = [
    "ParticleGun " + str(myRandomSeed1) + " " + str(myRandomSeed2)
]
myAtRndmGenSvc.OutputLevel = VERBOSE
myAtRndmGenSvc.EventReseeding = False
ServiceMgr += myAtRndmGenSvc
Esempio n. 24
0
    @phi.setter
    def phi(self, x):
        self._phi = mksampler(x)

    def shoot(self):
        """
        eta = - ln(tan(theta/2)) / 2
        => theta = 2 atan( exp(-eta) )
        """
        eta = self.eta()
        theta = 2 * math.atan(math.exp(-eta));
        p = self.momentum()
        phi = self.phi()
        pt = p * math.sin(theta)
        px = pt * math.cos(phi)
        py = pt * math.sin(phi)
        pz = p * math.cos(theta)
        m = self.mass()
        e = math.sqrt( p**2 + m**2 )
        v4 = ROOT.TLorentzVector(px, py, pz, e)
        return v4

a_particle = int(runArgs.jobConfig[0].split('_')[-1].split('.py')[0].replace('m','-'))

pg = PG.ParticleGun()
pg.sampler.pid = int(a_particle) #PID
pg.sampler.mom = PEtaSampler(momentum=(500,800,1000,1200,1500,2000,3000,4000,5000,6000,7000,8000,9000,10000,11000,13000,15000,17000,20000,\
                                       25000,35000,50000,75000,100000,200000,350000,500000), eta=[-0.3,0.3], pid=int(a_particle))
genSeq += pg

evgenConfig.description = "Single geantino with flat eta-phi and E = 10 GeV"
evgenConfig.keywords = ["singleParticle"]

include("MC15JobOptions/ParticleGun_Common.py")

import ParticleGun as PG
genSeq.ParticleGun.sampler.pid = 999
genSeq.ParticleGun.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=0)
genSeq.ParticleGun.sampler.pos = PG.PosSampler(x=0.0,y=0.0,z=[997.408,1011.46],t=0.0)
Esempio n. 26
0
evgenConfig.description = "Single geantino with flat eta-phi and E = 10 GeV"
evgenConfig.keywords = ["singleParticle"]

include("MC15JobOptions/ParticleGun_Common.py")

import ParticleGun as PG

genSeq.ParticleGun.sampler.pid = 999
genSeq.ParticleGun.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=0)
genSeq.ParticleGun.sampler.pos = PG.PosSampler(x=0.0,
                                               y=0.0,
                                               z=[491.68, 505.728],
                                               t=0.0)
Esempio n. 27
0
#! -*- python -*-

include("GeneratorUtils/StdEvgenSetup.py")
theApp.EvtMax = 10

import ParticleGun as PG
pg = PG.ParticleGun()
pg.randomSeed = 123456
pg.samplers.append(PG.ParticleSampler())  # add a second sampler
pg.samplers[0].pid = (-13, 13)  # cycle mu+-
pg.samplers[0].mom = PG.PtEtaMPhiSampler(pt=[4000, 100000],
                                         eta=[1.0,
                                              3.2])  # flat in pt and +ve eta
pg.samplers[1].pid = (13, -13)  # cycle mu-+
pg.samplers[1].mom = PG.PtEtaMPhiSampler(pt=[4000, 100000],
                                         eta=[-3.2,
                                              -1.0])  # flat in pt and -ve eta
topSeq += pg

include("GeneratorUtils/postJO.CopyWeights.py")
include("GeneratorUtils/postJO.PoolOutput.py")
include("GeneratorUtils/postJO.DumpMC.py")
Esempio n. 28
0
evgenConfig.description = "Single geantino with flat eta-phi and E = 10 GeV"
evgenConfig.keywords = ["singleParticle"]

include("MC15JobOptions/ParticleGun_Common.py")

import ParticleGun as PG
genSeq.ParticleGun.sampler.pid = 999
genSeq.ParticleGun.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=0)
genSeq.ParticleGun.sampler.pos = PG.PosSampler(x=0.0,
                                               y=0.0,
                                               z=[2943.06, 2957.1],
                                               t=0.0)
Esempio n. 29
0
#--- Simulation flags -----------------------------------------
from G4AtlasApps.SimFlags import simFlags
simFlags.load_atlas_flags()  # Going to use an ATLAS layout
simFlags.SimLayout = myGeo
simFlags.EventFilter.set_Off()

myMinEta = -6.0
myMaxEta = 6.0

myPDG = 999  # 999 = Geantinos, 13 = Muons

include("GeneratorUtils/StdEvgenSetup.py")
theApp.EvtMax = 100

import ParticleGun as PG
pg = PG.ParticleGun()
pg.sampler.pid = 999
pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[-6., 6.])
topSeq += pg

simFlags.RandomSeedOffset = myRandomOffset
simFlags.RandomSeedList.addSeed("SINGLE", myRandomSeed1, myRandomSeed2)

from RngComps.RngCompsConf import AtRndmGenSvc
myAtRndmGenSvc = AtRndmGenSvc()
myAtRndmGenSvc.Seeds = [
    "SINGLE " + str(myRandomSeed1) + " " + str(myRandomSeed2)
]
myAtRndmGenSvc.OutputLevel = VERBOSE
myAtRndmGenSvc.EventReseeding = False
ServiceMgr += myAtRndmGenSvc
SLHC_Setup_XMLReader = SLHC_Setup_XMLReader()
from InDetSLHC_Example.SLHC_Setup_ExtBrl_32 import SLHC_Setup
SLHC_Setup = SLHC_Setup()

#--------------------------------------------------------------
# Particle gun
#--------------------------------------------------------------

from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolEvgenInput.set_Off()
athenaCommonFlags.SkipEvents.set_Off()

import ParticleGun as PG
print dir(PG)

pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")
pg.sampler.pid = 999     # geantino
pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[-4.,4.], phi=[0,6.28318])
topSeq += pg


myRandomSeed1 = int(random.uniform(0,time.time()))
myRandomSeed2 = int(random.uniform(0,time.time()))
simFlags.RandomSeedList.addSeed( "SINGLE", myRandomSeed1, myRandomSeed2 )

from RngComps.RngCompsConf import AtRndmGenSvc
myAtRndmGenSvc = AtRndmGenSvc()
myAtRndmGenSvc.Seeds = ["SINGLE "+str(myRandomSeed1)+" "+str(myRandomSeed2) ]
myAtRndmGenSvc.OutputLevel      = VERBOSE
myAtRndmGenSvc.EventReseeding   = False
ServiceMgr += myAtRndmGenSvc