Commit 5f355f73 authored by Paul Jean Schutze's avatar Paul Jean Schutze
Browse files

Merge branch '161-prep' into 'v1.6-stable'

Preparation for v1.6.1 release

See merge request !411
parents 7d8efeb1 52880ffa
Pipeline #2268907 passed with stages
in 35 minutes and 43 seconds
......@@ -433,7 +433,7 @@ cmp:doxygen:
- mkdir build
- cd build
- cmake -DBUILD_DOCS_ONLY=ON ..
- make reference
- make Allpix-reference
- mv reference/html ../public/reference
# Compile LaTeX user manual:
......
......@@ -4,12 +4,13 @@ IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW) # change linker path search behaviour
CMAKE_POLICY(SET CMP0048 NEW) # set project version
IF(${CMAKE_VERSION} VERSION_GREATER "3.13")
CMAKE_POLICY(SET CMP0077 NEW) # allow overwriting options with normal variables
CMAKE_POLICY(SET CMP0079 NEW) # Allow lookup of linking libraries in other directories
ENDIF()
ENDIF(COMMAND CMAKE_POLICY)
# Set default version
SET(ALLPIX_VERSION "v1.6.0")
SET(ALLPIX_VERSION "v1.6.1")
# Set default build type
IF(NOT CMAKE_BUILD_TYPE)
......
......@@ -84,6 +84,7 @@ The following authors, in alphabetical order, have contributed to Allpix<sup>2</
* Thomas Billoud, Université de Montréal, @tbilloud
* Tobias Bisanz, CERN, @tbisanz
* Koen van den Brandt, Nikhef, @kvandenb
* Carsten Daniel Burgard, DESY @cburgard
* Liejian Chen, Institute of High Energy Physics Beijing, @chenlj
* Katharina Dort, University of Gie\ss en, @kdort
* Neal Gauvin, Université de Genève, @ngauvin
......
......@@ -5,8 +5,8 @@
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/reference/Doxyfile.in ${CMAKE_BINARY_DIR}/reference/Doxyfile @ONLY)
ADD_CUSTOM_TARGET(reference
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/reference/Doxyfile.in ${CMAKE_BINARY_DIR}/reference/Doxyfile @ONLY)
ADD_CUSTOM_TARGET(${CMAKE_PROJECT_NAME}-reference
${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/reference/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/reference
COMMENT "Generating API documentation with Doxygen"
......@@ -27,7 +27,7 @@ FIND_PACKAGE(LATEX)
IF(LATEX_COMPILER)
MESSAGE(STATUS "Found LaTeX compiler.")
SET(LATEX_COMPILER_FLAGS "-shell-escape" "-interaction nonstopmode" "-halt-on-error" "-file-line-error" CACHE STRING "Flags passed to latex.")
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/LATEX.cmake)
INCLUDE(${PROJECT_SOURCE_DIR}/cmake/LATEX.cmake)
SET(HTLATEX_COMPILER_TEX4HT_FLAGS "usermanual/html/allpix,charset=utf-8" CACHE STRING "Flags passed to Tex4HT" FORCE)
SET(HTLATEX_COMPILER_TEX4HT_POSTPROCESSOR_FLAGS "-utf8 -cunihtf" CACHE STRING "Flags passed to the postprocessor of Tex4HT" FORCE)
......@@ -39,10 +39,10 @@ IF(LATEX_COMPILER)
)
# Check for pandoc for markdown conversion
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/PANDOC.cmake)
INCLUDE(${PROJECT_SOURCE_DIR}/cmake/PANDOC.cmake)
IF(PANDOC_EXECUTABLE)
# Loop through all modules and fetch their README
SET(module_dir ${CMAKE_SOURCE_DIR}/src/modules)
SET(module_dir ${PROJECT_SOURCE_DIR}/src/modules)
FILE(GLOB subdirs RELATIVE ${module_dir} ${module_dir}/*)
FOREACH(subdir ${subdirs})
IF(EXISTS ${module_dir}/${subdir}/README.md AND NOT ${subdir} STREQUAL "Dummy")
......@@ -58,7 +58,7 @@ IF(LATEX_COMPILER)
ENDFOREACH()
# Loop through all modules and fetch their README
SET(example_dir ${CMAKE_SOURCE_DIR}/examples)
SET(example_dir ${PROJECT_SOURCE_DIR}/examples)
FILE(GLOB subdirs RELATIVE ${example_dir} ${example_dir}/*)
FOREACH(subdir ${subdirs})
IF(EXISTS ${example_dir}/${subdir}/README.md)
......@@ -82,7 +82,7 @@ IF(LATEX_COMPILER)
ADD_PANDOC_DOCUMENT(
${CMAKE_BINARY_DIR}/usermanual/md/${readme_parent_dir}/${readme_dir_name}.tex
SOURCES ${CMAKE_SOURCE_DIR}/${doc_readme_file}
SOURCES ${PROJECT_SOURCE_DIR}/${doc_readme_file}
PRODUCT_DIRECTORY usermanual/md/${readme_parent_dir}/
PANDOC_DIRECTIVES -t latex --listings --biblatex
NO_EXPORT_PRODUCT
......
......@@ -17,6 +17,7 @@ The following authors, in alphabetical order, have contributed to \apsq:
\item Thomas Billoud, Université de Montréal
\item Tobias Bisanz, CERN
\item Koen van den Brandt, Nikhef
\item Carsten Daniel Burgard, DESY
\item Liejian Chen, Institute of High Energy Physics Beijing
\item Katharina Dort, University of Gie\ss en
\item Neal Gauvin, Université de Genève
......
......@@ -20,7 +20,7 @@ ELSE()
ENDIF()
# Generate the ROOT dictionary
ROOT_GENERATE_DICTIONARY(CorryvreckanObjectsDictionary
ROOT_GENERATE_DICTIONARY(CorryvreckanWriterObjectsDictionary
${CMAKE_CURRENT_SOURCE_DIR}/corryvreckan/Object.hpp
${CMAKE_CURRENT_SOURCE_DIR}/corryvreckan/Pixel.hpp
${CMAKE_CURRENT_SOURCE_DIR}/corryvreckan/MCParticle.hpp
......@@ -31,26 +31,26 @@ ROOT_GENERATE_DICTIONARY(CorryvreckanObjectsDictionary
-inlineInputHeader
-I${CMAKE_CURRENT_SOURCE_DIR}/corryvreckan
MODULE
CorryvreckanObjects
CorryvreckanWriterObjects
)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/CorryvreckanObjectsDictionary.cxx
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/CorryvreckanWriterObjectsDictionary.cxx
PROPERTIES GENERATED TRUE COMPILE_FLAGS "-w" # or whatever ?
)
# Define the library adding the object file created above
ADD_LIBRARY(CorryvreckanObjects SHARED
ADD_LIBRARY(CorryvreckanWriterObjects SHARED
corryvreckan/Object.cpp
corryvreckan/Pixel.cpp
corryvreckan/Event.cpp
${CMAKE_CURRENT_BINARY_DIR}/CorryvreckanObjectsDictionary.cxx
${CMAKE_CURRENT_BINARY_DIR}/CorryvreckanWriterObjectsDictionary.cxx
)
# Link the standard dependencies
TARGET_LINK_LIBRARIES(CorryvreckanObjects ${ALLPIX_DEPS_LIBRARIES})
TARGET_LINK_LIBRARIES(CorryvreckanWriterObjects ${ALLPIX_DEPS_LIBRARIES})
# Specify install for the messages
INSTALL(TARGETS CorryvreckanObjects
INSTALL(TARGETS CorryvreckanWriterObjects
COMPONENT modules
EXPORT Allpix
RUNTIME DESTINATION bin
......@@ -58,8 +58,8 @@ INSTALL(TARGETS CorryvreckanObjects
# Also install the dictionary objects
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/libCorryvreckanObjects_rdict.pcm
${CMAKE_CURRENT_BINARY_DIR}/libCorryvreckanObjects.rootmap
${CMAKE_CURRENT_BINARY_DIR}/libCorryvreckanWriterObjects_rdict.pcm
${CMAKE_CURRENT_BINARY_DIR}/libCorryvreckanWriterObjects.rootmap
COMPONENT modules
DESTINATION lib)
......@@ -68,7 +68,7 @@ ALLPIX_MODULE_SOURCES(${MODULE_NAME}
CorryvreckanWriterModule.cpp
)
TARGET_LINK_LIBRARIES(${MODULE_NAME} CorryvreckanObjects ROOT::Tree)
TARGET_LINK_LIBRARIES(${MODULE_NAME} CorryvreckanWriterObjects ROOT::Tree)
# Provide standard install target
ALLPIX_MODULE_INSTALL(${MODULE_NAME})
......@@ -306,11 +306,10 @@ void DepositionReaderModule::run(unsigned int event) {
if(!mc_particle_time[detector].empty()) {
time_reference = *std::min_element(mc_particle_time[detector].begin(), mc_particle_time[detector].end());
LOG(DEBUG) << "Earliest MCParticle arrived on detector " << detector->getName() << " at "
<< Units::display(time_reference, {"ns", "ps"}) << " global";
}
LOG(DEBUG) << "Earliest MCParticle arrived on detector " << detector->getName() << " at "
<< Units::display(time_reference, {"ns", "ps"}) << " global";
std::vector<MCParticle> mc_particles;
for(size_t i = 0; i < mc_particle_start[detector].size(); i++) {
auto start_global = mc_particle_start[detector].at(i);
......@@ -336,8 +335,9 @@ void DepositionReaderModule::run(unsigned int event) {
}
// Send the mc particle information if available
bool has_mcparticles = !mc_particles.empty();
auto mc_particle_message = std::make_shared<MCParticleMessage>(std::move(mc_particles), detector);
if(!mc_particles.empty()) {
if(has_mcparticles) {
messenger_->dispatchMessage(this, mc_particle_message);
}
......
......@@ -46,16 +46,6 @@ using namespace allpix;
DetectorConstructionG4::DetectorConstructionG4(GeometryManager* geo_manager) : geo_manager_(geo_manager) {}
/**
* @brief Version of std::make_shared that does not delete the pointer
*
* This version is needed because some pointers are deleted by Geant4 internally, but they are stored as std::shared_ptr in
* the framework.
*/
template <typename T, typename... Args> static std::shared_ptr<T> make_shared_no_delete(Args... args) {
return std::shared_ptr<T>(new T(args...), [](T*) {});
}
void DetectorConstructionG4::build(std::map<std::string, G4Material*> materials_,
const std::shared_ptr<G4LogicalVolume>& world_log) {
......
......@@ -47,16 +47,6 @@ GeometryConstructionG4::GeometryConstructionG4(GeometryManager* geo_manager, Con
passive_builder_->registerVolumes();
}
/**
* @brief Version of std::make_shared that does not delete the pointer
*
* This version is needed because some pointers are deleted by Geant4 internally, but they are stored as std::shared_ptr in
* the framework.
*/
template <typename T, typename... Args> static std::shared_ptr<T> make_shared_no_delete(Args... args) {
return std::shared_ptr<T>(new T(args...), [](T*) {});
}
/**
* First initializes all the materials. Then constructs the world from the internally calculated world size with a certain
* margin. Finally builds all the individual detectors.
......
......@@ -9,30 +9,7 @@
*/
#include "PassiveMaterialConstructionG4.hpp"
#include <functional>
#include <memory>
#include <string>
#include <utility>
#include <Math/RotationX.h>
#include <Math/RotationY.h>
#include <Math/RotationZ.h>
#include <Math/RotationZYX.h>
#include <Math/Vector3D.h>
#include <G4LogicalVolume.hh>
#include <G4LogicalVolumeStore.hh>
#include <G4PVPlacement.hh>
#include <G4RotationMatrix.hh>
#include <G4ThreeVector.hh>
#include <G4VisAttributes.hh>
#include "Passive_Material_Models/BoxModel.hpp"
#include "Passive_Material_Models/CylinderModel.hpp"
#include "Passive_Material_Models/SphereModel.hpp"
#include "core/module/exceptions.h"
#include "tools/ROOT.h"
#include "tools/geant4.h"
using namespace allpix;
using namespace ROOT::Math;
......
......@@ -10,13 +10,11 @@
#ifndef ALLPIX_MODULE_PASSIVE_MATERIAL_CONSTRUCTION_H
#define ALLPIX_MODULE_PASSIVE_MATERIAL_CONSTRUCTION_H
#include <memory>
#include <utility>
#include <vector>
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "core/config/Configuration.hpp"
#include <G4LogicalVolume.hh>
#include <G4Material.hh>
#include "core/geometry/GeometryManager.hpp"
#include "PassiveMaterialModel.hpp"
......
......@@ -8,26 +8,11 @@
* Intergovernmental Organization or submit itself to any jurisdiction.
*/
#include <memory>
#include <string>
#include <utility>
#include <Math/RotationX.h>
#include <Math/RotationY.h>
#include <Math/RotationZ.h>
#include <Math/RotationZYX.h>
#include <Math/Vector3D.h>
#include <G4Box.hh>
#include <G4IntersectionSolid.hh>
#include <G4Sphere.hh>
#include <G4SubtractionSolid.hh>
#include <G4Tubs.hh>
#include <G4UnionSolid.hh>
#include "G4Material.hh"
#include <G4LogicalVolume.hh>
#include <G4LogicalVolumeStore.hh>
#include <G4Material.hh>
#include <G4PVPlacement.hh>
#include <G4RotationMatrix.hh>
#include <G4ThreeVector.hh>
......@@ -38,23 +23,13 @@
#include "tools/geant4.h"
#include "PassiveMaterialModel.hpp"
#include "Passive_Material_Models/BoxModel.hpp"
#include "Passive_Material_Models/CylinderModel.hpp"
#include "Passive_Material_Models/SphereModel.hpp"
#include "passive_models/BoxModel.hpp"
#include "passive_models/CylinderModel.hpp"
#include "passive_models/SphereModel.hpp"
using namespace allpix;
using namespace ROOT::Math;
/**
* @brief Version of std::make_shared that does not delete the pointer
*
* This version is needed because some pointers are deleted by Geant4 internally, but they are stored as std::shared_ptr in
* the framework.
*/
template <typename T, typename... Args> static std::shared_ptr<T> make_shared_no_delete(Args... args) {
return std::shared_ptr<T>(new T(args...), [](T*) {});
}
std::shared_ptr<PassiveMaterialModel>
allpix::PassiveMaterialModel::factory(const std::string& type, const Configuration& config, GeometryManager* geo_manager) {
if(type == "box") {
......@@ -119,11 +94,7 @@ void PassiveMaterialModel::buildVolume(const std::map<std::string, G4Material*>&
LOG(TRACE) << " -Position\t\t:\t " << Units::display(position_, {"mm", "um"});
// Get the solid from the Model
auto solid = std::shared_ptr<G4VSolid>(getSolid());
if(solid == nullptr) {
throw ModuleError("Passive Material '" + getName() + "' does not have a solid associated with its model");
}
solids_.push_back(solid);
auto solid = getSolid();
// Place the logical volume of the passive material
auto log_volume = make_shared_no_delete<G4LogicalVolume>(solid.get(), materials.at(material), getName() + "_log");
......
......@@ -16,22 +16,13 @@
#ifndef ALLPIX_MODULE_PASSIVE_MATERIAL_MODEL_H
#define ALLPIX_MODULE_PASSIVE_MATERIAL_MODEL_H
#include <array>
#include <string>
#include <utility>
#include <Math/Point2D.h>
#include <Math/Point3D.h>
#include <Math/Vector2D.h>
#include <Math/Vector3D.h>
#include "core/config/Configuration.hpp"
#include "core/config/exceptions.h"
#include "core/geometry/GeometryManager.hpp"
#include "core/utils/log.h"
#include "tools/ROOT.h"
#include "G4VSolid.hh"
#include <G4VSolid.hh>
namespace allpix {
/**
......@@ -65,14 +56,15 @@ namespace allpix {
/**
* @brief Virtual function that will return a G4VSolid corresponding to the specific model
* @return Nullptr if no valid model type is defined
* @return Shared pointer to the model solid
*/
virtual G4VSolid* getSolid() const { return nullptr; }
virtual std::shared_ptr<G4VSolid> getSolid() const = 0;
/**
* @brief Virtual function that will return the maximum size parameter of the model
* @return 0 if no valid model type is defined
* @return Maximum size of the model
*/
virtual double getMaxSize() const { return 0; }
virtual double getMaxSize() const = 0;
void buildVolume(const std::map<std::string, G4Material*>& materials,
const std::shared_ptr<G4LogicalVolume>& world_log);
......
......@@ -12,13 +12,6 @@
#define ALLPIX_PASSIVE_MATERIAL_BOX_H
#include <string>
#include <utility>
#include <Math/Cartesian2D.h>
#include <Math/DisplacementVector2D.h>
#include <Math/Point3D.h>
#include <Math/Vector2D.h>
#include <Math/Vector3D.h>
#include <G4Box.hh>
#include <G4SubtractionSolid.hh>
......@@ -71,15 +64,19 @@ namespace allpix {
}
// Create the G4VSolids which make the Box
auto outer_volume =
new G4Box(name + "_outer_volume", outer_size_.x() / 2, outer_size_.y() / 2, outer_size_.z() / 2);
auto outer_volume = make_shared_no_delete<G4Box>(
name + "_outer_volume", outer_size_.x() / 2, outer_size_.y() / 2, outer_size_.z() / 2);
if(inner_size_ == ROOT::Math::XYZVector()) {
solid_ = outer_volume;
} else {
auto inner_volume =
new G4Box(name + "_inner_volume", inner_size_.x() / 2, inner_size_.y() / 2, inner_size_.z() / 2);
auto inner_volume = make_shared_no_delete<G4Box>(
name + "_inner_volume", inner_size_.x() / 2, inner_size_.y() / 2, inner_size_.z() / 2);
solid_ = std::make_shared<G4SubtractionSolid>(name + "_volume", outer_volume.get(), inner_volume.get());
solid_ = new G4SubtractionSolid(name + "_volume", outer_volume, inner_volume);
// Keep references to the solids created because G4SubtractionSolid does not assume ownership
solids_.push_back(outer_volume);
solids_.push_back(inner_volume);
}
// Get the maximum of the size parameters
max_size_ = std::max(outer_size_.x(), std::max(outer_size_.y(), outer_size_.z()));
......@@ -89,12 +86,12 @@ namespace allpix {
}
// Set the override functions of PassiveMaterialModel
G4VSolid* getSolid() const override { return solid_; }
std::shared_ptr<G4VSolid> getSolid() const override { return solid_; }
double getMaxSize() const override { return max_size_; }
private:
// G4VSolid returnables
G4VSolid* solid_;
std::shared_ptr<G4VSolid> solid_;
// G4VSolid specifications
ROOT::Math::XYZVector outer_size_;
......
......@@ -12,13 +12,6 @@
#define ALLPIX_PASSIVE_MATERIAL_CYLINDER_H
#include <string>
#include <utility>
#include <Math/Cartesian2D.h>
#include <Math/DisplacementVector2D.h>
#include <Math/Point3D.h>
#include <Math/Vector2D.h>
#include <Math/Vector3D.h>
#include <G4Tubs.hh>
......@@ -63,7 +56,8 @@ namespace allpix {
}
// Create the G4VSolids which make the cylinder
solid_ = new G4Tubs(name + "_volume", inner_radius_, outer_radius_, length_ / 2, starting_angle_, arc_length_);
solid_ = make_shared_no_delete<G4Tubs>(
name + "_volume", inner_radius_, outer_radius_, length_ / 2, starting_angle_, arc_length_);
// Get the maximum of the size parameters
max_size_ = std::max(2 * outer_radius_, length_);
......@@ -73,12 +67,12 @@ namespace allpix {
}
// Set the override functions of PassiveMaterialModel
G4Tubs* getSolid() const override { return solid_; }
std::shared_ptr<G4VSolid> getSolid() const override { return solid_; }
double getMaxSize() const override { return max_size_; }
private:
// G4VSolid returnables
G4Tubs* solid_;
std::shared_ptr<G4VSolid> solid_;
// G4VSolid specifications
double inner_radius_;
......
......@@ -12,13 +12,6 @@
#define ALLPIX_PASSIVE_MATERIAL_SPHERE_H
#include <string>
#include <utility>
#include <Math/Cartesian2D.h>
#include <Math/DisplacementVector2D.h>
#include <Math/Point3D.h>
#include <Math/Vector2D.h>
#include <Math/Vector3D.h>
#include <G4Sphere.hh>
......@@ -73,13 +66,13 @@ namespace allpix {
setArcLengthTheta(180 * CLHEP::deg - starting_angle_theta_);
}
// Create the G4VSolids which make the sphere
solid_ = new G4Sphere(name + "_volume",
inner_radius_,
outer_radius_,
starting_angle_phi_,
arc_length_phi_,
starting_angle_theta_,
arc_length_theta_);
solid_ = make_shared_no_delete<G4Sphere>(name + "_volume",
inner_radius_,
outer_radius_,
starting_angle_phi_,
arc_length_phi_,
starting_angle_theta_,
arc_length_theta_);
// Get the maximum of the size parameters
max_size_ = 2 * outer_radius_;
......@@ -89,12 +82,12 @@ namespace allpix {
}
// Set the override functions of PassiveMaterialModel
G4Sphere* getSolid() const override { return solid_; }
std::shared_ptr<G4VSolid> getSolid() const override { return solid_; }
double getMaxSize() const override { return max_size_; }
private:
// G4VSolid returnables
G4Sphere* solid_;
std::shared_ptr<G4VSolid> solid_;
// G4VSolid specifications
double inner_radius_;
......
......@@ -22,6 +22,16 @@
#include "core/utils/text.h"
#include "core/utils/type.h"
/**
* @brief Version of std::make_shared that does not delete the pointer
*
* This version is needed because some pointers are deleted by Geant4 internally, but they are stored as std::shared_ptr in
* the framework.
*/
template <typename T, typename... Args> static std::shared_ptr<T> make_shared_no_delete(Args... args) {
return std::shared_ptr<T>(new T(args...), [](T*) {});
}
namespace allpix {
/**
* @ingroup StringConversions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment