Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPixelPhase2DiskBuilder.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/CmsTrackerPixelPhase2RingBuilder.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 CmsTrackerPixelPhase2DiskBuilder<FilteredView>::buildComponent(FilteredView& fv,
0016                                                                     GeometricDet* g,
0017                                                                     const std::string& s) {
0018   CmsTrackerPixelPhase2RingBuilder<FilteredView> theCmsTrackerPixelPhase2RingBuilder;
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::panel:
0026       theCmsTrackerPixelPhase2RingBuilder.build(fv, subdet, s);
0027       break;
0028     default:
0029       edm::LogError("CmsTrackerPixelPhase2DiskBuilder")
0030           << " ERROR - I was expecting a Panel, I got a " << ExtractStringFromDDD<FilteredView>::getString(s, &fv);
0031   }
0032   g->addComponent(subdet);
0033 }
0034 
0035 template <class FilteredView>
0036 void CmsTrackerPixelPhase2DiskBuilder<FilteredView>::sortNS(FilteredView& fv, GeometricDet* det) {
0037   GeometricDet::ConstGeometricDetContainer& comp = det->components();
0038 
0039   switch (det->components().front()->type()) {
0040     case GeometricDet::panel:
0041       // nothing to be done because the rings (here named panels) are already sorted ??
0042       break;
0043     default:
0044       edm::LogError("CmsTrackerPixelPhase2Builder")
0045           << "ERROR - wrong SubDet to sort..... " << det->components().front()->type();
0046   }
0047 
0048   GeometricDet::GeometricDetContainer rings;
0049   uint32_t totalrings = comp.size();
0050 
0051   for (uint32_t rn = 0; rn < totalrings; rn++) {
0052     rings.emplace_back(det->component(rn));
0053     uint32_t blade = rn + 1;
0054     uint32_t panel = 1;
0055     uint32_t temp = (blade << 2) | panel;
0056     rings[rn]->setGeographicalID(temp);
0057   }
0058 
0059   det->clearComponents();
0060   det->addComponents(rings);
0061 }
0062 
0063 template class CmsTrackerPixelPhase2DiskBuilder<DDFilteredView>;
0064 template class CmsTrackerPixelPhase2DiskBuilder<cms::DDFilteredView>;