ATLAS Offline Software
Loading...
Searching...
No Matches
jobOption.PtEtaHistParticleSampler Class Reference
Inheritance diagram for jobOption.PtEtaHistParticleSampler:
Collaboration diagram for jobOption.PtEtaHistParticleSampler:

Public Member Functions

 __init__ (self, pid, histfile, num=100)
 shoot (self)

Public Attributes

 pid = PG.mksampler(pid)
 hist = PG.TH2(histfile, "h_pt_eta")
 numparticles = num

Detailed Description

Definition at line 13 of file jobOption.ParticleGun_corrhist.py.

Constructor & Destructor Documentation

◆ __init__()

jobOption.PtEtaHistParticleSampler.__init__ ( self,
pid,
histfile,
num = 100 )

Definition at line 16 of file jobOption.ParticleGun_corrhist.py.

16 def __init__(self, pid, histfile, num=100):
17 self.pid = PG.mksampler(pid)
18 self.hist = PG.TH2(histfile, "h_pt_eta")
19 self.numparticles = num
20

Member Function Documentation

◆ shoot()

jobOption.PtEtaHistParticleSampler.shoot ( self)

Definition at line 21 of file jobOption.ParticleGun_corrhist.py.

21 def shoot(self):
22 "Return a vector of sampled particles from the provided pT--eta histogram"
23 particles = []
24 for i in xrange(self.numparticles):
25 ptrand, etarand = self.hist.GetRandom()
26 ptrand *= 1000 # NB. This _particular_ histogram is in GeV, but Athena needs MeV!
27 # TODO: Provide 4-mom construction functions to avoid building this one-time sampler
28 pid = self.pid()
29 mom = PG.PtEtaMPhiSampler(pt=ptrand, eta=etarand, mass=PG.MASSES[abs(pid)])
30 p = PG.SampledParticle(pid, mom())
31 #print p.mom.Pt(), "\t", p.mom.Eta(), "\t", p.mom.Phi(), "\t", p.mom.M()
32 particles.append(p)
33 return particles
34
void xrange(TH1 *h, bool symmetric)

Member Data Documentation

◆ hist

jobOption.PtEtaHistParticleSampler.hist = PG.TH2(histfile, "h_pt_eta")

Definition at line 18 of file jobOption.ParticleGun_corrhist.py.

◆ numparticles

jobOption.PtEtaHistParticleSampler.numparticles = num

Definition at line 19 of file jobOption.ParticleGun_corrhist.py.

◆ pid

jobOption.PtEtaHistParticleSampler.pid = PG.mksampler(pid)

Definition at line 17 of file jobOption.ParticleGun_corrhist.py.


The documentation for this class was generated from the following file: