Newer
Older
TB_Chris / TbKernel / src / lib / .svn / text-base / TbAlgorithm.cpp.svn-base
  1. // Boost
  2. #include "boost/format.hpp"
  3.  
  4. // Local
  5. #include "TbKernel/TbAlgorithm.h"
  6.  
  7. //=============================================================================
  8. // Standard constructor
  9. //=============================================================================
  10. TbAlgorithm::TbAlgorithm(const std::string& name, ISvcLocator* pSvcLocator)
  11. : GaudiTupleAlg(name, pSvcLocator) {
  12.  
  13. declareProperty("PrintConfiguration", m_printConfiguration = false);
  14. declareProperty("MaskedPlanes", m_maskedPlanes = {});
  15.  
  16. }
  17.  
  18. //=============================================================================
  19. // Destructor
  20. //=============================================================================
  21. TbAlgorithm::~TbAlgorithm() {}
  22.  
  23. //=============================================================================
  24. // Initialisation
  25. //=============================================================================
  26. StatusCode TbAlgorithm::initialize() {
  27.  
  28. // Initialise the base class.
  29. StatusCode sc = GaudiTupleAlg::initialize();
  30. if (sc.isFailure()) return sc;
  31. // Get the number of telescope planes.
  32. m_nPlanes = geomSvc()->modules().size();
  33. m_nDevices = geomSvc()->nDevices();
  34. // Set the flags whether a plane is masked or not.
  35. m_masked.resize(m_nPlanes, false);
  36. for (const unsigned int plane : m_maskedPlanes) {
  37. m_masked[plane] = true;
  38. }
  39.  
  40. setHistoTopDir("Tb/");
  41. // If requested, print the properties specific to this algorithm.
  42. if (m_printConfiguration) {
  43. boost::format fmt(" %|-30.30s|%|32t| %s ");
  44. const auto& props = this->getProperties();
  45. info() << std::string(70, '-') << endmsg;
  46. info() << "Configuration of " << this->name() << endmsg;
  47. info() << std::string(70, '-') << endmsg;
  48. for (auto it = props.crbegin(), end = props.crend(); it != end; ++it) {
  49. const std::string name = (*it)->name();
  50. // Stop when we reach the base class properties.
  51. if (name == "PrintConfiguration") break;
  52. info() << fmt % name % (*it)->toString() << endmsg;
  53. }
  54. }
  55. return StatusCode::SUCCESS;
  56.  
  57. }
  58.  
  59. //=============================================================================
  60. // Main execution
  61. //=============================================================================
  62. StatusCode TbAlgorithm::execute() {
  63.  
  64. return StatusCode::SUCCESS;
  65.  
  66. }
  67.  
  68. //=============================================================================
  69. // Finalisation
  70. //=============================================================================
  71. StatusCode TbAlgorithm::finalize() {
  72.  
  73. return GaudiTupleAlg::finalize();
  74. }