//............................. // state_t class state_t{ public: float3 pos; float3 mom; // normalized float q_over_p; float mass; }; //---------------- // MakeStateThetaPhi //---------------- inline state_t MakeStateThetaPhi(float theta, float phi, float p, float x, float y, float z, float q) { state_t S; float px = sin(theta)*cos(phi); float py = sin(theta)*sin(phi); float pz = cos(theta); S.mom = make_float3(px, py, pz); S.pos = make_float3(x, y, z); S.q_over_p = q/p; S.mass = 0.0; return S; } //---------------- // MakeStateXYZ //---------------- inline state_t MakeStateXYZ(float px, float py, float pz, float x, float y, float z, float q) { state_t S; float p = sqrt(px*px + py*py + pz*pz); px /= p; py /= p; pz /= p; S.mom = make_float3(px, py, pz); S.pos = make_float3(x, y, z); S.q_over_p = q/p; S.mass = 0.0; return S; }