CMS 3D CMS Logo

Classes | Typedefs | Functions

CMSSW_4_4_3_patch1/src/DetectorDescription/Core/src/DDStreamer.cc File Reference

#include "DetectorDescription/Core/interface/DDStreamer.h"
#include "DetectorDescription/Base/interface/Singleton.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDTransform.h"
#include "DetectorDescription/Core/interface/DDRoot.h"
#include "DetectorDescription/Core/interface/DDSpecifics.h"
#include "DetectorDescription/Core/interface/DDValue.h"
#include "DetectorDescription/Base/interface/DDdebug.h"
#include "DetectorDescription/Core/interface/DDConstant.h"
#include "DetectorDescription/Core/interface/DDPartSelection.h"
#include "DetectorDescription/ExprAlgo/interface/ExprEvalSingleton.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iomanip>

Go to the source code of this file.

Classes

struct  double_binary

Typedefs

typedef double_binary B

Functions

template<class T >
size_t dd_count (const T &dummy)
void dd_get_boolean_params (std::istream &is, DDRotation &r, DDTranslation &t, DDSolid &a, DDSolid &b)
std::string dd_get_delimit (std::istream &is, char d)
DDName dd_get_name (std::istream &is)
DDName dd_get_name_string (std::istream &is)
void dd_rot_bin_in (std::istream &is, DDRotationMatrix &r)
void dd_rot_bin_out (std::ostream &os, const DDRotationMatrix &rm)
void dd_rot_out (std::ostream &os, const DDRotation &r)
void dd_stream_booleans (std::ostream &os, DDSolid s, DDSolidShape sh)
void dd_stream_reflected (std::ostream &os, DDSolid s)
void nameout (std::ostream &o, const DDName &n)
void nameout_strings (std::ostream &o, const DDName &n)
std::ostream & operator<< (std::ostream &os, double_binary b)
std::istream & operator>> (std::istream &is, double_binary &b)

Typedef Documentation

typedef double_binary B

Definition at line 235 of file DDStreamer.cc.


Function Documentation

template<class T >
size_t dd_count ( const T dummy)

Definition at line 215 of file DDStreamer.cc.

References begin, end, query::result, and svgfig::template().

Referenced by DDStreamer::materials_write(), DDStreamer::parts_write(), DDStreamer::rots_write(), DDStreamer::solids_write(), and DDStreamer::specs_write().

{
  size_t result(0);
  typename T::template iterator<T> it(T::begin()), ed(T::end());
  for (; it!=ed; ++it) {
    if (it->isDefined().second) {
      ++result;
    }
  }
  return result;
}
void dd_get_boolean_params ( std::istream &  is,
DDRotation r,
DDTranslation t,
DDSolid a,
DDSolid b 
)

Definition at line 386 of file DDStreamer.cc.

References DCOUT, dd_get_name(), n, DDBase< N, C >::name(), x, detailsBasic3DVector::y, and z.

Referenced by DDStreamer::solids_read().

{
   DDName n = dd_get_name(is);
   r = DDRotation(n);
   //double x(0), y(0), z(0);
   B x,y,z;
   char cr = is.get();
   if(cr != ' ') 
      throw DDException("DDStreamer::get_boolean_param(): inconsistent sequence! no blank delimiter before trans!");
   is >> x;
   is >> y;
   is >> z;
   t = DDTranslation(x.val_,y.val_,z.val_);
   n = dd_get_name(is);
   a = DDSolid(n);
   n = dd_get_name(is);
   b = DDSolid(n);
   DCOUT('y', "boolean-par: rot=" << r.name() << " t=" << t << " a=" << a.name() << " b=" << b.name());
}
std::string dd_get_delimit ( std::istream &  is,
char  d 
)

Definition at line 66 of file DDStreamer.cc.

References i.

Referenced by dd_get_name_string(), DDStreamer::names_read(), DDStreamer::specs_read(), and DDStreamer::vars_read().

{
  std::string nm;
  char i;
  while ((i=is.get()) && i != d) ;
  while ((i=is.get()) && i != d) {
      nm = nm + i; 
   }
  return nm;
}
DDName dd_get_name ( std::istream &  is)
DDName dd_get_name_string ( std::istream &  is)

Definition at line 77 of file DDStreamer.cc.

References dd_get_delimit().

{  
   std::string nm(dd_get_delimit(is,'"'))  ;
   return DDName(nm,
                 dd_get_delimit(is,'"'));
/*
   char i;
   while ((i=is.get()) && i != '"') ;
   while ((i=is.get()) && i != '"') {
      nm = nm + i; 
   }
   std::pair<std::string,std::string> p = DDSplit(nm);
   return DDName(p.first,p.second);
*/   
}
void dd_rot_bin_in ( std::istream &  is,
DDRotationMatrix r 
)

Definition at line 577 of file DDStreamer.cc.

References i, v, and double_binary::val_.

Referenced by DDStreamer::pos_read(), and DDStreamer::rots_read().

{
    double v[9];
    B w;
    for (int i=0; i<9;i++) {
      is >> w; v[i]=w.val_;
    }
    r.SetComponents(v,v+9);
}
void dd_rot_bin_out ( std::ostream &  os,
const DDRotationMatrix rm 
)

Definition at line 535 of file DDStreamer.cc.

References i, and v.

Referenced by dd_rot_out(), and DDStreamer::pos_write().

{
  double v[9]; 
  rm.GetComponents(v,v+9);
  for (int i=0;i<9;i++)
    os        << B(v[i]);
}
void dd_rot_out ( std::ostream &  os,
const DDRotation r 
)

Definition at line 543 of file DDStreamer.cc.

References DCOUT, dd_rot_bin_out(), DDBase< N, C >::name(), nameout(), submit::rm, and DDRotation::rotation().

Referenced by DDStreamer::rots_write().

                                                       {
    os << "--Rot: " << r.name() << " @ ";
    nameout(os,r.name());
    os << ' ';
    const DDRotationMatrix & rm = *(r.rotation());
    DCOUT('y', "write-rots=" << r.name());
/*
    os << ' ' << B(rep.xx_) << ' ' << B(rep.xy_) << ' ' << B(rep.xz_) << ' '
              << B(rep.yx_) << ' ' << B(rep.yy_) << ' ' << B(rep.yz_) << ' '
              << B(rep.zx_) << ' ' << B(rep.zy_) << ' ' << B(rep.zz_) << std::endl; 
*/            
   dd_rot_bin_out(os,rm);             
   os << std::endl;
}
void dd_stream_booleans ( std::ostream &  os,
DDSolid  s,
DDSolidShape  sh 
)

Definition at line 322 of file DDStreamer.cc.

References b, DDBase< N, C >::isDefined(), DDBase< N, C >::name(), nameout(), DDBooleanSolid::rotation(), DDBooleanSolid::solidA(), DDBooleanSolid::solidB(), and DDBooleanSolid::translation().

Referenced by DDStreamer::solids_write().

{
  DDBooleanSolid b(s);
  DDRotation temprot = b.rotation();
  if(!temprot.isDefined().second) {
    temprot = DDRotation();
    edm::LogError("DDStreamer") << "DDStreamer::dd_stream_booleans(): solid=" << s.name() << " has no rotation. Using unit-rot." << std::endl;
  }
  nameout(os,temprot.name()); 
  // binary output of the translation std::vector
  os << ' ' << B(b.translation().x()) // << ' '
     << B(b.translation().y()) // << ' '
     << B(b.translation().z()) << ' '; 
  nameout(os,b.solidA().name());
  os << ' ';
  nameout(os,b.solidB().name());            
}
void dd_stream_reflected ( std::ostream &  os,
DDSolid  s 
)

Definition at line 340 of file DDStreamer.cc.

References DDBase< N, C >::name(), nameout(), MultipleCompare::ref, and DDReflectionSolid::unreflected().

Referenced by DDStreamer::solids_write().

{
      DDReflectionSolid ref(s);
      nameout(os,ref.unreflected().name());
}
void nameout ( std::ostream &  o,
const DDName n 
)
void nameout_strings ( std::ostream &  o,
const DDName n 
)

Definition at line 100 of file DDStreamer.cc.

References DDName::name(), and DDName::ns().

{
  o << '"' << n.name() << '"' << ' ' << '"' << n.ns() << '"' ;
}
std::ostream& operator<< ( std::ostream &  os,
double_binary  b 
)

Definition at line 237 of file DDStreamer.cc.

References double_binary::val_.

{
  const char * d = (const char *)(&(b.val_));
  //size_t s(sizeof(double)), i(0);
  //os << '(';
  os.write(d,sizeof(double));
  return os;
}
std::istream& operator>> ( std::istream &  is,
double_binary b 
) [inline]

Definition at line 247 of file DDStreamer.cc.

References double_binary::val_.

{
  char * d = (char *)(&(b.val_));
  //size_t s(sizeof(double)), i(0);
  is.read(d,sizeof(double));
  return is;
}