CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Typedefs | Functions
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 &)
 
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)
 
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 234 of file DDStreamer.cc.

Function Documentation

template<class T >
size_t dd_count ( const T )

Definition at line 214 of file DDStreamer.cc.

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

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

215 {
216  size_t result(0);
217  typename T::template iterator<T> it(T::begin()), ed(T::end());
218  for (; it!=ed; ++it) {
219  if (it->isDefined().second) {
220  ++result;
221  }
222  }
223  return result;
224 }
tuple result
Definition: mps_fire.py:83
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
def template
Definition: svgfig.py:520
void dd_get_boolean_params ( std::istream &  is,
DDRotation r,
DDTranslation t,
DDSolid a,
DDSolid b 
)

Definition at line 385 of file DDStreamer.cc.

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

Referenced by DDStreamer::solids_read().

386 {
387  DDName n = dd_get_name(is);
388  r = DDRotation(n);
389  //double x(0), y(0), z(0);
390  B x,y,z;
391  char cr = is.get();
392  if(cr != ' ')
393  throw cms::Exception("DDException") << "DDStreamer::get_boolean_param(): inconsistent sequence! no blank delimiter before trans!";
394  is >> x;
395  is >> y;
396  is >> z;
397  t = DDTranslation(x.val_,y.val_,z.val_);
398  n = dd_get_name(is);
399  a = DDSolid(n);
400  n = dd_get_name(is);
401  b = DDSolid(n);
402  DCOUT('y', "boolean-par: rot=" << r.name() << " t=" << t << " a=" << a.name() << " b=" << b.name());
403 }
const N & name() const
Definition: DDBase.h:78
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:14
float float float z
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
DDName dd_get_name(std::istream &is)
Definition: DDStreamer.cc:92
T x() const
Cartesian x coordinate.
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
std::string dd_get_delimit ( std::istream &  is,
char  d 
)

Definition at line 65 of file DDStreamer.cc.

References i, and AlCaHLTBitMon_QueryRunRegistry::string.

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

66 {
67  std::string nm;
68  char i;
69  while ((i=is.get()) && i != d) ;
70  while ((i=is.get()) && i != d) {
71  nm = nm + i;
72  }
73  return nm;
74 }
int i
Definition: DBlmapReader.cc:9
tuple d
Definition: ztail.py:151
DDName dd_get_name ( std::istream &  is)

Definition at line 92 of file DDStreamer.cc.

Referenced by dd_get_boolean_params(), DDStreamer::materials_read(), DDStreamer::parts_read(), DDStreamer::pos_read(), DDStreamer::rots_read(), DDStreamer::solids_read(), and DDStreamer::specs_read().

93 {
94  size_t id(0);
95  is >> id;
96  return DDName(id);
97 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:14
DDName dd_get_name_string ( std::istream &  is)

Definition at line 76 of file DDStreamer.cc.

References dd_get_delimit(), and AlCaHLTBitMon_QueryRunRegistry::string.

77 {
78  std::string nm(dd_get_delimit(is,'"')) ;
79  return DDName(nm,
80  dd_get_delimit(is,'"'));
81 /*
82  char i;
83  while ((i=is.get()) && i != '"') ;
84  while ((i=is.get()) && i != '"') {
85  nm = nm + i;
86  }
87  std::pair<std::string,std::string> p = DDSplit(nm);
88  return DDName(p.first,p.second);
89 */
90 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:14
std::string dd_get_delimit(std::istream &is, char d)
Definition: DDStreamer.cc:65
void dd_rot_bin_in ( std::istream &  is,
DDRotationMatrix r 
)

Definition at line 576 of file DDStreamer.cc.

References i, findQualityFiles::v, and w.

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

577 {
578  double v[9];
579  B w;
580  for (int i=0; i<9;i++) {
581  is >> w; v[i]=w.val_;
582  }
583  r.SetComponents(v,v+9);
584 }
int i
Definition: DBlmapReader.cc:9
const double w
Definition: UKUtility.cc:23
void dd_rot_bin_out ( std::ostream &  os,
const DDRotationMatrix rm 
)

Definition at line 534 of file DDStreamer.cc.

References i, and findQualityFiles::v.

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

535 {
536  double v[9];
537  rm.GetComponents(v,v+9);
538  for (int i=0;i<9;i++)
539  os << B(v[i]);
540 }
int i
Definition: DBlmapReader.cc:9
double_binary B
Definition: DDStreamer.cc:234
string rm
Definition: submit.py:76
void dd_rot_out ( std::ostream &  os,
const DDRotation r 
)

Definition at line 542 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().

542  {
543  os << "--Rot: " << r.name() << " @ ";
544  nameout(os,r.name());
545  os << ' ';
546  const DDRotationMatrix & rm = *(r.rotation());
547  DCOUT('y', "write-rots=" << r.name());
548 /*
549  os << ' ' << B(rep.xx_) << ' ' << B(rep.xy_) << ' ' << B(rep.xz_) << ' '
550  << B(rep.yx_) << ' ' << B(rep.yy_) << ' ' << B(rep.yz_) << ' '
551  << B(rep.zx_) << ' ' << B(rep.zy_) << ' ' << B(rep.zz_) << std::endl;
552 */
553  dd_rot_bin_out(os,rm);
554  os << std::endl;
555 }
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:90
const N & name() const
Definition: DDBase.h:78
void dd_rot_bin_out(std::ostream &os, const DDRotationMatrix &rm)
Definition: DDStreamer.cc:534
string rm
Definition: submit.py:76
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:104
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void dd_stream_booleans ( std::ostream &  os,
DDSolid  s,
DDSolidShape   
)

Definition at line 321 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().

322 {
323  DDBooleanSolid b(s);
324  DDRotation temprot = b.rotation();
325  if(!temprot.isDefined().second) {
326  temprot = DDRotation();
327  edm::LogError("DDStreamer") << "DDStreamer::dd_stream_booleans(): solid=" << s.name() << " has no rotation. Using unit-rot." << std::endl;
328  }
329  nameout(os,temprot.name());
330  // binary output of the translation std::vector
331  os << ' ' << B(b.translation().x()) // << ' '
332  << B(b.translation().y()) // << ' '
333  << B(b.translation().z()) << ' ';
334  nameout(os,b.solidA().name());
335  os << ' ';
336  nameout(os,b.solidB().name());
337 }
def_type isDefined() const
Definition: DDBase.h:110
const N & name() const
Definition: DDBase.h:78
double_binary B
Definition: DDStreamer.cc:234
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
double b
Definition: hdecay.h:120
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:104
void dd_stream_reflected ( std::ostream &  os,
DDSolid  s 
)

Definition at line 339 of file DDStreamer.cc.

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

Referenced by DDStreamer::solids_write().

340 {
341  DDReflectionSolid ref(s);
342  nameout(os,ref.unreflected().name());
343 }
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:104
void nameout ( std::ostream &  o,
const DDName n 
)
void nameout_strings ( std::ostream &  o,
const DDName n 
)

Definition at line 99 of file DDStreamer.cc.

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

100 {
101  o << '"' << n.name() << '"' << ' ' << '"' << n.ns() << '"' ;
102 }
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:101
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
std::ostream& operator<< ( std::ostream &  os,
double_binary  b 
)

Definition at line 236 of file DDStreamer.cc.

References ztail::d, and double_binary::val_.

237 {
238  const char * d = (const char *)(&(b.val_));
239  //size_t s(sizeof(double)), i(0);
240  //os << '(';
241  os.write(d,sizeof(double));
242  return os;
243 }
tuple d
Definition: ztail.py:151
std::istream& operator>> ( std::istream &  is,
double_binary b 
)
inline

Definition at line 246 of file DDStreamer.cc.

References ztail::d, and double_binary::val_.

247 {
248  char * d = (char *)(&(b.val_));
249  //size_t s(sizeof(double)), i(0);
250  is.read(d,sizeof(double));
251  return is;
252 }
tuple d
Definition: ztail.py:151