CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
DDStreamer Class Reference

Streaming the DDD transient store from/into a std::istream/std::ostream */. More...

#include <DDStreamer.h>

Public Member Functions

 DDStreamer ()
 constructs a streamer object with yet undefined std::istream and std::ostream More...
 
 DDStreamer (std::istream &readFrom)
 creates a streamer object for reading More...
 
 DDStreamer (std::ostream &writeTo)
 creates a streamer object for writing More...
 
void read ()
 populate DDD transient objects from the std::istream refetrred to by member i_ More...
 
void read (std::istream &is)
 populate DDD transient objects from the given std::istream is More...
 
void setInput (std::istream &i)
 set the istream for DDStreamer::read() More...
 
void setOutput (std::ostream &o)
 set the std::ostream for DDStreamer::write() More...
 
void write ()
 stream all DDD transient objects to the std::ostream referred to by member o_ More...
 
void write (std::ostream &os)
 stream all DDD transient objects to the given std::ostream os More...
 
virtual ~DDStreamer ()
 does nothing; usefull only if another streamer derives from DDStreamer More...
 

Protected Member Functions

void materials_read ()
 read all instances of DDMaterial More...
 
void materials_write ()
 write all instances of DDMaterial More...
 
void names_read ()
 read all instances of DDName More...
 
void names_write ()
 write all instances of DDName More...
 
void parts_read ()
 read all instances of DDLogicalPart More...
 
void parts_write ()
 write all instances of DDLogicalPart More...
 
void pos_read ()
 read the graph structure for DDCompactView::graph() More...
 
void pos_write ()
 write the graph structure of DDCompactView::graph() More...
 
void rots_read ()
 read all instances of DDRotation More...
 
void rots_write ()
 write all instances of DDRotation More...
 
void solids_read ()
 read all instances of DDSolid More...
 
void solids_write ()
 write all instances of DDSolid More...
 
void specs_read ()
 read all instances of More...
 
void specs_write ()
 write all instances of DDSpecifics More...
 
void vars_read ()
 read the dictionlary of ClhepEvaluator More...
 
void vars_write ()
 write the dictionary of ClhepEvaluator More...
 

Private Attributes

const DDCompactViewcpv_
 
std::istream * i_
 
std::ostream * o_
 

Detailed Description

Streaming the DDD transient store from/into a std::istream/std::ostream */.

DDStreamer can be used to write the DDD transient object into a std::ostram and to retrieve them again via an std::istream.


The streamer can also be used together with DDLParser. Once possible usage scenario would be to load most of the geometrical DDD information via the streamer and parse some addional DDD XML documents containing SpecPar-information using DDLParser.


If DDStreamer is used together with DDLParser, the user has to ensure that reading in via DDStreamer::read() is done BEFORE invoking DDLParser to guarantee internal consistensies of the DDD objects.



// writing:
#include<fstream>
std::ofstream file("pers.txt");
DDStreamer streamer(file);
streamer.write();
// reading:
#include<fstream>
std::ifstream file("pers.txt");
DDStreamer streamer(filer);
streamer.read();

Definition at line 41 of file DDStreamer.h.

Constructor & Destructor Documentation

DDStreamer::DDStreamer ( )

constructs a streamer object with yet undefined std::istream and std::ostream

Definition at line 22 of file DDStreamer.cc.

23  : cpv_(0), o_(0), i_(0)
24  {
25  }
std::istream * i_
Definition: DDStreamer.h:126
const DDCompactView * cpv_
Definition: DDStreamer.h:124
std::ostream * o_
Definition: DDStreamer.h:125
DDStreamer::DDStreamer ( std::istream &  readFrom)

creates a streamer object for reading

Definition at line 38 of file DDStreamer.cc.

References i_.

39  : cpv_(0), o_(0), i_(0)
40 {
41  if (is) {
42  i_ = &is;
43  }
44  else {
45  throw DDException("DDStreamer::DDStreamer(std::ostream&): not valid std::ostream");
46  }
47 }
An exception for DDD errors.
Definition: DDException.h:23
std::istream * i_
Definition: DDStreamer.h:126
const DDCompactView * cpv_
Definition: DDStreamer.h:124
std::ostream * o_
Definition: DDStreamer.h:125
DDStreamer::DDStreamer ( std::ostream &  writeTo)

creates a streamer object for writing

Definition at line 27 of file DDStreamer.cc.

References o_.

28  : cpv_(0), o_(0), i_(0)
29 {
30  if (os) {
31  o_ = &os;
32  }
33  else {
34  throw DDException("DDStreamer::DDStreamer(std::ostream&): not valid std::ostream");
35  }
36 }
An exception for DDD errors.
Definition: DDException.h:23
std::istream * i_
Definition: DDStreamer.h:126
const DDCompactView * cpv_
Definition: DDStreamer.h:124
std::ostream * o_
Definition: DDStreamer.h:125
DDStreamer::~DDStreamer ( )
virtual

does nothing; usefull only if another streamer derives from DDStreamer

Definition at line 49 of file DDStreamer.cc.

49 {}

Member Function Documentation

void DDStreamer::materials_read ( )
protected

read all instances of DDMaterial

Definition at line 285 of file DDStreamer.cc.

References a, DDMaterial::addMaterial(), DCOUT, dd_get_name(), i, i_, j, m, n, DDBase< N, C >::name(), and detailsBasic3DVector::z.

Referenced by read().

286 {
287  DCOUT('Y', "DDStreamer::materials_read()");
288  std::istream & is = *i_;
289  //DDMaterial::clear();
290  size_t n=0;
291  is >> n;
292  size_t i=0;
293  for (; i < n; ++i) { // Materials
294  is.ignore(1000,'@');
295  DDName dn = dd_get_name(is);
296  double z(0), a(0), d(0);
297  is >> z;
298  is >> a;
299  is >> d;
300  int comp(0);
301  is >> comp; // composites
302  if (comp) { // composite material
303  DDMaterial m(dn,d);
304  DCOUT('y', "read-comp-material=" << m.name());
305  int j=0;
306  for(; j<comp; ++j) {
307  DDName cname(dd_get_name(is));
308  double fm(0);
309  is >> fm;
310  DDMaterial constituent(cname);
311  DCOUT('y', " read-composite=" << constituent.name());
312  m.addMaterial(constituent,fm);
313  }
314  }
315  else { // elementary material
316  DDMaterial m(dn,z,a,d);
317  DCOUT('y', "read-elem-material=" << m.name());
318  }
319  }
320 }
int i
Definition: DBlmapReader.cc:9
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
double double double z
DDName dd_get_name(std::istream &is)
Definition: DDStreamer.cc:93
std::istream * i_
Definition: DDStreamer.h:126
int j
Definition: DBlmapReader.cc:9
double a
Definition: hdecay.h:121
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void DDStreamer::materials_write ( )
protected

write all instances of DDMaterial

Definition at line 256 of file DDStreamer.cc.

References DDMaterial::a(), DDBase< DDName, DDI::Material * >::begin(), DDMaterial::constituent(), DCOUT, dd_count(), DDMaterial::density(), DDBase< DDName, DDI::Material * >::end(), j, m, DDBase< N, C >::name(), nameout(), DDMaterial::noOfConstituents(), o_, and DDMaterial::z().

Referenced by write().

257 {
258  DCOUT('Y', "DDStreamer::materials_write()");
259  std::ostream & os = *o_;
260  DDMaterial::iterator<DDMaterial> it(DDMaterial::begin()), ed(DDMaterial::end());
261  size_t no = dd_count(DDMaterial());
262  os << no << std::endl;
263  for (; it != ed; ++it) {
264  if (! it->isDefined().second) continue;
265  const DDMaterial & m = *it;
266  os << "--Material: " << m.name() << " @ " ;
267  nameout(os,m.name());
268  DCOUT('y', "write-material=" << m.name());
269  os << ' ' << m.z() << ' ' << m.a() << ' ' << m.density() << ' ';
270 
271  int noc = m.noOfConstituents();
272  os << noc;
273  int j=0;
274  for (; j<noc; ++j) {
275  DCOUT('y', " write-const-material=" << m.constituent(j).first.name());
276  os << ' ';
277  nameout(os,m.constituent(j).first.name());
278  os << ' ' << m.constituent(j).second;
279  }
280  os << std::endl;
281  }
282 }
double a() const
returns the atomic mass
Definition: DDMaterial.cc:103
const N & name() const
Definition: DDBase.h:88
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
size_t dd_count(const T &dummy)
Definition: DDStreamer.cc:215
double z() const
retruns the atomic number
Definition: DDMaterial.cc:109
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
Definition: DDMaterial.cc:95
int j
Definition: DBlmapReader.cc:9
double density() const
returns the density
Definition: DDMaterial.cc:115
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
Definition: DDMaterial.cc:89
std::ostream * o_
Definition: DDStreamer.h:125
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:105
static DDI::Store< DDName, DDI::Material * >::iterator begin()
Definition: DDBase.h:76
static DDI::Store< DDName, DDI::Material * >::iterator end()
Definition: DDBase.h:75
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void DDStreamer::names_read ( )
protected

read all instances of DDName

Definition at line 190 of file DDStreamer.cc.

References DCOUT, dd_get_delimit(), DDName::defineId(), i, i_, DDI::Singleton< I >::instance(), and asciidump::s.

Referenced by read().

191 {
192  DCOUT('Y', "DDStreamer::names_read()");
193  std::istream & is = *i_;
196 
197  size_t s;
198  is >> s;
199  ids.clear();
200  //ids.resize(s);
201  reg.clear();
202  size_t i(0);
203  //std::string nm; getline(is,nm);
204  for (; i<s; ++i) {
205  std::string nm(dd_get_delimit(is,'"'));
206  std::string ns(dd_get_delimit(is,'"'));
207  size_t id(0);
208  is >> id;
209  DDName::defineId(std::make_pair(nm,ns),id);
210  }
211 }
int i
Definition: DBlmapReader.cc:9
std::string dd_get_delimit(std::istream &is, char d)
Definition: DDStreamer.cc:66
std::map< std::pair< std::string, std::string >, id_type > Registry
Definition: DDName.h:26
static value_type & instance()
std::istream * i_
Definition: DDStreamer.h:126
static void defineId(const std::pair< std::string, std::string > &, id_type id)
register pre-defined ids
Definition: DDName.cc:63
std::vector< Registry::const_iterator > IdToName
Definition: DDName.h:27
string s
Definition: asciidump.py:422
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void DDStreamer::names_write ( )
protected

write all instances of DDName

Definition at line 171 of file DDStreamer.cc.

References prof2calltree::count, DCOUT, DDI::Singleton< I >::instance(), and o_.

Referenced by write().

172 {
173  DCOUT('Y', "DDStreamer::names_write()");
174  std::ostream & os = *o_;
176 
177  DDName::IdToName::const_iterator it(ids.begin()), ed(ids.end());
178  os << ids.size() << std::endl;
179  size_t count(0);
180  for (; it != ed; ++it) {
181  os << '"' << (*it)->first.first << '"' << ' '
182  << '"' << (*it)->first.second << '"' << ' '
183  << count << std::endl;
184  ++count;
185  }
186 
187 }
static value_type & instance()
std::vector< Registry::const_iterator > IdToName
Definition: DDName.h:27
std::ostream * o_
Definition: DDStreamer.h:125
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void DDStreamer::parts_read ( )
protected

read all instances of DDLogicalPart

Definition at line 514 of file DDStreamer.cc.

References DCOUT, dd_get_name(), i, i_, and n.

Referenced by read().

515 {
516  DCOUT('Y', "DDStreamer::parts_read()");
517  std::istream & is = *i_;
518  //DDLogicalPart::clear();
519  size_t n=0;
520  is >> n;
521  size_t i=0;
522  for (; i < n; ++i) { // LogicalParts
523  is.ignore(1000,'@');
524  DDName dn = dd_get_name(is);
525  size_t cat(0);
526  is >> cat;
528  DDName mat = dd_get_name(is);
529  DDName sol = dd_get_name(is);
530  DDLogicalPart lp(dn,mat,sol,categ);
531  DCOUT('y', "read-lp=" << lp);
532  }
533 }
int i
Definition: DBlmapReader.cc:9
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
DDName dd_get_name(std::istream &is)
Definition: DDStreamer.cc:93
std::istream * i_
Definition: DDStreamer.h:126
Category
Definition: DDEnums.h:7
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void DDStreamer::parts_write ( )
protected

write all instances of DDLogicalPart

Definition at line 493 of file DDStreamer.cc.

References DDBase< DDName, DDI::LogicalPart * >::begin(), DDLogicalPart::category(), DCOUT, dd_count(), DDBase< DDName, DDI::LogicalPart * >::end(), DDLogicalPart::material(), DDBase< N, C >::name(), nameout(), o_, and DDLogicalPart::solid().

Referenced by write().

494 {
495  DCOUT('Y', "DDStreamer::parts_write()");
496  std::ostream & os = *o_;
497  DDLogicalPart::iterator<DDLogicalPart> it(DDLogicalPart::begin()), ed(DDLogicalPart::end());
498  size_t no = dd_count(DDLogicalPart());
499  os << no << std::endl;
500  for (; it != ed; ++it) {
501  if (! it->isDefined().second) continue;
502  const DDLogicalPart & lp = *it;
503  os << "--Part: " << lp.name() << " @ ";
504  nameout(os,lp.name());
505  os << ' ' << lp.category() << ' ';
506  nameout(os,lp.material().name());
507  os << ' ';
508  nameout(os,lp.solid().name());
509  os << std::endl;
510  }
511 }
const N & name() const
Definition: DDBase.h:88
const DDMaterial & material() const
Returns a reference object of the material this LogicalPart is made of.
size_t dd_count(const T &dummy)
Definition: DDStreamer.cc:215
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
std::ostream * o_
Definition: DDStreamer.h:125
const DDSolid & solid() const
Returns a reference object of the solid being the shape of this LogicalPart.
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:105
static DDI::Store< DDName, DDI::LogicalPart * >::iterator begin()
Definition: DDBase.h:76
static DDI::Store< DDName, DDI::LogicalPart * >::iterator end()
Definition: DDBase.h:75
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
DDEnums::Category category() const
Returns the categorization of the DDLogicalPart (sensitive detector element, cable, ...)
void DDStreamer::pos_read ( )
protected

read the graph structure for DDCompactView::graph()

Definition at line 676 of file DDStreamer.cc.

References CommonMethods::cp(), DCOUT, dd_get_name(), dd_rot_bin_in(), DDanonymousRot(), Capri::details::from(), g, DDCompactView::graph(), i, i_, DDI::Singleton< I >::instance(), argparse::message, n, DDBase< N, C >::name(), DDCompactView::position(), dbtoconf::root, graph< N, E >::size(), matplotRender::t, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by read().

677 {
678  DCOUT('Y', "DDStreamer::pos_read()");
679  std::istream & is = *i_;
680  is.ignore(1000,'@');
681  DDName rtname = dd_get_name(is);
682  DDLogicalPart root(rtname);
683  DCOUT('y', "root is: " << root.name());
684  DDRootDef::instance().set(root);
685  size_t n=0;
686  is >> n;
687  size_t i=0;
688  DDCompactView cpv;
690  // DDPositioner pos_(&cpv);
691  //LogDebug << "===== GRAPH SIZE = " << g.size() << " ======" << std::endl << std::endl;
692  if (g.size()) {
693  edm::LogWarning("DDStreamer") << std::endl;
694  edm::LogWarning("DDStreamer") << "DDStreamer::pos_read(): The CompactView already contains some position information." << std::endl
695  << " It may cause an inconsistent geometry representation!" << std::endl << std::endl;
696  throw DDException("DDStreamer::pos_read() failed; CompactView has already been populated by another data source");
697  }
698  for (; i < n; ++i) { // Positions
699  is.ignore(1000,'@');
700  DDName from(dd_get_name(is));
701  DDName to(dd_get_name(is));
702  std::string cp;
703  is >> cp;
704  char cr = is.get();
705  if (cr != ' ') throw DDException("DDStreamer::pos_read(): inconsistent sequence! no blank delimiter found!");
706  //double x,y,z;
707  B x,y,z;
708  is >> x;
709  is >> y;
710  is >> z;
711  DDTranslation t(x.val_,y.val_,z.val_);
712  is.ignore();
713  char rottype = is.get();
714  DDRotationMatrix * matrix(0);
715  //DDName rotname;
716  DDRotation rot;
717  switch(rottype) {
718  case 'a': // anonymous rotation
719  is.ignore();
720  matrix = new DDRotationMatrix;
721  dd_rot_bin_in(is,*matrix);
722  rot = DDanonymousRot(matrix);
723  break;
724  case 'u': // unit rotation
725  break;
726  case 'r': // regular (named) rotation
727  rot = DDRotation(dd_get_name(is));
728  break;
729  default:
730  std::string message = "DDStreamer::pos_read(): could not determine type of rotation\n";
731  throw(DDException(message));
732  }
733  //DDName rot(dd_get_name(is));
734  cpv.position(DDLogicalPart(to),DDLogicalPart(from),cp,t,rot);
735  DCOUT('y', " pos-read: f=" << from << " to=" << to << " t=" << t << " r=" << rot);
736  }
737 }
adj_list::size_type size() const
Definition: adjgraph.h:202
int i
Definition: DBlmapReader.cc:9
void dd_rot_bin_in(std::istream &is, DDRotationMatrix &r)
Definition: DDStreamer.cc:577
An exception for DDD errors.
Definition: DDException.h:23
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
type of data representation of DDCompactView
Definition: DDCompactView.h:81
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
double double double z
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDRotation DDanonymousRot(DDRotationMatrix *rot)
Defines a anonymous rotation or rotation-reflection matrix.
Definition: DDRotation.cc:198
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
DDName dd_get_name(std::istream &is)
Definition: DDStreamer.cc:93
static value_type & instance()
std::istream * i_
Definition: DDStreamer.h:126
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
static std::string from(" from ")
string message
Definition: argparse.py:126
Definition: DDAxes.h:10
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
string root
initialization
Definition: dbtoconf.py:70
void DDStreamer::pos_write ( )
protected

write the graph structure of DDCompactView::graph()

Definition at line 610 of file DDStreamer.cc.

References graph< N, E >::begin_iter(), prof2calltree::count, DCOUT, dd_rot_bin_out(), graph< N, E >::end_iter(), g, DDCompactView::graph(), DDI::Singleton< I >::instance(), DDBase< N, C >::name(), nameout(), and o_.

Referenced by write().

611 {
612  DCOUT('Y', "DDStreamer::pos_write()");
613  DDCompactView cpv;
614  const DDCompactView::graph_type & g = cpv.graph();
615  DDCompactView::graph_type::const_iterator it = g.begin_iter();
616  DDCompactView::graph_type::const_iterator ed = g.end_iter();
617  std::ostream & os = *o_;
618  // first the root
619  DDLogicalPart rt = DDRootDef::instance().root();
620  os << "--Root: @ ";
621  nameout(os,rt.name());
622  os << std::endl;
623  //os << g.edge_size() << std::endl;
624  DDCompactView::graph_type::const_iterator iit = g.begin_iter();
625  DDCompactView::graph_type::const_iterator eed = g.end_iter();
626  size_t count(0);
627  for(; iit != eed; ++iit) {
628  ++count;
629  }
630  os << count << std::endl;
631  count=0;
632  DDName unit_rot_name;
633  DDRotationMatrix unit_rot;
634  for(; it != ed; ++it) {
635  os << "--Pos[" << count << "]: @ "; ++count;
636  //const DDLogicalPart & fr = it->from();
637  nameout(os, it->from().name());
638  os << ' ';
639  nameout(os, it->to().name());
640  os << ' ' << it->edge()->copyno_;
641  const DDTranslation & tr = it->edge()->translation();
642  //os << ' ' << B(tr.x()) << ' ' << B(tr.y()) << ' ' << B(tr.z());
643  os << ' ' << B(tr.x()) << B(tr.y()) << B(tr.z());
644  const DDRotation & ro = it->edge()->rot_;
645  os << ' ';
646  /* if it's an anonymous rotation stemming from an AlgoPosPart
647  then it's id must be the one of a unit rotation AND
648  it must be defined at this point AND it must not be the
649  unit rotation.
650  A character identifier is issues to mark the type of the rotation:
651  a ... anonymous rotation, followed by the binary numbers of the matrix
652  u ... unit-rotation matrix, no values following
653  r ... regular defined rotation-matrix (named rotation matrix) followed by name-id
654  */
655  if (ro.name() == unit_rot_name) {
656  if(ro.isDefined().second) {
657  if(*(ro.rotation()) != unit_rot) {
658  os << "a ";
659  dd_rot_bin_out(os,*(ro.rotation()));
660  }
661  else {
662  os << "u ";
663  }
664  }
665  }
666  else {
667  os << "r ";
668  nameout(os, ro.name());
669  }
670  os << std::endl;
671  }
672 
673 }
const N & name() const
Definition: DDBase.h:88
double_binary B
Definition: DDStreamer.cc:235
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
void dd_rot_bin_out(std::ostream &os, const DDRotationMatrix &rm)
Definition: DDStreamer.cc:535
type of data representation of DDCompactView
Definition: DDCompactView.h:81
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
static value_type & instance()
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
const_iterator begin_iter() const
Definition: adjgraph.h:191
std::ostream * o_
Definition: DDStreamer.h:125
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:105
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
const_iterator end_iter() const
Definition: adjgraph.h:193
void DDStreamer::read ( )

populate DDD transient objects from the std::istream refetrred to by member i_

Definition at line 121 of file DDStreamer.cc.

References i_.

Referenced by python.Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), and python.Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

122 {
123  if (i_ && *i_) {
124  read(*i_);
125  }
126  else {
127  throw DDException("DDStreamer::read(): bad std::istream");
128  }
129 }
void read()
populate DDD transient objects from the std::istream refetrred to by member i_
Definition: DDStreamer.cc:121
An exception for DDD errors.
Definition: DDException.h:23
std::istream * i_
Definition: DDStreamer.h:126
void DDStreamer::read ( std::istream &  is)

populate DDD transient objects from the given std::istream is

Definition at line 154 of file DDStreamer.cc.

References i_, materials_read(), names_read(), parts_read(), pos_read(), rots_read(), solids_read(), specs_read(), and vars_read().

Referenced by python.Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), and python.Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

155 {
156 
157  i_=&is;
158  names_read();
159  vars_read();
160 
161  materials_read();
162  solids_read();
163  parts_read();
164 
165  pos_read();
166  specs_read();
167  rots_read();
168 }
void names_read()
read all instances of DDName
Definition: DDStreamer.cc:190
void vars_read()
read the dictionlary of ClhepEvaluator
Definition: DDStreamer.cc:912
void solids_read()
read all instances of DDSolid
Definition: DDStreamer.cc:406
std::istream * i_
Definition: DDStreamer.h:126
void specs_read()
read all instances of
Definition: DDStreamer.cc:824
void rots_read()
read all instances of DDRotation
Definition: DDStreamer.cc:587
void parts_read()
read all instances of DDLogicalPart
Definition: DDStreamer.cc:514
void pos_read()
read the graph structure for DDCompactView::graph()
Definition: DDStreamer.cc:676
void materials_read()
read all instances of DDMaterial
Definition: DDStreamer.cc:285
void DDStreamer::rots_read ( )
protected

read all instances of DDRotation

Definition at line 587 of file DDStreamer.cc.

References trackerHits::c, DCOUT, dd_get_name(), dd_rot_bin_in(), i, i_, n, DDBase< N, C >::name(), and submit::rm.

Referenced by read().

588 {
589  DCOUT('Y', "DDStreamer::rots_read()");
590  std::istream & is = *i_;
591  //DDRotation::clear();
592  size_t n=0;
593  is >> n;
594  size_t i=0;
595  for (; i < n; ++i) { // Rotations
596  is.ignore(1000,'@');
597  DDName dn = dd_get_name(is);
598  char c = is.get();
599  if (c != ' ') {
600  throw DDException("DDStreamer::rots_read(): inconsitency! no blank separator found!");
601  }
602 
604  dd_rot_bin_in(is,*rm);
605  DDRotation ddr = DDRotation(dn,rm);
606  DCOUT('y',"read-rots=" << ddr.name());
607  }
608 }
int i
Definition: DBlmapReader.cc:9
const N & name() const
Definition: DDBase.h:88
void dd_rot_bin_in(std::istream &is, DDRotationMatrix &r)
Definition: DDStreamer.cc:577
An exception for DDD errors.
Definition: DDException.h:23
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
DDName dd_get_name(std::istream &is)
Definition: DDStreamer.cc:93
std::istream * i_
Definition: DDStreamer.h:126
string rm
Definition: submit.py:76
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 DDStreamer::rots_write ( )
protected

write all instances of DDRotation

Definition at line 558 of file DDStreamer.cc.

References DDBase< DDName, DDRotationMatrix * >::begin(), DCOUT, dd_count(), dd_rot_out(), DDBase< DDName, DDRotationMatrix * >::end(), o_, and csvReporter::r.

Referenced by write().

559 {
560  DCOUT('Y', "DDStreamer::rots_write()");
561  std::ostream & os = *o_;
562  DDRotation::iterator<DDRotation> it(DDRotation::begin()), ed(DDRotation::end());
563  size_t no = dd_count(DDRotation());
564  os << no << std::endl;
565  //DDName ano;
566  for (; it != ed; ++it) {
567  if (! it->isDefined().second) continue;
568  const DDRotation & r = *it;
569  //if (r.name().id() == ano.id()) {
570  // continue;
571  //}
572  dd_rot_out(os,r);
573  }
574 }
size_t dd_count(const T &dummy)
Definition: DDStreamer.cc:215
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
void dd_rot_out(std::ostream &os, const DDRotation &r)
Definition: DDStreamer.cc:543
std::ostream * o_
Definition: DDStreamer.h:125
static DDI::Store< DDName, DDRotationMatrix * >::iterator begin()
Definition: DDBase.h:76
static DDI::Store< DDName, DDRotationMatrix * >::iterator end()
Definition: DDBase.h:75
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void DDStreamer::setInput ( std::istream &  i)
inline

set the istream for DDStreamer::read()

Definition at line 69 of file DDStreamer.h.

References i, and i_.

69 { i_ = &i; }
int i
Definition: DBlmapReader.cc:9
std::istream * i_
Definition: DDStreamer.h:126
void DDStreamer::setOutput ( std::ostream &  o)
inline

set the std::ostream for DDStreamer::write()

Definition at line 72 of file DDStreamer.h.

References connectstrParser::o, and o_.

72 { o_ = &o; }
std::ostream * o_
Definition: DDStreamer.h:125
void DDStreamer::solids_read ( )
protected

read all instances of DDSolid

Definition at line 406 of file DDStreamer.cc.

References a, b, trackerHits::c, DCOUT, dd_get_boolean_params(), dd_get_name(), ddbox, ddcons, ddintersection, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, ddreflected, ddshapeless, ddsubtraction, ddtrap, ddtubs, ddunion, i, i_, DDSolidFactory::intersection(), n, L1TEmulatorMonitor_cff::p, csvReporter::r, DDSolidFactory::reflection(), DDSolidFactory::subtraction(), matplotRender::t, and DDSolidFactory::unionSolid().

Referenced by read().

407 {
408  DCOUT('Y', "DDStreamer::solids_read()");
409  std::istream & is = *i_;
410  //DDSolid::clear();
411  size_t n=0;
412  is >> n;
413  size_t i=0;
414  for (; i < n; ++i) { // Solids
415  is.ignore(1000,'@');
416  DDName dn = dd_get_name(is);
417 
418  size_t sp(0);
419  is >> sp;
420  DDSolidShape shape = DDSolidShape(sp);
421 
422  // boolean solids
423  if ( (shape==ddunion) | (shape==ddsubtraction) || (shape==ddintersection) ) {
424  DDRotation r;
426  DDSolid a;
427  DDSolid b;
428  dd_get_boolean_params(is,r,t,a,b);
429  switch (shape) {
430  case ddunion:
431  DDSolidFactory::unionSolid(dn,a,b,t,r);
432  break;
433  case ddintersection:
434  DDSolidFactory::intersection(dn,a,b,t,r);
435  break;
436  case ddsubtraction:
437  DDSolidFactory::subtraction(dn,a,b,t,r);
438  break;
439  default:
440  throw DDException("DDStreamer::solids_read(): messed up in boolean solid reading!");
441  }
442  }
443 
444  // reflection solids
445  else if (shape==ddreflected) {
446  DDName ref_nm = dd_get_name(is);
447  DDSolidFactory::reflection(dn,ref_nm);
448  }
449  else if ( (shape==ddbox ) ||
450  (shape==ddtrap) ||
451  (shape==ddcons) ||
452  (shape==ddtubs) ||
453  (shape==ddpolycone_rz) ||
454  (shape==ddpolycone_rrz) ||
455  (shape==ddpolyhedra_rz) ||
456  (shape==ddpolyhedra_rrz) ||
457  (shape==ddpseudotrap) ||
458  (shape==ddshapeless) )
459  {
460  // read in the solid's parameters
461  size_t npars(0);
462  is >> npars;
463 
464  std::vector<double> p(npars);
465  if(npars) {
466  //edm::LogError("DDStreamer") << npars << flush << std::endl;
467  char c;
468  c = is.get();
469  if (c != ' ') {
470  edm::LogError("DDStreamer") << "delimiter: " << c << std::endl;
471  throw DDException("DDStreamer::solids_read(): wrong separator in atomic for atomic solids parameters");
472  }
473  is.read((char*)&(*(p.begin())),npars*sizeof(double));
474  /*
475  size_t i(0);
476  for(; i< npars; ++i) {
477  double d(0);
478  is >> d;
479  p.push_back(d);
480  }
481  */
482  }
483  DDSolid so = DDSolid(dn,shape,p);
484  DCOUT('y', "read-solid=" << so);
485  }
486  else {
487  edm::LogError("DDStreamer") << "wrong solid enum: " << shape << std::endl;
488  throw DDException("Error in DDStreamer::solids_read(), wrong shape-enum!");
489  }
490  }
491 }
int i
Definition: DBlmapReader.cc:9
void dd_get_boolean_params(std::istream &is, DDRotation &r, DDTranslation &t, DDSolid &a, DDSolid &b)
Definition: DDStreamer.cc:386
An exception for DDD errors.
Definition: DDException.h:23
DDSolidShape
Definition: DDSolidShapes.h:5
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
A DDSolid represents the shape of a part.
Definition: DDSolid.h:42
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:93
std::istream * i_
Definition: DDStreamer.h:126
static DDSolid intersection(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:717
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:708
double b
Definition: hdecay.h:120
static DDSolid reflection(const DDName &name, const DDSolid &s)
Definition: DDSolid.cc:855
double a
Definition: hdecay.h:121
static DDSolid unionSolid(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:699
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void DDStreamer::solids_write ( )
protected

write all instances of DDSolid

Definition at line 346 of file DDStreamer.cc.

References DDBase< DDName, DDI::Solid * >::begin(), DCOUT, dd_count(), dd_stream_booleans(), dd_stream_reflected(), ddintersection, ddreflected, ddsubtraction, ddunion, DDBase< DDName, DDI::Solid * >::end(), DDSolidShapesName::name(), DDBase< N, C >::name(), nameout(), o_, L1TEmulatorMonitor_cff::p, DDSolid::parameters(), asciidump::s, and DDSolid::shape().

Referenced by write().

347 {
348  DCOUT('Y', "DDStreamer::solids_write()");
349  std::ostream & os = *o_;
350  DDSolid::iterator<DDSolid> it(DDSolid::begin()), ed(DDSolid::end());
351  size_t no = dd_count(DDSolid());
352  os << no << std::endl;
353  for (; it != ed; ++it) {
354  if (! it->isDefined().second) continue;
355  const DDSolid & s = *it;
356  DCOUT('y', "write-solid=" << s << " enum=" << s.shape());
357  os << "--Solid: " << s.name() << ' ' << DDSolidShapesName::name(s.shape()) << " @ ";
358  nameout(os,s.name());
359  os << ' ' << s.shape() << ' ';
360  switch (s.shape()) {
361  case ddunion: case ddsubtraction: case ddintersection:
362  dd_stream_booleans(os, s, s.shape());
363  break;
364  case ddreflected:
365  dd_stream_reflected(os, s);
366  break;
367  default:
368  size_t ps = s.parameters().size();
369  os << ps;
370  const std::vector<double> & p = s.parameters();
371  os << ' ';
372  os.write((char*)(&(*p.begin())),ps*sizeof(double));
373  /*
374  std::vector<double>::const_iterator it(p.begin()), ed(p.end());
375  for (; it != ed; ++it) {
376  os << ' ' << *it;
377  }
378  */
379  }
380  os << std::endl;
381  }
382 }
const std::vector< double > & parameters() const
Don&#39;t use (only meant to be used by DDbox(), DDtub(), ...)
Definition: DDSolid.cc:153
void dd_stream_reflected(std::ostream &os, DDSolid s)
Definition: DDStreamer.cc:340
const N & name() const
Definition: DDBase.h:88
DDSolidShape shape() const
The type of the solid.
Definition: DDSolid.cc:147
void dd_stream_booleans(std::ostream &os, DDSolid s, DDSolidShape sh)
Definition: DDStreamer.cc:322
A DDSolid represents the shape of a part.
Definition: DDSolid.h:42
size_t dd_count(const T &dummy)
Definition: DDStreamer.cc:215
static const char * name(DDSolidShape s)
Definition: DDSolidShapes.h:20
std::ostream * o_
Definition: DDStreamer.h:125
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:105
static DDI::Store< DDName, DDI::Solid * >::iterator begin()
Definition: DDBase.h:76
string s
Definition: asciidump.py:422
static DDI::Store< DDName, DDI::Solid * >::iterator end()
Definition: DDBase.h:75
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void DDStreamer::specs_read ( )
protected

read all instances of

Definition at line 824 of file DDStreamer.cc.

References DCOUT, dd_get_delimit(), dd_get_name(), i, i_, n, mergeVDriftHistosByStation::name, query::result, asciidump::s, DDValue::setEvalState(), and python.multivaluedict::sort().

Referenced by read().

825 {
826  DCOUT('Y', "DDStreamer::specs_read()");
827  std::istream & is = *i_;
828  //DDSpecifics::clear();
829  size_t n=0;
830  is >> n;
831  size_t i=0;
832  for (; i < n; ++i) { // Specifics
833  is.ignore(1000,'@');
834  DDName sn(dd_get_name(is));
835  size_t nps(0);
836  is >> nps;
837  size_t ii=0;
838  std::vector<std::string> ps;
839  is.ignore(100,'\n');
840  for (; ii < nps; ++ii) {
841  std::string s;
842  getline(is,s);
843  DCOUT('y', "specs-ps=" << s);
844  ps.push_back(s);
845  }
846  is >> nps;
847  ii=0;
848  DDsvalues_type sv;
849  for(; ii<nps; ++ii) {
850  std::string name = dd_get_delimit(is,'"');
851  bool evl(false);
852  is >> evl;
853  size_t no(0);
854  is >> no;
855  std::vector<DDValuePair> valv;
856  DDValue result;
857  if (evl) {
858  size_t iii=0;
859  for(; iii<no; ++iii) {
860  std::string strv = dd_get_delimit(is,'"');
861  double dblv(0);
862  is >> dblv;
863  DDValuePair valp(strv,dblv);
864  valv.push_back(valp);
865  }
866  result = DDValue(name,valv);
867  result.setEvalState(true);
868  }
869  else {
870  size_t iii=0;
871  for(; iii<no; ++iii) {
872  std::string strv = dd_get_delimit(is,'"');
873  DDValuePair valp(strv,0);
874  valv.push_back(valp);
875  }
876  result = DDValue(name,valv);
877  result.setEvalState(false);
878  }
879  sv.push_back(DDsvalues_Content_type(result,result));
880  }
881  std::sort(sv.begin(),sv.end());
882  DDSpecifics sp(sn,ps,sv,false);
883  DCOUT('y', " specs-read: " << sp);
884  }
885 }
int i
Definition: DBlmapReader.cc:9
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
void setEvalState(bool newState)
set to true, if the double-values (method DDValue::doubles()) make sense
Definition: DDValue.cc:201
std::string dd_get_delimit(std::istream &is, char d)
Definition: DDStreamer.cc:66
DDName dd_get_name(std::istream &is)
Definition: DDStreamer.cc:93
std::istream * i_
Definition: DDStreamer.h:126
tuple result
Definition: query.py:137
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:19
string s
Definition: asciidump.py:422
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
DDsvalues_type::value_type DDsvalues_Content_type
Definition: DDsvalues.h:20
Interface to attach user specific data to nodes in the expanded-view.
Definition: DDSpecifics.h:40
void DDStreamer::specs_write ( )
protected

write all instances of DDSpecifics

Definition at line 774 of file DDStreamer.cc.

References DDBase< DDName, DDI::Specific * >::begin(), DCOUT, dd_count(), DDBase< DDName, DDI::Specific * >::end(), i, DDValue::isEvaluated(), DDValue::name(), DDBase< N, C >::name(), nameout(), o_, asciidump::s, DDSpecifics::selection(), DDValue::size(), DDSpecifics::specifics(), DDValue::strings(), and v.

Referenced by write().

775 {
776  DCOUT('Y', "DDStreamer::specs_write()");
777  std::ostream & os = *o_;
778  DDSpecifics::iterator<DDSpecifics> it(DDSpecifics::begin()), ed(DDSpecifics::end());
779  size_t no = dd_count(DDSpecifics());
780  os << no << std::endl;
781  for (; it != ed; ++it) {
782  if (! it->isDefined().second) continue;
783  const DDSpecifics & sp = *it;
784  os << "--Spec: @ ";
785  nameout(os,sp.name());
786  os << ' ' << sp.selection().size() << std::endl;
787  std::vector<DDPartSelection>::const_iterator sit(sp.selection().begin()), sed(sp.selection().end());
788  for (; sit != sed; ++sit) {
789  os << *sit << std::endl;
790  }
791  os << sp.specifics().size() << std::endl;
792  DDsvalues_type::const_iterator vit(sp.specifics().begin()), ved(sp.specifics().end());
793  for (; vit != ved; ++vit) {
794  const DDValue & v = vit->second;
795  os << ' ' << '"' << v.name() << '"' << ' ';
796  if (v.isEvaluated()) {
797  os << 1 << ' ';
798  }
799  else {
800  os << 0 << ' ';
801  }
802  os << v.size() << ' ';
803  if (v.isEvaluated()) {
804  size_t s=v.size();
805  size_t i=0;
806  for (; i<s; ++i) {
807  os << '"' << v[i].first << '"' << ' ' << v[i].second << ' ';
808  }
809  }
810  else {
811  size_t s=v.size();
812  size_t i=0;
813  const std::vector<std::string> & vs = v.strings();
814  for (; i<s; ++i) {
815  os << '"' << vs[i] << '"' << ' ';
816  }
817  }
818  os << std::endl;
819 
820  }
821  }
822 }
int i
Definition: DBlmapReader.cc:9
const N & name() const
Definition: DDBase.h:88
size_t dd_count(const T &dummy)
Definition: DDStreamer.cc:215
bool isEvaluated() const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:207
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
Definition: DDValue.h:76
const DDsvalues_type & specifics() const
Reference to the user-data attached to all nodes selected by the selections-strings given through sel...
Definition: DDSpecifics.cc:60
std::ostream * o_
Definition: DDStreamer.h:125
void nameout(std::ostream &o, const DDName &n)
Definition: DDStreamer.cc:105
static DDI::Store< DDName, DDI::Specific * >::iterator begin()
Definition: DDBase.h:76
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:83
string s
Definition: asciidump.py:422
static DDI::Store< DDName, DDI::Specific * >::iterator end()
Definition: DDBase.h:75
const std::string & name() const
the name of the DDValue
Definition: DDValue.h:69
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
mathSSE::Vec4< T > v
Interface to attach user specific data to nodes in the expanded-view.
Definition: DDSpecifics.h:40
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.
Definition: DDSpecifics.cc:54
void DDStreamer::vars_read ( )
protected

read the dictionlary of ClhepEvaluator

Definition at line 912 of file DDStreamer.cc.

References DDConstant::createConstantsFromEvaluator(), DCOUT, dd_get_delimit(), i, i_, DDI::Singleton< I >::instance(), n, mergeVDriftHistosByStation::name, ClhepEvaluator::set(), and relativeConstraints::value.

Referenced by read().

913 {
914  DCOUT('Y', "DDStreamer::vars_read()");
915  std::istream & is = *i_;
917  ClhepEvaluator * eval = dynamic_cast<ClhepEvaluator*>(&ev);
918  if (eval){
919  size_t n(0);
920  is >> n;
921  size_t i(0);
922 
923  for(; i<n; ++i) {
924  std::string name(dd_get_delimit(is,'"'));
925  std::string value(dd_get_delimit(is,'"'));
926  eval->set(name,value);
927  }
928  }
929  else {
930  throw DDException("DDStreamer::vars_write(): expression-evaluator is not a ClhepEvaluator-implementation!");
931  }
933 }
int i
Definition: DBlmapReader.cc:9
An exception for DDD errors.
Definition: DDException.h:23
std::string dd_get_delimit(std::istream &is, char d)
Definition: DDStreamer.cc:66
static value_type & instance()
std::istream * i_
Definition: DDStreamer.h:126
Interface of an Expression Evaluator.
static void createConstantsFromEvaluator()
creates all DDConstants from the variables of the ClhepEvaluator
Definition: DDConstant.cc:36
void set(const std::string &ns, const std::string &name, const std::string &exprValue)
put a new variable named &#39;namespace:name&#39; into the dictionary of the evaluator
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
void DDStreamer::vars_write ( )
protected

write the dictionary of ClhepEvaluator

Definition at line 888 of file DDStreamer.cc.

References i, DDI::Singleton< I >::instance(), o_, asciidump::s, ClhepEvaluator::values(), and ClhepEvaluator::variables().

Referenced by write().

889 {
890  std::ostream & os = *o_;
892  ClhepEvaluator * eval = dynamic_cast<ClhepEvaluator*>(&ev);
893  if (eval){
894  const std::vector<std::string> & vars = eval->variables();
895  const std::vector<std::string> & vals = eval->values();
896  if (vars.size() != vals.size()) {
897  throw DDException("DDStreamer::vars_write(): different size of variable names & values!") ;
898  }
899  size_t i(0), s(vars.size());
900  os << s << std::endl;
901  for (; i<s; ++i) {
902  os << '"' << vars[i] << '"' << ' '
903  << '"' << vals[i] << '"' << std::endl;
904  }
905  }
906  else {
907  throw DDException("DDStreamer::vars_write(): expression-evaluator is not a ClhepEvaluator-implementation!");
908  }
909 }
int i
Definition: DBlmapReader.cc:9
An exception for DDD errors.
Definition: DDException.h:23
static value_type & instance()
Interface of an Expression Evaluator.
const std::vector< std::string > & variables() const
access to the clhep-implementation of the dictionary variables
const std::vector< std::string > & values() const
std::ostream * o_
Definition: DDStreamer.h:125
string s
Definition: asciidump.py:422
void DDStreamer::write ( void  )

stream all DDD transient objects to the std::ostream referred to by member o_

Definition at line 111 of file DDStreamer.cc.

References o_.

112 {
113  if (o_ && *o_) {
114  write(*o_);
115  }
116  else {
117  throw DDException("DDStreamer::write(): bad std::ostream");
118  }
119 }
An exception for DDD errors.
Definition: DDException.h:23
void write()
stream all DDD transient objects to the std::ostream referred to by member o_
Definition: DDStreamer.cc:111
std::ostream * o_
Definition: DDStreamer.h:125
void DDStreamer::write ( std::ostream &  os)

stream all DDD transient objects to the given std::ostream os

Definition at line 131 of file DDStreamer.cc.

References materials_write(), names_write(), o_, parts_write(), pos_write(), rots_write(), solids_write(), specs_write(), and vars_write().

132 {
133  o_=&os;
134  std::streamsize prec(os.precision());
135  os << std::setprecision(26) << std::scientific;
136  names_write();
137  vars_write();
138 
139  materials_write();
140  solids_write();
141  parts_write();
142 
143  pos_write();
144  specs_write();
145 
146  rots_write();
147  //os << DDI::Singleton<DDName::IdToName>::instance().size() << std::endl;
148  //names_write();
149  os << resetiosflags((std::ios_base::fmtflags)0);
150  os << std::setprecision(prec);
151 }
void materials_write()
write all instances of DDMaterial
Definition: DDStreamer.cc:256
void solids_write()
write all instances of DDSolid
Definition: DDStreamer.cc:346
void pos_write()
write the graph structure of DDCompactView::graph()
Definition: DDStreamer.cc:610
void vars_write()
write the dictionary of ClhepEvaluator
Definition: DDStreamer.cc:888
void specs_write()
write all instances of DDSpecifics
Definition: DDStreamer.cc:774
void parts_write()
write all instances of DDLogicalPart
Definition: DDStreamer.cc:493
void names_write()
write all instances of DDName
Definition: DDStreamer.cc:171
std::ostream * o_
Definition: DDStreamer.h:125
void rots_write()
write all instances of DDRotation
Definition: DDStreamer.cc:558

Member Data Documentation

const DDCompactView* DDStreamer::cpv_
private

not used

Definition at line 124 of file DDStreamer.h.

std::istream* DDStreamer::i_
private

istream target for reading DDD objects

Definition at line 126 of file DDStreamer.h.

Referenced by DDStreamer(), materials_read(), names_read(), parts_read(), pos_read(), read(), rots_read(), setInput(), solids_read(), specs_read(), and vars_read().

std::ostream* DDStreamer::o_
private

std::ostream target for writing DDD objects

Definition at line 125 of file DDStreamer.h.

Referenced by DDStreamer(), materials_write(), names_write(), parts_write(), pos_write(), rots_write(), setOutput(), solids_write(), specs_write(), vars_write(), and write().