Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:28

0001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerBuilder.h"
0002 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
0003 #include "Geometry/TrackerNumberingBuilder/plugins/ExtractStringFromDDD.h"
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 
0007 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerSubStrctBuilder.h"
0008 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPixelPhase1EndcapBuilder.h"
0009 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerPixelPhase2EndcapBuilder.h"
0010 
0011 #include <bitset>
0012 
0013 template <class FilteredView>
0014 void CmsTrackerBuilder<FilteredView>::buildComponent(FilteredView& fv, GeometricDet* g, const std::string& s) {
0015   CmsTrackerSubStrctBuilder<FilteredView> theCmsTrackerSubStrctBuilder;
0016   CmsTrackerPixelPhase1EndcapBuilder<FilteredView> theCmsTrackerPixelPhase1EndcapBuilder;
0017   CmsTrackerPixelPhase2EndcapBuilder<FilteredView> theCmsTrackerPixelPhase2EndcapBuilder;
0018 
0019   GeometricDet* subdet = new GeometricDet(&fv,
0020                                           CmsTrackerLevelBuilder<FilteredView>::theCmsTrackerStringToEnum.type(
0021                                               ExtractStringFromDDD<FilteredView>::getString(s, &fv)));
0022   switch (CmsTrackerLevelBuilder<FilteredView>::theCmsTrackerStringToEnum.type(
0023       ExtractStringFromDDD<FilteredView>::getString(s, &fv))) {
0024     case GeometricDet::PixelBarrel:
0025       theCmsTrackerSubStrctBuilder.build(fv, subdet, s);
0026       break;
0027     case GeometricDet::PixelPhase1Barrel:
0028       theCmsTrackerSubStrctBuilder.build(fv, subdet, s);
0029       break;
0030     case GeometricDet::PixelPhase2Barrel:
0031       theCmsTrackerSubStrctBuilder.build(fv, subdet, s);
0032       break;
0033     case GeometricDet::PixelEndCap:
0034       theCmsTrackerSubStrctBuilder.build(fv, subdet, s);
0035       break;
0036     case GeometricDet::PixelPhase1EndCap:
0037       theCmsTrackerPixelPhase1EndcapBuilder.build(fv, subdet, s);
0038       break;
0039     case GeometricDet::PixelPhase2EndCap:
0040       theCmsTrackerPixelPhase2EndcapBuilder.build(fv, subdet, s);
0041       break;
0042     case GeometricDet::OTPhase2EndCap:
0043       theCmsTrackerPixelPhase2EndcapBuilder.build(fv, subdet, s);
0044       break;
0045     case GeometricDet::TIB:
0046       theCmsTrackerSubStrctBuilder.build(fv, subdet, s);
0047       break;
0048     case GeometricDet::TOB:
0049       theCmsTrackerSubStrctBuilder.build(fv, subdet, s);
0050       break;
0051     case GeometricDet::OTPhase2Barrel:
0052       theCmsTrackerSubStrctBuilder.build(fv, subdet, s);
0053       break;
0054     case GeometricDet::TEC:
0055       theCmsTrackerSubStrctBuilder.build(fv, subdet, s);
0056       break;
0057     case GeometricDet::TID:
0058       theCmsTrackerSubStrctBuilder.build(fv, subdet, s);
0059       break;
0060     default:
0061       edm::LogError("CmsTrackerBuilder") << " ERROR - I was expecting a SubDet, I got a "
0062                                          << ExtractStringFromDDD<FilteredView>::getString(s, &fv);
0063   }
0064 
0065   g->addComponent(subdet);
0066 }
0067 
0068 template <class FilteredView>
0069 void CmsTrackerBuilder<FilteredView>::sortNS(FilteredView&, GeometricDet* det) {
0070   GeometricDet::ConstGeometricDetContainer& comp = det->components();
0071   std::stable_sort(comp.begin(), comp.end(), CmsTrackerLevelBuilderHelper::subDetByType);
0072 
0073   for (uint32_t i = 0; i < comp.size(); i++) {
0074     uint32_t temp = comp[i]->type();
0075     det->component(i)->setGeographicalID(
0076         temp %
0077         100);  // it relies on the fact that the GeometricDet::GDEnumType enumerators used to identify the subdetectors in the upgrade geometries are equal to the ones of the present detector + n*100
0078   }
0079 }
0080 
0081 template class CmsTrackerBuilder<DDFilteredView>;
0082 template class CmsTrackerBuilder<cms::DDFilteredView>;