49 std::map<
const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp>& specStore);
58 if (sv1.size() < sv2.size())
60 if (sv2.size() < sv1.size())
63 for (; ind < sv1.size(); ++ind) {
66 if (sv2[ind].first < sv1[ind].first)
70 if (sv2[ind].second < sv1[ind].second)
79 if (m_fname.empty()) {
82 m_xos =
new std::ofstream(m_fname.c_str());
85 (*m_xos) <<
"<?xml version=\"1.0\"?>\n";
86 (*m_xos) <<
"<DDDefinition xmlns=\"http://www.cern.ch/cms/DDL\"\n";
87 (*m_xos) <<
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
88 (*m_xos) <<
"xsi:schemaLocation=\"http://www.cern.ch/cms/DDL ../../../DetectorDescription/Schema/DDLSchema.xsd\">\n";
89 (*m_xos) << std::fixed << std::setprecision(18);
91 ddToken_ = esConsumes<DDCompactView, IdealMagneticFieldRecord>();
95 (*m_xos) <<
"</DDDefinition>\n";
96 (*m_xos) << std::endl;
101 edm::LogInfo(
"OutputMagneticFieldDDToDDL") <<
"OutputMagneticFieldDDToDDL::beginRun";
105 const auto& gra = pDD->graph();
108 std::set<DDLogicalPart> lpStore;
109 std::set<DDMaterial> matStore;
110 std::set<DDSolid> solStore;
112 std::map<const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp> specStore;
113 std::set<DDRotation> rotStore;
118 size_t foundLastDot = rn.find_last_of(
'.');
119 size_t foundLastSlash = rn.find_last_of(
'/');
121 if (foundLastSlash > foundLastDot && foundLastSlash != std::string::npos) {
123 <<
"What? last . before last / in path for filename... this should die...";
125 if (foundLastDot != std::string::npos && foundLastSlash != std::string::npos) {
126 out.
ns_ = rn.substr(foundLastSlash, foundLastDot);
127 }
else if (foundLastDot != std::string::npos) {
128 out.
ns_ = rn.substr(0, foundLastDot);
131 <<
"What? no file name? Attempt at namespace =\"" << out.
ns_ <<
"\" filename was " <<
m_fname;
137 (*m_xos) << std::fixed << std::setprecision(18);
146 (*m_xos) <<
"<PosPartSection label=\"" << ns_ <<
"\">\n";
148 for (; git != gend; ++git) {
150 if (lpStore.find(ddLP) != lpStore.end()) {
153 lpStore.insert(ddLP);
159 auto cit = git->begin();
160 auto cend = git->end();
161 for (; cit != cend; ++cit) {
163 if (lpStore.find(ddcurLP) != lpStore.end()) {
166 lpStore.insert(ddcurLP);
169 rotStore.insert(gra.edgeData(cit->second)->ddrot());
175 (*m_xos) <<
"</PosPartSection>\n";
177 (*m_xos) << std::scientific << std::setprecision(18);
178 std::set<DDMaterial>::const_iterator it(matStore.begin()), ed(matStore.end());
179 (*m_xos) <<
"<MaterialSection label=\"" << ns_ <<
"\">\n";
180 for (; it != ed; ++it) {
181 if (!it->isDefined().second)
185 (*m_xos) <<
"</MaterialSection>\n";
187 (*m_xos) <<
"<RotationSection label=\"" << ns_ <<
"\">\n";
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>\n";
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_ <<
"\">\n";
203 for (; sit != sed; ++sit) {
204 if (!sit->isDefined().second)
208 (*m_xos) <<
"</SolidSection>\n";
210 std::set<DDLogicalPart>::iterator lpit(lpStore.begin()), lped(lpStore.end());
211 (*m_xos) <<
"<LogicalPartSection label=\"" << ns_ <<
"\">\n";
212 for (; lpit != lped; ++lpit) {
213 if (!lpit->isDefined().first)
218 (*m_xos) <<
"</LogicalPartSection>\n";
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_ <<
"\">\n";
224 for (; mit != mend; ++mit) {
227 (*m_xos) <<
"</SpecParSection>\n";
231 matStore.insert(mat);
236 if (matStore.find(mat.
constituent(findex).first) == matStore.end()) {
245 std::set<DDSolid>& solStore,
246 std::set<DDRotation>& rotStore) {
247 solStore.insert(sol);
251 if (solStore.find(bs.
solidA()) == solStore.end()) {
254 if (solStore.find(bs.
solidB()) == solStore.end()) {
263 std::map<
const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp>& specStore) {
264 std::vector<std::pair<const DDPartSelection*, const DDsvalues_type*> >::const_iterator spit(
267 for (; spit != spend; ++spit) {
268 specStore[*spit->second].insert(spit->first);
void addToSpecStore(const DDLogicalPart &lp, std::map< const DDsvalues_type, std::set< const DDPartSelection * >, ddsvaluesCmp > &specStore)
T getUntrackedParameter(std::string const &, T const &) const
math::Graph< DDLogicalPart, DDPosData * > Graph
edm::ESGetToken< DDCompactView, IdealMagneticFieldRecord > ddToken_
std::vector< double >::size_type index_type
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
DDMaterial is used to define and access material information.
#define DEFINE_FWK_MODULE(type)
void specpar(const DDSpecifics &sp, std::ostream &xos)
void addToMatStore(const DDMaterial &mat, std::set< DDMaterial > &matStore)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Log< level::Error, false > LogError
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)
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Container::value_type value_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 addToSolStore(const DDSolid &sol, std::set< DDSolid > &solStore, std::set< DDRotation > &rotStore)
void logicalPart(const DDLogicalPart &lp, std::ostream &xos)
Graph::const_adj_iterator adjl_iterator
~OutputMagneticFieldDDToDDL(void) override
DDSolid solidA(void) const
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
OutputMagneticFieldDDToDDL(const edm::ParameterSet &iConfig)
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
void material(const DDMaterial &material, std::ostream &xos)
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
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.