CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/DetectorDescription/RegressionTest/src/DDExpandedViewDump.cc

Go to the documentation of this file.
00001 namespace std { } using namespace std;
00002 #include <sstream>
00003 #include <cstdlib>
00004 #include <set>
00005 #include <algorithm>
00006 #include <string>
00007 #include "DetectorDescription/RegressionTest/interface/DDExpandedViewDump.h"
00008 
00009 void DDExpandedViewDump(ostream & os, DDExpandedView & ex, size_t skip, size_t sto)
00010 {
00011   typedef set<string>::iterator s_iter;
00012   set<string> result;
00013   bool go(true);
00014   int  count(0);
00015   bool dotrans(true);
00016   if (getenv("DDNOTRANS")) dotrans=false;
00017   ++skip;
00018   while(go) {
00019     if ((count % 5000)==0) cout << count << ' ' << flush;
00020     if (sto > 0) if ((count % sto)==0) break;
00021     ++count;
00022     if((count % skip) ==0){
00023       stringstream s;
00024       s.setf(ios_base::fixed,ios_base::floatfield);
00025       s.precision(2);
00026       s << ex.logicalPart().name() << ' '
00027         << ex.copyno() << ' ' 
00028         << ex.geoHistory() << " r="
00029         << ex.geoHistory().back().posdata()->rot_.name() << "\n"; 
00030       DDRotationMatrix rm = ex.rotation();
00031       {
00032         double v[9]; rm.GetComponents(v,v+9);
00033         s << "R=(";
00034         s << v[0] << ' ' << v[1] << ' ' << v[2] << endl;
00035         s << v[3] << ' ' << v[4] << ' ' << v[5] << endl;
00036         s << v[6] << ' ' << v[7] << ' ' << v[7] << endl;
00037       }
00038       rm = ex.geoHistory().back().posdata()->rotation();
00039       {
00040         double v[9]; rm.GetComponents(v,v+9);
00041         s << "r=(";
00042         s << v[0] << ' ' << v[1] << ' ' << v[2] << endl;
00043         s << v[3] << ' ' << v[4] << ' ' << v[5] << endl;
00044         s << v[6] << ' ' << v[7] << ' ' << v[7] << endl;
00045       }
00046       if (dotrans) {
00047         s << "T=("
00048           << ex.translation().x() << ','
00049           << ex.translation().y() << ','
00050           << ex.translation().z() << ") "
00051           ;
00052       }      
00053       pair<s_iter,bool> ins = result.insert(s.str());
00054       if(!ins.second) {
00055         cout << "DDExpandedViewDump:ERROR: duplicated=" << s.str() << endl;
00056       } 
00057     }
00058     go = ex.next();
00059   }
00060   s_iter it(result.begin()), ed(result.end());
00061   for(;it != ed;++it) {
00062     os << *it << endl;
00063   }
00064 }