Project
Loading...
Searching...
No Matches
O2BVHAssembly.h
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
13
14#ifndef ALICEO2_CADSUPPORT_O2BVHASSEMBLY_
15#define ALICEO2_CADSUPPORT_O2BVHASSEMBLY_
16
17#include "TGeoShapeAssembly.h"
18
19class TGeoVolumeAssembly;
20
21namespace o2
22{
23namespace cad
24{
25
31{
32 public:
35 explicit O2BVHAssembly(TGeoVolumeAssembly* volume);
36 ~O2BVHAssembly() override;
37
38 O2BVHAssembly(const O2BVHAssembly&) = delete;
40
42 void BuildBVH();
44 int GetNbuilt() const { return fNbuilt; }
46 size_t GetBVHMemory() const;
47
48 // ---- the accelerated part of the TGeoShapeAssembly contract ----------------------------
49 Bool_t Contains(const Double_t* point) const override;
50 Double_t DistFromOutside(const Double_t* point, const Double_t* dir, Int_t iact = 1,
51 Double_t step = TGeoShape::Big(), Double_t* safe = nullptr) const override;
52 Double_t Safety(const Double_t* point, Bool_t in = kTRUE) const override;
53
54 // ---- the reference twins: same answer, all daughters, index order ----------------------
55 Bool_t Contains_Loop(const Double_t* point) const;
56 Double_t DistFromOutside_Loop(const Double_t* point, const Double_t* dir,
57 Double_t step = TGeoShape::Big()) const;
58 Double_t Safety_Loop(const Double_t* point, Bool_t in = kTRUE) const;
59
61 static O2BVHAssembly* MakeBVHAssembly(TGeoVolumeAssembly* volume);
62
63 private:
65 void EnsureBuilt() const;
66
67 void* fBVH = nullptr;
68 int fNbuilt = -1;
69 int fTreeDepth = 0;
70
71 ClassDefOverride(O2BVHAssembly, 1) // BVH-accelerated assembly shape
72};
73
74} // namespace cad
75} // namespace o2
76
77#endif
static O2BVHAssembly * MakeBVHAssembly(TGeoVolumeAssembly *volume)
Replace volume's shape by an O2BVHAssembly and return it.
Double_t DistFromOutside_Loop(const Double_t *point, const Double_t *dir, Double_t step=TGeoShape::Big()) const
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
DistFromOutside – daughters are queried with the fixed query bound, so the answer is visit-order inde...
void BuildBVH()
(Re)build the acceleration structure from the volume's current daughter list.
size_t GetBVHMemory() const
Bytes held by the BVH nodes and the primitive-index permutation.
O2BVHAssembly(const O2BVHAssembly &)=delete
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Safety – from inside as ROOT; from outside a nearest-daughter descent of the BVH.
Double_t Safety_Loop(const Double_t *point, Bool_t in=kTRUE) const
O2BVHAssembly & operator=(const O2BVHAssembly &)=delete
Bool_t Contains_Loop(const Double_t *point) const
Bool_t Contains(const Double_t *point) const override
Contains.
int GetNbuilt() const
Number of daughter placements the current BVH covers, -1 if it was never built.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...