DDAlgorithm

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#ifndef DD_ALGO_PLUGIN_DD_ALGORITHM_H
#define DD_ALGO_PLUGIN_DD_ALGORITHM_H

#include "DetectorDescription/Core/interface/DDTypes.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include <vector>

class DDAlgorithmHandler;
class DDCompactView;

/** Abstract Base of all DDD algorithms. */
class DDAlgorithm {
  friend class DDAlgorithmHandler;

public:
  virtual ~DDAlgorithm() {}

  //! fetch the algorithm parameters
  /** an implementation of the initialize() method should initialize the algorithm
      by processing the provided parameters. Typically, data members of the
      derived algorithm are given meaningfull values. 
      Examples:\code double offset = nArgs["z-offset"];
      \code std::vector<double> vec = vArgs["X-Positions"];*/
  virtual void initialize(const DDNumericArguments& nArgs,
                          const DDVectorArguments& vArgs,
                          const DDMapArguments& mArgs,
                          const DDStringArguments& sArgs,
                          const DDStringVectorArguments& vsArgs) = 0;

  //! execute the algorithm
  /** an implementation of the execute() method creates detector description
      objects such as DDLogicalPart, DDSolid, ... */
  virtual void execute(DDCompactView&) = 0;

protected:
  //! returns the parent logical-part under which the algorithm creates sub-structures
  const DDLogicalPart& parent() const { return parent_; }

  //! the algorithm may only create sub-detector elements within on parent
  void setParent(const DDLogicalPart& parent) { parent_ = parent; }

private:
  //! parent part in which the algorithm creates sub-structures
  DDLogicalPart parent_;
};

#endif  // DD_ALGO_PLUGIN_DD_ALGORITHM_H