File indexing completed on 2024-04-06 12:15:29
0001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPanelBuilder.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/CmsDetConstruction.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "DataFormats/DetId/interface/DetId.h"
0009 #include <vector>
0010
0011 template <class FilteredView>
0012 void CmsTrackerPanelBuilder<FilteredView>::buildComponent(FilteredView& fv, GeometricDet* g, const std::string& s) {
0013 CmsDetConstruction<FilteredView> theCmsDetConstruction;
0014 switch (CmsTrackerLevelBuilder<FilteredView>::theCmsTrackerStringToEnum.type(
0015 ExtractStringFromDDD<FilteredView>::getString(s, &fv))) {
0016 case GeometricDet::DetUnit:
0017 theCmsDetConstruction.buildComponent(fv, g, s);
0018 break;
0019 default:
0020 edm::LogError("CmsTrackerPanelBuilder")
0021 << " ERROR - I was expecting a Plaq, I got a " << ExtractStringFromDDD<FilteredView>::getString(s, &fv);
0022 ;
0023 }
0024 }
0025
0026 template <class FilteredView>
0027 void CmsTrackerPanelBuilder<FilteredView>::sortNS(FilteredView& fv, GeometricDet* det) {
0028 GeometricDet::ConstGeometricDetContainer& comp = det->components();
0029
0030 if (comp.front()->type() == GeometricDet::DetUnit)
0031 std::sort(comp.begin(), comp.end(), CmsTrackerLevelBuilderHelper::isLessR);
0032 else
0033 edm::LogError("CmsTrackerPanelBuilder")
0034 << "ERROR - wrong SubDet to sort..... " << det->components().front()->type();
0035
0036 for (uint32_t i = 0; i < comp.size(); i++) {
0037 det->component(i)->setGeographicalID(i + 1);
0038 }
0039 }
0040
0041 template class CmsTrackerPanelBuilder<DDFilteredView>;
0042 template class CmsTrackerPanelBuilder<cms::DDFilteredView>;