Skip to content

Commit d39003b

Browse files
Merge pull request #518 from JanNiklasB/master
ObserverTimeEvolution minimum errormessage bug
2 parents e593b57 + cc7427e commit d39003b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if(ENABLE_GIT)
7070
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
7171
git_describe(GIT_DESC --tags)
7272
endif(ENABLE_GIT)
73-
IF(NOT ENABLE_GIT OR (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND"))
73+
IF(NOT ENABLE_GIT OR ("${GIT_SHA1}" STREQUAL "GITDIR-NOTFOUND"))
7474
set(GIT_REFSPEC "")
7575
set(GIT_SHA1 "")
7676
set(GIT_DESC "${CRPROPA_RELEASE_VERSION}-no-git")

src/module/Observer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,17 +246,17 @@ std::string ObserverParticleIdVeto::getDescription() const {
246246
ObserverTimeEvolution::ObserverTimeEvolution() {}
247247

248248
ObserverTimeEvolution::ObserverTimeEvolution(double min, double dist, double numb) {
249+
setIsLogarithmicScaling(false);
249250
setMaximum(min + (numb - 1) * dist);
250251
setMinimum(min);
251252
setNIntervals(numb);
252-
setIsLogarithmicScaling(false);
253253
}
254254

255255
ObserverTimeEvolution::ObserverTimeEvolution(double min, double max, double numb, bool log) {
256+
setIsLogarithmicScaling(log);
256257
setMinimum(min);
257258
setMaximum(max);
258259
setNIntervals(numb);
259-
setIsLogarithmicScaling(log);
260260
}
261261

262262
ObserverTimeEvolution::ObserverTimeEvolution(const std::vector<double> &detList){
@@ -335,7 +335,7 @@ void ObserverTimeEvolution::addTimeRange(double min, double max, double numb, bo
335335
if (log) {
336336
if ( min <= 0 ){
337337
std::cout << "min can not be <= 0 if log=true" << std::endl;
338-
throw new std::invalid_argument("min can not be <= 0 if log=true");
338+
throw new std::runtime_error("min can not be <= 0 if log=true");
339339
}
340340
addTime(min * pow(max / min, i / (numb - 1.0)));
341341
} else {
@@ -355,9 +355,9 @@ void ObserverTimeEvolution::setTimes(const std::vector<double> &detList){
355355
}
356356

357357
void ObserverTimeEvolution::setMinimum(double min){
358-
if ( min <= 0 ){
358+
if ( (min <= 0) && isLogarithmicScaling){
359359
std::cout << "minimum can not be <= 0 if isLogarithmicScaling=true" << std::endl;
360-
throw new std::invalid_argument("minimum can not be <= 0 if isLogarithmicScaling=true");
360+
throw new std::runtime_error("minimum can not be <= 0 if isLogarithmicScaling=true");
361361
}
362362
this->minimum = min;
363363
}

0 commit comments

Comments
 (0)