Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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