Commit 06349ac90a0139c2e178ec4c5021e461a3cc394b

Authored by Jürgen Knödlseder
1 parent da52c893

Use gammalib namespace for GammaLib functions.

src/ctbin/ctbin.cpp
... ... @@ -503,7 +503,7 @@ void ctbin::bin_events(GCTAObservation* obs)
503 503 }
504 504  
505 505 // Set reference point to pointing
506   - if (toupper(m_coordsys) == "GAL") {
  506 + if (gammalib::toupper(m_coordsys) == "GAL") {
507 507 xref = pnt->dir().l_deg();
508 508 yref = pnt->dir().b_deg();
509 509 }
... ... @@ -558,13 +558,13 @@ void ctbin::bin_events(GCTAObservation* obs)
558 558 if (logTerse()) {
559 559 log << std::endl;
560 560 log.header1("Binning");
561   - log << parformat("Events in list");
  561 + log << gammalib::parformat("Events in list");
562 562 log << obs->events()->size() << std::endl;
563   - log << parformat("Events in map");
  563 + log << gammalib::parformat("Events in map");
564 564 log << num_in_map << std::endl;
565   - log << parformat("Events outside map area");
  565 + log << gammalib::parformat("Events outside map area");
566 566 log << num_outside_map << std::endl;
567   - log << parformat("Events outside energy bins");
  567 + log << gammalib::parformat("Events outside energy bins");
568 568 log << num_outside_ebds << std::endl;
569 569 }
570 570  
... ... @@ -690,7 +690,7 @@ void ctbin::free_members(void)
690 690 std::string ctbin::set_outfile_name(const std::string& filename) const
691 691 {
692 692 // Split input filename into path elements
693   - std::vector<std::string> elements = split(filename, "/");
  693 + std::vector<std::string> elements = gammalib::split(filename, "/");
694 694  
695 695 // The last path element is the filename
696 696 std::string outname = m_prefix + elements[elements.size()-1];
... ...
src/ctlike/ctlike.cpp
... ... @@ -264,9 +264,12 @@ void ctlike::run(void)
264 264  
265 265 // Write results into logger
266 266 if (logTerse()) {
267   - log << parformat("Maximum log likelihood") << m_logL << std::endl;
268   - log << parformat("Observed events (Nobs)") << num_events << std::endl;
269   - log << parformat("Predicted events (Npred)") << m_obs.npred();
  267 + log << gammalib::parformat("Maximum log likelihood");
  268 + log << m_logL << std::endl;
  269 + log << gammalib::parformat("Observed events (Nobs)");
  270 + log << num_events << std::endl;
  271 + log << gammalib::parformat("Predicted events (Npred)");
  272 + log << m_obs.npred();
270 273 log << " (Nobs - Npred = " << num_events-m_obs.npred();
271 274 log << ")" << std::endl;
272 275 log << m_obs.models() << std::endl;
... ... @@ -294,7 +297,7 @@ void ctlike::save(void)
294 297 m_outmdl = (*this)["outmdl"].filename();
295 298  
296 299 // Write results out as XML model
297   - if (toupper(m_outmdl) != "NONE") {
  300 + if (gammalib::toupper(m_outmdl) != "NONE") {
298 301 m_obs.models().save(m_outmdl);
299 302 }
300 303  
... ... @@ -351,7 +354,7 @@ void ctlike::get_parameters(void)
351 354 }
352 355  
353 356 // Get task parameters for event file loading
354   - m_stat = toupper((*this)["stat"].string());
  357 + m_stat = gammalib::toupper((*this)["stat"].string());
355 358 m_caldb = (*this)["caldb"].string();
356 359 m_irf = (*this)["irf"].string();
357 360  
... ...
src/ctmodel/ctmodel.cpp
... ... @@ -403,7 +403,7 @@ void ctmodel::get_parameters(void)
403 403  
404 404 // If there is no input filename then read all parameters that
405 405 // are required to build a model map from scratch
406   - if ((m_infile == "NONE") || (strip_whitespace(m_infile) == "")) {
  406 + if ((m_infile == "NONE") || (gammalib::strip_whitespace(m_infile) == "")) {
407 407 m_ra = (*this)["ra"].real();
408 408 m_dec = (*this)["dec"].real();
409 409 m_deadc = (*this)["deadc"].real();
... ... @@ -474,7 +474,7 @@ void ctmodel::setup_obs(void)
474 474  
475 475 // If no input filename has been specified, then create a model map
476 476 // from the task parameters
477   - if ((m_infile == "NONE") || (strip_whitespace(m_infile) == "")) {
  477 + if ((m_infile == "NONE") || (gammalib::strip_whitespace(m_infile) == "")) {
478 478  
479 479 // Set pointing direction
480 480 GCTAPointing pnt;
... ... @@ -640,7 +640,7 @@ void ctmodel::model_map(GCTAObservation* obs, const GModels&amp; models)
640 640  
641 641 // Log results
642 642 if (logTerse()) {
643   - log << parformat("Model events in cube");
  643 + log << gammalib::parformat("Model events in cube");
644 644 log << sum << std::endl;
645 645 }
646 646  
... ... @@ -767,7 +767,7 @@ void ctmodel::free_members(void)
767 767 std::string ctmodel::set_outfile_name(const std::string& filename) const
768 768 {
769 769 // Split input filename into path elements
770   - std::vector<std::string> elements = split(filename, "/");
  770 + std::vector<std::string> elements = gammalib::split(filename, "/");
771 771  
772 772 // The last path element is the filename
773 773 std::string outname = m_prefix + elements[elements.size()-1];
... ...
src/ctobssim/ctobssim.cpp
... ... @@ -251,8 +251,8 @@ void ctobssim::run(void)
251 251 log << std::endl;
252 252 log.header1("Seed values");
253 253 for (int i = 0; i < m_rans.size(); ++i) {
254   - log << parformat("Seed "+str(i));
255   - log << str(m_rans[i].seed()) << std::endl;
  254 + log << gammalib::parformat("Seed "+gammalib::str(i));
  255 + log << gammalib::str(m_rans[i].seed()) << std::endl;
256 256 }
257 257 }
258 258  
... ... @@ -640,9 +640,9 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models,
640 640  
641 641 // Dump simulation cone information
642 642 if (logNormal()) {
643   - *wrklog << parformat("Simulation area");
644   - *wrklog << str(m_area) << " cm2" << std::endl;
645   - *wrklog << parformat("Simulation cone");
  643 + *wrklog << gammalib::parformat("Simulation area");
  644 + *wrklog << m_area << " cm2" << std::endl;
  645 + *wrklog << gammalib::parformat("Simulation cone");
646 646 *wrklog << "RA=" << dir.ra_deg() << " deg";
647 647 *wrklog << ", Dec=" << dir.dec_deg() << " deg";
648 648 *wrklog << ", r=" << rad << " deg" << std::endl;
... ... @@ -664,7 +664,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models,
664 664 indent++;
665 665 wrklog->indent(indent);
666 666 }
667   - *wrklog << parformat("Time interval", indent);
  667 + *wrklog << gammalib::parformat("Time interval", indent);
668 668 *wrklog << tmin.convert(m_cta_ref);
669 669 *wrklog << " - ";
670 670 *wrklog << tmax.convert(m_cta_ref);
... ... @@ -684,7 +684,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models,
684 684 indent++;
685 685 wrklog->indent(indent);
686 686 }
687   - *wrklog << parformat("Energy range", indent);
  687 + *wrklog << gammalib::parformat("Energy range", indent);
688 688 *wrklog << emin << " - " << emax << std::endl;
689 689 }
690 690  
... ... @@ -722,7 +722,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models,
722 722 indent++;
723 723 wrklog->indent(indent);
724 724 }
725   - *wrklog << parformat("Time slice", indent);
  725 + *wrklog << gammalib::parformat("Time slice", indent);
726 726 *wrklog << tstart.convert(m_cta_ref);
727 727 *wrklog << " - ";
728 728 *wrklog << tstop.convert(m_cta_ref);
... ... @@ -775,14 +775,14 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models,
775 775  
776 776 // Dump simulation results
777 777 if (logNormal()) {
778   - *wrklog << parformat("MC source photons", indent);
779   - *wrklog << str(nphotons);
  778 + *wrklog << gammalib::parformat("MC source photons", indent);
  779 + *wrklog << nphotons;
780 780 if (model->name().length() > 0) {
781 781 *wrklog << " [" << model->name() << "]";
782 782 }
783 783 *wrklog << std::endl;
784   - *wrklog << parformat("MC source events", indent);
785   - *wrklog << str(events->size());
  784 + *wrklog << gammalib::parformat("MC source events", indent);
  785 + *wrklog << events->size();
786 786 if (model->name().length() > 0) {
787 787 *wrklog << " [" << model->name() << "]";
788 788 }
... ... @@ -796,8 +796,8 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models,
796 796  
797 797 // Dump simulation results
798 798 if (logNormal()) {
799   - *wrklog << parformat("MC source events", indent);
800   - *wrklog << str(events->size());
  799 + *wrklog << gammalib::parformat("MC source events", indent);
  800 + *wrklog << events->size();
801 801 *wrklog << " (all source models)";
802 802 *wrklog << std::endl;
803 803 }
... ... @@ -909,8 +909,8 @@ void ctobssim::simulate_background(GCTAObservation* obs,
909 909  
910 910 // Dump simulation results
911 911 if (logNormal()) {
912   - *wrklog << parformat("MC background events");
913   - *wrklog << str(list->size()) << std::endl;
  912 + *wrklog << gammalib::parformat("MC background events");
  913 + *wrklog << list->size() << std::endl;
914 914 }
915 915  
916 916 // Free event list
... ... @@ -1087,7 +1087,7 @@ void ctobssim::save_xml(void)
1087 1087 if (obs != NULL) {
1088 1088  
1089 1089 // Set event output file name
1090   - std::string outfile = m_prefix + str(file_num) + ".fits";
  1090 + std::string outfile = m_prefix + gammalib::str(file_num) + ".fits";
1091 1091  
1092 1092 // Store output file name in observation
1093 1093 obs->eventfile(outfile);
... ...
src/ctselect/ctselect.cpp
... ... @@ -537,7 +537,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string&amp; filename)
537 537 sprintf(cmax, "%.8f", tmax);
538 538 selection = "TIME >= "+std::string(cmin)+" && TIME <= "+std::string(cmax);
539 539 if (logTerse()) {
540   - log << parformat("Time range");
  540 + log << gammalib::parformat("Time range");
541 541 log << tmin << " - " << tmax << " s" << std::endl;
542 542 }
543 543 if (selection.length() > 0) {
... ... @@ -550,7 +550,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string&amp; filename)
550 550 sprintf(cmax, "%.8f", m_emax);
551 551 selection += "ENERGY >= "+std::string(cmin)+" && ENERGY <= "+std::string(cmax);
552 552 if (logTerse()) {
553   - log << parformat("Energy range");
  553 + log << gammalib::parformat("Energy range");
554 554 log << m_emin << " - " << m_emax << " TeV" << std::endl;
555 555 }
556 556 if (selection.length() > 0) {
... ... @@ -565,22 +565,22 @@ void ctselect::select_events(GCTAObservation* obs, const std::string&amp; filename)
565 565 std::string(cdec)+",RA,DEC) <= " +
566 566 std::string(crad);
567 567 if (logTerse()) {
568   - log << parformat("Acceptance cone centre");
  568 + log << gammalib::parformat("Acceptance cone centre");
569 569 log << "RA=" << ra << ", DEC=" << dec << " deg" << std::endl;
570   - log << parformat("Acceptance cone radius");
  570 + log << gammalib::parformat("Acceptance cone radius");
571 571 log << m_rad << " deg" << std::endl;
572 572 }
573 573 if (logTerse()) {
574   - log << parformat("cfitsio selection");
  574 + log << gammalib::parformat("cfitsio selection");
575 575 log << selection << std::endl;
576 576 }
577 577  
578 578 // Add additional expression
579   - if (strip_whitespace(m_expr).length() > 0) {
  579 + if (gammalib::strip_whitespace(m_expr).length() > 0) {
580 580 if (selection.length() > 0) {
581 581 selection += " && ";
582 582 }
583   - selection += "("+strip_whitespace(m_expr)+")";
  583 + selection += "("+gammalib::strip_whitespace(m_expr)+")";
584 584 }
585 585  
586 586 // Build input filename including selection expression
... ... @@ -588,7 +588,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string&amp; filename)
588 588 if (selection.length() > 0)
589 589 expression += "[EVENTS]["+selection+"]";
590 590 if (logTerse()) {
591   - log << parformat("FITS filename");
  591 + log << gammalib::parformat("FITS filename");
592 592 log << expression << std::endl;
593 593 }
594 594  
... ... @@ -850,7 +850,7 @@ std::string ctselect::check_infile(const std::string&amp; filename) const
850 850 std::string ctselect::set_outfile_name(const std::string& filename) const
851 851 {
852 852 // Split input filename into path elements
853   - std::vector<std::string> elements = split(filename, "/");
  853 + std::vector<std::string> elements = gammalib::split(filename, "/");
854 854  
855 855 // The last path element is the filename
856 856 std::string outname = m_prefix + elements[elements.size()-1];
... ...
src/ctskymap/ctskymap.cpp
... ... @@ -425,7 +425,7 @@ void ctskymap::init_map(GCTAObservation* obs)
425 425 }
426 426  
427 427 // Set reference point to pointing
428   - if (toupper(m_coordsys) == "GAL") {
  428 + if (gammalib::toupper(m_coordsys) == "GAL") {
429 429 xref = pnt->dir().l_deg();
430 430 yref = pnt->dir().b_deg();
431 431 }
... ... @@ -512,13 +512,13 @@ void ctskymap::map_events(GCTAObservation* obs)
512 512 if (logTerse()) {
513 513 log << std::endl;
514 514 log.header1("Mapping");
515   - log << parformat("Events in list");
  515 + log << gammalib::parformat("Events in list");
516 516 log << obs->events()->size() << std::endl;
517   - log << parformat("Events in map");
  517 + log << gammalib::parformat("Events in map");
518 518 log << num_in_map << std::endl;
519   - log << parformat("Events outside map area");
  519 + log << gammalib::parformat("Events outside map area");
520 520 log << num_outside_map << std::endl;
521   - log << parformat("Events outside energy range");
  521 + log << gammalib::parformat("Events outside energy range");
522 522 log << num_outside_erange << std::endl;
523 523 }
524 524  
... ...