CMS 3D CMS Logo

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