49 void addToSolStore(
const DDSolid& sol, std::set<DDSolid>& solStore, std::set<DDRotation>& rotStore);
51 std::map<
const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp>& specStore);
59 if (sv1.size() < sv2.size())
61 if (sv2.size() < sv1.size())
65 for (; ind < sv1.size(); ++ind) {
68 if (sv2[ind].first < sv1[ind].first)
72 if (sv2[ind].second < sv1[ind].second)
81 if (m_fname.empty()) {
84 m_xos =
new std::ofstream(m_fname.c_str());
86 (*m_xos) <<
"<?xml version=\"1.0\"?>" << std::endl;
87 (*m_xos) <<
"<DDDefinition xmlns=\"http://www.cern.ch/cms/DDL\"" << std::endl;
88 (*m_xos) <<
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" << std::endl;
89 (*m_xos) <<
"xsi:schemaLocation=\"http://www.cern.ch/cms/DDL ../../../DetectorDescription/Schema/DDLSchema.xsd\">"
91 (*m_xos) << std::fixed << std::setprecision(18);
95 (*m_xos) <<
"</DDDefinition>" << std::endl;
96 (*m_xos) << std::endl;
101 std::cout <<
"OutputDDToDDL::beginRun" << std::endl;
109 const auto& gra = pDD->graph();
111 std::set<DDLogicalPart> lpStore;
112 std::set<DDMaterial> matStore;
113 std::set<DDSolid> solStore;
117 std::map<const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp> specStore;
118 std::set<DDRotation> rotStore;
123 size_t foundLastDot = rn.find_last_of(
'.');
124 size_t foundLastSlash = rn.find_last_of(
'/');
125 if (foundLastSlash > foundLastDot && foundLastSlash != std::string::npos) {
126 std::cout <<
"What? last . before last / in path for filename... this should die..." << std::endl;
128 if (foundLastDot != std::string::npos && foundLastSlash != std::string::npos) {
129 out.
ns_ = rn.substr(foundLastSlash, foundLastDot);
130 }
else if (foundLastDot != std::string::npos) {
131 out.
ns_ = rn.substr(0, foundLastDot);
133 std::cout <<
"What? no file name? Attempt at namespace =\"" << out.
ns_ <<
"\" filename was " <<
m_fname
139 (*m_xos) << std::fixed << std::setprecision(18);
145 (*m_xos) <<
"<PosPartSection label=\"" << ns_ <<
"\">" << std::endl;
147 for (; git != gend; ++git) {
149 if (lpStore.find(ddLP) != lpStore.end()) {
152 lpStore.insert(ddLP);
158 auto cit = git->begin();
159 auto cend = git->end();
160 for (; cit != cend; ++cit) {
162 if (lpStore.find(ddcurLP) != lpStore.end()) {
165 lpStore.insert(ddcurLP);
168 rotStore.insert(gra.edgeData(cit->second)->ddrot());
174 (*m_xos) <<
"</PosPartSection>" << std::endl;
176 (*m_xos) << std::scientific << std::setprecision(18);
178 (*m_xos) <<
"<MaterialSection label=\"" << ns_ <<
"\">" << std::endl;
179 for (
const auto& it : matStore) {
180 if (!it.isDefined().second)
184 (*m_xos) <<
"</MaterialSection>" << std::endl;
185 (*m_xos) <<
"<RotationSection label=\"" << ns_ <<
"\">" << std::endl;
186 (*m_xos) << std::fixed << std::setprecision(18);
187 std::set<DDRotation>::iterator rit(rotStore.begin()),
red(rotStore.end());
188 for (; rit !=
red; ++rit) {
189 if (!rit->isDefined().second)
191 if (rit->toString() !=
":") {
196 (*m_xos) <<
"</RotationSection>" << std::endl;
198 (*m_xos) << std::fixed << std::setprecision(18);
199 std::set<DDSolid>::const_iterator sit(solStore.begin()), sed(solStore.end());
200 (*m_xos) <<
"<SolidSection label=\"" << ns_ <<
"\">" << std::endl;
201 for (; sit != sed; ++sit) {
202 if (!sit->isDefined().second)
206 (*m_xos) <<
"</SolidSection>" << std::endl;
208 std::set<DDLogicalPart>::iterator lpit(lpStore.begin()), lped(lpStore.end());
209 (*m_xos) <<
"<LogicalPartSection label=\"" << ns_ <<
"\">" << std::endl;
210 for (; lpit != lped; ++lpit) {
211 if (!lpit->isDefined().first)
216 (*m_xos) <<
"</LogicalPartSection>" << std::endl;
218 (*m_xos) << std::fixed << std::setprecision(18);
219 std::map<DDsvalues_type, std::set<const DDPartSelection*> >::const_iterator mit(specStore.begin()),
220 mend(specStore.end());
221 (*m_xos) <<
"<SpecParSection label=\"" << ns_ <<
"\">" << std::endl;
222 for (; mit != mend; ++mit) {
225 (*m_xos) <<
"</SpecParSection>" << std::endl;
229 matStore.insert(mat);
233 if (matStore.find(mat.
constituent(findex).first) == matStore.end()) {
242 solStore.insert(sol);
246 if (solStore.find(bs.
solidA()) == solStore.end()) {
249 if (solStore.find(bs.
solidB()) == solStore.end()) {
258 std::map<
const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp>& specStore) {
260 specStore[*spit.second].insert(spit.first);
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
T getUntrackedParameter(std::string const &, T const &) const
math::Graph< DDLogicalPart, DDPosData * > Graph
std::vector< double >::size_type index_type
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.
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)
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
DDRotation rotation(void) const
void position(const DDLogicalPart &parent, const DDLogicalPart &child, DDPosData *edgeToChild, int &rotNameSeed, std::ostream &xos)
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 analyze(edm::Event const &iEvent, edm::EventSetup const &) override
void logicalPart(const DDLogicalPart &lp, std::ostream &xos)
Graph::const_adj_iterator adjl_iterator
~OutputDDToDDL() override
DDSolid solidA(void) const
T getParameter(std::string const &) const
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
OutputDDToDDL(const edm::ParameterSet &iConfig)
void material(const DDMaterial &material, std::ostream &xos)
adj_list::const_iterator const_adj_iterator
void rotation(const DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
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.