11#include "TLorentzVector.h"
71 assert(low == fabs(low) && high == fabs(high));
102 for (
unsigned int i=0; i<ranges.size();) {
103 std::pair<float,float> p(ranges[i],ranges[i+1]);
114 for (
unsigned int i=0; i<
m_ranges.size(); i++) {
117 float runningwidth = 0.0;
119 for (
unsigned int i=0; i<
m_ranges.size(); i++) {
125 for (
unsigned int i=0; i<
m_ranges.size(); i++)
130 assert(
x >= 0 &&
x <= 1);
131 unsigned int idx = -1, rem = 0;
132 for (
unsigned int i=0; i<
m_divisions.size()-1; i++)
164 float logval = rand * TMath::Log(
m_high) + (1 - rand) * TMath::Log(
m_low);
165 float val = TMath::Exp(logval);
193 std::cout <<
"Initializing CyclicSeqSampler..." << std::endl;
194 while ((pos = s.find(
',')) != std::string::npos) {
195 token = s.substr(0, pos);
198 std::cout <<
" adding " <<
m_sequence[
m_sequence.size()-1] <<
" from " << token.c_str() << std::endl;
268 float x =
m_x.shoot();
269 float y =
m_y.shoot();
270 float z =
m_z.shoot();
271 float t =
m_t.shoot();
272 return TLorentzVector(
x,
y,
z, t);
286 return TLorentzVector(0, 0, 0,
m_mass->shoot());
298 PtEtaMPhiSampler(
float ptmin,
float ptmax,
float etamin,
float etamax,
float mass=0.0,
float phimin=0,
float phimax=2.*TMath::Pi()){
316 float pt =
m_pt->shoot();
318 float m =
m_mass->shoot();
319 TLorentzVector tlv; tlv.SetPtEtaPhiM(pt,
eta,
phi,m);
333 SampledParticle(
int pid=0, TLorentzVector mom=TLorentzVector(0,0,0,0), TLorentzVector pos= TLorentzVector(0,0,0,0)) :
367 std::vector<SampledParticle>
shoot() {
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++){
373 int pid =
m_pid->shoot();
374 std::cout <<
" shot pid=" << pid << std::endl;
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;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
A number of constexpr particle constants to avoid hardcoding them directly in various places.
CyclicSeqSampler(std::string s)
std::vector< int > m_sequence
CyclicSeqSampler(const CyclicSeqSampler &orig)
GaussianSampler(float mean, float sigma)
LogSampler(float low, float high)
virtual TLorentzVector shoot()
NullMomSampler(float mass=0.0)
ParticleSampler(Sampler *pid, MomSampler *mom, int n=1)
std::map< unsigned int, float > m_massdict
~ParticleSampler()=default
std::vector< SampledParticle > shoot()
PosSampler(float x, float y, float z, float t=0)
PtEtaMPhiSampler & operator=(const PtEtaMPhiSampler &other)=delete
PtEtaMPhiSampler(const PtEtaMPhiSampler &other)=delete
PtEtaMPhiSampler(float ptmin, float ptmax, float etamin, float etamax, float mass=0.0, float phimin=0, float phimax=2.*TMath::Pi())
SampledParticle(int pid=0, TLorentzVector mom=TLorentzVector(0, 0, 0, 0), TLorentzVector pos=TLorentzVector(0, 0, 0, 0))
virtual ~Sampler()=default
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
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