ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
ParticleSampler Class Reference

#include <Samplers.h>

Collaboration diagram for ParticleSampler:

Public Member Functions

 ~ParticleSampler ()
 
 ParticleSampler (Sampler *pid, MomSampler *mom, int n=1)
 
std::vector< SampledParticleshoot ()
 

Private Attributes

MomSamplerm_mom
 
PosSampler m_pos
 
Samplerm_pid
 
ConstSampler m_n
 
bool m_mass_override
 
std::map< unsigned int, float > m_massdict
 

Detailed Description

Definition at line 758 of file Samplers.h.

Constructor & Destructor Documentation

◆ ~ParticleSampler()

ParticleSampler::~ParticleSampler ( )
inline

Definition at line 760 of file Samplers.h.

760 {};

◆ ParticleSampler()

ParticleSampler::ParticleSampler ( Sampler pid,
MomSampler mom,
int  n = 1 
)
inline

Definition at line 761 of file Samplers.h.

761  {
762  m_pid = pid;
763  m_mom=mom;
764  m_n = ConstSampler(n);
765  m_pos = PosSampler(0,0,0);
766  // A default dictionary of particle masses (in MeV)
767  m_massdict[22 ] = 0.0; // photon
768  m_massdict[11 ] = 0.5; // electron
769  m_massdict[12 ] = 0.0; // nu_e
770  m_massdict[13 ] = 105.7; // muon
771  m_massdict[14 ] = 0.0; // nu_mu
772  m_massdict[15 ] = 1777.8; // tau
773  m_massdict[16 ] = 0.0; // nu_tau
774  m_massdict[2212] = 938.0; // proton
775  m_massdict[2112] = 940.0; // neutron
776  m_massdict[111 ] = 135.0; // pi0
777  m_massdict[211 ] = 140.0; // pi+-
778  m_massdict[221 ] = 547.0; // eta
779  m_massdict[321 ] = 494.0; // K+-
780  m_massdict[311 ] = 598.0; // K0
781  m_mass_override = true;
782  };

Member Function Documentation

◆ shoot()

std::vector<SampledParticle> ParticleSampler::shoot ( )
inline

Definition at line 785 of file Samplers.h.

785  {
786  int numparticles = m_n.shoot();
787  std::cout << "ParticleSampler throwing " << numparticles << " particles" << std::endl;
788  std::vector<SampledParticle> rtn;
789  for (int i=0; i<numparticles ; i++){
790  //Sample the particle ID and create a particle
791  int pid = m_pid->shoot();
792  std::cout << " shot pid=" << pid << std::endl;
794  // Pass mass info to the v4 sampler and set same generated mass
795  if (m_mass_override && m_massdict.find(abs(pid))!=m_massdict.end()){
796  float m = m_massdict[abs(pid)];
797  m_mom->m_mass = new ConstSampler(m);
798  p.m_mass = m;
799  }
800  // Sample momentum and vertex positions into the particle
801  p.m_mom = m_mom->shoot();
802  p.m_pos = m_pos.shoot();
803  std::cout << " (" << p.m_mom.Eta() << ", " << p.m_mom.Phi() << ", " << p.m_mom.E() << ", " << p.m_mom.M() << ")" << std::endl;
804  // Add particle to output list
805  rtn.push_back(p);
806  }
807  return rtn;
808  }

Member Data Documentation

◆ m_mass_override

bool ParticleSampler::m_mass_override
private

Definition at line 814 of file Samplers.h.

◆ m_massdict

std::map<unsigned int,float> ParticleSampler::m_massdict
private

Definition at line 815 of file Samplers.h.

◆ m_mom

MomSampler* ParticleSampler::m_mom
private

Definition at line 810 of file Samplers.h.

◆ m_n

ConstSampler ParticleSampler::m_n
private

Definition at line 813 of file Samplers.h.

◆ m_pid

Sampler* ParticleSampler::m_pid
private

Definition at line 812 of file Samplers.h.

◆ m_pos

PosSampler ParticleSampler::m_pos
private

Definition at line 811 of file Samplers.h.


The documentation for this class was generated from the following file:
ParticleSampler::m_massdict
std::map< unsigned int, float > m_massdict
Definition: Samplers.h:815
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
MomSampler::shoot
virtual TLorentzVector shoot()
Definition: Samplers.h:42
MomSampler::m_mass
ConstSampler * m_mass
Definition: Samplers.h:44
ParticleSampler::m_mass_override
bool m_mass_override
Definition: Samplers.h:814
Sampler::shoot
virtual float shoot()
Definition: Samplers.h:22
PosSampler::shoot
TLorentzVector shoot()
Definition: Samplers.h:300
ConstSampler
Definition: Samplers.h:29
PosSampler
Definition: Samplers.h:289
ParticleSampler::m_pid
Sampler * m_pid
Definition: Samplers.h:812
SampledParticle
Definition: Samplers.h:740
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
lumiFormat.i
int i
Definition: lumiFormat.py:85
ConstSampler::shoot
virtual float shoot()
Definition: Samplers.h:34
beamspotman.n
n
Definition: beamspotman.py:731
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
ParticleSampler::m_pos
PosSampler m_pos
Definition: Samplers.h:811
ParticleSampler::m_n
ConstSampler m_n
Definition: Samplers.h:813
ParticleSampler::m_mom
MomSampler * m_mom
Definition: Samplers.h:810