CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/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 
00013 void CmsTrackerBuilder::buildComponent(DDFilteredView& fv, GeometricDet* g, std::string s){
00014 
00015   CmsTrackerSubStrctBuilder theCmsTrackerSubStrctBuilder;
00016 
00017   GeometricDet * subdet = new GeometricDet(&fv,theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(s,&fv)));
00018   switch (theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(s,&fv))){
00019   case GeometricDet::PixelBarrel:
00020     theCmsTrackerSubStrctBuilder.build(fv,subdet,s);      
00021     break;
00022   case GeometricDet::PixelEndCap:
00023     theCmsTrackerSubStrctBuilder.build(fv,subdet,s);      
00024     break;
00025   case GeometricDet::TIB:
00026     theCmsTrackerSubStrctBuilder.build(fv,subdet,s);      
00027     break;
00028   case GeometricDet::TOB:
00029     theCmsTrackerSubStrctBuilder.build(fv,subdet,s);      
00030     break;
00031   case GeometricDet::TEC:
00032     theCmsTrackerSubStrctBuilder.build(fv,subdet,s);      
00033     break;
00034   case GeometricDet::TID:
00035     theCmsTrackerSubStrctBuilder.build(fv,subdet,s);      
00036     break;
00037   default:
00038     edm::LogError("CmsTrackerBuilder")<<" ERROR - I was expecting a SubDet, I got a "<<ExtractStringFromDDD::getString(s,&fv);
00039     ;
00040   }
00041   
00042   g->addComponent(subdet);
00043   
00044 }
00045 
00046 void CmsTrackerBuilder::sortNS(DDFilteredView& fv, GeometricDet* det){
00047   
00048   GeometricDet::GeometricDetContainer & comp = det->components();
00049   std::stable_sort(comp.begin(),comp.end(),subDetByType());
00050   
00051   for(uint32_t i=0; i<comp.size(); i++){
00052     uint32_t temp= comp[i]->type();
00053     comp[i]->setGeographicalID(temp);
00054   }
00055 
00056 }
00057 
00058 
00059 
00060