CMS 3D CMS Logo

Classes | Typedefs | Functions
DDStreamer.cc File Reference
#include "DetectorDescription/Core/interface/DDStreamer.h"
#include <stddef.h>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "DetectorDescription/Base/interface/DDRotationMatrix.h"
#include "DetectorDescription/Base/interface/DDTranslation.h"
#include "DetectorDescription/Base/interface/Singleton.h"
#include "DetectorDescription/Core/interface/DDBase.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include "DetectorDescription/Core/interface/DDConstant.h"
#include "DetectorDescription/Core/interface/DDEnums.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "DetectorDescription/Core/interface/DDName.h"
#include "DetectorDescription/Core/interface/DDPartSelection.h"
#include "DetectorDescription/Core/interface/DDPosData.h"
#include "DetectorDescription/Core/interface/DDRoot.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDSolidShapes.h"
#include "DetectorDescription/Core/interface/DDSpecifics.h"
#include "DetectorDescription/Core/interface/DDTransform.h"
#include "DetectorDescription/Core/interface/DDValue.h"
#include "DetectorDescription/Core/interface/DDValuePair.h"
#include "DetectorDescription/Core/interface/DDsvalues.h"
#include "DetectorDescription/Core/interface/adjgraph.h"
#include "DetectorDescription/ExprAlgo/interface/ClhepEvaluator.h"
#include "DetectorDescription/ExprAlgo/interface/ExprEvalSingleton.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/Exception.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 248 of file DDStreamer.cc.

Function Documentation

template<class T >
size_t dd_count ( const T )

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

229 {
230  size_t result(0);
231  typename T::template iterator<T> it(T::begin()), ed(T::end());
232  for (; it!=ed; ++it) {
233  if (it->isDefined().second) {
234  ++result;
235  }
236  }
237  return result;
238 }
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:520
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
void dd_get_boolean_params ( std::istream &  is,
DDRotation r,
DDTranslation t,
DDSolid a,
DDSolid b 
)

Definition at line 390 of file DDStreamer.cc.

References dd_get_name(), Exception, gen::n, x, y, and z.

Referenced by DDStreamer::solids_read().

391 {
392  DDName n = dd_get_name(is);
393  r = DDRotation(n);
394  //double x(0), y(0), z(0);
395  B x,y,z;
396  char cr = is.get();
397  if(cr != ' ')
398  throw cms::Exception("DDException") << "DDStreamer::get_boolean_param(): inconsistent sequence! no blank delimiter before trans!";
399  is >> x;
400  is >> y;
401  is >> z;
402  t = DDTranslation(x.val_,y.val_,z.val_);
403  n = dd_get_name(is);
404  a = DDSolid(n);
405  n = dd_get_name(is);
406  b = DDSolid(n);
407 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
float float float z
A DDSolid represents the shape of a part.
Definition: DDSolid.h:37
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
DDName dd_get_name(std::istream &is)
Definition: DDStreamer.cc:108
T x() const
Cartesian x coordinate.
std::string dd_get_delimit ( std::istream &  is,
char  d 
)

Definition at line 81 of file DDStreamer.cc.

References mps_fire::i, and AlCaHLTBitMon_QueryRunRegistry::string.

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

82 {
83  std::string nm;
84  char i;
85  while ((i=is.get()) && i != d) ;
86  while ((i=is.get()) && i != d) {
87  nm = nm + i;
88  }
89  return nm;
90 }
DDName dd_get_name ( std::istream &  is)

Definition at line 108 of file DDStreamer.cc.

References hcalTTPDigis_cfi::id.

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().

109 {
110  size_t id(0);
111  is >> id;
112  return DDName(id);
113 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
DDName dd_get_name_string ( std::istream &  is)

Definition at line 92 of file DDStreamer.cc.

References dd_get_delimit(), and AlCaHLTBitMon_QueryRunRegistry::string.

93 {
94  std::string nm(dd_get_delimit(is,'"')) ;
95  return DDName(nm,
96  dd_get_delimit(is,'"'));
97 /*
98  char i;
99  while ((i=is.get()) && i != '"') ;
100  while ((i=is.get()) && i != '"') {
101  nm = nm + i;
102  }
103  std::pair<std::string,std::string> p = DDSplit(nm);
104  return DDName(p.first,p.second);
105 */
106 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
std::string dd_get_delimit(std::istream &is, char d)
Definition: DDStreamer.cc:81
void dd_rot_bin_in ( std::istream &  is,
DDRotationMatrix r 
)

Definition at line 574 of file DDStreamer.cc.

References mps_fire::i, findQualityFiles::v, and w.

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

575 {
576  double v[9];
577  B w;
578  for (int i=0; i<9;i++) {
579  is >> w; v[i]=w.val_;
580  }
581  r.SetComponents(v,v+9);
582 }
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 mps_fire::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 }
double_binary B
Definition: DDStreamer.cc:248
rm
Definition: submit.py:76
void dd_rot_out ( std::ostream &  os,
const DDRotation r 
)

Definition at line 542 of file DDStreamer.cc.

References 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 /*
548  os << ' ' << B(rep.xx_) << ' ' << B(rep.xy_) << ' ' << B(rep.xz_) << ' '
549  << B(rep.yx_) << ' ' << B(rep.yy_) << ' ' << B(rep.yz_) << ' '
550  << B(rep.zx_) << ' ' << B(rep.zy_) << ' ' << B(rep.zz_) << std::endl;
551 */
552  dd_rot_bin_out(os,rm);
553  os << std::endl;
554 }
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:88
const N & name() const
Definition: DDBase.h:78
void dd_rot_bin_out(std::ostream &os, const DDRotationMatrix &rm)
Definition: DDStreamer.cc:534
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:120
rm
Definition: submit.py:76
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
void dd_stream_booleans ( std::ostream &  os,
DDSolid  s,
DDSolidShape   
)

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

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

Definition at line 346 of file DDStreamer.cc.

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

Referenced by DDStreamer::solids_write().

347 {
348  DDReflectionSolid ref(s);
349  nameout(os,ref.unreflected().name());
350 }
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:120
void nameout ( std::ostream &  o,
const DDName n 
)
void nameout_strings ( std::ostream &  o,
const DDName n 
)

Definition at line 115 of file DDStreamer.cc.

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

116 {
117  o << '"' << n.name() << '"' << ' ' << '"' << n.ns() << '"' ;
118 }
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:104
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
std::ostream& operator<< ( std::ostream &  os,
double_binary  b 
)

Definition at line 250 of file DDStreamer.cc.

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

251 {
252  const char * d = (const char *)(&(b.val_));
253  //size_t s(sizeof(double)), i(0);
254  //os << '(';
255  os.write(d,sizeof(double));
256  return os;
257 }
std::istream& operator>> ( std::istream &  is,
double_binary b 
)
inline

Definition at line 260 of file DDStreamer.cc.

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

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