6 #include "art/Framework/Principal/Event.h"
7 #include "art/Framework/Principal/Handle.h"
8 #include "art/Framework/Services/Registry/ServiceHandle.h"
9 #include "art/Persistency/Common/PtrMaker.h"
10 #include "art/Utilities/ToolMacros.h"
11 #include "cetlib/cpu_timer.h"
12 #include "fhiclcpp/ParameterSet.h"
13 #include "messagefacility/MessageLogger/MessageLogger.h"
27 #include "dk2nu/tree/calcLocationWeights.h"
28 #include "dk2nu/tree/dkmeta.h"
29 #include "dk2nu/tree/dk2nu.h"
58 void configure(
const fhicl::ParameterSet&)
override;
97 if (pset.has_key(
"Box")) {
98 std::array<double, 6> box_config = pset.get<std::array<double, 6>>(
"Box");
100 fBox =
geo::BoxBoundedGeo(box_config[0], box_config[1], box_config[2], box_config[3], box_config[4], box_config[5]);
107 std::cout <<
"Detector Box." << std::endl;
178 TVector3
dir(1, 0, 0);
179 TVector3 boost(beta, 0., 0.);
181 double lab_frame_p, costh_rest, weight;
185 throw cet::exception(
"Weighted Ray Trace: Bad max weight calculation.");
194 bool intersect_MinX = loc.X() <
fBox.
MinX();
195 bool intersect_MinY = loc.Y() <
fBox.
MinY();
196 bool intersect_MinZ = loc.Z() <
fBox.
MinZ();
198 bool intersect_MaxX = loc.X() >
fBox.
MaxX();
199 bool intersect_MaxY = loc.Y() >
fBox.
MaxY();
200 bool intersect_MaxZ = loc.Z() >
fBox.
MaxZ();
203 double solid_angleX = 0.;
204 double solid_angleY = 0.;
205 double solid_angleZ = 0.;
208 if (intersect_MinX) {
212 solid_angleX = area *
abs((center-loc).Unit().
X()) / (center-
loc).Mag2();
214 else if (intersect_MaxX) {
218 solid_angleX = area *
abs((center-loc).Unit().
X()) / (center-
loc).Mag2();
221 if (intersect_MinY) {
225 solid_angleY = area *
abs((center-loc).Unit().Y()) / (center-
loc).Mag2();
227 else if (intersect_MaxY) {
231 solid_angleY = area *
abs((center-loc).Unit().Y()) / (center-
loc).Mag2();
234 if (intersect_MinZ) {
238 solid_angleZ = area *
abs((center-loc).Unit().Z()) / (center-
loc).Mag2();
240 else if (intersect_MaxZ) {
244 solid_angleZ = area *
abs((center-loc).Unit().Z()) / (center-
loc).Mag2();
250 bool select_X = rand < solid_angleX / (solid_angleX + solid_angleY + solid_angleZ);
251 bool select_Y = !select_X && (rand < (solid_angleX + solid_angleY) / (solid_angleX + solid_angleY + solid_angleZ));
252 bool select_Z = !select_X && !select_Y;
271 TVector3 ret(X, Y, Z);
277 bool intersect_MinX = loc.X() <
fBox.
MinX();
278 bool intersect_MinY = loc.Y() <
fBox.
MinY();
279 bool intersect_MinZ = loc.Z() <
fBox.
MinZ();
281 bool intersect_MaxX = loc.X() >
fBox.
MaxX();
282 bool intersect_MaxY = loc.Y() >
fBox.
MaxY();
283 bool intersect_MaxZ = loc.Z() >
fBox.
MaxZ();
285 double solid_angle = 0.;
288 if (intersect_MinX) {
292 solid_angle += area *
abs((center-loc).Unit().
X()) / (center-
loc).Mag2();
294 if (intersect_MinY) {
298 solid_angle += area *
abs((center-loc).Unit().Y()) / (center-
loc).Mag2();
300 if (intersect_MinZ) {
304 solid_angle += area *
abs((center-loc).Unit().Z()) / (center-
loc).Mag2();
307 if (intersect_MaxX) {
311 solid_angle += area *
abs((center-loc).Unit().
X()) / (center-
loc).Mag2();
313 if (intersect_MaxY) {
317 solid_angle += area *
abs((center-loc).Unit().Y()) / (center-
loc).Mag2();
319 if (intersect_MaxZ) {
323 solid_angle += area *
abs((center-loc).Unit().Z()) / (center-
loc).Mag2();
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());
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};
378 std::cout <<
"From: " << flux.
pos.X() <<
" " << flux.
pos.Y() <<
" " << flux.
pos.Z() << 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;
TLorentzVector sec_beamcoord
Utilities related to art service access.
double fReferenceLabSolidAngle
const geo::GeometryCore * geometry
double secPDG2Mass(int pdg)
TLorentzVector mom_beamcoord
EResult err(const char *call)
double MinX() const
Returns the world x coordinate of the start of the box.
geo::BoxBoundedGeo DetectorEnclosureBox(std::string const &name="volDetEnclosure") const
double CenterX() const
Returns the world x coordinate of the center of the box.
double CenterZ() const
Returns the world z coordinate of the center of the box.
double twobody_momentum(double parent_mass, double childA_mass, double childB_mass)
double MaxX() const
Returns the world x coordinate of the end of the box.
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo W echo The symbol is a weak symbol that has not been specifically echo tagged as a weak object symbol When a weak defined symbol echo is linked with a normal defined the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo echo The symbol is a stabs symbol in an a out object file In echo this the next values printed are the stabs other echo the stabs desc and the stab type Stabs symbols are echo used to hold debugging information For more echo see *Note or object file format specific echo echo For Mac OS X
Access the description of detector geometry.
void configure(const fhicl::ParameterSet &) override
Interface for configuring the particular algorithm tool.
~WeightedRayTraceBox()
Destructor.
double MinZ() const
Returns the world z coordinate of the start of the box.
WeightedRayTraceBox class definiton.
IMeVPrtlStage interface class definiton. General interface behind each stage. Provides random number ...
Description of geometry of one entire detector.
IRayTrace interface class definiton.
TVector3 RandomIntersectionPoint(TVector3 loc)
double MaxWeight() override
Provides a base class aware of world box coordinates.
double MaxY() const
Returns the world y coordinate of the end of the box.
static const Constants & Instance()
double fReferencePrtlMass
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
double CenterY() const
Returns the world y coordinate of the center of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
std::vector< TVector3 > GetIntersections(TVector3 const &TrajectoryStart, TVector3 const &TrajectoryDirect) const
Calculates the entry and exit points of a trajectory on the box surface.
void CalculateMaxWeight()
This provides an interface for an art tool which ray traces "Prtl" (massive) particles from their pro...
double MinY() const
Returns the world y coordinate of the start of the box.
WeightedRayTraceBox(fhicl::ParameterSet const &pset)
Constructor.
TLorentzVector kmom_beamcoord
double fReferenceKaonEnergy
art framework interface to geometry description
BEGIN_PROLOG could also be cout
double SolidAngle(TVector3 loc)
bool IntersectDetector(MeVPrtlFlux &flux, std::array< TVector3, 2 > &intersection, double &weight) override
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)