60 if (sv1.size() < sv2.size())
62 if (sv2.size() < sv1.size())
66 for (; ind < sv1.size(); ++ind) {
87 (*m_xos) <<
"<?xml version=\"1.0\"?>" << std::endl;
88 (*m_xos) <<
"<DDDefinition xmlns=\"http://www.cern.ch/cms/DDL\"" << std::endl;
89 (*m_xos) <<
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" << std::endl;
90 (*m_xos) <<
"xsi:schemaLocation=\"http://www.cern.ch/cms/DDL ../../../DetectorDescription/Schema/DDLSchema.xsd\">" 92 (*m_xos) <<
std::fixed << std::setprecision(18);
94 ddToken_ = esConsumes<DDCompactView, IdealGeometryRecord, edm::Transition::BeginRun>();
98 (*m_xos) <<
"</DDDefinition>" << std::endl;
99 (*m_xos) << std::endl;
104 std::cout <<
"OutputDDToDDL::beginRun" << std::endl;
111 const auto& gra = pDD->
graph();
113 std::set<DDLogicalPart> lpStore;
114 std::set<DDMaterial> matStore;
115 std::set<DDSolid> solStore;
119 std::map<const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp> specStore;
120 std::set<DDRotation> rotStore;
125 size_t foundLastDot = rn.find_last_of(
'.');
126 size_t foundLastSlash = rn.find_last_of(
'/');
127 if (foundLastSlash > foundLastDot && foundLastSlash != std::string::npos) {
128 std::cout <<
"What? last . before last / in path for filename... this should die..." << std::endl;
130 if (foundLastDot != std::string::npos && foundLastSlash != std::string::npos) {
131 out.ns_ = rn.substr(foundLastSlash, foundLastDot);
132 }
else if (foundLastDot != std::string::npos) {
133 out.ns_ = rn.substr(0, foundLastDot);
135 std::cout <<
"What? no file name? Attempt at namespace =\"" <<
out.ns_ <<
"\" filename was " <<
m_fname 141 (*m_xos) <<
std::fixed << std::setprecision(18);
147 (*m_xos) <<
"<PosPartSection label=\"" << ns_ <<
"\">" << std::endl;
149 for (; git != gend; ++git) {
151 if (lpStore.find(ddLP) != lpStore.end()) {
154 lpStore.insert(ddLP);
160 auto cit = git->begin();
161 auto cend = git->end();
162 for (; cit != cend; ++cit) {
164 if (lpStore.find(ddcurLP) != lpStore.end()) {
167 lpStore.insert(ddcurLP);
170 rotStore.insert(gra.edgeData(cit->second)->ddrot());
176 (*m_xos) <<
"</PosPartSection>" << std::endl;
178 (*m_xos) << std::scientific << std::setprecision(18);
180 (*m_xos) <<
"<MaterialSection label=\"" << ns_ <<
"\">" << std::endl;
181 for (
const auto& it : matStore) {
182 if (!it.isDefined().second)
186 (*m_xos) <<
"</MaterialSection>" << std::endl;
187 (*m_xos) <<
"<RotationSection label=\"" << ns_ <<
"\">" << std::endl;
188 (*m_xos) <<
std::fixed << std::setprecision(18);
189 std::set<DDRotation>::iterator rit(rotStore.begin()),
red(rotStore.end());
190 for (; rit !=
red; ++rit) {
191 if (!rit->isDefined().second)
193 if (rit->toString() !=
":") {
198 (*m_xos) <<
"</RotationSection>" << std::endl;
200 (*m_xos) <<
std::fixed << std::setprecision(18);
201 std::set<DDSolid>::const_iterator sit(solStore.begin()), sed(solStore.end());
202 (*m_xos) <<
"<SolidSection label=\"" << ns_ <<
"\">" << std::endl;
203 for (; sit != sed; ++sit) {
204 if (!sit->isDefined().second)
208 (*m_xos) <<
"</SolidSection>" << std::endl;
210 std::set<DDLogicalPart>::iterator lpit(lpStore.begin()), lped(lpStore.end());
211 (*m_xos) <<
"<LogicalPartSection label=\"" << ns_ <<
"\">" << std::endl;
212 for (; lpit != lped; ++lpit) {
213 if (!lpit->isDefined().first)
218 (*m_xos) <<
"</LogicalPartSection>" << std::endl;
220 (*m_xos) <<
std::fixed << std::setprecision(18);
221 std::map<DDsvalues_type, std::set<const DDPartSelection*> >::const_iterator mit(specStore.begin()),
222 mend(specStore.end());
223 (*m_xos) <<
"<SpecParSection label=\"" << ns_ <<
"\">" << std::endl;
224 for (; mit != mend; ++mit) {
227 (*m_xos) <<
"</SpecParSection>" << std::endl;
231 matStore.insert(mat);
235 if (matStore.find(mat.
constituent(findex).first) == matStore.end()) {
244 solStore.insert(
sol);
248 if (solStore.find(
bs.solidA()) == solStore.end()) {
251 if (solStore.find(
bs.solidB()) == solStore.end()) {
254 rotStore.insert(
bs.rotation());
262 specStore[*spit.second].insert(spit.first);
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
math::Graph< DDLogicalPart, DDPosData * > Graph
T getParameter(std::string const &) const
std::vector< double >::size_type index_type
DDMaterial is used to define and access material information.
#define DEFINE_FWK_MODULE(type)
void addToMatStore(const DDMaterial &mat, std::set< DDMaterial > &matStore)
void addToSpecStore(const DDLogicalPart &lp, std::map< const DDsvalues_type, std::set< const DDPartSelection *>, ddsvaluesCmp > &specStore)
void addToSolStore(const DDSolid &sol, std::set< DDSolid > &solStore, std::set< DDRotation > &rotStore)
A DDSolid represents the shape of a part.
Represents a uniquely identifyable rotation matrix.
T getUntrackedParameter(std::string const &, T const &) const
U second(std::pair< T, U > const &p)
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Graph::const_adj_iterator adjl_iterator
~OutputDDToDDL() override
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddToken_
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
OutputDDToDDL(const edm::ParameterSet &iConfig)
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > & attachedSpecifics(void) const
adj_list::const_iterator const_adj_iterator
const Graph & graph() const
Provides read-only access to the data structure of the compact-view.