CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions
GeometryInfoDump Class Reference

#include <GeometryInfoDump.h>

Public Member Functions

void dumpInfo (bool dumpHistory, bool dumpSpecs, bool dumpPosInfo, const DDCompactView &cpv, std::string fname="GeoHistory", int nVols=0)
 
 GeometryInfoDump ()
 
 ~GeometryInfoDump ()
 

Private Member Functions

void dumpSpec (const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > &attspec, std::ostream &dump)
 

Detailed Description

Definition at line 4 of file GeometryInfoDump.h.

Constructor & Destructor Documentation

GeometryInfoDump::GeometryInfoDump ( )

Definition at line 17 of file GeometryInfoDump.cc.

17 { }
GeometryInfoDump::~GeometryInfoDump ( )

Definition at line 19 of file GeometryInfoDump.cc.

19 { }

Member Function Documentation

void GeometryInfoDump::dumpInfo ( bool  dumpHistory,
bool  dumpSpecs,
bool  dumpPosInfo,
const DDCompactView cpv,
std::string  fname = "GeoHistory",
int  nVols = 0 
)

Definition at line 22 of file GeometryInfoDump.cc.

References assert(), DDLogicalPart::attachedSpecifics(), graph< N, E >::begin(), gather_cfg::cout, hcal_timing_source_file_cfg::dump, dumpSpec(), alignmentValidation::fname, DDExpandedView::geoHistory(), DDCompactView::graph(), i, DDExpandedView::logicalPart(), DDExpandedView::navPos(), DDExpandedView::next(), DDExpandedView::rotation(), alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, DDBase< N, C >::toString(), DDExpandedView::translation(), x, y, and z.

23  {
24  fname = "dump" + fname;
25  DDExpandedView epv(cpv);
26  std::cout << "Top Most LogicalPart =" << epv.logicalPart() << std::endl;
27  if ( dumpHistory || dumpPosInfo) {
28  if ( dumpPosInfo ) {
29  std::cout << "After the GeoHistory in the output file dumpGeoHistoryOnRead you will see x, y, z, r11, r12, r13, r21, r22, r23, r31, r32, r33" << std::endl;
30  }
31  typedef DDExpandedView::nav_type nav_type;
32  typedef std::map<nav_type,int> id_type;
33  id_type idMap;
34  int id=0;
35  std::ofstream dump(fname.c_str());
36  bool notReachedDepth(true);
37  char buf[256];
38 
39  do {
40  nav_type pos = epv.navPos();
41  idMap[pos]=id;
42  // dump << id
43  dump << " - " << epv.geoHistory();
44  DD3Vector x, y, z;
45  epv.rotation().GetComponents(x,y,z);
46  if ( dumpPosInfo ) {
47  size_t s = snprintf(buf, 256, ",%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f",
48  epv.translation().x(), epv.translation().y(), epv.translation().z(),
49  x.X(), y.X(), z.X(),
50  x.Y(), y.Y(), z.Y(),
51  x.Z(), y.Z(), z.Z());
52  assert(s < 256);
53  dump << buf;
54  }
55  dump << "\n";;
56  ++id;
57  if ( nVols != 0 && id > nVols ) notReachedDepth = false;
58  } while (epv.next() && notReachedDepth);
59  dump << std::flush;
60  dump.close();
61  }
62  if ( dumpSpecs ) {
63  // dump specifics at every compact-view nodes to have the most detailed "true"
64  // final destination of the DDSpecifics
65  std::string dsname = "dumpSpecs" + fname;
66  std::ofstream dump(dsname.c_str());
67  DDCompactView::DDCompactView::graph_type gra = cpv.graph();
68  std::set<DDLogicalPart> lpStore;
70  adjl_iterator git = gra.begin();
71  adjl_iterator gend = gra.end();
73  for (; git != gend; ++git)
74  {
75  const DDLogicalPart & ddLP = gra.nodeData(git);
76  if ( lpStore.find(ddLP) != lpStore.end() && ddLP.attachedSpecifics().size() != 0 ) {
77  dump << ddLP.toString() << ": ";
78  dumpSpec( ddLP.attachedSpecifics(), dump );
79  }
80  lpStore.insert(ddLP);
81 
82  ++i;
83  if (git->size())
84  {
85  // ask for children of ddLP
86  for( const auto& cit : *git )
87  {
88  const DDLogicalPart & ddcurLP = gra.nodeData(cit.first);
89  if (lpStore.find(ddcurLP) != lpStore.end() && ddcurLP.attachedSpecifics().size() != 0 ) {
90  dump << ddcurLP.toString() << ": ";
91  dumpSpec( ddcurLP.attachedSpecifics(), dump );
92  }
93  lpStore.insert(ddcurLP);
94  } // iterate over children
95  } // if (children)
96  } // iterate over graph nodes
97  dump.close();
98  }
99  }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
std::vector< double >::size_type index_type
Definition: adjgraph.h:15
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
void dumpSpec(const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > &attspec, std::ostream &dump)
std::string toString() const
Definition: DDBase.h:82
adj_list::const_iterator const_adj_iterator
Definition: adjgraph.h:125
string fname
main script
tuple cout
Definition: gather_cfg.py:145
adj_iterator begin()
Definition: adjgraph.h:197
const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > & attachedSpecifics(void) const
Provides an exploded view of the detector (tree-view)
std::vector< int > nav_type
std::vector of sibling numbers
void GeometryInfoDump::dumpSpec ( const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > &  attspec,
std::ostream &  dump 
)
private

Definition at line 101 of file GeometryInfoDump.cc.

References ddanychild, ddanylogp, ddanynode, ddanyposp, ddchildlogp, ddchildposp, ddunknown, and Exception.

Referenced by dumpInfo().

101  {
102  std::vector<std::pair< const DDPartSelection*, const DDsvalues_type*> >::const_iterator bit(attspec.begin()), eit(attspec.end());
103  for( ; bit != eit; ++bit ) {
104  // DDPartSelection is a std::vector<DDPartSelectionLevel>
105  std::vector<DDPartSelectionLevel>::const_iterator psit(bit->first->begin()), pseit(bit->first->end());
106  for ( ; psit != pseit; ++psit ) {
107  switch ( psit->selectionType_ ) {
108  case ddunknown:
109  throw cms::Exception("DetectorDescriptionSpecPar") << "Can not have an unknown selection type!";
110  break;
111  case ddanynode:
112  dump << "//*";
113  break;
114  case ddanychild:
115  dump << "/*";
116  break;
117  case ddanylogp:
118  dump << "//" << psit->lp_.toString();
119  break;
120  case ddanyposp:
121  dump << "//" << psit->lp_.toString() << "[" << psit->copyno_ << "]" ;
122  break;
123  case ddchildlogp:
124  dump << "/" << psit->lp_.toString();
125  break;
126  case ddchildposp:
127  dump << "/" << psit->lp_.toString() << "[" << psit->copyno_ << "]" ;
128  break;
129  default:
130  throw cms::Exception("DetectorDescriptionSpecPar") << "Can not end up here! default of switch on selectionTyp_";
131  }
132  }
133  dump << " ";
134  // DDsvalues_type is typedef std::vector< std::pair<unsigned int, DDValue> > DDsvalues_type;
135  DDsvalues_type::const_iterator bsit(bit->second->begin()), bseit(bit->second->end());
136  for( ; bsit != bseit; ++bsit ) {
137  dump << bsit->second.name() << " ";
138  dump << ( bsit->second.isEvaluated() ? "eval " : "NOT eval " );
139  size_t sdind(0);
140  for ( ; sdind != bsit->second.strings().size() ; ++sdind ) {
141  if (bsit->second.isEvaluated()) {
142  dump << bsit->second.doubles()[sdind] ;
143  } else {
144  dump << bsit->second.strings()[sdind] ;
145  }
146  if (sdind != bsit->second.strings().size() - 1) dump << ", ";
147  }
148  if ( bsit->second.strings().size() > 0 && bsit + 1 != bseit ) dump << " | ";
149  }
150  if ( bit->second->size() > 0 && bit + 1 != eit) dump << " | ";
151  }
152  dump << std::endl;
153 }