CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/Geometry/TrackerNumberingBuilder/src/CmsTrackerDebugNavigator.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/interface/CmsTrackerDebugNavigator.h"
00002 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
00003 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDetExtra.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 
00008 CmsTrackerDebugNavigator::CmsTrackerDebugNavigator ( const std::vector<GeometricDetExtra>& gdes ) {
00009   std::vector<GeometricDetExtra>::const_iterator gdeiEnd(gdes.end());
00010   std::vector<GeometricDetExtra>::const_iterator gdei(gdes.begin());
00011    for (; gdei != gdeiEnd; ++gdei) {
00012      const GeometricDetExtra* gdeaddr = &(*gdei);
00013      _helperMap[gdei->geographicalId().rawId()] = gdeaddr;
00014   }
00015 }
00016 
00017 void CmsTrackerDebugNavigator::dump(const GeometricDet& in, const std::vector<GeometricDetExtra>& gdes){
00018   edm::LogInfo("CmsTrackerDebugNavigator")<<" CmsTrackerDebugNavigator - Starting debug";
00019   for (int k=0; k<20; k++) numinstances[k]=0;
00020   iterate(in,0, gdes);
00021   
00022   for (int k=0; k<20; k++){
00023     edm::LogInfo("CmsTrackerDebugNavigator")<<" CmsTrackerDebugNavigator has found "<<numinstances[k]<<" GeometricDets at level "<<k;
00024   }
00025 }
00026 
00027 void CmsTrackerDebugNavigator::iterate(const GeometricDet& in, int level, const std::vector<GeometricDetExtra>& gdes){
00028   numinstances[level]++;
00029   for (unsigned int k=0; k<in.components().size(); k++){
00030     std::string spaces = "";
00031     for(unsigned int i=0; (int)i<=level; i++) spaces+="  ";
00032     const GeometricDetExtra* extra = _helperMap[in.components()[k]->geographicalId().rawId()];
00033     edm::LogInfo("CmsTrackerDebugNavigator") << level << spaces
00034                                              << "### VOLUME " << in.components()[k]->name().name()
00035                                              << " of type " << in.components()[k]->type()
00036                                              << " copy number " << extra->copyno()
00037                                              << " positioned in " << in.name().name()
00038                                              << " global position of centre " << in.components()[k]->translation()
00039       //              << " rotation matrix " << in.components()[k]->rotation()
00040                                              << " volume = "  << extra->volume()  << " cm3"
00041                                              << " density = " << extra->density() << " g/cm3"
00042                                              << " weight "    << extra->weight()  << " g"
00043                                              << std::endl;
00044     iterate(*((in.components())[k]),level+1, gdes);
00045   }
00046   return;
00047 }