Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:54

0001 #ifndef DD_ALGO_PLUGIN_DD_ALGORITHM_H
0002 #define DD_ALGO_PLUGIN_DD_ALGORITHM_H
0003 
0004 #include "DetectorDescription/Core/interface/DDTypes.h"
0005 #include "DetectorDescription/Core/interface/DDCompactView.h"
0006 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0007 #include <vector>
0008 
0009 class DDAlgorithmHandler;
0010 class DDCompactView;
0011 
0012 /** Abstract Base of all DDD algorithms. */
0013 class DDAlgorithm {
0014   friend class DDAlgorithmHandler;
0015 
0016 public:
0017   virtual ~DDAlgorithm() {}
0018 
0019   //! fetch the algorithm parameters
0020   /** an implementation of the initialize() method should initialize the algorithm
0021       by processing the provided parameters. Typically, data members of the
0022       derived algorithm are given meaningfull values. 
0023       Examples:\code double offset = nArgs["z-offset"];
0024       \code std::vector<double> vec = vArgs["X-Positions"];*/
0025   virtual void initialize(const DDNumericArguments& nArgs,
0026                           const DDVectorArguments& vArgs,
0027                           const DDMapArguments& mArgs,
0028                           const DDStringArguments& sArgs,
0029                           const DDStringVectorArguments& vsArgs) = 0;
0030 
0031   //! execute the algorithm
0032   /** an implementation of the execute() method creates detector description
0033       objects such as DDLogicalPart, DDSolid, ... */
0034   virtual void execute(DDCompactView&) = 0;
0035 
0036 protected:
0037   //! returns the parent logical-part under which the algorithm creates sub-structures
0038   const DDLogicalPart& parent() const { return parent_; }
0039 
0040   //! the algorithm may only create sub-detector elements within on parent
0041   void setParent(const DDLogicalPart& parent) { parent_ = parent; }
0042 
0043 private:
0044   //! parent part in which the algorithm creates sub-structures
0045   DDLogicalPart parent_;
0046 };
0047 
0048 #endif  // DD_ALGO_PLUGIN_DD_ALGORITHM_H