Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ViewParameters.cc File Reference
#include "G4ViewParameters.hh"
#include "G4VisManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4Polyhedron.hh"
#include <sstream>
#include <cmath>

Go to the source code of this file.

Macros

#define G4warn   G4cout
 
#define INTERPOLATE(param)
 
#define INTERPOLATELOG(param)
 
#define INTERPOLATEUNITVECTOR(vector)
 
#define INTERPOLATEVECTOR(vector)
 
#define INTERPOLATEPOINT(point)
 
#define INTERPOLATECOLOUR(colour)
 
#define CONTINUITY(quantity)
 
#define INTERPOLATEPLANE(plane)
 

Functions

std::ostream & operator<< (std::ostream &os, G4ViewParameters::DrawingStyle style)
 
std::ostream & operator<< (std::ostream &os, G4ViewParameters::SMROption option)
 
std::ostream & operator<< (std::ostream &os, const G4ViewParameters &v)
 

Macro Definition Documentation

◆ CONTINUITY

#define CONTINUITY (   quantity)
Value:
continuous = false; \
/* This follows the logic of the INTERPOLATE macro above; see comments therein */ \
if (i == 0) { \
if (v[1].quantity == v[0].quantity) { \
if (n == 1) continuous = true; \
else if (v[2].quantity == v[0].quantity) \
continuous = true; \
} \
} else if (i >= n - 1) { \
if (v[i+1].quantity == v[i].quantity) { \
if (n == 1) continuous = true; \
else if (v[i+1].quantity == v[i-1].quantity) \
continuous = true; \
} \
} else { \
if (v[i-1].quantity == v[i].quantity && \
v[i+1].quantity == v[i].quantity && \
v[i+2].quantity == v[i].quantity) \
continuous = true; \
}

◆ G4warn

#define G4warn   G4cout

Definition at line 43 of file G4ViewParameters.cc.

◆ INTERPOLATE

#define INTERPOLATE (   param)
Value:
/* This works out the interpolated param in i'th interval */ \
/* Assumes n >= 1 */ \
if (i == 0) { \
/* First interval */ \
mi = v[1].param - v[0].param; \
/* If there is only one interval, make start and end slopes equal */ \
/* (This results in a linear interpolation) */ \
if (n == 1) mi1 = mi; \
/* else the end slope of the interval takes account of the next waypoint along */ \
else mi1 = 0.5 * (v[2].param - v[0].param); \
} else if (i >= n - 1) { \
/* Similarly for last interval */ \
mi1 = v[i+1].param - v[i].param; \
/* If there is only one interval, make start and end slopes equal */ \
if (n == 1) mi = mi1; \
/* else the start slope of the interval takes account of the previous waypoint */ \
else mi = 0.5 * (v[i+1].param - v[i-1].param); \
} else { \
/* Full Catmull-Rom slopes use previous AND next waypoints */ \
mi = 0.5 * (v[i+1].param - v[i-1].param); \
mi1 = 0.5 * (v[i+2].param - v[i ].param); \
} \
real = h00 * v[i].param + h10 * mi + h01 * v[i+1].param + h11 * mi1;

◆ INTERPOLATECOLOUR

#define INTERPOLATECOLOUR (   colour)
Value:
INTERPOLATE(colour.GetRed()); red = real; \
INTERPOLATE(colour.GetGreen()); green = real; \
INTERPOLATE(colour.GetBlue()); blue = real; \
INTERPOLATE(colour.GetAlpha()); alpha = real;
#define INTERPOLATE(param)

◆ INTERPOLATELOG

#define INTERPOLATELOG (   param)
Value:
if (i == 0) { \
mi = std::log(v[1].param) - std::log(v[0].param); \
if (n == 1) mi1 = mi; \
else mi1 = 0.5 * (std::log(v[2].param) - std::log(v[0].param)); \
} else if (i >= n - 1) { \
mi1 = std::log(v[i+1].param) - std::log(v[i].param); \
if (n == 1) mi = mi1; \
else mi = 0.5 * (std::log(v[i+1].param) - std::log(v[i-1].param)); \
} else { \
mi = 0.5 * (std::log(v[i+1].param) - std::log(v[i-1].param)); \
mi1 = 0.5 * (std::log(v[i+2].param) - std::log(v[i ].param)); \
} \
real = std::exp(h00 * std::log(v[i].param) + h10 * mi + h01 * std::log(v[i+1].param) + h11 * mi1);

◆ INTERPOLATEPLANE

#define INTERPOLATEPLANE (   plane)
Value:
INTERPOLATE(plane.a()); a = real; \
INTERPOLATE(plane.b()); b = real; \
INTERPOLATE(plane.c()); c = real; \
INTERPOLATE(plane.d()); d = real;

◆ INTERPOLATEPOINT

#define INTERPOLATEPOINT (   point)
Value:
INTERPOLATE(point.x()); x = real; \
INTERPOLATE(point.y()); y = real; \
INTERPOLATE(point.z()); z = real;

◆ INTERPOLATEUNITVECTOR

#define INTERPOLATEUNITVECTOR (   vector)
Value:
INTERPOLATE(vector.x()); x = real; \
INTERPOLATE(vector.y()); y = real; \
INTERPOLATE(vector.z()); z = real;

◆ INTERPOLATEVECTOR

#define INTERPOLATEVECTOR (   vector)
Value:
INTERPOLATE(vector.x()); x = real; \
INTERPOLATE(vector.y()); y = real; \
INTERPOLATE(vector.z()); z = real;

Function Documentation

◆ operator<<() [1/3]

std::ostream & operator<< ( std::ostream &  os,
const G4ViewParameters v 
)

Definition at line 907 of file G4ViewParameters.cc.

907 {
908 os << "View parameters and options:";
909
910 os << "\n Drawing style: " << v.fDrawingStyle;
911
912 os << "\n Number of cloud points: " << v.fNumberOfCloudPoints;
913
914 os << "\n Auxiliary edges: ";
915 if (!v.fAuxEdgeVisible) os << "in";
916 os << "visible";
917
918 os << "\n Culling: ";
919 if (v.fCulling) os << "on";
920 else os << "off";
921
922 os << "\n Culling invisible objects: ";
923 if (v.fCullInvisible) os << "on";
924 else os << "off";
925
926 os << "\n Density culling: ";
927 if (v.fDensityCulling) {
928 os << "on - invisible if density less than "
929 << v.fVisibleDensity / (1. * g / cm3) << " g cm^-3";
930 }
931 else os << "off";
932
933 os << "\n Culling daughters covered by opaque mothers: ";
934 if (v.fCullCovered) os << "on";
935 else os << "off";
936
937 os << "\n Colour by density: ";
938 if (v.fCBDAlgorithmNumber <= 0) {
939 os << "inactive";
940 } else {
941 os << "Algorithm " << v.fCBDAlgorithmNumber << ", Parameters:";
942 for (auto p: v.fCBDParameters) {
943 os << ' ' << G4BestUnit(p,"Volumic Mass");
944 }
945 }
946
947 os << "\n Section flag: ";
948 if (v.fSection) os << "true, section/cut plane: " << v.fSectionPlane;
949 else os << "false";
950
951 if (v.IsCutaway()) {
952 os << "\n Cutaway planes: ";
953 for (size_t i = 0; i < v.fCutawayPlanes.size (); i++) {
954 os << ' ' << v.fCutawayPlanes[i];
955 }
956 }
957 else {
958 os << "\n No cutaway planes";
959 }
960
961 os << "\n Explode factor: " << v.fExplodeFactor
962 << " about centre: " << v.fExplodeCentre;
963
964 os << "\n No. of sides used in circle polygon approximation: "
965 << v.fNoOfSides;
966
967 os << "\n Viewpoint direction: " << v.fViewpointDirection;
968
969 os << "\n Up vector: " << v.fUpVector;
970
971 os << "\n Field half angle: " << v.fFieldHalfAngle;
972
973 os << "\n Zoom factor: " << v.fZoomFactor;
974
975 os << "\n Scale factor: " << v.fScaleFactor;
976
977 os << "\n Current target point: " << v.fCurrentTargetPoint;
978
979 os << "\n Dolly distance: " << v.fDolly;
980
981 os << "\n Light ";
982 if (v.fLightsMoveWithCamera) os << "moves";
983 else os << "does not move";
984 os << " with camera";
985
986 os << "\n Relative lightpoint direction: "
987 << v.fRelativeLightpointDirection;
988
989 os << "\n Actual lightpoint direction: "
990 << v.fActualLightpointDirection;
991
992 os << "\n Derived parameters for standard view of object of unit radius:";
993 G4ViewParameters tempVP = v;
994 tempVP.fDolly = 0.;
995 tempVP.fZoomFactor = 1.;
996 const G4double radius = 1.;
997 const G4double cameraDistance = tempVP.GetCameraDistance (radius);
998 const G4double nearDistance =
999 tempVP.GetNearDistance (cameraDistance, radius);
1000 const G4double farDistance =
1001 tempVP.GetFarDistance (cameraDistance, nearDistance, radius);
1002 const G4double right = tempVP.GetFrontHalfHeight (nearDistance, radius);
1003 os << "\n Camera distance: " << cameraDistance;
1004 os << "\n Near distance: " << nearDistance;
1005 os << "\n Far distance: " << farDistance;
1006 os << "\n Front half height: " << right;
1007
1008 os << "\n Default VisAttributes:\n " << v.fDefaultVisAttributes;
1009
1010 os << "\n Default TextVisAttributes:\n " << v.fDefaultTextVisAttributes;
1011
1012 os << "\n Default marker: " << v.fDefaultMarker;
1013
1014 os << "\n Global marker scale: " << v.fGlobalMarkerScale;
1015
1016 os << "\n Global lineWidth scale: " << v.fGlobalLineWidthScale;
1017
1018 os << "\n Marker ";
1019 if (v.fMarkerNotHidden) os << "not ";
1020 os << "hidden by surfaces.";
1021
1022 os << "\n Window size hint: "
1023 << v.fWindowSizeHintX << 'x'<< v.fWindowSizeHintX;
1024
1025 os << "\n X geometry string: " << v.fXGeometryString;
1026 os << "\n X geometry mask: "
1027 << std::showbase << std::hex << v.fGeometryMask
1028 << std::noshowbase << std::dec;
1029
1030 os << "\n Auto refresh: ";
1031 if (v.fAutoRefresh) os << "true";
1032 else os << "false";
1033
1034 os << "\n Background colour: " << v.fBackgroundColour;
1035
1036 os << "\n Picking requested: ";
1037 if (v.fPicking) os << "true";
1038 else os << "false";
1039
1040 os << "\n Rotation style: ";
1041 switch (v.fRotationStyle) {
1043 os << "constrainUpDirection (conventional HEP view)"; break;
1045 os << "freeRotation (Google-like rotation, using mouse-grab)"; break;
1046 default: os << "unrecognised"; break;
1047 }
1048
1049 os << "\n Vis attributes modifiers: ";
1050 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
1051 v.fVisAttributesModifiers;
1052 if (vams.empty()) {
1053 os << "None";
1054 } else {
1055 os << vams;
1056 }
1057
1058 os << "\n Time window parameters:"
1059 << "\n Start time: " << v.fStartTime/ns << " ns"
1060 << "\n End time: " << v.fEndTime/ns << " ns"
1061 << "\n Fade factor: " << v.fFadeFactor;
1062 if (!v.fDisplayHeadTime) {
1063 os << "\n Head time display not requested.";
1064 } else {
1065 os
1066 << "\n Head time position: "
1067 << v.fDisplayHeadTimeX << ' ' << v.fDisplayHeadTimeY
1068 << "\n Head time size: " << v.fDisplayHeadTimeSize
1069 << "\n Head time colour: " << v.fDisplayHeadTimeRed
1070 << ' ' << v.fDisplayHeadTimeGreen << ' ' << v.fDisplayHeadTimeBlue;
1071 }
1072 if (!v.fDisplayLightFront) {
1073 os << "\n Light front display not requested.";
1074 } else {
1075 os
1076 << "\n Light front position: "
1077 << v.fDisplayLightFrontX/mm << ' ' << v.fDisplayLightFrontY/mm
1078 << ' ' << v.fDisplayLightFrontZ/mm << " mm"
1079 << "\n Light front time: " << v.fDisplayLightFrontT/ns << " ns"
1080 << "\n Light front colour: " << v.fDisplayLightFrontRed
1081 << ' ' << v.fDisplayLightFrontGreen << ' ' << v.fDisplayLightFrontBlue;
1082 }
1083
1084 os << "\n Special Mesh Rendering";
1085 if (v.fSpecialMeshRendering) {
1086 os << " requested with option \"" << v.fSpecialMeshRenderingOption;
1087 os << "\" for ";
1088 if (v.fSpecialMeshVolumes.empty()) {
1089 os << "any mesh";
1090 } else {
1091 os << "selected meshes";
1092 for (const auto& vol: v.fSpecialMeshVolumes) {
1093 os << "\n " << vol.GetName() << ':' << vol.GetCopyNo();
1094 }
1095 }
1096 } else os << ": off";
1097 return os;
1098}
#define G4BestUnit(a, b)
double G4double
Definition: G4Types.hh:83
G4double GetCameraDistance(G4double radius) const
G4bool IsCutaway() const
G4double GetFarDistance(G4double cameraDistance, G4double nearDistance, G4double radius) const
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const
#define ns(x)
Definition: xmltok.c:1649

◆ operator<<() [2/3]

std::ostream & operator<< ( std::ostream &  os,
G4ViewParameters::DrawingStyle  style 
)

Definition at line 876 of file G4ViewParameters.cc.

878{
879 switch (style) {
881 os << "wireframe"; break;
883 os << "hlr - hidden lines removed"; break;
885 os << "hsr - hidden surfaces removed"; break;
887 os << "hlhsr - hidden line, hidden surface removed"; break;
889 os << "cloud - draw volume as a cloud of dots"; break;
890 default: os << "unrecognised"; break;
891 }
892 return os;
893}

◆ operator<<() [3/3]

std::ostream & operator<< ( std::ostream &  os,
G4ViewParameters::SMROption  option 
)

Definition at line 895 of file G4ViewParameters.cc.

897{
898 switch (option) {
900 os << "dots"; break;
902 os << "surfaces"; break;
903 }
904 return os;
905}