CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Geometry/TrackerNumberingBuilder/plugins/CmsTrackerBuilder.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerBuilder.h"
00002 #include "DetectorDescription/Core/interface/DDFilteredView.h"
00003 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
00004 #include "Geometry/TrackerNumberingBuilder/plugins/ExtractStringFromDDD.h"
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 
00008 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerSubStrctBuilder.h"
00009 
00010 #include <bitset>
00011 
00012 CmsTrackerBuilder::CmsTrackerBuilder( unsigned int totalBlade )
00013   : m_totalBlade( totalBlade )
00014 {}
00015 
00016 void
00017 CmsTrackerBuilder::buildComponent( DDFilteredView& fv, GeometricDet* g, std::string s )
00018 {
00019   CmsTrackerSubStrctBuilder theCmsTrackerSubStrctBuilder( m_totalBlade );
00020 
00021   GeometricDet* subdet = new GeometricDet( &fv, theCmsTrackerStringToEnum.type( ExtractStringFromDDD::getString( s, &fv )));
00022   switch( theCmsTrackerStringToEnum.type( ExtractStringFromDDD::getString( s, &fv )))
00023   {
00024   case GeometricDet::PixelBarrel:
00025     theCmsTrackerSubStrctBuilder.build( fv, subdet, s );      
00026     break;
00027   case GeometricDet::PixelEndCap:
00028     theCmsTrackerSubStrctBuilder.build( fv, subdet, s );      
00029     break;
00030   case GeometricDet::TIB:
00031     theCmsTrackerSubStrctBuilder.build( fv, subdet, s );      
00032     break;
00033   case GeometricDet::TOB:
00034     theCmsTrackerSubStrctBuilder.build( fv, subdet, s );    
00035     break;
00036   case GeometricDet::TEC:
00037     theCmsTrackerSubStrctBuilder.build( fv, subdet, s );      
00038     break;
00039   case GeometricDet::TID:
00040     theCmsTrackerSubStrctBuilder.build( fv, subdet, s );      
00041     break;
00042   default:
00043     edm::LogError( "CmsTrackerBuilder" ) << " ERROR - I was expecting a SubDet, I got a " << ExtractStringFromDDD::getString( s, &fv );
00044   }
00045   
00046   g->addComponent( subdet );
00047 }
00048 
00049 void
00050 CmsTrackerBuilder::sortNS( DDFilteredView& fv, GeometricDet* det )
00051 {  
00052   GeometricDet::GeometricDetContainer & comp = det->components();
00053   std::stable_sort( comp.begin(), comp.end(), subDetByType());
00054   
00055   for( uint32_t i = 0; i < comp.size(); i++ )
00056   {
00057     uint32_t temp= comp[i]->type();
00058     comp[i]->setGeographicalID(temp);
00059   }
00060 }
00061 
00062 
00063 
00064