48 void addToSolStore(
const DDSolid& sol, std::set<DDSolid> & solStore, std::set<DDRotation>& rotStore );
59 if( sv1.size() < sv2.size())
return true;
60 if( sv2.size() < sv1.size())
return false;
62 for( ; ind < sv1.size(); ++ind )
64 if( sv1[ ind ].
first < sv2[ ind ].
first )
return true;
65 if( sv2[ ind ].first < sv1[ ind ].first )
return false;
67 if( sv2[ ind ].second < sv1[ ind ].second )
return false;
83 m_xos =
new std::ofstream( m_fname.c_str());
86 ( *m_xos ) <<
"<?xml version=\"1.0\"?>\n";
87 ( *m_xos ) <<
"<DDDefinition xmlns=\"http://www.cern.ch/cms/DDL\"\n";
88 ( *m_xos ) <<
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
89 ( *m_xos ) <<
"xsi:schemaLocation=\"http://www.cern.ch/cms/DDL ../../../DetectorDescription/Schema/DDLSchema.xsd\">\n";
90 ( *m_xos ) << std::fixed << std::setprecision( 18 );
95 ( *m_xos ) <<
"</DDDefinition>\n";
96 ( *m_xos ) << std::endl;
103 edm::LogInfo(
"OutputMagneticFieldDDToDDL" ) <<
"OutputMagneticFieldDDToDDL::beginRun";
108 DDCompactView::DDCompactView::graph_type gra = pDD->graph();
111 std::set<DDLogicalPart> lpStore;
112 std::set<DDMaterial> matStore;
113 std::set<DDSolid> solStore;
115 std::map<const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp > specStore;
116 std::set<DDRotation> rotStore;
121 size_t foundLastDot= rn.find_last_of(
'.');
122 size_t foundLastSlash= rn.find_last_of(
'/');
124 if( foundLastSlash > foundLastDot && foundLastSlash != std::string::npos )
126 edm::LogError(
"OutputMagneticFieldDDToDDL" ) <<
"What? last . before last / in path for filename... this should die...";
128 if( foundLastDot != std::string::npos && foundLastSlash != std::string::npos )
130 out.
ns_ = rn.substr( foundLastSlash, foundLastDot );
132 else if ( foundLastDot != std::string::npos )
134 out.
ns_ = rn.substr(0, foundLastDot);
138 edm::LogError(
"OutputMagneticFieldDDToDDL" ) <<
"What? no file name? Attempt at namespace =\"" << out.
ns_ <<
"\" filename was " <<
m_fname;
144 ( *m_xos ) << std::fixed << std::setprecision( 18 );
148 adjl_iterator git = gra.begin();
149 adjl_iterator gend = gra.end();
152 ( *m_xos) <<
"<PosPartSection label=\"" << ns_ <<
"\">\n";
154 for( ; git != gend; ++git )
157 if( lpStore.find(ddLP) != lpStore.end())
161 lpStore.insert( ddLP );
168 DDCompactView::graph_type::edge_list::const_iterator cit = git->begin();
169 DDCompactView::graph_type::edge_list::const_iterator cend = git->end();
170 for( ; cit != cend; ++cit )
173 if( lpStore.find(ddcurLP) != lpStore.end())
177 lpStore.insert( ddcurLP );
180 rotStore.insert( gra.edgeData( cit->second )->rot_ );
186 ( *m_xos ) <<
"</PosPartSection>\n";
188 ( *m_xos ) << std::scientific << std::setprecision( 18 );
189 std::set<DDMaterial>::const_iterator it( matStore.begin()), ed( matStore.end());
190 ( *m_xos) <<
"<MaterialSection label=\"" << ns_ <<
"\">\n";
191 for( ; it != ed; ++it )
193 if( ! it->isDefined().second )
continue;
196 ( *m_xos ) <<
"</MaterialSection>\n";
198 ( *m_xos ) <<
"<RotationSection label=\"" << ns_ <<
"\">\n";
199 ( *m_xos ) << std::fixed << std::setprecision( 18 );
200 std::set<DDRotation>::iterator rit( rotStore.begin()),
red( rotStore.end());
201 for( ; rit !=
red; ++rit )
203 if( ! rit->isDefined().second )
continue;
204 if( rit->toString() !=
":" )
210 ( *m_xos ) <<
"</RotationSection>\n";
212 ( *m_xos ) << std::fixed << std::setprecision( 18 );
213 std::set<DDSolid>::const_iterator sit( solStore.begin()), sed( solStore.end());
214 ( *m_xos ) <<
"<SolidSection label=\"" << ns_ <<
"\">\n";
215 for( ; sit != sed; ++sit)
217 if( ! sit->isDefined().second )
continue;
220 ( *m_xos ) <<
"</SolidSection>\n";
222 std::set<DDLogicalPart>::iterator lpit( lpStore.begin()), lped( lpStore.end());
223 ( *m_xos ) <<
"<LogicalPartSection label=\"" << ns_ <<
"\">\n";
224 for( ; lpit != lped; ++lpit )
226 if( ! lpit->isDefined().first )
continue;
230 ( *m_xos ) <<
"</LogicalPartSection>\n";
232 ( *m_xos ) << std::fixed << std::setprecision( 18 );
233 std::map<DDsvalues_type, std::set<const DDPartSelection*> >::const_iterator mit( specStore.begin()), mend( specStore.end());
234 ( *m_xos ) <<
"<SpecParSection label=\"" << ns_ <<
"\">\n";
235 for( ; mit != mend; ++mit )
239 ( *m_xos ) <<
"</SpecParSection>\n";
245 matStore.insert( mat );
252 if( matStore.find( mat.
constituent( findex ).first ) == matStore.end())
264 solStore.insert( sol );
268 if( solStore.find(bs.
solidA()) == solStore.end())
272 if( solStore.find( bs.
solidB()) == solStore.end())
282 std::map<
const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp > & specStore )
285 for( ; spit != spend; ++spit )
287 specStore[ *spit->second ].insert( spit->first );
T getParameter(std::string const &) const
void addToSpecStore(const DDLogicalPart &lp, std::map< const DDsvalues_type, std::set< const DDPartSelection * >, ddsvaluesCmp > &specStore)
T getUntrackedParameter(std::string const &, T const &) const
void rotation(DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
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.
std::vector< double >::size_type index_type
~OutputMagneticFieldDDToDDL(void)
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
Container::value_type value_type
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 addToSolStore(const DDSolid &sol, std::set< DDSolid > &solStore, std::set< DDRotation > &rotStore)
void logicalPart(const DDLogicalPart &lp, std::ostream &xos)
DDSolid solidA(void) const
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
OutputMagneticFieldDDToDDL(const edm::ParameterSet &iConfig)
adj_list::const_iterator const_adj_iterator
void material(const DDMaterial &material, std::ostream &xos)
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
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.