File indexing completed on 2024-04-06 12:05:34
0001 #include <cstdlib>
0002 #include <iostream>
0003 #include <memory>
0004 #include <set>
0005 #include <string>
0006 #include <utility>
0007
0008 #include "DetectorDescription/Core/interface/DDRotationMatrix.h"
0009 #include "DetectorDescription/Core/interface/DDTranslation.h"
0010 #include "DetectorDescription/Core/interface/DDExpandedNode.h"
0011 #include "DetectorDescription/Core/interface/DDExpandedView.h"
0012 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0013 #include "DetectorDescription/Core/interface/DDName.h"
0014 #include "DetectorDescription/Core/interface/DDPosData.h"
0015 #include "DetectorDescription/Core/interface/DDTransform.h"
0016
0017 using namespace std;
0018
0019 void DDExpandedViewDump(ostream& os, DDExpandedView& ex, size_t skip, size_t sto) {
0020 typedef set<string>::iterator s_iter;
0021 set<string> result;
0022 bool go(true);
0023 int count(0);
0024 bool dotrans(true);
0025 if (std::getenv("DDNOTRANS"))
0026 dotrans = false;
0027 ++skip;
0028 while (go) {
0029 if ((count % 5000) == 0)
0030 cout << count << ' ' << flush;
0031 if (sto > 0)
0032 if ((count % sto) == 0)
0033 break;
0034 ++count;
0035 if ((count % skip) == 0) {
0036 stringstream s;
0037 s.setf(ios_base::fixed, ios_base::floatfield);
0038 s.precision(2);
0039 s << ex.logicalPart().name() << ' ' << ex.copyno() << ' ' << ex.geoHistory()
0040 << " r=" << ex.geoHistory().back().posdata()->ddrot().name() << "\n";
0041 DDRotationMatrix rm = ex.rotation();
0042 {
0043 double v[9];
0044 rm.GetComponents(v, v + 9);
0045 s << "R=(";
0046 s << v[0] << ' ' << v[1] << ' ' << v[2] << endl;
0047 s << v[3] << ' ' << v[4] << ' ' << v[5] << endl;
0048 s << v[6] << ' ' << v[7] << ' ' << v[7] << endl;
0049 }
0050 rm = ex.geoHistory().back().posdata()->rotation();
0051 {
0052 double v[9];
0053 rm.GetComponents(v, v + 9);
0054 s << "r=(";
0055 s << v[0] << ' ' << v[1] << ' ' << v[2] << endl;
0056 s << v[3] << ' ' << v[4] << ' ' << v[5] << endl;
0057 s << v[6] << ' ' << v[7] << ' ' << v[7] << endl;
0058 }
0059 if (dotrans) {
0060 s << "T=(" << ex.translation().x() << ',' << ex.translation().y() << ',' << ex.translation().z() << ") ";
0061 }
0062 pair<s_iter, bool> ins = result.insert(s.str());
0063 if (!ins.second) {
0064 cout << "DDExpandedViewDump:ERROR: duplicated=" << s.str() << endl;
0065 }
0066 }
0067 go = ex.next();
0068 }
0069 s_iter it(result.begin()), ed(result.end());
0070 for (; it != ed; ++it) {
0071 os << *it << endl;
0072 }
0073 }