50 #include "../egs_gtransformed/egs_gtransformed.h"
66 const string EGS_AENVELOPE_LOCAL EGS_AEnvelope::allowed_base_geom_types[] = {
"EGS_cSpheres",
"EGS_cSphericalShell",
"EGS_XYZGeometry",
"EGS_RZ"};
68 static char EGS_AENVELOPE_LOCAL geom_class_msg[] =
"createGeometry(AEnvelope): %s\n";
69 static char EGS_AENVELOPE_LOCAL base_geom_keyword[] =
"base geometry";
70 static char EGS_AENVELOPE_LOCAL inscribed_geom_keyword[] =
"inscribed geometry";
71 static char EGS_AENVELOPE_LOCAL inscribed_geom_name_keyword[] =
"inscribed geometry name";
72 static char EGS_AENVELOPE_LOCAL transformations_keyword[] =
"transformations";
73 static char EGS_AENVELOPE_LOCAL type_keyword[] =
"type";
74 static char EGS_AENVELOPE_LOCAL transformation_keyword[] =
"transformation";
76 static bool EGS_AENVELOPE_LOCAL inputSet =
false;
79 const vector<AEnvelopeAux> inscribed,
const string &Name,
bool debug,
string output_vc_file) :
80 EGS_BaseGeometry(Name), base_geom(base_geom), debug_info(debug), output_vc(output_vc_file) {
82 bool volcor_available = allowedBaseGeomType(base_geom->
getType());
83 bool volcor_requested = inscribed.size() > 0 && inscribed[0].vcopts->mode ==
CORRECT_VOLUME;
85 if (!volcor_available && volcor_requested) {
88 "EGS_AEnvelope:: Volume correction is not available for geometry type '%s (%s)'. "
89 "Geometry types must implement getVolume. Valid choices are:\n\t"
92 int end = (int)(
sizeof(allowed_base_geom_types)/
sizeof(string));
93 for (
int i=0; i < end; i++) {
94 msg += allowed_base_geom_types[i] +
" ";
96 msg +=
"\nPlease set `action = discover -or- correct and zero volume` or use a different base geometry type.\n";
102 nregbase = base_geom->
regions();
104 has_rho_scaling = getHasRhoScaling();
106 ninscribed = inscribed.size();
107 if (ninscribed == 0) {
108 egsFatal(
"EGS_AEnvelope: no inscribed geometries!\n");
116 for (
int geom_idx=0; geom_idx < ninscribed; geom_idx++) {
120 VCOptions *vcopt = inscribed[geom_idx].vcopts;
123 inscribed_geoms.push_back(transformed);
124 transforms.push_back(transform);
125 opts.push_back(vcopt);
127 int ninscribed_reg= transformed->
regions();
128 nreg += ninscribed_reg;
130 for (
int lreg = 0; lreg < ninscribed_reg; lreg++) {
132 local_to_global_reg[local] = global;
133 global_reg_to_local[global] = local;
138 geoms_in_region =
new vector<EGS_BaseGeometry *>[nregbase];
140 if (inscribed[0].vcopts->vc_file !=
"") {
141 vc_results =
loadFileResults(inscribed[0].vcopts, base_geom, inscribed_geoms, transforms);
142 egsInformation(
"loaded from %s\n", inscribed[0].vcopts->vc_file.c_str());
150 nreg_with_inscribed = 0;
151 for (volcor::RegionGeomSetT::iterator it=vc_results.regions_with_inscribed.begin();
152 it!=vc_results.regions_with_inscribed.end(); it++) {
153 nreg_with_inscribed++;
154 copy(it->second.begin(), it->second.end(), back_inserter(geoms_in_region[it->first]));
157 if (getNRegWithInscribed() == 0) {
158 egsFatal(
"EGS_AEnvelope:: Failed to find any regions with inscribed geometries\n");
161 if (output_vc==
"yes" || output_vc==
"text" || output_vc==
"gzip") {
162 writeVolumeCorrection();
172 EGS_AEnvelope::~EGS_AEnvelope() {
181 int end = (int)(
sizeof(allowed_base_geom_types)/
sizeof(string));
183 for (
int i=0; i<end; i++) {
184 if (allowed_base_geom_types[i] == geom_type) {
192 int EGS_AEnvelope::getGlobalRegFromLocalReg(
EGS_BaseGeometry *g,
int local_reg) {
198 map<volcor::GeomRegPairT, int>::const_iterator glob_it = local_to_global_reg.find(local);
199 if (glob_it != local_to_global_reg.end()) {
200 return (*glob_it).second;
207 map<int, volcor::GeomRegPairT>::const_iterator glob_it = global_reg_to_local.find(ireg);
208 if (glob_it != global_reg_to_local.end()) {
209 return (*glob_it).second;
214 int EGS_AEnvelope::getNRegWithInscribed()
const {
215 return nreg_with_inscribed;
218 bool EGS_AEnvelope::isRealRegion(
int ireg)
const {
220 bool is_outside = ireg < 0 || ireg >=
nreg;
225 bool in_base_geom = ireg <
nregbase;
231 local = getLocalFromGlobalReg(ireg);
232 return local.first->isRealRegion(local.second);
237 bool EGS_AEnvelope::isInside(
const EGS_Vector &x) {
242 int EGS_AEnvelope::isWhere(
const EGS_Vector &x) {
247 vector<EGS_BaseGeometry *> geoms_in_reg = getGeomsInRegion(base_reg);
249 if (base_reg < 0 || geoms_in_reg.size()==0) {
255 for (vector<EGS_BaseGeometry *>::iterator geom=geoms_in_reg.begin(); geom!= geoms_in_reg.end(); ++geom) {
256 int inscribed_reg = (*geom)->isWhere(x);
257 if (inscribed_reg >= 0) {
258 return getGlobalRegFromLocalReg(*geom, inscribed_reg);
266 int EGS_AEnvelope::inside(
const EGS_Vector &x) {
270 int EGS_AEnvelope::medium(
int ireg)
const {
278 return local.first->medium(local.second);
281 vector<EGS_BaseGeometry *> EGS_AEnvelope::getGeomsInRegion(
int ireg) {
283 vector<EGS_BaseGeometry *> empty;
286 return geoms_in_region[ireg];
289 int EGS_AEnvelope::computeIntersections(
int ireg,
int n,
const EGS_Vector &X,
313 bool outside_envelope = ireg < 0;
314 bool in_base_geom = ireg >= 0 && ireg <
nregbase;
316 if (outside_envelope) {
320 ireg = howfar(ireg,x,u,t,&imed);
321 bool would_not_intersect = ireg < 0;
323 if (would_not_intersect) {
328 isections[0].
rhof = 1;
329 isections[0].
ireg = -1;
330 isections[0].
imed = -1;
355 isections[isec_idx].
imed = imed;
356 isections[isec_idx].
ireg = ireg;
357 isections[isec_idx].
rhof = getRelativeRho(ireg);
367 vector<EGS_BaseGeometry *> geoms_in_reg = getGeomsInRegion(ireg);
368 for (vector<EGS_BaseGeometry *>::iterator geom=geoms_in_reg.begin(); geom!= geoms_in_reg.end(); ++geom) {
370 int inscribed_reg = (*geom)->howfar(-1, x, u, t, &imed);
372 bool hits_inscribed = inscribed_reg >= 0;
374 if (hits_inscribed) {
375 ireg = getGlobalRegFromLocalReg(*geom, inscribed_reg);
380 isections[isec_idx++].
t = ttot;
402 int max_isec = n - isec_idx;
404 int ninter_sec = local.first->computeIntersections(local.second, max_isec,
405 x, u, &isections[isec_idx]);
408 int nmax = ninter_sec >= 0 ? ninter_sec + isec_idx : n;
409 for (
int i=isec_idx; i < nmax; i++) {
410 isections[i].
ireg = getGlobalRegFromLocalReg(local.first, isections[i].ireg);
411 isections[i].
t += ttot;
415 if (ninter_sec < 0) {
419 isec_idx += ninter_sec;
425 t = isections[isec_idx-1].
t - ttot;
427 ttot = isections[isec_idx-1].
t;
449 bool in_base_geom = ireg <
nregbase;
465 EGS_Float &t,
int *newmed,
EGS_Vector *normal) {
467 bool inside_geom = ireg >= 0;
470 bool inside_base_geom = ireg <
nregbase;
472 if (inside_base_geom) {
475 vector<EGS_BaseGeometry *> geoms_in_reg = getGeomsInRegion(ireg);
477 bool no_inscribed_in_reg = geoms_in_reg.size() == 0;
478 if (no_inscribed_in_reg) {
482 int inscribed_global = -1;
483 for (vector<EGS_BaseGeometry *>::iterator geom=geoms_in_reg.begin(); geom!= geoms_in_reg.end(); ++geom) {
484 int local_reg = (*geom)->howfar(-1, x, u, t, newmed, normal);
485 bool hits_inscribed = local_reg >= 0;
486 if (hits_inscribed) {
487 inscribed_global = getGlobalRegFromLocalReg(*geom, local_reg);
491 bool hit_inscribed_first = inscribed_global >= 0;
493 if (hit_inscribed_first) {
494 return inscribed_global;
505 int new_local = local.first->howfar(local.second, x, u, t, newmed, normal);
506 bool hit_boundary_in_inscribed = new_local >=0;
507 if (hit_boundary_in_inscribed) {
508 return getGlobalRegFromLocalReg(local.first, new_local);
514 if (inew >= 0 && newmed) {
524 vector<EGS_BaseGeometry *> geoms_in_reg = getGeomsInRegion(new_base_reg);
525 bool has_geoms_in_reg = geoms_in_reg.size() > 0;
528 if (new_base_reg >= 0 && has_geoms_in_reg) {
531 for (vector<EGS_BaseGeometry *>::iterator geom=geoms_in_reg.begin(); geom!= geoms_in_reg.end(); ++geom) {
532 int new_local_reg = (*geom)->isWhere(x+u*t);
533 bool landed_in_inscribed = new_local_reg >= 0;
534 if (landed_in_inscribed) {
536 *newmed = (*geom)->medium(new_local_reg);
538 return getGlobalRegFromLocalReg(*geom, new_local_reg);
548 EGS_Float EGS_AEnvelope::hownear(
int ireg,
const EGS_Vector &x) {
549 bool inside_envelope = ireg >= 0;
551 if (!inside_envelope) {
555 bool in_base_geom = ireg <
nregbase ;
558 return local.first->hownear(local.second, x);
565 vector<EGS_BaseGeometry *> geoms_in_reg = getGeomsInRegion(ireg);
566 for (vector<EGS_BaseGeometry *>::iterator geom=geoms_in_reg.begin(); geom!= geoms_in_reg.end(); ++geom) {
567 EGS_Float local_t = (*geom)->hownear(-1, x);
568 if (local_t < tmin) {
578 bool EGS_AEnvelope::hasBooleanProperty(
int ireg, EGS_BPType prop)
const {
579 if (ireg >= 0 && ireg <
nreg) {
584 return local.first->hasBooleanProperty(local.second, prop);
589 void EGS_AEnvelope::setBooleanProperty(EGS_BPType prop) {
590 setPropertyError(
"setBooleanProperty()");
593 void EGS_AEnvelope::addBooleanProperty(
int bit) {
594 setPropertyError(
"addBooleanProperty()");
597 void EGS_AEnvelope::setBooleanProperty(EGS_BPType prop,
int start,
int end,
int step) {
598 setPropertyError(
"setBooleanProperty()");
601 void EGS_AEnvelope::addBooleanProperty(
int bit,
int start,
int end,
int step) {
602 setPropertyError(
"addBooleanProperty()");
605 int EGS_AEnvelope::getMaxStep()
const {
622 void EGS_AEnvelope::updatePosition(EGS_Float time) {
631 void EGS_AEnvelope::containsDynamic(
bool &hasdynamic) {
644 bool EGS_AEnvelope::hasRhoScaling() {
660 void EGS_AEnvelope::finishInitialization() {
668 EGS_Float EGS_AEnvelope::getVolume(
int ireg) {
679 return local.first->getVolume(local.second);
682 EGS_Float EGS_AEnvelope::getCorrectionRatio(
int ireg) {
696 void EGS_AEnvelope::printInfo()
const {
702 for (
int ir=0; ir <
nregbase; ir++) {
704 egsInformation(
" volume of region %d was corrected from %.5E g to %.5E g\n",
709 for (
int ir=0; ir <
nregbase; ir++) {
710 if (geoms_in_region[ir].size() > 0) {
711 egsInformation(
" region %d has %d inscribed geometries\n", ir, geoms_in_region[ir].size());
723 egsInformation(
"=======================================================\n");
726 void EGS_AEnvelope::writeVCToFile(ostream &out) {
728 vector<int> to_write;
733 bool has_correction = fabs(cor-uncor) > 1E-8;
734 if (has_correction) {
735 to_write.push_back(i);
739 size_t nrecords = to_write.size();
740 out << nrecords << endl;
742 for (
size_t i=0; i<to_write.size(); i++) {
743 int ir = to_write[i];
747 vector<EGS_BaseGeometry *> geoms_in_reg = getGeomsInRegion(ir);
748 vector<int> geom_idxs_in_reg;
749 for (
size_t i=0; i<geoms_in_reg.size(); i++) {
752 geom_idxs_in_reg.push_back(pos);
756 int ninscribed = (int)geom_idxs_in_reg.size();
758 out << ir <<
" " << cor;
761 for (
size_t gidx = 0; gidx < geom_idxs_in_reg.size(); gidx++) {
762 out <<
" " <<geom_idxs_in_reg[gidx];
769 void EGS_AEnvelope::writeVolumeCorrection() {
771 egsInformation(
"\nVolume Correction Output File \n%s\n",
string(80,
'=').c_str());
774 string fname = gname+
".autoenv.volcor";
775 fname += (output_vc ==
"gzip" ?
".gz" :
"");
776 string mode = (output_vc ==
"gzip" ?
"gzip" :
"text");
779 "Writing volume correction file for %s to %s file %s\n",
780 gname.c_str(), mode.c_str(), fname.c_str());
782 if (output_vc ==
"gzip") {
784 ogzstream outgz(fname.c_str());
785 writeVCToFile(outgz);
790 ofstream out(fname.c_str());
799 bool EGS_AEnvelope::getHasRhoScaling() {
806 for (
size_t geom_idx=0; geom_idx <
inscribed_geoms.size(); geom_idx++) {
817 egsWarning(
"EGS_AEnvelope::setMedia: don't use this method. Use the\n"
818 " setMedia() methods of the geometry objects that make up this geometry\n");
822 void EGS_AEnvelope::setRelativeRho(
int start,
int end, EGS_Float rho) {
827 void EGS_AEnvelope::setRelativeRho(
EGS_Input *) {
828 egsWarning(
"EGS_AEnvelope::setRelativeRho(): don't use this method."
829 " Use the\n setRelativeRho methods of the geometry objects that make up"
834 EGS_Float EGS_AEnvelope::getRelativeRho(
int ireg)
const {
835 if (ireg < 0 || ireg >=
nreg) {
844 return local.first->getRelativeRho(local.second);
855 const vector<AEnvelopeAux> inscribed,
const string &Name,
bool debug,
string output_vc_file):
856 EGS_AEnvelope(base_geom, inscribed, Name, debug, output_vc_file) {
868 vector<EGS_BaseGeometry *> EGS_ASwitchedEnvelope::getGeomsInRegion(
int ireg) {
870 vector<EGS_BaseGeometry *> active_in_reg;
871 if ((0 <= ireg) && (ireg <
nregbase)) {
873 geoms_in_region[ireg].begin(), geoms_in_region[ireg].end(),
874 active_inscribed.begin(), active_inscribed.end(),
875 back_inserter(active_in_reg)
879 return active_in_reg;
885 active_inscribed.clear();
886 active_inscribed = geoms;
888 if (geoms.size() <= 0) {
903 active_inscribed.clear();
905 for (
size_t i = 0; i < geom_indexes.size(); i++) {
906 int idx = geom_indexes[i];
908 egsFatal(
"EGS_ASwitchedEnvelope:: %d is not a valid geometry index\n", idx);
913 cur_ptr = geom_indexes[0];
920 if ((0 <= ireg) && (ireg <
nregbase)) {
921 size_t nactive = getGeomsInRegion(ireg).size();
931 if ((0 <= ireg) && (ireg <
nregbase)) {
932 size_t nactive = getGeomsInRegion(ireg).size();
933 size_t ntotal = EGS_AEnvelope::getGeomsInRegion(ireg).size();
934 return nactive < ntotal;
942 vector<EGS_BaseGeometry *> to_activate;
945 cur_ptr = inscribed_index;
953 vector<EGS_BaseGeometry *>::iterator loc = find(
954 active_inscribed.begin(), active_inscribed.end(),
957 if (loc != active_inscribed.end()) {
958 active_inscribed.erase(loc);
963 cur_ptr = cur_ptr ==
ninscribed -1 ? 0 : cur_ptr + 1;
964 vector<EGS_BaseGeometry *> to_activate;
979 egsWarning(
"Invalid transform input given\n");
995 static void setInputs() {
998 setBaseGeometryInputs(
false);
1000 geomBlockInput->getSingleInput(
"library")->setValues({
"egs_autoenvelope"});
1003 geomBlockInput->addSingleInput(
"type",
false,
"The type of auto envelope. A switched envelope only provides extra functionality in applications that specifically utilize it.", {
"EGS_AEnvelope",
"EGS_ASwitchedEnvelope"});
1004 geomBlockInput->addSingleInput(
"base geometry",
true,
"The name of a predefined geometry that other geometries will be inscribed inside. They must not touch the surfaces of this geometry.");
1005 geomBlockInput->addSingleInput(
"print debug info",
false,
"Whether or not to output additional debugging information. Defaults to No.", {
"Yes",
"No"});
1006 geomBlockInput->addSingleInput(
"output volume correction file",
false,
"Whether to output, or the format for the output of a file containing volume corrections. Defaults to No. Using Yes is equivalent to Text.", {
"Yes",
"No",
"Text",
"gzip"});
1008 auto inscribedPtr = geomBlockInput->addBlockInput(
"inscribed geometry",
true);
1009 inscribedPtr->addSingleInput(
"inscribed geometry name",
true,
"Name of a previously defined geometry");
1010 auto transfPtr = inscribedPtr->addBlockInput(
"transformations",
false);
1011 addTransformationBlock(transfPtr);
1013 auto regionPtr = inscribedPtr->addBlockInput(
"region discovery",
true);
1014 regionPtr->addSingleInput(
"action",
false,
"Optionally apply volume corrections or zero volumes. Defaults to Discover.", {
"discover",
"discover and correct volume",
"discover and zero volume"});
1015 auto volFilePtr = regionPtr->addSingleInput(
"volume correction file",
false,
"The path to a volume correction file to use instead of calculating volumes by sampling.");
1016 regionPtr->addSingleInput(
"density of random points (cm^-3)",
false,
"Sampling density for volume corrections. Defaults to 1e8.");
1018 auto shapePtr = regionPtr->addBlockInput(
"shape",
false);
1019 setShapeInputs(shapePtr);
1021 addRngDefinitionBlock(regionPtr);
1024 EGS_AENVELOPE_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
1028 return geomBlockInput;
1039 vector<string> debug_choices;
1040 debug_choices.push_back(
"no");
1041 debug_choices.push_back(
"yes");
1042 debug = input->
getInput(
"print debug info", debug_choices, 0);
1044 int output_vc_file_choice;
1045 vector<string> vc_file_choices;
1046 vc_file_choices.push_back(
"no");
1047 vc_file_choices.push_back(
"yes");
1048 vc_file_choices.push_back(
"text");
1049 vc_file_choices.push_back(
"gzip");
1050 output_vc_file_choice = input->
getInput(
"output volume correction file", vc_file_choices, 0);
1051 string output_vc_file = vc_file_choices[output_vc_file_choice];
1053 #ifndef HAS_GZSTREAM
1054 if (output_vc_file ==
"gzip") {
1056 "GZip file output requested but not compiled with gzstream.\n"
1057 "Please recompile with gzstream support.\n"
1065 string base_geom_name;
1066 int err = input->
getInput(base_geom_keyword, base_geom_name);
1068 egsWarning(geom_class_msg, (
"'"+
string(base_geom_keyword)+
"' input not found").c_str());
1073 err = input->
getInput(type_keyword, type);
1080 egsWarning(geom_class_msg, (
"Unable to find geometry '"+base_geom_name+
"'").c_str());
1085 if (!inscribed_input) {
1086 egsWarning(geom_class_msg, (
"Missing '"+
string(inscribed_geom_keyword)+
"' input item").c_str());
1090 string inscribed_geom_name;
1091 err = inscribed_input->
getInput(inscribed_geom_name_keyword, inscribed_geom_name);
1093 egsWarning(geom_class_msg, (
"'"+
string(inscribed_geom_name_keyword)+
"' input not found").c_str());
1098 if (!inscribed_geom) {
1099 egsWarning(geom_class_msg, (
"Unable to find geometry '"+inscribed_geom_name+
"'").c_str());
1103 vector<EGS_AffineTransform *> transforms;
1113 if (!vcopts->
valid) {
1114 egsWarning(geom_class_msg,
"Missing or invalid 'region discovery' input item");
1118 delete inscribed_input;
1121 vector<AEnvelopeAux> inscribed;
1122 if (transforms.size()>0) {
1123 for (
size_t i=0; i < transforms.size(); i++) {
1124 inscribed.push_back(
AEnvelopeAux(inscribed_geom, transforms[i], vcopts));
1129 inscribed.push_back(
AEnvelopeAux(inscribed_geom, unityt, vcopts));
1133 if (type ==
"EGS_ASwitchedEnvelope") {
1137 result =
new EGS_AEnvelope(base_geom, inscribed,
"", (
bool)debug, output_vc_file);
A fast envelope geometry with automatic region detection.
vector< EGS_BaseGeometry * > inscribed_geoms
The inscribed geometries.
vector< EGS_AffineTransform * > transforms
The inscribed geometries.
static vector< EGS_AffineTransform * > createTransforms(EGS_Input *inpt)
Take a block of transformations and return vector of EGS_AffineTransforms.
static string type
Geometry type.
static bool allowedBaseGeomType(const string &geom_type)
function for checking whether a given geometry type is allowed to be used as a base geometry
int nregbase
Number of regions in the base geometry.
EGS_BaseGeometry * base_geom
The envelope geometry.
void setMedia(EGS_Input *, int, const int *)
Don't set media for an envelope geometry.
int ninscribed
Number of regions in the base geometry.
This geometry type allows you to activate and deactivate inscribed geometries in custom egspp user co...
void deactivateByIndex(int inscribed_index)
bool hasInactiveGeom(int ireg)
void activateByIndex(int inscribed_index)
void setActiveGeometries(vector< EGS_BaseGeometry * > geoms)
void setActiveByIndex(int inscribed_index)
static string type
Geometry type.
bool hasActiveGeom(int ireg)
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
virtual EGS_Float hownear(int ireg, const EGS_Vector &x)=0
Calculate the distance to a boundary for position x in any direction.
int deref()
Decrease the reference count to this geometry.
virtual bool hasBooleanProperty(int ireg, EGS_BPType prop) const
Is the boolean property prop set for region ireg ?
virtual EGS_Float howfarToOutside(int ireg, const EGS_Vector &x, const EGS_Vector &u)
virtual const string & getType() const =0
Get the geometry type.
int nreg
Number of local regions in this geometry.
virtual int howfar(int ireg, const EGS_Vector &x, const EGS_Vector &u, EGS_Float &t, int *newmed=0, EGS_Vector *normal=0)=0
Calculate the distance to a boundary from x along the direction u.
bool has_rho_scaling
Does this geometry have relative mass density scvaling?
virtual bool hasRhoScaling()
Does this geometry object have a mass density scaling feature?
virtual bool isRealRegion(int ireg) const
Returnes true if ireg is a real region, false otherwise.
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
virtual bool isInside(const EGS_Vector &x)=0
Is the position x inside the geometry?
const string & getName() const
Get the name of this geometry.
virtual EGS_Float getRelativeRho(int ireg) const
Get the relative mass density in region ireg.
bool isConvex() const
Is the geometry convex?
virtual int getMaxStep() const
Returns the maximum number of steps through the geometry.
virtual int medium(int ireg) const
Returns the medium index in region ireg.
int regions() const
Returns the number of local regions in this geometry.
virtual void printInfo() const
Print information about this geometry.
int ref()
Increase the reference count to this geometry.
static EGS_BaseGeometry * getGeometry(const string &Name)
Get a pointer to the geometry named Name.
virtual int isWhere(const EGS_Vector &x)=0
In which region is poisition x?
Base random number generator class. All random number generators should be derived from this class.
A class representing 3D vectors.
Volume correction initialization helper class.
An envelope geometry with automatic inscribed region detection (inspired by EGS_FastEnvelope)
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
EGS_InfoFunction EGS_EXPORT egsInformation
Always use this function for reporting the progress of a simulation and any other type of information...
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.
VCResults findRegionsWithInscribed(VCOptions *opts, EGS_BaseGeometry *base, vector< EGS_BaseGeometry * > inscribed, vector< EGS_AffineTransform * > transforms)
Run the MC simulation.
VCResults loadFileResults(VCOptions *opts, EGS_BaseGeometry *base, vector< EGS_BaseGeometry * > inscribed, vector< EGS_AffineTransform * > transforms)
Load volume corrections from external file.
pair< EGS_BaseGeometry *, int > GeomRegPairT
A helper class for initializing auto envelopes.
EGS_Float t
distance to next region boundary
EGS_Float rhof
relative mass density in that region
vector< EGS_Float > corrected_volumes
void outputResults() const
vector< EGS_Float > uncorrected_volumes