50 int limit =
sizeof(vertices) /
sizeof(
UVector3);
51 for (
int i = 0 ; i < limit; i++)
58 if (current.
x() > max.
x()) max.
x() = current.
x();
59 if (current.
x() < min.
x()) min.
x() = current.
x();
61 if (current.
y() > max.
y()) max.
y() = current.
y();
62 if (current.
y() < min.
y()) min.
y() = current.
y();
64 if (current.
z() > max.
z()) max.
z() = current.
z();
65 if (current.
z() < min.
z()) min.
z() = current.
z();
72 double number = (double) rand() / RAND_MAX;
73 double res = min + number * (max -
min);
93 std::streampos fsize = 0;
94 std::ifstream file(filePath.c_str(), std::ios::binary);
97 file.seekg(0, std::ios::end);
98 fsize = file.tellg() - fsize;
107 int sleng = haystack.length();
108 int nleng = needle.length();
110 if (sleng == 0 || nleng == 0)
113 for (
int i = 0, j = 0; i < sleng; j = 0, i++)
115 while (i + j < sleng && j < nleng && haystack[i + j] == needle[j])
123 const char* exceptionCode,
126 const char* description)
129 bool toBeAborted =
true;
130 static const std::string es_banner
131 =
"\n-------- EEEE ------- UException-START -------- EEEE -------\n";
132 static const std::string ee_banner
133 =
"\n-------- EEEE ------- UException-END --------- EEEE -------\n";
134 static const std::string ws_banner
135 =
"\n-------- WWWW ------- UException-START -------- WWWW -------\n";
136 static const std::string we_banner
137 =
"\n-------- WWWW -------- UException-END --------- WWWW -------\n";
138 std::ostringstream message;
139 message <<
"\n*** ExceptionHandler is not defined ***\n"
140 <<
"*** Exception : " << exceptionCode << std::endl
141 <<
" issued by : " << originOfException << std::endl
142 << description << std::endl;
146 std::cerr << es_banner << message.str() <<
"*** Fatal Exception ***"
147 << ee_banner << std::endl;
150 std::cerr << es_banner << message.str() <<
"*** Fatal Error In Argument ***"
151 << ee_banner << std::endl;
154 std::cerr << es_banner << message.str() <<
"*** Error ***" << level
155 << ee_banner << std::endl;
158 std::cerr << ws_banner << message.str() <<
"*** This is just a warning message ***"
159 << we_banner << std::endl;
163 std::cout << ws_banner << message.str()
164 <<
"*** This is just a message for your information. ***"
165 << we_banner << std::endl;
173 std::cerr << std::endl <<
"*** GException: Aborting execution ***" << std::endl;
static const G4double kInfinity
int FileSize(const std::string &filePath)
void Exception(const char *originOfException, const char *exceptionCode, UExceptionSeverity severity, int level, const char *description)
void Set(double xx, double yy, double zz)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
std::string ToString(int number)
int StrPos(const std::string &haystack, const std::string &needle)
double Random(double min=0.0, double max=1.0)
void TransformLimits(UVector3 &min, UVector3 &max, const UTransform3D &transformation)