22 : cpv_(0), o_(0), i_(0)
27 : cpv_(0), o_(0), i_(0)
33 throw cms::Exception(
"DDException") <<
"DDStreamer::DDStreamer(std::ostream&): not valid std::ostream";
38 : cpv_(0), o_(0), i_(0)
44 throw cms::Exception(
"DDException") <<
"DDStreamer::DDStreamer(std::ostream&): not valid std::ostream";
69 while ((i=is.get()) && i != d) ;
70 while ((i=is.get()) && i != d) {
101 o <<
'"' << n.
name() <<
'"' <<
' ' <<
'"' << n.
ns() <<
'"' ;
116 throw cms::Exception(
"DDException") <<
"DDStreamer::write(): bad std::ostream";
126 throw cms::Exception(
"DDException") <<
"DDStreamer::read(): bad std::istream";
133 std::streamsize prec(os.precision());
134 os << std::setprecision(26) << std::scientific;
148 os << resetiosflags((std::ios_base::fmtflags)0);
149 os << std::setprecision(prec);
172 DCOUT(
'Y',
"DDStreamer::names_write()");
173 std::ostream & os = *
o_;
176 DDName::IdToName::const_iterator it(ids.begin()), ed(ids.end());
177 os << ids.size() << std::endl;
179 for (; it != ed; ++it) {
180 os <<
'"' << (*it)->first.first <<
'"' <<
' '
181 <<
'"' << (*it)->first.second <<
'"' <<
' '
182 << count << std::endl;
191 DCOUT(
'Y',
"DDStreamer::names_read()");
192 std::istream & is = *
i_;
218 for (; it!=ed; ++it) {
219 if (it->isDefined().second) {
238 const char * d = (
const char *)(&(b.
val_));
241 os.write(d,
sizeof(
double));
248 char * d = (
char *)(&(b.
val_));
250 is.read(d,
sizeof(
double));
257 DCOUT(
'Y',
"DDStreamer::materials_write()");
258 std::ostream & os = *
o_;
261 os << no << std::endl;
262 for (; it != ed; ++it) {
263 if (! it->isDefined().second)
continue;
265 os <<
"--Material: " << m.
name() <<
" @ " ;
267 DCOUT(
'y',
"write-material=" << m.
name());
268 os <<
' ' << m.
z() <<
' ' << m.
a() <<
' ' << m.
density() <<
' ';
286 DCOUT(
'Y',
"DDStreamer::materials_read()");
287 std::istream & is = *
i_;
295 double z(0),
a(0), d(0);
303 DCOUT(
'y',
"read-comp-material=" << m.
name());
310 DCOUT(
'y',
" read-composite=" << constituent.
name());
316 DCOUT(
'y',
"read-elem-material=" << m.
name());
327 edm::LogError(
"DDStreamer") <<
"DDStreamer::dd_stream_booleans(): solid=" << s.
name() <<
" has no rotation. Using unit-rot." << std::endl;
347 DCOUT(
'Y',
"DDStreamer::solids_write()");
348 std::ostream & os = *
o_;
351 os << no << std::endl;
352 for (; it != ed; ++it) {
353 if (! it->isDefined().second)
continue;
355 DCOUT(
'y',
"write-solid=" << s <<
" enum=" << s.
shape());
358 os <<
' ' << s.
shape() <<
' ';
371 os.write((
char*)(&(*p.begin())),ps*
sizeof(double));
393 throw cms::Exception(
"DDException") <<
"DDStreamer::get_boolean_param(): inconsistent sequence! no blank delimiter before trans!";
402 DCOUT(
'y',
"boolean-par: rot=" << r.
name() <<
" t=" << t <<
" a=" << a.
name() <<
" b=" << b.
name());
407 DCOUT(
'Y',
"DDStreamer::solids_read()");
408 std::istream & is = *
i_;
439 throw cms::Exception(
"DDException") <<
"DDStreamer::solids_read(): messed up in boolean solid reading!";
448 else if ( (shape==
ddbox ) ||
463 std::vector<double>
p(npars);
469 edm::LogError(
"DDStreamer") <<
"delimiter: " << c << std::endl;
470 throw cms::Exception(
"DDException") <<
"DDStreamer::solids_read(): wrong separator in atomic for atomic solids parameters";
472 is.read((
char*)&(*(p.begin())),npars*
sizeof(double));
483 DCOUT(
'y',
"read-solid=" << so);
486 edm::LogError(
"DDStreamer") <<
"wrong solid enum: " << shape << std::endl;
487 throw cms::Exception(
"DDException") <<
"Error in DDStreamer::solids_read(), wrong shape-enum!";
494 DCOUT(
'Y',
"DDStreamer::parts_write()");
495 std::ostream & os = *
o_;
498 os << no << std::endl;
499 for (; it != ed; ++it) {
500 if (! it->isDefined().second)
continue;
502 os <<
"--Part: " << lp.
name() <<
" @ ";
515 DCOUT(
'Y',
"DDStreamer::parts_read()");
516 std::istream & is = *
i_;
530 DCOUT(
'y',
"read-lp=" << lp);
537 rm.GetComponents(v,v+9);
538 for (
int i=0;
i<9;
i++)
543 os <<
"--Rot: " << r.
name() <<
" @ ";
559 DCOUT(
'Y',
"DDStreamer::rots_write()");
560 std::ostream & os = *
o_;
563 os << no << std::endl;
565 for (; it != ed; ++it) {
566 if (! it->isDefined().second)
continue;
580 for (
int i=0;
i<9;
i++) {
581 is >>
w; v[
i]=w.val_;
583 r.SetComponents(v,v+9);
588 DCOUT(
'Y',
"DDStreamer::rots_read()");
589 std::istream & is = *
i_;
599 throw cms::Exception(
"DDException") <<
"DDStreamer::rots_read(): inconsitency! no blank separator found!";
611 DCOUT(
'Y',
"DDStreamer::pos_write()");
614 DDCompactView::graph_type::const_iterator it = g.
begin_iter();
615 DDCompactView::graph_type::const_iterator ed = g.
end_iter();
616 std::ostream & os = *
o_;
623 DDCompactView::graph_type::const_iterator iit = g.
begin_iter();
624 DDCompactView::graph_type::const_iterator eed = g.
end_iter();
626 for(; iit != eed; ++iit) {
629 os << count << std::endl;
633 for(; it != ed; ++it) {
634 os <<
"--Pos[" << count <<
"]: @ "; ++
count;
636 nameout(os, it->from().name());
639 os <<
' ' << it->edge()->copyno_;
642 os <<
' ' <<
B(tr.x()) <<
B(tr.y()) <<
B(tr.z());
654 if (ro.name() == unit_rot_name) {
655 if(ro.isDefined().second) {
656 if(*(ro.rotation()) != unit_rot) {
677 DCOUT(
'Y',
"DDStreamer::pos_read()");
678 std::istream & is = *
i_;
693 edm::LogWarning(
"DDStreamer") <<
"DDStreamer::pos_read(): The CompactView already contains some position information." << std::endl
694 <<
" It may cause an inconsistent geometry representation!" << std::endl << std::endl;
695 throw cms::Exception(
"DDException") <<
"DDStreamer::pos_read() failed; CompactView has already been populated by another data source";
704 if (cr !=
' ')
throw cms::Exception(
"DDException") <<
"DDStreamer::pos_read(): inconsistent sequence! no blank delimiter found!";
712 char rottype = is.get();
729 std::string message =
"DDStreamer::pos_read(): could not determine type of rotation\n";
734 DCOUT(
'y',
" pos-read: f=" << from <<
" to=" << to <<
" t=" << t <<
" r=" << rot);
775 DCOUT(
'Y',
"DDStreamer::specs_write()");
776 std::ostream & os = *
o_;
779 os << no << std::endl;
780 for (; it != ed; ++it) {
781 if (! it->isDefined().second)
continue;
785 os <<
' ' << sp.
selection().size() << std::endl;
786 std::vector<DDPartSelection>::const_iterator sit(sp.
selection().begin()), sed(sp.
selection().end());
787 for (; sit != sed; ++sit) {
788 os << *sit << std::endl;
790 os << sp.
specifics().size() << std::endl;
791 DDsvalues_type::const_iterator vit(sp.
specifics().begin()), ved(sp.
specifics().end());
792 for (; vit != ved; ++vit) {
794 os <<
' ' <<
'"' << v.
name() <<
'"' <<
' ';
801 os << v.
size() <<
' ';
806 os <<
'"' << v[
i].first <<
'"' <<
' ' << v[
i].second <<
' ';
812 const std::vector<std::string> & vs = v.
strings();
814 os <<
'"' << vs[
i] <<
'"' <<
' ';
825 DCOUT(
'Y',
"DDStreamer::specs_read()");
826 std::istream & is = *
i_;
837 std::vector<std::string> ps;
839 for (; ii < nps; ++
ii) {
842 DCOUT(
'y',
"specs-ps=" << s);
848 for(; ii<nps; ++
ii) {
854 std::vector<DDValuePair> valv;
858 for(; iii<no; ++iii) {
863 valv.push_back(valp);
870 for(; iii<no; ++iii) {
873 valv.push_back(valp);
882 DCOUT(
'y',
" specs-read: " << sp);
889 std::ostream & os = *
o_;
893 const std::vector<std::string> & vars = eval->
variables();
894 const std::vector<std::string> &
vals = eval->
values();
895 if (vars.size() != vals.size()) {
896 throw cms::Exception(
"DDException") <<
"DDStreamer::vars_write(): different size of variable names & values!";
898 size_t i(0),
s(vars.size());
899 os <<
s << std::endl;
901 os <<
'"' << vars[
i] <<
'"' <<
' '
902 <<
'"' << vals[
i] <<
'"' << std::endl;
906 throw cms::Exception(
"DDException") <<
"DDStreamer::vars_write(): expression-evaluator is not a ClhepEvaluator-implementation!";
913 DCOUT(
'Y',
"DDStreamer::vars_read()");
914 std::istream & is = *
i_;
925 eval->
set(name,value);
929 throw cms::Exception(
"DDException") <<
"DDStreamer::vars_write(): expression-evaluator is not a ClhepEvaluator-implementation!";
void materials_write()
write all instances of DDMaterial
const std::string & name(void) const
the name of the DDValue
void solids_write()
write all instances of DDSolid
adj_list::size_type size() const
double a() const
returns the atomic mass
void dd_stream_reflected(std::ostream &os, DDSolid s)
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
def_type isDefined() const
void read()
populate DDD transient objects from the std::istream refetrred to by member i_
void dd_get_boolean_params(std::istream &is, DDRotation &r, DDTranslation &t, DDSolid &a, DDSolid &b)
DDMaterial is used to define and access material information.
DDEnums::Category category(void) const
Returns the categorization of the DDLogicalPart (sensitive detector element, cable, ...)
void pos_write()
write the graph structure of DDCompactView::graph()
void dd_rot_bin_in(std::istream &is, DDRotationMatrix &r)
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)
void vars_write()
write the dictionary of ClhepEvaluator
void specs_write()
write all instances of DDSpecifics
const std::string & ns() const
Returns the namespace.
DDName is used to identify DDD entities uniquely.
void names_read()
read all instances of DDName
void setEvalState(bool newState)
set to true, if the double-values (method DDValue::doubles()) make sense
std::string dd_get_delimit(std::istream &is, char d)
void parts_write()
write all instances of DDLogicalPart
virtual ~DDStreamer()
does nothing; usefull only if another streamer derives from DDStreamer
DDTranslation translation(void) const
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
void dd_rot_bin_out(std::ostream &os, const DDRotationMatrix &rm)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
type of data representation of DDCompactView
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
A DDSolid represents the shape of a part.
DDSolid solidB(void) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Represents a uniquely identifyable rotation matrix.
DDName dd_get_name(std::istream &is)
void vars_read()
read the dictionlary of ClhepEvaluator
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
std::map< std::pair< std::string, std::string >, id_type > Registry
int addMaterial(const DDMaterial &m, double fm)
adds a material to the mixture proportional to its fraction-mass fm.
void write()
stream all DDD transient objects to the std::ostream referred to by member o_
static value_type & instance()
double z() const
retruns the atomic number
void solids_read()
read all instances of DDSolid
static const char *const name(DDSolidShape s)
DDSolid unreflected(void) const
static DDSolid intersection(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
DDRotation rotation(void) const
void dd_stream_booleans(std::ostream &os, DDSolid s, DDSolidShape)
void dd_rot_out(std::ostream &os, const DDRotation &r)
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::...
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
void specs_read()
read all instances of
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
const std::vector< std::string > & variables() const
access to the clhep-implementation of the dictionary variables
DDSolidShape shape(void) const
The type of the solid.
const_iterator begin_iter() const
const std::vector< std::string > & values() const
static void defineId(const std::pair< std::string, std::string > &, id_type id)
register pre-defined ids
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
size_t dd_count(const T &)
DDSolid solidA(void) const
void rots_read()
read all instances of DDRotation
void names_write()
write all instances of DDName
void parts_read()
read all instances of DDLogicalPart
std::vector< Registry::const_iterator > IdToName
void pos_read()
read the graph structure for DDCompactView::graph()
double density() const
returns the density
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
static void createConstantsFromEvaluator()
creates all DDConstants from the variables of the ClhepEvaluator
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
const DDsvalues_type & specifics() const
Reference to the user-data attached to all nodes selected by the selections-strings given through sel...
std::istream & operator>>(std::istream &input, CLHEP::HepGenMatrix &matrix)
static DDSolid reflection(const DDName &name, const DDSolid &s)
void materials_read()
read all instances of DDMaterial
DDName dd_get_name_string(std::istream &is)
void nameout(std::ostream &o, const DDName &n)
void rots_write()
write all instances of DDRotation
void set(const std::string &ns, const std::string &name, const std::string &exprValue)
static DDI::Store< DDName, DDI::Material * >::iterator begin()
unsigned int size() const
the size of the stored value-pairs (std::string,double)
static DDSolid unionSolid(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
DDStreamer()
constructs a streamer object with yet undefined std::istream and std::ostream
static DDI::Store< DDName, DDI::Material * >::iterator end()
void nameout_strings(std::ostream &o, const DDName &n)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
#define DCOUT(M_v_Y, M_v_S)
const std::string & name() const
Returns the name.
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
DDsvalues_type::value_type DDsvalues_Content_type
Interface to attach user specific data to nodes in the expanded-view.
const_iterator end_iter() const
string root
initialization
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.