CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/DetectorDescription/Core/src/DDDivision.cc

Go to the documentation of this file.
00001 #include "DetectorDescription/Core/interface/DDDivision.h"
00002 #include "Division.h"
00003 
00004 #include "DetectorDescription/Base/interface/DDdebug.h"
00005 
00006 using DDI::Division;
00007 
00008 // void DD_NDC(const DDName & n) {
00009 //  std::vector<DDName> & ns = DIVNAMES::instance()[n.name()];
00010 //  typedef std::vector<DDName>::iterator IT;
00011 //  bool alreadyIn(false);
00012 //  for(IT p = ns.begin(); p != ns.end() ; ++p) {
00013 //    if ( p->ns() == n.ns()) {
00014 //      alreadyIn = true;
00015 //      break;
00016 //    } 
00017 //  }
00018 //  if (!alreadyIn) {
00019 //    ns.push_back(n);
00020 //  }  
00021 // }
00022   
00023 std::ostream & 
00024 operator<<(std::ostream & os, const DDDivision & div)
00025 {
00026   DDBase<DDName,Division*>::def_type defined(div.isDefined());
00027   if (defined.first) {
00028     os << *(defined.first) << " ";
00029     if (defined.second) {
00030       div.rep().stream(os); 
00031     }
00032     else {
00033       os << "* division not defined * ";  
00034     }
00035   }  
00036   else {
00037     os << "* division not declared * ";  
00038   }  
00039   return os;
00040 }
00041 
00042 DDDivision::DDDivision() : DDBase<DDName, DDI::Division*>()
00043 { }
00044 
00045 DDDivision::DDDivision( const DDName & name) : DDBase<DDName,DDI::Division*>()
00046 {
00047   prep_ = StoreT::instance().create(name);
00048   //  DD_NDC(name);
00049 }
00050 
00051 DDDivision::DDDivision(const DDName & name,
00052              const DDLogicalPart & parent,
00053              const DDAxes axis,
00054              const int nReplicas,
00055              const double width,
00056              const double offset ) :  DDBase<DDName,DDI::Division*>()
00057 {
00058   DCOUT('C', "create Division name=" << name << " parent=" << parent.name() << " axis=" << DDAxesNames::name(axis) << " nReplicas=" << nReplicas << " width=" << width << " offset=" << offset);
00059   prep_ = StoreT::instance().create(name, new Division(parent, axis, nReplicas, width, offset)); 
00060   //  DD_NDC(name);
00061 } 
00062 
00063 DDDivision::DDDivision(const DDName & name,
00064              const DDLogicalPart & parent,
00065              const DDAxes axis,
00066              const int nReplicas,
00067              const double offset )
00068 {
00069   DCOUT('C', "create Division name=" << name << " parent=" << parent.name() << " axis=" << DDAxesNames::name(axis) << " nReplicas=" << nReplicas << " offset=" << offset);
00070   prep_ = StoreT::instance().create(name, new Division(parent, axis, nReplicas, offset)); 
00071   //  DD_NDC(name);
00072 }
00073 
00074 DDDivision::DDDivision(const DDName & name,
00075              const DDLogicalPart & parent,
00076              const DDAxes axis,
00077              const double width,
00078              const double offset )
00079 {
00080   DCOUT('C', "create Division name=" << name << " parent=" << parent.name() << " axis=" << DDAxesNames::name(axis) << " width=" << width << " offset=" << offset);
00081   prep_ = StoreT::instance().create(name, new Division(parent, axis, width, offset)); 
00082   //  DD_NDC(name);
00083 }
00084 
00085 DDAxes DDDivision::axis() const
00086 {
00087   return rep().axis();
00088 }
00089 
00090 int DDDivision::nReplicas() const
00091 {
00092   return rep().nReplicas();
00093 }
00094 
00095 double DDDivision::width() const
00096 {
00097   return rep().width();
00098 }
00099 
00100 double DDDivision::offset() const
00101 {
00102   return rep().offset();
00103 }
00104 
00105 const DDLogicalPart & DDDivision::parent() const
00106 {
00107   return rep().parent();
00108 }
00109