15#define BOOST_TEST_MODULE Test MID simulation
16#define BOOST_TEST_DYN_LINK
18#include <boost/test/unit_test.hpp>
23#include <boost/test/data/test_case.hpp>
27#include "TGeoManager.h"
31BOOST_AUTO_TEST_SUITE(o2_mid_simulation)
36 if (gGeoManager && gGeoManager->GetTopVolume()) {
37 std::cerr <<
"Can only call this function with an empty geometry, i.e. gGeoManager==nullptr "
38 <<
" or gGeoManager->GetTopVolume()==nullptr\n";
40 TGeoManager* gm =
new TGeoManager(
"MID-ONLY",
"ALICE MID Standalone Geometry");
41 TGeoMaterial* mat =
new TGeoMaterial(
"Vacuum", 0, 0, 0);
42 TGeoMedium* med =
new TGeoMedium(
"Vacuum", 1, mat);
43 TGeoVolume*
top = gGeoManager->MakeBox(
name, med, 2000.0, 2000.0, 3000.0);
44 gm->SetTopVolume(
top);
57 std::random_device
rd;
58 std::mt19937 mt(
rd());
59 std::uniform_real_distribution<double> distX(-127.5, 127.5);
60 std::uniform_real_distribution<double> distY(-40., 40.);
61 std::uniform_int_distribution<int> distDE(0, 71);
63 std::vector<LocalPoint> localPoints;
65 for (
int ipt = 0; ipt < npoints; ++ipt) {
66 localPoints.emplace_back(distDE(mt), distX(mt), distY(mt));
73 return std::fabs(
b -
a) < 1E-4;
92 int deId = localPt.
deId;
96 std::cout <<
"got different positions for deId " << deId <<
" : got (" <<
p1.x() <<
", " <<
p1.y() <<
", " <<
p1.z() <<
") expected (" <<
p2.x() <<
", " <<
p2.y() <<
", " <<
p2.z() <<
")\n";
113 for (
auto& tp : positions) {
119BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(Geometry_test)
constexpr int p1()
constexpr to accelerate the coordinates changing
Implementation of the trigger-stations geometry.
std::vector< LocalPoint > getPositions(int npoints)
int testOnePosition(const LocalPoint &localPt, const o2::mid::GeometryTransformer &geoTrans, const o2::mid::GeometryTransformer &geoTransFromManager)
void createStandaloneGeometry(const char *name)
bool areEqual(double a, double b)
GLdouble GLdouble GLdouble GLdouble top
GLuint const GLchar * name
GLboolean GLboolean GLboolean b
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLboolean GLboolean GLboolean GLboolean a
GeometryTransformer createTransformationFromManager(const TGeoManager *geoManager)
void createGeometry(TGeoVolume &topVolume)
create MID geometry and attach it to existing topVolume
GeometryTransformer createDefaultTransformer()
LocalPoint(int ide, double x, double y)
BOOST_TEST(digits==digitsD, boost::test_tools::per_element())