CMS 3D CMS Logo

GeometryInfoDump.cc

Go to the documentation of this file.
00001 #include <DetectorDescription/OfflineDBLoader/interface/GeometryInfoDump.h>
00002 
00003 #include <DetectorDescription/Core/interface/DDValue.h>
00004 #include <DetectorDescription/Core/interface/DDSpecifics.h>
00005 #include "DetectorDescription/Core/interface/DDName.h"
00006 
00007 
00008 #include <iostream>
00009 #include <fstream>
00010 
00011 // Need thes??? maybe 
00012 #include <cmath>
00013 #include <iomanip>
00014 #include <vector>
00015 #include <map>
00016 #include <sstream>
00017 
00018 GeometryInfoDump::GeometryInfoDump () { }
00019 
00020 GeometryInfoDump::~GeometryInfoDump () { }
00021   
00022 
00023 void GeometryInfoDump::dumpInfo ( bool dumpHistory, bool dumpSpecs, bool dumpPosInfo
00024                                   , const DDCompactView& cpv ) {
00025 
00026   DDExpandedView epv(cpv);
00027   std::cout << "Top Most LogicalPart =" << epv.logicalPart() << std::endl;
00028   if ( dumpHistory || dumpPosInfo) {
00029     if ( dumpPosInfo ) {
00030       std::cout << "After the GeoHistory in the output file dumpGeoHistoryOnRead you will see x, y, z, r11, r12, r13, r21, r22, r23, r31, r32, r33" << std::endl;
00031     }
00032     typedef DDExpandedView::nav_type nav_type;
00033     typedef std::map<nav_type,int> id_type;
00034     id_type idMap;
00035     int id=0;
00036     std::ofstream dump("dumpGeoHistory");
00037     do {
00038       nav_type pos = epv.navPos();
00039       idMap[pos]=id;
00040       dump << id << " - " << epv.geoHistory();
00041       DD3Vector x, y, z;
00042       epv.rotation().GetComponents(x,y,z);
00043       if ( dumpPosInfo ) {
00044         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.translation().x();
00045         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.translation().y();
00046         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.translation().z();
00047         //             dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().thetaX()/deg;
00048         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().phiX()/deg;
00049         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().thetaY()/deg;
00050         //             dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().phiY()/deg;
00051         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().thetaZ()/deg;
00052         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().phiZ()/deg;
00053         
00054         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().xx();
00055         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().xy();
00056         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().xz();
00057         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().yx();
00058         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().yy();
00059         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().yz();
00060         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().zx();
00061         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().zy();
00062         //          dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << epv.rotation().zz();
00063         
00064         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << x.X();
00065         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << y.X();
00066         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << z.X();
00067         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << x.Y();
00068         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << y.Y();
00069         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << z.Y();
00070         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << x.Z();
00071         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << y.Z();
00072         dump << "," << std::setw(12) << std::fixed << std::setprecision(4) << z.Z();
00073       }
00074       dump << std::endl;;
00075       ++id;
00076     } while (epv.next());
00077     dump.close();
00078   }
00079   if ( dumpSpecs ) {
00080     DDSpecifics::iterator<DDSpecifics> spit(DDSpecifics::begin()), spend(DDSpecifics::end());
00081     // ======= For each DDSpecific...
00082     std::ofstream dump("dumpSpecs");
00083     for (; spit != spend; ++spit) {
00084       if ( !spit->isDefined().second ) continue;  
00085       const DDSpecifics & sp = *spit;
00086       dump << sp << std::endl;
00087     }
00088     dump.close();
00089   }
00090 }
00091 

Generated on Tue Jun 9 17:32:22 2009 for CMSSW by  doxygen 1.5.4