Loading src/modules/DepositionCosmics/DepositionCosmicsModule.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -112,16 +112,20 @@ DepositionCosmicsModule::DepositionCosmicsModule(Configuration& config, Messenge if(!config_.has("area")) { // Calculate subbox length required from the maximum coordinates of the setup: // Use maximum coordinate instead of setup size to make sure that off-center setups are fully covered LOG(DEBUG) << "Calculating subbox length from setup size"; auto min = geo_manager_->getMinimumCoordinate(); auto max = geo_manager_->getMaximumCoordinate(); auto size = std::max(max.x() - min.x(), max.y() - min.y()); // Round calculated value up to 10 cm auto size_meters = static_cast<double>(std::ceil(Units::convert(size, "m") * 10.0)) / 10.0; std::vector<double> max_candidates = {max.x(), max.y(), min.x(), min.y()}; auto size = *std::max_element( begin(max_candidates), end(max_candidates), [](double a, double b) { return std::fabs(a) < std::fabs(b); }); // Round margins up to 10 cm auto size_meters = static_cast<double>(std::ceil(Units::convert(2 * size, "m") * 10.0)) / 10.0; if(size_meters > 300) { throw ModuleError("Size of the setup too large, tabulated data only available for areas up to 300m"); } LOG(DEBUG) << "Maximum side length (in x,y): " << Units::display(size, {"mm", "cm", "m"}) LOG(DEBUG) << "Maximum absolute coordinate (in x,y): " << Units::display(size, {"mm", "cm", "m"}) << ", selecting subbox of size " << size_meters << "m"; cry_config << " subboxLength " << size_meters; } else { Loading src/modules/DepositionCosmics/tests/03-subbox.conf +2 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ #DESC test if the correct subbox letngth for the simulated shower is calculated from the detector model and world volume [AllPix] number_of_events = 1 detectors_file = "detector_large.conf" detectors_file = "detector_large_shifted.conf" random_seed = 0 model_paths = "./" Loading @@ -15,5 +15,5 @@ world_material = "air" physics_list = FTFP_BERT_LIV log_level = DEBUG #PASS Maximum side length (in x,y): 1.2445m, selecting subbox of size 1.3m #PASS Maximum absolute coordinate (in x,y): 82.225cm, selecting subbox of size 1.7m #FAIL FATAL src/modules/DepositionCosmics/tests/detector_large_shifted.conf 0 → 100644 +8 −0 Original line number Diff line number Diff line # SPDX-FileCopyrightText: 2021-2022 CERN and the Allpix Squared authors # SPDX-License-Identifier: MIT [telescope0] type = "timepix_large" position = 0um 20cm -50mm orientation_mode = "xyz" orientation = 0 0 180deg Loading
src/modules/DepositionCosmics/DepositionCosmicsModule.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -112,16 +112,20 @@ DepositionCosmicsModule::DepositionCosmicsModule(Configuration& config, Messenge if(!config_.has("area")) { // Calculate subbox length required from the maximum coordinates of the setup: // Use maximum coordinate instead of setup size to make sure that off-center setups are fully covered LOG(DEBUG) << "Calculating subbox length from setup size"; auto min = geo_manager_->getMinimumCoordinate(); auto max = geo_manager_->getMaximumCoordinate(); auto size = std::max(max.x() - min.x(), max.y() - min.y()); // Round calculated value up to 10 cm auto size_meters = static_cast<double>(std::ceil(Units::convert(size, "m") * 10.0)) / 10.0; std::vector<double> max_candidates = {max.x(), max.y(), min.x(), min.y()}; auto size = *std::max_element( begin(max_candidates), end(max_candidates), [](double a, double b) { return std::fabs(a) < std::fabs(b); }); // Round margins up to 10 cm auto size_meters = static_cast<double>(std::ceil(Units::convert(2 * size, "m") * 10.0)) / 10.0; if(size_meters > 300) { throw ModuleError("Size of the setup too large, tabulated data only available for areas up to 300m"); } LOG(DEBUG) << "Maximum side length (in x,y): " << Units::display(size, {"mm", "cm", "m"}) LOG(DEBUG) << "Maximum absolute coordinate (in x,y): " << Units::display(size, {"mm", "cm", "m"}) << ", selecting subbox of size " << size_meters << "m"; cry_config << " subboxLength " << size_meters; } else { Loading
src/modules/DepositionCosmics/tests/03-subbox.conf +2 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ #DESC test if the correct subbox letngth for the simulated shower is calculated from the detector model and world volume [AllPix] number_of_events = 1 detectors_file = "detector_large.conf" detectors_file = "detector_large_shifted.conf" random_seed = 0 model_paths = "./" Loading @@ -15,5 +15,5 @@ world_material = "air" physics_list = FTFP_BERT_LIV log_level = DEBUG #PASS Maximum side length (in x,y): 1.2445m, selecting subbox of size 1.3m #PASS Maximum absolute coordinate (in x,y): 82.225cm, selecting subbox of size 1.7m #FAIL FATAL
src/modules/DepositionCosmics/tests/detector_large_shifted.conf 0 → 100644 +8 −0 Original line number Diff line number Diff line # SPDX-FileCopyrightText: 2021-2022 CERN and the Allpix Squared authors # SPDX-License-Identifier: MIT [telescope0] type = "timepix_large" position = 0um 20cm -50mm orientation_mode = "xyz" orientation = 0 0 180deg