CMS 3D CMS Logo

DDExpandedViewDump.cc
Go to the documentation of this file.
1 #include <cstdlib>
2 #include <iostream>
3 #include <memory>
4 #include <set>
5 #include <string>
6 #include <utility>
7 
16 
17 using namespace std;
18 
19 void DDExpandedViewDump(ostream & os, DDExpandedView & ex, size_t skip, size_t sto)
20 {
21  typedef set<string>::iterator s_iter;
22  set<string> result;
23  bool go(true);
24  int count(0);
25  bool dotrans(true);
26  if (getenv("DDNOTRANS")) dotrans=false;
27  ++skip;
28  while(go) {
29  if ((count % 5000)==0) cout << count << ' ' << flush;
30  if (sto > 0) if ((count % sto)==0) break;
31  ++count;
32  if((count % skip) ==0){
33  stringstream s;
34  s.setf(ios_base::fixed,ios_base::floatfield);
35  s.precision(2);
36  s << ex.logicalPart().name() << ' '
37  << ex.copyno() << ' '
38  << ex.geoHistory() << " r="
39  << ex.geoHistory().back().posdata()->ddrot().name() << "\n";
41  {
42  double v[9]; rm.GetComponents(v,v+9);
43  s << "R=(";
44  s << v[0] << ' ' << v[1] << ' ' << v[2] << endl;
45  s << v[3] << ' ' << v[4] << ' ' << v[5] << endl;
46  s << v[6] << ' ' << v[7] << ' ' << v[7] << endl;
47  }
48  rm = ex.geoHistory().back().posdata()->rotation();
49  {
50  double v[9]; rm.GetComponents(v,v+9);
51  s << "r=(";
52  s << v[0] << ' ' << v[1] << ' ' << v[2] << endl;
53  s << v[3] << ' ' << v[4] << ' ' << v[5] << endl;
54  s << v[6] << ' ' << v[7] << ' ' << v[7] << endl;
55  }
56  if (dotrans) {
57  s << "T=("
58  << ex.translation().x() << ','
59  << ex.translation().y() << ','
60  << ex.translation().z() << ") "
61  ;
62  }
63  pair<s_iter,bool> ins = result.insert(s.str());
64  if(!ins.second) {
65  cout << "DDExpandedViewDump:ERROR: duplicated=" << s.str() << endl;
66  }
67  }
68  go = ex.next();
69  }
70  s_iter it(result.begin()), ed(result.end());
71  for(;it != ed;++it) {
72  os << *it << endl;
73  }
74 }
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.