49 void addToMatStore(
const DDMaterial& mat, std::set<DDMaterial> & matStore );
50 void addToSolStore(
const DDSolid& sol, std::set<DDSolid> & solStore, std::set<DDRotation>& rotStore );
61 if( sv1.size() < sv2.size())
return true;
62 if( sv2.size() < sv1.size())
return false;
65 for( ; ind < sv1.size(); ++ind ) {
66 if ( sv1[ind].
first < sv2[ind].
first )
return true;
67 if ( sv2[ind].first < sv1[ind].first )
return false;
69 if ( sv2[ind].second < sv1[ind].second )
return false;
82 m_xos =
new std::ofstream( m_fname.c_str());
84 (*m_xos) <<
"<?xml version=\"1.0\"?>" << std::endl;
85 (*m_xos) <<
"<DDDefinition xmlns=\"http://www.cern.ch/cms/DDL\"" << std::endl;
86 (*m_xos) <<
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" << std::endl;
87 (*m_xos) <<
"xsi:schemaLocation=\"http://www.cern.ch/cms/DDL ../../../DetectorDescription/Schema/DDLSchema.xsd\">" << std::endl;
88 (*m_xos) <<
std::fixed << std::setprecision(18);
93 (*m_xos) <<
"</DDDefinition>" << std::endl;
94 (*m_xos) << std::endl;
101 std::cout <<
"OutputDDToDDL::beginRun" << std::endl;
106 DDCompactView::DDCompactView::graph_type gra = pDD->
graph();
108 std::set<DDLogicalPart> lpStore;
109 std::set<DDMaterial> matStore;
110 std::set<DDSolid> solStore;
114 std::map<const DDsvalues_type, std::set<const DDPartSelection*>, ddsvaluesCmp > specStore;
115 std::set<DDRotation> rotStore;
120 size_t foundLastDot = rn.find_last_of(
'.');
121 size_t foundLastSlash = rn.find_last_of(
'/');
122 if( foundLastSlash > foundLastDot && foundLastSlash != std::string::npos ) {
123 std::cout <<
"What? last . before last / in path for filename... this should die..." << std::endl;
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);
130 std::cout <<
"What? no file name? Attempt at namespace =\"" << out.
ns_ <<
"\" filename was " <<
m_fname << std::endl;
135 (*m_xos) <<
std::fixed << std::setprecision(18);
138 adjl_iterator git = gra.begin();
139 adjl_iterator gend = gra.end();
142 (*m_xos) <<
"<PosPartSection label=\"" << ns_ <<
"\">" << std::endl;
144 for( ; git != gend; ++git ) {
146 if( lpStore.find( ddLP ) != lpStore.end()) {
149 lpStore.insert( ddLP );
155 DDCompactView::graph_type::edge_list::const_iterator cit = git->begin();
156 DDCompactView::graph_type::edge_list::const_iterator cend = git->end();
157 for( ; cit != cend; ++cit ) {
159 if( lpStore.find( ddcurLP ) != lpStore.end()) {
162 lpStore.insert( ddcurLP );
165 rotStore.insert( gra.edgeData( cit->second )->rot_ );
171 (*m_xos) <<
"</PosPartSection>" << std::endl;
173 (*m_xos) << std::scientific << std::setprecision(18);
175 (*m_xos) <<
"<MaterialSection label=\"" << ns_ <<
"\">" << std::endl;
176 for(
auto it : matStore ) {
177 if( ! it.isDefined().second )
continue;
180 (*m_xos) <<
"</MaterialSection>" << std::endl;
181 (*m_xos) <<
"<RotationSection label=\"" << ns_ <<
"\">" << std::endl;
182 (*m_xos) <<
std::fixed << std::setprecision(18);
183 std::set<DDRotation>::iterator rit( rotStore.begin()),
red( rotStore.end());
184 for( ; rit !=
red; ++rit ) {
185 if( !rit->isDefined().second )
continue;
186 if( rit->toString() !=
":" ) {
191 (*m_xos) <<
"</RotationSection>" << std::endl;
193 (*m_xos) <<
std::fixed << std::setprecision(18);
194 std::set<DDSolid>::const_iterator sit( solStore.begin()), sed( solStore.end());
195 (*m_xos) <<
"<SolidSection label=\"" << ns_ <<
"\">" << std::endl;
196 for( ; sit != sed; ++sit ) {
197 if( !sit->isDefined().second)
continue;
200 (*m_xos) <<
"</SolidSection>" << std::endl;
202 std::set<DDLogicalPart>::iterator lpit( lpStore.begin()), lped( lpStore.end());
203 (*m_xos) <<
"<LogicalPartSection label=\"" << ns_ <<
"\">" << std::endl;
204 for( ; lpit != lped; ++lpit ) {
205 if( !lpit->isDefined().first )
continue;
209 (*m_xos) <<
"</LogicalPartSection>" << std::endl;
211 (*m_xos) <<
std::fixed << std::setprecision(18);
212 std::map<DDsvalues_type, std::set<const DDPartSelection*> >::const_iterator mit( specStore.begin()), mend( specStore.end());
213 (*m_xos) <<
"<SpecParSection label=\"" << ns_ <<
"\">" << std::endl;
214 for( ; mit != mend; ++mit ) {
217 (*m_xos) <<
"</SpecParSection>" << std::endl;
223 matStore.insert( mat );
227 if( matStore.find( mat.
constituent( findex ).first) == matStore.end()) {
238 solStore.insert(sol);
241 if( solStore.find( bs.
solidA()) == solStore.end()) {
244 if( solStore.find( bs.
solidB()) == solStore.end()) {
251 for(
auto it : ms.
solids())
252 if( solStore.find(it) == solStore.end()) {
256 rotStore.insert( it );
265 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
const std::vector< DDRotation > & rotations(void) 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)
const std::vector< DDSolid > & solids(void) const
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)
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
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 analyze(edm::Event const &iEvent, edm::EventSetup const &) override
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
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
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.