CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/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 void CmsTrackerSubStrctBuilder::buildComponent(DDFilteredView& fv, GeometricDet* g, std::string s){
00015 
00016   CmsTrackerLayerBuilder theCmsTrackerLayerBuilder ;
00017   CmsTrackerWheelBuilder theCmsTrackerWheelBuilder;
00018   CmsTrackerDiskBuilder  theCmsTrackerDiskBuilder;   
00019 
00020   GeometricDet * subdet = new GeometricDet(&fv,theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(s,&fv)));
00021   switch (theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(s,&fv))){
00022   case GeometricDet::layer:
00023     theCmsTrackerLayerBuilder.build(fv,subdet,s);      
00024     break;
00025   case GeometricDet::wheel:
00026     theCmsTrackerWheelBuilder.build(fv,subdet,s);      
00027     break;
00028   case GeometricDet::disk:    
00029     theCmsTrackerDiskBuilder.build(fv,subdet,s);
00030     break;
00031 
00032   default:
00033     edm::LogError("CmsTrackerSubStrctBuilder")<<" ERROR - I was expecting a Layer ,Wheel or Disk... I got a "<<ExtractStringFromDDD::getString(s,&fv);
00034   }  
00035   
00036   g->addComponent(subdet);
00037 
00038 }
00039 
00040 void CmsTrackerSubStrctBuilder::sortNS( DDFilteredView& fv, GeometricDet* det){
00041   GeometricDet::GeometricDetContainer & comp = det->components();
00042 
00043   switch(comp.front()->type()){
00044   case GeometricDet::layer: std::sort(comp.begin(),comp.end(),LessR()); break;  
00045   case GeometricDet::wheel: std::sort(comp.begin(),comp.end(),LessModZ()); break;       
00046   case GeometricDet::disk:  std::sort(comp.begin(),comp.end(),LessModZ()); break;
00047     
00048   default:
00049     edm::LogError("CmsTrackerSubStrctBuilder")<<"ERROR - wrong SubDet to sort..... "<<det->components().front()->type(); 
00050   }
00051   
00052   for(uint32_t i=0; i<comp.size(); i++){
00053     comp[i]->setGeographicalID(i+1); // Every subdetector: Layer/Disk/Wheel Number
00054   }
00055   
00056 }
00057