CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/Geometry/TrackerNumberingBuilder/plugins/CmsTrackerSubStrctBuilder.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerSubStrctBuilder.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 "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerLayerBuilder.h"
00007 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerWheelBuilder.h"
00008 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerDiskBuilder.h"  
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include <vector>
00011 
00012 #include <bitset>
00013 
00014 CmsTrackerSubStrctBuilder::CmsTrackerSubStrctBuilder( unsigned int totalBlade )
00015   : m_totalBlade( totalBlade )
00016 {}
00017 
00018 void
00019 CmsTrackerSubStrctBuilder::buildComponent( DDFilteredView& fv, GeometricDet* g, std::string s )
00020 {
00021   CmsTrackerLayerBuilder theCmsTrackerLayerBuilder;
00022   CmsTrackerWheelBuilder theCmsTrackerWheelBuilder;
00023   CmsTrackerDiskBuilder  theCmsTrackerDiskBuilder( m_totalBlade );   
00024 
00025   GeometricDet * subdet = new GeometricDet( &fv, theCmsTrackerStringToEnum.type( ExtractStringFromDDD::getString( s, &fv )));
00026   switch( theCmsTrackerStringToEnum.type( ExtractStringFromDDD::getString( s, &fv )))
00027   {
00028   case GeometricDet::layer:
00029     theCmsTrackerLayerBuilder.build(fv,subdet,s);      
00030     break;
00031   case GeometricDet::wheel:
00032     theCmsTrackerWheelBuilder.build(fv,subdet,s);      
00033     break;
00034   case GeometricDet::disk:    
00035     theCmsTrackerDiskBuilder.build(fv,subdet,s);
00036     break;
00037 
00038   default:
00039     edm::LogError("CmsTrackerSubStrctBuilder")<<" ERROR - I was expecting a Layer ,Wheel or Disk... I got a "<<ExtractStringFromDDD::getString(s,&fv);
00040   }  
00041   
00042   g->addComponent(subdet);
00043 
00044 }
00045 
00046 void
00047 CmsTrackerSubStrctBuilder::sortNS( DDFilteredView& fv, GeometricDet* det )
00048 {
00049   GeometricDet::GeometricDetContainer & comp = det->components();
00050 
00051   switch( comp.front()->type())
00052   {
00053   case GeometricDet::layer:
00054     std::sort( comp.begin(), comp.end(), LessR());
00055     break;      
00056   case GeometricDet::wheel:
00057     std::sort( comp.begin(), comp.end(), LessModZ());
00058     break;      
00059   case GeometricDet::disk:
00060     std::sort( comp.begin(), comp.end(), LessModZ());
00061     break;
00062   default:
00063     edm::LogError( "CmsTrackerSubStrctBuilder" ) << "ERROR - wrong SubDet to sort..... " << det->components().front()->type(); 
00064   }
00065   
00066   for( uint32_t i = 0; i < comp.size(); i++ )
00067   {
00068     comp[i]->setGeographicalID(i+1); // Every subdetector: Layer/Disk/Wheel Number
00069   }
00070 }
00071