8using namespace boost::math::tools;
22 double pmax=std::sqrt(2+2*std::sqrt(1+
m_A*
m_A))/
m_A;
37 return p*p*exp(-
m_A*p*p/(1+std::sqrt(1+p*p)));
42 return exp(-
m_A*p*p/(1+std::sqrt(1+p*p)))*p*(2-
m_A*p*p/std::sqrt(1+p*p));
57 double U(0.0), V(0.0), X(0.0), Y(0.0), E(0.0);
64 U = ((double) rand() / RAND_MAX);
65 V = ((double) rand() / RAND_MAX);
78 if(V<exp(E)*
f(X)/
f(
m_p_m) && X>0){
85 if(V < exp(E)*
f(X)/
f(
m_p_m) && X>0){
98 phi = 2.0*
M_PI*((double) rand() / RAND_MAX);
99 theta = acos(2.0*((
double) rand() / RAND_MAX)-1.0);
103 en = std::sqrt(p*p+(this->
m_m)*(this->
m_m));
115 for(
unsigned n = 0; n<
event.size();n++){
116 p2 =
event[n].px()*
event[n].px() +
event[n].py()*
event[n].py() +
event[n].pz()*
event[n].pz();
125 vector< Vec4 > event;
129 while(sum_E<(this->
m_Etot)){
131 sum_E += (
event.back()).e();
135 int len =
event.size();
136 double sum_p, correction;
137 for(
int i = 1;i<4;i++){
140 for(
int n=0;n<len;n++){
143 correction=-1.0*sum_p/len;
145 for(
int n=0;n<len;n++){
146 event[n][i] += correction;
162 }
catch (std::exception &e) {
164 std::cout <<
"[SUEP_SHOWER] WARNING: Failed to rebalance the following event; Printing for debug and throw exception" << std::endl;
165 std::cout << e.what() << std::endl;
166 std::cout <<
"N. Particle, px, py, pz, E" << std::endl;
167 for (
size_t jj=0; jj <
event.size(); jj++) {
169 std::cout << jj <<
": " <<
event[jj].px() <<
", " <<
event[jj].py() <<
", " <<
event[jj].pz() <<
", " <<
event[jj].e() << std::endl;
174 for(
int n=0;n<len;n++){
175 event[n].px(p_scale*event[n].px());
176 event[n].py(p_scale*event[n].py());
177 event[n].pz(p_scale*event[n].pz());
179 event[n].e(std::sqrt(event[n].px()*event[n].px() + event[n].py()*event[n].py() + event[n].pz()*event[n].pz() + (this->
m_m)*(this->
m_m)));
Scalar phi() const
phi method
Scalar theta() const
theta method
Suep_shower(double mass, double temperature, double energy, Pythia8::Rndm *rndm=0)
Constructor.
double test_fun(double p)
Test function to be solved for p_plus,p_minus.
double m_p_m
convenience function of mass/Temperature ratio
double fp(double p)
Derivative of Maxwell-Boltzmann.
double m_q_plus
solutions for shower generation.
Pythia8::Vec4 generateFourVector()
generate one random 4 vector from the thermal distribution
double m_m
Mass of the dark mesons to be generated in the shower.
Pythia8::Rndm * m_rndmEngine
Random number generator, if not provided will use rand()
double m_p_plus
solutions for shower generation.
double f(double p)
Maxwell-Boltzman distribution, slightly massaged.
double m_Etot
Total energy of the system.
double m_Temp
Temperature parameter.
double m_lambda_plus
solutions in Lambda for shower generation
std::vector< Pythia8::Vec4 > generate_shower()
Generate a shower event, in the rest frame of the showe.
double reballance_func(double a, const std::vector< Pythia8::Vec4 > &event)
auxiliary function which computes the total energy difference as a function of the momentum vectors a...
double m_A
mass/Temperature ratio
Author: James Monk (jmonk@cern.ch)