Commit 7b4aed9fd6d9a6a81594c9ff65c79d5c086c20b5
1 parent
5d51fc36
Reduce number of tests for containment radius.
Showing
1 changed file
with
16 additions
and
21 deletions
inst/cta/test/test_CTA.cpp
| ... | ... | @@ -379,6 +379,7 @@ void TestGCTAResponse::test_response_psf(void) |
| 379 | 379 | |
| 380 | 380 | // Integrate Psf |
| 381 | 381 | GEnergy eng; |
| 382 | + double sum_check = 0.1; | |
| 382 | 383 | for (double e = 0.1; e < 10.0; e *= 2.0) { |
| 383 | 384 | eng.TeV(e); |
| 384 | 385 | double r = 0.0; |
| ... | ... | @@ -395,11 +396,13 @@ void TestGCTAResponse::test_response_psf(void) |
| 395 | 396 | // since 'sum' already totals to 1.0, its also a 'fraction', |
| 396 | 397 | // which we can plug back into containment_radius(), to compare |
| 397 | 398 | // with the origial radius 'r' |
| 398 | - if (sum < 1.0 && sum > 0.0) { | |
| 399 | - rcont = rsp.psf()->containment_radius(sum, eng.log10TeV()); | |
| 400 | - char percent[50] ; | |
| 401 | - sprintf(percent, "%8.5f", sum*100.0) ; | |
| 402 | - test_value(rcont, r*gammalib::deg2rad, 0.1, "PSF containment radius for "+eng.print()+" and " + percent + "% containment"); | |
| 399 | + if (sum > sum_check && sum < 1.0) { | |
| 400 | + rcont = rsp.psf()->containment_radius(sum, eng.log10TeV()); | |
| 401 | + sum_check += 0.1; | |
| 402 | + std::string msg = "PSF containment radius for "+eng.print()+ | |
| 403 | + " and "+gammalib::str(sum*100.0)+ | |
| 404 | + "% containment"; | |
| 405 | + test_value(rcont, r*gammalib::deg2rad, 0.1, msg); | |
| 403 | 406 | } |
| 404 | 407 | } |
| 405 | 408 | test_value(sum, 1.0, 0.001, "PSF integration for "+eng.print()); |
| ... | ... | @@ -428,6 +431,7 @@ void TestGCTAResponse::test_response_psf_king(void) |
| 428 | 431 | |
| 429 | 432 | // Integrate Psf |
| 430 | 433 | GEnergy eng; |
| 434 | + double sum_check = 0.1; | |
| 431 | 435 | for (double e = 0.1; e < 10.0; e *= 2.0) { |
| 432 | 436 | eng.TeV(e); |
| 433 | 437 | double r_max = rsp.psf()->delta_max(eng.log10TeV()) * gammalib::rad2deg; |
| ... | ... | @@ -441,27 +445,18 @@ void TestGCTAResponse::test_response_psf_king(void) |
| 441 | 445 | sum += rsp.psf(r * gammalib::deg2rad, 0.0, 0.0, 0.0, 0.0, eng.log10TeV()) * |
| 442 | 446 | gammalib::twopi * std::sin(r * gammalib::deg2rad) * dr * |
| 443 | 447 | gammalib::deg2rad; |
| 444 | - //sum += rsp.psf(r * gammalib::deg2rad, 0.0, 0.0, 0.0, 0.0, eng.log10TeV()) * | |
| 445 | - // gammalib::twopi * dr * gammalib::deg2rad; | |
| 446 | 448 | |
| 447 | 449 | // since 'sum' already totals to 1.0, its also a 'fraction', |
| 448 | 450 | // which we can plug back into containment_radius(), to compare |
| 449 | 451 | // with the origial radius 'r' |
| 450 | - if ( sum > 0.0 && sum < 1.0 ) { | |
| 451 | - rcont = rsp.psf()->containment_radius(sum, eng.log10TeV()); | |
| 452 | - char percent[50] ; | |
| 453 | - sprintf( percent, "%8.5f", sum*100.0 ) ; | |
| 454 | - test_value( rcont, r*gammalib::deg2rad, 0.1, "PSF king containment radius for "+eng.print()+" and " + percent + "% containment"); | |
| 452 | + if (sum > sum_check && sum < 1.0) { | |
| 453 | + rcont = rsp.psf()->containment_radius(sum, eng.log10TeV()); | |
| 454 | + sum_check += 0.1; | |
| 455 | + std::string msg = "King PSF containment radius for "+eng.print()+ | |
| 456 | + " and "+gammalib::str(sum*100.0)+ | |
| 457 | + "% containment"; | |
| 458 | + test_value(rcont, r*gammalib::deg2rad, 0.1, msg); | |
| 455 | 459 | } |
| 456 | - //std::cout << "psf_king | en=" << eng.print() << " r=" << r << " rcont=" << rcont << " sum=" << sum << std::endl; | |
| 457 | - //char status[30] = "" ; | |
| 458 | - //if ( fabs(r-rcont) > 0.006 ) { | |
| 459 | - // sprintf( status, "fail!" ) ; | |
| 460 | - //} | |
| 461 | - //else { | |
| 462 | - // sprintf( status, "ok" ) ; | |
| 463 | - //} | |
| 464 | - //printf( "psf_king | en=%5.1f r=%7.5f rcont=%9.3e fabs(r-rcont)=%9.3e sum=%9.3e %5s\n", eng.TeV(), r, rcont, fabs(r-rcont), sum, status ) ; | |
| 465 | 460 | } |
| 466 | 461 | test_value(sum, 1.0, 0.001, "PSF integration for "+eng.print()); |
| 467 | 462 | ... | ... |