CMS 3D CMS Logo

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 12 of file GeometryInfoDump.h.

Constructor & Destructor Documentation

◆ GeometryInfoDump()

GeometryInfoDump::GeometryInfoDump ( )

Definition at line 21 of file GeometryInfoDump.cc.

21 {}

◆ ~GeometryInfoDump()

GeometryInfoDump::~GeometryInfoDump ( )

Definition at line 23 of file GeometryInfoDump.cc.

23 {}

Member Function Documentation

◆ dumpInfo()

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

Definition at line 25 of file GeometryInfoDump.cc.

26  {
27  fname = "dump" + fname;
28  DDExpandedView epv(cpv);
29  std::cout << "Top Most LogicalPart =" << epv.logicalPart() << std::endl;
30  if (dumpHistory || dumpPosInfo) {
31  if (dumpPosInfo) {
32  std::cout << "After the GeoHistory in the output file dumpGeoHistoryOnRead you will see x, y, z, r11, r12, r13, "
33  "r21, r22, r23, r31, r32, r33"
34  << std::endl;
35  }
36  typedef DDExpandedView::nav_type nav_type;
37  typedef std::map<nav_type, int> id_type;
38  id_type idMap;
39  int id = 0;
40  std::ofstream dump(fname.c_str());
41  bool notReachedDepth(true);
42  char buf[256];
43 
44  do {
45  nav_type pos = epv.navPos();
46  idMap[pos] = id;
47  // dump << id
48  dump << " - " << epv.geoHistory();
49  DD3Vector x, y, z;
50  epv.rotation().GetComponents(x, y, z);
51  if (dumpPosInfo) {
52  size_t s = snprintf(buf,
53  256,
54  ",%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f,%12.4f",
55  epv.translation().x(),
56  epv.translation().y(),
57  epv.translation().z(),
58  x.X(),
59  y.X(),
60  z.X(),
61  x.Y(),
62  y.Y(),
63  z.Y(),
64  x.Z(),
65  y.Z(),
66  z.Z());
67  assert(s < 256);
68  dump << buf;
69  }
70  dump << "\n";
71  ;
72  ++id;
73  if (nVols != 0 && id > nVols)
74  notReachedDepth = false;
75  } while (epv.next() && notReachedDepth);
76  dump << std::flush;
77  dump.close();
78  }
79  if (dumpSpecs) {
80  // dump specifics at every compact-view nodes to have the most detailed "true"
81  // final destination of the DDSpecifics
82  std::string dsname = "dumpSpecs" + fname;
83  std::ofstream dump(dsname.c_str());
84  const auto& gra = cpv.graph();
85  std::set<DDLogicalPart> lpStore;
86  adjl_iterator git = gra.begin();
87  adjl_iterator gend = gra.end();
88  Graph::index_type i = 0;
89  for (; git != gend; ++git) {
90  const DDLogicalPart& ddLP = gra.nodeData(git);
91  if (lpStore.find(ddLP) != lpStore.end() && !ddLP.attachedSpecifics().empty()) {
92  dump << ddLP.toString() << ": ";
94  }
95  lpStore.insert(ddLP);
96 
97  ++i;
98  if (!git->empty()) {
99  // ask for children of ddLP
100  for (const auto& cit : *git) {
101  const DDLogicalPart& ddcurLP = gra.nodeData(cit.first);
102  if (lpStore.find(ddcurLP) != lpStore.end() && !ddcurLP.attachedSpecifics().empty()) {
103  dump << ddcurLP.toString() << ": ";
104  dumpSpec(ddcurLP.attachedSpecifics(), dump);
105  }
106  lpStore.insert(ddcurLP);
107  } // iterate over children
108  } // if (children)
109  } // iterate over graph nodes
110  dump.close();
111  }
112 }

References cms::cuda::assert(), DDLogicalPart::attachedSpecifics(), math::Graph< N, E >::begin(), visDQMUpload::buf, gather_cfg::cout, FrontierConditions_GlobalTag_cff::dump, dumpSpec(), alignmentValidation::fname, DDExpandedView::geoHistory(), DDCompactView::graph(), mps_fire::i, triggerObjects_cff::id, DDExpandedView::logicalPart(), DDExpandedView::navPos(), DDExpandedView::next(), DDExpandedView::rotation(), alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, DDBase< N, C >::toString(), DDExpandedView::translation(), x, y, and z.

◆ dumpSpec()

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

Definition at line 114 of file GeometryInfoDump.cc.

115  {
116  std::vector<std::pair<const DDPartSelection*, const DDsvalues_type*> >::const_iterator bit(attspec.begin()),
117  eit(attspec.end());
118  for (; bit != eit; ++bit) {
119  // DDPartSelection is a std::vector<DDPartSelectionLevel>
120  std::vector<DDPartSelectionLevel>::const_iterator psit(bit->first->begin()), pseit(bit->first->end());
121  for (; psit != pseit; ++psit) {
122  switch (psit->selectionType_) {
123  case ddunknown:
124  throw cms::Exception("DetectorDescriptionSpecPar") << "Can not have an unknown selection type!";
125  break;
126  case ddanynode:
127  dump << "//*";
128  break;
129  case ddanychild:
130  dump << "/*";
131  break;
132  case ddanylogp:
133  dump << "//" << psit->lp_.toString();
134  break;
135  case ddanyposp:
136  dump << "//" << psit->lp_.toString() << "[" << psit->copyno_ << "]";
137  break;
138  case ddchildlogp:
139  dump << "/" << psit->lp_.toString();
140  break;
141  case ddchildposp:
142  dump << "/" << psit->lp_.toString() << "[" << psit->copyno_ << "]";
143  break;
144  default:
145  throw cms::Exception("DetectorDescriptionSpecPar")
146  << "Can not end up here! default of switch on selectionTyp_";
147  }
148  }
149  dump << " ";
150  // DDsvalues_type is typedef std::vector< std::pair<unsigned int, DDValue> > DDsvalues_type;
151  DDsvalues_type::const_iterator bsit(bit->second->begin()), bseit(bit->second->end());
152  for (; bsit != bseit; ++bsit) {
153  dump << bsit->second.name() << " ";
154  dump << (bsit->second.isEvaluated() ? "eval " : "NOT eval ");
155  size_t sdind(0);
156  for (; sdind != bsit->second.strings().size(); ++sdind) {
157  if (bsit->second.isEvaluated()) {
158  dump << bsit->second.doubles()[sdind];
159  } else {
160  dump << bsit->second.strings()[sdind];
161  }
162  if (sdind != bsit->second.strings().size() - 1)
163  dump << ", ";
164  }
165  if (!bsit->second.strings().empty() && bsit + 1 != bseit)
166  dump << " | ";
167  }
168  if (!bit->second->empty() && bit + 1 != eit)
169  dump << " | ";
170  }
171  dump << std::endl;
172 }

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

Referenced by dumpInfo().

ddanychild
Definition: DDPartSelection.h:14
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
ddanyposp
Definition: DDPartSelection.h:16
DDExpandedView::nav_type
std::vector< int > nav_type
std::vector of sibling numbers
Definition: DDExpandedView.h:48
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
cms::cuda::assert
assert(be >=bs)
ddunknown
Definition: DDPartSelection.h:12
DDAxes::x
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DDCompactView::graph
const Graph & graph() const
Provides read-only access to the data structure of the compact-view.
Definition: DDCompactView.cc:58
ddchildposp
Definition: DDPartSelection.h:18
DDBase::toString
std::string toString() const
Definition: DDBase.h:63
adjl_iterator
Graph::const_adj_iterator adjl_iterator
Definition: GeometryInfoDump.cc:19
DDAxes::z
DDExpandedView
Provides an exploded view of the detector (tree-view)
Definition: DDExpandedView.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
FrontierConditions_GlobalTag_cff.dump
dump
Definition: FrontierConditions_GlobalTag_cff.py:12
ddanynode
Definition: DDPartSelection.h:13
ddanylogp
Definition: DDPartSelection.h:15
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
math::Graph::begin
adj_iterator begin()
Definition: Graph.h:172
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
math::Graph< DDLogicalPart, DDPosData * >::index_type
std::vector< double >::size_type index_type
Definition: Graph.h:15
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Exception
Definition: hltDiff.cc:246
DDLogicalPart::attachedSpecifics
const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > & attachedSpecifics(void) const
Definition: DDLogicalPart.cc:340
ddchildlogp
Definition: DDPartSelection.h:17
GeometryInfoDump::dumpSpec
void dumpSpec(const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > &attspec, std::ostream &dump)
Definition: GeometryInfoDump.cc:114