18 if ( sv1.size() < sv2.size() )
return true;
19 if ( sv2.size() < sv1.size() )
return false;
21 for (; ind < sv1.size(); ++ind) {
22 if ( sv1[ind].
first < sv2[ind].
first )
return true;
23 if ( sv2[ind].first < sv1[ind].first )
return false;
25 if ( sv2[ind].second < sv1[ind].second )
return false;
38 xos_ =
new std::ofstream(fname_.c_str());
40 (*xos_) <<
"<?xml version=\"1.0\"?>" << std::endl;
41 (*xos_) <<
"<DDDefinition xmlns=\"http://www.cern.ch/cms/DDL\"" << std::endl;
42 (*xos_) <<
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" << std::endl;
43 (*xos_) <<
"xsi:schemaLocation=\"http://www.cern.ch/cms/DDL ../../../DetectorDescription/Schema/DDLSchema.xsd\">" << std::endl;
44 (*xos_) << std::fixed << std::setprecision(18);
48 (*xos_) <<
"</DDDefinition>" << std::endl;
57 std::cout<<
"OutputDDToDDL::beginRun"<<std::endl;
63 DDCompactView::DDCompactView::graph_type gra = pDD->graph();
65 std::set<DDLogicalPart> lpStore;
66 std::set<DDMaterial> matStore;
67 std::set<DDSolid> solStore;
71 std::map<const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp > specStore;
72 std::set<DDRotation> rotStore;
77 size_t foundLastDot= rn.find_last_of(
'.');
78 size_t foundLastSlash= rn.find_last_of(
'/');
79 if ( foundLastSlash > foundLastDot && foundLastSlash != std::string::npos) {
80 std::cout <<
"What? last . before last / in path for filename... this should die..." << std::endl;
82 if ( foundLastDot != std::string::npos && foundLastSlash != std::string::npos ) {
83 out.
ns_ = rn.substr(foundLastSlash,foundLastDot);
84 }
else if ( foundLastDot != std::string::npos ) {
85 out.
ns_ = rn.substr(0, foundLastDot);
87 std::cout <<
"What? no file name? Attempt at namespace =\"" << out.
ns_ <<
"\" filename was " <<
fname_ << std::endl;
92 (*xos_) << std::fixed << std::setprecision(18);
95 adjl_iterator git = gra.begin();
96 adjl_iterator gend = gra.end();
99 (*xos_) <<
"<PosPartSection label=\"" << ns_ <<
"\">" << std::endl;
101 for (; git != gend; ++git)
104 if ( lpStore.find(ddLP) != lpStore.end() ) {
107 lpStore.insert(ddLP);
114 DDCompactView::graph_type::edge_list::const_iterator cit = git->begin();
115 DDCompactView::graph_type::edge_list::const_iterator cend = git->end();
116 for (; cit != cend; ++cit)
119 if (lpStore.find(ddcurLP) != lpStore.end()) {
122 lpStore.insert(ddcurLP);
125 rotStore.insert(gra.edgeData(cit->second)->rot_);
132 (*xos_) <<
"</PosPartSection>" << std::endl;
134 (*xos_) << std::scientific << std::setprecision(18);
135 std::set<DDMaterial>::const_iterator it(matStore.begin()), ed(matStore.end());
136 (*xos_) <<
"<MaterialSection label=\"" << ns_ <<
"\">" << std::endl;
137 for (; it != ed; ++it) {
138 if (! it->isDefined().second)
continue;
141 (*xos_) <<
"</MaterialSection>" << std::endl;
143 (*xos_) <<
"<RotationSection label=\"" << ns_ <<
"\">" << std::endl;
144 (*xos_) << std::fixed << std::setprecision(18);
145 std::set<DDRotation>::iterator rit(rotStore.begin()),
red(rotStore.end());
146 for (; rit !=
red; ++rit) {
147 if (! rit->isDefined().second)
continue;
148 if ( rit->toString() !=
":" ) {
153 (*xos_) <<
"</RotationSection>" << std::endl;
155 (*xos_) << std::fixed << std::setprecision(18);
156 std::set<DDSolid>::const_iterator sit(solStore.begin()), sed(solStore.end());
157 (*xos_) <<
"<SolidSection label=\"" << ns_ <<
"\">" << std::endl;
158 for (; sit != sed; ++sit) {
159 if (! sit->isDefined().second)
continue;
162 (*xos_) <<
"</SolidSection>" << std::endl;
164 std::set<DDLogicalPart>::iterator lpit(lpStore.begin()), lped(lpStore.end());
165 (*xos_) <<
"<LogicalPartSection label=\"" << ns_ <<
"\">" << std::endl;
166 for (; lpit != lped; ++lpit) {
167 if (! lpit->isDefined().first)
continue;
171 (*xos_) <<
"</LogicalPartSection>" << std::endl;
173 (*xos_) << std::fixed << std::setprecision(18);
174 std::map<DDsvalues_type, std::set<const DDPartSelection*> >::const_iterator mit(specStore.begin()), mend (specStore.end());
175 (*xos_) <<
"<SpecParSection label=\"" << ns_ <<
"\">" << std::endl;
176 for (; mit != mend; ++mit) {
179 (*xos_) <<
"</SpecParSection>" << std::endl;
184 matStore.insert(mat);
189 if ( matStore.find(mat.
constituent(findex).first) == matStore.end() ) {
198 solStore.insert(sol);
201 if ( solStore.find(bs.
solidA()) == solStore.end()) {
204 if ( solStore.find(bs.
solidB()) == solStore.end()) {
213 for ( ; spit != spend; ++spit ) {
214 specStore[*spit->second].insert(spit->first);
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void rotation(DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
DDMaterial is used to define and access material information.
#define DEFINE_FWK_MODULE(type)
void addToSpecStore(const DDLogicalPart &lp, std::map< const DDsvalues_type, std::set< const DDPartSelection * >, ddsvaluesCmp > &specStore)
void addToMatStore(const DDMaterial &mat, std::set< DDMaterial > &matStore)
void specpar(const DDSpecifics &sp, std::ostream &xos)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
std::vector< double >::size_type index_type
void addToSolStore(const DDSolid &sol, std::set< DDSolid > &solStore, std::set< DDRotation > &rotStore)
A DDSolid represents the shape of a part.
DDSolid solidB(void) const
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
DDRotation rotation(void) const
void position(const DDLogicalPart &parent, const DDLogicalPart &child, DDPosData *edgeToChild, int &rotNameSeed, std::ostream &xos)
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
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
DDSolidShape shape(void) const
The type of the solid.
void logicalPart(const DDLogicalPart &lp, std::ostream &xos)
Container::value_type value_type
DDSolid solidA(void) const
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
OutputDDToDDL(const edm::ParameterSet &iConfig)
adj_list::const_iterator const_adj_iterator
void material(const DDMaterial &material, std::ostream &xos)
void solid(const DDSolid &solid, std::ostream &xos)
const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > & attachedSpecifics(void) const
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.