CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/Geometry/TrackerNumberingBuilder/plugins/CmsTrackerRingBuilder.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerRingBuilder.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/CmsDetConstruction.h"
00007 #include "Geometry/TrackerNumberingBuilder/plugins/TrackerStablePhiSort.h"
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 #include <vector>
00010 
00011 #include <bitset>
00012 
00013 void CmsTrackerRingBuilder::buildComponent(DDFilteredView& fv, GeometricDet* g, std::string s){
00014   CmsDetConstruction theCmsDetConstruction;
00015   theCmsDetConstruction.buildComponent(fv,g,s);  
00016 }
00017 
00018 void CmsTrackerRingBuilder::sortNS(DDFilteredView& fv, GeometricDet* det){
00019   GeometricDet::GeometricDetContainer & comp = det->components();
00020   fv.firstChild(); 
00021   GeometricDet::GeometricDetContainer compfw;
00022   GeometricDet::GeometricDetContainer compbw;
00023 
00024 
00025   switch(comp.front()->type()) {
00026   
00027   case GeometricDet::mergedDet: 
00028     TrackerStablePhiSort(comp.begin(), comp.end(), ExtractPhiGluedModule()); 
00029     break;
00030   case GeometricDet::DetUnit: 
00031     TrackerStablePhiSort(comp.begin(), comp.end(), ExtractPhi()); 
00032     break;
00033   default:
00034     edm::LogError("CmsTrackerRingBuilder")<<"ERROR - wrong SubDet to sort..... "<<det->components().front()->type(); 
00035   }
00036   
00037   static std::string const part("TkDDDStructure");
00038   static std::string const TECGluedDet("TECGluedDet");
00039   static std::string const TECDet("TECDet");
00040 
00041   std::string const pname = ExtractStringFromDDD::getString(part,&fv); 
00042 
00043   // TEC
00044   // Module Number: 3 bits [1,...,5 at most]
00045   if(pname== TECGluedDet || pname == TECDet){
00046     
00047     // TEC- 
00048     if( det->translation().z() < 0 && pname == TECDet) {
00049       TrackerStablePhiSort(comp.begin(), comp.end(), ExtractPhiMirror());
00050     }
00051     
00052     if( det->translation().z() < 0 && pname == TECGluedDet) {
00053       TrackerStablePhiSort(comp.begin(), comp.end(), ExtractPhiGluedModuleMirror());
00054     }
00055 
00056     for(uint32_t i=0; i<comp.size();i++)
00057       comp[i]->setGeographicalID(i+1);
00058 
00059   } else {
00060     // TID
00061     // Ring Side: 2 bits [back:1 front:2]
00062     // Module Number: 5 bits [1,...,20 at most]
00063     //
00064     for(uint32_t i=0; i<comp.size();i++){
00065       if(fabs(comp[i]->translation().z())<fabs(det->translation().z())){      
00066         compfw.push_back(comp[i]);
00067       } else {
00068         compbw.push_back(comp[i]);
00069       }
00070     }
00071     
00072     for(uint32_t i=0; i<compbw.size();i++){
00073       uint32_t temp = i+1;
00074       temp |=(1<<5);
00075       compbw[i]->setGeographicalID(temp);
00076     }
00077     
00078     for(uint32_t i=0; i<compfw.size();i++){
00079       uint32_t temp = i+1;
00080       temp |=(2<<5);
00081       compfw[i]->setGeographicalID(temp);
00082     }
00083     
00084     det->clearComponents();
00085     det->addComponents(compfw);
00086     det->addComponents(compbw);
00087     
00088   }
00089   
00090   fv.parent();
00091   
00092 }
00093 
00094 
00095 
00096 
00097