Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:09

0001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPixelPhase1EndcapBuilder.h"
0002 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0003 #include "DetectorDescription/DDCMS/interface/DDFilteredView.h"
0004 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
0005 #include "Geometry/TrackerNumberingBuilder/plugins/ExtractStringFromDDD.h"
0006 #include "DataFormats/DetId/interface/DetId.h"
0007 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPhase1DiskBuilder.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include <vector>
0010 
0011 #include <bitset>
0012 
0013 template <class FilteredView>
0014 void CmsTrackerPixelPhase1EndcapBuilder<FilteredView>::buildComponent(FilteredView& fv,
0015                                                                       GeometricDet* g,
0016                                                                       const std::string& s) {
0017   CmsTrackerPhase1DiskBuilder<FilteredView> theCmsTrackerPhase1DiskBuilder;
0018 
0019   GeometricDet* subdet = new GeometricDet(&fv,
0020                                           CmsTrackerLevelBuilder<FilteredView>::theCmsTrackerStringToEnum.type(
0021                                               ExtractStringFromDDD<FilteredView>::getString(s, &fv)));
0022   const std::string& subdet_name = subdet->name();
0023   switch (CmsTrackerLevelBuilder<FilteredView>::theCmsTrackerStringToEnum.type(
0024       ExtractStringFromDDD<FilteredView>::getString(s, &fv))) {
0025     case GeometricDet::PixelPhase1Disk:
0026       LogDebug("DiskNames") << "The name of the components is: " << subdet_name;
0027       theCmsTrackerPhase1DiskBuilder.build(fv, subdet, s);
0028       break;
0029 
0030     default:
0031       edm::LogError("CmsTrackerPixelPhase1EndcapBuilder")
0032           << " ERROR - I was expecting a Disk... I got a " << ExtractStringFromDDD<FilteredView>::getString(s, &fv);
0033   }
0034 
0035   g->addComponent(subdet);
0036 }
0037 
0038 template <class FilteredView>
0039 void CmsTrackerPixelPhase1EndcapBuilder<FilteredView>::sortNS(FilteredView& fv, GeometricDet* det) {
0040   GeometricDet::ConstGeometricDetContainer& comp = det->components();
0041 
0042   switch (comp.front()->type()) {
0043     case GeometricDet::PixelPhase1Disk:
0044       std::sort(comp.begin(), comp.end(), CmsTrackerLevelBuilderHelper::isLessModZ);
0045       break;
0046     default:
0047       edm::LogError("CmsTrackerPixelPhase1EndcapBuilder")
0048           << "ERROR - wrong SubDet to sort..... " << det->components().front()->type();
0049   }
0050 
0051   for (uint32_t i = 0; i < comp.size(); i++) {
0052     det->component(i)->setGeographicalID(i + 1);  // Every subdetector: Disk Number
0053   }
0054 }
0055 
0056 template class CmsTrackerPixelPhase1EndcapBuilder<DDFilteredView>;
0057 template class CmsTrackerPixelPhase1EndcapBuilder<cms::DDFilteredView>;