15#define BOOST_TEST_MODULE Test MCHSimulation GeometryTransformer
16#define BOOST_TEST_DYN_LINK
18#include <boost/test/unit_test.hpp>
23#include "TGeoManager.h"
24#include "boost/format.hpp"
25#include <boost/test/data/test_case.hpp>
29#include <fmt/format.h>
32namespace bdata = boost::unit_test::data;
40 static std::vector<o2::mch::geo::TransformationCreator> vtrans;
42 BOOST_REQUIRE(boost::unit_test::framework::master_test_suite().argc == 2);
49 BOOST_TEST_REQUIRE(boost::unit_test::framework::master_test_suite().argc == 2);
50 std::string jsonInput = boost::unit_test::framework::master_test_suite().argv[1];
51 std::ifstream in(jsonInput);
59constexpr double rad2deg = 180.0 / 3.14159265358979323846;
60constexpr double deg2rad = 3.14159265358979323846 / 180.0;
64 std::cout << fmt::format(
65 "{:7.3f} {:7.3f} {:7.3f}\n"
66 "{:7.3f} {:7.3f} {:7.3f}\n"
67 "{:7.3f} {:7.3f} {:7.3f}\n",
75 for (
auto detElemId :
o2::mch::geo::
allDeIds) {
82 const auto someInvalidDetElemIds = {99, 105, 1026};
84 for (
auto detElemId : someInvalidDetElemIds) {
85 BOOST_CHECK_THROW((
transformation(tindex)(detElemId)), std::runtime_error);
89struct CoarseLocation {
95constexpr CoarseLocation
topLeft{
false,
true};
101 std::string
s = q.isTop ?
"TOP" :
"BOTTOM";
102 s += q.isRight ?
"RIGHT" :
"LEFT";
108 return a.isRight ==
b.isRight &&
a.isTop ==
b.isTop;
117 if (detElemId < 500) {
120 localTestPos.SetXYZ(60, 60, 0);
130 localTestPos.SetXYZ(-72.50, 19.75, 0.0);
134 localTestPos.SetXYZ(-77.50, 19.75, 0.0);
144 localTestPos.SetXYZ(95.0, -19.75, 0);
149 t.LocalToMaster(localTestPos, master);
150 bool right = master.x() > 10.;
151 bool top = master.y() > -10.;
158 for (
int deid = firstDeId; deid <= lastDeId; deid++) {
165 std::map<int, CoarseLocation>
expected;
167 for (
int i = 0;
i < 4;
i++) {
175 for (
int i = 0;
i < 2;
i++) {
182 for (
int i = 0;
i < 4;
i++) {
189 for (
auto detElemId :
o2::mch::geo::allDeIds) {
191 std::cout <<
"got no expectation for DE=" << detElemId <<
"\n";
194 BOOST_TEST_INFO_SCOPE(fmt::format(
"DeId {}", detElemId));
201 std::random_device
rd;
202 std::mt19937 mt(
rd());
203 std::vector<std::tuple<double, double, double>> testAngles;
206 testAngles.resize(
n);
207 constexpr double pi = 3.14159265358979323846;
208 std::uniform_real_distribution<double> dist{-pi / 2.0, pi / 2.0};
209 std::uniform_real_distribution<double> dist2{-pi, pi};
210 std::generate(testAngles.begin(), testAngles.end(), [&dist, &dist2, &mt] {
211 return std::tuple<double, double, double>{dist2(mt), dist(mt), dist2(mt)};
214 testAngles.emplace_back(-pi, pi / 2.0, 0);
215 for (
auto a : testAngles) {
216 auto [yaw, pitch, roll] =
a;
219 BOOST_TEST_INFO_SCOPE(fmt::format(
220 " input yaw {:7.2f} pitch {:7.2f} roll {:7.2f}\n"
221 "output yaw {:7.2f} pitch {:7.2f} roll {:7.2f}\n",
224 BOOST_CHECK_CLOSE(
y, yaw, 1E-6);
225 BOOST_CHECK_CLOSE(p, pitch, 1E-6);
226 BOOST_CHECK_CLOSE(
r, roll, 1E-6);
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Interface for MCH geometry creation.
BOOST_DATA_TEST_CASE(DefaultConstructorNofSamplesIsInvariant, boost::unit_test::data::make(nsamples), nofSamples)
GLdouble GLdouble GLdouble GLdouble top
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
void addAlignableVolumes(TGeoManager &geom)
TransformationCreator transformationFromJSON(std::istream &in)
std::tuple< double, double, double > matrix2angles(gsl::span< double > rot)
std::array< int, 156 > allDeIds
std::array< double, 9 > angles2matrix(double yaw, double pitch, double roll)
TransformationCreator transformationFromTGeoManager(const TGeoManager &geo)
std::function< o2::math_utils::Transform3D(int detElemId)> TransformationCreator
void createStandaloneGeometry()
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::map< std::string, ID > expected
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())