CMS 3D CMS Logo

DDExpandedViewDump.cc
Go to the documentation of this file.
1 namespace std { } using namespace std;
2 #include <cstdlib>
3 #include <iostream>
4 #include <memory>
5 #include <set>
6 #include <string>
7 #include <utility>
8 
17 
18 void DDExpandedViewDump(ostream & os, DDExpandedView & ex, size_t skip, size_t sto)
19 {
20  typedef set<string>::iterator s_iter;
21  set<string> result;
22  bool go(true);
23  int count(0);
24  bool dotrans(true);
25  if (getenv("DDNOTRANS")) dotrans=false;
26  ++skip;
27  while(go) {
28  if ((count % 5000)==0) cout << count << ' ' << flush;
29  if (sto > 0) if ((count % sto)==0) break;
30  ++count;
31  if((count % skip) ==0){
32  stringstream s;
33  s.setf(ios_base::fixed,ios_base::floatfield);
34  s.precision(2);
35  s << ex.logicalPart().name() << ' '
36  << ex.copyno() << ' '
37  << ex.geoHistory() << " r="
38  << ex.geoHistory().back().posdata()->rot_.name() << "\n";
40  {
41  double v[9]; rm.GetComponents(v,v+9);
42  s << "R=(";
43  s << v[0] << ' ' << v[1] << ' ' << v[2] << endl;
44  s << v[3] << ' ' << v[4] << ' ' << v[5] << endl;
45  s << v[6] << ' ' << v[7] << ' ' << v[7] << endl;
46  }
47  rm = ex.geoHistory().back().posdata()->rotation();
48  {
49  double v[9]; rm.GetComponents(v,v+9);
50  s << "r=(";
51  s << v[0] << ' ' << v[1] << ' ' << v[2] << endl;
52  s << v[3] << ' ' << v[4] << ' ' << v[5] << endl;
53  s << v[6] << ' ' << v[7] << ' ' << v[7] << endl;
54  }
55  if (dotrans) {
56  s << "T=("
57  << ex.translation().x() << ','
58  << ex.translation().y() << ','
59  << ex.translation().z() << ") "
60  ;
61  }
62  pair<s_iter,bool> ins = result.insert(s.str());
63  if(!ins.second) {
64  cout << "DDExpandedViewDump:ERROR: duplicated=" << s.str() << endl;
65  }
66  }
67  go = ex.next();
68  }
69  s_iter it(result.begin()), ed(result.end());
70  for(;it != ed;++it) {
71  os << *it << endl;
72  }
73 }
void DDExpandedViewDump(ostream &os, DDExpandedView &ex, size_t skip, size_t sto)
bool next()
set current node to the next node in the expanded tree
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
const N & name() const
Definition: DDBase.h:78
ins
Definition: cuy.py:312
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
const DDTranslation & translation() const
The absolute translation of the current node.
int copyno() const
Copy number associated with the current node.
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the expanded-view.
rm
Definition: submit.py:76
Provides an exploded view of the detector (tree-view)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.