83 Fatal(
"TGeoVoxelFinder",
"Null pointer for volume");
177 return td.fVoxNcandidates;
185 return td.fVoxCheckList;
207 for (
id = 0;
id < nd;
id++) {
212 for (
Int_t point = 0; point < 8; point++) {
215 xyz[0] = xyz[1] =
pt[0];
216 xyz[2] = xyz[3] =
pt[1];
217 xyz[4] = xyz[5] =
pt[2];
221 if (
pt[
j] < xyz[2 *
j])
223 if (
pt[
j] > xyz[2 *
j + 1])
224 xyz[2 *
j + 1] =
pt[
j];
227 fBoxes[6 *
id] = 0.5 * (xyz[1] - xyz[0]);
228 fBoxes[6 *
id + 1] = 0.5 * (xyz[3] - xyz[2]);
229 fBoxes[6 *
id + 2] = 0.5 * (xyz[5] - xyz[4]);
230 fBoxes[6 *
id + 3] = 0.5 * (xyz[0] + xyz[1]);
231 fBoxes[6 *
id + 4] = 0.5 * (xyz[2] + xyz[3]);
232 fBoxes[6 *
id + 5] = 0.5 * (xyz[4] + xyz[5]);
263 for (i = 0; i < 3; i++) {
288 for (
id = 0;
id <
fIbx - 1;
id++) {
294 printf(
"Woops : slice X\n");
300 for (
id = 0;
id <
fIby - 1;
id++) {
306 printf(
"Woops : slice X\n");
312 for (
id = 0;
id <
fIbz - 1;
id++) {
318 printf(
"Woops : slice X\n");
388 td.fVoxSlices[0] = -2;
389 td.fVoxSlices[1] = -2;
390 td.fVoxSlices[2] = -2;
394 if ((
td.fVoxSlices[0] < 0) || (
td.fVoxSlices[0] >=
fIbx - 1)) {
407 if ((
td.fVoxSlices[1] < 0) || (
td.fVoxSlices[1] >=
fIby - 1)) {
420 if ((
td.fVoxSlices[2] < 0) || (
td.fVoxSlices[2] >=
fIbz - 1))
437 Int_t *list =
nullptr;
457 Int_t *list =
nullptr;
477 Int_t *list =
nullptr;
496 td.fVoxNcandidates = 0;
504 byte = (
~td.fVoxBits1[
loc]) & (1 <<
bit);
506 td.fVoxCheckList[
td.fVoxNcandidates++] = list[
icand];
509 return td.fVoxCheckList;
517 td.fVoxNcandidates = 0;
527 td.fVoxCheckList[
td.fVoxNcandidates++] = list[
icand];
530 return td.fVoxCheckList;
539 td.fVoxNcandidates = 0;
549 td.fVoxCheckList[
td.fVoxNcandidates++] = list[
icand];
552 return td.fVoxCheckList;
566 if (
td.fVoxLimits[0] < 0)
568 if (
td.fVoxLimits[1] < 0)
570 if (
td.fVoxLimits[2] < 0)
590 if (
td.fVoxInc[0] == 1) {
595 if (
td.fVoxSlices[0] < 0 ||
td.fVoxSlices[0] >
fIbx - 1)
597 dmin[0] = (
fXb[
td.fVoxSlices[0]] - point[0]) *
td.fVoxInvdir[0];
604 if ((
td.fVoxSlices[0] == -1) || (
td.fVoxSlices[0] ==
fIbx - 1)) {
627 dmin[0] =
td.fVoxLimits[0];
634 if (
td.fVoxInc[1] == 1) {
639 if (
td.fVoxSlices[1] < 0 ||
td.fVoxSlices[1] >
fIby - 1)
641 dmin[1] = (
fYb[
td.fVoxSlices[1]] - point[1]) *
td.fVoxInvdir[1];
649 if ((
td.fVoxSlices[1] == -1) || (
td.fVoxSlices[1] ==
fIby - 1)) {
672 dmin[1] =
td.fVoxLimits[1];
679 if (
td.fVoxInc[2] == 1) {
684 if (
td.fVoxSlices[2] < 0 ||
td.fVoxSlices[2] >
fIbz - 1)
686 dmin[2] = (
fZb[
td.fVoxSlices[2]] - point[2]) *
td.fVoxInvdir[2];
694 if ((
td.fVoxSlices[2] == -1) || (
td.fVoxSlices[2] ==
fIbz - 1)) {
717 dmin[2] =
td.fVoxLimits[2];
794 td.fVoxSlices[0] =
dind[0];
805 td.fVoxSlices[1] +=
td.fVoxInc[1];
806 if (
td.fVoxInc[1] == 1) {
807 if (
td.fVoxSlices[1] < -1 ||
td.fVoxSlices[1] >
fIby - 2)
812 if (
td.fVoxSlices[1] < 0 ||
td.fVoxSlices[1] >
fIby - 1)
824 td.fVoxSlices[2] +=
td.fVoxInc[2];
825 if (
td.fVoxInc[2] == 1) {
826 if (
td.fVoxSlices[2] < -1 ||
td.fVoxSlices[2] >
fIbz - 2)
831 if (
td.fVoxSlices[2] < 0 ||
td.fVoxSlices[2] >
fIbz - 1)
845 if (
td.fVoxSlices[1] < 0 ||
td.fVoxSlices[1] >=
fIby - 1)
846 return td.fVoxCheckList;
849 return td.fVoxCheckList;
854 if (
td.fVoxSlices[2] < 0 ||
td.fVoxSlices[2] >=
fIbz - 1)
855 return td.fVoxCheckList;
858 return td.fVoxCheckList;
873 return td.fVoxCheckList;
880 return td.fVoxCheckList;
882 if (
td.fVoxSlices[1] < 0 ||
td.fVoxSlices[1] >=
fIby - 1) {
884 return td.fVoxCheckList;
889 return td.fVoxCheckList;
895 if (
td.fVoxSlices[2] < 0 ||
td.fVoxSlices[2] >=
fIbz - 1) {
897 return td.fVoxCheckList;
902 return td.fVoxCheckList;
923 td.fVoxSlices[1] =
dind[1];
934 td.fVoxSlices[0] +=
td.fVoxInc[0];
935 if (
td.fVoxInc[0] == 1) {
936 if (
td.fVoxSlices[0] < -1 ||
td.fVoxSlices[0] >
fIbx - 2)
941 if (
td.fVoxSlices[0] < 0 ||
td.fVoxSlices[0] >
fIbx - 1)
953 td.fVoxSlices[2] +=
td.fVoxInc[2];
954 if (
td.fVoxInc[2] == 1) {
955 if (
td.fVoxSlices[2] < -1 ||
td.fVoxSlices[2] >
fIbz - 2)
960 if (
td.fVoxSlices[2] < 0 ||
td.fVoxSlices[2] >
fIbz - 1)
974 if (
td.fVoxSlices[0] < 0 ||
td.fVoxSlices[0] >=
fIbx - 1)
975 return td.fVoxCheckList;
978 return td.fVoxCheckList;
983 if (
td.fVoxSlices[2] < 0 ||
td.fVoxSlices[2] >=
fIbz - 1)
984 return td.fVoxCheckList;
987 return td.fVoxCheckList;
1002 return td.fVoxCheckList;
1009 return td.fVoxCheckList;
1011 if (
td.fVoxSlices[0] < 0 ||
td.fVoxSlices[0] >=
fIbx - 1) {
1013 return td.fVoxCheckList;
1018 return td.fVoxCheckList;
1024 if (
td.fVoxSlices[2] < 0 ||
td.fVoxSlices[2] >=
fIbz - 1) {
1026 return td.fVoxCheckList;
1031 return td.fVoxCheckList;
1052 td.fVoxSlices[2] =
dind[2];
1063 td.fVoxSlices[1] +=
td.fVoxInc[1];
1064 if (
td.fVoxInc[1] == 1) {
1065 if (
td.fVoxSlices[1] < -1 ||
td.fVoxSlices[1] >
fIby - 2)
1070 if (
td.fVoxSlices[1] < 0 ||
td.fVoxSlices[1] >
fIby - 1)
1082 td.fVoxSlices[0] +=
td.fVoxInc[0];
1083 if (
td.fVoxInc[0] == 1) {
1084 if (
td.fVoxSlices[0] < -1 ||
td.fVoxSlices[0] >
fIbx - 2)
1089 if (
td.fVoxSlices[0] < 0 ||
td.fVoxSlices[0] >
fIbx - 1)
1103 if (
td.fVoxSlices[1] < 0 ||
td.fVoxSlices[1] >=
fIby - 1)
1104 return td.fVoxCheckList;
1107 return td.fVoxCheckList;
1112 if (
td.fVoxSlices[0] < 0 ||
td.fVoxSlices[0] >=
fIbx - 1)
1113 return td.fVoxCheckList;
1116 return td.fVoxCheckList;
1131 return td.fVoxCheckList;
1138 return td.fVoxCheckList;
1140 if (
td.fVoxSlices[1] < 0 ||
td.fVoxSlices[1] >=
fIby - 1) {
1142 return td.fVoxCheckList;
1147 return td.fVoxCheckList;
1153 if (
td.fVoxSlices[0] < 0 ||
td.fVoxSlices[0] >=
fIbx - 1) {
1155 return td.fVoxCheckList;
1160 return td.fVoxCheckList;
1194 td.fVoxNcandidates = 0;
1200 for (
Int_t i = 0; i < 3; i++) {
1204 td.fVoxInc[i] = (dir[i] > 0) ? 1 : -1;
1205 td.fVoxInvdir[i] = 1. / dir[i];
1210 if (
td.fVoxInc[0] == 0) {
1213 if (
td.fVoxSlices[0] == -2) {
1215 td.fVoxLimits[0] = (
box_orig[0] - point[0] +
td.fVoxInc[0] *
box->GetDX()) *
td.fVoxInvdir[0];
1217 if (
td.fVoxInc[0] == 1) {
1218 td.fVoxLimits[0] = (
fXb[
fIbx - 1] - point[0]) *
td.fVoxInvdir[0];
1220 td.fVoxLimits[0] = (
fXb[0] - point[0]) *
td.fVoxInvdir[0];
1224 if (
td.fVoxInc[1] == 0) {
1227 if (
td.fVoxSlices[1] == -2) {
1229 td.fVoxLimits[1] = (
box_orig[1] - point[1] +
td.fVoxInc[1] *
box->GetDY()) *
td.fVoxInvdir[1];
1231 if (
td.fVoxInc[1] == 1) {
1232 td.fVoxLimits[1] = (
fYb[
fIby - 1] - point[1]) *
td.fVoxInvdir[1];
1234 td.fVoxLimits[1] = (
fYb[0] - point[1]) *
td.fVoxInvdir[1];
1238 if (
td.fVoxInc[2] == 0) {
1241 if (
td.fVoxSlices[2] == -2) {
1243 td.fVoxLimits[2] = (
box_orig[2] - point[2] +
td.fVoxInc[2] *
box->GetDZ()) *
td.fVoxInvdir[2];
1245 if (
td.fVoxInc[2] == 1) {
1246 td.fVoxLimits[2] = (
fZb[
fIbz - 1] - point[2]) *
td.fVoxInvdir[2];
1248 td.fVoxLimits[2] = (
fZb[0] - point[2]) *
td.fVoxInvdir[2];
1324 if (point[0] <
fXb[0] || point[0] >
fXb[1])
1328 if (point[1] <
fYb[0] || point[1] >
fYb[1])
1333 if (point[2] <
fZb[0] || point[2] >
fZb[1])
1336 td.fVoxCheckList[0] = 0;
1338 return td.fVoxCheckList;
1344 Int_t nd[3] = {0, 0, 0};
1348 if ((
im == -1) || (
im ==
fIbx - 1))
1361 if ((
im == -1) || (
im ==
fIby - 1))
1379 if ((
im == -1) || (
im ==
fIbz - 1))
1409 return td.fVoxCheckList;
1421 Int_t nd[3] = {0, 0, 0};
1469 return td.fVoxCheckList;
1483 if (
td.fVoxCurrent == 0) {
1488 return td.fVoxCheckList;
1535 td.fVoxNcandidates = 0;
1539 while (
td.fVoxNcandidates < nd) {
1540 td.fVoxCheckList[
td.fVoxNcandidates] =
td.fVoxNcandidates;
1541 ++
td.fVoxNcandidates;
1559 if (
td.fVoxNcandidates ==
n1) {
1579 td.fVoxNcandidates = 0;
1593 if (
td.fVoxNcandidates ==
n1) {
1603 return (
td.fVoxNcandidates > 0);
1614 td.fVoxNcandidates = 0;
1630 return (
td.fVoxNcandidates > 0);
1643 td.fVoxNcandidates = 0;
1659 return (
td.fVoxNcandidates > 0);
1701 td.fVoxNcandidates = 0;
1720 return (
td.fVoxNcandidates > 0);
1763 td.fVoxNcandidates = 0;
1782 return (
td.fVoxNcandidates > 0);
1799 zmin = (
box->GetOrigin())[2] -
box->GetDZ();
1800 zmax = (
box->GetOrigin())[2] +
box->GetDZ();
1808 for (
id = 0;
id < nd;
id++) {
1813 boundaries[2 *
id + 2 * nd] =
fBoxes[6 *
id + 4] -
fBoxes[6 *
id + 1];
1814 boundaries[2 *
id + 2 * nd + 1] =
fBoxes[6 *
id + 4] +
fBoxes[6 *
id + 1];
1816 boundaries[2 *
id + 4 * nd] =
fBoxes[6 *
id + 5] -
fBoxes[6 *
id + 2];
1817 boundaries[2 *
id + 4 * nd + 1] =
fBoxes[6 *
id + 5] +
fBoxes[6 *
id + 2];
1847 for (
id = 0;
id < 2 * nd;
id++) {
1858 delete[] boundaries;
1870 if (((temp[0] -
xmin) < 1E-10) && ((temp[1] -
xmax) > -1E-10)) {
1916 for (
id = 0;
id <
fNox;
id++) {
1922 bits = &
ind[current];
1945 if ((
id == 0) || (
ddx1 > -1E-10)) {
1949 if ((
id == (
fNoz - 1)) || (
ddx2 < 1E-10)) {
1983 for (
id = 0;
id < 2 * nd;
id++) {
1985 temp[
ib++] = boundaries[2 * nd +
index[
id]];
1989 temp[
ib++] = boundaries[2 * nd +
index[
id]];
1994 delete[] boundaries;
2006 if (((temp[0] -
ymin) < 1E-10) && ((temp[1] -
ymax) > -1E-10)) {
2053 for (
id = 0;
id <
fNoy;
id++) {
2059 bits = &
ind[current];
2082 if ((
id == 0) || (
ddx1 > -1E-10)) {
2086 if ((
id == (
fNoz - 1)) || (
ddx2 < 1E-10)) {
2120 for (
id = 0;
id < 2 * nd;
id++) {
2122 temp[
ib++] = boundaries[4 * nd +
index[
id]];
2126 temp[
ib++] = boundaries[4 * nd +
index[
id]];
2131 delete[] boundaries;
2143 if (((temp[0] - zmin) < 1E-10) && ((temp[1] - zmax) > -1E-10)) {
2190 for (
id = 0;
id <
fNoz;
id++) {
2196 bits = &
ind[current];
2219 if ((
id == 0) || (
ddx1 > -1E-10)) {
2223 if ((
id == (
fNoz - 1)) || (
ddx2 < 1E-10)) {
2252 delete[] boundaries;
2289 for (
id = 0;
id <
fIbx;
id++) {
2291 if (
id == (
fIbx - 1))
2296 for (i = 0; i <
nbytes; i++) {
2299 if (
byte & (1 <<
bit))
2312 for (
id = 0;
id < nd;
id++)
2319 for (
id = 0;
id <
fIby;
id++) {
2321 if (
id == (
fIby - 1))
2326 for (i = 0; i <
nbytes; i++) {
2329 if (
byte & (1 <<
bit))
2341 for (
id = 0;
id < nd;
id++)
2349 for (
id = 0;
id <
fIbz;
id++) {
2351 if (
id == (
fIbz - 1))
2356 for (i = 0; i <
nbytes; i++) {
2359 if (
byte & (1 <<
bit))
2372 for (
id = 0;
id < nd;
id++)
2392 if ((
im == -1) || (
im ==
fIbx - 1)) {
2393 printf(
"Voxel X limits: OUT\n");
2400 if ((
im == -1) || (
im ==
fIby - 1)) {
2401 printf(
"Voxel Y limits: OUT\n");
2408 if ((
im == -1) || (
im ==
fIbz - 1)) {
2409 printf(
"Voxel Z limits: OUT\n");
2425 for (
Int_t i = 0; i < nd; i++) {
2427 if (
vd->IsAssembly())
2428 vd->GetShape()->ComputeBBox();
2439 if (
R__b.IsReading()) {
2449 R__b.ReadFastArray(dummy,
R__c - 2);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
R__EXTERN TGeoManager * gGeoManager
Buffer base class used for serializing objects.
Geometrical transformation package.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
TGeoVolume * GetVolume() const
void SetOverlaps(Int_t *ovlp, Int_t novlp)
set the list of overlaps for this node (ovlp must be created with operator new)
virtual TGeoMatrix * GetMatrix() const =0
static Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
virtual void ComputeBBox()=0
static Double_t Tolerance()
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
void SetCylVoxels(Bool_t flag=kTRUE)
Int_t GetNdaughters() const
void FindOverlaps() const
loop all nodes marked as overlaps and find overlapping brothers
TGeoNode * GetNode(const char *name) const
get the pointer to a daughter node
TGeoShape * GetShape() const
virtual Bool_t IsAssembly() const
Returns true if the volume is an assembly or a scaled assembly.
Finder class handling voxels.
void Print(Option_t *option="") const override
Print the voxels.
Bool_t Union(Int_t n1, UChar_t *array1, TGeoStateInfo &td)
make union of older bits with new array printf("Union - one slice\n");
void SetNeedRebuild(Bool_t flag=kTRUE)
void Streamer(TBuffer &) override
Stream an object of class TGeoVoxelFinder.
virtual Int_t * GetCheckList(const Double_t *point, Int_t &nelem, TGeoStateInfo &td)
get the list of daughter indices for which point is inside their bbox
virtual Int_t * GetNextVoxel(const Double_t *point, const Double_t *dir, Int_t &ncheck, TGeoStateInfo &td)
get the list of new candidates for the next voxel crossed by current ray printf("### GetNextVoxel\n")...
~TGeoVoxelFinder() override
Destructor.
virtual void Voxelize(Option_t *option="")
Voxelize attached volume according to option If the volume is an assembly, make sure the bbox is comp...
void DaughterToMother(Int_t id, const Double_t *local, Double_t *master) const
convert a point from the local reference system of node id to reference system of mother volume
Bool_t Intersect(Int_t n1, UChar_t *array1, Int_t &nf, Int_t *result)
return the list of nodes corresponding to one array of bits
virtual Int_t * GetNextCandidates(const Double_t *point, Int_t &ncheck, TGeoStateInfo &td)
Returns list of new candidates in next voxel.
Bool_t GetIndices(const Double_t *point, TGeoStateInfo &td)
Get indices for current slices on x, y, z.
void SortAll(Option_t *option="")
order bounding boxes along x, y, z
Bool_t IsSafeVoxel(const Double_t *point, Int_t inode, Double_t minsafe) const
Computes squared distance from POINT to the voxel(s) containing node INODE.
Int_t * GetExtraY(Int_t islice, Bool_t left, Int_t &nextra) const
Return the list of extra candidates in a given Y slice compared to another (left or right)
void BuildVoxelLimits()
build the array of bounding boxes of the nodes inside
Int_t * GetVoxelCandidates(Int_t i, Int_t j, Int_t k, Int_t &ncheck, TGeoStateInfo &td)
get the list of candidates in voxel (i,j,k) - no check
void SetInvalid(Bool_t flag=kTRUE)
virtual void FindOverlaps(Int_t inode) const
create the list of nodes for which the bboxes overlap with inode's bbox
void PrintVoxelLimits(const Double_t *point) const
print the voxel containing point
Bool_t NeedRebuild() const
Int_t GetNcandidates(TGeoStateInfo &td) const
virtual Double_t Efficiency()
Compute voxelization efficiency.
virtual void SortCrossedVoxels(const Double_t *point, const Double_t *dir, TGeoStateInfo &td)
get the list in the next voxel crossed by a ray
Int_t * GetExtraZ(Int_t islice, Bool_t left, Int_t &nextra) const
Return the list of extra candidates in a given Z slice compared to another (left or right)
Int_t * GetExtraX(Int_t islice, Bool_t left, Int_t &nextra) const
Return the list of extra candidates in a given X slice compared to another (left or right)
Int_t * GetValidExtra(Int_t *list, Int_t &ncheck, TGeoStateInfo &td)
Get extra candidates that are not contained in current check list.
Bool_t IntersectAndStore(Int_t n1, UChar_t *array1, TGeoStateInfo &td)
return the list of nodes corresponding to one array of bits
TGeoVoxelFinder()
Default constructor.
const char * GetName() const override
Returns name of object.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Long64_t LocMin(Long64_t n, const T *a)
Returns index of array with the minimum element.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Sort the n elements of the array a of generic templated type Element.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Statefull info for the current geometry level.