1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/// \file shape_testPolyhedron.h
/// \author: Mihaela Gheata (mihaela.gheata@cern.ch)
#include "../benchmark/ArgParser.h"
#include "ShapeTester.h"
#include "VecGeom/volumes/PlacedVolume.h"
#include "VecGeom/volumes/Polyhedron.h"
typedef vecgeom::SimplePolyhedron Polyhedron_t;
using vecgeom::Precision;
int main(int argc, char *argv[])
{
if (argc == 1) {
std::cout << "Usage: shape_testPolyhedron -test <#>:\n"
" 0 - case 0\n"
" 1 - case 1\n";
}
OPTION_INT(npoints, 10000);
OPTION_BOOL(debug, false);
OPTION_BOOL(stat, false);
OPTION_INT(type, 0);
using namespace vecgeom;
Polyhedron_t *solid = 0;
switch (type) {
case 0: {
// Non-zero alpha, theta, phi
std::cout << "Testing polyhedron #0\n";
Precision phiStart = 0., deltaPhi = 120. * kDegToRad;
int sides = 4;
constexpr int nPlanes = 5;
Precision zPlanes[nPlanes] = {-2, -1, 1, 1, 2};
Precision rInner[nPlanes] = {0, 1, 0.5, 1, 0};
Precision rOuter[nPlanes] = {1, 2, 2, 2.5, 1};
solid = new Polyhedron_t("test_VecGeomPolyhedron", phiStart, deltaPhi, sides, nPlanes, zPlanes, rInner, rOuter);
} break;
case 1:
// Polyhedron degenerated to box
std::cout << "NOT implemented polyhedron #1\n";
return 1;
break;
default:
std::cout << "Unknown test case.\n";
}
if (!solid) return 0;
ShapeTester<vecgeom::VPlacedVolume> tester;
tester.setDebug(debug);
tester.setStat(stat);
tester.SetMaxPoints(npoints);
tester.SetTestBoundaryErrors(false);
int errCode = tester.Run(solid);
std::cout << "Final Error count for Shape *** " << solid->GetName() << "*** = " << errCode << "\n";
std::cout << "=========================================================" << std::endl;
if (solid) delete solid;
return 0;
}
|