CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DetectorDescription/Core/interface/DDCompactView.h

Go to the documentation of this file.
00001 #ifndef DDCompactView_h
00002 #define DDCompactView_h
00003 
00004 #include <vector>
00005 
00006 #include "DetectorDescription/Core/interface/DDAlgo.h"
00007 #include "DetectorDescription/Core/interface/DDCompactViewImpl.h"
00008 #include "DetectorDescription/Core/interface/graphwalker.h"
00009 
00010 
00011 class DDPartSelector;
00012 class DDPhysicalPart;
00013 namespace DDI {
00014   class Material;
00015   class Solid;
00016   class LogicalPart;
00017   class Specific;
00018 }
00019 
00020 
00027 //MEC: these comments are kept from original... Will we ever do this? don't think so.
00028 //FIXME: DDCompactView: check for proper acyclic directed graph structure!!
00029 //FIXME:
00030 //FIXME:         X          [A-X] ... LogicalPart
00031 //FIXME:        / \             | ... PosPart (directed parten to child)
00032 //FIXME:       A   A
00033 //FIXME:       |   | 
00034 //FIXME:       B   C      
00035 //FIXME:
00036 //FIXME:    THIS IS NOT ALLOWED, but currently can be specified using DDL ....
00037 //FIXME:
00038 
00039 //typedef TreeNode<DDPhysicalPart,int> expnode_t;
00041 //typedef graph<DDLogicalPart,DDPosData*> graph_type; //:typedef Graph<DDLogicalPart,DDPosData*> graph_type;
00042 
00044 
00077 class DDCompactView
00078 {
00079  
00080 public:
00082   typedef std::vector<DDLogicalPart> logchild_type;
00083   
00085   typedef std::vector< std::pair<DDLogicalPart,DDPosData*> > poschildren_type;
00086   
00088   typedef std::pair<DDLogicalPart,DDPosData*> pos_type;
00089   
00091   //:typedef GraphWalker<DDLogicalPart,DDPosData*> walker_type;
00092   typedef graphwalker<DDLogicalPart,DDPosData*> walker_type;
00093   
00095   //:typedef walker_type::value_type value_type;
00096   
00098 
00099   typedef ::graph<DDLogicalPart,DDPosData*> graph_type;
00100     
00102   explicit DDCompactView();
00103   
00105   explicit DDCompactView(const DDLogicalPart & rootnodedata);
00106   
00107   ~DDCompactView();
00108   
00110   const graph_type & graph() const;
00111 
00113   const DDLogicalPart & root() const;
00114 
00116   double weight(const DDLogicalPart & p) const;
00117 
00119   void algoPosPart(const DDLogicalPart & self,
00120                    const DDLogicalPart & parent,
00121                    DDAlgo & algo
00122                    );
00123   
00124   void position (const DDLogicalPart & self,
00125                  const DDLogicalPart & parent,
00126                  std::string copyno,
00127                  const DDTranslation & trans,
00128                  const DDRotation & rot,
00129                  const DDDivision * div = NULL);
00130   
00131   void position (const DDLogicalPart & self,
00132                  const DDLogicalPart & parent,
00133                  int copyno,
00134                  const DDTranslation & trans,
00135                  const DDRotation & rot,
00136                  const DDDivision * div = NULL);
00137   
00138   // ************************************************************************
00139   // UNSTABLE STUFF below! DON'T USE!
00140   // ************************************************************************
00141   
00143   void setRoot(const DDLogicalPart & root);
00144 
00146   walker_type walker() const;
00147 
00148   // ---------------------------------------------------------------
00149   // +++ DDCore INTERNAL USE ONLY ++++++++++++++++++++++++++++++++++
00150     
00151   // to modify the structure! DDCore internal!
00152   graph_type & writeableGraph();
00153 
00154   void swap( DDCompactView& );
00155 
00156   void lockdown();
00157   
00158  protected:
00159   DDCompactViewImpl* rep_;
00160 
00161  private:
00162     // 2010-01-27 memory patch
00163     // for copying and protecting DD Store's after parsing is complete.
00164     DDI::Store<DDName, DDI::Material*> matStore_;
00165     DDI::Store<DDName, DDI::Solid*> solidStore_;
00166     DDI::Store<DDName, DDI::LogicalPart*> lpStore_;
00167     DDI::Store<DDName, DDI::Specific*> specStore_;
00168     DDI::Store<DDName, DDRotationMatrix*> rotStore_;    
00169 
00170 };
00171 
00173 typedef DDCompactView::walker_type walker_type;
00174 #endif