ATLAS Offline Software
jobOption.ParticleGun_flatcurvature_flatip.py
Go to the documentation of this file.
1 #! -*- python -*-
2 
3 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
4 
5 include("EvgenProdTools/StdEvgenSetup.py")
6 theApp.EvtMax = 100
7 
8 import ParticleGun as PG
9 
10 class MyParticleSampler(PG.ParticleSampler):
11  """
12  A special sampler to generate single particles flat in 1/pT and in
13  impact parameter to the beam, with flat z0.
14  """
15 
16  def __init__(self):
17  psamp = PG.PtEtaMPhiSampler(pt=PG.InvSampler(4000, 400000), eta=[0.1,0.3], phi=[0.3, 0.5])
18  xsamp = PG.PosSampler(0, 0, [-150,150], 0)
19  PG.ParticleSampler.__init__(self, pid={13,-13}, mom=psamp, pos=xsamp)
20  self.ip = PG.mksampler([-2,2])
21 
22  def shoot(self):
23  "Return a vector of sampled particles"
24  ps = PG.ParticleSampler.shoot(self)
25  assert len(ps) == 1
26  p = ps[0]
27  from math import sqrt
28  m = -p.mom.X() / p.mom.Y() #< gradient of azimuthal IP sampling line, perp to mom
29  x = self.ip() / sqrt(1 + m**2) #< just decomposing sampled IP into x component...
30  y = m*x #< ... and y-component
31  p.pos.SetX(x)
32  p.pos.SetY(m*x)
33  return [p]
34 
35 topSeq += PG.ParticleGun()
36 topSeq.ParticleGun.randomSeed = 123456
37 topSeq.ParticleGun.sampler = MyParticleSampler()
38 
39 include("EvgenProdTools/postJO.CopyWeights.py")
40 include("EvgenProdTools/postJO.PoolOutput.py")
41 include("EvgenProdTools/postJO.DumpMC.py")
jobOption.MyParticleSampler.__init__
def __init__(self)
Definition: jobOption.ParticleGun_correlated.py:13
jobOption.MyParticleSampler.shoot
def shoot(self)
Definition: jobOption.ParticleGun_correlated.py:16
jobOption.MyParticleSampler
Definition: jobOption.ParticleGun_correlated.py:10
jobOption.MyParticleSampler.ip
ip
Definition: jobOption.ParticleGun_flatcurvature_flatip.py:20
python.Include.include
include
Definition: Include.py:319