ATLAS Offline Software
Loading...
Searching...
No Matches
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
5include("EvgenProdTools/StdEvgenSetup.py")
6theApp.EvtMax = 100
7
8import ParticleGun as PG
9
10class 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
35topSeq += PG.ParticleGun()
36topSeq.ParticleGun.randomSeed = 123456
37topSeq.ParticleGun.sampler = MyParticleSampler()
38
39include("EvgenProdTools/postJO.CopyWeights.py")
40include("EvgenProdTools/postJO.PoolOutput.py")
41include("EvgenProdTools/postJO.DumpMC.py")