Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-12 09:07:39

0001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPixelPhase2DoubleDiskBuilder.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 "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPixelPhase2SubDiskBuilder.h"
0007 #include "DataFormats/DetId/interface/DetId.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include <vector>
0010 #include <algorithm>
0011 
0012 using namespace std;
0013 
0014 template <class FilteredView>
0015 void CmsTrackerPixelPhase2DoubleDiskBuilder<FilteredView>::buildComponent(FilteredView& fv,
0016                                                                           GeometricDet* g,
0017                                                                           const std::string& s) {
0018   CmsTrackerPixelPhase2SubDiskBuilder<FilteredView> theCmsTrackerPixelPhase2SubDiskBuilder;
0019   GeometricDet* subdet = new GeometricDet(&fv,
0020                                           CmsTrackerLevelBuilder<FilteredView>::theCmsTrackerStringToEnum.type(
0021                                               ExtractStringFromDDD<FilteredView>::getString(s, &fv)));
0022 
0023   switch (CmsTrackerLevelBuilder<FilteredView>::theCmsTrackerStringToEnum.type(
0024       ExtractStringFromDDD<FilteredView>::getString(s, &fv))) {
0025     case GeometricDet::PixelPhase2SubDisk:
0026       theCmsTrackerPixelPhase2SubDiskBuilder.build(fv, subdet, s);
0027       break;
0028     default:
0029       edm::LogError("CmsTrackerPixelPhase2DoubleDiskBuilder")
0030           << " ERROR - I was expecting a SubDisk, I got a " << ExtractStringFromDDD<FilteredView>::getString(s, &fv);
0031   }
0032   g->addComponent(subdet);
0033 }
0034 
0035 template <class FilteredView>
0036 void CmsTrackerPixelPhase2DoubleDiskBuilder<FilteredView>::sortNS(FilteredView& fv, GeometricDet* det) {
0037   GeometricDet::ConstGeometricDetContainer& comp = det->components();
0038 
0039   std::sort(comp.begin(), comp.end(), CmsTrackerLevelBuilderHelper::isLessModZ);
0040 
0041   for (uint32_t i = 0; i < comp.size(); i++) {
0042     det->component(i)->setGeographicalID(i);
0043   }
0044 }
0045 
0046 template class CmsTrackerPixelPhase2DoubleDiskBuilder<DDFilteredView>;
0047 template class CmsTrackerPixelPhase2DoubleDiskBuilder<cms::DDFilteredView>;