343 TLorentzVector flux_mom_rest = flux.mom;
344 flux_mom_rest.Boost(-flux.kmom.BoostVector());
345 double rest_frame_p = flux_mom_rest.Vect().Mag();
346 double p_lab, costh_rest;
348 p_lab, costh_rest, weight);
351 if (err)
return false;
354 flux.mom.SetVectM(p_lab * (detloc - flux.pos.Vect()).Unit(), flux.mom.M());
357 flux.mom_beamcoord = flux.mom;
358 flux.mom_beamcoord.Boost(-flux.kmom.BoostVector());
359 flux.mom_beamcoord.Boost(flux.kmom_beamcoord.BoostVector());
361 flux.sec = flux.kmom - flux.mom;
362 flux.sec_beamcoord = flux.kmom_beamcoord - flux.mom_beamcoord;
365 std::vector<TVector3> box_intersections =
fBox.
GetIntersections(flux.pos.Vect(), flux.mom.Vect().Unit());
366 TVector3
A = box_intersections.at(0);
367 TVector3 B = box_intersections.at(1);
368 if ((flux.pos.Vect() -
A).Mag() < (flux.pos.Vect() - B).Mag()) {
369 intersection = {
A, B};
372 intersection = {B, A};
376 weight *=
SolidAngle(flux.pos.Vect()) / (4*M_PI);
378 std::cout <<
"From: " << flux.pos.X() <<
" " << flux.pos.Y() <<
" " << flux.pos.Z() << std::endl;
379 std::cout <<
"Solid Angle ratio is: " << (
SolidAngle(flux.pos.Vect()) / (4*M_PI)) << std::endl;
381 std::cout <<
"Kaon 4P: " << flux.kmom.E() <<
" " << flux.kmom.Px() <<
" " << flux.kmom.Py() <<
" " << flux.kmom.Pz() << std::endl;
382 std::cout <<
"Selected Prtl 4P: " << flux.mom.E() <<
" " << flux.mom.Px() <<
" " << flux.mom.Py() <<
" " << flux.mom.Pz() << std::endl;
383 std::cout <<
"Selected Scdy 4P: " << flux.sec.E() <<
" " << flux.sec.Px() <<
" " << flux.sec.Py() <<
" " << flux.sec.Pz() << std::endl;
386 TLorentzVector flux_rest = flux.mom;
387 flux_rest.Boost(-flux.kmom.BoostVector());
388 std::cout <<
"Prtl lab costh: " << costh_rest <<
" " << flux.kmom.Vect().Unit().Dot(flux_rest.Vect().Unit()) << std::endl;
EResult err(const char *call)
TVector3 RandomIntersectionPoint(TVector3 loc)
std::vector< TVector3 > GetIntersections(TVector3 const &TrajectoryStart, TVector3 const &TrajectoryDirect) const
Calculates the entry and exit points of a trajectory on the box surface.
BEGIN_PROLOG could also be cout
double SolidAngle(TVector3 loc)
int calcPrtlRayWgt(double rest_frame_p, double M, TVector3 dir, TVector3 boost, double rand, double &lab_frame_p_out, double &costh_rest_out, double &wgt)