23 : cpv_(0), o_(0), i_(0)
28 : cpv_(0), o_(0), i_(0)
34 throw DDException(
"DDStreamer::DDStreamer(std::ostream&): not valid std::ostream");
39 : cpv_(0), o_(0), i_(0)
45 throw DDException(
"DDStreamer::DDStreamer(std::ostream&): not valid std::ostream");
70 while ((i=is.get()) && i != d) ;
71 while ((i=is.get()) && i != d) {
102 o <<
'"' << n.
name() <<
'"' <<
' ' <<
'"' << n.
ns() <<
'"' ;
117 throw DDException(
"DDStreamer::write(): bad std::ostream");
127 throw DDException(
"DDStreamer::read(): bad std::istream");
134 std::streamsize prec(os.precision());
135 os << std::setprecision(26) << std::scientific;
149 os << resetiosflags((std::ios_base::fmtflags)0);
150 os << std::setprecision(prec);
173 DCOUT(
'Y',
"DDStreamer::names_write()");
174 std::ostream & os = *
o_;
177 DDName::IdToName::const_iterator it(ids.begin()), ed(ids.end());
178 os << ids.size() << std::endl;
180 for (; it != ed; ++it) {
181 os <<
'"' << (*it)->first.first <<
'"' <<
' '
182 <<
'"' << (*it)->first.second <<
'"' <<
' '
183 << count << std::endl;
192 DCOUT(
'Y',
"DDStreamer::names_read()");
193 std::istream & is = *
i_;
219 for (; it!=ed; ++it) {
220 if (it->isDefined().second) {
239 const char * d = (
const char *)(&(b.
val_));
242 os.write(d,
sizeof(
double));
249 char * d = (
char *)(&(b.
val_));
251 is.read(d,
sizeof(
double));
258 DCOUT(
'Y',
"DDStreamer::materials_write()");
259 std::ostream & os = *
o_;
262 os << no << std::endl;
263 for (; it != ed; ++it) {
264 if (! it->isDefined().second)
continue;
266 os <<
"--Material: " << m.
name() <<
" @ " ;
268 DCOUT(
'y',
"write-material=" << m.
name());
269 os <<
' ' << m.
z() <<
' ' << m.
a() <<
' ' << m.
density() <<
' ';
287 DCOUT(
'Y',
"DDStreamer::materials_read()");
288 std::istream & is = *
i_;
296 double z(0),
a(0), d(0);
304 DCOUT(
'y',
"read-comp-material=" << m.
name());
311 DCOUT(
'y',
" read-composite=" << constituent.
name());
317 DCOUT(
'y',
"read-elem-material=" << m.
name());
328 edm::LogError(
"DDStreamer") <<
"DDStreamer::dd_stream_booleans(): solid=" << s.
name() <<
" has no rotation. Using unit-rot." << std::endl;
348 DCOUT(
'Y',
"DDStreamer::solids_write()");
349 std::ostream & os = *
o_;
352 os << no << std::endl;
353 for (; it != ed; ++it) {
354 if (! it->isDefined().second)
continue;
356 DCOUT(
'y',
"write-solid=" << s <<
" enum=" << s.
shape());
359 os <<
' ' << s.
shape() <<
' ';
372 os.write((
char*)(&(*p.begin())),ps*
sizeof(double));
394 throw DDException(
"DDStreamer::get_boolean_param(): inconsistent sequence! no blank delimiter before trans!");
403 DCOUT(
'y',
"boolean-par: rot=" << r.
name() <<
" t=" << t <<
" a=" << a.
name() <<
" b=" << b.
name());
408 DCOUT(
'Y',
"DDStreamer::solids_read()");
409 std::istream & is = *
i_;
440 throw DDException(
"DDStreamer::solids_read(): messed up in boolean solid reading!");
449 else if ( (shape==
ddbox ) ||
464 std::vector<double>
p(npars);
470 edm::LogError(
"DDStreamer") <<
"delimiter: " << c << std::endl;
471 throw DDException(
"DDStreamer::solids_read(): wrong separator in atomic for atomic solids parameters");
473 is.read((
char*)&(*(p.begin())),npars*
sizeof(double));
484 DCOUT(
'y',
"read-solid=" << so);
487 edm::LogError(
"DDStreamer") <<
"wrong solid enum: " << shape << std::endl;
488 throw DDException(
"Error in DDStreamer::solids_read(), wrong shape-enum!");
495 DCOUT(
'Y',
"DDStreamer::parts_write()");
496 std::ostream & os = *
o_;
499 os << no << std::endl;
500 for (; it != ed; ++it) {
501 if (! it->isDefined().second)
continue;
503 os <<
"--Part: " << lp.
name() <<
" @ ";
516 DCOUT(
'Y',
"DDStreamer::parts_read()");
517 std::istream & is = *
i_;
531 DCOUT(
'y',
"read-lp=" << lp);
538 rm.GetComponents(v,v+9);
539 for (
int i=0;
i<9;
i++)
544 os <<
"--Rot: " << r.
name() <<
" @ ";
560 DCOUT(
'Y',
"DDStreamer::rots_write()");
561 std::ostream & os = *
o_;
564 os << no << std::endl;
566 for (; it != ed; ++it) {
567 if (! it->isDefined().second)
continue;
581 for (
int i=0;
i<9;
i++) {
582 is >> w; v[
i]=w.
val_;
584 r.SetComponents(v,v+9);
589 DCOUT(
'Y',
"DDStreamer::rots_read()");
590 std::istream & is = *
i_;
600 throw DDException(
"DDStreamer::rots_read(): inconsitency! no blank separator found!");
612 DCOUT(
'Y',
"DDStreamer::pos_write()");
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_;
624 DDCompactView::graph_type::const_iterator iit = g.
begin_iter();
625 DDCompactView::graph_type::const_iterator eed = g.
end_iter();
627 for(; iit != eed; ++iit) {
630 os << count << std::endl;
634 for(; it != ed; ++it) {
635 os <<
"--Pos[" << count <<
"]: @ "; ++
count;
637 nameout(os, it->from().name());
640 os <<
' ' << it->edge()->copyno_;
643 os <<
' ' <<
B(tr.x()) <<
B(tr.y()) <<
B(tr.z());
655 if (ro.name() == unit_rot_name) {
656 if(ro.isDefined().second) {
657 if(*(ro.rotation()) != unit_rot) {
678 DCOUT(
'Y',
"DDStreamer::pos_read()");
679 std::istream & is = *
i_;
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");
705 if (cr !=
' ')
throw DDException(
"DDStreamer::pos_read(): inconsistent sequence! no blank delimiter found!");
713 char rottype = is.get();
730 std::string
message =
"DDStreamer::pos_read(): could not determine type of rotation\n";
735 DCOUT(
'y',
" pos-read: f=" << from <<
" to=" << to <<
" t=" << t <<
" r=" << rot);
776 DCOUT(
'Y',
"DDStreamer::specs_write()");
777 std::ostream & os = *
o_;
780 os << no << std::endl;
781 for (; it != ed; ++it) {
782 if (! it->isDefined().second)
continue;
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;
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) {
795 os <<
' ' <<
'"' << v.
name() <<
'"' <<
' ';
802 os << v.
size() <<
' ';
807 os <<
'"' << v[
i].first <<
'"' <<
' ' << v[
i].second <<
' ';
813 const std::vector<std::string> & vs = v.
strings();
815 os <<
'"' << vs[
i] <<
'"' <<
' ';
826 DCOUT(
'Y',
"DDStreamer::specs_read()");
827 std::istream & is = *
i_;
838 std::vector<std::string> ps;
840 for (; ii < nps; ++ii) {
843 DCOUT(
'y',
"specs-ps=" << s);
849 for(; ii<nps; ++ii) {
855 std::vector<DDValuePair> valv;
859 for(; iii<no; ++iii) {
864 valv.push_back(valp);
871 for(; iii<no; ++iii) {
874 valv.push_back(valp);
883 DCOUT(
'y',
" specs-read: " << sp);
890 std::ostream & os = *
o_;
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!") ;
899 size_t i(0),
s(vars.size());
900 os <<
s << std::endl;
902 os <<
'"' << vars[
i] <<
'"' <<
' '
903 <<
'"' << vals[
i] <<
'"' << std::endl;
907 throw DDException(
"DDStreamer::vars_write(): expression-evaluator is not a ClhepEvaluator-implementation!");
914 DCOUT(
'Y',
"DDStreamer::vars_read()");
915 std::istream & is = *
i_;
926 eval->
set(name,value);
930 throw DDException(
"DDStreamer::vars_write(): expression-evaluator is not a ClhepEvaluator-implementation!");
void materials_write()
write all instances of DDMaterial
const std::vector< double > & parameters() const
Don't use (only meant to be used by DDbox(), DDtub(), ...)
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.
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)
DDSolidShape shape() const
The type of the solid.
DDMaterial is used to define and access material information.
void dd_stream_booleans(std::ostream &os, DDSolid s, DDSolidShape sh)
void pos_write()
write the graph structure of DDCompactView::graph()
void dd_rot_bin_in(std::istream &is, DDRotationMatrix &r)
An exception for DDD errors.
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
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
const DDMaterial & material() const
Returns a reference object of the material this LogicalPart is made of.
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.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
size_t dd_count(const T &dummy)
Represents a uniquely identifyable rotation matrix.
DDName dd_get_name(std::istream &is)
void vars_read()
read the dictionlary of ClhepEvaluator
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.
bool isEvaluated() const
true, if values are numerical evaluated; else false.
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
DDSolid unreflected() const
static DDSolid intersection(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
static const char * name(DDSolidShape s)
void dd_rot_out(std::ostream &os, const DDRotation &r)
Interface of an Expression Evaluator.
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
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 ...
void rots_read()
read all instances of DDRotation
void names_write()
write all instances of DDName
static std::string from(" from ")
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)
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)
void rots_write()
write all instances of DDRotation
void set(const std::string &ns, const std::string &name, const std::string &exprValue)
put a new variable named 'namespace:name' into the dictionary of the evaluator
static DDI::Store< DDName, DDI::Material * >::iterator begin()
unsigned int size() const
the size of the stored value-pairs (std::string,double)
DDRotation rotation() const
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()
const std::string & name() const
the name of the DDValue
void nameout_strings(std::ostream &o, const DDName &n)
DDTranslation translation() const
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
#define DCOUT(M_v_Y, M_v_S)
DDEnums::Category category() const
Returns the categorization of the DDLogicalPart (sensitive detector element, cable, ...)
const std::string & name() const
Returns the name.
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.