17#ifndef ALICEO2_CADSUPPORT_O2SOLIDHARNESS_
18#define ALICEO2_CADSUPPORT_O2SOLIDHARNESS_
118 const std::vector<Ray>& rays,
const ValidationOptions& opt = {});
121 const std::vector<Ray>& rays,
const ValidationOptions& opt = {});
124ValidationResult
validateSafety(
const TGeoShape* shape,
const std::vector<Point3D>& points,
125 const ValidationOptions& opt = {});
131 const std::vector<Point3D>& points,
132 const std::vector<int>& oracleState,
133 const std::vector<double>& oracleBoundaryDistance,
134 const ValidationOptions& opt = {});
139 const std::vector<Ray>& rays,
140 const std::vector<double>& oracleDistance,
141 bool wantInside,
const ValidationOptions& opt = {},
142 const std::vector<int>& oracleOriginState = {});
146 const std::vector<Point3D>& points,
147 const std::vector<double>& oracleBoundaryDistance,
148 const ValidationOptions& opt = {});
166template <
typename RayKernel>
169 for (
int warmup = 0; warmup < warmupRepeats; ++warmup) {
170 for (
const auto& ray : rays) {
171 volatile double sink = kernel(ray.origin, ray.dir);
176 const auto start = std::chrono::steady_clock::now();
177 for (
int repeat = 0; repeat < timedRepeats; ++repeat) {
178 for (
const auto& ray : rays) {
182 const auto stop = std::chrono::steady_clock::now();
184 result.
nCalls = rays.size() *
static_cast<size_t>(timedRepeats);
185 const double nanoseconds = std::chrono::duration<double, std::nano>(stop -
start).count();
186 result.nsPerCall =
result.nCalls > 0 ? nanoseconds /
static_cast<double>(
result.nCalls) : 0.;
187 result.checksum = checksum;
194 int timedRepeats,
double stepmax = TGeoShape::Big());
218 const TGeoMatrix* placement, std::string*
error);
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 First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
char error[CURL_ERROR_SIZE]
GLsizei const GLfloat * value
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLsizei const GLchar *const * path
uint64_t mixDouble(uint64_t acc, double value)
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.
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 poin...
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,...
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.
TimingResult timeDistFromInside(const TGeoShape *shape, const std::vector< Ray > &rays, int warmupRepeats, int timedRepeats)
TimingResult timeDistFromOutside(const TGeoShape *shape, const std::vector< Ray > &rays, int warmupRepeats, int timedRepeats, double stepmax=TGeoShape::Big())
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;...
ValidationResult validateDistFromInside(const TGeoShape *candidate, const TGeoShape *reference, const std::vector< Ray > &rays, const ValidationOptions &opt={})
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={})
TimingResult timeContains(const TGeoShape *shape, const std::vector< Point3D > &points, int warmupRepeats, int timedRepeats)
TGeoHMatrix * loadShapePlacementFromRootFile(const std::string &path)
Read the shape's placement, or nullptr when there is none, meaning the identity. The caller owns it.
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 *err...
ValidationResult validateContains(const TGeoShape *candidate, const TGeoShape *reference, const std::vector< Point3D > &points, const ValidationOptions &opt={})
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,...
ValidationResult validateDistFromOutside(const TGeoShape *candidate, const TGeoShape *reference, const std::vector< Ray > &rays, const ValidationOptions &opt={})
TimingResult timeSafety(const TGeoShape *shape, const std::vector< Point3D > &points, int warmupRepeats, int timedRepeats)
std::array< double, 3 > Point3D
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Parameters of generateSamples; the counts are targets, and a category may come back short.
int nInsideRays
rays from inside origins, for DistFromInside
int nOutsideRays
rays from outside origins, for DistFromOutside
int nBulk
uniform points over the inflated bbox
double boundaryBand
absolute distance (cm); <0 auto-picks 1e-3 * bbox diagonal
int nBoundary
points within boundaryBand of the reference surface
int maxRejectionAttempts
attempts per accepted sample before giving up on that category
uint64_t seed
every SampleSet is fully determined by this and the bbox
int nInside
points accepted by the reference Contains()
double bboxInflate
fractional bbox half-extent padding for bulk/outside sampling
std::vector< Point3D > boundaryPoints
std::vector< Point3D > bulkPoints
std::vector< Ray > outsideRays
std::vector< Ray > insideRays
std::vector< Point3D > insidePoints
uint64_t checksum
accumulated from the results so the optimizer cannot elide the calls
double minIncidenceCosine
Floor of the incidence cosine that scales the distance allowance, so a tangent ray cannot excuse an u...
double distanceTolerance
absolute agreement tolerance for distances (cm)
size_t nMismatchMissedSurface
size_t nMismatchWithinBand
size_t nMismatchUnexplained
std::vector< Offender > worstOffenders