File indexing completed on 2025-01-18 09:15:17
0001 #include "Particle.hxx"
0002 #include "ScatteredParticleGen.hxx"
0003 #include "CustomRand.hxx"
0004
0005 #include "TMath.h"
0006
0007 using namespace TMath;
0008
0009 ScatteredParticleGen::ScatteredParticleGen(double mass_in,
0010 double ERange[2],
0011 double ThetaRange[2],
0012 double PhiRange[2])
0013 {
0014 mass = mass_in;
0015 char fname[100] = "ScatteredParticle";
0016 Rand = new CustomRand(fname, ERange, ThetaRange, PhiRange);
0017 ScatteredParticle = new Particle();
0018 }
0019
0020 Particle * ScatteredParticleGen::GetParticle()
0021 {
0022 double theta, phi, E;
0023 double px, py, pz;
0024 double p;
0025
0026 E = Rand->E();
0027 theta = Rand->Theta();
0028 phi = Rand->Phi();
0029
0030 p = Sqrt(E*E - mass*mass);
0031
0032 px = p*Sin(theta)*Cos(phi);
0033 py = p*Sin(theta)*Sin(phi);
0034 pz = p*Cos(theta);
0035
0036 ScatteredParticle->SetPxPyPzE(px,py,pz,E);
0037 return ScatteredParticle;
0038 }