diff --git a/CMakeLists.txt b/CMakeLists.txt index c1f1a4a3..6b24256a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ add_subdirectory(projects/math) add_subdirectory(projects/dataclasses) add_subdirectory(projects/geometry) add_subdirectory(projects/detector) -add_subdirectory(projects/crosssections) +add_subdirectory(projects/interactions) add_subdirectory(projects/distributions) add_subdirectory(projects/injection) @@ -98,7 +98,7 @@ target_link_libraries(LeptonInjector LI_dataclasses LI_geometry LI_detector - LI_crosssections + LI_interactions LI_distributions LI_injection ) @@ -114,7 +114,7 @@ target_link_libraries(LeptonInjector LI_dataclasses LI_geometry LI_detector - LI_crosssections + LI_interactions LI_distributions LI_injection ) @@ -136,7 +136,7 @@ if(DEFINED SKBUILD) LI_dataclasses LI_geometry LI_detector - LI_crosssections + LI_interactions LI_distributions LI_injection EXPORT ${PROJECT_NAME}Config @@ -151,7 +151,7 @@ if(DEFINED SKBUILD) LI_dataclasses LI_geometry LI_detector - LI_crosssections + LI_interactions LI_distributions LI_injection EXPORT ${PROJECT_NAME}Config @@ -167,7 +167,7 @@ else() LI_dataclasses LI_geometry LI_detector - LI_crosssections + LI_interactions LI_distributions LI_injection EXPORT ${PROJECT_NAME}Config @@ -213,7 +213,7 @@ if(DEFINED SKBUILD) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector) install(TARGETS detector LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector) - install(TARGETS crosssections + install(TARGETS interactions LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector) install(TARGETS distributions LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector) diff --git a/projects/crosssections/CMakeLists.txt b/projects/crosssections/CMakeLists.txt deleted file mode 100644 index 3976bf2e..00000000 --- a/projects/crosssections/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ - -#core files -LIST (APPEND crosssections_SOURCES - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/Decay.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/CrossSection.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/CrossSectionCollection.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/DipoleFromTable.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/DarkNewsCrossSection.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/DarkNewsDecay.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/NeutrissimoDecay.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/DISFromSpline.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/HNLFromSpline.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/ElasticScattering.cxx - ${PROJECT_SOURCE_DIR}/projects/crosssections/private/DummyCrossSection.cxx -) -add_library(LI_crosssections OBJECT ${crosssections_SOURCES}) -set_property(TARGET LI_crosssections PROPERTY POSITION_INDEPENDENT_CODE ON) -target_include_directories(LI_crosssections PUBLIC - $ - $ -) - -target_link_libraries(LI_crosssections - PRIVATE - $ - pybind11::embed - PUBLIC - photospline - LI_serialization - LI_utilities - LI_math - LI_dataclasses - LI_detector -) - -install(DIRECTORY "${PROJECT_SOURCE_DIR}/projects/crosssections/public/" - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - FILES_MATCHING - PATTERN "*.h" - PATTERN "*.tcc" -) - -package_add_test(UnitTest_DISFromSpline ${PROJECT_SOURCE_DIR}/projects/crosssections/private/test/DISFromSpline_TEST.cxx) -package_add_test(UnitTest_DipoleFromTable ${PROJECT_SOURCE_DIR}/projects/crosssections/private/test/DipoleFromTable_TEST.cxx) -#package_add_test(UnitTest_ElasticScattering ${PROJECT_SOURCE_DIR}/projects/crosssections/private/test/ElasticScattering_TEST.cxx) - -pybind11_add_module(crosssections ${PROJECT_SOURCE_DIR}/projects/crosssections/private/pybindings/crosssections.cxx) -target_link_libraries(crosssections PRIVATE LeptonInjector photospline rk_static pybind11::embed) -pybind11_add_module(pyDarkNewsSerializer ${PROJECT_SOURCE_DIR}/projects/crosssections/private/pybindings/pyDarkNewsSerializer.cxx) -target_link_libraries(pyDarkNewsSerializer PRIVATE LeptonInjector photospline rk_static pybind11::embed) -if(DEFINED SKBUILD) -set_target_properties(crosssections PROPERTIES - BUILD_WITH_INSTALL_RPATH FALSE - LINK_FLAGS "-Wl,-rpath,$ORIGIN/../leptoninjector.libs/") -endif() diff --git a/projects/crosssections/private/pybindings/CrossSectionCollection.h b/projects/crosssections/private/pybindings/CrossSectionCollection.h deleted file mode 100644 index 0daedefd..00000000 --- a/projects/crosssections/private/pybindings/CrossSectionCollection.h +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include - -#include -#include -#include - -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/CrossSectionCollection.h" -#include "../../public/LeptonInjector/crosssections/Decay.h" -#include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" -#include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" -#include "../../../utilities/public/LeptonInjector/utilities/Random.h" - -void register_CrossSectionCollection(pybind11::module_ & m) { - using namespace pybind11; - using namespace LI::crosssections; - - class_>(m, "CrossSectionCollection") - .def(init<>()) - .def(init>>()) - .def(init>>()) - .def(init>, std::vector>>()) - .def(self == self) - .def("GetDecays",&CrossSectionCollection::GetDecays) - .def("HasCrossSections",&CrossSectionCollection::HasCrossSections) - .def("HasDecays",&CrossSectionCollection::HasDecays) - .def("GetCrossSectionsForTarget",&CrossSectionCollection::GetCrossSectionsForTarget) - .def("GetCrossSectionsByTarget",&CrossSectionCollection::GetCrossSectionsByTarget) - .def("TargetTypes",&CrossSectionCollection::TargetTypes) - .def("TotalDecayWidth",&CrossSectionCollection::TotalDecayWidth) - .def("TotalDecayLength",&CrossSectionCollection::TotalDecayLength) - .def("MatchesPrimary",&CrossSectionCollection::MatchesPrimary) - ; -} diff --git a/projects/detector/CMakeLists.txt b/projects/detector/CMakeLists.txt index 86af2dd8..7114de60 100644 --- a/projects/detector/CMakeLists.txt +++ b/projects/detector/CMakeLists.txt @@ -13,7 +13,7 @@ LIST (APPEND detector_SOURCES ${PROJECT_SOURCE_DIR}/projects/detector/private/ExponentialDistribution1D.cxx ${PROJECT_SOURCE_DIR}/projects/detector/private/DensityDistribution.cxx - ${PROJECT_SOURCE_DIR}/projects/detector/private/EarthModel.cxx + ${PROJECT_SOURCE_DIR}/projects/detector/private/DetectorModel.cxx ${PROJECT_SOURCE_DIR}/projects/detector/private/MaterialModel.cxx ${PROJECT_SOURCE_DIR}/projects/detector/private/Path.cxx ) @@ -46,7 +46,7 @@ install(DIRECTORY "${PROJECT_SOURCE_DIR}/projects/detector/public/" package_add_test(UnitTest_Axis ${PROJECT_SOURCE_DIR}/projects/detector/private/test/Axis_TEST.cxx) package_add_test(UnitTest_DensityDistribution ${PROJECT_SOURCE_DIR}/projects/detector/private/test/DensityDistribution_TEST.cxx) package_add_test(UnitTest_Distribution1D ${PROJECT_SOURCE_DIR}/projects/detector/private/test/Distribution1D_TEST.cxx) -package_add_test(UnitTest_EarthModel ${PROJECT_SOURCE_DIR}/projects/detector/private/test/EarthModel_TEST.cxx) +package_add_test(UnitTest_DetectorModel ${PROJECT_SOURCE_DIR}/projects/detector/private/test/DetectorModel_TEST.cxx) package_add_test(UnitTest_MaterialModel ${PROJECT_SOURCE_DIR}/projects/detector/private/test/MaterialModel_TEST.cxx) package_add_test(UnitTest_Path ${PROJECT_SOURCE_DIR}/projects/detector/private/test/Path_TEST.cxx) diff --git a/projects/detector/private/EarthModel.cxx b/projects/detector/private/DetectorModel.cxx similarity index 87% rename from projects/detector/private/EarthModel.cxx rename to projects/detector/private/DetectorModel.cxx index 99e2605e..26f1025e 100644 --- a/projects/detector/private/EarthModel.cxx +++ b/projects/detector/private/DetectorModel.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include #include @@ -104,12 +104,12 @@ class accumulator { }; } -bool EarthSector::operator==(EarthSector const & o) const { +bool DetectorSector::operator==(DetectorSector const & o) const { return name == o.name and material_id == o.material_id and level == o.level and geo == o.geo and density == o.density; } -std::ostream & EarthSector::Print(std::ostream& oss) const { - oss << "[EarthSector:\n" +std::ostream & DetectorSector::Print(std::ostream& oss) const { + oss << "[DetectorSector:\n" << " Name : " << name << '\n' << " MaterialID : " << material_id << '\n' << " Level : " << level << '\n' @@ -118,73 +118,73 @@ std::ostream & EarthSector::Print(std::ostream& oss) const { return oss; } -std::ostream& operator<<(std::ostream& oss, EarthSector const & bcm) { +std::ostream& operator<<(std::ostream& oss, DetectorSector const & bcm) { return(bcm.Print(oss)); } -std::ostream& operator<<(std::ostream& oss, EarthSector & bcm) { +std::ostream& operator<<(std::ostream& oss, DetectorSector & bcm) { return(bcm.Print(oss)); } -EarthModel::EarthModel() { +DetectorModel::DetectorModel() { LoadDefaultMaterials(); LoadDefaultSectors(); } -EarthModel::EarthModel(std::string const & earth_model, std::string const & material_model) { +DetectorModel::DetectorModel(std::string const & earth_model, std::string const & material_model) { LoadDefaultMaterials(); LoadDefaultSectors(); LoadMaterialModel(material_model); - LoadEarthModel(earth_model); + LoadDetectorModel(earth_model); } -EarthModel::EarthModel(std::string const & path, std::string const & earth_model, std::string const & material_model) : path_(path) { +DetectorModel::DetectorModel(std::string const & path, std::string const & earth_model, std::string const & material_model) : path_(path) { LoadDefaultMaterials(); LoadDefaultSectors(); LoadMaterialModel(material_model); - LoadEarthModel(earth_model); + LoadDetectorModel(earth_model); } -bool EarthModel::operator==(EarthModel const & o) const { +bool DetectorModel::operator==(DetectorModel const & o) const { return std::tie(materials_, sectors_, sector_map_, detector_origin_) == std::tie(o.materials_, o.sectors_, o.sector_map_, o.detector_origin_); } -std::string EarthModel::GetPath() const { +std::string DetectorModel::GetPath() const { return path_; } -void EarthModel::SetPath(std::string const & path) { +void DetectorModel::SetPath(std::string const & path) { path_ = path; } -MaterialModel const & EarthModel::GetMaterials() const { +MaterialModel const & DetectorModel::GetMaterials() const { return materials_; } -void EarthModel::SetMaterials(MaterialModel const & materials) { +void DetectorModel::SetMaterials(MaterialModel const & materials) { materials_ = materials; } -std::vector const & EarthModel::GetSectors() const { +std::vector const & DetectorModel::GetSectors() const { return sectors_; } -void EarthModel::SetSectors(std::vector const & sectors) { +void DetectorModel::SetSectors(std::vector const & sectors) { sectors_ = sectors; } -Vector3D EarthModel::GetDetectorOrigin() const { +Vector3D DetectorModel::GetDetectorOrigin() const { return detector_origin_; } -void EarthModel::SetDetectorOrigin(Vector3D const & detector_origin) { +void DetectorModel::SetDetectorOrigin(Vector3D const & detector_origin) { detector_origin_ = detector_origin; } -void EarthModel::AddSector(EarthSector sector) { +void DetectorModel::AddSector(DetectorSector sector) { if(sector_map_.count(sector.level) > 0) { throw(std::runtime_error("Already have a sector of that heirarchy!")); } @@ -194,7 +194,7 @@ void EarthModel::AddSector(EarthSector sector) { } } -EarthSector EarthModel::GetSector(int heirarchy) const { +DetectorSector DetectorModel::GetSector(int heirarchy) const { auto const iter = sector_map_.find(heirarchy); assert(iter != sector_map_.end()); unsigned int index = sector_map_.at(heirarchy); @@ -204,7 +204,7 @@ EarthSector EarthModel::GetSector(int heirarchy) const { return sectors_[index]; } -void EarthModel::ClearSectors() { +void DetectorModel::ClearSectors() { sectors_.clear(); sector_map_.clear(); } @@ -217,7 +217,7 @@ bool fexists(const std::string filename) } } -void EarthModel::LoadEarthModel(std::string const & earth_model) { +void DetectorModel::LoadDetectorModel(std::string const & earth_model) { if(earth_model.empty()) throw(std::runtime_error("Received empty earth model filename!")); @@ -287,7 +287,7 @@ void EarthModel::LoadEarthModel(std::string const & earth_model) { ss >> type; if(type.find("object") != std::string::npos) { - EarthSector sector; + DetectorSector sector; sector.level = level; level += 1; double xc, yc, zc; // Coordinates of the center of the shape @@ -411,7 +411,7 @@ void EarthModel::LoadEarthModel(std::string const & earth_model) { in.close(); } -void EarthModel::LoadDefaultMaterials() { +void DetectorModel::LoadDefaultMaterials() { // Interstellar medium mass composition from // https://arxiv.org/abs/astro-ph/0106359 // Limited information exists for Z > 2 @@ -429,8 +429,8 @@ void EarthModel::LoadDefaultMaterials() { ); // Assume there are 1 neutrons for every 7 protons in the universe } -void EarthModel::LoadDefaultSectors() { - EarthSector sector; +void DetectorModel::LoadDefaultSectors() { + DetectorSector sector; sector.material_id = materials_.GetMaterialId("VACUUM"); sector.level = std::numeric_limits::min(); sector.geo = Sphere(std::numeric_limits::infinity(), 0).create(); @@ -438,13 +438,13 @@ void EarthModel::LoadDefaultSectors() { AddSector(sector); } -void EarthModel::LoadMaterialModel(std::string const & material_model) { +void DetectorModel::LoadMaterialModel(std::string const & material_model) { materials_.SetPath(path_); materials_.AddModelFile(material_model); } -double EarthModel::GetMassDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0) const { +double DetectorModel::GetMassDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0) const { Vector3D direction = p0 - intersections.position; if(direction.magnitude() == 0) { direction = intersections.direction; @@ -469,7 +469,7 @@ double EarthModel::GetMassDensity(Geometry::IntersectionList const & intersectio // whereas the lower end is bounded by the end of the last line segment, and the entry into the sector double start_point = std::max(offset + dot * current_intersection->distance, offset + dot * last_point); if(start_point <= 0 and end_point >= 0) { - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); density = sector.density->Evaluate(p0); return true; } else { @@ -484,13 +484,13 @@ double EarthModel::GetMassDensity(Geometry::IntersectionList const & intersectio return density; } -double EarthModel::GetMassDensity(Vector3D const & p0) const { +double DetectorModel::GetMassDensity(Vector3D const & p0) const { Vector3D direction(1,0,0); // Any direction will work for determining the sector heirarchy Geometry::IntersectionList intersections = GetIntersections(p0, direction); return GetMassDensity(intersections, p0); } -double EarthModel::GetParticleDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0, LI::dataclasses::Particle::ParticleType target) const { +double DetectorModel::GetParticleDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0, LI::dataclasses::Particle::ParticleType target) const { Vector3D direction = p0 - intersections.position; if(direction.magnitude() == 0) { direction = intersections.direction; @@ -515,7 +515,7 @@ double EarthModel::GetParticleDensity(Geometry::IntersectionList const & interse // whereas the lower end is bounded by the end of the last line segment, and the entry into the sector double start_point = std::max(offset + dot * current_intersection->distance, offset + dot * last_point); if(start_point <= 0 and end_point >= 0) { - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); density = sector.density->Evaluate(p0); density *= materials_.GetTargetParticleFraction(sector.material_id, target); return true; @@ -531,13 +531,13 @@ double EarthModel::GetParticleDensity(Geometry::IntersectionList const & interse return density; } -double EarthModel::GetParticleDensity(Vector3D const & p0, LI::dataclasses::Particle::ParticleType target) const { +double DetectorModel::GetParticleDensity(Vector3D const & p0, LI::dataclasses::Particle::ParticleType target) const { Vector3D direction(1,0,0); // Any direction will work for determining the sector heirarchy Geometry::IntersectionList intersections = GetIntersections(p0, direction); return GetParticleDensity(intersections, p0, target); } -double EarthModel::GetInteractionDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0, +double DetectorModel::GetInteractionDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0, std::vector const & targets, std::vector const & total_cross_sections, double const & total_decay_length) const { @@ -572,7 +572,7 @@ double EarthModel::GetInteractionDensity(Geometry::IntersectionList const & inte // whereas the lower end is bounded by the end of the last line segment, and the entry into the sector double start_point = std::max(offset + dot * current_intersection->distance, offset + dot * last_point); if(start_point <= 0 and end_point >= 0) { - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); double density = sector.density->Evaluate(p0); std::vector particle_fractions = materials_.GetTargetParticleFraction(sector.material_id, targets.begin(), targets.end()); interaction_density = 0.0; @@ -595,7 +595,7 @@ double EarthModel::GetInteractionDensity(Geometry::IntersectionList const & inte return interaction_density; } -double EarthModel::GetInteractionDensity(Vector3D const & p0, +double DetectorModel::GetInteractionDensity(Vector3D const & p0, std::vector const & targets, std::vector const & total_cross_sections, double const & total_decay_length) const { @@ -604,7 +604,7 @@ double EarthModel::GetInteractionDensity(Vector3D const & p0, return GetInteractionDensity(intersections, p0, targets, total_cross_sections, total_decay_length); } -double EarthModel::GetColumnDepthInCGS(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & p1) const { +double DetectorModel::GetColumnDepthInCGS(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & p1) const { if(p0 == p1) { return 0.0; } @@ -635,7 +635,7 @@ double EarthModel::GetColumnDepthInCGS(Geometry::IntersectionList const & inters double start_point = std::max(std::max(offset + dot * current_intersection->distance, 0.0), offset + dot * last_point); if(end_point > 0) { double segment_length = end_point - start_point; - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); double integral = sector.density->Integral(p0+start_point*direction, direction, segment_length); column_depth += integral; } @@ -649,7 +649,7 @@ double EarthModel::GetColumnDepthInCGS(Geometry::IntersectionList const & inters return column_depth * 100; } -double EarthModel::GetColumnDepthInCGS(Vector3D const & p0, Vector3D const & p1) const { +double DetectorModel::GetColumnDepthInCGS(Vector3D const & p0, Vector3D const & p1) const { if(p0 == p1) { return 0.0; } @@ -664,7 +664,7 @@ double EarthModel::GetColumnDepthInCGS(Vector3D const & p0, Vector3D const & p1) return GetColumnDepthInCGS(intersections, p0, p1); } -double EarthModel::DistanceForColumnDepthFromPoint(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & dir, double column_depth) const { +double DetectorModel::DistanceForColumnDepthFromPoint(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & dir, double column_depth) const { Vector3D direction = dir; column_depth /= 100; bool flip = column_depth < 0; @@ -694,7 +694,7 @@ double EarthModel::DistanceForColumnDepthFromPoint(Geometry::IntersectionList co // whereas the lower end is bounded by the global start point, the end of the last line segment, and the entry into the sector double start_point = std::max(std::max(offset + dot * current_intersection->distance, 0.0), offset + dot * last_point); double segment_length = end_point - start_point; - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); double target = column_depth - total_column_depth; double distance = sector.density->InverseIntegral(p0+start_point*direction, direction, target, segment_length); @@ -720,20 +720,20 @@ double EarthModel::DistanceForColumnDepthFromPoint(Geometry::IntersectionList co return total_distance; } -double EarthModel::DistanceForColumnDepthFromPoint(Vector3D const & p0, Vector3D const & direction, double column_depth) const { +double DetectorModel::DistanceForColumnDepthFromPoint(Vector3D const & p0, Vector3D const & direction, double column_depth) const { Geometry::IntersectionList intersections = GetIntersections(p0, direction); return DistanceForColumnDepthFromPoint(intersections, p0, direction, column_depth); } -double EarthModel::DistanceForColumnDepthToPoint(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & direction, double column_depth) const { +double DetectorModel::DistanceForColumnDepthToPoint(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & direction, double column_depth) const { return DistanceForColumnDepthFromPoint(intersections, p0, -direction, column_depth); } -double EarthModel::DistanceForColumnDepthToPoint(Vector3D const & p0, Vector3D const & direction, double column_depth) const { +double DetectorModel::DistanceForColumnDepthToPoint(Vector3D const & p0, Vector3D const & direction, double column_depth) const { return DistanceForColumnDepthFromPoint(p0, -direction, column_depth); } -double EarthModel::GetMassDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0, std::set targets) const { +double DetectorModel::GetMassDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0, std::set targets) const { Vector3D direction = p0 - intersections.position; if(direction.magnitude() == 0) { direction = intersections.direction; @@ -758,7 +758,7 @@ double EarthModel::GetMassDensity(Geometry::IntersectionList const & intersectio // whereas the lower end is bounded by the end of the last line segment, and the entry into the sector double start_point = std::max(offset + dot * current_intersection->distance, offset + dot * last_point); if(start_point <= 0 and end_point >= 0) { - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); density = sector.density->Evaluate(p0); std::vector mass_fractions = materials_.GetTargetMassFraction(sector.material_id, targets.begin(), targets.end()); density *= std::accumulate(mass_fractions.begin(), mass_fractions.end(), 0.0); @@ -775,13 +775,13 @@ double EarthModel::GetMassDensity(Geometry::IntersectionList const & intersectio return density; } -double EarthModel::GetMassDensity(Vector3D const & p0, std::set targets) const { +double DetectorModel::GetMassDensity(Vector3D const & p0, std::set targets) const { Vector3D direction(1,0,0); // Any direction will work for determining the sector heirarchy Geometry::IntersectionList intersections = GetIntersections(p0, direction); return GetMassDensity(intersections, p0, targets); } -std::vector EarthModel::GetParticleDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0, std::set targets) const { +std::vector DetectorModel::GetParticleDensity(Geometry::IntersectionList const & intersections, Vector3D const & p0, std::set targets) const { Vector3D direction = p0 - intersections.position; if(direction.magnitude() == 0) { direction = intersections.direction; @@ -807,7 +807,7 @@ std::vector EarthModel::GetParticleDensity(Geometry::IntersectionList co // whereas the lower end is bounded by the end of the last line segment, and the entry into the sector double start_point = std::max(offset + dot * current_intersection->distance, offset + dot * last_point); if(start_point <= 0 and end_point >= 0) { - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); density = sector.density->Evaluate(p0); particle_fractions = materials_.GetTargetParticleFraction(sector.material_id, targets.begin(), targets.end()); return true; @@ -827,13 +827,13 @@ std::vector EarthModel::GetParticleDensity(Geometry::IntersectionList co return particle_fractions; } -std::vector EarthModel::GetParticleDensity(Vector3D const & p0, std::set targets) const { +std::vector DetectorModel::GetParticleDensity(Vector3D const & p0, std::set targets) const { Vector3D direction(1,0,0); // Any direction will work for determining the sector heirarchy Geometry::IntersectionList intersections = GetIntersections(p0, direction); return GetParticleDensity(intersections, p0, targets); } -double EarthModel::GetInteractionDepthInCGS(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & p1, +double DetectorModel::GetInteractionDepthInCGS(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & p1, std::vector const & targets, std::vector const & total_cross_sections, double const & total_decay_length) const { @@ -872,7 +872,7 @@ double EarthModel::GetInteractionDepthInCGS(Geometry::IntersectionList const & i double start_point = std::max(std::max(offset + dot * current_intersection->distance, 0.0), offset + dot * last_point); if(end_point > 0) { double segment_length = end_point - start_point; - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); double integral = sector.density->Integral(p0+start_point*direction, direction, segment_length); std::vector particle_fractions = materials_.GetTargetParticleFraction(sector.material_id, targets.begin(), targets.end()); @@ -898,7 +898,7 @@ double EarthModel::GetInteractionDepthInCGS(Geometry::IntersectionList const & i return interaction_depth; } -std::vector EarthModel::GetParticleColumnDepth(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & p1, std::vector const & targets) const { +std::vector DetectorModel::GetParticleColumnDepth(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & p1, std::vector const & targets) const { if(p0 == p1) { return std::vector(targets.size(), 0.0); } @@ -930,7 +930,7 @@ std::vector EarthModel::GetParticleColumnDepth(Geometry::IntersectionLis double start_point = std::max(std::max(offset + dot * current_intersection->distance, 0.0), offset + dot * last_point); if(end_point > 0) { double segment_length = end_point - start_point; - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); double integral = sector.density->Integral(p0+start_point*direction, direction, segment_length); std::vector particle_fractions = materials_.GetTargetParticleFraction(sector.material_id, targets.begin(), targets.end()); for(unsigned int i=0; i EarthModel::GetParticleColumnDepth(Geometry::IntersectionLis return target_counts; } -double EarthModel::GetInteractionDepthInCGS(Vector3D const & p0, Vector3D const & p1, +double DetectorModel::GetInteractionDepthInCGS(Vector3D const & p0, Vector3D const & p1, std::vector const & targets, std::vector const & total_cross_sections, double const & total_decay_length) const { @@ -965,7 +965,7 @@ double EarthModel::GetInteractionDepthInCGS(Vector3D const & p0, Vector3D const return GetInteractionDepthInCGS(intersections, p0, p1, targets, total_cross_sections, total_decay_length); } -EarthSector EarthModel::GetContainingSector(Geometry::IntersectionList const & intersections, Vector3D const & p0) const { +DetectorSector DetectorModel::GetContainingSector(Geometry::IntersectionList const & intersections, Vector3D const & p0) const { Vector3D direction = intersections.direction; double offset = (intersections.position - p0) * direction; @@ -977,7 +977,7 @@ EarthSector EarthModel::GetContainingSector(Geometry::IntersectionList const & i dot = 1; } - EarthSector sector; + DetectorSector sector; std::function::const_iterator, std::vector::const_iterator, double)> callback = [&] (std::vector::const_iterator current_intersection, std::vector::const_iterator intersection, double last_point) { @@ -996,13 +996,13 @@ EarthSector EarthModel::GetContainingSector(Geometry::IntersectionList const & i return sector; } -EarthSector EarthModel::GetContainingSector(Vector3D const & p0) const { +DetectorSector DetectorModel::GetContainingSector(Vector3D const & p0) const { Vector3D direction(0, 0, 1); Geometry::IntersectionList intersections = GetIntersections(p0, direction); return GetContainingSector(intersections, p0); } -Geometry::IntersectionList EarthModel::GetIntersections(Vector3D const & p0, Vector3D const & direction) const { +Geometry::IntersectionList DetectorModel::GetIntersections(Vector3D const & p0, Vector3D const & direction) const { Geometry::IntersectionList intersections; intersections.position = p0; intersections.direction = direction; @@ -1023,11 +1023,11 @@ Geometry::IntersectionList EarthModel::GetIntersections(Vector3D const & p0, Vec return intersections; } -void EarthModel::SortIntersections(Geometry::IntersectionList & intersections) { +void DetectorModel::SortIntersections(Geometry::IntersectionList & intersections) { SortIntersections(intersections.intersections); } -void EarthModel::SortIntersections(std::vector & intersections) { +void DetectorModel::SortIntersections(std::vector & intersections) { // Intersections should be sorted according to distance and then hierarchy std::function comp = [](Geometry::Intersection const & a, Geometry::Intersection const & b){ bool a_enter = a.entering; @@ -1056,7 +1056,7 @@ void EarthModel::SortIntersections(std::vector & interse std::sort(intersections.begin(), intersections.end(), comp); } -Geometry::IntersectionList EarthModel::GetOuterBounds(Geometry::IntersectionList const & intersections) { +Geometry::IntersectionList DetectorModel::GetOuterBounds(Geometry::IntersectionList const & intersections) { Geometry::IntersectionList result; result.position = intersections.position; result.direction = intersections.direction; @@ -1078,23 +1078,23 @@ Geometry::IntersectionList EarthModel::GetOuterBounds(Geometry::IntersectionList return result; } -Geometry::IntersectionList EarthModel::GetOuterBounds(Vector3D const & p0, Vector3D const & direction) const { +Geometry::IntersectionList DetectorModel::GetOuterBounds(Vector3D const & p0, Vector3D const & direction) const { Geometry::IntersectionList intersections = GetIntersections(p0, direction); return GetOuterBounds(intersections); } -std::set EarthModel::GetAvailableTargets(std::array const & vertex) const { +std::set DetectorModel::GetAvailableTargets(std::array const & vertex) const { Geometry::IntersectionList intersections = GetIntersections(vertex, math::Vector3D(0,0,1)); return GetAvailableTargets(intersections, vertex); } -std::set EarthModel::GetAvailableTargets(geometry::Geometry::IntersectionList const & intersections, std::array const & vertex) const { +std::set DetectorModel::GetAvailableTargets(geometry::Geometry::IntersectionList const & intersections, std::array const & vertex) const { int matID = GetContainingSector(intersections, Vector3D(vertex[0],vertex[1],vertex[2])).material_id; std::vector particles = materials_.GetMaterialConstituents(matID); return std::set(particles.begin(), particles.end()); } -void EarthModel::SectorLoop(std::function::const_iterator, std::vector::const_iterator, double)> callback, Geometry::IntersectionList const & intersections, bool reverse) { +void DetectorModel::SectorLoop(std::function::const_iterator, std::vector::const_iterator, double)> callback, Geometry::IntersectionList const & intersections, bool reverse) { // Keep track of the integral progress double last_point; @@ -1180,7 +1180,7 @@ void EarthModel::SectorLoop(std::function const & targets, std::vector const & total_cross_sections, double const & total_decay_length) const { @@ -1221,7 +1221,7 @@ double EarthModel::DistanceForInteractionDepthFromPoint(Geometry::IntersectionLi // whereas the lower end is bounded by the global start point, the end of the last line segment, and the entry into the sector double start_point = std::max(std::max(offset + dot * current_intersection->distance, 0.0), offset + dot * last_point); double segment_length = end_point - start_point; - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); double target = interaction_depth - total_interaction_depth; // This next line is because when we evaluate the density integral, // we end up calculating an interaction length in units of m/cm. @@ -1264,7 +1264,7 @@ double EarthModel::DistanceForInteractionDepthFromPoint(Geometry::IntersectionLi return total_distance; } -double EarthModel::DistanceForInteractionDepthFromPoint(Vector3D const & p0, Vector3D const & direction, double interaction_depth, +double DetectorModel::DistanceForInteractionDepthFromPoint(Vector3D const & p0, Vector3D const & direction, double interaction_depth, std::vector const & targets, std::vector const & total_cross_sections, double const & total_decay_length) const { @@ -1272,37 +1272,37 @@ double EarthModel::DistanceForInteractionDepthFromPoint(Vector3D const & p0, Vec return DistanceForInteractionDepthFromPoint(intersections, p0, direction, interaction_depth, targets, total_cross_sections, total_decay_length); } -double EarthModel::DistanceForInteractionDepthToPoint(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & direction, double interaction_depth, +double DetectorModel::DistanceForInteractionDepthToPoint(Geometry::IntersectionList const & intersections, Vector3D const & p0, Vector3D const & direction, double interaction_depth, std::vector const & targets, std::vector const & total_cross_sections, double const & total_decay_length) const { return DistanceForInteractionDepthFromPoint(intersections, p0, -direction, interaction_depth, targets, total_cross_sections, total_decay_length); } -double EarthModel::DistanceForInteractionDepthToPoint(Vector3D const & p0, Vector3D const & direction, double interaction_depth, +double DetectorModel::DistanceForInteractionDepthToPoint(Vector3D const & p0, Vector3D const & direction, double interaction_depth, std::vector const & targets, std::vector const & total_cross_sections, double const & total_decay_length) const { return DistanceForInteractionDepthFromPoint(p0, -direction, interaction_depth, targets, total_cross_sections, total_decay_length); } -Vector3D EarthModel::GetEarthCoordPosFromDetCoordPos(Vector3D const & point) const { +Vector3D DetectorModel::GetEarthCoordPosFromDetCoordPos(Vector3D const & point) const { return point + detector_origin_; } -Vector3D EarthModel::GetEarthCoordDirFromDetCoordDir(Vector3D const & direction) const { +Vector3D DetectorModel::GetEarthCoordDirFromDetCoordDir(Vector3D const & direction) const { return direction; } -Vector3D EarthModel::GetDetCoordPosFromEarthCoordPos(Vector3D const & point) const { +Vector3D DetectorModel::GetDetCoordPosFromEarthCoordPos(Vector3D const & point) const { return point - detector_origin_; } -Vector3D EarthModel::GetDetCoordDirFromEarthCoordDir(Vector3D const & direction) const { +Vector3D DetectorModel::GetDetCoordDirFromEarthCoordDir(Vector3D const & direction) const { return direction; } -void EarthModel::LoadConcentricShellsFromLegacyFile(std::string model_fname, double detector_depth, double ice_cap_angle) { +void DetectorModel::LoadConcentricShellsFromLegacyFile(std::string model_fname, double detector_depth, double ice_cap_angle) { if(model_fname.empty()) throw(std::runtime_error("Received empty earth model filename!")); @@ -1381,7 +1381,7 @@ void EarthModel::LoadConcentricShellsFromLegacyFile(std::string model_fname, dou throw(std::runtime_error(ss.str())); } - EarthSector sector; + DetectorSector sector; sector.material_id = materials_.GetMaterialId(medtype); sector.level = level; sector.name = label; @@ -1416,7 +1416,7 @@ void EarthModel::LoadConcentricShellsFromLegacyFile(std::string model_fname, dou std::vector ice_layers; bool saw_ice = false; for(unsigned int i=1; i(sector.geo.get()); sector.geo = Sphere(Placement(Vector3D(0,0,ice_offset), QFromZXZr(0,0,0)), geo->GetRadius()-ice_offset, 0).create(); //geo->SetRadius(geo->GetRadius()-ice_offset); @@ -1482,7 +1482,7 @@ void EarthModel::LoadConcentricShellsFromLegacyFile(std::string model_fname, dou } } -double EarthModel::GetTargetMass(LI::dataclasses::Particle::ParticleType target) const { +double DetectorModel::GetTargetMass(LI::dataclasses::Particle::ParticleType target) const { double molar_mass = materials_.GetMolarMass(target); // grams per mole return molar_mass * LI::utilities::Constants::GeV_per_amu; } diff --git a/projects/detector/private/Path.cxx b/projects/detector/private/Path.cxx index b6e3af72..8b1e6d38 100644 --- a/projects/detector/private/Path.cxx +++ b/projects/detector/private/Path.cxx @@ -8,7 +8,7 @@ #include // for max #include "LeptonInjector/dataclasses/Particle.h" // for Particle -#include "LeptonInjector/detector/EarthModel.h" // for EarthModel +#include "LeptonInjector/detector/DetectorModel.h" // for DetectorModel #include "LeptonInjector/geometry/Geometry.h" // for Geometry namespace LI { @@ -18,21 +18,21 @@ Path::Path() { } -Path::Path(std::shared_ptr earth_model) { - SetEarthModel(earth_model); +Path::Path(std::shared_ptr earth_model) { + SetDetectorModel(earth_model); } -Path::Path(std::shared_ptr earth_model, math::Vector3D const & first_point, math::Vector3D const & last_point) { - SetEarthModel(earth_model); +Path::Path(std::shared_ptr earth_model, math::Vector3D const & first_point, math::Vector3D const & last_point) { + SetDetectorModel(earth_model); SetPoints(first_point, last_point); } -Path::Path(std::shared_ptr earth_model, math::Vector3D const & first_point, math::Vector3D const & direction, double distance) { - SetEarthModel(earth_model); +Path::Path(std::shared_ptr earth_model, math::Vector3D const & first_point, math::Vector3D const & direction, double distance) { + SetDetectorModel(earth_model); SetPointsWithRay(first_point, direction, distance); } -bool Path::HasEarthModel() { +bool Path::HasDetectorModel() { return set_earth_model_; } @@ -48,7 +48,7 @@ bool Path::HasColumnDepth() { return set_column_depth_; } -std::shared_ptr Path::GetEarthModel() { +std::shared_ptr Path::GetDetectorModel() { return earth_model_; } @@ -72,12 +72,12 @@ geometry::Geometry::IntersectionList const & Path::GetIntersections() { return intersections_; } -void Path::SetEarthModel(std::shared_ptr earth_model) { +void Path::SetDetectorModel(std::shared_ptr earth_model) { earth_model_ = earth_model; set_earth_model_ = true; } -void Path::EnsureEarthModel() { +void Path::EnsureDetectorModel() { if(not set_earth_model_) { throw(std::runtime_error("Earth model not set!")); } @@ -119,7 +119,7 @@ void Path::SetIntersections(geometry::Geometry::IntersectionList const & interse } void Path::ComputeIntersections() { - EnsureEarthModel(); + EnsureDetectorModel(); EnsurePoints(); intersections_ = earth_model_->GetIntersections(first_point_, direction_); set_intersections_ = true; @@ -134,7 +134,7 @@ void Path::EnsureIntersections() { void Path::ClipToOuterBounds() { EnsureIntersections(); EnsurePoints(); - geometry::Geometry::IntersectionList bounds = EarthModel::GetOuterBounds(intersections_); + geometry::Geometry::IntersectionList bounds = DetectorModel::GetOuterBounds(intersections_); if(bounds.intersections.size() > 0) { assert(bounds.intersections.size() == 2); math::Vector3D p0 = bounds.intersections[0].position; diff --git a/projects/detector/private/pybindings/Axis1D.h b/projects/detector/private/pybindings/Axis1D.h index 16053d48..878e90d5 100644 --- a/projects/detector/private/pybindings/Axis1D.h +++ b/projects/detector/private/pybindings/Axis1D.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/Axis1D.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/CartesianAxis1D.h b/projects/detector/private/pybindings/CartesianAxis1D.h index faa7b1aa..92be73e0 100644 --- a/projects/detector/private/pybindings/CartesianAxis1D.h +++ b/projects/detector/private/pybindings/CartesianAxis1D.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/CartesianAxis1D.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/CartesianAxisExponentialDensityDistribution.h b/projects/detector/private/pybindings/CartesianAxisExponentialDensityDistribution.h index 32de67a1..a729538f 100644 --- a/projects/detector/private/pybindings/CartesianAxisExponentialDensityDistribution.h +++ b/projects/detector/private/pybindings/CartesianAxisExponentialDensityDistribution.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/CartesianAxisExponentialDensityDistribution.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/CartesianAxisPolynomialDensityDistribution.h b/projects/detector/private/pybindings/CartesianAxisPolynomialDensityDistribution.h index 4cf0cd93..f8d1ad64 100644 --- a/projects/detector/private/pybindings/CartesianAxisPolynomialDensityDistribution.h +++ b/projects/detector/private/pybindings/CartesianAxisPolynomialDensityDistribution.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/CartesianAxisPolynomialDensityDistribution.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/ConstantDensityDistribution.h b/projects/detector/private/pybindings/ConstantDensityDistribution.h index 479f3190..39936a65 100644 --- a/projects/detector/private/pybindings/ConstantDensityDistribution.h +++ b/projects/detector/private/pybindings/ConstantDensityDistribution.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/ConstantDensityDistribution.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/ConstantDistribution1D.h b/projects/detector/private/pybindings/ConstantDistribution1D.h index ab7a0e63..53b82155 100644 --- a/projects/detector/private/pybindings/ConstantDistribution1D.h +++ b/projects/detector/private/pybindings/ConstantDistribution1D.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/Distribution1D.h" #include "../../public/LeptonInjector/detector/ConstantDistribution1D.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/DensityDistribution.h b/projects/detector/private/pybindings/DensityDistribution.h index 35b31b58..f681ca63 100644 --- a/projects/detector/private/pybindings/DensityDistribution.h +++ b/projects/detector/private/pybindings/DensityDistribution.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/DensityDistribution.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/EarthModel.h b/projects/detector/private/pybindings/DetectorModel.h similarity index 57% rename from projects/detector/private/pybindings/EarthModel.h rename to projects/detector/private/pybindings/DetectorModel.h index c133b069..0eab19d6 100644 --- a/projects/detector/private/pybindings/EarthModel.h +++ b/projects/detector/private/pybindings/DetectorModel.h @@ -5,122 +5,122 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" -void register_EarthModel(pybind11::module_ & m) { +void register_DetectorModel(pybind11::module_ & m) { using namespace pybind11; using namespace LI::detector; - class_>(m, "EarthModel") + class_>(m, "DetectorModel") .def(init<>()) .def(init()) .def(init()) - .def("LoadEarthModel",&EarthModel::LoadEarthModel) - .def("LoadMaterialModel",&EarthModel::LoadMaterialModel) + .def("LoadDetectorModel",&DetectorModel::LoadDetectorModel) + .def("LoadMaterialModel",&DetectorModel::LoadMaterialModel) .def("GetMassDensity", ( - double (EarthModel::*)(LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &) const - )(&EarthModel::GetMassDensity)) + double (DetectorModel::*)(LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &) const + )(&DetectorModel::GetMassDensity)) .def("GetMassDensity", ( - double (EarthModel::*)(LI::math::Vector3D const &) const - )(&EarthModel::GetMassDensity)) + double (DetectorModel::*)(LI::math::Vector3D const &) const + )(&DetectorModel::GetMassDensity)) .def("GetParticleDensity", ( - double (EarthModel::*)(LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, LI::dataclasses::Particle::ParticleType) const - )(&EarthModel::GetParticleDensity)) + double (DetectorModel::*)(LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, LI::dataclasses::Particle::ParticleType) const + )(&DetectorModel::GetParticleDensity)) .def("GetParticleDensity", ( - double (EarthModel::*)(LI::math::Vector3D const &, LI::dataclasses::Particle::ParticleType) const - )(&EarthModel::GetParticleDensity)) + double (DetectorModel::*)(LI::math::Vector3D const &, LI::dataclasses::Particle::ParticleType) const + )(&DetectorModel::GetParticleDensity)) .def("GetInteractionDensity", ( - double (EarthModel::*)(LI::geometry::Geometry::IntersectionList const &, + double (DetectorModel::*)(LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, std::vector const &, std::vector const &, double const &) const - )(&EarthModel::GetInteractionDensity)) + )(&DetectorModel::GetInteractionDensity)) .def("GetInteractionDensity", ( - double (EarthModel::*)(LI::math::Vector3D const &, + double (DetectorModel::*)(LI::math::Vector3D const &, std::vector const &, std::vector const &, double const &) const - )(&EarthModel::GetInteractionDensity)) + )(&DetectorModel::GetInteractionDensity)) .def("GetColumnDepthInCGS", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, LI::math::Vector3D const &) const - )(&EarthModel::GetColumnDepthInCGS)) + )(&DetectorModel::GetColumnDepthInCGS)) .def("GetColumnDepthInCGS", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::math::Vector3D const &, LI::math::Vector3D const &) const - )(&EarthModel::GetColumnDepthInCGS)) + )(&DetectorModel::GetColumnDepthInCGS)) .def("DistanceForColumnDepthFromPoint", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, LI::math::Vector3D const &, double) const - )(&EarthModel::DistanceForColumnDepthFromPoint)) + )(&DetectorModel::DistanceForColumnDepthFromPoint)) .def("DistanceForColumnDepthFromPoint", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::math::Vector3D const &, LI::math::Vector3D const &, double) const - )(&EarthModel::DistanceForColumnDepthFromPoint)) + )(&DetectorModel::DistanceForColumnDepthFromPoint)) .def("DistanceForColumnDepthToPoint", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, LI::math::Vector3D const &, double) const - )(&EarthModel::DistanceForColumnDepthToPoint)) + )(&DetectorModel::DistanceForColumnDepthToPoint)) .def("DistanceForColumnDepthToPoint", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::math::Vector3D const &, LI::math::Vector3D const &, double) const - )(&EarthModel::DistanceForColumnDepthToPoint)) + )(&DetectorModel::DistanceForColumnDepthToPoint)) .def("GetMassDensity", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, std::set) const - )(&EarthModel::GetMassDensity)) + )(&DetectorModel::GetMassDensity)) .def("GetMassDensity", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::math::Vector3D const &, std::set) const - )(&EarthModel::GetMassDensity)) + )(&DetectorModel::GetMassDensity)) .def("GetParticleDensity", ( - std::vector (EarthModel::*)( + std::vector (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, std::set) const - )(&EarthModel::GetParticleDensity)) + )(&DetectorModel::GetParticleDensity)) .def("GetParticleDensity", ( - std::vector (EarthModel::*)( + std::vector (DetectorModel::*)( LI::math::Vector3D const &, std::set) const - )(&EarthModel::GetParticleDensity)) + )(&DetectorModel::GetParticleDensity)) .def("GetInteractionDepthInCGS", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, LI::math::Vector3D const &, std::vector const &, std::vector const &, double const &) const - )(&EarthModel::GetInteractionDepthInCGS)) + )(&DetectorModel::GetInteractionDepthInCGS)) .def("GetInteractionDepthInCGS", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::math::Vector3D const &, LI::math::Vector3D const &, std::vector const &, std::vector const &, double const &) const - )(&EarthModel::GetInteractionDepthInCGS)) + )(&DetectorModel::GetInteractionDepthInCGS)) .def("DistanceForInteractionDepthFromPoint", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, LI::math::Vector3D const &, @@ -128,18 +128,18 @@ void register_EarthModel(pybind11::module_ & m) { std::vector const &, std::vector const &, double const &) const - )(&EarthModel::DistanceForInteractionDepthFromPoint)) + )(&DetectorModel::DistanceForInteractionDepthFromPoint)) .def("DistanceForInteractionDepthFromPoint", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::math::Vector3D const &, LI::math::Vector3D const &, double, std::vector const &, std::vector const &, double const &) const - )(&EarthModel::DistanceForInteractionDepthFromPoint)) + )(&DetectorModel::DistanceForInteractionDepthFromPoint)) .def("DistanceForInteractionDepthToPoint", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, LI::math::Vector3D const &, @@ -147,86 +147,86 @@ void register_EarthModel(pybind11::module_ & m) { std::vector const &, std::vector const &, double const &) const - )(&EarthModel::DistanceForInteractionDepthToPoint)) + )(&DetectorModel::DistanceForInteractionDepthToPoint)) .def("DistanceForInteractionDepthToPoint", ( - double (EarthModel::*)( + double (DetectorModel::*)( LI::math::Vector3D const &, LI::math::Vector3D const &, double, std::vector const &, std::vector const &, double const &) const - )(&EarthModel::DistanceForInteractionDepthToPoint)) + )(&DetectorModel::DistanceForInteractionDepthToPoint)) .def("GetParticleColumnDepth", ( - std::vector (EarthModel::*)( + std::vector (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const &, LI::math::Vector3D const &, std::vector const &) const - )(&EarthModel::GetParticleColumnDepth)) + )(&DetectorModel::GetParticleColumnDepth)) .def("GetContainingSector", ( - EarthSector (EarthModel::*)( + DetectorSector (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, LI::math::Vector3D const & p0) const - )(&EarthModel::GetContainingSector)) + )(&DetectorModel::GetContainingSector)) .def("GetContainingSector", ( - EarthSector (EarthModel::*)( + DetectorSector (DetectorModel::*)( LI::math::Vector3D const & p0) const - )(&EarthModel::GetContainingSector)) + )(&DetectorModel::GetContainingSector)) .def("GetEarthCoordPosFromDetCoordPos", ( - LI::math::Vector3D (EarthModel::*)( + LI::math::Vector3D (DetectorModel::*)( LI::math::Vector3D const &) const - )(&EarthModel::GetEarthCoordPosFromDetCoordPos)) + )(&DetectorModel::GetEarthCoordPosFromDetCoordPos)) .def("GetEarthCoordDirFromDetCoordDir", ( - LI::math::Vector3D (EarthModel::*)( + LI::math::Vector3D (DetectorModel::*)( LI::math::Vector3D const &) const - )(&EarthModel::GetEarthCoordDirFromDetCoordDir)) + )(&DetectorModel::GetEarthCoordDirFromDetCoordDir)) .def("GetDetCoordPosFromEarthCoordPos", ( - LI::math::Vector3D (EarthModel::*)( + LI::math::Vector3D (DetectorModel::*)( LI::math::Vector3D const &) const - )(&EarthModel::GetDetCoordPosFromEarthCoordPos)) + )(&DetectorModel::GetDetCoordPosFromEarthCoordPos)) .def("GetDetCoordDirFromEarthCoordDir", ( - LI::math::Vector3D (EarthModel::*)( + LI::math::Vector3D (DetectorModel::*)( LI::math::Vector3D const &) const - )(&EarthModel::GetDetCoordDirFromEarthCoordDir)) - .def_property("Path", &EarthModel::GetPath, &EarthModel::SetPath) - .def_property("Materials", &EarthModel::GetMaterials, &EarthModel::SetMaterials) - .def_property("Sectors", &EarthModel::GetSectors, &EarthModel::SetSectors) - .def_property("DetectorOrigin", &EarthModel::GetDetectorOrigin, &EarthModel::SetDetectorOrigin) - .def("AddSector", &EarthModel::AddSector) - .def("GetSector", &EarthModel::GetSector) - .def("ClearSectors", &EarthModel::ClearSectors) - .def("GetIntersections", &EarthModel::GetIntersections) + )(&DetectorModel::GetDetCoordDirFromEarthCoordDir)) + .def_property("Path", &DetectorModel::GetPath, &DetectorModel::SetPath) + .def_property("Materials", &DetectorModel::GetMaterials, &DetectorModel::SetMaterials) + .def_property("Sectors", &DetectorModel::GetSectors, &DetectorModel::SetSectors) + .def_property("DetectorOrigin", &DetectorModel::GetDetectorOrigin, &DetectorModel::SetDetectorOrigin) + .def("AddSector", &DetectorModel::AddSector) + .def("GetSector", &DetectorModel::GetSector) + .def("ClearSectors", &DetectorModel::ClearSectors) + .def("GetIntersections", &DetectorModel::GetIntersections) .def_static("SortIntersections", ( void (*)(LI::geometry::Geometry::IntersectionList &) - )(&EarthModel::SortIntersections)) + )(&DetectorModel::SortIntersections)) .def_static("SortIntersections", ( void (*)(std::vector &) - )(&EarthModel::SortIntersections)) - .def_static("SectorLoop", &EarthModel::SectorLoop) + )(&DetectorModel::SortIntersections)) + .def_static("SectorLoop", &DetectorModel::SectorLoop) .def_static("GetOuterBoundsFromIntersections", ( LI::geometry::Geometry::IntersectionList (*)( LI::geometry::Geometry::IntersectionList const &) - )(&EarthModel::GetOuterBounds)) - .def("GetOuterBounds", [](LI::detector::EarthModel const & earth, LI::geometry::Geometry::IntersectionList const & intersections){ + )(&DetectorModel::GetOuterBounds)) + .def("GetOuterBounds", [](LI::detector::DetectorModel const & earth, LI::geometry::Geometry::IntersectionList const & intersections){ return earth.GetOuterBounds(intersections); }) .def("GetOuterBounds", ( - LI::geometry::Geometry::IntersectionList (EarthModel::*)( + LI::geometry::Geometry::IntersectionList (DetectorModel::*)( LI::math::Vector3D const &, LI::math::Vector3D const &) const - )(&EarthModel::GetOuterBounds)) + )(&DetectorModel::GetOuterBounds)) .def("GetAvailableTargets", ( - std::set (EarthModel::*)( + std::set (DetectorModel::*)( LI::geometry::Geometry::IntersectionList const &, std::array const &) const - )(&EarthModel::GetAvailableTargets)) + )(&DetectorModel::GetAvailableTargets)) .def("GetAvailableTargets", ( - std::set (EarthModel::*)( + std::set (DetectorModel::*)( std::array const &) const - )(&EarthModel::GetAvailableTargets)) - .def("GetTargetMass", &EarthModel::GetTargetMass) - .def("GetMaterials",&EarthModel::GetMaterials) - .def("GetDetectorOrigin",&EarthModel::GetDetectorOrigin); + )(&DetectorModel::GetAvailableTargets)) + .def("GetTargetMass", &DetectorModel::GetTargetMass) + .def("GetMaterials",&DetectorModel::GetMaterials) + .def("GetDetectorOrigin",&DetectorModel::GetDetectorOrigin); } diff --git a/projects/detector/private/pybindings/DetectorSector.h b/projects/detector/private/pybindings/DetectorSector.h new file mode 100644 index 00000000..ab0b163c --- /dev/null +++ b/projects/detector/private/pybindings/DetectorSector.h @@ -0,0 +1,27 @@ +#include +#include +#include + +#include + +#include "../../public/LeptonInjector/detector/DetectorModel.h" + +std::string to_str(LI::detector::DetectorSector const & sector) { + std::stringstream ss; + sector.Print(ss); + return ss.str(); +} + +void register_DetectorSector(pybind11::module_ & m) { + using namespace pybind11; + using namespace LI::detector; + + class_>(m, "DetectorSector") + .def(init<>()) + .def("__str__", &to_str) + .def_readwrite("name",&DetectorSector::name) + .def_readwrite("material_id",&DetectorSector::material_id) + .def_readwrite("level", &DetectorSector::level) + .def_readwrite("geo",&DetectorSector::geo) + .def_readwrite("density",&DetectorSector::density); +} diff --git a/projects/detector/private/pybindings/Distribution1D.h b/projects/detector/private/pybindings/Distribution1D.h index dfff9703..8bd255e2 100644 --- a/projects/detector/private/pybindings/Distribution1D.h +++ b/projects/detector/private/pybindings/Distribution1D.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/Distribution1D.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/EarthSector.h b/projects/detector/private/pybindings/EarthSector.h deleted file mode 100644 index 955aee19..00000000 --- a/projects/detector/private/pybindings/EarthSector.h +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include - -#include - -#include "../../public/LeptonInjector/detector/EarthModel.h" - -std::string to_str(LI::detector::EarthSector const & sector) { - std::stringstream ss; - sector.Print(ss); - return ss.str(); -} - -void register_EarthSector(pybind11::module_ & m) { - using namespace pybind11; - using namespace LI::detector; - - class_>(m, "EarthSector") - .def(init<>()) - .def("__str__", &to_str) - .def_readwrite("name",&EarthSector::name) - .def_readwrite("material_id",&EarthSector::material_id) - .def_readwrite("level", &EarthSector::level) - .def_readwrite("geo",&EarthSector::geo) - .def_readwrite("density",&EarthSector::density); -} diff --git a/projects/detector/private/pybindings/ExponentialDistribution1D.h b/projects/detector/private/pybindings/ExponentialDistribution1D.h index 1188c910..dcc58ba3 100644 --- a/projects/detector/private/pybindings/ExponentialDistribution1D.h +++ b/projects/detector/private/pybindings/ExponentialDistribution1D.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/Distribution1D.h" #include "../../public/LeptonInjector/detector/ExponentialDistribution1D.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/Path.h b/projects/detector/private/pybindings/Path.h index 4066f73b..34d55206 100644 --- a/projects/detector/private/pybindings/Path.h +++ b/projects/detector/private/pybindings/Path.h @@ -4,7 +4,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/Path.h" void register_Path(pybind11::module_ & m) { @@ -12,16 +12,16 @@ void register_Path(pybind11::module_ & m) { using namespace LI::detector; class_>(m, "Path") - .def(init>()) - .def(init, LI::math::Vector3D const &, LI::math::Vector3D const &>()) - .def(init, LI::math::Vector3D const &, LI::math::Vector3D const &, double>()) + .def(init>()) + .def(init, LI::math::Vector3D const &, LI::math::Vector3D const &>()) + .def(init, LI::math::Vector3D const &, LI::math::Vector3D const &, double>()) - .def("HasEarthModel",&Path::HasEarthModel) + .def("HasDetectorModel",&Path::HasDetectorModel) .def("HasPoints",&Path::HasPoints) .def("HasIntersections",&Path::HasIntersections) .def("HasColumnDepth",&Path::HasColumnDepth) - .def("GetEarthModel",&Path::GetEarthModel) - .def("HasEarthModel",&Path::HasEarthModel) + .def("GetDetectorModel",&Path::GetDetectorModel) + .def("HasDetectorModel",&Path::HasDetectorModel) .def("GetFirstPoint",&Path::GetFirstPoint) .def("GetLastPoint",&Path::GetLastPoint) .def("GetDirection",&Path::GetDirection) diff --git a/projects/detector/private/pybindings/PolynomialDistribution1D.h b/projects/detector/private/pybindings/PolynomialDistribution1D.h index 8b64383c..fea51d93 100644 --- a/projects/detector/private/pybindings/PolynomialDistribution1D.h +++ b/projects/detector/private/pybindings/PolynomialDistribution1D.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/Distribution1D.h" #include "../../public/LeptonInjector/detector/PolynomialDistribution1D.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/RadialAxis1D.h b/projects/detector/private/pybindings/RadialAxis1D.h index 2e43e5ba..a7a52583 100644 --- a/projects/detector/private/pybindings/RadialAxis1D.h +++ b/projects/detector/private/pybindings/RadialAxis1D.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/detector/EarthModel.h" +#include "../../public/LeptonInjector/detector/DetectorModel.h" #include "../../public/LeptonInjector/detector/Axis1D.h" #include "../../public/LeptonInjector/detector/RadialAxis1D.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" diff --git a/projects/detector/private/pybindings/detector.cxx b/projects/detector/private/pybindings/detector.cxx index 6d0704fc..37a33cbc 100644 --- a/projects/detector/private/pybindings/detector.cxx +++ b/projects/detector/private/pybindings/detector.cxx @@ -1,8 +1,8 @@ #include #include -#include "./EarthModel.h" -#include "./EarthSector.h" +#include "./DetectorModel.h" +#include "./DetectorSector.h" #include "./Path.h" #include "./DensityDistribution.h" #include "./Distribution1D.h" @@ -20,8 +20,8 @@ using namespace pybind11; PYBIND11_MODULE(detector,m) { - register_EarthModel(m); - register_EarthSector(m); + register_DetectorModel(m); + register_DetectorSector(m); register_Path(m); register_DensityDistribution(m); register_Distribution1D(m); diff --git a/projects/detector/private/pybindings/earthmodel-service.cxx b/projects/detector/private/pybindings/earthmodel-service.cxx index 521eebf6..864b48ae 100644 --- a/projects/detector/private/pybindings/earthmodel-service.cxx +++ b/projects/detector/private/pybindings/earthmodel-service.cxx @@ -8,8 +8,8 @@ #include #include #include -#include -#include +#include +#include // #include #include @@ -71,13 +71,13 @@ void ListToVec(std::vector &ret, boost::python::list l){ } namespace earthmodel{ - struct LIEarthModelCalculator { + struct LIDetectorModelCalculator { }; } -BOOST_PYTHON_MODULE(EarthModelService){ +BOOST_PYTHON_MODULE(DetectorModelService){ using namespace earthmodel; - typedef std::vector Sectors; + typedef std::vector Sectors; class_("Sectors") .def(vector_indexing_suite()); @@ -109,57 +109,57 @@ BOOST_PYTHON_MODULE(EarthModelService){ .def("SetSphericalCoordinates",&Vector3D::SetSphericalCoordinates) ; - class_("EarthSector", init<>()) - .def_readwrite("name", &EarthSector::name) - .def_readwrite("material_id", &EarthSector::material_id) - .def_readwrite("level", &EarthSector::level) - .def_readwrite("geo", &EarthSector::geo) - .def_readwrite("density", &EarthSector::density) + class_("DetectorSector", init<>()) + .def_readwrite("name", &DetectorSector::name) + .def_readwrite("material_id", &DetectorSector::material_id) + .def_readwrite("level", &DetectorSector::level) + .def_readwrite("geo", &DetectorSector::geo) + .def_readwrite("density", &DetectorSector::density) ; - double (EarthModel::*GetMassDensity_cached)(Geometry::IntersectionList const & intersections, Vector3D const & p0) const = &EarthModel::GetMassDensity; - double (EarthModel::*GetMassDensity)(Vector3D const & p0) const = &EarthModel::GetMassDensity; + double (DetectorModel::*GetMassDensity_cached)(Geometry::IntersectionList const & intersections, Vector3D const & p0) const = &DetectorModel::GetMassDensity; + double (DetectorModel::*GetMassDensity)(Vector3D const & p0) const = &DetectorModel::GetMassDensity; - double (EarthModel::*DistanceForColumnDepthToPoint_cached)(Geometry::IntersectionList const & intersections, Vector3D const & end_point, Vector3D const & direction, double column_depth) const = &EarthModel::DistanceForColumnDepthToPoint; - double (EarthModel::*DistanceForColumnDepthToPoint)(Vector3D const & end_point, Vector3D const & direction, double column_depth) const = &EarthModel::DistanceForColumnDepthToPoint; + double (DetectorModel::*DistanceForColumnDepthToPoint_cached)(Geometry::IntersectionList const & intersections, Vector3D const & end_point, Vector3D const & direction, double column_depth) const = &DetectorModel::DistanceForColumnDepthToPoint; + double (DetectorModel::*DistanceForColumnDepthToPoint)(Vector3D const & end_point, Vector3D const & direction, double column_depth) const = &DetectorModel::DistanceForColumnDepthToPoint; - class_("EarthModel", init<>()) + class_("DetectorModel", init<>()) .def(init()) .def(init()) - .def("LoadEarthModel",&EarthModel::LoadEarthModel) - .def("LoadMaterialModel",&EarthModel::LoadMaterialModel) - //.def("GetColumnDepthInCGS",&EarthModel::GetColumnDepthInCGS) + .def("LoadDetectorModel",&DetectorModel::LoadDetectorModel) + .def("LoadMaterialModel",&DetectorModel::LoadMaterialModel) + //.def("GetColumnDepthInCGS",&DetectorModel::GetColumnDepthInCGS) .def("GetColumnDepthInCGS", GetMassDensity) .def("GetColumnDepthInCGS", GetMassDensity_cached) .def("DistanceForColumnDepthToPoint", DistanceForColumnDepthToPoint) .def("DistanceForColumnDepthToPoint", DistanceForColumnDepthToPoint_cached) - .def("GetEarthCoordPosFromDetCoordPos",&EarthModel::GetEarthCoordPosFromDetCoordPos) - .def("GetEarthCoordDirFromDetCoordDir",&EarthModel::GetEarthCoordDirFromDetCoordDir) - .def("GetDetCoordPosFromEarthCoordPos",&EarthModel::GetDetCoordPosFromEarthCoordPos) - .def("GetDetCoordDirFromEarthCoordDir",&EarthModel::GetDetCoordDirFromEarthCoordDir) - .def("GetPath",&EarthModel::GetPath) - .def("SetPath",&EarthModel::SetPath) - .def("GetMaterials",&EarthModel::GetMaterials, return_value_policy()) - .def("SetMaterials",&EarthModel::SetMaterials) - .def("GetSectors",&EarthModel::GetSectors, return_value_policy()) - .def("SetSectors",&EarthModel::SetSectors) - .def("GetDetectorOrigin",&EarthModel::GetDetectorOrigin) - .def("SetDetectorOrigin",&EarthModel::SetDetectorOrigin) - .def("AddSector",&EarthModel::AddSector) - .def("GetSector",&EarthModel::GetSector) - .def("ClearSectors",&EarthModel::ClearSectors) + .def("GetEarthCoordPosFromDetCoordPos",&DetectorModel::GetEarthCoordPosFromDetCoordPos) + .def("GetEarthCoordDirFromDetCoordDir",&DetectorModel::GetEarthCoordDirFromDetCoordDir) + .def("GetDetCoordPosFromEarthCoordPos",&DetectorModel::GetDetCoordPosFromEarthCoordPos) + .def("GetDetCoordDirFromEarthCoordDir",&DetectorModel::GetDetCoordDirFromEarthCoordDir) + .def("GetPath",&DetectorModel::GetPath) + .def("SetPath",&DetectorModel::SetPath) + .def("GetMaterials",&DetectorModel::GetMaterials, return_value_policy()) + .def("SetMaterials",&DetectorModel::SetMaterials) + .def("GetSectors",&DetectorModel::GetSectors, return_value_policy()) + .def("SetSectors",&DetectorModel::SetSectors) + .def("GetDetectorOrigin",&DetectorModel::GetDetectorOrigin) + .def("SetDetectorOrigin",&DetectorModel::SetDetectorOrigin) + .def("AddSector",&DetectorModel::AddSector) + .def("GetSector",&DetectorModel::GetSector) + .def("ClearSectors",&DetectorModel::ClearSectors) ; { - scope earthmodel = class_("EarthModelCalculator"); - - def("GetImpactParameter", &EarthModelCalculator::GetImpactParameter); - def("GetIntersectionsWithSphere", &EarthModelCalculator::GetIntersectionsWithSphere); - def("GetDistsToIntersectionsWithSphere", &EarthModelCalculator::GetDistsToIntersectionsWithSphere); - def("GetLeptonRange", &EarthModelCalculator::GetLeptonRange); - def("ColumnDepthCGStoMWE",&EarthModelCalculator::ColumnDepthCGStoMWE); - def("MWEtoColumnDepthCGS",&EarthModelCalculator::MWEtoColumnDepthCGS); + scope earthmodel = class_("DetectorModelCalculator"); + + def("GetImpactParameter", &DetectorModelCalculator::GetImpactParameter); + def("GetIntersectionsWithSphere", &DetectorModelCalculator::GetIntersectionsWithSphere); + def("GetDistsToIntersectionsWithSphere", &DetectorModelCalculator::GetDistsToIntersectionsWithSphere); + def("GetLeptonRange", &DetectorModelCalculator::GetLeptonRange); + def("ColumnDepthCGStoMWE",&DetectorModelCalculator::ColumnDepthCGStoMWE); + def("MWEtoColumnDepthCGS",&DetectorModelCalculator::MWEtoColumnDepthCGS); } using namespace scitbx::boost_python::container_conversions; diff --git a/projects/detector/private/test/EarthModel_TEST.cxx b/projects/detector/private/test/DetectorModel_TEST.cxx similarity index 83% rename from projects/detector/private/test/EarthModel_TEST.cxx rename to projects/detector/private/test/DetectorModel_TEST.cxx index 269b6eea..125fc337 100644 --- a/projects/detector/private/test/EarthModel_TEST.cxx +++ b/projects/detector/private/test/DetectorModel_TEST.cxx @@ -13,7 +13,7 @@ #include "LeptonInjector/geometry/Geometry.h" #include "LeptonInjector/geometry/Sphere.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/utilities/Constants.h" #include "LeptonInjector/detector/DensityDistribution.h" #include "LeptonInjector/detector/Distribution1D.h" @@ -25,7 +25,7 @@ #include "LeptonInjector/detector/ExponentialDistribution1D.h" #include "LeptonInjector/detector/DensityDistribution1D.h" -#include "FakeEarthModel.h" +#include "FakeDetectorModel.h" #include "FakeMaterialModel.h" using namespace LI::math; @@ -36,12 +36,12 @@ using namespace LI::dataclasses; TEST(Constructor, Default) { - EXPECT_NO_THROW(EarthModel A); + EXPECT_NO_THROW(DetectorModel A); } TEST(DefaultMaterials, VacuumOnly) { - EarthModel A; + DetectorModel A; MaterialModel materials = A.GetMaterials(); int material_count = 0; @@ -86,7 +86,7 @@ TEST(DefaultMaterials, VacuumOnly) } /* - EarthSector sector; + DetectorSector sector; sector.material_id = materials_.GetMaterialId("VACUUM"); sector.level = sectors_.size(); sector.geo = Sphere(Vector3D(0,0,0), std::numeric_limits::infinity(), 0).create(); @@ -96,10 +96,10 @@ TEST(DefaultMaterials, VacuumOnly) TEST(DefaultSectors, VacuumOnly) { - EarthModel A; - std::vector sectors = A.GetSectors(); + DetectorModel A; + std::vector sectors = A.GetSectors(); ASSERT_EQ(1, sectors.size()); - EarthSector sector = sectors[0]; + DetectorSector sector = sectors[0]; EXPECT_EQ(0, sector.material_id); EXPECT_EQ(std::numeric_limits::min(), sector.level); Sphere geo(Vector3D(0,0,0),std::numeric_limits::infinity(), 0); @@ -108,44 +108,44 @@ TEST(DefaultSectors, VacuumOnly) EXPECT_EQ(density, *sector.density); } -TEST_F(FakeMaterialModelTest, EarthModelConstructorEmptyModel) +TEST_F(FakeMaterialModelTest, DetectorModelConstructorEmptyModel) { - EXPECT_THROW(EarthModel A("", materials_file), std::runtime_error); + EXPECT_THROW(DetectorModel A("", materials_file), std::runtime_error); } -TEST_F(FakeMaterialModelTest, EarthModelConstructorEmptyPathEmptyModel) +TEST_F(FakeMaterialModelTest, DetectorModelConstructorEmptyPathEmptyModel) { - EXPECT_THROW(EarthModel A("", "", materials_file), std::runtime_error); + EXPECT_THROW(DetectorModel A("", "", materials_file), std::runtime_error); } -TEST(Constructor, EarthModelConstructorEmptyModelEmptyMaterials) +TEST(Constructor, DetectorModelConstructorEmptyModelEmptyMaterials) { - EXPECT_THROW(EarthModel A("", ""), std::runtime_error); + EXPECT_THROW(DetectorModel A("", ""), std::runtime_error); } -TEST(Constructor, EarthModelConstructorEmptyPathEmptyModelEmptyMaterials) +TEST(Constructor, DetectorModelConstructorEmptyPathEmptyModelEmptyMaterials) { - EXPECT_THROW(EarthModel A("", "", ""), std::runtime_error); + EXPECT_THROW(DetectorModel A("", "", ""), std::runtime_error); } -TEST_F(FakeMaterialModelTest, EarthModelConstructorEmptyPathBadModel) +TEST_F(FakeMaterialModelTest, DetectorModelConstructorEmptyPathBadModel) { - EXPECT_THROW(EarthModel("", std::tmpnam(nullptr), materials_file), std::runtime_error); + EXPECT_THROW(DetectorModel("", std::tmpnam(nullptr), materials_file), std::runtime_error); } -TEST_F(FakeMaterialModelTest, EarthModelConstructorBadModel) +TEST_F(FakeMaterialModelTest, DetectorModelConstructorBadModel) { - EXPECT_THROW(EarthModel(std::tmpnam(nullptr), materials_file), std::runtime_error); + EXPECT_THROW(DetectorModel(std::tmpnam(nullptr), materials_file), std::runtime_error); } -TEST_F(FakeMaterialModelTest, EarthModelConstructorBadModelEmptyMaterial) +TEST_F(FakeMaterialModelTest, DetectorModelConstructorBadModelEmptyMaterial) { - EXPECT_THROW(EarthModel(std::tmpnam(nullptr), ""), std::runtime_error); + EXPECT_THROW(DetectorModel(std::tmpnam(nullptr), ""), std::runtime_error); } TEST(Path, SetGet) { - EarthModel A; + DetectorModel A; std::string result; std::string expect; A.SetPath("a"); @@ -167,7 +167,7 @@ TEST(Path, SetGet) TEST(EdgeCases, ColumnDepthWithEqualPoints) { - EarthModel A; + DetectorModel A; unsigned int N_rand = 1000; for(unsigned int i=0; i sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); EXPECT_EQ(layer_names.size(), sectors.size() - 1); unsigned int n_layers = std::min(layer_names.size(), sectors.size() - 1); for(unsigned int j=0; j sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); EXPECT_EQ(layer_materials.size(), sectors.size() - 1); unsigned int n_layers = std::min(layer_materials.size(), sectors.size() - 1); MaterialModel materials = A.GetMaterials(); @@ -248,26 +248,26 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileLayerMaterials) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileSectorTypes) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileSectorTypes) { unsigned int N_rand = 1000; for(unsigned int i=0; i sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); unsigned int n_layers = sectors.size()-1; ASSERT_EQ(n_layers, layer_thicknesses.size()); double max_radius = 0.0; for(unsigned int j=0; j geo = sector.geo; Placement placement = geo->GetPlacement(); Sphere const* sphere = dynamic_cast(geo.get()); @@ -308,25 +308,25 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileSectorTypes) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileGetMassDensityCachedIntersections) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileGetMassDensityCachedIntersections) { unsigned int N_rand = 1000; for(unsigned int i=0; i sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -417,21 +417,21 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantIntegralInternal) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantGetMassDensityInternal) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantGetMassDensityInternal) { unsigned int N_rand = 1000; for(unsigned int i=0; i sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -445,23 +445,23 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantGetMassDensityInternal) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantIntegralNested) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantIntegralNested) { unsigned int N_rand = 1000; for(unsigned int i=0; i sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(3, sectors.size()); - EarthSector sector_0 = sectors[1]; - EarthSector sector_1 = sectors[2]; + DetectorSector sector_0 = sectors[1]; + DetectorSector sector_1 = sectors[2]; Sphere const * sphere_0 = dynamic_cast(sector_0.geo.get()); Sphere const * sphere_1 = dynamic_cast(sector_1.geo.get()); ASSERT_TRUE(sphere_0); @@ -547,23 +547,23 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantIntegralNested) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantGetMassDensityNested) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantGetMassDensityNested) { unsigned int N_rand = 1000; for(unsigned int i=0; i sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(3, sectors.size()); - EarthSector sector_0 = sectors[1]; - EarthSector sector_1 = sectors[2]; + DetectorSector sector_0 = sectors[1]; + DetectorSector sector_1 = sectors[2]; Sphere const * sphere_0 = dynamic_cast(sector_0.geo.get()); Sphere const * sphere_1 = dynamic_cast(sector_1.geo.get()); ASSERT_TRUE(sphere_0); @@ -591,44 +591,44 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantGetMassDensityNested) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantIntegralIntersecting) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantIntegralIntersecting) { unsigned int N_rand = 1000; for(unsigned int i=0; i(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + upper_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); - EarthSector lower_sector; + DetectorSector lower_sector; Vector3D lower_center(radius/4.0,0,0); lower_sector.name = "lower"; - lower_sector.material_id = FakeLegacyEarthModelFile::RandomDouble()*material_count; + lower_sector.material_id = FakeLegacyDetectorModelFile::RandomDouble()*material_count; lower_sector.level = -2; lower_sector.geo = Sphere(lower_center, radius, 0).create(); - lower_sector.density = DensityDistribution1D(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + lower_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); A.AddSector(lower_sector); A.AddSector(upper_sector); - std::vector sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(3, sectors.size()); - EarthSector sector_vacuum = sectors[0]; - EarthSector sector_0 = sectors[1]; - EarthSector sector_1 = sectors[2]; + DetectorSector sector_vacuum = sectors[0]; + DetectorSector sector_0 = sectors[1]; + DetectorSector sector_1 = sectors[2]; ASSERT_EQ(lower_sector.name, sector_0.name); ASSERT_EQ(upper_sector.name, sector_1.name); Sphere const * sphere_0 = dynamic_cast(sector_0.geo.get()); @@ -885,44 +885,44 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantIntegralIntersecting) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantGetMassDensityIntersecting) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantGetMassDensityIntersecting) { unsigned int N_rand = 1000; for(unsigned int i=0; i(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + upper_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); - EarthSector lower_sector; + DetectorSector lower_sector; Vector3D lower_center(radius/4.0,0,0); lower_sector.name = "lower"; - lower_sector.material_id = FakeLegacyEarthModelFile::RandomDouble()*material_count; + lower_sector.material_id = FakeLegacyDetectorModelFile::RandomDouble()*material_count; lower_sector.level = -2; lower_sector.geo = Sphere(lower_center, radius, 0).create(); - lower_sector.density = DensityDistribution1D(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + lower_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); A.AddSector(lower_sector); A.AddSector(upper_sector); - std::vector sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(3, sectors.size()); - EarthSector sector_vacuum = sectors[0]; - EarthSector sector_0 = sectors[1]; - EarthSector sector_1 = sectors[2]; + DetectorSector sector_vacuum = sectors[0]; + DetectorSector sector_0 = sectors[1]; + DetectorSector sector_1 = sectors[2]; ASSERT_EQ(lower_sector.name, sector_0.name); ASSERT_EQ(upper_sector.name, sector_1.name); Sphere const * sphere_0 = dynamic_cast(sector_0.geo.get()); @@ -956,44 +956,44 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantGetMassDensityIntersecting) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantIntegralHidden) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantIntegralHidden) { unsigned int N_rand = 1000; for(unsigned int i=0; i(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + upper_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); - EarthSector lower_sector; + DetectorSector lower_sector; Vector3D lower_center(0,0,0); lower_sector.name = "lower"; - lower_sector.material_id = FakeLegacyEarthModelFile::RandomDouble()*material_count; + lower_sector.material_id = FakeLegacyDetectorModelFile::RandomDouble()*material_count; lower_sector.level = -2; lower_sector.geo = Sphere(lower_center, radius/2.0, 0).create(); - lower_sector.density = DensityDistribution1D(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + lower_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); A.AddSector(lower_sector); A.AddSector(upper_sector); - std::vector sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(3, sectors.size()); - EarthSector sector_vacuum = sectors[0]; - EarthSector sector_0 = sectors[1]; - EarthSector sector_1 = sectors[2]; + DetectorSector sector_vacuum = sectors[0]; + DetectorSector sector_0 = sectors[1]; + DetectorSector sector_1 = sectors[2]; ASSERT_EQ(lower_sector.name, sector_0.name); ASSERT_EQ(upper_sector.name, sector_1.name); Sphere const * sphere_0 = dynamic_cast(sector_0.geo.get()); @@ -1060,44 +1060,44 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantIntegralHidden) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantGetMassDensityHidden) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantGetMassDensityHidden) { unsigned int N_rand = 1000; for(unsigned int i=0; i(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + upper_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); - EarthSector lower_sector; + DetectorSector lower_sector; Vector3D lower_center(0,0,0); lower_sector.name = "lower"; - lower_sector.material_id = FakeLegacyEarthModelFile::RandomDouble()*material_count; + lower_sector.material_id = FakeLegacyDetectorModelFile::RandomDouble()*material_count; lower_sector.level = -2; lower_sector.geo = Sphere(lower_center, radius/2.0, 0).create(); - lower_sector.density = DensityDistribution1D(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + lower_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); A.AddSector(lower_sector); A.AddSector(upper_sector); - std::vector sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(3, sectors.size()); - EarthSector sector_vacuum = sectors[0]; - EarthSector sector_0 = sectors[1]; - EarthSector sector_1 = sectors[2]; + DetectorSector sector_vacuum = sectors[0]; + DetectorSector sector_0 = sectors[1]; + DetectorSector sector_1 = sectors[2]; ASSERT_EQ(lower_sector.name, sector_0.name); ASSERT_EQ(upper_sector.name, sector_1.name); Sphere const * sphere_0 = dynamic_cast(sector_0.geo.get()); @@ -1126,19 +1126,19 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantGetMassDensityHidden) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantInverseIntegralInternal) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantInverseIntegralInternal) { unsigned int N_rand = 1000; for(unsigned int i=0; i sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); unsigned int n_layers = std::min(layer_names.size(), sectors.size() - 1); double max_radius = 0.0; for(unsigned int j=0; j(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + upper_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); - EarthSector lower_sector; + DetectorSector lower_sector; Vector3D lower_center(0,0,0); lower_sector.name = "lower"; - lower_sector.material_id = FakeLegacyEarthModelFile::RandomDouble()*material_count; + lower_sector.material_id = FakeLegacyDetectorModelFile::RandomDouble()*material_count; lower_sector.level = -2; lower_sector.geo = Sphere(lower_center, radius/2.0, 0).create(); - lower_sector.density = DensityDistribution1D(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + lower_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); - EarthSector bg_sector; + DetectorSector bg_sector; Vector3D bg_center(0,0,0); bg_sector.name = "bg"; - bg_sector.material_id = FakeLegacyEarthModelFile::RandomDouble()*material_count; + bg_sector.material_id = FakeLegacyDetectorModelFile::RandomDouble()*material_count; bg_sector.level = -100; bg_sector.geo = Sphere(bg_center, radius*100, 0).create(); - bg_sector.density = DensityDistribution1D(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + bg_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); A.AddSector(lower_sector); A.AddSector(upper_sector); A.AddSector(bg_sector); - std::vector sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(4, sectors.size()); - EarthSector sector_vacuum = sectors[0]; - EarthSector sector_0 = sectors[1]; - EarthSector sector_1 = sectors[2]; + DetectorSector sector_vacuum = sectors[0]; + DetectorSector sector_0 = sectors[1]; + DetectorSector sector_1 = sectors[2]; ASSERT_EQ(lower_sector.name, sector_0.name); ASSERT_EQ(upper_sector.name, sector_1.name); Sphere const * sphere_0 = dynamic_cast(sector_0.geo.get()); @@ -1235,53 +1235,53 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantInverseIntegralHidden) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantInverseIntegralIntersecting) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantInverseIntegralIntersecting) { unsigned int N_rand = 1000; for(unsigned int i=0; i(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + upper_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); - EarthSector lower_sector; + DetectorSector lower_sector; Vector3D lower_center(radius/4.0,0,0); lower_sector.name = "lower"; - lower_sector.material_id = FakeLegacyEarthModelFile::RandomDouble()*material_count; + lower_sector.material_id = FakeLegacyDetectorModelFile::RandomDouble()*material_count; lower_sector.level = -2; lower_sector.geo = Sphere(lower_center, radius, 0).create(); - lower_sector.density = DensityDistribution1D(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + lower_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); - EarthSector bg_sector; + DetectorSector bg_sector; Vector3D bg_center(0,0,0); bg_sector.name = "bg"; - bg_sector.material_id = FakeLegacyEarthModelFile::RandomDouble()*material_count; + bg_sector.material_id = FakeLegacyDetectorModelFile::RandomDouble()*material_count; bg_sector.level = -100; bg_sector.geo = Sphere(bg_center, radius*100, 0).create(); - bg_sector.density = DensityDistribution1D(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + bg_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); A.AddSector(lower_sector); A.AddSector(upper_sector); A.AddSector(bg_sector); - std::vector sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(4, sectors.size()); - EarthSector sector_vacuum = sectors[0]; - EarthSector sector_0 = sectors[1]; - EarthSector sector_1 = sectors[2]; + DetectorSector sector_vacuum = sectors[0]; + DetectorSector sector_0 = sectors[1]; + DetectorSector sector_1 = sectors[2]; ASSERT_EQ(lower_sector.name, sector_0.name); ASSERT_EQ(upper_sector.name, sector_1.name); Sphere const * sphere_0 = dynamic_cast(sector_0.geo.get()); @@ -1308,13 +1308,13 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantInverseIntegralIntersecting) } } -TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantInverseIntegralNested) +TEST_F(FakeLegacyDetectorModelTest, LegacyFileConstantInverseIntegralNested) { unsigned int N_rand = 1000; for(unsigned int i=0; i(FakeLegacyEarthModelFile::RandomDouble()*15).create(); + bg_sector.density = DensityDistribution1D(FakeLegacyDetectorModelFile::RandomDouble()*15).create(); A.AddSector(bg_sector); - std::vector sectors = A.GetSectors(); + std::vector sectors = A.GetSectors(); ASSERT_EQ(4, sectors.size()); - EarthSector sector_0 = sectors[1]; - EarthSector sector_1 = sectors[2]; + DetectorSector sector_0 = sectors[1]; + DetectorSector sector_1 = sectors[2]; Sphere const * sphere_0 = dynamic_cast(sector_0.geo.get()); Sphere const * sphere_1 = dynamic_cast(sector_1.geo.get()); ASSERT_TRUE(sphere_0); @@ -1369,14 +1369,14 @@ TEST_F(FakeLegacyEarthModelTest, LegacyFileConstantInverseIntegralNested) } } -TEST_F(FakeEarthModelTest, FileLoad) +TEST_F(FakeDetectorModelTest, FileLoad) { unsigned int N_rand = 1000; for(unsigned int i=0; i #include @@ -14,7 +14,7 @@ #include "FakeMaterialModel.h" #include "LeptonInjector/geometry/Geometry.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/math/Quaternion.h" #include "LeptonInjector/math/Polynomial.h" @@ -45,7 +45,7 @@ struct ModelToken { }; -class FakeEarthModelFile { +class FakeDetectorModelFile { protected: bool file_exists; std::mt19937 rng_; @@ -465,15 +465,15 @@ class FakeEarthModelFile { } }; -class FakeEarthModelTest : public FakeEarthModelFile, public FakeMaterialModelFile, public ::testing::Test { +class FakeDetectorModelTest : public FakeDetectorModelFile, public FakeMaterialModelFile, public ::testing::Test { protected: void setup() { FakeMaterialModelFile::create_file(std::vector{"air", "atmosphere", "ice"}, 6); - FakeEarthModelFile::create_file(FakeMaterialModelFile::material_names_); + FakeDetectorModelFile::create_file(FakeMaterialModelFile::material_names_); } void setup(unsigned int n_layers, int poly_max) { FakeMaterialModelFile::create_file(std::vector{"air", "atmosphere", "ice"}, 6); - FakeEarthModelFile::create_file(FakeMaterialModelFile::material_names_, n_layers, 0, poly_max); + FakeDetectorModelFile::create_file(FakeMaterialModelFile::material_names_, n_layers, 0, poly_max); } void reset() { setup(); @@ -483,18 +483,18 @@ class FakeEarthModelTest : public FakeEarthModelFile, public FakeMaterialModelFi } void SetUp() override { FakeMaterialModelFile::file_exists = false; - FakeEarthModelFile::file_exists = false; + FakeDetectorModelFile::file_exists = false; setup(); } void TearDown() override { //FakeMaterialModelFile::remove_file(); - //FakeLegacyEarthModelFile::remove_file(); + //FakeLegacyDetectorModelFile::remove_file(); FakeMaterialModelFile::clear(); - FakeEarthModelFile::clear(); + FakeDetectorModelFile::clear(); } }; -class FakeLegacyEarthModelFile { +class FakeLegacyDetectorModelFile { protected: bool file_exists; std::mt19937 rng_; @@ -731,15 +731,15 @@ class FakeLegacyEarthModelFile { } }; -class FakeLegacyEarthModelTest : public FakeLegacyEarthModelFile, public FakeMaterialModelFile, public ::testing::Test { +class FakeLegacyDetectorModelTest : public FakeLegacyDetectorModelFile, public FakeMaterialModelFile, public ::testing::Test { protected: void setup() { FakeMaterialModelFile::create_file(std::vector{"air", "atmosphere", "ice"}, 6); - FakeLegacyEarthModelFile::create_file(FakeMaterialModelFile::material_names_); + FakeLegacyDetectorModelFile::create_file(FakeMaterialModelFile::material_names_); } void setup(unsigned int n_layers, int poly_max) { FakeMaterialModelFile::create_file(std::vector{"air", "atmosphere", "ice"}, 6); - FakeLegacyEarthModelFile::create_file(FakeMaterialModelFile::material_names_, n_layers, 0, poly_max); + FakeLegacyDetectorModelFile::create_file(FakeMaterialModelFile::material_names_, n_layers, 0, poly_max); } void reset() { setup(); @@ -749,16 +749,16 @@ class FakeLegacyEarthModelTest : public FakeLegacyEarthModelFile, public FakeMat } void SetUp() override { FakeMaterialModelFile::file_exists = false; - FakeLegacyEarthModelFile::file_exists = false; + FakeLegacyDetectorModelFile::file_exists = false; setup(); } void TearDown() override { //FakeMaterialModelFile::remove_file(); - //FakeLegacyEarthModelFile::remove_file(); + //FakeLegacyDetectorModelFile::remove_file(); FakeMaterialModelFile::clear(); - FakeLegacyEarthModelFile::clear(); + FakeLegacyDetectorModelFile::clear(); } }; -#endif // LI_TEST_FakeEarthModel_H +#endif // LI_TEST_FakeDetectorModel_H diff --git a/projects/detector/private/test/FakeMaterialModel.h b/projects/detector/private/test/FakeMaterialModel.h index 49146f98..80fe6d30 100644 --- a/projects/detector/private/test/FakeMaterialModel.h +++ b/projects/detector/private/test/FakeMaterialModel.h @@ -12,7 +12,7 @@ #include #include "LeptonInjector/geometry/Geometry.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/detector/MaterialModel.h" using namespace LI::detector; diff --git a/projects/detector/private/test/Path_TEST.cxx b/projects/detector/private/test/Path_TEST.cxx index 00a4f52f..d3f9a42b 100644 --- a/projects/detector/private/test/Path_TEST.cxx +++ b/projects/detector/private/test/Path_TEST.cxx @@ -11,7 +11,7 @@ #include "LeptonInjector/geometry/Geometry.h" #include "LeptonInjector/geometry/Sphere.h" #include "LeptonInjector/math/Vector3D.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/detector/DensityDistribution.h" #include "LeptonInjector/detector/DensityDistribution1D.h" #include "LeptonInjector/detector/Distribution1D.h" @@ -25,7 +25,7 @@ #include "LeptonInjector/dataclasses/Particle.h" #include "FakeMaterialModel.h" -#include "FakeEarthModel.h" +#include "FakeDetectorModel.h" using namespace LI::detector; using namespace LI::geometry; @@ -38,7 +38,7 @@ TEST(DefaultConstructor, NoThrow) TEST(DefaultConstructor, HasNone) { Path A; - EXPECT_FALSE(A.HasEarthModel()); + EXPECT_FALSE(A.HasDetectorModel()); EXPECT_FALSE(A.HasPoints()); EXPECT_FALSE(A.HasIntersections()); } @@ -46,7 +46,7 @@ TEST(DefaultConstructor, HasNone) TEST(DefaultConstructor, MembersAreDefault) { Path A; - EXPECT_EQ(std::shared_ptr(), A.GetEarthModel()); + EXPECT_EQ(std::shared_ptr(), A.GetDetectorModel()); EXPECT_EQ(Vector3D(), A.GetFirstPoint()); EXPECT_EQ(Vector3D(), A.GetLastPoint()); EXPECT_EQ(Vector3D(), A.GetDirection()); @@ -54,17 +54,17 @@ TEST(DefaultConstructor, MembersAreDefault) EXPECT_EQ(Geometry::IntersectionList(), A.GetIntersections()); } -TEST(EarthModelConstructor, NoThrow) +TEST(DetectorModelConstructor, NoThrow) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); EXPECT_NO_THROW(Path A(EMp)); } -TEST(EarthModelConstructor, MemberValues) +TEST(DetectorModelConstructor, MemberValues) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Path A(EMp); - EXPECT_EQ(EMp, A.GetEarthModel()); + EXPECT_EQ(EMp, A.GetDetectorModel()); EXPECT_EQ(Vector3D(), A.GetFirstPoint()); EXPECT_EQ(Vector3D(), A.GetLastPoint()); EXPECT_EQ(Vector3D(), A.GetDirection()); @@ -74,7 +74,7 @@ TEST(EarthModelConstructor, MemberValues) TEST(PointsConstructor, NoThrow) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1, 2, 3); Vector3D C(4, 6, 8); EXPECT_NO_THROW(Path A(EMp, B, C)); @@ -82,14 +82,14 @@ TEST(PointsConstructor, NoThrow) TEST(PointsConstructor, MemberValues) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1, 2, 3); Vector3D C(4, 6, 8); Vector3D direction = C - B; double distance = direction.magnitude(); direction.normalize(); Path A(EMp, B, C); - EXPECT_EQ(EMp, A.GetEarthModel()); + EXPECT_EQ(EMp, A.GetDetectorModel()); EXPECT_EQ(B, A.GetFirstPoint()); EXPECT_EQ(C, A.GetLastPoint()); EXPECT_EQ(direction, A.GetDirection()); @@ -99,7 +99,7 @@ TEST(PointsConstructor, MemberValues) TEST(RayConstructor, NoThrow) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1, 2, 3); Vector3D C(4, 6, 8); Vector3D direction = C - B; @@ -110,7 +110,7 @@ TEST(RayConstructor, NoThrow) TEST(RayConstructor, MemberValues) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1, 2, 3); Vector3D C(4, 6, 8); Vector3D direction = C - B; @@ -122,7 +122,7 @@ TEST(RayConstructor, MemberValues) direction.normalize(); direction.normalize(); Path A(EMp, B, direction, distance); - EXPECT_EQ(EMp, A.GetEarthModel()); + EXPECT_EQ(EMp, A.GetDetectorModel()); EXPECT_EQ(B, A.GetFirstPoint()); EXPECT_EQ(B + direction * distance, A.GetLastPoint()); EXPECT_EQ(direction, A.GetDirection()); @@ -130,22 +130,22 @@ TEST(RayConstructor, MemberValues) EXPECT_EQ(Geometry::IntersectionList(), A.GetIntersections()); } -TEST(EarthModel, SetGet) { - std::shared_ptr EMp(new EarthModel()); +TEST(DetectorModel, SetGet) { + std::shared_ptr EMp(new DetectorModel()); Path A; - A.SetEarthModel(EMp); - EXPECT_EQ(EMp, A.GetEarthModel()); + A.SetDetectorModel(EMp); + EXPECT_EQ(EMp, A.GetDetectorModel()); } -TEST(EnsureEarthModel, Throw) { +TEST(EnsureDetectorModel, Throw) { Path A; - EXPECT_THROW(A.EnsureEarthModel(), std::runtime_error); + EXPECT_THROW(A.EnsureDetectorModel(), std::runtime_error); } -TEST(EnsureEarthModel, NoThrow) { - std::shared_ptr EMp(new EarthModel()); +TEST(EnsureDetectorModel, NoThrow) { + std::shared_ptr EMp(new DetectorModel()); Path A(EMp); - EXPECT_NO_THROW(A.EnsureEarthModel()); + EXPECT_NO_THROW(A.EnsureDetectorModel()); } TEST(Points, SetGet) { @@ -216,7 +216,7 @@ TEST(EnsureIntersections, Throw) { Path A; EXPECT_THROW(A.EnsureIntersections(), std::runtime_error); - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); A = Path(EMp); EXPECT_THROW(A.EnsureIntersections(), std::runtime_error); @@ -235,7 +235,7 @@ TEST(EnsureIntersections, Throw) { } TEST(EnsureIntersections, NoThrow) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -245,12 +245,12 @@ TEST(EnsureIntersections, NoThrow) { Path A; A = Path(); - A.SetEarthModel(EMp); + A.SetDetectorModel(EMp); A.SetPoints(B, C); EXPECT_NO_THROW(A.EnsureIntersections()); A = Path(); - A.SetEarthModel(EMp); + A.SetDetectorModel(EMp); A.SetPointsWithRay(B, direction, distance); EXPECT_NO_THROW(A.EnsureIntersections()); @@ -270,7 +270,7 @@ TEST(EnsureIntersections, NoThrow) { } TEST(PointManipulation, Flip) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -299,7 +299,7 @@ TEST(PointManipulation, Flip) { } TEST(PointManipulation, ExtendFromEndByDistance) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -330,20 +330,20 @@ TEST(PointManipulation, ExtendFromEndByDistance) { EXPECT_EQ(0, A.GetDistance()); } -TEST_F(FakeLegacyEarthModelTest, ExtendFromEndByColumnDepth) { +TEST_F(FakeLegacyDetectorModelTest, ExtendFromEndByColumnDepth) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -408,7 +408,7 @@ TEST_F(FakeLegacyEarthModelTest, ExtendFromEndByColumnDepth) { } TEST(PointManipulation, ExtendFromStartByDistance) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -440,20 +440,20 @@ TEST(PointManipulation, ExtendFromStartByDistance) { EXPECT_EQ(0, A.GetDistance()); } -TEST_F(FakeLegacyEarthModelTest, ExtendFromStartByColumnDepth) { +TEST_F(FakeLegacyDetectorModelTest, ExtendFromStartByColumnDepth) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -520,7 +520,7 @@ TEST_F(FakeLegacyEarthModelTest, ExtendFromStartByColumnDepth) { } TEST(PointManipulation, ShrinkFromEndByDistance) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -551,20 +551,20 @@ TEST(PointManipulation, ShrinkFromEndByDistance) { EXPECT_EQ(0, A.GetDistance()); } -TEST_F(FakeLegacyEarthModelTest, ShrinkFromEndByColumnDepth) { +TEST_F(FakeLegacyDetectorModelTest, ShrinkFromEndByColumnDepth) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -629,7 +629,7 @@ TEST_F(FakeLegacyEarthModelTest, ShrinkFromEndByColumnDepth) { } TEST(PointManipulation, ShrinkFromStartByDistance) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -661,20 +661,20 @@ TEST(PointManipulation, ShrinkFromStartByDistance) { EXPECT_EQ(0, A.GetDistance()); } -TEST_F(FakeLegacyEarthModelTest, ShrinkFromStartByColumnDepth) { +TEST_F(FakeLegacyDetectorModelTest, ShrinkFromStartByColumnDepth) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -740,7 +740,7 @@ TEST_F(FakeLegacyEarthModelTest, ShrinkFromStartByColumnDepth) { } TEST(PointManipulation, ExtendFromEndToDistance) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -774,20 +774,20 @@ TEST(PointManipulation, ExtendFromEndToDistance) { EXPECT_EQ(distance, A.GetDistance()); } -TEST_F(FakeLegacyEarthModelTest, ExtendFromEndToColumnDepth) { +TEST_F(FakeLegacyDetectorModelTest, ExtendFromEndToColumnDepth) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -859,7 +859,7 @@ TEST_F(FakeLegacyEarthModelTest, ExtendFromEndToColumnDepth) { TEST(PointManipulation, ExtendFromStartToDistance) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -894,20 +894,20 @@ TEST(PointManipulation, ExtendFromStartToDistance) { EXPECT_EQ(distance, A.GetDistance()); } -TEST_F(FakeLegacyEarthModelTest, ExtendFromStartToColumnDepth) { +TEST_F(FakeLegacyDetectorModelTest, ExtendFromStartToColumnDepth) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -980,7 +980,7 @@ TEST_F(FakeLegacyEarthModelTest, ExtendFromStartToColumnDepth) { } TEST(PointManipulation, ShrinkFromEndToDistance) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -1014,20 +1014,20 @@ TEST(PointManipulation, ShrinkFromEndToDistance) { EXPECT_EQ(0, A.GetDistance()); } -TEST_F(FakeLegacyEarthModelTest, ShrinkFromEndToColumnDepth) { +TEST_F(FakeLegacyDetectorModelTest, ShrinkFromEndToColumnDepth) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1098,7 +1098,7 @@ TEST_F(FakeLegacyEarthModelTest, ShrinkFromEndToColumnDepth) { } TEST(PointManipulation, ShrinkFromStartToDistance) { - std::shared_ptr EMp(new EarthModel()); + std::shared_ptr EMp(new DetectorModel()); Vector3D B(1,2,3); Vector3D C(4,6,8); Vector3D direction = C - B; @@ -1133,20 +1133,20 @@ TEST(PointManipulation, ShrinkFromStartToDistance) { EXPECT_EQ(0, A.GetDistance()); } -TEST_F(FakeLegacyEarthModelTest, ShrinkFromStartToColumnDepth) { +TEST_F(FakeLegacyDetectorModelTest, ShrinkFromStartToColumnDepth) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1217,21 +1217,21 @@ TEST_F(FakeLegacyEarthModelTest, ShrinkFromStartToColumnDepth) { } } -TEST_F(FakeLegacyEarthModelTest, GetColumnDepthInBounds) +TEST_F(FakeLegacyDetectorModelTest, GetColumnDepthInBounds) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1252,21 +1252,21 @@ TEST_F(FakeLegacyEarthModelTest, GetColumnDepthInBounds) } } -TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromStartInBounds) +TEST_F(FakeLegacyDetectorModelTest, GetColumnDepthFromStartInBounds) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1303,21 +1303,21 @@ TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromStartInBounds) } } -TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromEndInBounds) +TEST_F(FakeLegacyDetectorModelTest, GetColumnDepthFromEndInBounds) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1354,21 +1354,21 @@ TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromEndInBounds) } } -TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromStartAlongPath) +TEST_F(FakeLegacyDetectorModelTest, GetColumnDepthFromStartAlongPath) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1405,21 +1405,21 @@ TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromStartAlongPath) } } -TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromEndAlongPath) +TEST_F(FakeLegacyDetectorModelTest, GetColumnDepthFromEndAlongPath) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1456,21 +1456,21 @@ TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromEndAlongPath) } } -TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromStartInReverse) +TEST_F(FakeLegacyDetectorModelTest, GetColumnDepthFromStartInReverse) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1507,21 +1507,21 @@ TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromStartInReverse) } } -TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromEndInReverse) +TEST_F(FakeLegacyDetectorModelTest, GetColumnDepthFromEndInReverse) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1560,21 +1560,21 @@ TEST_F(FakeLegacyEarthModelTest, GetColumnDepthFromEndInReverse) ///////////////////////////////////////////////////////// -TEST_F(FakeLegacyEarthModelTest, GetDistanceFromStartInBounds) +TEST_F(FakeLegacyDetectorModelTest, GetDistanceFromStartInBounds) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1611,21 +1611,21 @@ TEST_F(FakeLegacyEarthModelTest, GetDistanceFromStartInBounds) } } -TEST_F(FakeLegacyEarthModelTest, GetDistanceFromEndInBounds) +TEST_F(FakeLegacyDetectorModelTest, GetDistanceFromEndInBounds) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1662,21 +1662,21 @@ TEST_F(FakeLegacyEarthModelTest, GetDistanceFromEndInBounds) } } -TEST_F(FakeLegacyEarthModelTest, GetDistanceFromStartAlongPath) +TEST_F(FakeLegacyDetectorModelTest, GetDistanceFromStartAlongPath) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1713,21 +1713,21 @@ TEST_F(FakeLegacyEarthModelTest, GetDistanceFromStartAlongPath) } } -TEST_F(FakeLegacyEarthModelTest, GetDistanceFromEndAlongPath) +TEST_F(FakeLegacyDetectorModelTest, GetDistanceFromEndAlongPath) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1764,21 +1764,21 @@ TEST_F(FakeLegacyEarthModelTest, GetDistanceFromEndAlongPath) } } -TEST_F(FakeLegacyEarthModelTest, GetDistanceFromStartInReverse) +TEST_F(FakeLegacyDetectorModelTest, GetDistanceFromStartInReverse) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); @@ -1815,21 +1815,21 @@ TEST_F(FakeLegacyEarthModelTest, GetDistanceFromStartInReverse) } } -TEST_F(FakeLegacyEarthModelTest, GetDistanceFromEndInReverse) +TEST_F(FakeLegacyDetectorModelTest, GetDistanceFromEndInReverse) { unsigned int N_rand = 1000; for(unsigned int i=0; i A(new EarthModel()); + std::shared_ptr A(new DetectorModel()); ASSERT_NO_THROW(A->LoadMaterialModel(materials_file)); double max_depth = 5000; max_depth = std::min(max_depth, *std::max_element(layer_radii.begin(), layer_radii.end())); - double depth = FakeLegacyEarthModelFile::RandomDouble()*max_depth; + double depth = FakeLegacyDetectorModelFile::RandomDouble()*max_depth; double ice_angle = -1; ASSERT_NO_THROW(A->LoadConcentricShellsFromLegacyFile(model_file, depth, ice_angle)); - std::vector sectors = A->GetSectors(); + std::vector sectors = A->GetSectors(); ASSERT_EQ(2, sectors.size()); - EarthSector sector = sectors[1]; + DetectorSector sector = sectors[1]; Sphere const * sphere = dynamic_cast(sector.geo.get()); ASSERT_TRUE(sphere); double max_radius = sphere->GetRadius(); diff --git a/projects/detector/public/LeptonInjector/detector/EarthModel.h b/projects/detector/public/LeptonInjector/detector/DetectorModel.h similarity index 88% rename from projects/detector/public/LeptonInjector/detector/EarthModel.h rename to projects/detector/public/LeptonInjector/detector/DetectorModel.h index 7ba68c11..d71d74d1 100644 --- a/projects/detector/public/LeptonInjector/detector/EarthModel.h +++ b/projects/detector/public/LeptonInjector/detector/DetectorModel.h @@ -1,6 +1,6 @@ #pragma once -#ifndef LI_EarthModel_H -#define LI_EarthModel_H +#ifndef LI_DetectorModel_H +#define LI_DetectorModel_H #include // for map #include // for set @@ -36,13 +36,13 @@ namespace LI { namespace detector { class DensityDistribution; } } namespace LI { namespace detector { -struct EarthSector { +struct DetectorSector { std::string name; int material_id; int level; std::shared_ptr geo; std::shared_ptr density; - bool operator==(EarthSector const & o) const; + bool operator==(DetectorSector const & o) const; template void serialize(Archive & archive, std::uint32_t const version) { if(version == 0) { @@ -52,25 +52,25 @@ struct EarthSector { archive(cereal::make_nvp("Geometry", geo)); archive(cereal::make_nvp("density", density)); } else { - throw std::runtime_error("EarthSector only supports version <= 0!"); + throw std::runtime_error("DetectorSector only supports version <= 0!"); } } std::ostream & Print(std::ostream& oss) const; }; -class EarthModel { +class DetectorModel { private: std::string path_; MaterialModel materials_; - std::vector sectors_; + std::vector sectors_; std::map sector_map_; math::Vector3D detector_origin_; public: - EarthModel(); - EarthModel(std::string const & earth_model, std::string const & material_model); - EarthModel(std::string const & path, std::string const & earth_model, std::string const & material_model); + DetectorModel(); + DetectorModel(std::string const & earth_model, std::string const & material_model); + DetectorModel(std::string const & path, std::string const & earth_model, std::string const & material_model); - bool operator==(EarthModel const & o) const; + bool operator==(DetectorModel const & o) const; template void serialize(Archive & archive, std::uint32_t const version) { @@ -81,11 +81,11 @@ class EarthModel { archive(cereal::make_nvp("SectorMap", sector_map_)); archive(cereal::make_nvp("DetectorOrigin", detector_origin_)); } else { - throw std::runtime_error("EarthModel only supports version <= 0!"); + throw std::runtime_error("DetectorModel only supports version <= 0!"); } } - void LoadEarthModel(std::string const & earth_model); + void LoadDetectorModel(std::string const & earth_model); void LoadMaterialModel(std::string const & material_model); double GetMassDensity(geometry::Geometry::IntersectionList const & intersections, math::Vector3D const & p0) const; @@ -149,8 +149,8 @@ class EarthModel { std::vector GetParticleColumnDepth(geometry::Geometry::IntersectionList const & intersections, math::Vector3D const & p0, math::Vector3D const & p1, std::vector const & targets) const; - EarthSector GetContainingSector(geometry::Geometry::IntersectionList const & intersections, math::Vector3D const & p0) const; - EarthSector GetContainingSector(math::Vector3D const & p0) const; + DetectorSector GetContainingSector(geometry::Geometry::IntersectionList const & intersections, math::Vector3D const & p0) const; + DetectorSector GetContainingSector(math::Vector3D const & p0) const; math::Vector3D GetEarthCoordPosFromDetCoordPos(math::Vector3D const & point) const; math::Vector3D GetEarthCoordDirFromDetCoordDir(math::Vector3D const & direction) const; math::Vector3D GetDetCoordPosFromEarthCoordPos(math::Vector3D const & point) const; @@ -162,14 +162,14 @@ class EarthModel { MaterialModel const & GetMaterials() const; void SetMaterials(MaterialModel const & materials); - std::vector const & GetSectors() const; - void SetSectors(std::vector const & sectors); + std::vector const & GetSectors() const; + void SetSectors(std::vector const & sectors); math::Vector3D GetDetectorOrigin() const; void SetDetectorOrigin(math::Vector3D const & detector_origin); - void AddSector(EarthSector sector); - EarthSector GetSector(int level) const; + void AddSector(DetectorSector sector); + DetectorSector GetSector(int level) const; void ClearSectors(); @@ -196,11 +196,11 @@ class EarthModel { } // namespace LI -std::ostream& operator<<(std::ostream& oss, LI::detector::EarthSector const & bcm); -std::ostream& operator<<(std::ostream& oss, LI::detector::EarthSector & bcm); +std::ostream& operator<<(std::ostream& oss, LI::detector::DetectorSector const & bcm); +std::ostream& operator<<(std::ostream& oss, LI::detector::DetectorSector & bcm); -#include "LeptonInjector/detector/EarthModel.tcc" +#include "LeptonInjector/detector/DetectorModel.tcc" -CEREAL_CLASS_VERSION(LI::detector::EarthModel, 0); +CEREAL_CLASS_VERSION(LI::detector::DetectorModel, 0); -#endif // LI_EarthModel_H +#endif // LI_DetectorModel_H diff --git a/projects/detector/public/LeptonInjector/detector/EarthModel.tcc b/projects/detector/public/LeptonInjector/detector/DetectorModel.tcc similarity index 84% rename from projects/detector/public/LeptonInjector/detector/EarthModel.tcc rename to projects/detector/public/LeptonInjector/detector/DetectorModel.tcc index 887bae5e..9be16ed4 100644 --- a/projects/detector/public/LeptonInjector/detector/EarthModel.tcc +++ b/projects/detector/public/LeptonInjector/detector/DetectorModel.tcc @@ -1,18 +1,18 @@ #pragma once -#ifndef LI_EarthModel_TCC -#define LI_EarthModel_TCC +#ifndef LI_DetectorModel_TCC +#define LI_DetectorModel_TCC #include #include -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/detector/DensityDistribution.h" namespace LI { namespace detector { template -double EarthModel::GetMassDensity(geometry::Geometry::IntersectionList const & intersections, math::Vector3D const & p0, Iterator begin, Iterator end) const { +double DetectorModel::GetMassDensity(geometry::Geometry::IntersectionList const & intersections, math::Vector3D const & p0, Iterator begin, Iterator end) const { math::Vector3D direction = p0 - intersections.position; if(direction.magnitude() == 0) { direction = intersections.direction; @@ -37,7 +37,7 @@ double EarthModel::GetMassDensity(geometry::Geometry::IntersectionList const & i // whereas the lower end is bounded by the end of the last line segment, and the entry into the sector double start_point = std::max(offset + dot * current_intersection->distance, offset + dot * last_point); if(start_point <= 0 and end_point >= 0) { - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); density = sector.density->Evaluate(p0); std::vector mass_fractions = materials_.GetTargetMassFraction(sector.material_id, begin, end); density *= std::accumulate(mass_fractions.begin(), mass_fractions.end(), 0.0); @@ -55,7 +55,7 @@ double EarthModel::GetMassDensity(geometry::Geometry::IntersectionList const & i } template -double EarthModel::GetMassDensity(math::Vector3D const & p0, Iterator begin, Iterator end) const { +double DetectorModel::GetMassDensity(math::Vector3D const & p0, Iterator begin, Iterator end) const { math::Vector3D direction(1,0,0); // Any direction will work for determining the sector heirarchy geometry::Geometry::IntersectionList intersections = GetIntersections(p0, direction); return GetMassDensity(intersections, p0, begin, end); @@ -63,7 +63,7 @@ double EarthModel::GetMassDensity(math::Vector3D const & p0, Iterator begin, Ite template -std::vector EarthModel::GetParticleDensity(geometry::Geometry::IntersectionList const & intersections, math::Vector3D const & p0, Iterator begin, Iterator end) const { +std::vector DetectorModel::GetParticleDensity(geometry::Geometry::IntersectionList const & intersections, math::Vector3D const & p0, Iterator begin, Iterator end) const { math::Vector3D direction = p0 - intersections.position; if(direction.magnitude() == 0) { direction = intersections.direction; @@ -89,7 +89,7 @@ std::vector EarthModel::GetParticleDensity(geometry::Geometry::Intersect // whereas the lower end is bounded by the end of the last line segment, and the entry into the sector double start_point = std::max(offset + dot * current_intersection->distance, offset + dot * last_point); if(start_point <= 0 and end_point >= 0) { - EarthSector sector = GetSector(current_intersection->hierarchy); + DetectorSector sector = GetSector(current_intersection->hierarchy); density = sector.density->Evaluate(p0); particle_fractions = materials_.GetTargetParticleFraction(sector.material_id, begin, end); return true; @@ -110,7 +110,7 @@ std::vector EarthModel::GetParticleDensity(geometry::Geometry::Intersect } template -std::vector EarthModel::GetParticleDensity(math::Vector3D const & p0, Iterator begin, Iterator end) const { +std::vector DetectorModel::GetParticleDensity(math::Vector3D const & p0, Iterator begin, Iterator end) const { math::Vector3D direction(1,0,0); // Any direction will work for determining the sector heirarchy geometry::Geometry::IntersectionList intersections = GetIntersections(p0, direction); return GetParticleDensity(intersections, p0, begin, end); diff --git a/projects/detector/public/LeptonInjector/detector/Path.h b/projects/detector/public/LeptonInjector/detector/Path.h index 88b86b23..e714fd80 100644 --- a/projects/detector/public/LeptonInjector/detector/Path.h +++ b/projects/detector/public/LeptonInjector/detector/Path.h @@ -22,7 +22,7 @@ #include "LeptonInjector/dataclasses/Particle.h" // for Particle #include "LeptonInjector/geometry/Geometry.h" // for Geometry -#include "LeptonInjector/detector/EarthModel.h" // for EarthModel +#include "LeptonInjector/detector/DetectorModel.h" // for DetectorModel #include "LeptonInjector/math/Vector3D.h" // for Vector3D namespace LI { @@ -30,7 +30,7 @@ namespace detector { class Path { private: - std::shared_ptr earth_model_; + std::shared_ptr earth_model_; bool set_earth_model_ = false; math::Vector3D first_point_; @@ -46,15 +46,15 @@ class Path { bool set_intersections_ = false; public: Path(); - Path(std::shared_ptr earth_model); - Path(std::shared_ptr earth_model, math::Vector3D const & first_point, math::Vector3D const & last_point); - Path(std::shared_ptr earth_model, math::Vector3D const & first_point, math::Vector3D const & direction, double distance); + Path(std::shared_ptr earth_model); + Path(std::shared_ptr earth_model, math::Vector3D const & first_point, math::Vector3D const & last_point); + Path(std::shared_ptr earth_model, math::Vector3D const & first_point, math::Vector3D const & direction, double distance); template void serialize(Archive & archive, std::uint32_t const version) { if(version == 0) { - archive(cereal::make_nvp("EarthModel", earth_model_)); - archive(cereal::make_nvp("SetEarthModel", set_earth_model_)); + archive(cereal::make_nvp("DetectorModel", earth_model_)); + archive(cereal::make_nvp("SetDetectorModel", set_earth_model_)); archive(cereal::make_nvp("FirstPoint", first_point_)); archive(cereal::make_nvp("LastPoint", last_point_)); archive(cereal::make_nvp("Distance", distance_)); @@ -64,20 +64,20 @@ class Path { } } - bool HasEarthModel(); + bool HasDetectorModel(); bool HasPoints(); bool HasIntersections(); bool HasColumnDepth(); - std::shared_ptr GetEarthModel(); + std::shared_ptr GetDetectorModel(); math::Vector3D const & GetFirstPoint(); math::Vector3D const & GetLastPoint(); math::Vector3D const & GetDirection(); double GetDistance(); geometry::Geometry::IntersectionList const & GetIntersections(); - void SetEarthModel(std::shared_ptr earth_model); - void EnsureEarthModel(); + void SetDetectorModel(std::shared_ptr earth_model); + void EnsureDetectorModel(); void SetPoints(math::Vector3D first_point, math::Vector3D last_point); void SetPointsWithRay(math::Vector3D first_point, math::Vector3D direction, double distance); diff --git a/projects/distributions/CMakeLists.txt b/projects/distributions/CMakeLists.txt index 2341f6fa..c48735bd 100644 --- a/projects/distributions/CMakeLists.txt +++ b/projects/distributions/CMakeLists.txt @@ -52,7 +52,7 @@ target_link_libraries(LI_distributions LI_dataclasses LI_geometry LI_detector - LI_crosssections + LI_interactions ) install(DIRECTORY "${PROJECT_SOURCE_DIR}/projects/distributions/public/" diff --git a/projects/distributions/private/Distributions.cxx b/projects/distributions/private/Distributions.cxx index acc1dac7..1b8982a1 100644 --- a/projects/distributions/private/Distributions.cxx +++ b/projects/distributions/private/Distributions.cxx @@ -53,12 +53,12 @@ bool WeightableDistribution::operator<(WeightableDistribution const & distributi return std::type_index(typeid(this)) < std::type_index(typeid(&distribution)); } -bool WeightableDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const { +bool WeightableDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const { return this->operator==(*distribution); } -double WeightableDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum const & datum) const { - return GenerationProbability(earth_model, cross_sections, datum.record); +double WeightableDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum const & datum) const { + return GenerationProbability(earth_model, interactions, datum.record); } //--------------- @@ -71,7 +71,7 @@ NormalizationConstant::NormalizationConstant(double norm) { SetNormalization(norm); } -double NormalizationConstant::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double NormalizationConstant::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { return 1.0; } @@ -95,11 +95,11 @@ bool NormalizationConstant::less(WeightableDistribution const & distribution) co // class InjectionDistribution //--------------- -void InjectionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +void InjectionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { } -void InjectionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum & datum) const { - Sample(rand, earth_model, cross_sections, datum.record); +void InjectionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum & datum) const { + Sample(rand, earth_model, interactions, datum.record); } } // namespace distributions diff --git a/projects/distributions/private/primary/direction/Cone.cxx b/projects/distributions/private/primary/direction/Cone.cxx index a7e436df..0aeb22ee 100644 --- a/projects/distributions/private/primary/direction/Cone.cxx +++ b/projects/distributions/private/primary/direction/Cone.cxx @@ -11,8 +11,8 @@ #include "LeptonInjector/math/Vector3D.h" // for Vector3D #include "LeptonInjector/utilities/Random.h" // for LI_random -namespace LI { namespace crosssections { class CrossSectionCollection; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace interactions { class InteractionCollection; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { @@ -34,7 +34,7 @@ Cone::Cone(LI::math::Vector3D dir, double opening_angle) : dir(dir), opening_ang } } -LI::math::Vector3D Cone::SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const{ +LI::math::Vector3D Cone::SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const{ double theta = acos(rand->Uniform(cos(opening_angle), 1)); double phi = rand->Uniform(0, 2.0 * M_PI); LI::math::Quaternion q; @@ -42,7 +42,7 @@ LI::math::Vector3D Cone::SampleDirection(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double Cone::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D event_dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); event_dir.normalize(); double c = LI::math::scalar_product(dir, event_dir); diff --git a/projects/distributions/private/primary/direction/FixedDirection.cxx b/projects/distributions/private/primary/direction/FixedDirection.cxx index 80b8e2b7..fe373762 100644 --- a/projects/distributions/private/primary/direction/FixedDirection.cxx +++ b/projects/distributions/private/primary/direction/FixedDirection.cxx @@ -9,8 +9,8 @@ #include "LeptonInjector/distributions/Distributions.h" // for InjectionD... #include "LeptonInjector/math/Vector3D.h" // for Vector3D -namespace LI { namespace crosssections { class CrossSectionCollection; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace interactions { class InteractionCollection; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { @@ -19,11 +19,11 @@ namespace distributions { //--------------- // class FixedDirection : PrimaryDirectionDistribution //--------------- -LI::math::Vector3D FixedDirection::SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +LI::math::Vector3D FixedDirection::SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { return dir; } -double FixedDirection::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double FixedDirection::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D event_dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); event_dir.normalize(); if(abs(1.0 - LI::math::scalar_product(dir, event_dir)) < 1e-9) diff --git a/projects/distributions/private/primary/direction/IsotropicDirection.cxx b/projects/distributions/private/primary/direction/IsotropicDirection.cxx index 1a29f612..35f51898 100644 --- a/projects/distributions/private/primary/direction/IsotropicDirection.cxx +++ b/projects/distributions/private/primary/direction/IsotropicDirection.cxx @@ -7,9 +7,9 @@ #include "LeptonInjector/math/Vector3D.h" // for Vector3D #include "LeptonInjector/utilities/Random.h" // for LI_random -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { @@ -17,7 +17,7 @@ namespace distributions { //--------------- // class IsotropicDirection : PrimaryDirectionDistribution //--------------- -LI::math::Vector3D IsotropicDirection::SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +LI::math::Vector3D IsotropicDirection::SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { double nz = rand->Uniform(-1, 1); double nr = sqrt(1.0 - nz*nz); double phi = rand->Uniform(-M_PI, M_PI); @@ -28,7 +28,7 @@ LI::math::Vector3D IsotropicDirection::SampleDirection(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double IsotropicDirection::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { return 1.0 / (4.0 * M_PI); } diff --git a/projects/distributions/private/primary/direction/PrimaryDirectionDistribution.cxx b/projects/distributions/private/primary/direction/PrimaryDirectionDistribution.cxx index 9bce69c1..98ba03e3 100644 --- a/projects/distributions/private/primary/direction/PrimaryDirectionDistribution.cxx +++ b/projects/distributions/private/primary/direction/PrimaryDirectionDistribution.cxx @@ -13,8 +13,8 @@ namespace distributions { //--------------- // class PrimaryDirectionDistribution : InjectionDistribution //--------------- -void PrimaryDirectionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { - LI::math::Vector3D dir = SampleDirection(rand, earth_model, cross_sections, record); +void PrimaryDirectionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { + LI::math::Vector3D dir = SampleDirection(rand, earth_model, interactions, record); double energy = record.primary_momentum[0]; double mass = record.primary_mass; double momentum = std::sqrt(energy*energy - mass*mass); diff --git a/projects/distributions/private/primary/energy/ModifiedMoyalPlusExponentialEnergyDistribution.cxx b/projects/distributions/private/primary/energy/ModifiedMoyalPlusExponentialEnergyDistribution.cxx index 8e018c9e..86b119ee 100644 --- a/projects/distributions/private/primary/energy/ModifiedMoyalPlusExponentialEnergyDistribution.cxx +++ b/projects/distributions/private/primary/energy/ModifiedMoyalPlusExponentialEnergyDistribution.cxx @@ -12,8 +12,8 @@ #include "LeptonInjector/utilities/Integration.h" // for rombergInt... #include "LeptonInjector/utilities/Random.h" // for LI_random -namespace LI { namespace crosssections { class CrossSectionCollection; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace interactions { class InteractionCollection; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { @@ -62,7 +62,7 @@ ModifiedMoyalPlusExponentialEnergyDistribution::ModifiedMoyalPlusExponentialEner } } -double ModifiedMoyalPlusExponentialEnergyDistribution::SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double ModifiedMoyalPlusExponentialEnergyDistribution::SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { // Metropolis-Hastings algorithm to sample from PDF. // Pass in a function pointer for the PDF @@ -88,7 +88,7 @@ double ModifiedMoyalPlusExponentialEnergyDistribution::SampleEnergy(std::shared_ return energy; } -double ModifiedMoyalPlusExponentialEnergyDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double ModifiedMoyalPlusExponentialEnergyDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { double const & energy = record.primary_momentum[0]; if(energy < energyMin or energy > energyMax) return 0.0; diff --git a/projects/distributions/private/primary/energy/Monoenergetic.cxx b/projects/distributions/private/primary/energy/Monoenergetic.cxx index e60b1aa5..f3e6e0d0 100644 --- a/projects/distributions/private/primary/energy/Monoenergetic.cxx +++ b/projects/distributions/private/primary/energy/Monoenergetic.cxx @@ -9,8 +9,8 @@ #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interactio... #include "LeptonInjector/distributions/Distributions.h" // for InjectionD... -namespace LI { namespace crosssections { class CrossSectionCollection; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace interactions { class InteractionCollection; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { @@ -23,7 +23,7 @@ Monoenergetic::Monoenergetic(double gen_energy) : gen_energy(gen_energy) {} -double Monoenergetic::SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double Monoenergetic::SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { return gen_energy; } @@ -33,7 +33,7 @@ double Monoenergetic::pdf(double energy) const { return 0.0; } -double Monoenergetic::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double Monoenergetic::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { return pdf(record.primary_momentum[0]); } diff --git a/projects/distributions/private/primary/energy/PowerLaw.cxx b/projects/distributions/private/primary/energy/PowerLaw.cxx index cd6ba7c0..a1639a4d 100644 --- a/projects/distributions/private/primary/energy/PowerLaw.cxx +++ b/projects/distributions/private/primary/energy/PowerLaw.cxx @@ -9,8 +9,8 @@ #include "LeptonInjector/distributions/Distributions.h" // for InjectionD... #include "LeptonInjector/utilities/Random.h" // for LI_random -namespace LI { namespace crosssections { class CrossSectionCollection; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace interactions { class InteractionCollection; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { @@ -24,7 +24,7 @@ PowerLaw::PowerLaw(double powerLawIndex, double energyMin, double energyMax) , energyMax(energyMax) {} -double PowerLaw::SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double PowerLaw::SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { if(energyMin == energyMax) return energyMin; //return the only allowed energy @@ -48,7 +48,7 @@ double PowerLaw::pdf(double energy) const { } } -double PowerLaw::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double PowerLaw::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { return pdf(record.primary_momentum[0]); } diff --git a/projects/distributions/private/primary/energy/PrimaryEnergyDistribution.cxx b/projects/distributions/private/primary/energy/PrimaryEnergyDistribution.cxx index fdb0beeb..5d0caa01 100644 --- a/projects/distributions/private/primary/energy/PrimaryEnergyDistribution.cxx +++ b/projects/distributions/private/primary/energy/PrimaryEnergyDistribution.cxx @@ -13,10 +13,10 @@ namespace distributions { //--------------- void PrimaryEnergyDistribution::Sample( std::shared_ptr rand, - std::shared_ptr earth_model, - std::shared_ptr cross_sections, + std::shared_ptr earth_model, + std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { - record.primary_momentum[0] = SampleEnergy(rand, earth_model, cross_sections, record); + record.primary_momentum[0] = SampleEnergy(rand, earth_model, interactions, record); } std::vector PrimaryEnergyDistribution::DensityVariables() const { diff --git a/projects/distributions/private/primary/energy/TabulatedFluxDistribution.cxx b/projects/distributions/private/primary/energy/TabulatedFluxDistribution.cxx index 5e3043f3..dc7eaa7a 100644 --- a/projects/distributions/private/primary/energy/TabulatedFluxDistribution.cxx +++ b/projects/distributions/private/primary/energy/TabulatedFluxDistribution.cxx @@ -11,8 +11,8 @@ #include "LeptonInjector/utilities/Interpolator.h" // for TableData1D #include "LeptonInjector/utilities/Random.h" // for LI_random -namespace LI { namespace crosssections { class CrossSectionCollection; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace interactions { class InteractionCollection; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { @@ -196,7 +196,7 @@ TabulatedFluxDistribution::TabulatedFluxDistribution(double energyMin, double en ComputeCDF(); } -double TabulatedFluxDistribution::SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double TabulatedFluxDistribution::SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { // inverse CDF algorithm to sample from PDF. double randomValue = rand->Uniform(0,1); @@ -204,7 +204,7 @@ double TabulatedFluxDistribution::SampleEnergy(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double TabulatedFluxDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { double const & energy = record.primary_momentum[0]; if(energy < energyMin or energy > energyMax) return 0.0; diff --git a/projects/distributions/private/primary/helicity/PrimaryNeutrinoHelicityDistribution.cxx b/projects/distributions/private/primary/helicity/PrimaryNeutrinoHelicityDistribution.cxx index 3100b47f..5f7ca538 100644 --- a/projects/distributions/private/primary/helicity/PrimaryNeutrinoHelicityDistribution.cxx +++ b/projects/distributions/private/primary/helicity/PrimaryNeutrinoHelicityDistribution.cxx @@ -16,7 +16,7 @@ namespace distributions { //--------------- // class PrimaryNeutrinoHelicityDistribution : InjectionDistribution //--------------- -void PrimaryNeutrinoHelicityDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +void PrimaryNeutrinoHelicityDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { LI::dataclasses::Particle::ParticleType & t = record.signature.primary_type; if(t > 0) // Particles are left handed, anti-particles are right handed record.primary_helicity = -0.5; @@ -24,7 +24,7 @@ void PrimaryNeutrinoHelicityDistribution::Sample(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double PrimaryNeutrinoHelicityDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { std::array const & mom = record.primary_momentum; LI::math::Vector3D dir(mom[1], mom[2], mom[3]); dir.normalize(); diff --git a/projects/distributions/private/primary/type/PrimaryInjector.cxx b/projects/distributions/private/primary/type/PrimaryInjector.cxx index 821dd2da..2db7ec71 100644 --- a/projects/distributions/private/primary/type/PrimaryInjector.cxx +++ b/projects/distributions/private/primary/type/PrimaryInjector.cxx @@ -30,11 +30,11 @@ double PrimaryInjector::PrimaryMass() const { return primary_mass; } -void PrimaryInjector::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +void PrimaryInjector::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { record.signature.primary_type = primary_type; record.primary_mass = primary_mass; } -double PrimaryInjector::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double PrimaryInjector::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { if(record.signature.primary_type != primary_type) return 0.0; if(2.0 * abs(record.primary_mass - primary_mass) / (record.primary_mass + primary_mass) > 1e-9) { diff --git a/projects/distributions/private/primary/vertex/ColumnDepthPositionDistribution.cxx b/projects/distributions/private/primary/vertex/ColumnDepthPositionDistribution.cxx index 6216cecd..4c04d53b 100644 --- a/projects/distributions/private/primary/vertex/ColumnDepthPositionDistribution.cxx +++ b/projects/distributions/private/primary/vertex/ColumnDepthPositionDistribution.cxx @@ -6,12 +6,12 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/CrossSectionCollection.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/InteractionCollection.h" #include "LeptonInjector/dataclasses/InteractionRecord.h" #include "LeptonInjector/dataclasses/InteractionSignature.h" #include "LeptonInjector/dataclasses/Particle.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/detector/Path.h" #include "LeptonInjector/distributions/Distributions.h" #include "LeptonInjector/distributions/primary/vertex/DepthFunction.h" @@ -52,7 +52,7 @@ LI::math::Vector3D ColumnDepthPositionDistribution::SampleFromDisk(std::shared_p return q.rotate(pos, false); } -LI::math::Vector3D ColumnDepthPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +LI::math::Vector3D ColumnDepthPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D pca = SampleFromDisk(rand, dir); @@ -66,18 +66,18 @@ LI::math::Vector3D ColumnDepthPositionDistribution::SamplePosition(std::shared_p path.ExtendFromStartByColumnDepth(lepton_depth); path.ClipToOuterBounds(); - std::set const & possible_targets = cross_sections->TargetTypes(); + std::set const & possible_targets = interactions->TargetTypes(); std::vector targets(possible_targets.begin(), possible_targets.end()); std::vector total_cross_sections(targets.size(), 0.0); - double total_decay_length = cross_sections->TotalDecayLength(record); + double total_decay_length = interactions->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(unsigned int i=0; iGetTargetMass(target); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - for(auto const & cross_section : cross_sections->GetCrossSectionsForTarget(target)) { + for(auto const & cross_section : interactions->GetCrossSectionsForTarget(target)) { total_cross_sections[i] += cross_section->TotalCrossSection(fake_record); } } @@ -103,14 +103,14 @@ LI::math::Vector3D ColumnDepthPositionDistribution::SamplePosition(std::shared_p } // public getter function for the private SamplePosition function (for debugging) -LI::math::Vector3D ColumnDepthPositionDistribution::GetSamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) { +LI::math::Vector3D ColumnDepthPositionDistribution::GetSamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) { - LI::math::Vector3D samplepos = ColumnDepthPositionDistribution::SamplePosition(rand, earth_model, cross_sections, record); + LI::math::Vector3D samplepos = ColumnDepthPositionDistribution::SamplePosition(rand, earth_model, interactions, record); return samplepos; } -double ColumnDepthPositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double ColumnDepthPositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(record.interaction_vertex); // m @@ -134,11 +134,11 @@ double ColumnDepthPositionDistribution::GenerationProbability(std::shared_ptr
  • const & possible_targets = cross_sections->TargetTypes(); + std::set const & possible_targets = interactions->TargetTypes(); std::vector targets(possible_targets.begin(), possible_targets.end()); std::vector total_cross_sections(targets.size(), 0.0); - double total_decay_length = cross_sections->TotalDecayLength(record); + double total_decay_length = interactions->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(unsigned int i=0; iGetTargetMass(target); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - for(auto const & cross_section : cross_sections->GetCrossSectionsForTarget(target)) { + for(auto const & cross_section : interactions->GetCrossSectionsForTarget(target)) { total_cross_sections[i] += cross_section->TotalCrossSection(fake_record); } } @@ -180,7 +180,7 @@ std::shared_ptr ColumnDepthPositionDistribution::clone() return std::shared_ptr(new ColumnDepthPositionDistribution(*this)); } -std::pair ColumnDepthPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +std::pair ColumnDepthPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(record.interaction_vertex); // m diff --git a/projects/distributions/private/primary/vertex/CylinderVolumePositionDistribution.cxx b/projects/distributions/private/primary/vertex/CylinderVolumePositionDistribution.cxx index a02782cb..33b986ca 100644 --- a/projects/distributions/private/primary/vertex/CylinderVolumePositionDistribution.cxx +++ b/projects/distributions/private/primary/vertex/CylinderVolumePositionDistribution.cxx @@ -7,13 +7,13 @@ #include // for abs #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interactio... -#include "LeptonInjector/detector/EarthModel.h" // for EarthModel +#include "LeptonInjector/detector/DetectorModel.h" // for DetectorModel #include "LeptonInjector/distributions/Distributions.h" // for InjectionD... #include "LeptonInjector/geometry/Geometry.h" // for Geometry #include "LeptonInjector/math/Vector3D.h" // for Vector3D #include "LeptonInjector/utilities/Random.h" // for LI_random -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace distributions { @@ -21,7 +21,7 @@ namespace distributions { //--------------- // class CylinderVolumePositionDistribution : public VertexPositionDistribution //--------------- -LI::math::Vector3D CylinderVolumePositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +LI::math::Vector3D CylinderVolumePositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { double t = rand->Uniform(0, 2 * M_PI); const double outer_radius = cylinder.GetRadius(); const double inner_radius = cylinder.GetInnerRadius(); @@ -32,7 +32,7 @@ LI::math::Vector3D CylinderVolumePositionDistribution::SamplePosition(std::share return cylinder.LocalToGlobalPosition(pos); } -double CylinderVolumePositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double CylinderVolumePositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D pos(record.interaction_vertex); double z = pos.GetZ(); double r = sqrt(pos.GetX() * pos.GetX() + pos.GetY() * pos.GetY()); @@ -56,12 +56,12 @@ std::shared_ptr CylinderVolumePositionDistribution::clone return std::shared_ptr(new CylinderVolumePositionDistribution(*this)); } -std::pair CylinderVolumePositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const { +std::pair CylinderVolumePositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const { LI::math::Vector3D dir(interaction.primary_momentum[1], interaction.primary_momentum[2], interaction.primary_momentum[3]); dir.normalize(); LI::math::Vector3D pos(interaction.interaction_vertex); std::vector intersections = cylinder.Intersections(pos, dir); - LI::detector::EarthModel::SortIntersections(intersections); + LI::detector::DetectorModel::SortIntersections(intersections); if(intersections.size() == 0) { return std::pair(LI::math::Vector3D(0, 0, 0), LI::math::Vector3D(0, 0, 0)); } else if(intersections.size() >= 2) { @@ -85,7 +85,7 @@ bool CylinderVolumePositionDistribution::less(WeightableDistribution const & oth return cylinder < x->cylinder; } -bool CylinderVolumePositionDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const { +bool CylinderVolumePositionDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const { return this->operator==(*distribution); } diff --git a/projects/distributions/private/primary/vertex/DecayRangePositionDistribution.cxx b/projects/distributions/private/primary/vertex/DecayRangePositionDistribution.cxx index ea8953e3..2d90a8f8 100644 --- a/projects/distributions/private/primary/vertex/DecayRangePositionDistribution.cxx +++ b/projects/distributions/private/primary/vertex/DecayRangePositionDistribution.cxx @@ -7,7 +7,7 @@ #include "LeptonInjector/dataclasses/InteractionRecord.h" #include "LeptonInjector/dataclasses/Particle.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/detector/Path.h" #include "LeptonInjector/distributions/Distributions.h" #include "LeptonInjector/distributions/primary/vertex/DecayRangeFunction.h" @@ -30,7 +30,7 @@ LI::math::Vector3D DecayRangePositionDistribution::SampleFromDisk(std::shared_pt return q.rotate(pos, false); } -LI::math::Vector3D DecayRangePositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +LI::math::Vector3D DecayRangePositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D pca = SampleFromDisk(rand, dir); @@ -53,7 +53,7 @@ LI::math::Vector3D DecayRangePositionDistribution::SamplePosition(std::shared_pt return vertex; } -double DecayRangePositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double DecayRangePositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(record.interaction_vertex); // m @@ -96,7 +96,7 @@ std::shared_ptr DecayRangePositionDistribution::clone() c return std::shared_ptr(new DecayRangePositionDistribution(*this)); } -std::pair DecayRangePositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +std::pair DecayRangePositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(record.interaction_vertex); // m @@ -150,7 +150,7 @@ bool DecayRangePositionDistribution::less(WeightableDistribution const & other) std::tie(radius, x->endcap_length, range_less); } -bool DecayRangePositionDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const { +bool DecayRangePositionDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const { return this->operator==(*distribution); } diff --git a/projects/distributions/private/primary/vertex/OrientedCylinderPositionDistribution.cxx b/projects/distributions/private/primary/vertex/OrientedCylinderPositionDistribution.cxx index be05928b..62feeba7 100644 --- a/projects/distributions/private/primary/vertex/OrientedCylinderPositionDistribution.cxx +++ b/projects/distributions/private/primary/vertex/OrientedCylinderPositionDistribution.cxx @@ -25,13 +25,13 @@ LI::math::Vector3D OrientedCylinderPositionDistribution::SampleFromDisk(std::sha return q.rotate(pos, false); } -LI::math::Vector3D OrientedCylinderPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +LI::math::Vector3D OrientedCylinderPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D pca = SampleFromDisk(rand, dir); /* - std::pair GetBounds(earth_model, cross_sections, pca); + std::pair GetBounds(earth_model, interactions, pca); LI::math::Vector3D p0; LI::math::Vector3D p1; @@ -43,15 +43,15 @@ LI::math::Vector3D OrientedCylinderPositionDistribution::SamplePosition(std::sha return LI::math::Vector3D(); } -double OrientedCylinderPositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double OrientedCylinderPositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { return 0.0; } -std::pair OrientedCylinderPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const { +std::pair OrientedCylinderPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const { return std::make_pair(LI::math::Vector3D(), LI::math::Vector3D()); } -bool OrientedCylinderPositionDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const { +bool OrientedCylinderPositionDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const { return false; } diff --git a/projects/distributions/private/primary/vertex/PointSourcePositionDistribution.cxx b/projects/distributions/private/primary/vertex/PointSourcePositionDistribution.cxx index 4d92f25d..31939147 100644 --- a/projects/distributions/private/primary/vertex/PointSourcePositionDistribution.cxx +++ b/projects/distributions/private/primary/vertex/PointSourcePositionDistribution.cxx @@ -6,12 +6,12 @@ #include // for bas... #include // for vector -#include "LeptonInjector/crosssections/CrossSection.h" // for Cro... -#include "LeptonInjector/crosssections/CrossSectionCollection.h" // for Cro... +#include "LeptonInjector/interactions/CrossSection.h" // for Cro... +#include "LeptonInjector/interactions/InteractionCollection.h" // for Cro... #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Int... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Int... #include "LeptonInjector/dataclasses/Particle.h" // for Par... -#include "LeptonInjector/detector/EarthModel.h" // for Ear... +#include "LeptonInjector/detector/DetectorModel.h" // for Ear... #include "LeptonInjector/detector/Path.h" // for Path #include "LeptonInjector/distributions/Distributions.h" // for Inj... #include "LeptonInjector/math/Vector3D.h" // for Vec... @@ -43,7 +43,7 @@ namespace { // class PointSourcePositionDistribution : public VertexPositionDistribution //--------------- -LI::math::Vector3D PointSourcePositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +LI::math::Vector3D PointSourcePositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); @@ -54,18 +54,18 @@ LI::math::Vector3D PointSourcePositionDistribution::SamplePosition(std::shared_p LI::detector::Path path(earth_model, earth_model->GetEarthCoordPosFromDetCoordPos(endcap_0), earth_model->GetEarthCoordDirFromDetCoordDir(dir), max_distance); path.ClipToOuterBounds(); - std::set const & possible_targets = cross_sections->TargetTypes(); + std::set const & possible_targets = interactions->TargetTypes(); std::vector targets(possible_targets.begin(), possible_targets.end()); std::vector total_cross_sections(targets.size(), 0.0); - double total_decay_length = cross_sections->TotalDecayLength(record); + double total_decay_length = interactions->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(unsigned int i=0; iGetTargetMass(target); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - for(auto const & cross_section : cross_sections->GetCrossSectionsForTarget(target)) { + for(auto const & cross_section : interactions->GetCrossSectionsForTarget(target)) { total_cross_sections[i] += cross_section->TotalCrossSection(fake_record); } } @@ -89,7 +89,7 @@ LI::math::Vector3D PointSourcePositionDistribution::SamplePosition(std::shared_p return vertex; } -double PointSourcePositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double PointSourcePositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(record.interaction_vertex); // m @@ -104,18 +104,18 @@ double PointSourcePositionDistribution::GenerationProbability(std::shared_ptr
  • const & possible_targets = cross_sections->TargetTypes(); + std::set const & possible_targets = interactions->TargetTypes(); std::vector targets(possible_targets.begin(), possible_targets.end()); std::vector total_cross_sections(targets.size(), 0.0); - double total_decay_length = cross_sections->TotalDecayLength(record); + double total_decay_length = interactions->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(unsigned int i=0; iGetTargetMass(target); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - for(auto const & cross_section : cross_sections->GetCrossSectionsForTarget(target)) { + for(auto const & cross_section : interactions->GetCrossSectionsForTarget(target)) { total_cross_sections[i] += cross_section->TotalCrossSection(fake_record); } } @@ -149,7 +149,7 @@ std::shared_ptr PointSourcePositionDistribution::clone() return std::shared_ptr(new PointSourcePositionDistribution(*this)); } -std::pair PointSourcePositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +std::pair PointSourcePositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(record.interaction_vertex); // m diff --git a/projects/distributions/private/primary/vertex/RangePositionDistribution.cxx b/projects/distributions/private/primary/vertex/RangePositionDistribution.cxx index 3af16be9..bbabbef2 100644 --- a/projects/distributions/private/primary/vertex/RangePositionDistribution.cxx +++ b/projects/distributions/private/primary/vertex/RangePositionDistribution.cxx @@ -6,12 +6,12 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/CrossSectionCollection.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/InteractionCollection.h" #include "LeptonInjector/dataclasses/InteractionRecord.h" #include "LeptonInjector/dataclasses/InteractionSignature.h" #include "LeptonInjector/dataclasses/Particle.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/detector/Path.h" #include "LeptonInjector/distributions/Distributions.h" #include "LeptonInjector/distributions/primary/vertex/RangeFunction.h" @@ -52,7 +52,7 @@ LI::math::Vector3D RangePositionDistribution::SampleFromDisk(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +LI::math::Vector3D RangePositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D pca = SampleFromDisk(rand, dir); @@ -66,18 +66,18 @@ LI::math::Vector3D RangePositionDistribution::SamplePosition(std::shared_ptr const & possible_targets = cross_sections->TargetTypes(); + std::set const & possible_targets = interactions->TargetTypes(); std::vector targets(possible_targets.begin(), possible_targets.end()); std::vector total_cross_sections(targets.size(), 0.0); - double total_decay_length = cross_sections->TotalDecayLength(record); + double total_decay_length = interactions->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(unsigned int i=0; iGetTargetMass(target); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - for(auto const & cross_section : cross_sections->GetCrossSectionsForTarget(target)) { + for(auto const & cross_section : interactions->GetCrossSectionsForTarget(target)) { total_cross_sections[i] += cross_section->TotalCrossSection(fake_record); } } @@ -101,7 +101,7 @@ LI::math::Vector3D RangePositionDistribution::SamplePosition(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double RangePositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(record.interaction_vertex); // m @@ -122,18 +122,18 @@ double RangePositionDistribution::GenerationProbability(std::shared_ptrGetEarthCoordPosFromDetCoordPos(vertex))) return 0.0; - std::set const & possible_targets = cross_sections->TargetTypes(); + std::set const & possible_targets = interactions->TargetTypes(); std::vector targets(possible_targets.begin(), possible_targets.end()); std::vector total_cross_sections(targets.size(), 0.0); - double total_decay_length = cross_sections->TotalDecayLength(record); + double total_decay_length = interactions->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(unsigned int i=0; iGetTargetMass(target); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - for(auto const & cross_section : cross_sections->GetCrossSectionsForTarget(target)) { + for(auto const & cross_section : interactions->GetCrossSectionsForTarget(target)) { total_cross_sections[i] += cross_section->TotalCrossSection(fake_record); } } @@ -168,7 +168,7 @@ std::shared_ptr RangePositionDistribution::clone() const return std::shared_ptr(new RangePositionDistribution(*this)); } -std::pair RangePositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +std::pair RangePositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { LI::math::Vector3D dir(record.primary_momentum[1], record.primary_momentum[2], record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(record.interaction_vertex); // m diff --git a/projects/distributions/private/primary/vertex/SecondaryPositionDistribution.cxx b/projects/distributions/private/primary/vertex/SecondaryPositionDistribution.cxx index d766b7a4..8209b838 100644 --- a/projects/distributions/private/primary/vertex/SecondaryPositionDistribution.cxx +++ b/projects/distributions/private/primary/vertex/SecondaryPositionDistribution.cxx @@ -7,12 +7,12 @@ #include // for bas... #include // for vector -#include "LeptonInjector/crosssections/CrossSection.h" // for Cro... -#include "LeptonInjector/crosssections/CrossSectionCollection.h" // for Cro... +#include "LeptonInjector/interactions/CrossSection.h" // for Cro... +#include "LeptonInjector/interactions/InteractionCollection.h" // for Cro... #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Int... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Int... #include "LeptonInjector/dataclasses/Particle.h" // for Par... -#include "LeptonInjector/detector/EarthModel.h" // for Ear... +#include "LeptonInjector/detector/DetectorModel.h" // for Ear... #include "LeptonInjector/detector/Path.h" // for Path #include "LeptonInjector/distributions/Distributions.h" // for Inj... #include "LeptonInjector/geometry/Geometry.h" // for Geo... @@ -45,23 +45,23 @@ namespace { // class SecondaryPositionDistribution : public VertexPositionDistribution //--------------- -LI::math::Vector3D SecondaryPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +LI::math::Vector3D SecondaryPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { throw(LI::utilities::SecondaryProcessFailure("Cannot call SecondaryPositionDistribution::SamplePosition without a datum to access the parent")); return LI::math::Vector3D(0,0,0); } -void SecondaryPositionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum & datum) const { - LI::math::Vector3D pos = SamplePosition(rand, earth_model, cross_sections, datum); +void SecondaryPositionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum & datum) const { + LI::math::Vector3D pos = SamplePosition(rand, earth_model, interactions, datum); datum.record.interaction_vertex[0] = pos.GetX(); datum.record.interaction_vertex[1] = pos.GetY(); datum.record.interaction_vertex[2] = pos.GetZ(); } -void SecondaryPositionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { +void SecondaryPositionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { throw(LI::utilities::SecondaryProcessFailure("Cannot call SecondaryPositionDistribution::Sample without a datum to access the parent")); } -LI::math::Vector3D SecondaryPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum & datum) const { +LI::math::Vector3D SecondaryPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum & datum) const { LI::math::Vector3D dir(datum.record.primary_momentum[1], datum.record.primary_momentum[2], datum.record.primary_momentum[3]); dir.normalize(); @@ -91,18 +91,18 @@ LI::math::Vector3D SecondaryPositionDistribution::SamplePosition(std::shared_ptr } } - std::set const & possible_targets = cross_sections->TargetTypes(); + std::set const & possible_targets = interactions->TargetTypes(); std::vector targets(possible_targets.begin(), possible_targets.end()); std::vector total_cross_sections(targets.size(), 0.0); - double total_decay_length = cross_sections->TotalDecayLength(datum.record); + double total_decay_length = interactions->TotalDecayLength(datum.record); LI::dataclasses::InteractionRecord fake_record = datum.record; for(unsigned int i=0; iGetTargetMass(target); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - for(auto const & cross_section : cross_sections->GetCrossSectionsForTarget(target)) { + for(auto const & cross_section : interactions->GetCrossSectionsForTarget(target)) { total_cross_sections[i] += cross_section->TotalCrossSection(fake_record); } } @@ -126,12 +126,12 @@ LI::math::Vector3D SecondaryPositionDistribution::SamplePosition(std::shared_ptr return vertex; } -double SecondaryPositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double SecondaryPositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { throw(LI::utilities::SecondaryProcessFailure("Cannot call SecondaryPositionDistribution::GenerationProbability without a datum to access the parent")); return 0; } -double SecondaryPositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum const & datum) const { +double SecondaryPositionDistribution::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum const & datum) const { LI::math::Vector3D dir(datum.record.primary_momentum[1], datum.record.primary_momentum[2], datum.record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(datum.record.interaction_vertex); @@ -163,18 +163,18 @@ double SecondaryPositionDistribution::GenerationProbability(std::shared_ptr const & possible_targets = cross_sections->TargetTypes(); + std::set const & possible_targets = interactions->TargetTypes(); std::vector targets(possible_targets.begin(), possible_targets.end()); std::vector total_cross_sections(targets.size(), 0.0); - double total_decay_length = cross_sections->TotalDecayLength(datum.record); + double total_decay_length = interactions->TotalDecayLength(datum.record); LI::dataclasses::InteractionRecord fake_record = datum.record; for(unsigned int i=0; iGetTargetMass(target); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - for(auto const & cross_section : cross_sections->GetCrossSectionsForTarget(target)) { + for(auto const & cross_section : interactions->GetCrossSectionsForTarget(target)) { total_cross_sections[i] += cross_section->TotalCrossSection(fake_record); } } @@ -214,12 +214,12 @@ std::shared_ptr SecondaryPositionDistribution::clone() co return std::shared_ptr(new SecondaryPositionDistribution(*this)); } -std::pair SecondaryPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +std::pair SecondaryPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { throw(LI::utilities::SecondaryProcessFailure("Cannot call SecondaryPositionDistribution::InjectionBounds without a datum to access the parent")); return std::make_pair(LI::math::Vector3D(0,0,0),LI::math::Vector3D(0,0,0)); } -std::pair SecondaryPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum const & datum) const { +std::pair SecondaryPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum const & datum) const { LI::math::Vector3D dir(datum.record.primary_momentum[1], datum.record.primary_momentum[2], datum.record.primary_momentum[3]); dir.normalize(); LI::math::Vector3D vertex(datum.record.interaction_vertex); diff --git a/projects/distributions/private/primary/vertex/VertexPositionDistribution.cxx b/projects/distributions/private/primary/vertex/VertexPositionDistribution.cxx index 5aa0c597..503d43a1 100644 --- a/projects/distributions/private/primary/vertex/VertexPositionDistribution.cxx +++ b/projects/distributions/private/primary/vertex/VertexPositionDistribution.cxx @@ -3,9 +3,9 @@ #include // for array #include // for bas... -#include "LeptonInjector/crosssections/CrossSectionCollection.h" // for Cro... +#include "LeptonInjector/interactions/InteractionCollection.h" // for Cro... #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Int... -#include "LeptonInjector/detector/EarthModel.h" // for Ear... +#include "LeptonInjector/detector/DetectorModel.h" // for Ear... #include "LeptonInjector/math/Vector3D.h" // for Vec... namespace LI { @@ -14,12 +14,12 @@ namespace distributions { //--------------- // class VertexPositionDistribution : InjectionDistribution //--------------- -LI::math::Vector3D VertexPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum & datum) const { - return SamplePosition(rand, earth_model, cross_sections, datum.record); +LI::math::Vector3D VertexPositionDistribution::SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum & datum) const { + return SamplePosition(rand, earth_model, interactions, datum.record); } -void VertexPositionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const { - LI::math::Vector3D pos = SamplePosition(rand, earth_model, cross_sections, record); +void VertexPositionDistribution::Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { + LI::math::Vector3D pos = SamplePosition(rand, earth_model, interactions, record); record.interaction_vertex[0] = pos.GetX(); record.interaction_vertex[1] = pos.GetY(); record.interaction_vertex[2] = pos.GetZ(); @@ -29,12 +29,12 @@ std::vector VertexPositionDistribution::DensityVariables() const { return std::vector{"InteractionVertexPosition"}; } -std::pair VertexPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum const & datum) const { - return InjectionBounds(earth_model, cross_sections, datum.record); +std::pair VertexPositionDistribution::InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum const & datum) const { + return InjectionBounds(earth_model, interactions, datum.record); } -bool VertexPositionDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const { - return this->operator==(*distribution) and earth_model->operator==(*second_earth_model) and cross_sections->operator==(*second_cross_sections); +bool VertexPositionDistribution::AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const { + return this->operator==(*distribution) and earth_model->operator==(*second_earth_model) and interactions->operator==(*second_interactions); } } // namespace distributions diff --git a/projects/distributions/private/pybindings/distributions.cxx b/projects/distributions/private/pybindings/distributions.cxx index 4c54010d..cff0cd07 100644 --- a/projects/distributions/private/pybindings/distributions.cxx +++ b/projects/distributions/private/pybindings/distributions.cxx @@ -26,8 +26,8 @@ #include "../../public/LeptonInjector/distributions/target/momentum/TargetMomentumDistribution.h" #include "../../../utilities/public/LeptonInjector/utilities/Random.h" -#include "../../../detector/public/LeptonInjector/detector/EarthModel.h" -#include "../../../crosssections/public/LeptonInjector/crosssections/CrossSectionCollection.h" +#include "../../../detector/public/LeptonInjector/detector/DetectorModel.h" +#include "../../../interactions/public/LeptonInjector/interactions/InteractionCollection.h" #include #include @@ -56,8 +56,8 @@ PYBIND11_MODULE(distributions,m) { .def("Name",&NormalizationConstant::Name); class_, WeightableDistribution>(m, "InjectionDistribution") - .def("Sample",overload_cast, std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionRecord &>(&InjectionDistribution::Sample, const_)) - .def("Sample",overload_cast, std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionTreeDatum &>(&InjectionDistribution::Sample, const_)) + .def("Sample",overload_cast, std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionRecord &>(&InjectionDistribution::Sample, const_)) + .def("Sample",overload_cast, std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionTreeDatum &>(&InjectionDistribution::Sample, const_)) .def("IsPositionDistribution",&InjectionDistribution::IsPositionDistribution); // Direciton distributions @@ -219,12 +219,12 @@ PYBIND11_MODULE(distributions,m) { .def(init()) .def(init>()) .def(init>()) - .def("Sample",overload_cast, std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionRecord &>(&SecondaryPositionDistribution::Sample, const_)) - .def("Sample",overload_cast, std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionTreeDatum &>(&SecondaryPositionDistribution::Sample, const_)) - .def("GenerationProbability",overload_cast, std::shared_ptr, LI::dataclasses::InteractionRecord const &>(&SecondaryPositionDistribution::GenerationProbability, const_)) - .def("GenerationProbability",overload_cast, std::shared_ptr, LI::dataclasses::InteractionTreeDatum const &>(&SecondaryPositionDistribution::GenerationProbability, const_)) - .def("InjectionBounds",overload_cast, std::shared_ptr, LI::dataclasses::InteractionRecord const &>(&SecondaryPositionDistribution::InjectionBounds, const_)) - .def("InjectionBounds",overload_cast, std::shared_ptr, LI::dataclasses::InteractionTreeDatum const &>(&SecondaryPositionDistribution::InjectionBounds, const_)) + .def("Sample",overload_cast, std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionRecord &>(&SecondaryPositionDistribution::Sample, const_)) + .def("Sample",overload_cast, std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionTreeDatum &>(&SecondaryPositionDistribution::Sample, const_)) + .def("GenerationProbability",overload_cast, std::shared_ptr, LI::dataclasses::InteractionRecord const &>(&SecondaryPositionDistribution::GenerationProbability, const_)) + .def("GenerationProbability",overload_cast, std::shared_ptr, LI::dataclasses::InteractionTreeDatum const &>(&SecondaryPositionDistribution::GenerationProbability, const_)) + .def("InjectionBounds",overload_cast, std::shared_ptr, LI::dataclasses::InteractionRecord const &>(&SecondaryPositionDistribution::InjectionBounds, const_)) + .def("InjectionBounds",overload_cast, std::shared_ptr, LI::dataclasses::InteractionTreeDatum const &>(&SecondaryPositionDistribution::InjectionBounds, const_)) .def("Name",&SecondaryPositionDistribution::Name); // Target momentum distributions diff --git a/projects/distributions/private/target/momentum/TargetMomentumDistribution.cxx b/projects/distributions/private/target/momentum/TargetMomentumDistribution.cxx index 785ff513..42005987 100644 --- a/projects/distributions/private/target/momentum/TargetMomentumDistribution.cxx +++ b/projects/distributions/private/target/momentum/TargetMomentumDistribution.cxx @@ -14,10 +14,10 @@ namespace distributions { void TargetMomentumDistribution::Sample( std::shared_ptr rand, - std::shared_ptr earth_model, - std::shared_ptr cross_sections, + std::shared_ptr earth_model, + std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const { - record.target_momentum = SampleMomentum(rand, earth_model, cross_sections, record); + record.target_momentum = SampleMomentum(rand, earth_model, interactions, record); } std::vector TargetMomentumDistribution::DensityVariables() const { @@ -29,13 +29,13 @@ std::vector TargetMomentumDistribution::DensityVariables() const { //--------------- std::array TargetAtRest::SampleMomentum( std::shared_ptr rand, - std::shared_ptr earth_model, - std::shared_ptr cross_sections, + std::shared_ptr earth_model, + std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { return std::array{record.target_mass, 0, 0, 0}; } -double TargetAtRest::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const { +double TargetAtRest::GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const { return 1.0; } diff --git a/projects/distributions/public/LeptonInjector/distributions/Distributions.h b/projects/distributions/public/LeptonInjector/distributions/Distributions.h index 7f00ec3b..d54f641b 100644 --- a/projects/distributions/public/LeptonInjector/distributions/Distributions.h +++ b/projects/distributions/public/LeptonInjector/distributions/Distributions.h @@ -15,9 +15,9 @@ #include "LeptonInjector/dataclasses/InteractionTree.h" // for InteractionT... -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { @@ -26,15 +26,15 @@ class LI_random; } namespace detector { -class EarthModel; +class DetectorModel; } // namespace detector namespace dataclasses { struct InteractionRecord; struct InteractionSignature; } -namespace crosssections { -class CrossSectionCollection; +namespace interactions { +class InteractionCollection; } } // namespace LeptonInjector @@ -78,8 +78,8 @@ class WeightableDistribution { friend cereal::access; public: virtual ~WeightableDistribution() {}; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const = 0; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum const & datum) const; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const = 0; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum const & datum) const; virtual std::vector DensityVariables() const; virtual std::string Name() const = 0; template @@ -98,7 +98,7 @@ friend cereal::access; } bool operator==(WeightableDistribution const & distribution) const; bool operator<(WeightableDistribution const & distribution) const; - virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const; + virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const; protected: virtual bool equal(WeightableDistribution const & distribution) const = 0; virtual bool less(WeightableDistribution const & distribution) const = 0; @@ -111,7 +111,7 @@ friend cereal::access; public: virtual ~NormalizationConstant() {}; NormalizationConstant(double norm); - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; virtual std::string Name() const override; template void save(Archive & archive, std::uint32_t const version) const { @@ -141,8 +141,8 @@ friend cereal::access; private: public: virtual ~InjectionDistribution() {}; - virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const; - virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum & datum) const; + virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const; + virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum & datum) const; virtual bool IsPositionDistribution() const {return false;} virtual std::shared_ptr clone() const = 0; template diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/direction/Cone.h b/projects/distributions/public/LeptonInjector/distributions/primary/direction/Cone.h index 4cc4f662..92d4fccc 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/direction/Cone.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/direction/Cone.h @@ -15,9 +15,9 @@ #include "LeptonInjector/math/Quaternion.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -35,8 +35,8 @@ friend cereal::access; double opening_angle; public: Cone(LI::math::Vector3D dir, double opening_angle); - LI::math::Vector3D SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + LI::math::Vector3D SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; virtual std::shared_ptr clone() const override; std::string Name() const override; template diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/direction/FixedDirection.h b/projects/distributions/public/LeptonInjector/distributions/primary/direction/FixedDirection.h index 6a4d08a7..4eb88e00 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/direction/FixedDirection.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/direction/FixedDirection.h @@ -15,9 +15,9 @@ #include "LeptonInjector/distributions/primary/direction/PrimaryDirectionDistribution.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -34,8 +34,8 @@ friend cereal::access; public: FixedDirection(LI::math::Vector3D dir) : dir(dir) {}; private: - LI::math::Vector3D SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + LI::math::Vector3D SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; virtual std::vector DensityVariables() const override; virtual std::shared_ptr clone() const override; std::string Name() const override; diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/direction/IsotropicDirection.h b/projects/distributions/public/LeptonInjector/distributions/primary/direction/IsotropicDirection.h index 0ba8552c..9dc5d29a 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/direction/IsotropicDirection.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/direction/IsotropicDirection.h @@ -15,9 +15,9 @@ #include "LeptonInjector/distributions/primary/direction/PrimaryDirectionDistribution.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -31,8 +31,8 @@ namespace distributions { class IsotropicDirection : virtual public PrimaryDirectionDistribution { friend cereal::access; public: - LI::math::Vector3D SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + LI::math::Vector3D SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; virtual std::shared_ptr clone() const override; std::string Name() const override; template diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/direction/PrimaryDirectionDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/direction/PrimaryDirectionDistribution.h index c3f9e45d..0b566dfe 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/direction/PrimaryDirectionDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/direction/PrimaryDirectionDistribution.h @@ -10,9 +10,9 @@ #include "LeptonInjector/distributions/Distributions.h" // for WeightableDi... -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace math { class Vector3D; } } namespace LI { namespace utilities { class LI_random; } } @@ -26,16 +26,16 @@ class Vector3D; } // namespace math namespace detector { -class EarthModel; +class DetectorModel; } // namespace detector namespace dataclasses { struct InteractionRecord; struct InteractionSignature; } -namespace crosssections { -class CrossSectionCollection; -} // namespace crosssections +namespace interactions { +class InteractionCollection; +} // namespace interactions } // namespace LeptonInjector namespace LI { @@ -48,10 +48,10 @@ friend cereal::access; protected: PrimaryDirectionDistribution() {}; private: - virtual LI::math::Vector3D SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const = 0; + virtual LI::math::Vector3D SampleDirection(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const = 0; public: - void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override = 0; + void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override = 0; virtual std::vector DensityVariables() const override; virtual std::shared_ptr clone() const override = 0; template diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/energy/ModifiedMoyalPlusExponentialEnergyDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/energy/ModifiedMoyalPlusExponentialEnergyDistribution.h index 379a370b..66fd47e7 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/energy/ModifiedMoyalPlusExponentialEnergyDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/energy/ModifiedMoyalPlusExponentialEnergyDistribution.h @@ -15,9 +15,9 @@ #include "LeptonInjector/distributions/primary/energy/PrimaryEnergyDistribution.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -43,8 +43,8 @@ friend cereal::access; double pdf(double energy) const; double pdf_integral() const; public: - double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; ModifiedMoyalPlusExponentialEnergyDistribution(double energyMin, double energyMax, double mu, double sigma, double A, double l, double B, bool has_physical_normalization=false); std::string Name() const override; virtual std::shared_ptr clone() const override; diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/energy/Monoenergetic.h b/projects/distributions/public/LeptonInjector/distributions/primary/energy/Monoenergetic.h index 8169c79d..949ada87 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/energy/Monoenergetic.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/energy/Monoenergetic.h @@ -14,9 +14,9 @@ #include "LeptonInjector/distributions/primary/energy/PrimaryEnergyDistribution.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -33,8 +33,8 @@ friend cereal::access; public: Monoenergetic(double gen_energy); double pdf(double energy) const; - double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; std::string Name() const override; virtual std::shared_ptr clone() const override; template diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/energy/PowerLaw.h b/projects/distributions/public/LeptonInjector/distributions/primary/energy/PowerLaw.h index d261ed8a..9f7e244b 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/energy/PowerLaw.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/energy/PowerLaw.h @@ -14,9 +14,9 @@ #include "LeptonInjector/distributions/primary/energy/PrimaryEnergyDistribution.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -35,8 +35,8 @@ friend cereal::access; public: PowerLaw(double powerLawIndex, double energyMin, double energyMax); double pdf(double energy) const; - double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; std::string Name() const override; void SetNormalizationAtEnergy(double normalization, double energy); virtual std::shared_ptr clone() const override; diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/energy/PrimaryEnergyDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/energy/PrimaryEnergyDistribution.h index 41624efd..d97907f8 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/energy/PrimaryEnergyDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/energy/PrimaryEnergyDistribution.h @@ -15,9 +15,9 @@ #include "LeptonInjector/distributions/Distributions.h" // for WeightableDi... -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace utilities { class LI_random; } } namespace cereal { class access; } @@ -29,10 +29,10 @@ friend cereal::access; public: virtual ~PrimaryEnergyDistribution() {}; private: - virtual double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const = 0; + virtual double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const = 0; public: - void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override = 0; + void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override = 0; virtual std::vector DensityVariables() const override; virtual std::string Name() const override = 0; virtual std::shared_ptr clone() const override = 0; diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/energy/TabulatedFluxDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/energy/TabulatedFluxDistribution.h index dfe8818f..9b032734 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/energy/TabulatedFluxDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/energy/TabulatedFluxDistribution.h @@ -17,9 +17,9 @@ #include "LeptonInjector/distributions/primary/energy/PrimaryEnergyDistribution.h" #include "LeptonInjector/utilities/Interpolator.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -56,8 +56,8 @@ friend cereal::access; std::vector GetCDF() const; std::vector GetEnergyNodes() const; std::vector GetCDFEnergyNodes() const; - double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + double SampleEnergy(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; void SetEnergyBounds(double energyMin, double energyMax); TabulatedFluxDistribution(std::string fluxTableFilename, bool has_physical_normalization=false); TabulatedFluxDistribution(double energyMin, double energyMax, std::string fluxTableFilename, bool has_physical_normalization=false); diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/helicity/PrimaryNeutrinoHelicityDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/helicity/PrimaryNeutrinoHelicityDistribution.h index 5fb6d7c8..cdfcc6f2 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/helicity/PrimaryNeutrinoHelicityDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/helicity/PrimaryNeutrinoHelicityDistribution.h @@ -15,9 +15,9 @@ #include "LeptonInjector/distributions/Distributions.h" // for InjectionDis... -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { @@ -26,8 +26,8 @@ namespace distributions { class PrimaryNeutrinoHelicityDistribution : virtual public InjectionDistribution { friend cereal::access; public: - virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; PrimaryNeutrinoHelicityDistribution(); PrimaryNeutrinoHelicityDistribution(const PrimaryNeutrinoHelicityDistribution &) = default; virtual std::vector DensityVariables() const override; diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/type/PrimaryInjector.h b/projects/distributions/public/LeptonInjector/distributions/primary/type/PrimaryInjector.h index d788cbd9..87c0036a 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/type/PrimaryInjector.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/type/PrimaryInjector.h @@ -16,9 +16,9 @@ #include "LeptonInjector/dataclasses/Particle.h" // for Particle #include "LeptonInjector/distributions/Distributions.h" // for InjectionDis... -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { @@ -35,8 +35,8 @@ friend cereal::access; PrimaryInjector(LI::dataclasses::Particle::ParticleType primary_type, double primary_mass = 0); LI::dataclasses::Particle::ParticleType PrimaryType() const; double PrimaryMass() const; - void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; virtual std::vector DensityVariables() const override; virtual std::string Name() const override; virtual std::shared_ptr clone() const override; diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/ColumnDepthPositionDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/ColumnDepthPositionDistribution.h index 238a36ae..c9b08664 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/ColumnDepthPositionDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/ColumnDepthPositionDistribution.h @@ -20,9 +20,9 @@ #include "LeptonInjector/distributions/primary/vertex/DepthFunction.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -42,14 +42,14 @@ friend cereal::access; LI::math::Vector3D SampleFromDisk(std::shared_ptr rand, LI::math::Vector3D const & dir) const; - LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; + LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; public: - LI::math::Vector3D GetSamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record); - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + LI::math::Vector3D GetSamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record); + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; ColumnDepthPositionDistribution(double radius, double endcap_length, std::shared_ptr depth_function, std::set target_types); std::string Name() const override; virtual std::shared_ptr clone() const override; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const override; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const override; template void save(Archive & archive, std::uint32_t const version) const { if(version == 0) { diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/CylinderVolumePositionDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/CylinderVolumePositionDistribution.h index 08fedb9c..e82ee57b 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/CylinderVolumePositionDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/CylinderVolumePositionDistribution.h @@ -17,9 +17,9 @@ #include "LeptonInjector/geometry/Cylinder.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -33,14 +33,14 @@ friend cereal::access; CylinderVolumePositionDistribution() {}; private: LI::geometry::Cylinder cylinder; - LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; + LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; public: - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; CylinderVolumePositionDistribution(LI::geometry::Cylinder); std::string Name() const override; virtual std::shared_ptr clone() const override; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const override; - virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const override; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const override; + virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const override; template void save(Archive & archive, std::uint32_t const version) const { if(version == 0) { diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/DecayRangePositionDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/DecayRangePositionDistribution.h index 87752ea2..5e9fa8d7 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/DecayRangePositionDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/DecayRangePositionDistribution.h @@ -20,9 +20,9 @@ #include "LeptonInjector/distributions/primary/vertex/DecayRangeFunction.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -38,16 +38,16 @@ class DecayRangePositionDistribution : virtual public VertexPositionDistribution LI::math::Vector3D SampleFromDisk(std::shared_ptr rand, LI::math::Vector3D const & dir) const; - LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; + LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; public: - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; DecayRangePositionDistribution(); DecayRangePositionDistribution(const DecayRangePositionDistribution &) = default; DecayRangePositionDistribution(double radius, double endcap_length, std::shared_ptr range_function); std::string Name() const override; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const override; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const override; virtual std::shared_ptr clone() const override; - virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const override; + virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const override; template void save(Archive & archive, std::uint32_t const version) const { if(version == 0) { diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/OrientedCylinderPositionDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/OrientedCylinderPositionDistribution.h index e3566eae..10b0f06c 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/OrientedCylinderPositionDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/OrientedCylinderPositionDistribution.h @@ -16,9 +16,9 @@ #include "LeptonInjector/distributions/primary/vertex/VertexPositionDistribution.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -32,16 +32,16 @@ friend cereal::access; double radius; LI::math::Vector3D SampleFromDisk(std::shared_ptr rand, LI::math::Vector3D const & dir) const; - virtual std::pair GetBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record, LI::math::Vector3D & point_of_closest_approach) const = 0; - virtual void SampleWithinBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record, std::pair boundaries) const = 0; - virtual LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; + virtual std::pair GetBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record, LI::math::Vector3D & point_of_closest_approach) const = 0; + virtual void SampleWithinBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record, std::pair boundaries) const = 0; + virtual LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; public: - virtual double PositionProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record, std::pair boundaries) const = 0; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + virtual double PositionProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record, std::pair boundaries) const = 0; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; virtual std::string Name() const override = 0; virtual std::shared_ptr clone() const override = 0; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const override; - virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const override; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const override; + virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const override; template void save(Archive & archive, std::uint32_t const version) const { if(version == 0) { diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/PointSourcePositionDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/PointSourcePositionDistribution.h index bb8853af..809566b8 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/PointSourcePositionDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/PointSourcePositionDistribution.h @@ -19,9 +19,9 @@ #include "LeptonInjector/distributions/primary/vertex/VertexPositionDistribution.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -38,14 +38,14 @@ friend cereal::access; LI::math::Vector3D SampleFromDisk(std::shared_ptr rand, LI::math::Vector3D const & dir) const; - LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; + LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; public: - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; PointSourcePositionDistribution(); PointSourcePositionDistribution(const PointSourcePositionDistribution &) = default; PointSourcePositionDistribution(LI::math::Vector3D origin, double max_distance, std::set target_types); std::string Name() const override; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const override; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const override; virtual std::shared_ptr clone() const override; template void save(Archive & archive, std::uint32_t const version) const { diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/RangePositionDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/RangePositionDistribution.h index 797e7180..3df66a7f 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/RangePositionDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/RangePositionDistribution.h @@ -20,9 +20,9 @@ #include "LeptonInjector/distributions/primary/vertex/RangeFunction.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace utilities { class LI_random; } } @@ -40,14 +40,14 @@ friend cereal::access; LI::math::Vector3D SampleFromDisk(std::shared_ptr rand, LI::math::Vector3D const & dir) const; - LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; + LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; public: - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; RangePositionDistribution(); RangePositionDistribution(const RangePositionDistribution &) = default; RangePositionDistribution(double radius, double endcap_length, std::shared_ptr range_function, std::set target_types); std::string Name() const override; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const override; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const override; virtual std::shared_ptr clone() const override; template void save(Archive & archive, std::uint32_t const version) const { diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/SecondaryPositionDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/SecondaryPositionDistribution.h index c8fe7424..09b2dd79 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/SecondaryPositionDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/SecondaryPositionDistribution.h @@ -20,9 +20,9 @@ #include "LeptonInjector/distributions/primary/vertex/VertexPositionDistribution.h" #include "LeptonInjector/math/Vector3D.h" -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } namespace LI { namespace geometry { class Geometry; } } @@ -38,21 +38,21 @@ friend cereal::access; std::shared_ptr fiducial = NULL; - LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; - LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum & datum) const override; + LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; + LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum & datum) const override; public: - virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum & datum) const override; - virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum const & datum) const override; + virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum & datum) const override; + virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum const & datum) const override; SecondaryPositionDistribution(); SecondaryPositionDistribution(const SecondaryPositionDistribution &) = default; SecondaryPositionDistribution(double max_length); SecondaryPositionDistribution(double max_length, std::shared_ptr fiducial); SecondaryPositionDistribution(std::shared_ptr fiducial); std::string Name() const override; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const override; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum const & datum) const override; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const override; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum const & datum) const override; virtual std::shared_ptr clone() const override; template void save(Archive & archive, std::uint32_t const version) const { diff --git a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/VertexPositionDistribution.h b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/VertexPositionDistribution.h index f9f9570b..9673536b 100644 --- a/projects/distributions/public/LeptonInjector/distributions/primary/vertex/VertexPositionDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/primary/vertex/VertexPositionDistribution.h @@ -18,9 +18,9 @@ #include "LeptonInjector/distributions/Distributions.h" // for WeightableDi... #include "LeptonInjector/math/Vector3D.h" // for Vector3D -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { @@ -31,18 +31,18 @@ friend cereal::access; public: virtual ~VertexPositionDistribution() {}; private: - virtual LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const = 0; - virtual LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum & datum) const; + virtual LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const = 0; + virtual LI::math::Vector3D SamplePosition(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum & datum) const; public: - virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; + virtual void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; virtual bool IsPositionDistribution() const override {return true;} - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override = 0; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override = 0; virtual std::vector DensityVariables() const override; virtual std::string Name() const override = 0; virtual std::shared_ptr clone() const override = 0; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & interaction) const = 0; - virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionTreeDatum const & datum) const; - virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_cross_sections) const override; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & interaction) const = 0; + virtual std::pair InjectionBounds(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionTreeDatum const & datum) const; + virtual bool AreEquivalent(std::shared_ptr earth_model, std::shared_ptr interactions, std::shared_ptr distribution, std::shared_ptr second_earth_model, std::shared_ptr second_interactions) const override; template void save(Archive & archive, std::uint32_t const version) const { if(version == 0) { diff --git a/projects/distributions/public/LeptonInjector/distributions/target/momentum/TargetMomentumDistribution.h b/projects/distributions/public/LeptonInjector/distributions/target/momentum/TargetMomentumDistribution.h index a456ed18..469c101a 100644 --- a/projects/distributions/public/LeptonInjector/distributions/target/momentum/TargetMomentumDistribution.h +++ b/projects/distributions/public/LeptonInjector/distributions/target/momentum/TargetMomentumDistribution.h @@ -17,9 +17,9 @@ #include "LeptonInjector/distributions/Distributions.h" // for InjectionDis... -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { @@ -28,10 +28,10 @@ namespace distributions { class TargetMomentumDistribution : virtual public InjectionDistribution { friend cereal::access; private: - virtual std::array SampleMomentum(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const = 0; + virtual std::array SampleMomentum(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const = 0; public: - void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord & record) const override; - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override = 0; + void Sample(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override = 0; virtual std::vector DensityVariables() const override; template void save(Archive & archive, std::uint32_t const version) const { @@ -57,9 +57,9 @@ friend cereal::access; class TargetAtRest : virtual public TargetMomentumDistribution { friend cereal::access; private: - virtual std::array SampleMomentum(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + virtual std::array SampleMomentum(std::shared_ptr rand, std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; public: - virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) const override; + virtual double GenerationProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) const override; virtual std::vector DensityVariables() const override; virtual std::shared_ptr clone() const override; std::string Name() const override; diff --git a/projects/injection/CMakeLists.txt b/projects/injection/CMakeLists.txt index c42d3311..5b4d83b0 100644 --- a/projects/injection/CMakeLists.txt +++ b/projects/injection/CMakeLists.txt @@ -2,7 +2,7 @@ #core files LIST (APPEND injection_SOURCES ${PROJECT_SOURCE_DIR}/projects/injection/private/Process.cxx - ${PROJECT_SOURCE_DIR}/projects/injection/private/InjectorBase.cxx + ${PROJECT_SOURCE_DIR}/projects/injection/private/Injector.cxx ${PROJECT_SOURCE_DIR}/projects/injection/private/WeightingUtils.cxx ${PROJECT_SOURCE_DIR}/projects/injection/private/TreeWeighter.cxx ${PROJECT_SOURCE_DIR}/projects/injection/private/Weighter.cxx @@ -29,7 +29,7 @@ target_link_libraries(LI_injection LI_dataclasses LI_geometry LI_detector - LI_crosssections + LI_interactions LI_distributions ) diff --git a/projects/injection/private/ColumnDepthLeptonInjector.cxx b/projects/injection/private/ColumnDepthLeptonInjector.cxx index 9f1a5fcc..fad43546 100644 --- a/projects/injection/private/ColumnDepthLeptonInjector.cxx +++ b/projects/injection/private/ColumnDepthLeptonInjector.cxx @@ -5,41 +5,41 @@ #include #include -#include "LeptonInjector/crosssections/CrossSectionCollection.h" +#include "LeptonInjector/interactions/InteractionCollection.h" #include "LeptonInjector/dataclasses/Particle.h" #include "LeptonInjector/distributions/primary/vertex/ColumnDepthPositionDistribution.h" -#include "LeptonInjector/injection/InjectorBase.h" +#include "LeptonInjector/injection/Injector.h" #include "LeptonInjector/injection/Process.h" #include "LeptonInjector/math/Vector3D.h" namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class DepthFunction; } } namespace LI { namespace injection { //--------------- -// class ColumnDepthLeptonInjector : InjectorBase +// class ColumnDepthLeptonInjector : Injector //--------------- ColumnDepthLeptonInjector::ColumnDepthLeptonInjector() {} ColumnDepthLeptonInjector::ColumnDepthLeptonInjector( unsigned int events_to_inject, - std::shared_ptr earth_model, + std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, std::shared_ptr depth_func, double disk_radius, double endcap_length) : - InjectorBase(events_to_inject, earth_model, random), + Injector(events_to_inject, earth_model, random), depth_func(depth_func), disk_radius(disk_radius), endcap_length(endcap_length) { - cross_sections = primary_process->GetCrossSections(); - std::set target_types = cross_sections->TargetTypes(); + interactions = primary_process->GetInteractions(); + std::set target_types = interactions->TargetTypes(); position_distribution = std::make_shared(disk_radius, endcap_length, depth_func, target_types); primary_process->AddInjectionDistribution(position_distribution); SetPrimaryProcess(primary_process); @@ -48,7 +48,7 @@ ColumnDepthLeptonInjector::ColumnDepthLeptonInjector( // Assume each secondary process already has a position distribution // Otherwise uncomment below /* - target_types = sec_process->GetCrossSections()->TargetTypes(); + target_types = sec_process->GetInteractions()->TargetTypes(); sec_process->GetInjectionDistributions().push_back(std::make_shared(disk_radius, endcap_length, depth_func, target_types)); */ } @@ -59,7 +59,7 @@ std::string ColumnDepthLeptonInjector::Name() const { } std::pair ColumnDepthLeptonInjector::InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const { - return position_distribution->InjectionBounds(earth_model, cross_sections, interaction); + return position_distribution->InjectionBounds(earth_model, interactions, interaction); } } // namespace injection diff --git a/projects/injection/private/CylinderVolumeLeptonInjector.cxx b/projects/injection/private/CylinderVolumeLeptonInjector.cxx index 32c4da5d..a7d0372b 100644 --- a/projects/injection/private/CylinderVolumeLeptonInjector.cxx +++ b/projects/injection/private/CylinderVolumeLeptonInjector.cxx @@ -4,31 +4,31 @@ #include #include "LeptonInjector/distributions/primary/vertex/CylinderVolumePositionDistribution.h" -#include "LeptonInjector/injection/InjectorBase.h" +#include "LeptonInjector/injection/Injector.h" #include "LeptonInjector/injection/Process.h" #include "LeptonInjector/math/Vector3D.h" namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace injection { //--------------- -// class CylinderVolumeLeptonInjector : InjectorBase +// class CylinderVolumeLeptonInjector : Injector //--------------- CylinderVolumeLeptonInjector::CylinderVolumeLeptonInjector() {} CylinderVolumeLeptonInjector::CylinderVolumeLeptonInjector( unsigned int events_to_inject, - std::shared_ptr earth_model, + std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, LI::geometry::Cylinder cylinder) : - InjectorBase(events_to_inject, earth_model, random), + Injector(events_to_inject, earth_model, random), position_distribution(std::make_shared(cylinder)) { - cross_sections = primary_process->GetCrossSections(); + interactions = primary_process->GetInteractions(); primary_process->AddInjectionDistribution(position_distribution); SetPrimaryProcess(primary_process); for(auto & sec_process : secondary_processes) { @@ -46,7 +46,7 @@ std::string CylinderVolumeLeptonInjector::Name() const { } std::pair CylinderVolumeLeptonInjector::InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const { - return position_distribution->InjectionBounds(earth_model, cross_sections, interaction); + return position_distribution->InjectionBounds(earth_model, interactions, interaction); } } // namespace injection diff --git a/projects/injection/private/DecayRangeLeptonInjector.cxx b/projects/injection/private/DecayRangeLeptonInjector.cxx index a300a733..8546b4e6 100644 --- a/projects/injection/private/DecayRangeLeptonInjector.cxx +++ b/projects/injection/private/DecayRangeLeptonInjector.cxx @@ -4,40 +4,40 @@ #include #include -#include "LeptonInjector/crosssections/CrossSectionCollection.h" +#include "LeptonInjector/interactions/InteractionCollection.h" #include "LeptonInjector/dataclasses/Particle.h" #include "LeptonInjector/distributions/primary/vertex/DecayRangeFunction.h" #include "LeptonInjector/distributions/primary/vertex/DecayRangePositionDistribution.h" -#include "LeptonInjector/injection/InjectorBase.h" +#include "LeptonInjector/injection/Injector.h" #include "LeptonInjector/injection/Process.h" #include "LeptonInjector/math/Vector3D.h" namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace injection { //--------------- -// class DecayRangeLeptonInjector : InjectorBase +// class DecayRangeLeptonInjector : Injector //--------------- DecayRangeLeptonInjector::DecayRangeLeptonInjector() {} DecayRangeLeptonInjector::DecayRangeLeptonInjector( unsigned int events_to_inject, - std::shared_ptr earth_model, + std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, std::shared_ptr range_func, double disk_radius, double endcap_length) : - InjectorBase(events_to_inject, earth_model, random), + Injector(events_to_inject, earth_model, random), range_func(range_func), disk_radius(disk_radius), endcap_length(endcap_length) { - cross_sections = primary_process->GetCrossSections(); + interactions = primary_process->GetInteractions(); position_distribution = std::make_shared(disk_radius, endcap_length, range_func); primary_process->AddInjectionDistribution(position_distribution); SetPrimaryProcess(primary_process); @@ -46,7 +46,7 @@ DecayRangeLeptonInjector::DecayRangeLeptonInjector( // Assume each secondary process already has a position distribution // Otherwise uncomment below /* - target_types = sec_process->GetCrossSections()->TargetTypes(); + target_types = sec_process->GetInteractions()->TargetTypes(); sec_process->GetInjectionDistributions().push_back(std::make_shared(disk_radius, endcap_length, range_func, target_types)); */ } @@ -57,7 +57,7 @@ std::string DecayRangeLeptonInjector::Name() const { } std::pair DecayRangeLeptonInjector::InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const { - return position_distribution->InjectionBounds(earth_model, cross_sections, interaction); + return position_distribution->InjectionBounds(earth_model, interactions, interaction); } } // namespace injection diff --git a/projects/injection/private/InjectorBase.cxx b/projects/injection/private/Injector.cxx similarity index 82% rename from projects/injection/private/InjectorBase.cxx rename to projects/injection/private/Injector.cxx index 369ad3c1..0248e03b 100644 --- a/projects/injection/private/InjectorBase.cxx +++ b/projects/injection/private/Injector.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/injection/InjectorBase.h" +#include "LeptonInjector/injection/Injector.h" #include #include @@ -7,14 +7,14 @@ #include -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/CrossSectionCollection.h" -#include "LeptonInjector/crosssections/Decay.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/InteractionCollection.h" +#include "LeptonInjector/interactions/Decay.h" #include "LeptonInjector/dataclasses/DecayRecord.h" #include "LeptonInjector/dataclasses/DecaySignature.h" #include "LeptonInjector/dataclasses/InteractionSignature.h" #include "LeptonInjector/dataclasses/Particle.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/detector/MaterialModel.h" #include "LeptonInjector/detector/Path.h" #include "LeptonInjector/distributions/Distributions.h" @@ -32,23 +32,23 @@ namespace LI { namespace injection { //--------------- -// class InjectorBase +// class Injector //--------------- -InjectorBase::InjectorBase() {} +Injector::Injector() {} -InjectorBase::InjectorBase( +Injector::Injector( unsigned int events_to_inject, - std::shared_ptr earth_model, + std::shared_ptr earth_model, std::shared_ptr random) : events_to_inject(events_to_inject), random(random), earth_model(earth_model) {} -InjectorBase::InjectorBase( +Injector::Injector( unsigned int events_to_inject, - std::shared_ptr earth_model, + std::shared_ptr earth_model, std::shared_ptr primary_process, std::shared_ptr random) : events_to_inject(events_to_inject), @@ -58,9 +58,9 @@ InjectorBase::InjectorBase( SetPrimaryProcess(primary_process); } -InjectorBase::InjectorBase( +Injector::Injector( unsigned int events_to_inject, - std::shared_ptr earth_model, + std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random) : @@ -74,14 +74,14 @@ InjectorBase::InjectorBase( } } -std::shared_ptr InjectorBase::FindPositionDistribution(std::shared_ptr process) { +std::shared_ptr Injector::FindPositionDistribution(std::shared_ptr process) { for(auto distribution : process->GetInjectionDistributions()) { if(distribution->IsPositionDistribution()) return std::dynamic_pointer_cast(distribution); } throw(LI::utilities::AddProcessFailure("No vertex distribution specified!")); } -void InjectorBase::SetPrimaryProcess(std::shared_ptr primary) { +void Injector::SetPrimaryProcess(std::shared_ptr primary) { std::shared_ptr vtx_dist; try { vtx_dist = FindPositionDistribution(primary); @@ -93,7 +93,7 @@ void InjectorBase::SetPrimaryProcess(std::shared_ptr secondary) { +void Injector::AddSecondaryProcess(std::shared_ptr secondary) { std::shared_ptr vtx_dist; try { vtx_dist = FindPositionDistribution(secondary); @@ -107,21 +107,21 @@ void InjectorBase::AddSecondaryProcess(std::shared_ptrGetPrimaryType(), vtx_dist}); } -LI::dataclasses::InteractionRecord InjectorBase::NewRecord() const { +LI::dataclasses::InteractionRecord Injector::NewRecord() const { LI::dataclasses::InteractionRecord record; record.signature.primary_type = primary_process->GetPrimaryType(); return record; } -void InjectorBase::SetRandom(std::shared_ptr random) { +void Injector::SetRandom(std::shared_ptr random) { this->random = random; } -void InjectorBase::SampleCrossSection(LI::dataclasses::InteractionRecord & record) const { - SampleCrossSection(record, primary_process->GetCrossSections()); +void Injector::SampleCrossSection(LI::dataclasses::InteractionRecord & record) const { + SampleCrossSection(record, primary_process->GetInteractions()); } -void InjectorBase::SampleCrossSection(LI::dataclasses::InteractionRecord & record, std::shared_ptr cross_sections) const { +void Injector::SampleCrossSection(LI::dataclasses::InteractionRecord & record, std::shared_ptr interactions) const { // Make sure the particle has interacted if(std::isnan(record.interaction_vertex[0]) || @@ -130,7 +130,7 @@ void InjectorBase::SampleCrossSection(LI::dataclasses::InteractionRecord & recor throw(LI::utilities::InjectionFailure("No particle interaction!")); } - std::set const & possible_targets = cross_sections->TargetTypes(); + std::set const & possible_targets = interactions->TargetTypes(); LI::math::Vector3D interaction_vertex( record.interaction_vertex[0], @@ -152,17 +152,17 @@ void InjectorBase::SampleCrossSection(LI::dataclasses::InteractionRecord & recor std::vector probs; std::vector matching_targets; std::vector matching_signatures; - std::vector> matching_cross_sections; - std::vector> matching_decays; + std::vector> matching_cross_sections; + std::vector> matching_decays; LI::dataclasses::InteractionRecord fake_record = record; double fake_prob; - if (cross_sections->HasCrossSections()) { + if (interactions->HasCrossSections()) { for(auto const target : available_targets) { if(possible_targets.find(target) != possible_targets.end()) { // Get target density double target_density = earth_model->GetParticleDensity(intersections, interaction_vertex, target); // Loop over cross sections that have this target - std::vector> const & target_cross_sections = cross_sections->GetCrossSectionsForTarget(target); + std::vector> const & target_cross_sections = interactions->GetCrossSectionsForTarget(target); for(auto const & cross_section : target_cross_sections) { // Loop over cross section signatures with the same target std::vector signatures = cross_section->GetPossibleSignaturesFromParents(record.signature.primary_type, target); @@ -185,8 +185,8 @@ void InjectorBase::SampleCrossSection(LI::dataclasses::InteractionRecord & recor } } } - if (cross_sections->HasDecays()) { - for(auto const & decay : cross_sections->GetDecays() ) { + if (interactions->HasDecays()) { + for(auto const & decay : interactions->GetDecays() ) { for(auto const & signature : decay->GetPossibleSignaturesFromParent(record.signature.primary_type)) { fake_record.signature = signature; // fake_prob has units of 1/cm to match cross section probabilities @@ -224,7 +224,7 @@ void InjectorBase::SampleCrossSection(LI::dataclasses::InteractionRecord & recor matching_decays[index - matching_cross_sections.size()]->SampleFinalState(record, random); } -void InjectorBase::SampleNeutrissimoDecay(LI::dataclasses::InteractionRecord const & interaction, LI::dataclasses::DecayRecord & decay, double decay_width, double alpha_gen, double alpha_phys, LI::geometry::Geometry *fiducial = nullptr, double buffer = 0) const { +void Injector::SampleNeutrissimoDecay(LI::dataclasses::InteractionRecord const & interaction, LI::dataclasses::DecayRecord & decay, double decay_width, double alpha_gen, double alpha_phys, LI::geometry::Geometry *fiducial = nullptr, double buffer = 0) const { // This function takes an interaction record containing an HNL and simulates the decay to a photon // Samples according to (1 + alpha * cos(theta))/2 and returns physical weight // Final state photon added to secondary particle vectors in LI::dataclasses::InteractionRecord @@ -316,7 +316,7 @@ void InjectorBase::SampleNeutrissimoDecay(LI::dataclasses::InteractionRecord con decay.decay_parameters[4] = b; } -void InjectorBase::SamplePairProduction(LI::dataclasses::DecayRecord const & decay, LI::dataclasses::InteractionRecord & interaction) const { +void Injector::SamplePairProduction(LI::dataclasses::DecayRecord const & decay, LI::dataclasses::InteractionRecord & interaction) const { // function for simulating the pair production of the photon created in HNL decay // considers the different radiation lengths of materials in the detector // Nick TODO: comment more @@ -391,7 +391,7 @@ void InjectorBase::SamplePairProduction(LI::dataclasses::DecayRecord const & dec // Returns true if the sampling was successful // // TODO: convert to using an std::map of secondary processes -bool InjectorBase::SampleSecondaryProcess(unsigned int idx, +bool Injector::SampleSecondaryProcess(unsigned int idx, std::shared_ptr parent, LI::dataclasses::InteractionTreeDatum & datum) { @@ -404,7 +404,7 @@ bool InjectorBase::SampleSecondaryProcess(unsigned int idx, return false; throw(LI::utilities::SecondaryProcessFailure("No process defined for this particle type!")); } - std::shared_ptr sec_cross_sections = (*it)->GetCrossSections(); + std::shared_ptr sec_interactions = (*it)->GetInteractions(); std::vector> sec_distributions = (*it)->GetInjectionDistributions(); datum.record.signature.primary_type = parent->record.signature.secondary_types[idx]; datum.record.primary_mass = parent->record.secondary_masses[idx]; @@ -412,16 +412,16 @@ bool InjectorBase::SampleSecondaryProcess(unsigned int idx, datum.record.primary_helicity = parent->record.secondary_helicity[idx]; datum.parent = parent; for(auto & distribution : sec_distributions) { - distribution->Sample(random, earth_model, sec_cross_sections, datum); + distribution->Sample(random, earth_model, sec_interactions, datum); } - SampleCrossSection(datum.record,sec_cross_sections); + SampleCrossSection(datum.record,sec_interactions); // TODO: properly weight for secondary injection failure /*while(true) { try { for(auto & distribution : sec_distributions) { - distribution->Sample(random, earth_model, sec_cross_sections, datum); + distribution->Sample(random, earth_model, sec_interactions, datum); } - SampleCrossSection(record,sec_cross_sections); + SampleCrossSection(record,sec_interactions); break; } catch(LI::utilities::InjectionFailure const & e) { continue; @@ -430,14 +430,14 @@ bool InjectorBase::SampleSecondaryProcess(unsigned int idx, return true; } -LI::dataclasses::InteractionTree InjectorBase::GenerateEvent() { +LI::dataclasses::InteractionTree Injector::GenerateEvent() { LI::dataclasses::InteractionRecord record; // Initial Process while(true) { try { record = this->NewRecord(); for(auto & distribution : primary_process->GetInjectionDistributions()) { - distribution->Sample(random, earth_model, primary_process->GetCrossSections(), record); + distribution->Sample(random, earth_model, primary_process->GetInteractions(), record); } SampleCrossSection(record); break; @@ -471,11 +471,11 @@ LI::dataclasses::InteractionTree InjectorBase::GenerateEvent() { return tree; } -double InjectorBase::SecondaryGenerationProbability(std::shared_ptr const & datum) const { +double Injector::SecondaryGenerationProbability(std::shared_ptr const & datum) const { return GenerationProbability(datum, secondary_process_map.at(datum->record.signature.primary_type)); } -double InjectorBase::GenerationProbability(LI::dataclasses::InteractionTree const & tree) const { +double Injector::GenerationProbability(LI::dataclasses::InteractionTree const & tree) const { double probability = 1.0; std::set>::const_iterator it = tree.tree.cbegin(); while(it != tree.tree.cend()) { @@ -486,7 +486,7 @@ double InjectorBase::GenerationProbability(LI::dataclasses::InteractionTree cons return probability; } -double InjectorBase::GenerationProbability(std::shared_ptr const & datum, +double Injector::GenerationProbability(std::shared_ptr const & datum, std::shared_ptr process) const { double probability = 1.0; if(!process) { // assume we are dealing with the primary process @@ -494,15 +494,15 @@ double InjectorBase::GenerationProbability(std::shared_ptrGetInjectionDistributions()) { - double prob = dist->GenerationProbability(earth_model, process->GetCrossSections(), *datum); + double prob = dist->GenerationProbability(earth_model, process->GetInteractions(), *datum); probability *= prob; } - double prob = LI::injection::CrossSectionProbability(earth_model, process->GetCrossSections(), datum->record); + double prob = LI::injection::CrossSectionProbability(earth_model, process->GetInteractions(), datum->record); probability *= prob; return probability; } -double InjectorBase::GenerationProbability(LI::dataclasses::InteractionRecord const & record, +double Injector::GenerationProbability(LI::dataclasses::InteractionRecord const & record, std::shared_ptr process) const { double probability = 1.0; if(!process) { // assume we are dealing with the primary process @@ -510,16 +510,16 @@ double InjectorBase::GenerationProbability(LI::dataclasses::InteractionRecord co probability *= events_to_inject; // only do this for the primary process } for(auto const & dist : process->GetInjectionDistributions()) { - double prob = dist->GenerationProbability(earth_model, process->GetCrossSections(), record); + double prob = dist->GenerationProbability(earth_model, process->GetInteractions(), record); probability *= prob; } - double prob = LI::injection::CrossSectionProbability(earth_model, process->GetCrossSections(), record); + double prob = LI::injection::CrossSectionProbability(earth_model, process->GetInteractions(), record); probability *= prob; return probability; } // TODO: do we need to save secondary process variables here? -std::set> InjectorBase::DensityVariables() const { +std::set> Injector::DensityVariables() const { std::set> variable_sets; std::vector variables; for(auto const & dist : primary_process->GetInjectionDistributions()) { @@ -527,7 +527,7 @@ std::set> InjectorBase::DensityVariables() const { variables.reserve(variables.size() + new_variables.size()); variables.insert(variables.end(), new_variables.begin(), new_variables.end()); } - std::vector> xs_vec = primary_process->GetCrossSections()->GetCrossSections(); + std::vector> xs_vec = primary_process->GetInteractions()->GetCrossSections(); for(auto const & xs : xs_vec) { std::vector new_variables = xs->DensityVariables(); std::vector variable_list; @@ -539,43 +539,43 @@ std::set> InjectorBase::DensityVariables() const { return variable_sets; } -std::string InjectorBase::Name() const { - return("InjectorBase"); +std::string Injector::Name() const { + return("Injector"); } -std::pair InjectorBase::InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const { +std::pair Injector::InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const { if(!primary_position_distribution) { return std::pair(LI::math::Vector3D(0, 0, 0), LI::math::Vector3D(0, 0, 0)); } - return primary_position_distribution->InjectionBounds(earth_model, primary_process->GetCrossSections(), interaction); + return primary_position_distribution->InjectionBounds(earth_model, primary_process->GetInteractions(), interaction); } // Assumes there is a secondary process and position distribuiton for the provided particle type -std::pair InjectorBase::InjectionBounds(LI::dataclasses::InteractionTreeDatum const & datum, LI::dataclasses::Particle::ParticleType const & primary_type) const { - return secondary_position_distribution_map.at(primary_type)->InjectionBounds(earth_model, secondary_process_map.at(primary_type)->GetCrossSections(), datum); +std::pair Injector::InjectionBounds(LI::dataclasses::InteractionTreeDatum const & datum, LI::dataclasses::Particle::ParticleType const & primary_type) const { + return secondary_position_distribution_map.at(primary_type)->InjectionBounds(earth_model, secondary_process_map.at(primary_type)->GetInteractions(), datum); } -std::vector> InjectorBase::GetInjectionDistributions() const { +std::vector> Injector::GetInjectionDistributions() const { return primary_process->GetInjectionDistributions(); } -std::shared_ptr InjectorBase::GetEarthModel() const { +std::shared_ptr Injector::GetDetectorModel() const { return earth_model; } -std::shared_ptr InjectorBase::GetCrossSections() const { - return primary_process->GetCrossSections(); +std::shared_ptr Injector::GetInteractions() const { + return primary_process->GetInteractions(); } -unsigned int InjectorBase::InjectedEvents() const { +unsigned int Injector::InjectedEvents() const { return injected_events; } -unsigned int InjectorBase::EventsToInject() const { +unsigned int Injector::EventsToInject() const { return events_to_inject; } -InjectorBase::operator bool() const { +Injector::operator bool() const { return injected_events < events_to_inject; } diff --git a/projects/injection/private/Process.cxx b/projects/injection/private/Process.cxx index 9dd0389c..ee2e0d27 100644 --- a/projects/injection/private/Process.cxx +++ b/projects/injection/private/Process.cxx @@ -5,30 +5,30 @@ namespace LI { namespace injection { -Process::Process(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _cross_sections) : primary_type(_primary_type), cross_sections(_cross_sections) {} +Process::Process(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _interactions) : primary_type(_primary_type), interactions(_interactions) {} -Process::Process(Process const & other) : primary_type(other.primary_type), cross_sections(other.cross_sections) {} +Process::Process(Process const & other) : primary_type(other.primary_type), interactions(other.interactions) {} -Process::Process(Process && other) : primary_type(other.primary_type), cross_sections(other.cross_sections) {} +Process::Process(Process && other) : primary_type(other.primary_type), interactions(other.interactions) {} Process & Process::operator=(Process const & other) { primary_type = other.primary_type; - cross_sections = other.cross_sections; + interactions = other.interactions; return *this; } Process & Process::operator=(Process && other) { primary_type = other.primary_type; - cross_sections = other.cross_sections; + interactions = other.interactions; return *this; } -void Process::SetCrossSections(std::shared_ptr _cross_sections) { - cross_sections = _cross_sections; +void Process::SetInteractions(std::shared_ptr _interactions) { + interactions = _interactions; } -std::shared_ptr Process::GetCrossSections() const { - return cross_sections; +std::shared_ptr Process::GetInteractions() const { + return interactions; } void Process::SetPrimaryType(LI::dataclasses::Particle::ParticleType _primary_type) { @@ -42,24 +42,24 @@ LI::dataclasses::Particle::ParticleType Process::GetPrimaryType() const { bool Process::operator==(Process const & other) const { return std::tie( primary_type, - cross_sections) + interactions) == std::tie( other.primary_type, - other.cross_sections); + other.interactions); } bool Process::MatchesHead(std::shared_ptr const & other) const { return std::tie( primary_type, - cross_sections) + interactions) == std::tie( other->primary_type, - other->cross_sections); + other->interactions); } -PhysicalProcess::PhysicalProcess(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _cross_sections) : Process(_primary_type, _cross_sections) {}; +PhysicalProcess::PhysicalProcess(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _interactions) : Process(_primary_type, _interactions) {}; PhysicalProcess::PhysicalProcess(PhysicalProcess const & other) : Process(other), physical_distributions(other.physical_distributions) {}; @@ -88,7 +88,7 @@ std::vector> const & Phys return physical_distributions; } -InjectionProcess::InjectionProcess(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _cross_sections) : PhysicalProcess(_primary_type, _cross_sections) {}; +InjectionProcess::InjectionProcess(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _interactions) : PhysicalProcess(_primary_type, _interactions) {}; InjectionProcess::InjectionProcess(InjectionProcess const & other) : PhysicalProcess(other), injection_distributions(other.injection_distributions) {}; diff --git a/projects/injection/private/RangedLeptonInjector.cxx b/projects/injection/private/RangedLeptonInjector.cxx index e03e4494..c1748ce0 100644 --- a/projects/injection/private/RangedLeptonInjector.cxx +++ b/projects/injection/private/RangedLeptonInjector.cxx @@ -4,41 +4,41 @@ #include #include -#include "LeptonInjector/crosssections/CrossSectionCollection.h" +#include "LeptonInjector/interactions/InteractionCollection.h" #include "LeptonInjector/dataclasses/Particle.h" #include "LeptonInjector/distributions/primary/vertex/RangeFunction.h" #include "LeptonInjector/distributions/primary/vertex/RangePositionDistribution.h" -#include "LeptonInjector/injection/InjectorBase.h" +#include "LeptonInjector/injection/Injector.h" #include "LeptonInjector/injection/Process.h" #include "LeptonInjector/math/Vector3D.h" namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace injection { //--------------- -// class RangedLeptonInjector : InjectorBase +// class RangedLeptonInjector : Injector //--------------- RangedLeptonInjector::RangedLeptonInjector() {} RangedLeptonInjector::RangedLeptonInjector( unsigned int events_to_inject, - std::shared_ptr earth_model, + std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, std::shared_ptr range_func, double disk_radius, double endcap_length) : - InjectorBase(events_to_inject, earth_model, random), + Injector(events_to_inject, earth_model, random), range_func(range_func), disk_radius(disk_radius), endcap_length(endcap_length) { - cross_sections = primary_process->GetCrossSections(); - std::set target_types = cross_sections->TargetTypes(); + interactions = primary_process->GetInteractions(); + std::set target_types = interactions->TargetTypes(); position_distribution = std::make_shared(disk_radius, endcap_length, range_func, target_types); primary_process->AddInjectionDistribution(position_distribution); SetPrimaryProcess(primary_process); @@ -47,7 +47,7 @@ RangedLeptonInjector::RangedLeptonInjector( // Assume each secondary process already has a position distribution // Otherwise uncomment below /* - target_types = sec_process->GetCrossSections()->TargetTypes(); + target_types = sec_process->GetInteractions()->TargetTypes(); sec_process->GetInjectionDistributions().push_back(std::make_shared(disk_radius, endcap_length, range_func, target_types)); */ } @@ -58,7 +58,7 @@ std::string RangedLeptonInjector::Name() const { } std::pair RangedLeptonInjector::InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const { - return position_distribution->InjectionBounds(earth_model, cross_sections, interaction); + return position_distribution->InjectionBounds(earth_model, interactions, interaction); } } // namespace injection diff --git a/projects/injection/private/TreeWeighter.cxx b/projects/injection/private/TreeWeighter.cxx index e9c553ff..15baf037 100644 --- a/projects/injection/private/TreeWeighter.cxx +++ b/projects/injection/private/TreeWeighter.cxx @@ -8,14 +8,14 @@ #include // for ope... #include // for set #include // for out... -#include "LeptonInjector/crosssections/CrossSection.h" // for Cro... -#include "LeptonInjector/crosssections/CrossSectionCollection.h" // for Cro... +#include "LeptonInjector/interactions/CrossSection.h" // for Cro... +#include "LeptonInjector/interactions/InteractionCollection.h" // for Cro... #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Int... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Int... -#include "LeptonInjector/detector/EarthModel.h" // for Ear... +#include "LeptonInjector/detector/DetectorModel.h" // for Ear... #include "LeptonInjector/distributions/Distributions.h" // for Inj... #include "LeptonInjector/geometry/Geometry.h" // for Geo... -#include "LeptonInjector/injection/InjectorBase.h" // for Inj... +#include "LeptonInjector/injection/Injector.h" // for Inj... #include "LeptonInjector/injection/Process.h" // for Phy... #include "LeptonInjector/injection/WeightingUtils.h" // for Cro... #include "LeptonInjector/math/Vector3D.h" // for Vec... @@ -25,12 +25,12 @@ #include #include -#include "LeptonInjector/injection/InjectorBase.h" +#include "LeptonInjector/injection/Injector.h" #include "LeptonInjector/distributions/primary/vertex/VertexPositionDistribution.h" -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/CrossSectionCollection.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/InteractionCollection.h" #include "LeptonInjector/dataclasses/InteractionSignature.h" @@ -163,7 +163,7 @@ double LeptonTreeWeighter::EventWeight(LI::dataclasses::InteractionTree const & return 1./inv_weight; } -LeptonTreeWeighter::LeptonTreeWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr primary_physical_process, std::vector> secondary_physical_processes) +LeptonTreeWeighter::LeptonTreeWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr primary_physical_process, std::vector> secondary_physical_processes) : injectors(injectors) , earth_model(earth_model) , primary_physical_process(primary_physical_process) @@ -172,7 +172,7 @@ LeptonTreeWeighter::LeptonTreeWeighter(std::vector Initialize(); } -LeptonTreeWeighter::LeptonTreeWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr primary_physical_process) +LeptonTreeWeighter::LeptonTreeWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr primary_physical_process) : injectors(injectors) , earth_model(earth_model) , primary_physical_process(primary_physical_process) @@ -225,18 +225,18 @@ double LeptonProcessWeighter::InteractionProbability(std::pairGetIntersections(earth_model->GetEarthCoordPosFromDetCoordPos(interaction_vertex), earth_model->GetEarthCoordDirFromDetCoordDir(primary_direction)); - std::map>> const & cross_sections_by_target = phys_process->GetCrossSections()->GetCrossSectionsByTarget(); + std::map>> const & cross_sections_by_target = phys_process->GetInteractions()->GetCrossSectionsByTarget(); std::vector targets; targets.reserve(cross_sections_by_target.size()); std::vector total_cross_sections; - double total_decay_length = phys_process->GetCrossSections()->TotalDecayLength(record); + double total_decay_length = phys_process->GetInteractions()->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(auto const & target_xs : cross_sections_by_target) { targets.push_back(target_xs.first); fake_record.target_mass = earth_model->GetTargetMass(target_xs.first); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - std::vector> const & xs_list = target_xs.second; + std::vector> const & xs_list = target_xs.second; double total_xs = 0.0; for(auto const & xs : xs_list) { std::vector signatures = xs->GetPossibleSignaturesFromParents(record.signature.primary_type, target_xs.first); @@ -273,19 +273,19 @@ double LeptonProcessWeighter::NormalizedPositionProbability(std::pairGetIntersections(earth_model->GetEarthCoordPosFromDetCoordPos(interaction_vertex), primary_direction); - std::map>> const & cross_sections_by_target = phys_process->GetCrossSections()->GetCrossSectionsByTarget(); + std::map>> const & cross_sections_by_target = phys_process->GetInteractions()->GetCrossSectionsByTarget(); unsigned int n_targets = cross_sections_by_target.size(); std::vector targets; targets.reserve(n_targets); std::vector total_cross_sections; - double total_decay_length = phys_process->GetCrossSections()->TotalDecayLength(record); + double total_decay_length = phys_process->GetInteractions()->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(auto const & target_xs : cross_sections_by_target) { targets.push_back(target_xs.first); fake_record.target_mass = earth_model->GetTargetMass(target_xs.first); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - std::vector> const & xs_list = target_xs.second; + std::vector> const & xs_list = target_xs.second; double total_xs = 0.0; for(auto const & xs : xs_list) { std::vector signatures = xs->GetPossibleSignaturesFromParents(record.signature.primary_type, target_xs.first); @@ -326,22 +326,22 @@ double LeptonProcessWeighter::PhysicalProbability(std::pairGetCrossSections(), record); + prob = LI::injection::CrossSectionProbability(earth_model, phys_process->GetInteractions(), record); physical_probability *= prob; for(auto physical_dist : unique_phys_distributions) { - physical_probability *= physical_dist->GenerationProbability(earth_model, phys_process->GetCrossSections(), record); + physical_probability *= physical_dist->GenerationProbability(earth_model, phys_process->GetInteractions(), record); } return normalization * physical_probability; } double LeptonProcessWeighter::GenerationProbability(LI::dataclasses::InteractionTreeDatum const & datum ) const { - double gen_probability = LI::injection::CrossSectionProbability(earth_model, phys_process->GetCrossSections(), datum.record); + double gen_probability = LI::injection::CrossSectionProbability(earth_model, phys_process->GetInteractions(), datum.record); for(auto gen_dist : unique_gen_distributions) { - gen_probability *= gen_dist->GenerationProbability(earth_model, phys_process->GetCrossSections(), datum); + gen_probability *= gen_dist->GenerationProbability(earth_model, phys_process->GetInteractions(), datum); } return gen_probability; } @@ -351,7 +351,7 @@ double LeptonProcessWeighter::EventWeight(std::pair phys_process, std::shared_ptr inj_process, std::shared_ptr earth_model) +LeptonProcessWeighter::LeptonProcessWeighter(std::shared_ptr phys_process, std::shared_ptr inj_process, std::shared_ptr earth_model) : phys_process(phys_process) , inj_process(inj_process) , earth_model(earth_model) diff --git a/projects/injection/private/Weighter.cxx b/projects/injection/private/Weighter.cxx index 9df94d6f..43f4e5ed 100644 --- a/projects/injection/private/Weighter.cxx +++ b/projects/injection/private/Weighter.cxx @@ -11,16 +11,16 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/CrossSectionCollection.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/InteractionCollection.h" #include "LeptonInjector/dataclasses/InteractionRecord.h" #include "LeptonInjector/dataclasses/InteractionSignature.h" #include "LeptonInjector/dataclasses/Particle.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/distributions/Distributions.h" #include "LeptonInjector/distributions/primary/vertex/VertexPositionDistribution.h" #include "LeptonInjector/geometry/Geometry.h" -#include "LeptonInjector/injection/InjectorBase.h" +#include "LeptonInjector/injection/Injector.h" #include "LeptonInjector/injection/WeightingUtils.h" #include "LeptonInjector/math/Vector3D.h" @@ -82,7 +82,7 @@ namespace { // class LeptonWeighter //--------------- -double LeptonWeighter::InteractionProbability(std::shared_ptr injector, LI::dataclasses::InteractionRecord const & record) const { +double LeptonWeighter::InteractionProbability(std::shared_ptr injector, LI::dataclasses::InteractionRecord const & record) const { std::pair bounds = injector->InjectionBounds(record); return InteractionProbability(bounds, record); } @@ -100,17 +100,17 @@ double LeptonWeighter::InteractionProbability(std::pairGetIntersections(earth_model->GetEarthCoordPosFromDetCoordPos(interaction_vertex), earth_model->GetEarthCoordDirFromDetCoordDir(primary_direction)); - std::map>> const & cross_sections_by_target = cross_sections->GetCrossSectionsByTarget(); + std::map>> const & cross_sections_by_target = interactions->GetCrossSectionsByTarget(); std::vector targets; targets.reserve(cross_sections_by_target.size()); std::vector total_cross_sections; - double total_decay_length = cross_sections->TotalDecayLength(record); + double total_decay_length = interactions->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(auto const & target_xs : cross_sections_by_target) { targets.push_back(target_xs.first); fake_record.target_mass = earth_model->GetTargetMass(target_xs.first); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - std::vector> const & xs_list = target_xs.second; + std::vector> const & xs_list = target_xs.second; double total_xs = 0.0; for(auto const & xs : xs_list) { std::vector signatures = xs->GetPossibleSignaturesFromParents(record.signature.primary_type, target_xs.first); @@ -133,7 +133,7 @@ double LeptonWeighter::InteractionProbability(std::pair injector, LI::dataclasses::InteractionRecord const & record) const { +double LeptonWeighter::UnnormalizedPositionProbability(std::shared_ptr injector, LI::dataclasses::InteractionRecord const & record) const { std::pair bounds = injector->InjectionBounds(record); return UnnormalizedPositionProbability(bounds, record); } @@ -151,19 +151,19 @@ double LeptonWeighter::UnnormalizedPositionProbability(std::pairGetIntersections(earth_model->GetEarthCoordPosFromDetCoordPos(interaction_vertex), primary_direction); - std::map>> const & cross_sections_by_target = cross_sections->GetCrossSectionsByTarget(); + std::map>> const & cross_sections_by_target = interactions->GetCrossSectionsByTarget(); unsigned int n_targets = cross_sections_by_target.size(); std::vector targets; targets.reserve(n_targets); std::vector total_cross_sections; - double total_decay_length = cross_sections->TotalDecayLength(record); + double total_decay_length = interactions->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(auto const & target_xs : cross_sections_by_target) { targets.push_back(target_xs.first); fake_record.target_mass = earth_model->GetTargetMass(target_xs.first); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - std::vector> const & xs_list = target_xs.second; + std::vector> const & xs_list = target_xs.second; double total_xs = 0.0; for(auto const & xs : xs_list) { std::vector signatures = xs->GetPossibleSignaturesFromParents(record.signature.primary_type, target_xs.first); @@ -203,19 +203,19 @@ double LeptonWeighter::NormalizedPositionProbability(std::pairGetIntersections(earth_model->GetEarthCoordPosFromDetCoordPos(interaction_vertex), primary_direction); - std::map>> const & cross_sections_by_target = cross_sections->GetCrossSectionsByTarget(); + std::map>> const & cross_sections_by_target = interactions->GetCrossSectionsByTarget(); unsigned int n_targets = cross_sections_by_target.size(); std::vector targets; targets.reserve(n_targets); std::vector total_cross_sections; - double total_decay_length = cross_sections->TotalDecayLength(record); + double total_decay_length = interactions->TotalDecayLength(record); LI::dataclasses::InteractionRecord fake_record = record; for(auto const & target_xs : cross_sections_by_target) { targets.push_back(target_xs.first); fake_record.target_mass = earth_model->GetTargetMass(target_xs.first); fake_record.target_momentum = {fake_record.target_mass,0,0,0}; - std::vector> const & xs_list = target_xs.second; + std::vector> const & xs_list = target_xs.second; double total_xs = 0.0; for(auto const & xs : xs_list) { std::vector signatures = xs->GetPossibleSignaturesFromParents(record.signature.primary_type, target_xs.first); @@ -310,15 +310,15 @@ void LeptonWeighter::Initialize() { continue; } // Check if dists are equivalent - // Must consider the EarthModel and CrossSectionCollection context in the comparison + // Must consider the DetectorModel and InteractionCollection context in the comparison std::shared_ptr gen_dist_ptr(gen_dist.second); bool equivalent_dists = phys_dist.second->AreEquivalent( // physical dist earth_model, // physical context - cross_sections, // physical context + interactions, // physical context gen_dist_ptr, // generation dist - injectors[i]->GetEarthModel(), // generation context - injectors[i]->GetCrossSections()); // generation context + injectors[i]->GetDetectorModel(), // generation context + injectors[i]->GetInteractions()); // generation context if(not equivalent_dists) { continue; } @@ -333,7 +333,7 @@ void LeptonWeighter::Initialize() { // The one exception to this is vertex position distributions // Physical vertex position distributions depend on the injection bounds and so cannot be common across terms - // Physical distributions have the same EarthModel+CrossSection context so we do not need to compare them + // Physical distributions have the same DetectorModel+CrossSection context so we do not need to compare them // We just need to check that these distributions have not been cancelled out for any terms std::vector common_physical_dist_idxs; for(unsigned int phys_idx=0; phys_idxAreEquivalent( // gen dist 0 - injectors[i]->GetEarthModel(), // gen dist 0 context - injectors[i]->GetCrossSections(), // gen dist 0 context + injectors[i]->GetDetectorModel(), // gen dist 0 context + injectors[i]->GetInteractions(), // gen dist 0 context (std::shared_ptr)(gen_dist_1.second), // gen dist 1 - injectors[j]->GetEarthModel(), // gen dist 1 context - injectors[j]->GetCrossSections()); // gen dist 1 context + injectors[j]->GetDetectorModel(), // gen dist 1 context + injectors[j]->GetInteractions()); // gen dist 1 context if(not equivalent_dists) continue; found_common = true; @@ -410,32 +410,32 @@ void LeptonWeighter::Initialize() { for(unsigned int gen_idx : common_generation_dist_idxs) { // These are common to all injectors, so we pull information from the first injector std::shared_ptr dist = generation_distribution_state[0][gen_idx].second; - std::shared_ptr dist_earth = injectors[0]->GetEarthModel(); - std::shared_ptr dist_cross_sections = injectors[0]->GetCrossSections(); - std::function, std::shared_ptr, std::shared_ptr>)> predicate = [&] (std::tuple, std::shared_ptr, std::shared_ptr> p) -> bool { - return std::get<0>(p)->AreEquivalent(std::get<1>(p), std::get<2>(p), dist, dist_earth, dist_cross_sections); + std::shared_ptr dist_earth = injectors[0]->GetDetectorModel(); + std::shared_ptr dist_interactions = injectors[0]->GetInteractions(); + std::function, std::shared_ptr, std::shared_ptr>)> predicate = [&] (std::tuple, std::shared_ptr, std::shared_ptr> p) -> bool { + return std::get<0>(p)->AreEquivalent(std::get<1>(p), std::get<2>(p), dist, dist_earth, dist_interactions); }; auto it = std::find_if(unique_distributions.begin(), unique_distributions.end(), predicate); if(it != unique_distributions.end()) { unsigned int index = std::distance(unique_distributions.begin(), it); common_gen_idxs.push_back(index); } else { - unique_distributions.push_back(std::make_tuple(dist, injectors[0]->GetEarthModel(), injectors[0]->GetCrossSections())); + unique_distributions.push_back(std::make_tuple(dist, injectors[0]->GetDetectorModel(), injectors[0]->GetInteractions())); common_gen_idxs.push_back(unique_distributions.size()-1); } } for(unsigned int phys_idx : common_physical_dist_idxs) { std::shared_ptr dist = physical_distributions[phys_idx]; - std::function, std::shared_ptr, std::shared_ptr>)> predicate = [&] (std::tuple, std::shared_ptr, std::shared_ptr> p) -> bool { - return std::get<0>(p)->AreEquivalent(std::get<1>(p), std::get<2>(p), dist, earth_model, cross_sections); + std::function, std::shared_ptr, std::shared_ptr>)> predicate = [&] (std::tuple, std::shared_ptr, std::shared_ptr> p) -> bool { + return std::get<0>(p)->AreEquivalent(std::get<1>(p), std::get<2>(p), dist, earth_model, interactions); }; auto it = std::find_if(unique_distributions.begin(), unique_distributions.end(), predicate); if(it != unique_distributions.end()) { unsigned int index = std::distance(unique_distributions.begin(), it); common_phys_idxs.push_back(index); } else { - unique_distributions.push_back(std::make_tuple(dist, earth_model, cross_sections)); + unique_distributions.push_back(std::make_tuple(dist, earth_model, interactions)); common_phys_idxs.push_back(unique_distributions.size()-1); } } @@ -452,17 +452,17 @@ void LeptonWeighter::Initialize() { continue; std::shared_ptr dist = gen_dists[gen_idx].second; // These are common to all injectors, so we pull information from the first injector - std::shared_ptr dist_earth = injectors[injector_idx]->GetEarthModel(); - std::shared_ptr dist_cross_sections = injectors[injector_idx]->GetCrossSections(); - std::function, std::shared_ptr, std::shared_ptr>)> predicate = [&] (std::tuple, std::shared_ptr, std::shared_ptr> p) -> bool { - return std::get<0>(p)->AreEquivalent(std::get<1>(p), std::get<2>(p), dist, dist_earth, dist_cross_sections); + std::shared_ptr dist_earth = injectors[injector_idx]->GetDetectorModel(); + std::shared_ptr dist_interactions = injectors[injector_idx]->GetInteractions(); + std::function, std::shared_ptr, std::shared_ptr>)> predicate = [&] (std::tuple, std::shared_ptr, std::shared_ptr> p) -> bool { + return std::get<0>(p)->AreEquivalent(std::get<1>(p), std::get<2>(p), dist, dist_earth, dist_interactions); }; auto it = std::find_if(unique_distributions.begin(), unique_distributions.end(), predicate); if(it != unique_distributions.end()) { unsigned int index = std::distance(unique_distributions.begin(), it); gen_idxs.push_back(index); } else { - unique_distributions.push_back(std::make_tuple(dist, injectors[injector_idx]->GetEarthModel(), injectors[injector_idx]->GetCrossSections())); + unique_distributions.push_back(std::make_tuple(dist, injectors[injector_idx]->GetDetectorModel(), injectors[injector_idx]->GetInteractions())); gen_idxs.push_back(unique_distributions.size()-1); } } @@ -472,15 +472,15 @@ void LeptonWeighter::Initialize() { if(not included) continue; std::shared_ptr dist = phys_dists[phys_idx].second; - std::function, std::shared_ptr, std::shared_ptr>)> predicate = [&] (std::tuple, std::shared_ptr, std::shared_ptr> p) -> bool { - return std::get<0>(p)->AreEquivalent(std::get<1>(p), std::get<2>(p), dist, earth_model, cross_sections); + std::function, std::shared_ptr, std::shared_ptr>)> predicate = [&] (std::tuple, std::shared_ptr, std::shared_ptr> p) -> bool { + return std::get<0>(p)->AreEquivalent(std::get<1>(p), std::get<2>(p), dist, earth_model, interactions); }; auto it = std::find_if(unique_distributions.begin(), unique_distributions.end(), predicate); if(it != unique_distributions.end()) { unsigned int index = std::distance(unique_distributions.begin(), it); phys_idxs.push_back(index); } else { - unique_distributions.push_back(std::make_tuple(dist, earth_model, cross_sections)); + unique_distributions.push_back(std::make_tuple(dist, earth_model, interactions)); phys_idxs.push_back(unique_distributions.size()-1); } } @@ -490,14 +490,14 @@ void LeptonWeighter::Initialize() { //TODO // Find unique contexts - // std::vector, std::shared_ptr>> unique_contexts; + // std::vector, std::shared_ptr>> unique_contexts; // std::vector context_idx_by_injector; } -LeptonWeighter::LeptonWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr cross_sections, std::vector> physical_distributions) +LeptonWeighter::LeptonWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr interactions, std::vector> physical_distributions) : injectors(injectors) , earth_model(earth_model) - , cross_sections(cross_sections) + , interactions(interactions) , physical_distributions(physical_distributions) { Initialize(); @@ -534,20 +534,20 @@ double LeptonWeighter::EventWeight(LI::dataclasses::InteractionRecord const & re // Need pos_prob * int_prob // pos_prob already supplied // just need int_prob - physical_probability *= InteractionProbability((std::shared_ptr)injector, record); + physical_probability *= InteractionProbability((std::shared_ptr)injector, record); } else { // Need pos_prob * int_prob // nothing is already supplied // need pos_prob and int_prob // pos_prob * int_prob == unnormalized pos_prob - physical_probability *= UnnormalizedPositionProbability((std::shared_ptr)injector, record); + physical_probability *= UnnormalizedPositionProbability((std::shared_ptr)injector, record); } */ double prob = InteractionProbability(bounds, record); physical_probability *= prob; prob = NormalizedPositionProbability(bounds, record); physical_probability *= prob; - prob = LI::injection::CrossSectionProbability(injector->GetEarthModel(), injector->GetCrossSections(), record); + prob = LI::injection::CrossSectionProbability(injector->GetDetectorModel(), injector->GetInteractions(), record); physical_probability *= prob; // Number of events is already in GenerationProbability // double num_events = injector->EventsToInject(); @@ -560,7 +560,7 @@ double LeptonWeighter::EventWeight(LI::dataclasses::InteractionRecord const & re // One physical probability density is computed for each distribution, independent of the injectors double common_physical_probability = 1.0; for(auto physical_distribution : physical_distributions) { - double prob = physical_distribution->GenerationProbability(earth_model, cross_sections, record); + double prob = physical_distribution->GenerationProbability(earth_model, interactions, record); common_physical_probability *= prob; } @@ -574,8 +574,8 @@ double LeptonWeighter::SimplifiedEventWeight(LI::dataclasses::InteractionRecord for(unsigned int i=0; i, - std::shared_ptr, - std::shared_ptr + std::shared_ptr, + std::shared_ptr > const & p = unique_distributions[i]; probs.push_back(std::get<0>(p)->GenerationProbability(std::get<1>(p), std::get<2>(p), record)); } @@ -584,7 +584,7 @@ double LeptonWeighter::SimplifiedEventWeight(LI::dataclasses::InteractionRecord for(unsigned int i=0; iGetEarthModel(), injectors[i]->GetCrossSections(), record); + double cross_section_probability = LI::injection::CrossSectionProbability(injectors[i]->GetDetectorModel(), injectors[i]->GetInteractions(), record); prob *= cross_section_probability; for(unsigned int j=0; j)injectors[i], record); + double int_prob = InteractionProbability((std::shared_ptr)injectors[i], record); prob /= int_prob; } else { // Need pos_prob * int_prob // nothing is already supplied // need pos_prob and int_prob // pos_prob * int_prob == unnormalized pos_prob - double pos_prob = UnnormalizedPositionProbability((std::shared_ptr)injectors[i], record); + double pos_prob = UnnormalizedPositionProbability((std::shared_ptr)injectors[i], record); prob /= pos_prob; }*/ std::pair bounds = injectors[i]->InjectionBounds(record); diff --git a/projects/injection/private/WeightingUtils.cxx b/projects/injection/private/WeightingUtils.cxx index fee9e5fa..ec9b44b0 100644 --- a/projects/injection/private/WeightingUtils.cxx +++ b/projects/injection/private/WeightingUtils.cxx @@ -4,13 +4,13 @@ #include // for array #include // for vector -#include "LeptonInjector/crosssections/CrossSection.h" // for Cro... -#include "LeptonInjector/crosssections/CrossSectionCollection.h" // for Cro... -#include "LeptonInjector/crosssections/Decay.h" // for Decay +#include "LeptonInjector/interactions/CrossSection.h" // for Cro... +#include "LeptonInjector/interactions/InteractionCollection.h" // for Cro... +#include "LeptonInjector/interactions/Decay.h" // for Decay #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Int... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Int... #include "LeptonInjector/dataclasses/Particle.h" // for Par... -#include "LeptonInjector/detector/EarthModel.h" // for Ear... +#include "LeptonInjector/detector/DetectorModel.h" // for Ear... #include "LeptonInjector/geometry/Geometry.h" // for Geo... #include "LeptonInjector/math/Vector3D.h" // for Vec... #include "LeptonInjector/utilities/Constants.h" // for cm @@ -18,8 +18,8 @@ namespace LI { namespace injection { -double CrossSectionProbability(std::shared_ptr earth_model, std::shared_ptr cross_sections, LI::dataclasses::InteractionRecord const & record) { - std::set const & possible_targets = cross_sections->TargetTypes(); +double CrossSectionProbability(std::shared_ptr earth_model, std::shared_ptr interactions, LI::dataclasses::InteractionRecord const & record) { + std::set const & possible_targets = interactions->TargetTypes(); std::set available_targets_list = earth_model->GetAvailableTargets(earth_model->GetEarthCoordPosFromDetCoordPos(record.interaction_vertex)); std::set available_targets(available_targets_list.begin(), available_targets_list.end()); @@ -41,7 +41,7 @@ double CrossSectionProbability(std::shared_ptr e double selected_final_state = 0.0; LI::dataclasses::InteractionRecord fake_record = record; // first let's check decays - std::vector> decays = cross_sections->GetDecays(); + std::vector> decays = interactions->GetDecays(); for(auto const & decay : decays) { std::vector signatures = decay->GetPossibleSignaturesFromParent(record.signature.primary_type); for(auto const & signature : signatures) { @@ -60,7 +60,7 @@ double CrossSectionProbability(std::shared_ptr e // Get target density double target_density = earth_model->GetParticleDensity(intersections, earth_model->GetEarthCoordPosFromDetCoordPos(interaction_vertex), target); // Loop over cross sections that have this target - std::vector> const & target_cross_sections = cross_sections->GetCrossSectionsForTarget(target); + std::vector> const & target_cross_sections = interactions->GetCrossSectionsForTarget(target); for(auto const & cross_section : target_cross_sections) { // Loop over cross section signatures with the same target std::vector signatures = cross_section->GetPossibleSignaturesFromParents(record.signature.primary_type, target); diff --git a/projects/injection/private/pybindings/LeptonInjector.cxx b/projects/injection/private/pybindings/LeptonInjector.cxx index e14575c1..1690a91d 100644 --- a/projects/injection/private/pybindings/LeptonInjector.cxx +++ b/projects/injection/private/pybindings/LeptonInjector.cxx @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -267,9 +267,9 @@ BOOST_PYTHON_MODULE(LeptonInjector){ def("deduceInitialType", &deduceInitialType); def("getInteraction", &getInteraction); - class_>("InjectorBase", - init, std::vector>, std::shared_ptr, std::vector>, std::shared_ptr>( - (args("events_to_inject"),args("primary_injector"),args("cross_sections"),args("earth_model"),args("distributions"),args("random")) + class_>("Injector", + init, std::vector>, std::shared_ptr, std::vector>, std::shared_ptr>( + (args("events_to_inject"),args("primary_injector"),args("interactions"),args("earth_model"),args("distributions"),args("random")) ) ) ; diff --git a/projects/injection/private/pybindings/injection.cxx b/projects/injection/private/pybindings/injection.cxx index 841a3079..3fbc4562 100644 --- a/projects/injection/private/pybindings/injection.cxx +++ b/projects/injection/private/pybindings/injection.cxx @@ -2,7 +2,7 @@ #include #include "../../public/LeptonInjector/injection/Process.h" -#include "../../public/LeptonInjector/injection/InjectorBase.h" +#include "../../public/LeptonInjector/injection/Injector.h" #include "../../public/LeptonInjector/injection/ColumnDepthLeptonInjector.h" #include "../../public/LeptonInjector/injection/CylinderVolumeLeptonInjector.h" #include "../../public/LeptonInjector/injection/DecayRangeLeptonInjector.h" @@ -13,8 +13,8 @@ #include "../../../distributions/public/LeptonInjector/distributions/primary/vertex/DepthFunction.h" #include "../../../utilities/public/LeptonInjector/utilities/Random.h" -#include "../../../detector/public/LeptonInjector/detector/EarthModel.h" -#include "../../../crosssections/public/LeptonInjector/crosssections/CrossSectionCollection.h" +#include "../../../detector/public/LeptonInjector/detector/DetectorModel.h" +#include "../../../interactions/public/LeptonInjector/interactions/InteractionCollection.h" #include #include @@ -35,7 +35,7 @@ PYBIND11_MODULE(injection,m) { class_>(m, "Process") .def_property("primary_type", &Process::GetPrimaryType, &Process::SetPrimaryType) - .def_property("cross_sections", &Process::GetCrossSections, &Process::SetCrossSections); + .def_property("interactions", &Process::GetInteractions, &Process::SetInteractions); class_, Process>(m, "InjectionProcess") .def(init<>()) @@ -49,48 +49,48 @@ PYBIND11_MODULE(injection,m) { // Injection - class_>(m, "InjectorBase") - .def(init, std::shared_ptr>()) - .def(init, std::shared_ptr, std::shared_ptr>()) - .def(init, std::shared_ptr, std::vector>, std::shared_ptr>()) - .def("SetStoppingCondition",&InjectorBase::SetStoppingCondition) - .def("SetPrimaryProcess",&InjectorBase::SetPrimaryProcess) - .def("AddSecondaryProcess",&InjectorBase::AddSecondaryProcess) - .def("GetPrimaryProcess",&InjectorBase::GetPrimaryProcess) - .def("GetSecondaryProcesses",&InjectorBase::GetSecondaryProcesses) - .def("GetSecondaryProcessMap",&InjectorBase::GetSecondaryProcessMap) - .def("NewRecord",&InjectorBase::NewRecord) - .def("SetRandom",&InjectorBase::SetRandom) - .def("GenerateEvent",&InjectorBase::GenerateEvent) - .def("DensityVariables",&InjectorBase::DensityVariables) - .def("Name",&InjectorBase::Name) - .def("GetInjectionDistributions",&InjectorBase::GetInjectionDistributions) - .def("GetEarthModel",&InjectorBase::GetEarthModel) - .def("GetCrossSections",&InjectorBase::GetCrossSections) - .def("InjectedEvents",&InjectorBase::InjectedEvents) - .def("EventsToInject",&InjectorBase::EventsToInject); - - class_, InjectorBase>(m, "RangedLeptonInjector") - .def(init, std::shared_ptr, std::vector>, std::shared_ptr, std::shared_ptr, double, double>()) + class_>(m, "Injector") + .def(init, std::shared_ptr>()) + .def(init, std::shared_ptr, std::shared_ptr>()) + .def(init, std::shared_ptr, std::vector>, std::shared_ptr>()) + .def("SetStoppingCondition",&Injector::SetStoppingCondition) + .def("SetPrimaryProcess",&Injector::SetPrimaryProcess) + .def("AddSecondaryProcess",&Injector::AddSecondaryProcess) + .def("GetPrimaryProcess",&Injector::GetPrimaryProcess) + .def("GetSecondaryProcesses",&Injector::GetSecondaryProcesses) + .def("GetSecondaryProcessMap",&Injector::GetSecondaryProcessMap) + .def("NewRecord",&Injector::NewRecord) + .def("SetRandom",&Injector::SetRandom) + .def("GenerateEvent",&Injector::GenerateEvent) + .def("DensityVariables",&Injector::DensityVariables) + .def("Name",&Injector::Name) + .def("GetInjectionDistributions",&Injector::GetInjectionDistributions) + .def("GetDetectorModel",&Injector::GetDetectorModel) + .def("GetInteractions",&Injector::GetInteractions) + .def("InjectedEvents",&Injector::InjectedEvents) + .def("EventsToInject",&Injector::EventsToInject); + + class_, Injector>(m, "RangedLeptonInjector") + .def(init, std::shared_ptr, std::vector>, std::shared_ptr, std::shared_ptr, double, double>()) .def("Name",&RangedLeptonInjector::Name); - class_, InjectorBase>(m, "DecayRangeLeptonInjector") - .def(init, std::shared_ptr, std::vector>, std::shared_ptr, std::shared_ptr, double, double>()) + class_, Injector>(m, "DecayRangeLeptonInjector") + .def(init, std::shared_ptr, std::vector>, std::shared_ptr, std::shared_ptr, double, double>()) .def("Name",&DecayRangeLeptonInjector::Name); - class_, InjectorBase>(m, "ColumnDepthLeptonInjector") - .def(init, std::shared_ptr, std::vector>, std::shared_ptr, std::shared_ptr, double, double>()) + class_, Injector>(m, "ColumnDepthLeptonInjector") + .def(init, std::shared_ptr, std::vector>, std::shared_ptr, std::shared_ptr, double, double>()) .def("Name",&ColumnDepthLeptonInjector::Name) .def("InjectionBounds",&ColumnDepthLeptonInjector::InjectionBounds); - class_, InjectorBase>(m, "CylinderVolumeLeptonInjector") - .def(init, std::shared_ptr, std::vector>, std::shared_ptr, LI::geometry::Cylinder>()) + class_, Injector>(m, "CylinderVolumeLeptonInjector") + .def(init, std::shared_ptr, std::vector>, std::shared_ptr, LI::geometry::Cylinder>()) .def("Name",&CylinderVolumeLeptonInjector::Name); // Weighter classes class_>(m, "LeptonProcessWeighter") - .def(init, std::shared_ptr, std::shared_ptr>()) + .def(init, std::shared_ptr, std::shared_ptr>()) .def("InteractionProbability",&LeptonProcessWeighter::InteractionProbability) .def("NormalizedPositionProbability",&LeptonProcessWeighter::NormalizedPositionProbability) .def("PhysicalProbability",&LeptonProcessWeighter::PhysicalProbability) @@ -98,12 +98,12 @@ PYBIND11_MODULE(injection,m) { .def("EventWeight",&LeptonProcessWeighter::EventWeight); class_>(m, "LeptonTreeWeighter") - .def(init>, std::shared_ptr, std::shared_ptr, std::vector>>()) - .def(init>, std::shared_ptr, std::shared_ptr>()) + .def(init>, std::shared_ptr, std::shared_ptr, std::vector>>()) + .def(init>, std::shared_ptr, std::shared_ptr>()) .def("EventWeight",&LeptonTreeWeighter::EventWeight); class_>(m, "LeptonWeighter") - .def(init>, std::shared_ptr, std::shared_ptr, std::vector>>()) + .def(init>, std::shared_ptr, std::shared_ptr, std::vector>>()) .def("EventWeight",&LeptonWeighter::EventWeight) .def("SimplifiedEventWeight",&LeptonWeighter::SimplifiedEventWeight); diff --git a/projects/injection/private/test/CCM_HNL_TEST.cxx b/projects/injection/private/test/CCM_HNL_TEST.cxx index f117356d..75bb95bb 100644 --- a/projects/injection/private/test/CCM_HNL_TEST.cxx +++ b/projects/injection/private/test/CCM_HNL_TEST.cxx @@ -10,12 +10,12 @@ #include -#include "LeptonInjector/crosssections/CrossSection.h" +#include "LeptonInjector/interactions/CrossSection.h" #include "LeptonInjector/utilities/Random.h" #include "LeptonInjector/utilities/Constants.h" #include "LeptonInjector/dataclasses/Particle.h" -#include "LeptonInjector/injection/InjectorBase.h" +#include "LeptonInjector/injection/Injector.h" #include "LeptonInjector/injection/Process.h" #include "LeptonInjector/injection/RangedLeptonInjector.h" #include "LeptonInjector/injection/TreeWeighter.h" @@ -33,18 +33,18 @@ #include "LeptonInjector/distributions/primary/helicity/PrimaryNeutrinoHelicityDistribution.h" #include "LeptonInjector/distributions/target/momentum/TargetMomentumDistribution.h" -#include "LeptonInjector/crosssections/CrossSectionCollection.h" -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/DipoleFromTable.h" -#include "LeptonInjector/crosssections/Decay.h" -#include "LeptonInjector/crosssections/NeutrissimoDecay.h" +#include "LeptonInjector/interactions/InteractionCollection.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/DipoleFromTable.h" +#include "LeptonInjector/interactions/Decay.h" +#include "LeptonInjector/interactions/NeutrissimoDecay.h" using namespace LI::math; using namespace LI::geometry; using namespace LI::detector; using namespace LI::injection; using namespace LI::dataclasses; -using namespace LI::crosssections; +using namespace LI::interactions; using namespace LI::utilities; using namespace LI::distributions; @@ -167,11 +167,11 @@ TEST(Injector, Generation) // Load the earth model - std::shared_ptr earth_model = std::make_shared(); + std::shared_ptr earth_model = std::make_shared(); std::cout << "Loading MaterialModel...\n"; earth_model->LoadMaterialModel(material_file); - std::cout << "Loading EarthModel...\n"; - earth_model->LoadEarthModel(earth_file); + std::cout << "Loading DetectorModel...\n"; + earth_model->LoadDetectorModel(earth_file); // random class instance std::shared_ptr random = std::make_shared(); @@ -215,11 +215,11 @@ TEST(Injector, Generation) std::cout << "GotCrossSections!\n"; - std::shared_ptr primary_cross_sections = std::make_shared(primary_type, cross_sections); - primary_injection_process_upper_injector->SetCrossSections(primary_cross_sections); - primary_injection_process_lower_injector->SetCrossSections(primary_cross_sections); - primary_physical_process_upper_injector->SetCrossSections(primary_cross_sections); - primary_physical_process_lower_injector->SetCrossSections(primary_cross_sections); + std::shared_ptr primary_interactions = std::make_shared(primary_type, cross_sections); + primary_injection_process_upper_injector->SetInteractions(primary_interactions); + primary_injection_process_lower_injector->SetInteractions(primary_interactions); + primary_physical_process_upper_injector->SetInteractions(primary_interactions); + primary_physical_process_lower_injector->SetInteractions(primary_interactions); // Primary energy distribution: pion decay-at-rest double nu_energy = 0.02965; @@ -267,8 +267,8 @@ TEST(Injector, Generation) // Primary position distribution: treat targets as point sources, generate from center double max_dist = 25; // m - std::shared_ptr upper_pos_dist = std::make_shared(upper_target_origin, max_dist, primary_cross_sections->TargetTypes()); - std::shared_ptr lower_pos_dist = std::make_shared(lower_target_origin, max_dist, primary_cross_sections->TargetTypes()); + std::shared_ptr upper_pos_dist = std::make_shared(upper_target_origin, max_dist, primary_interactions->TargetTypes()); + std::shared_ptr lower_pos_dist = std::make_shared(lower_target_origin, max_dist, primary_interactions->TargetTypes()); primary_injection_process_upper_injector->AddInjectionDistribution(upper_pos_dist); primary_injection_process_lower_injector->AddInjectionDistribution(lower_pos_dist); //primary_physical_process_upper_injector->AddPhysicalDistribution(upper_pos_dist); @@ -284,9 +284,9 @@ TEST(Injector, Generation) // Assume dirac HNL for now std::shared_ptr sec_decay = std::make_shared(hnl_mass, dipole_coupling_vec, NeutrissimoDecay::ChiralNature::Majorana); std::vector> sec_decays = {sec_decay}; - std::shared_ptr secondary_cross_sections = std::make_shared(ParticleType::NuF4, sec_decays); - secondary_decay_inj_process->GetCrossSections() = secondary_cross_sections; - secondary_decay_phys_process->GetCrossSections() = secondary_cross_sections; + std::shared_ptr secondary_interactions = std::make_shared(ParticleType::NuF4, sec_decays); + secondary_decay_inj_process->SetInteractions(secondary_interactions); + secondary_decay_phys_process->SetInteractions(secondary_interactions); // Secondary physical distribution std::shared_ptr fid_vol = NULL; @@ -300,8 +300,8 @@ TEST(Injector, Generation) secondary_physical_processes.push_back(secondary_decay_phys_process); // Put it all together! - std::shared_ptr upper_injector = std::make_shared(events_to_inject, earth_model, primary_injection_process_upper_injector, secondary_injection_processes, random); - std::shared_ptr lower_injector = std::make_shared(events_to_inject, earth_model, primary_injection_process_lower_injector, secondary_injection_processes, random); + std::shared_ptr upper_injector = std::make_shared(events_to_inject, earth_model, primary_injection_process_upper_injector, secondary_injection_processes, random); + std::shared_ptr lower_injector = std::make_shared(events_to_inject, earth_model, primary_injection_process_lower_injector, secondary_injection_processes, random); // Set stopping condition std::function)> stopping_condition = @@ -312,8 +312,8 @@ TEST(Injector, Generation) upper_injector->SetStoppingCondition(stopping_condition); lower_injector->SetStoppingCondition(stopping_condition); - std::shared_ptr upper_weighter = std::make_shared(std::vector>{upper_injector}, earth_model, primary_physical_process_upper_injector, secondary_physical_processes); - std::shared_ptr lower_weighter = std::make_shared(std::vector>{lower_injector}, earth_model, primary_physical_process_lower_injector, secondary_physical_processes); + std::shared_ptr upper_weighter = std::make_shared(std::vector>{upper_injector}, earth_model, primary_physical_process_upper_injector, secondary_physical_processes); + std::shared_ptr lower_weighter = std::make_shared(std::vector>{lower_injector}, earth_model, primary_physical_process_lower_injector, secondary_physical_processes); int i = 0; diff --git a/projects/injection/private/test/Injector_TEST.cxx b/projects/injection/private/test/Injector_TEST.cxx index 3e994e15..5676578f 100644 --- a/projects/injection/private/test/Injector_TEST.cxx +++ b/projects/injection/private/test/Injector_TEST.cxx @@ -10,12 +10,12 @@ #include -#include "LeptonInjector/crosssections/CrossSection.h" +#include "LeptonInjector/interactions/CrossSection.h" #include "LeptonInjector/utilities/Random.h" #include "LeptonInjector/utilities/Constants.h" #include "LeptonInjector/dataclasses/Particle.h" -#include "LeptonInjector/injection/InjectorBase.h" +#include "LeptonInjector/injection/Injector.h" #include "LeptonInjector/injection/RangedLeptonInjector.h" #include "LeptonInjector/injection/Weighter.h" #include "LeptonInjector/geometry/Geometry.h" @@ -31,9 +31,9 @@ #include "LeptonInjector/distributions/primary/vertex/RangeFunction.h" #include "LeptonInjector/distributions/primary/vertex/DecayRangeFunction.h" -#include "LeptonInjector/crosssections/CrossSectionCollection.h" -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/DipoleFromTable.h" +#include "LeptonInjector/interactions/InteractionCollection.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/DipoleFromTable.h" #define AUSTIN @@ -42,7 +42,7 @@ using namespace LI::geometry; using namespace LI::detector; using namespace LI::injection; using namespace LI::dataclasses; -using namespace LI::crosssections; +using namespace LI::interactions; using namespace LI::utilities; using namespace LI::distributions; @@ -156,7 +156,7 @@ bool inFiducial(std::array & int_vtx, Sphere & fidVol) { return fidVol.IsInside(pos,dir); } -double ComputeInteractionLengths(std::shared_ptr earth_model, std::shared_ptr cross_sections, std::pair const & bounds, InteractionRecord const & record) { +double ComputeInteractionLengths(std::shared_ptr earth_model, std::shared_ptr interactions, std::pair const & bounds, InteractionRecord const & record) { Vector3D interaction_vertex = record.interaction_vertex; Vector3D direction( record.primary_momentum[1], @@ -165,7 +165,7 @@ double ComputeInteractionLengths(std::shared_ptr earth_model, direction.normalize(); Geometry::IntersectionList intersections = earth_model->GetIntersections(earth_model->GetEarthCoordPosFromDetCoordPos(interaction_vertex), direction); - std::map>> const & cross_sections_by_target = cross_sections->GetCrossSectionsByTarget(); + std::map>> const & cross_sections_by_target = interactions->GetCrossSectionsByTarget(); std::vector total_cross_sections; std::vector targets; InteractionRecord fake_record = record; @@ -275,9 +275,9 @@ TEST(Injector, Generation) cross_sections.push_back(hc_xs); // Load the earth model - std::shared_ptr earth_model = std::make_shared(); + std::shared_ptr earth_model = std::make_shared(); earth_model->LoadMaterialModel(material_file); - earth_model->LoadEarthModel(earth_file); + earth_model->LoadDetectorModel(earth_file); // Setup the primary type and mass //std::shared_ptr primary_injector = std::make_shared(primary_type, hnl_mass); @@ -315,7 +315,7 @@ TEST(Injector, Generation) // Put it all together! //RangedLeptonInjector injector(events_to_inject, primary_type, cross_sections, earth_model, random, edist, ddist, target_momentum_distribution, range_func, disk_radius, endcap_length); - std::shared_ptr injector = std::make_shared(events_to_inject, primary_injector, cross_sections, earth_model, random, edist, ddist, target_momentum_distribution, range_func, disk_radius, endcap_length, helicity_distribution); + std::shared_ptr injector = std::make_shared(events_to_inject, primary_injector, cross_sections, earth_model, random, edist, ddist, target_momentum_distribution, range_func, disk_radius, endcap_length, helicity_distribution); std::vector> physical_distributions = { std::shared_ptr(tab_pdf), @@ -325,7 +325,7 @@ TEST(Injector, Generation) std::shared_ptr(helicity_distribution) }; - LeptonWeighter weighter(std::vector>{injector}, earth_model, injector->GetCrossSections(), physical_distributions); + LeptonWeighter weighter(std::vector>{injector}, earth_model, injector->GetInteractions(), physical_distributions); std::vector> poly; // MINERvA Fiducial Volume @@ -389,7 +389,7 @@ TEST(Injector, Generation) injector->SamplePairProduction(decay, pair_prod); //basic_weight = weighter.EventWeight(event); simplified_weight = weighter.SimplifiedEventWeight(event); - interaction_lengths = ComputeInteractionLengths(earth_model, injector->GetCrossSections(), injector->InjectionBounds(event), event); + interaction_lengths = ComputeInteractionLengths(earth_model, injector->GetInteractions(), injector->InjectionBounds(event), event); interaction_prob = weighter.InteractionProbability(injector->InjectionBounds(event), event); } if(event.secondary_momenta.size() > 0) { diff --git a/projects/injection/public/LeptonInjector/injection/ColumnDepthLeptonInjector.h b/projects/injection/public/LeptonInjector/injection/ColumnDepthLeptonInjector.h index fa63e976..e502432b 100644 --- a/projects/injection/public/LeptonInjector/injection/ColumnDepthLeptonInjector.h +++ b/projects/injection/public/LeptonInjector/injection/ColumnDepthLeptonInjector.h @@ -20,14 +20,14 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/Decay.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/Decay.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/distributions/primary/vertex/ColumnDepthPositionDistribution.h" #include "LeptonInjector/distributions/primary/vertex/DepthFunction.h" -#include "LeptonInjector/injection/InjectorBase.h" // for InjectorBase +#include "LeptonInjector/injection/Injector.h" // for Injector -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } namespace LI { namespace injection { class InjectionProcess; } } namespace LI { namespace math { class Vector3D; } } @@ -36,17 +36,17 @@ namespace LI { namespace utilities { class LI_random; } } namespace LI { namespace injection { -class ColumnDepthLeptonInjector : public InjectorBase { +class ColumnDepthLeptonInjector : public Injector { friend cereal::access; protected: std::shared_ptr depth_func; double disk_radius; double endcap_length; std::shared_ptr position_distribution; - std::shared_ptr cross_sections; + std::shared_ptr interactions; ColumnDepthLeptonInjector(); public: - ColumnDepthLeptonInjector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, std::shared_ptr depth_func, double disk_radius, double endcap_length); + ColumnDepthLeptonInjector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, std::shared_ptr depth_func, double disk_radius, double endcap_length); std::string Name() const override; virtual std::pair InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const override; @@ -57,7 +57,7 @@ friend cereal::access; archive(::cereal::make_nvp("DiskRadius", disk_radius)); archive(::cereal::make_nvp("EndcapLength", endcap_length)); archive(::cereal::make_nvp("PositionDistribution", position_distribution)); - archive(cereal::virtual_base_class(this)); + archive(cereal::virtual_base_class(this)); } else { throw std::runtime_error("ColumnDepthLeptonInjector only supports version <= 0!"); } @@ -70,7 +70,7 @@ friend cereal::access; archive(::cereal::make_nvp("DiskRadius", disk_radius)); archive(::cereal::make_nvp("EndcapLength", endcap_length)); archive(::cereal::make_nvp("PositionDistribution", position_distribution)); - archive(cereal::virtual_base_class(this)); + archive(cereal::virtual_base_class(this)); } else { throw std::runtime_error("ColumnDepthLeptonInjector only supports version <= 0!"); } @@ -82,6 +82,6 @@ friend cereal::access; CEREAL_CLASS_VERSION(LI::injection::ColumnDepthLeptonInjector, 0); CEREAL_REGISTER_TYPE(LI::injection::ColumnDepthLeptonInjector); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::injection::InjectorBase, LI::injection::ColumnDepthLeptonInjector); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::injection::Injector, LI::injection::ColumnDepthLeptonInjector); #endif // LI_ColumnDepthLeptonInjector_H diff --git a/projects/injection/public/LeptonInjector/injection/CylinderVolumeLeptonInjector.h b/projects/injection/public/LeptonInjector/injection/CylinderVolumeLeptonInjector.h index c8961ef6..501c758f 100644 --- a/projects/injection/public/LeptonInjector/injection/CylinderVolumeLeptonInjector.h +++ b/projects/injection/public/LeptonInjector/injection/CylinderVolumeLeptonInjector.h @@ -20,13 +20,13 @@ #include #include -#include "LeptonInjector/crosssections/CrossSectionCollection.h" -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/Decay.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/interactions/InteractionCollection.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/Decay.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/distributions/primary/vertex/CylinderVolumePositionDistribution.h" #include "LeptonInjector/geometry/Cylinder.h" // for Cylinder -#include "LeptonInjector/injection/InjectorBase.h" // for InjectorBase +#include "LeptonInjector/injection/Injector.h" // for Injector namespace LI { namespace dataclasses { struct InteractionRecord; } } namespace LI { namespace injection { class InjectionProcess; } } @@ -44,21 +44,21 @@ class LI_random; namespace injection { -class CylinderVolumeLeptonInjector : public InjectorBase { +class CylinderVolumeLeptonInjector : public Injector { friend cereal::access; protected: std::shared_ptr position_distribution; - std::shared_ptr cross_sections; + std::shared_ptr interactions; CylinderVolumeLeptonInjector(); public: - CylinderVolumeLeptonInjector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, LI::geometry::Cylinder cylinder); + CylinderVolumeLeptonInjector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, LI::geometry::Cylinder cylinder); std::string Name() const override; virtual std::pair InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const override; template void save(Archive & archive, std::uint32_t const version) const { if(version == 0) { archive(::cereal::make_nvp("PositionDistribution", position_distribution)); - archive(cereal::virtual_base_class(this)); + archive(cereal::virtual_base_class(this)); } else { throw std::runtime_error("CylinderVolumeLeptonInjector only supports version <= 0!"); } @@ -68,7 +68,7 @@ friend cereal::access; void load(Archive & archive, std::uint32_t const version) { if(version == 0) { archive(::cereal::make_nvp("PositionDistribution", position_distribution)); - archive(cereal::virtual_base_class(this)); + archive(cereal::virtual_base_class(this)); } else { throw std::runtime_error("CylinderVolumeLeptonInjector only supports version <= 0!"); } @@ -81,6 +81,6 @@ friend cereal::access; CEREAL_CLASS_VERSION(LI::injection::CylinderVolumeLeptonInjector, 0); CEREAL_REGISTER_TYPE(LI::injection::CylinderVolumeLeptonInjector); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::injection::InjectorBase, LI::injection::CylinderVolumeLeptonInjector); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::injection::Injector, LI::injection::CylinderVolumeLeptonInjector); #endif // LI_CylinderVolumeLeptonInjector_H diff --git a/projects/injection/public/LeptonInjector/injection/DecayRangeLeptonInjector.h b/projects/injection/public/LeptonInjector/injection/DecayRangeLeptonInjector.h index f13b42d7..9a6fe498 100644 --- a/projects/injection/public/LeptonInjector/injection/DecayRangeLeptonInjector.h +++ b/projects/injection/public/LeptonInjector/injection/DecayRangeLeptonInjector.h @@ -20,13 +20,13 @@ #include #include -#include "LeptonInjector/crosssections/CrossSectionCollection.h" -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/Decay.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/interactions/InteractionCollection.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/Decay.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/distributions/primary/vertex/DecayRangeFunction.h" #include "LeptonInjector/distributions/primary/vertex/DecayRangePositionDistribution.h" -#include "LeptonInjector/injection/InjectorBase.h" // for InjectorBase +#include "LeptonInjector/injection/Injector.h" // for Injector namespace LI { namespace dataclasses { struct InteractionRecord; } } namespace LI { namespace injection { class InjectionProcess; } } @@ -36,17 +36,17 @@ namespace LI { namespace utilities { class LI_random; } } namespace LI { namespace injection { -class DecayRangeLeptonInjector : public InjectorBase { +class DecayRangeLeptonInjector : public Injector { friend cereal::access; protected: std::shared_ptr range_func; double disk_radius; double endcap_length; std::shared_ptr position_distribution; - std::shared_ptr cross_sections; + std::shared_ptr interactions; DecayRangeLeptonInjector(); public: - DecayRangeLeptonInjector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, std::shared_ptr range_func, double disk_radius, double endcap_length); + DecayRangeLeptonInjector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, std::shared_ptr range_func, double disk_radius, double endcap_length); std::string Name() const override; virtual std::pair InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const override; template @@ -56,7 +56,7 @@ friend cereal::access; archive(::cereal::make_nvp("DiskRadius", disk_radius)); archive(::cereal::make_nvp("EndcapLength", endcap_length)); archive(::cereal::make_nvp("PositionDistribution", position_distribution)); - archive(cereal::virtual_base_class(this)); + archive(cereal::virtual_base_class(this)); } else { throw std::runtime_error("DecayRangeLeptonInjector only supports version <= 0!"); } @@ -69,7 +69,7 @@ friend cereal::access; archive(::cereal::make_nvp("DiskRadius", disk_radius)); archive(::cereal::make_nvp("EndcapLength", endcap_length)); archive(::cereal::make_nvp("PositionDistribution", position_distribution)); - archive(cereal::virtual_base_class(this)); + archive(cereal::virtual_base_class(this)); } else { throw std::runtime_error("DecayRangeLeptonInjector only supports version <= 0!"); } @@ -81,6 +81,6 @@ friend cereal::access; CEREAL_CLASS_VERSION(LI::injection::DecayRangeLeptonInjector, 0); CEREAL_REGISTER_TYPE(LI::injection::DecayRangeLeptonInjector); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::injection::InjectorBase, LI::injection::DecayRangeLeptonInjector); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::injection::Injector, LI::injection::DecayRangeLeptonInjector); #endif // LI_DecayRangeLeptonInjector_H diff --git a/projects/injection/public/LeptonInjector/injection/InjectorBase.h b/projects/injection/public/LeptonInjector/injection/Injector.h similarity index 81% rename from projects/injection/public/LeptonInjector/injection/InjectorBase.h rename to projects/injection/public/LeptonInjector/injection/Injector.h index db0fb6e5..e645eda4 100644 --- a/projects/injection/public/LeptonInjector/injection/InjectorBase.h +++ b/projects/injection/public/LeptonInjector/injection/Injector.h @@ -30,9 +30,9 @@ #include "LeptonInjector/dataclasses/InteractionTree.h" // for Interactio... #include "LeptonInjector/dataclasses/Particle.h" // for Particle -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct DecayRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class VertexPositionDistribution; } } namespace LI { namespace geometry { class Geometry; } } @@ -43,18 +43,18 @@ namespace LI { namespace utilities { class LI_random; } } namespace LI { namespace injection { -class InjectorBase { +class Injector { friend cereal::access; public: - virtual ~InjectorBase() {}; + virtual ~Injector() {}; protected: unsigned int events_to_inject = 0; unsigned int injected_events = 0; std::shared_ptr random; - std::shared_ptr earth_model; + std::shared_ptr earth_model; // This funciton returns true if the given datum is the last entry to be saved in a tree std::function)> stopping_condition; - InjectorBase(); + Injector(); private: std::shared_ptr primary_process; std::shared_ptr primary_position_distribution; @@ -64,9 +64,9 @@ friend cereal::access; std::map> secondary_position_distribution_map; public: // Constructors - InjectorBase(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr random); - InjectorBase(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::shared_ptr random); - InjectorBase(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random); + Injector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr random); + Injector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::shared_ptr random); + Injector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random); void SetStoppingCondition(std::function)> f_in) {stopping_condition = f_in;} std::shared_ptr FindPositionDistribution(std::shared_ptr process); @@ -79,7 +79,7 @@ friend cereal::access; void SetRandom(std::shared_ptr random); virtual void SampleCrossSection(LI::dataclasses::InteractionRecord & record) const; virtual void SampleCrossSection(LI::dataclasses::InteractionRecord & record, - std::shared_ptr cross_sections) const; + std::shared_ptr interactions) const; virtual void SampleNeutrissimoDecay(LI::dataclasses::InteractionRecord const & interaction, LI::dataclasses::DecayRecord & decay, double width, double alpha_gen, double alpha_phys, LI::geometry::Geometry *fiducial, double buffer) const; virtual void SamplePairProduction(LI::dataclasses::DecayRecord const & decay, LI::dataclasses::InteractionRecord & pairprod) const; bool SampleSecondaryProcess(unsigned int idx, @@ -95,8 +95,8 @@ friend cereal::access; virtual std::pair InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const; virtual std::pair InjectionBounds(LI::dataclasses::InteractionTreeDatum const & datum, LI::dataclasses::Particle::ParticleType const & primary_type) const; virtual std::vector> GetInjectionDistributions() const; - virtual std::shared_ptr GetEarthModel() const; - virtual std::shared_ptr GetCrossSections() const; + virtual std::shared_ptr GetDetectorModel() const; + virtual std::shared_ptr GetInteractions() const; unsigned int InjectedEvents() const; unsigned int EventsToInject() const; operator bool() const; @@ -107,11 +107,11 @@ friend cereal::access; archive(::cereal::make_nvp("EventsToInject", events_to_inject)); archive(::cereal::make_nvp("InjectedEvents", injected_events)); //archive(::cereal::make_nvp("StoppingCondition", stopping_condition)); - archive(::cereal::make_nvp("EarthModel", earth_model)); + archive(::cereal::make_nvp("DetectorModel", earth_model)); archive(::cereal::make_nvp("PrimaryProcess", primary_process)); archive(::cereal::make_nvp("SecondaryProcesses", secondary_processes)); } else { - throw std::runtime_error("InjectorBase only supports version <= 0!"); + throw std::runtime_error("Injector only supports version <= 0!"); } } @@ -121,11 +121,11 @@ friend cereal::access; archive(::cereal::make_nvp("EventsToInject", events_to_inject)); archive(::cereal::make_nvp("InjectedEvents", injected_events)); //archive(::cereal::make_nvp("StoppingCondition", stopping_condition)); - archive(::cereal::make_nvp("EarthModel", earth_model)); + archive(::cereal::make_nvp("DetectorModel", earth_model)); archive(::cereal::make_nvp("PrimaryProcess", primary_process)); archive(::cereal::make_nvp("SecondaryProcesses", secondary_processes)); } else { - throw std::runtime_error("InjectorBase only supports version <= 0!"); + throw std::runtime_error("Injector only supports version <= 0!"); } } }; @@ -133,7 +133,7 @@ friend cereal::access; } // namespace injection } // namespace LI -CEREAL_CLASS_VERSION(LI::injection::InjectorBase, 0); +CEREAL_CLASS_VERSION(LI::injection::Injector, 0); #endif // LI_LeptonInjector_H diff --git a/projects/injection/public/LeptonInjector/injection/Process.h b/projects/injection/public/LeptonInjector/injection/Process.h index 99de1715..1628e4ae 100644 --- a/projects/injection/public/LeptonInjector/injection/Process.h +++ b/projects/injection/public/LeptonInjector/injection/Process.h @@ -19,7 +19,7 @@ #include "LeptonInjector/dataclasses/Particle.h" // for Particle #include "LeptonInjector/distributions/Distributions.h" // for InjectionDis... -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace injection { @@ -27,18 +27,18 @@ namespace injection { class Process { private: LI::dataclasses::Particle::ParticleType primary_type; - std::shared_ptr cross_sections; + std::shared_ptr interactions; public: Process() = default; - Process(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _cross_sections); + Process(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _interactions); Process(Process const & other); Process(Process && other); Process & operator=(Process const & other); Process & operator=(Process && other); virtual ~Process() = default; - void SetCrossSections(std::shared_ptr _cross_sections); - std::shared_ptr GetCrossSections() const; + void SetInteractions(std::shared_ptr _interactions); + std::shared_ptr GetInteractions() const; void SetPrimaryType(LI::dataclasses::Particle::ParticleType _primary_type); LI::dataclasses::Particle::ParticleType GetPrimaryType() const; @@ -48,7 +48,7 @@ class Process { void serialize(Archive & archive, std::uint32_t const version) { if(version == 0) { archive(::cereal::make_nvp("PrimaryType", primary_type)); - archive(::cereal::make_nvp("CrossSections", cross_sections)); + archive(::cereal::make_nvp("Interactions", interactions)); } else { throw std::runtime_error("Process only supports version <= 0!"); } @@ -60,7 +60,7 @@ class PhysicalProcess : public Process { std::vector> physical_distributions; public: PhysicalProcess() = default; - PhysicalProcess(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _cross_sections); + PhysicalProcess(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _interactions); PhysicalProcess(PhysicalProcess const & other); PhysicalProcess(PhysicalProcess && other); PhysicalProcess & operator=(PhysicalProcess const & other); @@ -84,7 +84,7 @@ class InjectionProcess : public PhysicalProcess { std::vector> injection_distributions; public: InjectionProcess() = default; - InjectionProcess(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _cross_sections); + InjectionProcess(LI::dataclasses::Particle::ParticleType _primary_type, std::shared_ptr _interactions); InjectionProcess(InjectionProcess const & other); InjectionProcess(InjectionProcess && other); InjectionProcess & operator=(InjectionProcess const & other); diff --git a/projects/injection/public/LeptonInjector/injection/RangedLeptonInjector.h b/projects/injection/public/LeptonInjector/injection/RangedLeptonInjector.h index 4c550bd3..d17d1659 100644 --- a/projects/injection/public/LeptonInjector/injection/RangedLeptonInjector.h +++ b/projects/injection/public/LeptonInjector/injection/RangedLeptonInjector.h @@ -18,13 +18,13 @@ #include #include -#include "LeptonInjector/crosssections/CrossSectionCollection.h" -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/Decay.h" -#include "LeptonInjector/detector/EarthModel.h" +#include "LeptonInjector/interactions/InteractionCollection.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/Decay.h" +#include "LeptonInjector/detector/DetectorModel.h" #include "LeptonInjector/distributions/primary/vertex/RangeFunction.h" #include "LeptonInjector/distributions/primary/vertex/RangePositionDistribution.h" -#include "LeptonInjector/injection/InjectorBase.h" // for InjectorBase +#include "LeptonInjector/injection/Injector.h" // for Injector namespace LI { namespace dataclasses { struct InteractionRecord; } } namespace LI { namespace injection { class InjectionProcess; } } @@ -34,17 +34,17 @@ namespace LI { namespace utilities { class LI_random; } } namespace LI { namespace injection { -class RangedLeptonInjector : public InjectorBase { +class RangedLeptonInjector : public Injector { friend cereal::access; protected: std::shared_ptr range_func; double disk_radius; double endcap_length; std::shared_ptr position_distribution; - std::shared_ptr cross_sections; + std::shared_ptr interactions; RangedLeptonInjector(); public: - RangedLeptonInjector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, std::shared_ptr range_func, double disk_radius, double endcap_length); + RangedLeptonInjector(unsigned int events_to_inject, std::shared_ptr earth_model, std::shared_ptr primary_process, std::vector> secondary_processes, std::shared_ptr random, std::shared_ptr range_func, double disk_radius, double endcap_length); std::string Name() const override; virtual std::pair InjectionBounds(LI::dataclasses::InteractionRecord const & interaction) const override; @@ -55,7 +55,7 @@ friend cereal::access; archive(::cereal::make_nvp("DiskRadius", disk_radius)); archive(::cereal::make_nvp("EndcapLength", endcap_length)); archive(::cereal::make_nvp("PositionDistribution", position_distribution)); - archive(cereal::virtual_base_class(this)); + archive(cereal::virtual_base_class(this)); } else { throw std::runtime_error("RangedLeptonInjector only supports version <= 0!"); } @@ -68,7 +68,7 @@ friend cereal::access; archive(::cereal::make_nvp("DiskRadius", disk_radius)); archive(::cereal::make_nvp("EndcapLength", endcap_length)); archive(::cereal::make_nvp("PositionDistribution", position_distribution)); - archive(cereal::virtual_base_class(this)); + archive(cereal::virtual_base_class(this)); } else { throw std::runtime_error("RangedLeptonInjector only supports version <= 0!"); } @@ -80,6 +80,6 @@ friend cereal::access; CEREAL_CLASS_VERSION(LI::injection::RangedLeptonInjector, 0); CEREAL_REGISTER_TYPE(LI::injection::RangedLeptonInjector); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::injection::InjectorBase, LI::injection::RangedLeptonInjector); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::injection::Injector, LI::injection::RangedLeptonInjector); #endif // LI_RangedLeptonInjector_H diff --git a/projects/injection/public/LeptonInjector/injection/TreeWeighter.h b/projects/injection/public/LeptonInjector/injection/TreeWeighter.h index f0d37fdd..a156e394 100644 --- a/projects/injection/public/LeptonInjector/injection/TreeWeighter.h +++ b/projects/injection/public/LeptonInjector/injection/TreeWeighter.h @@ -19,10 +19,10 @@ #include "LeptonInjector/dataclasses/Particle.h" // for Particle namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class InjectionDistribution; } } namespace LI { namespace distributions { class WeightableDistribution; } } -namespace LI { namespace injection { class InjectorBase; } } +namespace LI { namespace injection { class Injector; } } namespace LI { namespace injection { class InjectionProcess; } } namespace LI { namespace injection { class PhysicalProcess; } } namespace LI { namespace math { class Vector3D; } } @@ -37,7 +37,7 @@ class LeptonProcessWeighter { std::shared_ptr inj_process; std::vector> unique_gen_distributions; std::vector> unique_phys_distributions; - std::shared_ptr earth_model; + std::shared_ptr earth_model; void Initialize(); double normalization; public: @@ -46,7 +46,7 @@ class LeptonProcessWeighter { double PhysicalProbability(std::pair const & bounds, LI::dataclasses::InteractionRecord const & record) const; double GenerationProbability(LI::dataclasses::InteractionTreeDatum const & datum) const; double EventWeight(std::pair const & bounds, LI::dataclasses::InteractionTreeDatum const & datum) const; - LeptonProcessWeighter(std::shared_ptr phys_process, std::shared_ptr inj_process, std::shared_ptr earth_model); + LeptonProcessWeighter(std::shared_ptr phys_process, std::shared_ptr inj_process, std::shared_ptr earth_model); }; // LeptonProcessWeighter @@ -55,8 +55,8 @@ class LeptonProcessWeighter { class LeptonTreeWeighter { private: // Supplied by constructor - std::vector> injectors; - std::shared_ptr earth_model; + std::vector> injectors; + std::shared_ptr earth_model; std::shared_ptr primary_physical_process; std::vector> secondary_physical_processes; @@ -72,8 +72,8 @@ class LeptonTreeWeighter { void Initialize(); public: double EventWeight(LI::dataclasses::InteractionTree const & tree) const; - LeptonTreeWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr primary_physical_process, std::vector> secondary_physical_processes); - LeptonTreeWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr primary_physical_process); + LeptonTreeWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr primary_physical_process, std::vector> secondary_physical_processes); + LeptonTreeWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr primary_physical_process); }; // LeptonTreeWeighter diff --git a/projects/injection/public/LeptonInjector/injection/Weighter.h b/projects/injection/public/LeptonInjector/injection/Weighter.h index a5c459ee..390827a7 100644 --- a/projects/injection/public/LeptonInjector/injection/Weighter.h +++ b/projects/injection/public/LeptonInjector/injection/Weighter.h @@ -15,11 +15,11 @@ #include #include -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace distributions { class WeightableDistribution; } } -namespace LI { namespace injection { class InjectorBase; } } +namespace LI { namespace injection { class Injector; } } namespace LI { namespace math { class Vector3D; } } namespace LI { @@ -27,19 +27,19 @@ namespace injection { class LeptonWeighter { private: - std::vector> injectors; - std::shared_ptr earth_model; + std::vector> injectors; + std::shared_ptr earth_model; //TODO Think about whether we want to pass a CrossSection collection, or a vector of cross sections - //TODO Think about what to do with multiple neutrino primary types. Do we want to support mutiple types across one CrossSectionCollection, across one InjectorBase, across one LeptonWeighter? - std::shared_ptr cross_sections; + //TODO Think about what to do with multiple neutrino primary types. Do we want to support mutiple types across one InteractionCollection, across one Injector, across one LeptonWeighter? + std::shared_ptr interactions; std::vector> physical_distributions; - std::vector, std::shared_ptr, std::shared_ptr>> unique_distributions; + std::vector, std::shared_ptr, std::shared_ptr>> unique_distributions; std::vector common_gen_idxs; std::vector common_phys_idxs; std::vector> distinct_gen_idxs_by_injector; std::vector> distinct_physical_idxs_by_injector; - std::vector, std::shared_ptr>> unique_contexts; + std::vector, std::shared_ptr>> unique_contexts; std::vector context_idx_by_injector; double normalization; @@ -49,14 +49,14 @@ class LeptonWeighter { public: //TODO Think about the relationship between interaction probability and the positional distribution. Check that the math works out //TODO Add versions of these functions that take precomputed intersections - double InteractionProbability(std::shared_ptr injector, LI::dataclasses::InteractionRecord const & record) const; + double InteractionProbability(std::shared_ptr injector, LI::dataclasses::InteractionRecord const & record) const; double InteractionProbability(std::pair bounds, LI::dataclasses::InteractionRecord const & record) const; - double UnnormalizedPositionProbability(std::shared_ptr injector, LI::dataclasses::InteractionRecord const & record) const; + double UnnormalizedPositionProbability(std::shared_ptr injector, LI::dataclasses::InteractionRecord const & record) const; double UnnormalizedPositionProbability(std::pair bounds, LI::dataclasses::InteractionRecord const & record) const; double NormalizedPositionProbability(std::pair bounds, LI::dataclasses::InteractionRecord const & record) const; //TODO Add a function to check that we have the right match up of variables between generator and physical distribution //TODO Figure out a way to check that physical and generation probabilities match, and ignore those when weighting - LeptonWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr cross_sections, std::vector> physical_distributions); + LeptonWeighter(std::vector> injectors, std::shared_ptr earth_model, std::shared_ptr interactions, std::vector> physical_distributions); double EventWeight(LI::dataclasses::InteractionRecord const & record) const; double SimplifiedEventWeight(LI::dataclasses::InteractionRecord const & record) const; }; diff --git a/projects/injection/public/LeptonInjector/injection/WeightingUtils.h b/projects/injection/public/LeptonInjector/injection/WeightingUtils.h index 3af6e665..abd21f38 100644 --- a/projects/injection/public/LeptonInjector/injection/WeightingUtils.h +++ b/projects/injection/public/LeptonInjector/injection/WeightingUtils.h @@ -4,14 +4,14 @@ #include // for shared_ptr -namespace LI { namespace crosssections { class CrossSectionCollection; } } +namespace LI { namespace interactions { class InteractionCollection; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } -namespace LI { namespace detector { class EarthModel; } } +namespace LI { namespace detector { class DetectorModel; } } namespace LI { namespace injection { -double CrossSectionProbability(std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionRecord const &); +double CrossSectionProbability(std::shared_ptr, std::shared_ptr, LI::dataclasses::InteractionRecord const &); } // namespace injection } // namespace LI diff --git a/projects/interactions/CMakeLists.txt b/projects/interactions/CMakeLists.txt new file mode 100644 index 00000000..483221c4 --- /dev/null +++ b/projects/interactions/CMakeLists.txt @@ -0,0 +1,55 @@ + +#core files +LIST (APPEND interactions_SOURCES + ${PROJECT_SOURCE_DIR}/projects/interactions/private/Decay.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/CrossSection.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/InteractionCollection.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/DipoleFromTable.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/DarkNewsCrossSection.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/DarkNewsDecay.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/NeutrissimoDecay.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/DISFromSpline.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/HNLFromSpline.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/ElasticScattering.cxx + ${PROJECT_SOURCE_DIR}/projects/interactions/private/DummyCrossSection.cxx +) +add_library(LI_interactions OBJECT ${interactions_SOURCES}) +set_property(TARGET LI_interactions PROPERTY POSITION_INDEPENDENT_CODE ON) +target_include_directories(LI_interactions PUBLIC + $ + $ +) + +target_link_libraries(LI_interactions + PRIVATE + $ + pybind11::embed + PUBLIC + photospline + LI_serialization + LI_utilities + LI_math + LI_dataclasses + LI_detector +) + +install(DIRECTORY "${PROJECT_SOURCE_DIR}/projects/interactions/public/" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.tcc" +) + +package_add_test(UnitTest_DISFromSpline ${PROJECT_SOURCE_DIR}/projects/interactions/private/test/DISFromSpline_TEST.cxx) +package_add_test(UnitTest_DipoleFromTable ${PROJECT_SOURCE_DIR}/projects/interactions/private/test/DipoleFromTable_TEST.cxx) +#package_add_test(UnitTest_ElasticScattering ${PROJECT_SOURCE_DIR}/projects/interactions/private/test/ElasticScattering_TEST.cxx) + +pybind11_add_module(interactions ${PROJECT_SOURCE_DIR}/projects/interactions/private/pybindings/interactions.cxx) +target_link_libraries(interactions PRIVATE LeptonInjector photospline rk_static pybind11::embed) +pybind11_add_module(pyDarkNewsSerializer ${PROJECT_SOURCE_DIR}/projects/interactions/private/pybindings/pyDarkNewsSerializer.cxx) +target_link_libraries(pyDarkNewsSerializer PRIVATE LeptonInjector photospline rk_static pybind11::embed) +if(DEFINED SKBUILD) +set_target_properties(interactions PROPERTIES + BUILD_WITH_INSTALL_RPATH FALSE + LINK_FLAGS "-Wl,-rpath,$ORIGIN/../leptoninjector.libs/") +endif() diff --git a/projects/crosssections/private/CrossSection.cxx b/projects/interactions/private/CrossSection.cxx similarity index 67% rename from projects/crosssections/private/CrossSection.cxx rename to projects/interactions/private/CrossSection.cxx index d548c559..9b94fc55 100644 --- a/projects/crosssections/private/CrossSection.cxx +++ b/projects/interactions/private/CrossSection.cxx @@ -1,7 +1,7 @@ -#include "LeptonInjector/crosssections/CrossSection.h" +#include "LeptonInjector/interactions/CrossSection.h" namespace LI { -namespace crosssections { +namespace interactions { CrossSection::CrossSection() {} @@ -12,6 +12,6 @@ bool CrossSection::operator==(CrossSection const & other) const { return this->equal(other); } -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/DISFromSpline.cxx b/projects/interactions/private/DISFromSpline.cxx similarity index 99% rename from projects/crosssections/private/DISFromSpline.cxx rename to projects/interactions/private/DISFromSpline.cxx index 95072b5f..67fe38c0 100644 --- a/projects/crosssections/private/DISFromSpline.cxx +++ b/projects/interactions/private/DISFromSpline.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/DISFromSpline.h" +#include "LeptonInjector/interactions/DISFromSpline.h" #include // for map, opera... #include // for set, opera... @@ -17,13 +17,13 @@ #include // for splinetable //#include -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSection +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSection #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interactio... #include "LeptonInjector/dataclasses/Particle.h" // for Particle #include "LeptonInjector/utilities/Random.h" // for LI_random namespace LI { -namespace crosssections { +namespace interactions { namespace { ///Check whether a given point in phase space is physically realizable. @@ -612,5 +612,5 @@ std::vector DISFromSpline::DensityVariables() const { return std::vector{"Bjorken x", "Bjorken y"}; } -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/DarkNewsCrossSection.cxx b/projects/interactions/private/DarkNewsCrossSection.cxx similarity index 98% rename from projects/crosssections/private/DarkNewsCrossSection.cxx rename to projects/interactions/private/DarkNewsCrossSection.cxx index 8b733527..67dc82dc 100644 --- a/projects/crosssections/private/DarkNewsCrossSection.cxx +++ b/projects/interactions/private/DarkNewsCrossSection.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/DarkNewsCrossSection.h" +#include "LeptonInjector/interactions/DarkNewsCrossSection.h" #include // for array #include // for sqrt, M_PI @@ -9,7 +9,7 @@ #include // for Vector3 #include // for P4, Boost -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSe... +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSe... #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interac... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac... #include "LeptonInjector/dataclasses/Particle.h" // for Particle @@ -17,7 +17,7 @@ #include "LeptonInjector/utilities/Errors.h" // for PythonImplementationError namespace LI { -namespace crosssections { +namespace interactions { DarkNewsCrossSection::DarkNewsCrossSection() {} @@ -285,5 +285,5 @@ std::vector DarkNewsCrossSection::DensityVariables() const { return std::vector{"Q2"}; } -} // namespace crosssections +} // namespace interactions } // namespace LI \ No newline at end of file diff --git a/projects/crosssections/private/DarkNewsDecay.cxx b/projects/interactions/private/DarkNewsDecay.cxx similarity index 95% rename from projects/crosssections/private/DarkNewsDecay.cxx rename to projects/interactions/private/DarkNewsDecay.cxx index 5718b674..fdf99bad 100644 --- a/projects/crosssections/private/DarkNewsDecay.cxx +++ b/projects/interactions/private/DarkNewsDecay.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/DarkNewsDecay.h" +#include "LeptonInjector/interactions/DarkNewsDecay.h" #include // for array #include // for sqrt, M_PI @@ -9,7 +9,7 @@ #include // for Vector3 #include // for P4, Boost -#include "LeptonInjector/crosssections/Decay.h" // for Decay +#include "LeptonInjector/interactions/Decay.h" // for Decay #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interac... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac... #include "LeptonInjector/dataclasses/Particle.h" // for Particle @@ -18,7 +18,7 @@ namespace LI { -namespace crosssections { +namespace interactions { DarkNewsDecay::DarkNewsDecay() {} @@ -80,5 +80,5 @@ void DarkNewsDecay::SampleFinalState(dataclasses::InteractionRecord & interactio } -} // namespace crosssections +} // namespace interactions } // namespace LI \ No newline at end of file diff --git a/projects/crosssections/private/Decay.cxx b/projects/interactions/private/Decay.cxx similarity index 92% rename from projects/crosssections/private/Decay.cxx rename to projects/interactions/private/Decay.cxx index 47e9d32b..f9655667 100644 --- a/projects/crosssections/private/Decay.cxx +++ b/projects/interactions/private/Decay.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/Decay.h" +#include "LeptonInjector/interactions/Decay.h" #include // for array @@ -9,7 +9,7 @@ #include "LeptonInjector/utilities/Constants.h" namespace LI { -namespace crosssections { +namespace interactions { Decay::Decay() {} @@ -32,6 +32,6 @@ double Decay::TotalDecayLengthForFinalState(dataclasses::InteractionRecord const return p1.beta() * p1.gamma() * tau * LI::utilities::Constants::hbarc; } -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/DipoleFromTable.cxx b/projects/interactions/private/DipoleFromTable.cxx similarity index 99% rename from projects/crosssections/private/DipoleFromTable.cxx rename to projects/interactions/private/DipoleFromTable.cxx index d47c7588..5bfa98c5 100644 --- a/projects/crosssections/private/DipoleFromTable.cxx +++ b/projects/interactions/private/DipoleFromTable.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/DipoleFromTable.h" +#include "LeptonInjector/interactions/DipoleFromTable.h" #include // for set #include // for array @@ -22,7 +22,7 @@ #include // for Vector3 #include // for P4, Boost -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSe... +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSe... #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interac... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac... #include "LeptonInjector/dataclasses/Particle.h" // for Particle @@ -33,7 +33,7 @@ #include "LeptonInjector/utilities/Random.h" // for LI_random namespace LI { -namespace crosssections { +namespace interactions { namespace { bool fexists(const std::string filename) { @@ -774,5 +774,5 @@ void DipoleFromTable::AddTotalCrossSection(LI::dataclasses::Particle::ParticleTy total.insert(std::make_pair(target, interp)); } -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/DummyCrossSection.cxx b/projects/interactions/private/DummyCrossSection.cxx similarity index 98% rename from projects/crosssections/private/DummyCrossSection.cxx rename to projects/interactions/private/DummyCrossSection.cxx index dbc3585f..3ea37c48 100644 --- a/projects/crosssections/private/DummyCrossSection.cxx +++ b/projects/interactions/private/DummyCrossSection.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/DummyCrossSection.h" +#include "LeptonInjector/interactions/DummyCrossSection.h" #include // for array #include // for sqrt, M_PI @@ -9,14 +9,14 @@ #include // for Vector3 #include // for P4, Boost -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSe... +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSe... #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interac... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac... #include "LeptonInjector/dataclasses/Particle.h" // for Particle #include "LeptonInjector/utilities/Random.h" // for LI_random namespace LI { -namespace crosssections { +namespace interactions { DummyCrossSection::DummyCrossSection() {} @@ -240,6 +240,6 @@ std::vector DummyCrossSection::DensityVariables() const { return std::vector{"Bjorken x", "Bjorken y"}; } -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/ElasticScattering.cxx b/projects/interactions/private/ElasticScattering.cxx similarity index 98% rename from projects/crosssections/private/ElasticScattering.cxx rename to projects/interactions/private/ElasticScattering.cxx index 66647074..1bdf3f2d 100644 --- a/projects/crosssections/private/ElasticScattering.cxx +++ b/projects/interactions/private/ElasticScattering.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/ElasticScattering.h" +#include "LeptonInjector/interactions/ElasticScattering.h" #include // for set #include // for array @@ -14,7 +14,7 @@ #include // for Vector3 #include // for P4, Boost -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSe... +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSe... #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interac... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac... #include "LeptonInjector/dataclasses/Particle.h" // for Particle @@ -23,7 +23,7 @@ #include "LeptonInjector/utilities/Random.h" // for LI_random namespace LI { -namespace crosssections { +namespace interactions { bool ElasticScattering::equal(CrossSection const & other) const { const ElasticScattering* x = dynamic_cast(&other); @@ -331,6 +331,6 @@ std::vector ElasticScattering::DensityVariables() const { return std::vector{"Bjorken y"}; } -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/HNLDecay.cxx b/projects/interactions/private/HNLDecay.cxx similarity index 99% rename from projects/crosssections/private/HNLDecay.cxx rename to projects/interactions/private/HNLDecay.cxx index 4329456d..de8dd489 100644 --- a/projects/crosssections/private/HNLDecay.cxx +++ b/projects/interactions/private/HNLDecay.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/HNLDecay.h" +#include "LeptonInjector/interactions/HNLDecay.h" #include #include @@ -13,10 +13,10 @@ #include "LeptonInjector/detector/MaterialModel.h" -#include "LeptonInjector/crosssections/Decay.h" +#include "LeptonInjector/interactions/Decay.h" namespace LI { -namespace crosssections { +namespace interactions { bool HNLDecay::equal(Decay const & other) const { const HNLDecay* x = dynamic_cast(&other); @@ -364,6 +364,6 @@ double HNLDecay::FinalStateProbability(dataclasses::InteractionRecord const & re -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/HNLFromSpline.cxx b/projects/interactions/private/HNLFromSpline.cxx similarity index 99% rename from projects/crosssections/private/HNLFromSpline.cxx rename to projects/interactions/private/HNLFromSpline.cxx index d6d0dd5f..ce12d346 100644 --- a/projects/crosssections/private/HNLFromSpline.cxx +++ b/projects/interactions/private/HNLFromSpline.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/HNLFromSpline.h" +#include "LeptonInjector/interactions/HNLFromSpline.h" #include // for map, opera... #include // for set, opera... @@ -20,13 +20,13 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSection +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSection #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interactio... #include "LeptonInjector/dataclasses/Particle.h" // for Particle #include "LeptonInjector/utilities/Random.h" // for LI_random namespace LI { -namespace crosssections { +namespace interactions { namespace { ///Check whether a given point in phase space is physically realizable. @@ -603,5 +603,5 @@ std::vector HNLFromSpline::DensityVariables() const { return std::vector{"Bjorken x", "Bjorken y"}; } -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/CrossSectionCollection.cxx b/projects/interactions/private/InteractionCollection.cxx similarity index 65% rename from projects/crosssections/private/CrossSectionCollection.cxx rename to projects/interactions/private/InteractionCollection.cxx index 9168e138..4747f8e0 100644 --- a/projects/crosssections/private/CrossSectionCollection.cxx +++ b/projects/interactions/private/InteractionCollection.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/CrossSectionCollection.h" +#include "LeptonInjector/interactions/InteractionCollection.h" #include // for map #include // for operator== @@ -7,16 +7,16 @@ #include // for vector #include // for pair -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSe... -#include "LeptonInjector/crosssections/Decay.h" // for Decay +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSe... +#include "LeptonInjector/interactions/Decay.h" // for Decay #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interac... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac... #include "LeptonInjector/dataclasses/Particle.h" // for Particle namespace LI { -namespace crosssections { +namespace interactions { -void CrossSectionCollection::InitializeTargetTypes() { +void InteractionCollection::InitializeTargetTypes() { target_types.clear(); cross_sections_by_target.clear(); for(unsigned int i=0; i> CrossSectionCollection::empty = {}; +const std::vector> InteractionCollection::empty = {}; -CrossSectionCollection::CrossSectionCollection() {} +InteractionCollection::InteractionCollection() {} -CrossSectionCollection::CrossSectionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> cross_sections) : primary_type(primary_type), cross_sections(cross_sections) { +InteractionCollection::InteractionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> cross_sections) : primary_type(primary_type), cross_sections(cross_sections) { InitializeTargetTypes(); } -CrossSectionCollection::CrossSectionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> decays) : primary_type(primary_type), decays(decays) { +InteractionCollection::InteractionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> decays) : primary_type(primary_type), decays(decays) { InitializeTargetTypes(); } -CrossSectionCollection::CrossSectionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> cross_sections, std::vector> decays) : primary_type(primary_type), cross_sections(cross_sections), decays(decays) { +InteractionCollection::InteractionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> cross_sections, std::vector> decays) : primary_type(primary_type), cross_sections(cross_sections), decays(decays) { InitializeTargetTypes(); } -bool CrossSectionCollection::operator==(CrossSectionCollection const & other) const { +bool InteractionCollection::operator==(InteractionCollection const & other) const { return std::tie(primary_type, target_types, cross_sections, decays) == std::tie(other.primary_type, other.target_types, other.cross_sections, other.decays); } -std::vector> const & CrossSectionCollection::GetCrossSectionsForTarget(LI::dataclasses::Particle::ParticleType p) const { +std::vector> const & InteractionCollection::GetCrossSectionsForTarget(LI::dataclasses::Particle::ParticleType p) const { std::map>>::const_iterator it = cross_sections_by_target.find(p); if(it != cross_sections_by_target.end()) { return it->second; @@ -76,7 +76,7 @@ std::vector> const & CrossSectionCollection::GetCr } } -double CrossSectionCollection::TotalDecayWidth(dataclasses::InteractionRecord const & record) const { +double InteractionCollection::TotalDecayWidth(dataclasses::InteractionRecord const & record) const { double width = 0; if(!HasDecays()) return width; for(auto dec : decays) { @@ -85,7 +85,7 @@ double CrossSectionCollection::TotalDecayWidth(dataclasses::InteractionRecord co return width; } -double CrossSectionCollection::TotalDecayLength(dataclasses::InteractionRecord const & record) const { +double InteractionCollection::TotalDecayLength(dataclasses::InteractionRecord const & record) const { double inv_length = 0; if(!HasDecays()) return std::numeric_limits::infinity(); for(auto dec : decays) { @@ -94,9 +94,9 @@ double CrossSectionCollection::TotalDecayLength(dataclasses::InteractionRecord c return 1./inv_length; } -bool CrossSectionCollection::MatchesPrimary(dataclasses::InteractionRecord const & record) const { +bool InteractionCollection::MatchesPrimary(dataclasses::InteractionRecord const & record) const { return primary_type == record.signature.primary_type; } -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/NeutrissimoDecay.cxx b/projects/interactions/private/NeutrissimoDecay.cxx similarity index 98% rename from projects/crosssections/private/NeutrissimoDecay.cxx rename to projects/interactions/private/NeutrissimoDecay.cxx index 95bbc249..119b03fd 100644 --- a/projects/crosssections/private/NeutrissimoDecay.cxx +++ b/projects/interactions/private/NeutrissimoDecay.cxx @@ -1,4 +1,4 @@ -#include "LeptonInjector/crosssections/NeutrissimoDecay.h" +#include "LeptonInjector/interactions/NeutrissimoDecay.h" #include // for array #include // for copysign @@ -8,7 +8,7 @@ #include // for Vector3 #include // for P4, Boost -#include "LeptonInjector/crosssections/Decay.h" // for Decay +#include "LeptonInjector/interactions/Decay.h" // for Decay #include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interac... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac... #include "LeptonInjector/dataclasses/Particle.h" // for Particle @@ -17,7 +17,7 @@ #include "LeptonInjector/utilities/Random.h" // for LI_random namespace LI { -namespace crosssections { +namespace interactions { bool NeutrissimoDecay::equal(Decay const & other) const { const NeutrissimoDecay* x = dynamic_cast(&other); @@ -192,6 +192,6 @@ double NeutrissimoDecay::FinalStateProbability(dataclasses::InteractionRecord co -} // namespace crosssections +} // namespace interactions } // namespace LI diff --git a/projects/crosssections/private/pybindings/CrossSection.h b/projects/interactions/private/pybindings/CrossSection.h similarity index 96% rename from projects/crosssections/private/pybindings/CrossSection.h rename to projects/interactions/private/pybindings/CrossSection.h index bca5360b..6ecb9904 100644 --- a/projects/crosssections/private/pybindings/CrossSection.h +++ b/projects/interactions/private/pybindings/CrossSection.h @@ -6,7 +6,7 @@ #include #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionRecord.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionSignature.h" @@ -14,8 +14,8 @@ #include "../../../utilities/public/LeptonInjector/utilities/Random.h" using namespace pybind11; -using namespace LI::crosssections; -class PyCrossSection : public LI::crosssections::CrossSection { +using namespace LI::interactions; +class PyCrossSection : public LI::interactions::CrossSection { public: using CrossSection::CrossSection; @@ -140,7 +140,7 @@ class PyCrossSection : public LI::crosssections::CrossSection { void register_CrossSection(pybind11::module_ & m) { using namespace pybind11; - using namespace LI::crosssections; + using namespace LI::interactions; class_, PyCrossSection>(m, "CrossSection") .def(init<>()) diff --git a/projects/crosssections/private/pybindings/DISFromSpline.h b/projects/interactions/private/pybindings/DISFromSpline.h similarity index 94% rename from projects/crosssections/private/pybindings/DISFromSpline.h rename to projects/interactions/private/pybindings/DISFromSpline.h index 4ef183c8..db696598 100644 --- a/projects/crosssections/private/pybindings/DISFromSpline.h +++ b/projects/interactions/private/pybindings/DISFromSpline.h @@ -6,8 +6,8 @@ #include #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/DISFromSpline.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/DISFromSpline.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionRecord.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionSignature.h" @@ -16,7 +16,7 @@ void register_DISFromSpline(pybind11::module_ & m) { using namespace pybind11; - using namespace LI::crosssections; + using namespace LI::interactions; class_, CrossSection> disfromspline(m, "DISFromSpline"); diff --git a/projects/crosssections/private/pybindings/DarkNewsCrossSection.h b/projects/interactions/private/pybindings/DarkNewsCrossSection.h similarity index 91% rename from projects/crosssections/private/pybindings/DarkNewsCrossSection.h rename to projects/interactions/private/pybindings/DarkNewsCrossSection.h index 9c3f859d..8d8e35db 100644 --- a/projects/crosssections/private/pybindings/DarkNewsCrossSection.h +++ b/projects/interactions/private/pybindings/DarkNewsCrossSection.h @@ -7,8 +7,8 @@ #include #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/DarkNewsCrossSection.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/DarkNewsCrossSection.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionRecord.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionSignature.h" @@ -67,7 +67,7 @@ } while (false); namespace LI { -namespace crosssections { +namespace interactions { // Trampoline class for CrossSection class pyCrossSection : public CrossSection { public: @@ -392,22 +392,22 @@ class pyDarkNewsCrossSection : public DarkNewsCrossSection { return self; } }; -} // end crosssections namespace +} // end interactions namespace } // end LI namespace void register_DarkNewsCrossSection(pybind11::module_ & m) { using namespace pybind11; - using namespace LI::crosssections; + using namespace LI::interactions; // Bindings for pyDarkNewsCrossSection - class_ pyDarkNewsCrossSection(m, "pyDarkNewsCrossSection"); + class_ pyDarkNewsCrossSection(m, "pyDarkNewsCrossSection"); pyDarkNewsCrossSection .def(init<>()) - .def("__eq__", [](const LI::crosssections::DarkNewsCrossSection &self, const LI::crosssections::DarkNewsCrossSection &other){ return self == other; }) + .def("__eq__", [](const LI::interactions::DarkNewsCrossSection &self, const LI::interactions::DarkNewsCrossSection &other){ return self == other; }) .def_readwrite("m_ups",&DarkNewsCrossSection::m_ups) .def_readwrite("m_target",&DarkNewsCrossSection::m_target) - .def("equal", &LI::crosssections::DarkNewsCrossSection::equal) + .def("equal", &LI::interactions::DarkNewsCrossSection::equal) .def("TotalCrossSection",overload_cast(&DarkNewsCrossSection::TotalCrossSection, const_)) .def("TotalCrossSection",overload_cast(&DarkNewsCrossSection::TotalCrossSection, const_)) .def("DifferentialCrossSection",overload_cast(&DarkNewsCrossSection::DifferentialCrossSection, const_)) @@ -427,7 +427,7 @@ void register_DarkNewsCrossSection(pybind11::module_ & m) { .def("SampleFinalState",&DarkNewsCrossSection::SampleFinalState) .def("get_self", &pyDarkNewsCrossSection::get_self) .def(pybind11::pickle( - [](const LI::crosssections::pyDarkNewsCrossSection & cpp_obj) { + [](const LI::interactions::pyDarkNewsCrossSection & cpp_obj) { pybind11::object self; if(cpp_obj.self) { self = pybind11::reinterpret_borrow(cpp_obj.self); @@ -446,7 +446,7 @@ void register_DarkNewsCrossSection(pybind11::module_ & m) { if (t.size() != 1) { throw std::runtime_error("Invalid state!"); } - auto cpp_state = std::unique_ptr(new LI::crosssections::pyDarkNewsCrossSection); + auto cpp_state = std::unique_ptr(new LI::interactions::pyDarkNewsCrossSection); auto py_state = t[0].cast(); return std::make_pair(std::move(cpp_state), py_state); }) @@ -454,14 +454,14 @@ void register_DarkNewsCrossSection(pybind11::module_ & m) { ; - class_, CrossSection, LI::crosssections::pyDarkNewsCrossSection> DarkNewsCrossSection(m, "DarkNewsCrossSection"); + class_, CrossSection, LI::interactions::pyDarkNewsCrossSection> DarkNewsCrossSection(m, "DarkNewsCrossSection"); DarkNewsCrossSection .def(init<>()) - .def("__eq__", [](const LI::crosssections::DarkNewsCrossSection &self, const LI::crosssections::DarkNewsCrossSection &other){ return self == other; }) + .def("__eq__", [](const LI::interactions::DarkNewsCrossSection &self, const LI::interactions::DarkNewsCrossSection &other){ return self == other; }) .def_readwrite("m_ups",&DarkNewsCrossSection::m_ups) .def_readwrite("m_target",&DarkNewsCrossSection::m_target) - .def("equal", &LI::crosssections::DarkNewsCrossSection::equal) + .def("equal", &LI::interactions::DarkNewsCrossSection::equal) .def("TotalCrossSection",overload_cast(&DarkNewsCrossSection::TotalCrossSection, const_)) .def("TotalCrossSection",overload_cast(&DarkNewsCrossSection::TotalCrossSection, const_)) .def("DifferentialCrossSection",overload_cast(&DarkNewsCrossSection::DifferentialCrossSection, const_)) @@ -481,13 +481,13 @@ void register_DarkNewsCrossSection(pybind11::module_ & m) { .def("SampleFinalState",&DarkNewsCrossSection::SampleFinalState) .def("get_self", &DarkNewsCrossSection::get_self) .def(pybind11::pickle( - [](const LI::crosssections::DarkNewsCrossSection & cpp_obj) { + [](const LI::interactions::DarkNewsCrossSection & cpp_obj) { pybind11::object self; - if(dynamic_cast(&cpp_obj) != nullptr and dynamic_cast(&cpp_obj)->self) { - self = pybind11::reinterpret_borrow(dynamic_cast(&cpp_obj)->self); + if(dynamic_cast(&cpp_obj) != nullptr and dynamic_cast(&cpp_obj)->self) { + self = pybind11::reinterpret_borrow(dynamic_cast(&cpp_obj)->self); } else { - auto *tinfo = pybind11::detail::get_type_info(typeid(LI::crosssections::DarkNewsCrossSection)); - pybind11::handle self_handle = get_object_handle(static_cast(&cpp_obj), tinfo); + auto *tinfo = pybind11::detail::get_type_info(typeid(LI::interactions::DarkNewsCrossSection)); + pybind11::handle self_handle = get_object_handle(static_cast(&cpp_obj), tinfo); self = pybind11::reinterpret_borrow(self_handle); } pybind11::dict d; @@ -500,7 +500,7 @@ void register_DarkNewsCrossSection(pybind11::module_ & m) { if (t.size() != 1) { throw std::runtime_error("Invalid state!"); } - auto cpp_state = std::unique_ptr(new LI::crosssections::pyDarkNewsCrossSection); + auto cpp_state = std::unique_ptr(new LI::interactions::pyDarkNewsCrossSection); auto py_state = t[0].cast(); return std::make_pair(std::move(cpp_state), py_state); }) diff --git a/projects/crosssections/private/pybindings/DarkNewsDecay.h b/projects/interactions/private/pybindings/DarkNewsDecay.h similarity index 90% rename from projects/crosssections/private/pybindings/DarkNewsDecay.h rename to projects/interactions/private/pybindings/DarkNewsDecay.h index e110b757..87981a83 100644 --- a/projects/crosssections/private/pybindings/DarkNewsDecay.h +++ b/projects/interactions/private/pybindings/DarkNewsDecay.h @@ -7,8 +7,8 @@ #include #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/DarkNewsDecay.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/DarkNewsDecay.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionRecord.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionSignature.h" @@ -67,7 +67,7 @@ } while (false); namespace LI { -namespace crosssections { +namespace interactions { // Trampoline class for CrossSection class pyDecay : public Decay { public: @@ -320,20 +320,20 @@ class pyDarkNewsDecay : public DarkNewsDecay { return self; } }; -} // end crosssections namespace +} // end interactions namespace } // end LI namespace void register_DarkNewsDecay(pybind11::module_ & m) { using namespace pybind11; - using namespace LI::crosssections; + using namespace LI::interactions; // Bindings for pyDarkNewsDecay - class_ pyDarkNewsDecay(m, "pyDarkNewsDecay"); + class_ pyDarkNewsDecay(m, "pyDarkNewsDecay"); pyDarkNewsDecay .def(init<>()) - .def("__eq__", [](const LI::crosssections::DarkNewsDecay &self, const LI::crosssections::DarkNewsDecay &other){ return self == other; }) - .def("equal", &LI::crosssections::DarkNewsDecay::equal) + .def("__eq__", [](const LI::interactions::DarkNewsDecay &self, const LI::interactions::DarkNewsDecay &other){ return self == other; }) + .def("equal", &LI::interactions::DarkNewsDecay::equal) .def("TotalDecayWidth",overload_cast(&DarkNewsDecay::TotalDecayWidth, const_)) .def("TotalDecayWidth",overload_cast(&DarkNewsDecay::TotalDecayWidth, const_)) .def("TotalDecayWidthForFinalState",&DarkNewsDecay::TotalDecayWidthForFinalState) @@ -346,7 +346,7 @@ void register_DarkNewsDecay(pybind11::module_ & m) { .def("SampleRecordFromDarkNews",&DarkNewsDecay::SampleRecordFromDarkNews) .def("get_self", &pyDarkNewsDecay::get_self) .def(pybind11::pickle( - [](const LI::crosssections::pyDarkNewsDecay & cpp_obj) { + [](const LI::interactions::pyDarkNewsDecay & cpp_obj) { pybind11::object self; if(cpp_obj.self) { self = pybind11::reinterpret_borrow(cpp_obj.self); @@ -365,7 +365,7 @@ void register_DarkNewsDecay(pybind11::module_ & m) { if (t.size() != 1) { throw std::runtime_error("Invalid state!"); } - auto cpp_state = std::unique_ptr(new LI::crosssections::pyDarkNewsDecay); + auto cpp_state = std::unique_ptr(new LI::interactions::pyDarkNewsDecay); auto py_state = t[0].cast(); return std::make_pair(std::move(cpp_state), py_state); }) @@ -373,12 +373,12 @@ void register_DarkNewsDecay(pybind11::module_ & m) { ; - class_, Decay, LI::crosssections::pyDarkNewsDecay> DarkNewsDecay(m, "DarkNewsDecay"); + class_, Decay, LI::interactions::pyDarkNewsDecay> DarkNewsDecay(m, "DarkNewsDecay"); DarkNewsDecay .def(init<>()) - .def("__eq__", [](const LI::crosssections::DarkNewsDecay &self, const LI::crosssections::DarkNewsDecay &other){ return self == other; }) - .def("equal", &LI::crosssections::DarkNewsDecay::equal) + .def("__eq__", [](const LI::interactions::DarkNewsDecay &self, const LI::interactions::DarkNewsDecay &other){ return self == other; }) + .def("equal", &LI::interactions::DarkNewsDecay::equal) .def("TotalDecayWidth",overload_cast(&DarkNewsDecay::TotalDecayWidth, const_)) .def("TotalDecayWidth",overload_cast(&DarkNewsDecay::TotalDecayWidth, const_)) .def("TotalDecayWidthForFinalState",&DarkNewsDecay::TotalDecayWidthForFinalState) @@ -391,13 +391,13 @@ void register_DarkNewsDecay(pybind11::module_ & m) { .def("SampleRecordFromDarkNews",&DarkNewsDecay::SampleRecordFromDarkNews) .def("get_self", &DarkNewsDecay::get_self) .def(pybind11::pickle( - [](const LI::crosssections::DarkNewsDecay & cpp_obj) { + [](const LI::interactions::DarkNewsDecay & cpp_obj) { pybind11::object self; - if(dynamic_cast(&cpp_obj) != nullptr and dynamic_cast(&cpp_obj)->self) { - self = pybind11::reinterpret_borrow(dynamic_cast(&cpp_obj)->self); + if(dynamic_cast(&cpp_obj) != nullptr and dynamic_cast(&cpp_obj)->self) { + self = pybind11::reinterpret_borrow(dynamic_cast(&cpp_obj)->self); } else { - auto *tinfo = pybind11::detail::get_type_info(typeid(LI::crosssections::DarkNewsDecay)); - pybind11::handle self_handle = get_object_handle(static_cast(&cpp_obj), tinfo); + auto *tinfo = pybind11::detail::get_type_info(typeid(LI::interactions::DarkNewsDecay)); + pybind11::handle self_handle = get_object_handle(static_cast(&cpp_obj), tinfo); self = pybind11::reinterpret_borrow(self_handle); } pybind11::dict d; @@ -410,7 +410,7 @@ void register_DarkNewsDecay(pybind11::module_ & m) { if (t.size() != 1) { throw std::runtime_error("Invalid state!"); } - auto cpp_state = std::unique_ptr(new LI::crosssections::pyDarkNewsDecay); + auto cpp_state = std::unique_ptr(new LI::interactions::pyDarkNewsDecay); auto py_state = t[0].cast(); return std::make_pair(std::move(cpp_state), py_state); }) diff --git a/projects/crosssections/private/pybindings/Decay.h b/projects/interactions/private/pybindings/Decay.h similarity index 79% rename from projects/crosssections/private/pybindings/Decay.h rename to projects/interactions/private/pybindings/Decay.h index 9444a4d3..41e6f5b5 100644 --- a/projects/crosssections/private/pybindings/Decay.h +++ b/projects/interactions/private/pybindings/Decay.h @@ -6,15 +6,15 @@ #include #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/Decay.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/Decay.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" #include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" #include "../../../utilities/public/LeptonInjector/utilities/Random.h" void register_Decay(pybind11::module_ & m) { using namespace pybind11; - using namespace LI::crosssections; + using namespace LI::interactions; class_>(m, "Decay") .def("TotalDecayLength",&Decay::TotalDecayLength) diff --git a/projects/crosssections/private/pybindings/DipoleFromTable.h b/projects/interactions/private/pybindings/DipoleFromTable.h similarity index 95% rename from projects/crosssections/private/pybindings/DipoleFromTable.h rename to projects/interactions/private/pybindings/DipoleFromTable.h index 46baacfb..49a8d202 100644 --- a/projects/crosssections/private/pybindings/DipoleFromTable.h +++ b/projects/interactions/private/pybindings/DipoleFromTable.h @@ -6,8 +6,8 @@ #include #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/DipoleFromTable.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/DipoleFromTable.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionRecord.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionSignature.h" @@ -16,7 +16,7 @@ void register_DipoleFromTable(pybind11::module_ & m) { using namespace pybind11; - using namespace LI::crosssections; + using namespace LI::interactions; class_, CrossSection> dipolefromtable(m, "DipoleFromTable"); diff --git a/projects/crosssections/private/pybindings/DummyCrossSection.h b/projects/interactions/private/pybindings/DummyCrossSection.h similarity index 91% rename from projects/crosssections/private/pybindings/DummyCrossSection.h rename to projects/interactions/private/pybindings/DummyCrossSection.h index ecbfcf61..691ba850 100644 --- a/projects/crosssections/private/pybindings/DummyCrossSection.h +++ b/projects/interactions/private/pybindings/DummyCrossSection.h @@ -6,8 +6,8 @@ #include #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/DummyCrossSection.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/DummyCrossSection.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionRecord.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionSignature.h" @@ -16,7 +16,7 @@ void register_DummyCrossSection(pybind11::module_ & m) { using namespace pybind11; - using namespace LI::crosssections; + using namespace LI::interactions; class_, CrossSection> dummycrosssection(m, "DummyCrossSection"); diff --git a/projects/crosssections/private/pybindings/HNLFromSpline.h b/projects/interactions/private/pybindings/HNLFromSpline.h similarity index 94% rename from projects/crosssections/private/pybindings/HNLFromSpline.h rename to projects/interactions/private/pybindings/HNLFromSpline.h index bd7b7967..2d25d9c3 100644 --- a/projects/crosssections/private/pybindings/HNLFromSpline.h +++ b/projects/interactions/private/pybindings/HNLFromSpline.h @@ -6,8 +6,8 @@ #include #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/HNLFromSpline.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/HNLFromSpline.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionRecord.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionSignature.h" @@ -16,7 +16,7 @@ void register_HNLFromSpline(pybind11::module_ & m) { using namespace pybind11; - using namespace LI::crosssections; + using namespace LI::interactions; class_, CrossSection> disfromspline(m, "HNLFromSpline"); diff --git a/projects/interactions/private/pybindings/InteractionCollection.h b/projects/interactions/private/pybindings/InteractionCollection.h new file mode 100644 index 00000000..2ec06f49 --- /dev/null +++ b/projects/interactions/private/pybindings/InteractionCollection.h @@ -0,0 +1,36 @@ +#include +#include +#include + +#include +#include +#include + +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/InteractionCollection.h" +#include "../../public/LeptonInjector/interactions/Decay.h" +#include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" +#include "../../../geometry/public/LeptonInjector/geometry/Geometry.h" +#include "../../../utilities/public/LeptonInjector/utilities/Random.h" + +void register_InteractionCollection(pybind11::module_ & m) { + using namespace pybind11; + using namespace LI::interactions; + + class_>(m, "InteractionCollection") + .def(init<>()) + .def(init>>()) + .def(init>>()) + .def(init>, std::vector>>()) + .def(self == self) + .def("GetDecays",&InteractionCollection::GetDecays) + .def("HasCrossSections",&InteractionCollection::HasCrossSections) + .def("HasDecays",&InteractionCollection::HasDecays) + .def("GetCrossSectionsForTarget",&InteractionCollection::GetCrossSectionsForTarget) + .def("GetCrossSectionsByTarget",&InteractionCollection::GetCrossSectionsByTarget) + .def("TargetTypes",&InteractionCollection::TargetTypes) + .def("TotalDecayWidth",&InteractionCollection::TotalDecayWidth) + .def("TotalDecayLength",&InteractionCollection::TotalDecayLength) + .def("MatchesPrimary",&InteractionCollection::MatchesPrimary) + ; +} diff --git a/projects/crosssections/private/pybindings/NeutrissimoDecay.h b/projects/interactions/private/pybindings/NeutrissimoDecay.h similarity index 92% rename from projects/crosssections/private/pybindings/NeutrissimoDecay.h rename to projects/interactions/private/pybindings/NeutrissimoDecay.h index a8867969..fb012262 100644 --- a/projects/crosssections/private/pybindings/NeutrissimoDecay.h +++ b/projects/interactions/private/pybindings/NeutrissimoDecay.h @@ -6,8 +6,8 @@ #include #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/NeutrissimoDecay.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/NeutrissimoDecay.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/Particle.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionRecord.h" #include "../../../dataclasses/public/LeptonInjector/dataclasses/InteractionSignature.h" @@ -16,7 +16,7 @@ void register_NeutrissimoDecay(pybind11::module_ & m) { using namespace pybind11; - using namespace LI::crosssections; + using namespace LI::interactions; class_, Decay> neutrissimodecay(m, "NeutrissimoDecay"); diff --git a/projects/crosssections/private/pybindings/crosssections.cxx b/projects/interactions/private/pybindings/interactions.cxx similarity index 51% rename from projects/crosssections/private/pybindings/crosssections.cxx rename to projects/interactions/private/pybindings/interactions.cxx index 6d3b7f9d..57fb7ac7 100644 --- a/projects/crosssections/private/pybindings/crosssections.cxx +++ b/projects/interactions/private/pybindings/interactions.cxx @@ -1,14 +1,14 @@ #include -#include "../../public/LeptonInjector/crosssections/CrossSection.h" -#include "../../public/LeptonInjector/crosssections/NeutrissimoDecay.h" -#include "../../public/LeptonInjector/crosssections/CrossSectionCollection.h" -#include "../../public/LeptonInjector/crosssections/DISFromSpline.h" -#include "../../public/LeptonInjector/crosssections/HNLFromSpline.h" -#include "../../public/LeptonInjector/crosssections/DipoleFromTable.h" -#include "../../public/LeptonInjector/crosssections/DarkNewsCrossSection.h" -#include "../../public/LeptonInjector/crosssections/DarkNewsDecay.h" +#include "../../public/LeptonInjector/interactions/CrossSection.h" +#include "../../public/LeptonInjector/interactions/NeutrissimoDecay.h" +#include "../../public/LeptonInjector/interactions/InteractionCollection.h" +#include "../../public/LeptonInjector/interactions/DISFromSpline.h" +#include "../../public/LeptonInjector/interactions/HNLFromSpline.h" +#include "../../public/LeptonInjector/interactions/DipoleFromTable.h" +#include "../../public/LeptonInjector/interactions/DarkNewsCrossSection.h" +#include "../../public/LeptonInjector/interactions/DarkNewsDecay.h" #include "./CrossSection.h" #include "./DipoleFromTable.h" @@ -18,7 +18,7 @@ #include "./HNLFromSpline.h" #include "./Decay.h" #include "./NeutrissimoDecay.h" -#include "./CrossSectionCollection.h" +#include "./InteractionCollection.h" #include "./DummyCrossSection.h" #include @@ -29,8 +29,8 @@ PYBIND11_DECLARE_HOLDER_TYPE(T__,std::shared_ptr) using namespace pybind11; -PYBIND11_MODULE(crosssections,m) { - using namespace LI::crosssections; +PYBIND11_MODULE(interactions,m) { + using namespace LI::interactions; register_CrossSection(m); register_Decay(m); @@ -40,6 +40,6 @@ PYBIND11_MODULE(crosssections,m) { register_DISFromSpline(m); register_HNLFromSpline(m); register_NeutrissimoDecay(m); - register_CrossSectionCollection(m); + register_InteractionCollection(m); register_DummyCrossSection(m); } diff --git a/projects/crosssections/private/pybindings/pyDarkNewsSerializer.cxx b/projects/interactions/private/pybindings/pyDarkNewsSerializer.cxx similarity index 70% rename from projects/crosssections/private/pybindings/pyDarkNewsSerializer.cxx rename to projects/interactions/private/pybindings/pyDarkNewsSerializer.cxx index 9e4b081f..5c686120 100644 --- a/projects/crosssections/private/pybindings/pyDarkNewsSerializer.cxx +++ b/projects/interactions/private/pybindings/pyDarkNewsSerializer.cxx @@ -1,7 +1,7 @@ #include "./DarkNewsCrossSection.h" -#include "../../public/LeptonInjector/crosssections/DarkNewsCrossSection.h" +#include "../../public/LeptonInjector/interactions/DarkNewsCrossSection.h" #include "./DarkNewsDecay.h" -#include "../../public/LeptonInjector/crosssections/DarkNewsDecay.h" +#include "../../public/LeptonInjector/interactions/DarkNewsDecay.h" #include @@ -10,13 +10,13 @@ namespace py = pybind11; -std::string pyDarkNewsCrossSection_dumper(LI::crosssections::pyDarkNewsCrossSection & object) { +std::string pyDarkNewsCrossSection_dumper(LI::interactions::pyDarkNewsCrossSection & object) { pybind11::object obj; if(object.self) { obj = object.self; } else { - auto *tinfo = pybind11::detail::get_type_info(typeid(LI::crosssections::DarkNewsCrossSection)); - pybind11::handle self_handle = get_object_handle(static_cast(&object), tinfo); + auto *tinfo = pybind11::detail::get_type_info(typeid(LI::interactions::DarkNewsCrossSection)); + pybind11::handle self_handle = get_object_handle(static_cast(&object), tinfo); obj = pybind11::reinterpret_borrow(self_handle); } py::module pkl = py::module::import("pickle"); @@ -25,8 +25,8 @@ std::string pyDarkNewsCrossSection_dumper(LI::crosssections::pyDarkNewsCrossSect return str; } -LI::crosssections::pyDarkNewsCrossSection pyDarkNewsCrossSection_loader(std::string & state) { - LI::crosssections::pyDarkNewsCrossSection object; +LI::interactions::pyDarkNewsCrossSection pyDarkNewsCrossSection_loader(std::string & state) { + LI::interactions::pyDarkNewsCrossSection object; py::module pkl = py::module::import("pickle"); py::object fromhex = py::globals()["__builtins__"].attr("bytes").attr("fromhex"); @@ -37,13 +37,13 @@ LI::crosssections::pyDarkNewsCrossSection pyDarkNewsCrossSection_loader(std::str return object; } -std::string pyDarkNewsDecay_dumper(LI::crosssections::pyDarkNewsDecay & object) { +std::string pyDarkNewsDecay_dumper(LI::interactions::pyDarkNewsDecay & object) { pybind11::object obj; if(object.self) { obj = object.self; } else { - auto *tinfo = pybind11::detail::get_type_info(typeid(LI::crosssections::DarkNewsDecay)); - pybind11::handle self_handle = get_object_handle(static_cast(&object), tinfo); + auto *tinfo = pybind11::detail::get_type_info(typeid(LI::interactions::DarkNewsDecay)); + pybind11::handle self_handle = get_object_handle(static_cast(&object), tinfo); obj = pybind11::reinterpret_borrow(self_handle); } py::module pkl = py::module::import("pickle"); @@ -52,8 +52,8 @@ std::string pyDarkNewsDecay_dumper(LI::crosssections::pyDarkNewsDecay & object) return str; } -LI::crosssections::pyDarkNewsDecay pyDarkNewsDecay_loader(std::string & state) { - LI::crosssections::pyDarkNewsDecay object; +LI::interactions::pyDarkNewsDecay pyDarkNewsDecay_loader(std::string & state) { + LI::interactions::pyDarkNewsDecay object; py::module pkl = py::module::import("pickle"); py::object fromhex = py::globals()["__builtins__"].attr("bytes").attr("fromhex"); diff --git a/projects/crosssections/private/test/DISFromSpline_TEST.cxx b/projects/interactions/private/test/DISFromSpline_TEST.cxx similarity index 94% rename from projects/crosssections/private/test/DISFromSpline_TEST.cxx rename to projects/interactions/private/test/DISFromSpline_TEST.cxx index f349a859..1f9b085b 100644 --- a/projects/crosssections/private/test/DISFromSpline_TEST.cxx +++ b/projects/interactions/private/test/DISFromSpline_TEST.cxx @@ -9,15 +9,15 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/DISFromSpline.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/DISFromSpline.h" #include "LeptonInjector/utilities/Random.h" #include "LeptonInjector/dataclasses/Particle.h" #include "LeptonInjector/dataclasses/InteractionRecord.h" #include "LeptonInjector/dataclasses/InteractionSignature.h" -using namespace LI::crosssections; +using namespace LI::interactions; using namespace LI::dataclasses; using namespace LI::utilities; diff --git a/projects/crosssections/private/test/DipoleFromTable_TEST.cxx b/projects/interactions/private/test/DipoleFromTable_TEST.cxx similarity index 96% rename from projects/crosssections/private/test/DipoleFromTable_TEST.cxx rename to projects/interactions/private/test/DipoleFromTable_TEST.cxx index c129303c..fe259535 100644 --- a/projects/crosssections/private/test/DipoleFromTable_TEST.cxx +++ b/projects/interactions/private/test/DipoleFromTable_TEST.cxx @@ -9,15 +9,15 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/DipoleFromTable.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/DipoleFromTable.h" #include "LeptonInjector/utilities/Random.h" #include "LeptonInjector/dataclasses/Particle.h" #include "LeptonInjector/dataclasses/InteractionRecord.h" #include "LeptonInjector/dataclasses/InteractionSignature.h" -using namespace LI::crosssections; +using namespace LI::interactions; using namespace LI::dataclasses; using namespace LI::utilities; diff --git a/projects/crosssections/private/test/DipoleTable_TEST.cxx b/projects/interactions/private/test/DipoleTable_TEST.cxx similarity index 100% rename from projects/crosssections/private/test/DipoleTable_TEST.cxx rename to projects/interactions/private/test/DipoleTable_TEST.cxx diff --git a/projects/crosssections/private/test/ElasticScattering_TEST.cxx b/projects/interactions/private/test/ElasticScattering_TEST.cxx similarity index 93% rename from projects/crosssections/private/test/ElasticScattering_TEST.cxx rename to projects/interactions/private/test/ElasticScattering_TEST.cxx index a8ef425a..6844698d 100644 --- a/projects/crosssections/private/test/ElasticScattering_TEST.cxx +++ b/projects/interactions/private/test/ElasticScattering_TEST.cxx @@ -10,8 +10,8 @@ #include -#include "LeptonInjector/crosssections/CrossSection.h" -#include "LeptonInjector/crosssections/ElasticScattering.h" +#include "LeptonInjector/interactions/CrossSection.h" +#include "LeptonInjector/interactions/ElasticScattering.h" #include "LeptonInjector/distributions/primary/energy/PrimaryEnergyDistribution.h" #include "LeptonInjector/distributions/primary/energy/TabulatedFluxDistribution.h" @@ -36,7 +36,7 @@ #include "LeptonInjector/injection/Weighter.h" #include "LeptonInjector/injection/ColumnDepthLeptonInjector.h" -using namespace LI::crosssections; +using namespace LI::interactions; using namespace LI::distributions; using namespace LI::dataclasses; using namespace LI::injection; @@ -83,9 +83,9 @@ TEST(ElasticScattering, Generation) cross_sections.push_back(es_xs); // Load the earth model - std::shared_ptr earth_model = std::make_shared(); + std::shared_ptr earth_model = std::make_shared(); earth_model->LoadMaterialModel(material_file); - earth_model->LoadEarthModel(earth_file); + earth_model->LoadDetectorModel(earth_file); // Setup the primary type and mass //std::shared_ptr primary_injector = std::make_shared(primary_type, hnl_mass); @@ -117,7 +117,7 @@ TEST(ElasticScattering, Generation) std::shared_ptr helicity_distribution = std::make_shared(); // Put it all together! - std::shared_ptr injector = std::make_shared(events_to_inject, primary_injector, cross_sections, earth_model, random, edist, ddist, target_momentum_distribution, depth_func, disk_radius, endcap_length, helicity_distribution); + std::shared_ptr injector = std::make_shared(events_to_inject, primary_injector, cross_sections, earth_model, random, edist, ddist, target_momentum_distribution, depth_func, disk_radius, endcap_length, helicity_distribution); std::vector> physical_distributions = { std::shared_ptr(tab_pdf), @@ -127,7 +127,7 @@ TEST(ElasticScattering, Generation) std::shared_ptr(helicity_distribution) }; - LeptonWeighter weighter(std::vector>{injector}, earth_model, injector->GetCrossSections(), physical_distributions); + LeptonWeighter weighter(std::vector>{injector}, earth_model, injector->GetInteractions(), physical_distributions); // MINERvA Fiducial Volume std::vector> poly; diff --git a/projects/crosssections/public/LeptonInjector/crosssections/CrossSection.h b/projects/interactions/public/LeptonInjector/interactions/CrossSection.h similarity index 95% rename from projects/crosssections/public/LeptonInjector/crosssections/CrossSection.h rename to projects/interactions/public/LeptonInjector/interactions/CrossSection.h index ebe28006..6a1ea388 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/CrossSection.h +++ b/projects/interactions/public/LeptonInjector/interactions/CrossSection.h @@ -21,7 +21,7 @@ namespace LI { namespace dataclasses { struct InteractionSignature; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { -namespace crosssections { +namespace interactions { class CrossSection { friend cereal::access; @@ -51,10 +51,10 @@ friend cereal::access; void load(Archive & archive, std::uint32_t const version) {}; }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::CrossSection, 0); +CEREAL_CLASS_VERSION(LI::interactions::CrossSection, 0); #endif // LI_CrossSection_H diff --git a/projects/crosssections/public/LeptonInjector/crosssections/DISFromSpline.h b/projects/interactions/public/LeptonInjector/interactions/DISFromSpline.h similarity index 96% rename from projects/crosssections/public/LeptonInjector/crosssections/DISFromSpline.h rename to projects/interactions/public/LeptonInjector/interactions/DISFromSpline.h index 24e61efb..56956886 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/DISFromSpline.h +++ b/projects/interactions/public/LeptonInjector/interactions/DISFromSpline.h @@ -24,7 +24,7 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSe... +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSe... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac... #include "LeptonInjector/dataclasses/Particle.h" // for Particle @@ -32,7 +32,7 @@ namespace LI { namespace dataclasses { struct InteractionRecord; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { -namespace crosssections { +namespace interactions { class DISFromSpline : public CrossSection { friend cereal::access; @@ -149,11 +149,11 @@ friend cereal::access; void InitializeSignatures(); }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::DISFromSpline, 0); -CEREAL_REGISTER_TYPE(LI::crosssections::DISFromSpline); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::crosssections::CrossSection, LI::crosssections::DISFromSpline); +CEREAL_CLASS_VERSION(LI::interactions::DISFromSpline, 0); +CEREAL_REGISTER_TYPE(LI::interactions::DISFromSpline); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::interactions::CrossSection, LI::interactions::DISFromSpline); #endif // LI_DISFromSpline_H diff --git a/projects/crosssections/public/LeptonInjector/crosssections/DarkNewsCrossSection.h b/projects/interactions/public/LeptonInjector/interactions/DarkNewsCrossSection.h similarity index 91% rename from projects/crosssections/public/LeptonInjector/crosssections/DarkNewsCrossSection.h rename to projects/interactions/public/LeptonInjector/interactions/DarkNewsCrossSection.h index e5188618..990e0dca 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/DarkNewsCrossSection.h +++ b/projects/interactions/public/LeptonInjector/interactions/DarkNewsCrossSection.h @@ -20,7 +20,7 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSection +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSection #include "LeptonInjector/dataclasses/Particle.h" // for Particlev namespace LI { namespace dataclasses { struct InteractionRecord; } } @@ -28,7 +28,7 @@ namespace LI { namespace dataclasses { struct InteractionSignature; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { -namespace crosssections { +namespace interactions { class DarkNewsCrossSection : public CrossSection { friend cereal::access; @@ -85,11 +85,11 @@ friend cereal::access; } }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::DarkNewsCrossSection, 0); -CEREAL_REGISTER_TYPE(LI::crosssections::DarkNewsCrossSection); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::crosssections::CrossSection, LI::crosssections::DarkNewsCrossSection); +CEREAL_CLASS_VERSION(LI::interactions::DarkNewsCrossSection, 0); +CEREAL_REGISTER_TYPE(LI::interactions::DarkNewsCrossSection); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::interactions::CrossSection, LI::interactions::DarkNewsCrossSection); #endif // LI_DarkNewsCrossSection_H \ No newline at end of file diff --git a/projects/crosssections/public/LeptonInjector/crosssections/DarkNewsDecay.h b/projects/interactions/public/LeptonInjector/interactions/DarkNewsDecay.h similarity index 90% rename from projects/crosssections/public/LeptonInjector/crosssections/DarkNewsDecay.h rename to projects/interactions/public/LeptonInjector/interactions/DarkNewsDecay.h index b22ef6da..47417ff6 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/DarkNewsDecay.h +++ b/projects/interactions/public/LeptonInjector/interactions/DarkNewsDecay.h @@ -20,7 +20,7 @@ #include #include -#include "LeptonInjector/crosssections/Decay.h" // for Decay +#include "LeptonInjector/interactions/Decay.h" // for Decay #include "LeptonInjector/dataclasses/Particle.h" // for Particle namespace LI { namespace dataclasses { struct InteractionRecord; } } @@ -28,7 +28,7 @@ namespace LI { namespace dataclasses { struct InteractionSignature; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { -namespace crosssections { +namespace interactions { class DarkNewsDecay : public Decay { friend cereal::access; @@ -72,11 +72,11 @@ friend cereal::access; }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::DarkNewsDecay, 0); -CEREAL_REGISTER_TYPE(LI::crosssections::DarkNewsDecay); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::crosssections::Decay, LI::crosssections::DarkNewsDecay); +CEREAL_CLASS_VERSION(LI::interactions::DarkNewsDecay, 0); +CEREAL_REGISTER_TYPE(LI::interactions::DarkNewsDecay); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::interactions::Decay, LI::interactions::DarkNewsDecay); #endif // LI_DarkNewsDecay_H \ No newline at end of file diff --git a/projects/crosssections/public/LeptonInjector/crosssections/Decay.h b/projects/interactions/public/LeptonInjector/interactions/Decay.h similarity index 95% rename from projects/crosssections/public/LeptonInjector/crosssections/Decay.h rename to projects/interactions/public/LeptonInjector/interactions/Decay.h index 66198801..c5d1de34 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/Decay.h +++ b/projects/interactions/public/LeptonInjector/interactions/Decay.h @@ -21,7 +21,7 @@ namespace LI { namespace dataclasses { struct InteractionSignature; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { -namespace crosssections { +namespace interactions { class Decay{ friend cereal::access; @@ -49,9 +49,9 @@ friend cereal::access; }; // class Decay -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::Decay, 0); +CEREAL_CLASS_VERSION(LI::interactions::Decay, 0); #endif // LI_Decay_H diff --git a/projects/crosssections/public/LeptonInjector/crosssections/DipoleFromTable.h b/projects/interactions/public/LeptonInjector/interactions/DipoleFromTable.h similarity index 96% rename from projects/crosssections/public/LeptonInjector/crosssections/DipoleFromTable.h rename to projects/interactions/public/LeptonInjector/interactions/DipoleFromTable.h index 427b8009..1d57dafe 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/DipoleFromTable.h +++ b/projects/interactions/public/LeptonInjector/interactions/DipoleFromTable.h @@ -19,7 +19,7 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSection +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSection #include "LeptonInjector/dataclasses/Particle.h" // for Particle #include "LeptonInjector/utilities/Interpolator.h" // for Interpolator1D @@ -28,7 +28,7 @@ namespace LI { namespace dataclasses { struct InteractionSignature; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { -namespace crosssections { +namespace interactions { class DipoleFromTable : public CrossSection { friend cereal::access; @@ -129,11 +129,11 @@ DipoleFromTable() {}; }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::DipoleFromTable, 0); -CEREAL_REGISTER_TYPE(LI::crosssections::DipoleFromTable); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::crosssections::CrossSection, LI::crosssections::DipoleFromTable); +CEREAL_CLASS_VERSION(LI::interactions::DipoleFromTable, 0); +CEREAL_REGISTER_TYPE(LI::interactions::DipoleFromTable); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::interactions::CrossSection, LI::interactions::DipoleFromTable); #endif // LI_DipoleFromTable_H diff --git a/projects/crosssections/public/LeptonInjector/crosssections/DummyCrossSection.h b/projects/interactions/public/LeptonInjector/interactions/DummyCrossSection.h similarity index 89% rename from projects/crosssections/public/LeptonInjector/crosssections/DummyCrossSection.h rename to projects/interactions/public/LeptonInjector/interactions/DummyCrossSection.h index fe8f4319..a0ef7850 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/DummyCrossSection.h +++ b/projects/interactions/public/LeptonInjector/interactions/DummyCrossSection.h @@ -18,7 +18,7 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSection +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSection #include "LeptonInjector/dataclasses/Particle.h" // for Particle namespace LI { namespace dataclasses { struct InteractionRecord; } } @@ -26,7 +26,7 @@ namespace LI { namespace dataclasses { struct InteractionSignature; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { -namespace crosssections { +namespace interactions { class DummyCrossSection : public CrossSection { friend cereal::access; @@ -70,11 +70,11 @@ friend cereal::access; } }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::DummyCrossSection, 0); -CEREAL_REGISTER_TYPE(LI::crosssections::DummyCrossSection); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::crosssections::CrossSection, LI::crosssections::DummyCrossSection); +CEREAL_CLASS_VERSION(LI::interactions::DummyCrossSection, 0); +CEREAL_REGISTER_TYPE(LI::interactions::DummyCrossSection); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::interactions::CrossSection, LI::interactions::DummyCrossSection); #endif // LI_DummyCrossSection_H diff --git a/projects/crosssections/public/LeptonInjector/crosssections/ElasticScattering.h b/projects/interactions/public/LeptonInjector/interactions/ElasticScattering.h similarity index 91% rename from projects/crosssections/public/LeptonInjector/crosssections/ElasticScattering.h rename to projects/interactions/public/LeptonInjector/interactions/ElasticScattering.h index 06893b3a..b78f51c4 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/ElasticScattering.h +++ b/projects/interactions/public/LeptonInjector/interactions/ElasticScattering.h @@ -17,7 +17,7 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSection +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSection #include "LeptonInjector/dataclasses/Particle.h" // for Particle namespace LI { namespace dataclasses { struct InteractionRecord; } } @@ -25,7 +25,7 @@ namespace LI { namespace dataclasses { struct InteractionSignature; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { -namespace crosssections { +namespace interactions { // For details, see appendix A of 1906.00111v4 class ElasticScattering : public CrossSection { @@ -75,11 +75,11 @@ friend cereal::access; } }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::ElasticScattering, 0); -CEREAL_REGISTER_TYPE(LI::crosssections::ElasticScattering); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::crosssections::CrossSection, LI::crosssections::ElasticScattering); +CEREAL_CLASS_VERSION(LI::interactions::ElasticScattering, 0); +CEREAL_REGISTER_TYPE(LI::interactions::ElasticScattering); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::interactions::CrossSection, LI::interactions::ElasticScattering); #endif // LI_ElasticScattering_H diff --git a/projects/crosssections/public/LeptonInjector/crosssections/HNLDecay.h b/projects/interactions/public/LeptonInjector/interactions/HNLDecay.h similarity index 93% rename from projects/crosssections/public/LeptonInjector/crosssections/HNLDecay.h rename to projects/interactions/public/LeptonInjector/interactions/HNLDecay.h index c6e7c88a..38f896b1 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/HNLDecay.h +++ b/projects/interactions/public/LeptonInjector/interactions/HNLDecay.h @@ -24,10 +24,10 @@ #include "LeptonInjector/dataclasses/InteractionSignature.h" #include "LeptonInjector/dataclasses/InteractionRecord.h" -#include "LeptonInjector/crosssections/Decay.h" +#include "LeptonInjector/interactions/Decay.h" namespace LI { -namespace crosssections { +namespace interactions { class HNLDecay : public Decay { friend cereal::access; @@ -91,11 +91,11 @@ HNLDecay() {}; }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::HNLDecay, 0); -CEREAL_REGISTER_TYPE(LI::crosssections::HNLDecay); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::crosssections::Decay, LI::crosssections::HNLDecay); +CEREAL_CLASS_VERSION(LI::interactions::HNLDecay, 0); +CEREAL_REGISTER_TYPE(LI::interactions::HNLDecay); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::interactions::Decay, LI::interactions::HNLDecay); #endif // LI_HNLDecay_H diff --git a/projects/crosssections/public/LeptonInjector/crosssections/HNLFromSpline.h b/projects/interactions/public/LeptonInjector/interactions/HNLFromSpline.h similarity index 95% rename from projects/crosssections/public/LeptonInjector/crosssections/HNLFromSpline.h rename to projects/interactions/public/LeptonInjector/interactions/HNLFromSpline.h index 16b654e8..e11a91ba 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/HNLFromSpline.h +++ b/projects/interactions/public/LeptonInjector/interactions/HNLFromSpline.h @@ -24,7 +24,7 @@ #include #include -#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSe... +#include "LeptonInjector/interactions/CrossSection.h" // for CrossSe... #include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac... #include "LeptonInjector/dataclasses/Particle.h" // for Particle #include "photospline/detail/fitsio.h" // for splinet... @@ -35,7 +35,7 @@ namespace cereal { class access; } namespace LI { -namespace crosssections { +namespace interactions { class HNLFromSpline : public CrossSection { friend cereal::access; @@ -148,11 +148,11 @@ friend cereal::access; void InitializeSignatures(); }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::HNLFromSpline, 0); -CEREAL_REGISTER_TYPE(LI::crosssections::HNLFromSpline); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::crosssections::CrossSection, LI::crosssections::HNLFromSpline); +CEREAL_CLASS_VERSION(LI::interactions::HNLFromSpline, 0); +CEREAL_REGISTER_TYPE(LI::interactions::HNLFromSpline); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::interactions::CrossSection, LI::interactions::HNLFromSpline); #endif // LI_HNLFromSpline_H diff --git a/projects/crosssections/public/LeptonInjector/crosssections/CrossSectionCollection.h b/projects/interactions/public/LeptonInjector/interactions/InteractionCollection.h similarity index 73% rename from projects/crosssections/public/LeptonInjector/crosssections/CrossSectionCollection.h rename to projects/interactions/public/LeptonInjector/interactions/InteractionCollection.h index a2282a4d..ca57cf84 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/CrossSectionCollection.h +++ b/projects/interactions/public/LeptonInjector/interactions/InteractionCollection.h @@ -1,6 +1,6 @@ #pragma once -#ifndef LI_CrossSectionCollection_H -#define LI_CrossSectionCollection_H +#ifndef LI_InteractionCollection_H +#define LI_InteractionCollection_H #include // for map #include // for set @@ -25,14 +25,14 @@ #include "LeptonInjector/dataclasses/Particle.h" // for Particle -namespace LI { namespace crosssections { class CrossSection; } } -namespace LI { namespace crosssections { class Decay; } } +namespace LI { namespace interactions { class CrossSection; } } +namespace LI { namespace interactions { class Decay; } } namespace LI { namespace dataclasses { struct InteractionRecord; } } namespace LI { -namespace crosssections { +namespace interactions { -class CrossSectionCollection{ +class InteractionCollection{ private: LI::dataclasses::Particle::ParticleType primary_type; std::vector> cross_sections; @@ -42,12 +42,12 @@ class CrossSectionCollection{ static const std::vector> empty; void InitializeTargetTypes(); public: - CrossSectionCollection(); - virtual ~CrossSectionCollection() {}; - CrossSectionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> cross_sections); - CrossSectionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> decays); - CrossSectionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> cross_sections, std::vector> decays); - bool operator==(CrossSectionCollection const & other) const; + InteractionCollection(); + virtual ~InteractionCollection() {}; + InteractionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> cross_sections); + InteractionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> decays); + InteractionCollection(LI::dataclasses::Particle::ParticleType primary_type, std::vector> cross_sections, std::vector> decays); + bool operator==(InteractionCollection const & other) const; std::vector> const & GetCrossSections() const {return cross_sections;} std::vector> const & GetDecays() const {return decays;} bool const HasCrossSections() const {return cross_sections.size() > 0;} @@ -70,7 +70,7 @@ class CrossSectionCollection{ archive(cereal::make_nvp("CrossSections", cross_sections)); archive(cereal::make_nvp("Decays", decays)); } else { - throw std::runtime_error("CrossSectionCollection only supports version <= 0!"); + throw std::runtime_error("InteractionCollection only supports version <= 0!"); } } @@ -81,14 +81,14 @@ class CrossSectionCollection{ archive(cereal::make_nvp("CrossSections", cross_sections)); archive(cereal::make_nvp("Decays", decays)); } else { - throw std::runtime_error("CrossSectionCollection only supports version <= 0!"); + throw std::runtime_error("InteractionCollection only supports version <= 0!"); } } }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::CrossSectionCollection, 0); +CEREAL_CLASS_VERSION(LI::interactions::InteractionCollection, 0); -#endif // LI_CrossSectionCollection_H +#endif // LI_InteractionCollection_H diff --git a/projects/crosssections/public/LeptonInjector/crosssections/NeutrissimoDecay.h b/projects/interactions/public/LeptonInjector/interactions/NeutrissimoDecay.h similarity index 93% rename from projects/crosssections/public/LeptonInjector/crosssections/NeutrissimoDecay.h rename to projects/interactions/public/LeptonInjector/interactions/NeutrissimoDecay.h index d8650fb3..2cac3b29 100644 --- a/projects/crosssections/public/LeptonInjector/crosssections/NeutrissimoDecay.h +++ b/projects/interactions/public/LeptonInjector/interactions/NeutrissimoDecay.h @@ -18,7 +18,7 @@ #include #include -#include "LeptonInjector/crosssections/Decay.h" // for Decay +#include "LeptonInjector/interactions/Decay.h" // for Decay #include "LeptonInjector/dataclasses/Particle.h" // for Particle namespace LI { namespace dataclasses { struct InteractionRecord; } } @@ -26,7 +26,7 @@ namespace LI { namespace dataclasses { struct InteractionSignature; } } namespace LI { namespace utilities { class LI_random; } } namespace LI { -namespace crosssections { +namespace interactions { class NeutrissimoDecay : public Decay { friend cereal::access; @@ -90,11 +90,11 @@ NeutrissimoDecay() {}; }; -} // namespace crosssections +} // namespace interactions } // namespace LI -CEREAL_CLASS_VERSION(LI::crosssections::NeutrissimoDecay, 0); -CEREAL_REGISTER_TYPE(LI::crosssections::NeutrissimoDecay); -CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::crosssections::Decay, LI::crosssections::NeutrissimoDecay); +CEREAL_CLASS_VERSION(LI::interactions::NeutrissimoDecay, 0); +CEREAL_REGISTER_TYPE(LI::interactions::NeutrissimoDecay); +CEREAL_REGISTER_POLYMORPHIC_RELATION(LI::interactions::Decay, LI::interactions::NeutrissimoDecay); #endif // LI_NeutrissimoDecay_H diff --git a/python/LIController.py b/python/LIController.py index c589e80a..58b993a2 100644 --- a/python/LIController.py +++ b/python/LIController.py @@ -3,7 +3,7 @@ import numpy as np import leptoninjector as LI -from LIDarkNews import PyDarkNewsCrossSectionCollection +from LIDarkNews import PyDarkNewsInteractionCollection # For determining fiducial volume of different experiments fid_vol_dict = {'MiniBooNE':'fid_vol', @@ -36,15 +36,15 @@ def __init__(self, # Find the density and materials files self.LI_SRC = os.environ.get('LEPTONINJECTOR_SRC') - materials_file = self.LI_SRC + '/resources/earthparams/materials/%s.dat'%experiment + materials_file = self.LI_SRC + '/resources/DetectorParams/materials/%s.dat'%experiment if experiment in ['ATLAS','dune']: - earth_model_file = self.LI_SRC + '/resources/earthparams/densities/PREM_%s.dat'%experiment + detector_model_file = self.LI_SRC + '/resources/DetectorParams/densities/PREM_%s.dat'%experiment else: - earth_model_file = self.LI_SRC + '/resources/earthparams/densities/%s.dat'%experiment + detector_model_file = self.LI_SRC + '/resources/DetectorParams/densities/%s.dat'%experiment - self.earth_model = LI.detector.EarthModel() - self.earth_model.LoadMaterialModel(materials_file) - self.earth_model.LoadEarthModel(earth_model_file) + self.detector_model = LI.detector.DetectorModel() + self.detector_model.LoadMaterialModel(materials_file) + self.detector_model.LoadDetectorModel(detector_model_file) # Define the primary injection and physical process self.primary_injection_process = LI.injection.InjectionProcess() @@ -131,20 +131,20 @@ def InputDarkNewsModel(self, :param dict model_kwargs: The dict of DarkNews model parameters """ # Add nuclear targets to the model arguments - model_kwargs['nuclear_targets'] = self.GetEarthModelTargets()[1] + model_kwargs['nuclear_targets'] = self.GetDetectorModelTargets()[1] # Initialize DarkNews cross sections and decays - self.DN_processes = PyDarkNewsCrossSectionCollection(table_dir=table_dir, + self.DN_processes = PyDarkNewsInteractionCollection(table_dir=table_dir, **model_kwargs) - # Initialize primary CrossSectionCollection + # Initialize primary InteractionCollection # Loop over available cross sections and save those which match primary type primary_cross_sections = [] for cross_section in self.DN_processes.cross_sections: if primary_type == LI.dataclasses.Particle.ParticleType(cross_section.ups_case.nu_projectile.pdgid): primary_cross_sections.append(cross_section) - primary_cross_section_collection = LI.crosssections.CrossSectionCollection(primary_type, primary_cross_sections) + primary_interaction_collection = LI.crosssections.InteractionCollection(primary_type, primary_cross_sections) - # Initialize secondary processes and define secondary CrossSectionCollection objects + # Initialize secondary processes and define secondary InteractionCollection objects secondary_decays = {} # Also keep track of the minimum decay width for defining the position distribution later self.DN_min_decay_width = 0 @@ -160,7 +160,7 @@ def InputDarkNewsModel(self, # Now make the list of secondary cross section collections # Add new secondary injection and physical processes at the same time fid_vol = self.GetFiducialVolume() # find fiducial volume for secondary position distirbutions - secondary_cross_section_collections = [] + secondary_interaction_collections = [] for secondary_type,decay_list in secondary_decays.items(): # Define a sedcondary injection distribution @@ -178,9 +178,9 @@ def InputDarkNewsModel(self, self.secondary_injection_processes.append(secondary_injection_process) self.secondary_physical_processes.append(secondary_physical_process) - secondary_cross_section_collections.append(LI.crosssections.CrossSectionCollection(secondary_type, decay_list)) + secondary_interaction_collections.append(LI.crosssections.InteractionCollection(secondary_type, decay_list)) - self.SetCrossSections(primary_cross_section_collection,secondary_cross_section_collections) + self.SetCrossSections(primary_interaction_collection,secondary_interaction_collections) @@ -189,23 +189,23 @@ def GetFiducialVolume(self): :return: identified fiducial volume for the experiment, None if not found """ fid_vol = None - for sector in self.earth_model.Sectors: + for sector in self.detector_model.Sectors: if self.experiment in fid_vol_dict.keys(): if sector.name==fid_vol_dict[self.experiment]: fid_vol = sector.geo return fid_vol - def GetEarthModelTargets(self): + def GetDetectorModelTargets(self): """ - Determines the targets that exist inside the earth model + Determines the targets that exist inside the detector model :return: lists of targets and strings :rtype: (list, list) """ count = 0 targets = [] target_strs = [] - while self.earth_model.Materials.HasMaterial(count): - for _target in self.earth_model.Materials.GetMaterialTargets(count): + while self.detector_model.Materials.HasMaterial(count): + for _target in self.detector_model.Materials.GetMaterialTargets(count): if _target not in targets: targets.append(_target) if str(_target).find('Nucleus') == -1: @@ -219,16 +219,16 @@ def GetEarthModelTargets(self): return targets, target_strs def SetCrossSections(self, - primary_cross_section_collection, - secondary_cross_section_collections): + primary_interaction_collection, + secondary_interaction_collections): """ Set cross sections for the primary and secondary processes - :param CrossSectionCollection primary_cross_section_collection: The cross section collection for the primary process - :param list secondary_cross_section_collections: The list of cross section collections for the primary process + :param InteractionCollection primary_interaction_collection: The cross section collection for the primary process + :param list secondary_interaction_collections: The list of cross section collections for the primary process """ # Set primary cross sections - self.primary_injection_process.cross_sections = primary_cross_section_collection - self.primary_physical_process.cross_sections = primary_cross_section_collection + self.primary_injection_process.interactions = primary_interaction_collection + self.primary_physical_process.interactions = primary_interaction_collection # Loop through secondary processes for sec_inj,sec_phys in zip(self.secondary_injection_processes, @@ -238,11 +238,11 @@ def SetCrossSections(self, record.signature.primary_type = sec_inj.primary_type found_collection = False # Loop through possible seconday cross sections - for sec_xs in secondary_cross_section_collections: + for sec_xs in secondary_interaction_collections: # Match cross section collection on the primary type if sec_xs.MatchesPrimary(record): - sec_inj.cross_sections = sec_xs - sec_phys.cross_sections = sec_xs + sec_inj.interactions = sec_xs + sec_phys.interactions = sec_xs found_collection = True if(not found_collection): print('Couldn\'t find cross section collection for secondary particle %s; Exiting'%record.primary_type) @@ -259,17 +259,17 @@ def StoppingCondition(datum): return True # Define the injector object - self.injector = LI.injection.InjectorBase(self.events_to_inject, - self.earth_model, - self.primary_injection_process, - self.secondary_injection_processes, - self.random) + self.injector = LI.injection.Injector(self.events_to_inject, + self.detector_model, + self.primary_injection_process, + self.secondary_injection_processes, + self.random) self.injector.SetStoppingCondition(StoppingCondition) # Define the weighter object self.weighter = LI.injection.LeptonTreeWeighter([self.injector], - self.earth_model, + self.detector_model, self.primary_physical_process, self.secondary_physical_processes) diff --git a/python/LIDarkNews.py b/python/LIDarkNews.py index 4a4f4ac8..597886cf 100644 --- a/python/LIDarkNews.py +++ b/python/LIDarkNews.py @@ -20,7 +20,7 @@ from DarkNews.integrands import get_decay_momenta_from_vegas_samples # Class containing all upscattering and decay modes available in DarkNews -class PyDarkNewsCrossSectionCollection: +class PyDarkNewsInteractionCollection: def __init__(self, table_dir=None, diff --git a/python/__init__.py b/python/__init__.py index ab47de3e..cdac1590 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -3,6 +3,6 @@ from . import dataclasses from . import geometry from . import detector -from . import crosssections +from . import interactions from . import distributions from . import injection diff --git a/resources/earthparams/densities/CCM.dat b/resources/DetectorParams/densities/CCM.dat similarity index 100% rename from resources/earthparams/densities/CCM.dat rename to resources/DetectorParams/densities/CCM.dat diff --git a/resources/earthparams/densities/FLATCORE_5.568.dat b/resources/DetectorParams/densities/FLATCORE_5.568.dat similarity index 100% rename from resources/earthparams/densities/FLATCORE_5.568.dat rename to resources/DetectorParams/densities/FLATCORE_5.568.dat diff --git a/resources/earthparams/densities/MINERvA.dat b/resources/DetectorParams/densities/MINERvA.dat similarity index 100% rename from resources/earthparams/densities/MINERvA.dat rename to resources/DetectorParams/densities/MINERvA.dat diff --git a/resources/earthparams/densities/MiniBooNE.dat b/resources/DetectorParams/densities/MiniBooNE.dat similarity index 100% rename from resources/earthparams/densities/MiniBooNE.dat rename to resources/DetectorParams/densities/MiniBooNE.dat diff --git a/resources/earthparams/densities/PREM_ATLAS.dat b/resources/DetectorParams/densities/PREM_ATLAS.dat similarity index 100% rename from resources/earthparams/densities/PREM_ATLAS.dat rename to resources/DetectorParams/densities/PREM_ATLAS.dat diff --git a/resources/earthparams/densities/PREM_IceCube.dat b/resources/DetectorParams/densities/PREM_IceCube.dat similarity index 100% rename from resources/earthparams/densities/PREM_IceCube.dat rename to resources/DetectorParams/densities/PREM_IceCube.dat diff --git a/resources/earthparams/densities/PREM_dune.dat b/resources/DetectorParams/densities/PREM_dune.dat similarity index 100% rename from resources/earthparams/densities/PREM_dune.dat rename to resources/DetectorParams/densities/PREM_dune.dat diff --git a/resources/earthparams/densities/PREM_mmc_DUNE.dat b/resources/DetectorParams/densities/PREM_mmc_DUNE.dat similarity index 100% rename from resources/earthparams/densities/PREM_mmc_DUNE.dat rename to resources/DetectorParams/densities/PREM_mmc_DUNE.dat diff --git a/resources/earthparams/densities/README b/resources/DetectorParams/densities/README similarity index 100% rename from resources/earthparams/densities/README rename to resources/DetectorParams/densities/README diff --git a/resources/earthparams/densities/legacy/PREM.dat b/resources/DetectorParams/densities/legacy/PREM.dat similarity index 100% rename from resources/earthparams/densities/legacy/PREM.dat rename to resources/DetectorParams/densities/legacy/PREM.dat diff --git a/resources/earthparams/densities/legacy/PREM_mmc.dat b/resources/DetectorParams/densities/legacy/PREM_mmc.dat similarity index 100% rename from resources/earthparams/densities/legacy/PREM_mmc.dat rename to resources/DetectorParams/densities/legacy/PREM_mmc.dat diff --git a/resources/earthparams/densities/legacy/mmc.dat b/resources/DetectorParams/densities/legacy/mmc.dat similarity index 100% rename from resources/earthparams/densities/legacy/mmc.dat rename to resources/DetectorParams/densities/legacy/mmc.dat diff --git a/resources/earthparams/materials/ATLAS.dat b/resources/DetectorParams/materials/ATLAS.dat similarity index 100% rename from resources/earthparams/materials/ATLAS.dat rename to resources/DetectorParams/materials/ATLAS.dat diff --git a/resources/earthparams/materials/AtomicData.csv b/resources/DetectorParams/materials/AtomicData.csv similarity index 100% rename from resources/earthparams/materials/AtomicData.csv rename to resources/DetectorParams/materials/AtomicData.csv diff --git a/resources/earthparams/materials/CCM.dat b/resources/DetectorParams/materials/CCM.dat similarity index 100% rename from resources/earthparams/materials/CCM.dat rename to resources/DetectorParams/materials/CCM.dat diff --git a/resources/earthparams/materials/Fe_Core.dat b/resources/DetectorParams/materials/Fe_Core.dat similarity index 100% rename from resources/earthparams/materials/Fe_Core.dat rename to resources/DetectorParams/materials/Fe_Core.dat diff --git a/resources/earthparams/materials/IceCube.dat b/resources/DetectorParams/materials/IceCube.dat similarity index 100% rename from resources/earthparams/materials/IceCube.dat rename to resources/DetectorParams/materials/IceCube.dat diff --git a/resources/earthparams/materials/MINERvA.dat b/resources/DetectorParams/materials/MINERvA.dat similarity index 100% rename from resources/earthparams/materials/MINERvA.dat rename to resources/DetectorParams/materials/MINERvA.dat diff --git a/resources/earthparams/materials/MiniBooNE.dat b/resources/DetectorParams/materials/MiniBooNE.dat similarity index 100% rename from resources/earthparams/materials/MiniBooNE.dat rename to resources/DetectorParams/materials/MiniBooNE.dat diff --git a/resources/earthparams/materials/SiO2_Mantle.dat b/resources/DetectorParams/materials/SiO2_Mantle.dat similarity index 100% rename from resources/earthparams/materials/SiO2_Mantle.dat rename to resources/DetectorParams/materials/SiO2_Mantle.dat diff --git a/resources/earthparams/materials/Standard.dat b/resources/DetectorParams/materials/Standard.dat similarity index 100% rename from resources/earthparams/materials/Standard.dat rename to resources/DetectorParams/materials/Standard.dat diff --git a/resources/earthparams/materials/Standard_Air.dat b/resources/DetectorParams/materials/Standard_Air.dat similarity index 100% rename from resources/earthparams/materials/Standard_Air.dat rename to resources/DetectorParams/materials/Standard_Air.dat diff --git a/resources/earthparams/materials/Standard_RockIce.dat b/resources/DetectorParams/materials/Standard_RockIce.dat similarity index 100% rename from resources/earthparams/materials/Standard_RockIce.dat rename to resources/DetectorParams/materials/Standard_RockIce.dat diff --git a/resources/earthparams/old_formats/PREM_legacy.dat b/resources/DetectorParams/old_formats/PREM_legacy.dat similarity index 100% rename from resources/earthparams/old_formats/PREM_legacy.dat rename to resources/DetectorParams/old_formats/PREM_legacy.dat diff --git a/resources/earthparams/old_formats/PREM_legacy_mmcnewice.dat b/resources/DetectorParams/old_formats/PREM_legacy_mmcnewice.dat similarity index 100% rename from resources/earthparams/old_formats/PREM_legacy_mmcnewice.dat rename to resources/DetectorParams/old_formats/PREM_legacy_mmcnewice.dat diff --git a/resources/earthparams/old_formats/PREM_mmc.dat b/resources/DetectorParams/old_formats/PREM_mmc.dat similarity index 100% rename from resources/earthparams/old_formats/PREM_mmc.dat rename to resources/DetectorParams/old_formats/PREM_mmc.dat