Project
Loading...
Searching...
No Matches
o2::cad::harness Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  Offender
 
struct  Ray
 
struct  SampleConfig
 Parameters of generateSamples; the counts are targets, and a category may come back short. More...
 
struct  SampleSet
 
struct  TimingResult
 
struct  ValidationOptions
 
struct  ValidationResult
 

Typedefs

using Point3D = std::array< double, 3 >
 

Functions

SampleSet generateSamples (const TGeoShape *reference, const Point3D &bboxMin, const Point3D &bboxMax, const SampleConfig &cfg={})
 A deterministic sample set from cfg.seed and the bbox; reference, the trusted mesh, classifies the points.
 
ValidationResult validateContains (const TGeoShape *candidate, const TGeoShape *reference, const std::vector< Point3D > &points, const ValidationOptions &opt={})
 
ValidationResult validateDistFromOutside (const TGeoShape *candidate, const TGeoShape *reference, const std::vector< Ray > &rays, const ValidationOptions &opt={})
 
ValidationResult validateDistFromInside (const TGeoShape *candidate, const TGeoShape *reference, const std::vector< Ray > &rays, const ValidationOptions &opt={})
 
ValidationResult validateSafety (const TGeoShape *shape, const std::vector< Point3D > &points, const ValidationOptions &opt={})
 Check one shape's Safety() lower-bound contract against its own DistFrom* along six probe directions; never compares two shapes.
 
ValidationResult validateContainsAgainstOracle (const TGeoShape *candidate, const std::vector< Point3D > &points, const std::vector< int > &oracleState, const std::vector< double > &oracleBoundaryDistance, const ValidationOptions &opt={})
 oracleState: 1 inside, 0 outside, -1 declined; oracleBoundaryDistance may cover only a prefix of points.
 
ValidationResult validateDistanceAgainstOracle (const TGeoShape *candidate, const std::vector< Ray > &rays, const std::vector< double > &oracleDistance, bool wantInside, const ValidationOptions &opt={}, const std::vector< int > &oracleOriginState={})
 
ValidationResult validateSafetyAgainstOracle (const TGeoShape *candidate, const std::vector< Point3D > &points, const std::vector< double > &oracleBoundaryDistance, const ValidationOptions &opt={})
 Safety's contract against the oracle's exact distance: 0 <= safety <= trueDistance.
 
template<typename RayKernel >
TimingResult timeRayKernel (const std::vector< Ray > &rays, int warmupRepeats, int timedRepeats, RayKernel &&kernel)
 Time a per-ray kernel kernel(origin, dir) exactly like the timeDistFrom* functions, e.g. a _Loop twin.
 
TimingResult timeContains (const TGeoShape *shape, const std::vector< Point3D > &points, int warmupRepeats, int timedRepeats)
 
TimingResult timeDistFromOutside (const TGeoShape *shape, const std::vector< Ray > &rays, int warmupRepeats, int timedRepeats, double stepmax=TGeoShape::Big())
 
TimingResult timeDistFromInside (const TGeoShape *shape, const std::vector< Ray > &rays, int warmupRepeats, int timedRepeats)
 
TimingResult timeSafety (const TGeoShape *shape, const std::vector< Point3D > &points, int warmupRepeats, int timedRepeats)
 
TGeoShape * loadShapeFromRootFile (const std::string &path, std::string *error=nullptr)
 Read the single TGeoShape of a shape_<part>.root sidecar; nullptr on failure, with the reason in *error. The caller owns it.
 
TGeoHMatrix * loadShapePlacementFromRootFile (const std::string &path)
 Read the shape's placement, or nullptr when there is none, meaning the identity. The caller owns it.
 
bool saveShapeToRootFile (const std::string &path, const TGeoShape &shape, std::string *error=nullptr)
 Write a shape sidecar, with placement under "placement" unless it is null or the identity.
 
bool saveShapeToRootFile (const std::string &path, const TGeoShape &shape, const TGeoMatrix *placement, std::string *error)
 

Typedef Documentation

◆ Point3D

using o2::cad::harness::Point3D = typedef std::array<double, 3>

Definition at line 38 of file O2SolidHarness.h.

Function Documentation

◆ generateSamples()

SampleSet o2::cad::harness::generateSamples ( const TGeoShape *  reference,
const Point3D bboxMin,
const Point3D bboxMax,
const SampleConfig cfg = {} 
)

A deterministic sample set from cfg.seed and the bbox; reference, the trusted mesh, classifies the points.

Definition at line 80 of file O2SolidHarness.cxx.

◆ loadShapeFromRootFile()

TGeoShape * o2::cad::harness::loadShapeFromRootFile ( const std::string &  path,
std::string *  error = nullptr 
)

Read the single TGeoShape of a shape_<part>.root sidecar; nullptr on failure, with the reason in *error. The caller owns it.

Definition at line 577 of file O2SolidHarness.cxx.

◆ loadShapePlacementFromRootFile()

TGeoHMatrix * o2::cad::harness::loadShapePlacementFromRootFile ( const std::string &  path)

Read the shape's placement, or nullptr when there is none, meaning the identity. The caller owns it.

Definition at line 625 of file O2SolidHarness.cxx.

◆ saveShapeToRootFile() [1/2]

bool o2::cad::harness::saveShapeToRootFile ( const std::string &  path,
const TGeoShape &  shape,
const TGeoMatrix *  placement,
std::string *  error 
)

Definition at line 645 of file O2SolidHarness.cxx.

◆ saveShapeToRootFile() [2/2]

bool o2::cad::harness::saveShapeToRootFile ( const std::string &  path,
const TGeoShape &  shape,
std::string *  error = nullptr 
)

Write a shape sidecar, with placement under "placement" unless it is null or the identity.

Definition at line 640 of file O2SolidHarness.cxx.

◆ timeContains()

TimingResult o2::cad::harness::timeContains ( const TGeoShape *  shape,
const std::vector< Point3D > &  points,
int  warmupRepeats,
int  timedRepeats 
)

Definition at line 535 of file O2SolidHarness.cxx.

◆ timeDistFromInside()

TimingResult o2::cad::harness::timeDistFromInside ( const TGeoShape *  shape,
const std::vector< Ray > &  rays,
int  warmupRepeats,
int  timedRepeats 
)

Definition at line 550 of file O2SolidHarness.cxx.

◆ timeDistFromOutside()

TimingResult o2::cad::harness::timeDistFromOutside ( const TGeoShape *  shape,
const std::vector< Ray > &  rays,
int  warmupRepeats,
int  timedRepeats,
double  stepmax = TGeoShape::Big() 
)

Definition at line 542 of file O2SolidHarness.cxx.

◆ timeRayKernel()

template<typename RayKernel >
TimingResult o2::cad::harness::timeRayKernel ( const std::vector< Ray > &  rays,
int  warmupRepeats,
int  timedRepeats,
RayKernel &&  kernel 
)

Time a per-ray kernel kernel(origin, dir) exactly like the timeDistFrom* functions, e.g. a _Loop twin.

Definition at line 167 of file O2SolidHarness.h.

◆ timeSafety()

TimingResult o2::cad::harness::timeSafety ( const TGeoShape *  shape,
const std::vector< Point3D > &  points,
int  warmupRepeats,
int  timedRepeats 
)

Definition at line 558 of file O2SolidHarness.cxx.

◆ validateContains()

ValidationResult o2::cad::harness::validateContains ( const TGeoShape *  candidate,
const TGeoShape *  reference,
const std::vector< Point3D > &  points,
const ValidationOptions opt = {} 
)

Definition at line 249 of file O2SolidHarness.cxx.

◆ validateContainsAgainstOracle()

ValidationResult o2::cad::harness::validateContainsAgainstOracle ( const TGeoShape *  candidate,
const std::vector< Point3D > &  points,
const std::vector< int > &  oracleState,
const std::vector< double > &  oracleBoundaryDistance,
const ValidationOptions opt = {} 
)

oracleState: 1 inside, 0 outside, -1 declined; oracleBoundaryDistance may cover only a prefix of points.

Definition at line 379 of file O2SolidHarness.cxx.

◆ validateDistanceAgainstOracle()

ValidationResult o2::cad::harness::validateDistanceAgainstOracle ( const TGeoShape *  candidate,
const std::vector< Ray > &  rays,
const std::vector< double > &  oracleDistance,
bool  wantInside,
const ValidationOptions opt = {},
const std::vector< int > &  oracleOriginState = {} 
)

oracleDistance: the nearest positive crossing, or >= Big() for a miss. oracleOriginState (1, 0, -1), when present, decides per ray which entry point is asked, and a -1 origin abstains; otherwise wantInside decides.

Definition at line 413 of file O2SolidHarness.cxx.

◆ validateDistFromInside()

ValidationResult o2::cad::harness::validateDistFromInside ( const TGeoShape *  candidate,
const TGeoShape *  reference,
const std::vector< Ray > &  rays,
const ValidationOptions opt = {} 
)

Definition at line 323 of file O2SolidHarness.cxx.

◆ validateDistFromOutside()

ValidationResult o2::cad::harness::validateDistFromOutside ( const TGeoShape *  candidate,
const TGeoShape *  reference,
const std::vector< Ray > &  rays,
const ValidationOptions opt = {} 
)

Definition at line 317 of file O2SolidHarness.cxx.

◆ validateSafety()

ValidationResult o2::cad::harness::validateSafety ( const TGeoShape *  shape,
const std::vector< Point3D > &  points,
const ValidationOptions opt = {} 
)

Check one shape's Safety() lower-bound contract against its own DistFrom* along six probe directions; never compares two shapes.

Definition at line 329 of file O2SolidHarness.cxx.

◆ validateSafetyAgainstOracle()

ValidationResult o2::cad::harness::validateSafetyAgainstOracle ( const TGeoShape *  candidate,
const std::vector< Point3D > &  points,
const std::vector< double > &  oracleBoundaryDistance,
const ValidationOptions opt = {} 
)

Safety's contract against the oracle's exact distance: 0 <= safety <= trueDistance.

Definition at line 470 of file O2SolidHarness.cxx.