CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPanelBuilder.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPanelBuilder.h"
00002 #include "DetectorDescription/Core/interface/DDFilteredView.h"
00003 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
00004 #include "Geometry/TrackerNumberingBuilder/plugins/ExtractStringFromDDD.h"
00005 #include "Geometry/TrackerNumberingBuilder/plugins/CmsDetConstruction.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 #include "DataFormats/DetId/interface/DetId.h"
00008 #include <vector>
00009 
00010 #include "Geometry/TrackerNumberingBuilder/plugins/TrackerStablePhiSort.h"
00011 
00012 void CmsTrackerPanelBuilder::buildComponent(DDFilteredView& fv, GeometricDet* g, std::string s){
00013 
00014   CmsDetConstruction theCmsDetConstruction;
00015   switch (theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(s,&fv))){
00016   case GeometricDet::DetUnit:
00017            theCmsDetConstruction.buildComponent(fv,g,s);
00018     break;
00019   default:
00020     edm::LogError("CmsTrackerPanelBuilder")<<" ERROR - I was expecting a Plaq, I got a "<<ExtractStringFromDDD::getString(s,&fv);
00021     ;
00022   }  
00023 }
00024 
00025 void CmsTrackerPanelBuilder::sortNS(DDFilteredView& fv, GeometricDet* det){
00026  GeometricDet::GeometricDetContainer & comp = det->components();
00027 
00028  if (comp.front()->type()==GeometricDet::DetUnit){ 
00029 
00030    // NP** Phase 2 Sort Modules within Rings
00031    if( fabs( comp[0]->translation().z() ) > 1000 ) {
00032      //std::cerr<<"PHASE 2!!!"<<std::endl;
00033      TrackerStablePhiSort(comp.begin(), comp.end(), ExtractPhi());
00034      stable_sort(comp.begin(), comp.end() ,PhiSortNP());
00035    }
00036    else
00037      // original one
00038      std::sort(comp.begin(),comp.end(),LessR());
00039  }
00040  else
00041    edm::LogError("CmsTrackerPanelBuilder")<<"ERROR - wrong SubDet to sort..... "<<det->components().front()->type(); 
00042 
00043   for(uint32_t i=0; i<comp.size();i++){
00044     comp[i]->setGeographicalID(i+1);
00045   } 
00046  
00047 }