ATLAS Offline Software
Loading...
Searching...
No Matches
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 345 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 348 of file Samplers.h.

348 :m_mom(mom), m_pos(PosSampler(0,0,0)), m_pid(pid), m_n( ConstSampler(n)), m_mass_override(true) {
349 // A default dictionary of particle masses (in MeV)
364 };
MomSampler * m_mom
Definition Samplers.h:392
std::map< unsigned int, float > m_massdict
Definition Samplers.h:397
ConstSampler m_n
Definition Samplers.h:395
bool m_mass_override
Definition Samplers.h:396
Sampler * m_pid
Definition Samplers.h:394
PosSampler m_pos
Definition Samplers.h:393
constexpr double etaMassInMeV
the mass of the eta meson (in MeV)
constexpr double muonMassInMeV
the mass of the muon (in MeV)
constexpr double chargedKaonMassInMeV
the mass of the charged kaon (in MeV)
constexpr double protonMassInMeV
the mass of the proton (in MeV)
constexpr double tauMassInMeV
the mass of the tau (in MeV)
constexpr double KZeroMassInMeV
the mass of the neutral kaon (K0) (in MeV)
constexpr double chargedPionMassInMeV
the mass of the charged pion (in MeV)
constexpr double electronMassInMeV
the mass of the electron (in MeV)
constexpr double piZeroMassInMeV
the mass of the pi zero (in MeV)
constexpr double neutronMassInMeV
the mass of the neutron (in MeV)
constexpr double photonMassInMeV
various mass-less particles
constexpr double electronNeutrinoMassInMeV
constexpr double tauNeutrinoMassInMeV
constexpr double muonNeutrinoMassInMeV

Member Function Documentation

◆ shoot()

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

Definition at line 367 of file Samplers.h.

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

Member Data Documentation

◆ m_mass_override

bool ParticleSampler::m_mass_override {}
private

Definition at line 396 of file Samplers.h.

396{};

◆ m_massdict

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

Definition at line 397 of file Samplers.h.

◆ m_mom

MomSampler* ParticleSampler::m_mom {}
private

Definition at line 392 of file Samplers.h.

392{};

◆ m_n

ConstSampler ParticleSampler::m_n {}
private

Definition at line 395 of file Samplers.h.

395{};

◆ m_pid

Sampler* ParticleSampler::m_pid {}
private

Definition at line 394 of file Samplers.h.

394{};

◆ m_pos

PosSampler ParticleSampler::m_pos {}
private

Definition at line 393 of file Samplers.h.

393{};

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