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 ()=default
 
 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 343 of file Samplers.h.

Constructor & Destructor Documentation

◆ ~ParticleSampler()

ParticleSampler::~ParticleSampler ( )
default

◆ ParticleSampler()

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

Definition at line 346 of file Samplers.h.

346  :m_mom(mom), m_pos(PosSampler(0,0,0)), m_pid(pid), m_n( ConstSampler(n)), m_mass_override(true) {
347  // A default dictionary of particle masses (in MeV)
348  m_massdict[22 ] = 0.0; // photon
349  m_massdict[11 ] = 0.5; // electron
350  m_massdict[12 ] = 0.0; // nu_e
351  m_massdict[13 ] = 105.7; // muon
352  m_massdict[14 ] = 0.0; // nu_mu
353  m_massdict[15 ] = 1777.8; // tau
354  m_massdict[16 ] = 0.0; // nu_tau
355  m_massdict[2212] = 938.0; // proton
356  m_massdict[2112] = 940.0; // neutron
357  m_massdict[111 ] = 135.0; // pi0
358  m_massdict[211 ] = 140.0; // pi+-
359  m_massdict[221 ] = 547.0; // eta
360  m_massdict[321 ] = 494.0; // K+-
361  m_massdict[311 ] = 598.0; // K0
362  };

Member Function Documentation

◆ shoot()

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

Definition at line 365 of file Samplers.h.

365  {
366  int numparticles = m_n.shoot();
367  std::cout << "ParticleSampler throwing " << numparticles << " particles" << std::endl;
368  std::vector<SampledParticle> rtn;
369  for (int i=0; i<numparticles ; i++){
370  //Sample the particle ID and create a particle
371  int pid = m_pid->shoot();
372  std::cout << " shot pid=" << pid << std::endl;
374  // Pass mass info to the v4 sampler and set same generated mass
375  if (m_mass_override && m_massdict.find(abs(pid))!=m_massdict.end()){
376  float m = m_massdict[abs(pid)];
377  m_mom->m_mass = new ConstSampler(m);
378  p.m_mass = m;
379  }
380  // Sample momentum and vertex positions into the particle
381  p.m_mom = m_mom->shoot();
382  p.m_pos = m_pos.shoot();
383  std::cout << " (" << p.m_mom.Eta() << ", " << p.m_mom.Phi() << ", " << p.m_mom.E() << ", " << p.m_mom.M() << ")" << std::endl;
384  // Add particle to output list
385  rtn.push_back(p);
386  }
387  return rtn;
388  }

Member Data Documentation

◆ m_mass_override

bool ParticleSampler::m_mass_override {}
private

Definition at line 394 of file Samplers.h.

◆ m_massdict

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

Definition at line 395 of file Samplers.h.

◆ m_mom

MomSampler* ParticleSampler::m_mom {}
private

Definition at line 390 of file Samplers.h.

◆ m_n

ConstSampler ParticleSampler::m_n {}
private

Definition at line 393 of file Samplers.h.

◆ m_pid

Sampler* ParticleSampler::m_pid {}
private

Definition at line 392 of file Samplers.h.

◆ m_pos

PosSampler ParticleSampler::m_pos {}
private

Definition at line 391 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:395
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
MomSampler::shoot
virtual TLorentzVector shoot()
Definition: Samplers.h:41
MomSampler::m_mass
ConstSampler * m_mass
Definition: Samplers.h:43
ParticleSampler::m_mass_override
bool m_mass_override
Definition: Samplers.h:394
Sampler::shoot
virtual float shoot()
Definition: Samplers.h:23
PosSampler::shoot
TLorentzVector shoot()
Definition: Samplers.h:265
ConstSampler
Definition: Samplers.h:29
PosSampler
Definition: Samplers.h:256
ParticleSampler::m_pid
Sampler * m_pid
Definition: Samplers.h:392
SampledParticle
Definition: Samplers.h:328
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:391
ParticleSampler::m_n
ConstSampler m_n
Definition: Samplers.h:393
ParticleSampler::m_mom
MomSampler * m_mom
Definition: Samplers.h:390