ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
python.samplers.ParticleSampler Class Reference
Inheritance diagram for python.samplers.ParticleSampler:
Collaboration diagram for python.samplers.ParticleSampler:

Public Member Functions

def __init__ (self, pid=999, mom=NullMomSampler(), n=1, pos=PosSampler(0, 0, 0))
 
def pid (self)
 
def pid (self, x)
 
def n (self)
 
def n (self, x)
 
def shoot (self)
 
def __call__ (self)
 

Public Attributes

 pid
 
 mom
 
 n
 
 pos
 
 massdict
 
 mass_override
 

Private Attributes

 _pid
 
 _n
 

Detailed Description

A simple N-independent-particle sampler.

Definition at line 853 of file samplers.py.

Constructor & Destructor Documentation

◆ __init__()

def python.samplers.ParticleSampler.__init__ (   self,
  pid = 999,
  mom = NullMomSampler(),
  n = 1,
  pos = PosSampler(0, 0, 0) 
)

Definition at line 858 of file samplers.py.

858  def __init__(self, pid=999,
859  mom=NullMomSampler(), # noqa: B008 (re-using same ConstSampler)
860  n=1,
861  pos=PosSampler(0, 0, 0)): # noqa: B008 (re-using same ConstSampler)
862  self.pid = pid
863  self.mom = mom
864  self.n = n
865  self.pos = pos
866  self.massdict = MASSES
867  self.mass_override = True
868 

Member Function Documentation

◆ __call__()

def python.samplers.Sampler.__call__ (   self)
inherited
This is the call method that will actually be used (so that normal
functions can also be passed in as samplers).

Definition at line 17 of file samplers.py.

17  def __call__(self):
18  """This is the call method that will actually be used (so that normal
19  functions can also be passed in as samplers)."""
20  return self.shoot()
21 

◆ n() [1/2]

def python.samplers.ParticleSampler.n (   self)

Definition at line 878 of file samplers.py.

878  def n(self):
879  "Particle number sampler"
880  return self._n

◆ n() [2/2]

def python.samplers.ParticleSampler.n (   self,
  x 
)

Definition at line 882 of file samplers.py.

882  def n(self, x):
883  self._n = mksampler(x)
884 

◆ pid() [1/2]

def python.samplers.ParticleSampler.pid (   self)

Definition at line 870 of file samplers.py.

870  def pid(self):
871  "Particle ID code sampler"
872  return self._pid

◆ pid() [2/2]

def python.samplers.ParticleSampler.pid (   self,
  x 
)

Definition at line 874 of file samplers.py.

874  def pid(self, x):
875  self._pid = mksampler(x)
876 

◆ shoot()

def python.samplers.ParticleSampler.shoot (   self)

Reimplemented from python.samplers.Sampler.

Definition at line 885 of file samplers.py.

885  def shoot(self):
886  "Return a vector of sampled particles"
887  numparticles = self.n()
888  rtn = []
889  for i in range(numparticles):
890 
891  pid = self.pid()
892  p = SampledParticle(pid)
893 
894  if self.mass_override and abs(pid) in self.massdict:
895  m = self.massdict[abs(pid)]
896  self.mom.mass = m
897  p.mass = m
898  # TODO: Should the particle generated_mass be set from the sampler by default?
899 
900  p.mom = self.mom()
901  p.pos = self.pos()
902 
903  rtn.append(p)
904  return rtn

Member Data Documentation

◆ _n

python.samplers.ParticleSampler._n
private

Definition at line 883 of file samplers.py.

◆ _pid

python.samplers.ParticleSampler._pid
private

Definition at line 875 of file samplers.py.

◆ mass_override

python.samplers.ParticleSampler.mass_override

Definition at line 864 of file samplers.py.

◆ massdict

python.samplers.ParticleSampler.massdict

Definition at line 863 of file samplers.py.

◆ mom

python.samplers.ParticleSampler.mom

Definition at line 860 of file samplers.py.

◆ n

python.samplers.ParticleSampler.n

Definition at line 861 of file samplers.py.

◆ pid

python.samplers.ParticleSampler.pid

Definition at line 859 of file samplers.py.

◆ pos

python.samplers.ParticleSampler.pos

Definition at line 862 of file samplers.py.


The documentation for this class was generated from the following file:
PosSampler
Definition: Samplers.h:289
SampledParticle
Definition: Samplers.h:740
beamspotman.n
n
Definition: beamspotman.py:731
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.samplers.mksampler
def mksampler(x)
Convenience function for sampler-making from Python literals.
Definition: samplers.py:245
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18