Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-25 23:59:22

0001 
0002 #include "Alignment/TrackerAlignment/interface/TrackerAlignmentLevelBuilder.h"
0003 
0004 // Original Author:  Max Stark
0005 //         Created:  Wed, 10 Feb 2016 13:48:41 CET
0006 
0007 // topology and geometry
0008 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0009 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0010 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0011 
0012 //=============================================================================
0013 //===   PUBLIC METHOD IMPLEMENTATION                                        ===
0014 //=============================================================================
0015 
0016 //_____________________________________________________________________________
0017 TrackerAlignmentLevelBuilder ::TrackerAlignmentLevelBuilder(const TrackerTopology* trackerTopology,
0018                                                             const TrackerGeometry* trackerGeometry)
0019     : trackerTopology_(trackerTopology),
0020       alignableObjectId_(trackerGeometry, nullptr, nullptr, nullptr),
0021       trackerNameSpace_(trackerTopology) {}
0022 
0023 //_____________________________________________________________________________
0024 TrackerAlignmentLevelBuilder::~TrackerAlignmentLevelBuilder() {}
0025 
0026 //_____________________________________________________________________________
0027 void TrackerAlignmentLevelBuilder ::addDetUnitInfo(const DetId& detId) {
0028   int subdetId = detId.subdetId();
0029 
0030   switch (subdetId) {
0031     case PixelSubdetector::PixelBarrel:
0032       addPXBDetUnitInfo(detId);
0033       break;
0034     case PixelSubdetector::PixelEndcap:
0035       addPXEDetUnitInfo(detId);
0036       break;
0037     case StripSubdetector::TIB:
0038       addTIBDetUnitInfo(detId);
0039       break;
0040     case StripSubdetector::TID:
0041       addTIDDetUnitInfo(detId);
0042       break;
0043     case StripSubdetector::TOB:
0044       addTOBDetUnitInfo(detId);
0045       break;
0046     case StripSubdetector::TEC:
0047       addTECDetUnitInfo(detId);
0048       break;
0049   }
0050 }
0051 
0052 //_____________________________________________________________________________
0053 std::vector<align::AlignmentLevels> TrackerAlignmentLevelBuilder ::build() {
0054   std::vector<align::AlignmentLevels> levels;
0055   levels.push_back(buildPXBAlignmentLevels());
0056   levels.push_back(buildPXEAlignmentLevels());
0057   levels.push_back(buildTIBAlignmentLevels());
0058   levels.push_back(buildTIDAlignmentLevels());
0059   levels.push_back(buildTOBAlignmentLevels());
0060   levels.push_back(buildTECAlignmentLevels());
0061   levelsBuilt_ = true;
0062   return levels;
0063 }
0064 
0065 //______________________________________________________________________________
0066 const align::TrackerNameSpace& TrackerAlignmentLevelBuilder ::trackerNameSpace() const {
0067   if (levelsBuilt_) {
0068     return trackerNameSpace_;
0069   } else {
0070     throw cms::Exception("LogicError") << "@SUB=TrackerAlignmentLevelBuilder::trackerNameSpace\n"
0071                                        << "trying to get the name space before it has been properly initialized;"
0072                                        << " please call TrackerAlignmentLevelBuilder::build() first";
0073   }
0074 }
0075 
0076 //=============================================================================
0077 //===   PRIVATE METHOD IMPLEMENTATION                                       ===
0078 //=============================================================================
0079 
0080 //_____________________________________________________________________________
0081 void TrackerAlignmentLevelBuilder ::addPXBDetUnitInfo(const DetId& detId) {
0082   auto layerID = trackerTopology_->pxbLayer(detId);
0083   auto ladderID = trackerTopology_->pxbLadder(detId);
0084   auto moduleID = trackerTopology_->module(detId);
0085 
0086   if (pxbLaddersPerLayer_[layerID - 1] < ladderID) {
0087     pxbLaddersPerLayer_[layerID - 1] = ladderID;
0088   }
0089 
0090   pxbLayerIDs_.insert(layerID);
0091   pxbLadderIDs_.insert(ladderID);
0092   pxbModuleIDs_.insert(moduleID);
0093 }
0094 
0095 //_____________________________________________________________________________
0096 void TrackerAlignmentLevelBuilder ::addPXEDetUnitInfo(const DetId& detId) {
0097   auto sideID = trackerTopology_->pxfSide(detId);
0098   auto diskID = trackerTopology_->pxfDisk(detId);
0099   auto bladeID = trackerTopology_->pxfBlade(detId);
0100   auto panelID = trackerTopology_->pxfPanel(detId);
0101   auto moduleID = trackerTopology_->module(detId);
0102 
0103   pxeSideIDs_.insert(sideID);
0104   pxeDiskIDs_.insert(diskID);
0105   pxeBladeIDs_.insert(bladeID);
0106   pxePanelIDs_.insert(panelID);
0107   pxeModuleIDs_.insert(moduleID);
0108 }
0109 
0110 //_____________________________________________________________________________
0111 void TrackerAlignmentLevelBuilder ::addTIBDetUnitInfo(const DetId& detId) {
0112   auto sideID = trackerTopology_->tibSide(detId);
0113   auto layerID = trackerTopology_->tibLayer(detId);
0114   auto layerSide = trackerTopology_->tibOrder(detId);
0115   auto stringID = trackerTopology_->tibString(detId);
0116   auto moduleID = trackerTopology_->module(detId);
0117 
0118   if (layerSide == 1) {
0119     if (tidStringsInnerLayer_[layerID - 1] < stringID) {
0120       tidStringsInnerLayer_[layerID - 1] = stringID;
0121     }
0122   } else {
0123     if (tidStringsOuterLayer_[layerID - 1] < stringID) {
0124       tidStringsOuterLayer_[layerID - 1] = stringID;
0125     }
0126   }
0127 
0128   tibSideIDs_.insert(sideID);
0129   tibLayerIDs_.insert(layerID);
0130   tibStringIDs_.insert(stringID);
0131   tibModuleIDs_.insert(moduleID);
0132 }
0133 
0134 //_____________________________________________________________________________
0135 void TrackerAlignmentLevelBuilder ::addTIDDetUnitInfo(const DetId& detId) {
0136   auto sideID = trackerTopology_->tidSide(detId);
0137   auto wheelID = trackerTopology_->tidWheel(detId);
0138   auto ringID = trackerTopology_->tidRing(detId);
0139   auto moduleID = trackerTopology_->module(detId);
0140 
0141   // tidOrder
0142   tidSideIDs_.insert(sideID);
0143   tidWheelIDs_.insert(wheelID);
0144   tidRingIDs_.insert(ringID);
0145   tidModuleIDs_.insert(moduleID);
0146 }
0147 
0148 //_____________________________________________________________________________
0149 void TrackerAlignmentLevelBuilder ::addTOBDetUnitInfo(const DetId& detId) {
0150   auto layerID = trackerTopology_->tobLayer(detId);
0151   auto sideID = trackerTopology_->tobSide(detId);
0152   auto rodID = trackerTopology_->tobRod(detId);
0153   auto moduleID = trackerTopology_->module(detId);
0154 
0155   tobLayerIDs_.insert(layerID);
0156   tobSideIDs_.insert(sideID);
0157   tobRodIDs_.insert(rodID);
0158   tobModuleIDs_.insert(moduleID);
0159 }
0160 
0161 //_____________________________________________________________________________
0162 void TrackerAlignmentLevelBuilder ::addTECDetUnitInfo(const DetId& detId) {
0163   auto sideID = trackerTopology_->tecSide(detId);
0164   auto wheelID = trackerTopology_->tecWheel(detId);
0165   auto petalID = trackerTopology_->tecPetalNumber(detId);
0166   auto ringID = trackerTopology_->tecRing(detId);
0167   auto moduleID = trackerTopology_->module(detId);
0168 
0169   tecSideIDs_.insert(sideID);
0170   tecWheelIDs_.insert(wheelID);
0171   tecPetalIDs_.insert(petalID);
0172   tecRingIDs_.insert(ringID);
0173   tecModuleIDs_.insert(moduleID);
0174 }
0175 
0176 //_____________________________________________________________________________
0177 align::AlignmentLevels TrackerAlignmentLevelBuilder ::buildPXBAlignmentLevels() {
0178   int maxNumModules = pxbModuleIDs_.size();
0179   int maxNumLadders = pxbLadderIDs_.size() / 2;  // divide by 2 since we have
0180                                                  // HalfBarrels
0181   int maxNumLayers = pxbLayerIDs_.size();
0182 
0183   std::ostringstream ss;
0184   ss << "determined following numbers for " << alignableObjectId_.idToString(align::TPBBarrel) << " geometry:"
0185      << "\n"
0186      << "   max. number of modules: " << maxNumModules << "\n"
0187      << "   max. number of ladders: " << maxNumLadders << "\n";
0188 
0189   for (size_t layer = 0; layer < pxbLaddersPerLayer_.size(); ++layer) {
0190     // divide by 4, because we need the ladders per quarter cylinder
0191     trackerNameSpace_.tpb_.lpqc_.push_back(pxbLaddersPerLayer_[layer] / 4);
0192     ss << "      ladders in layer-" << layer << ": " << pxbLaddersPerLayer_[layer] << "\n";
0193   }
0194 
0195   ss << "   max. number of layers:  " << maxNumLayers;
0196   edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildPXBAlignmentLevels" << ss.str();
0197 
0198   align::AlignmentLevels pxb;
0199   pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBModule, maxNumModules, false));
0200   pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBLadder, maxNumLadders, true));
0201   pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBLayer, maxNumLayers, false));
0202   pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBHalfBarrel, 2, false));
0203   pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBBarrel, 1, false));
0204   return pxb;
0205 }
0206 
0207 //_____________________________________________________________________________
0208 align::AlignmentLevels TrackerAlignmentLevelBuilder ::buildPXEAlignmentLevels() {
0209   int maxNumModules = pxeModuleIDs_.size();
0210   int maxNumPanels = pxePanelIDs_.size();
0211   int maxNumBlades = pxeBladeIDs_.size() / 2;
0212   int maxNumDisks = pxeDiskIDs_.size();
0213   int maxNumSides = pxeSideIDs_.size();
0214 
0215   std::ostringstream ss;
0216   ss << "determined following numbers for " << alignableObjectId_.idToString(align::TPEEndcap) << " geometry:"
0217      << "\n"
0218      << "   max. number of modules: " << maxNumModules << "\n"
0219      << "   max. number of panels:  " << maxNumPanels << "\n"
0220      << "   max. number of blades:  " << maxNumBlades << "\n";
0221 
0222   trackerNameSpace_.tpe_.bpqd_ = maxNumBlades / 2;
0223 
0224   ss << "      blades per quarter disk: " << trackerNameSpace_.tpe_.bpqd_ << "\n"
0225      << "   max. number of disks:   " << maxNumDisks << "\n"
0226      << "   max. number of sides:   " << maxNumSides;
0227   edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildPXEAlignmentLevels" << ss.str();
0228 
0229   align::AlignmentLevels pxe;
0230   pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEModule, maxNumModules, false));
0231   pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEPanel, maxNumPanels, true));
0232   pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEBlade, maxNumBlades, true));
0233   pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEHalfDisk, maxNumDisks, false));
0234   pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEHalfCylinder, 2, false));
0235   pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEEndcap, maxNumSides, false));
0236   return pxe;
0237 }
0238 
0239 //_____________________________________________________________________________
0240 align::AlignmentLevels TrackerAlignmentLevelBuilder ::buildTIBAlignmentLevels() {
0241   int maxNumModules = tibModuleIDs_.size();
0242   int maxNumStrings = tibStringIDs_.size();
0243   int maxNumLayers = tibLayerIDs_.size();
0244   int maxNumSides = tibSideIDs_.size();
0245 
0246   std::ostringstream ss;
0247   ss << "determined following numbers for " << alignableObjectId_.idToString(align::TIBBarrel) << " geometry:"
0248      << "\n"
0249      << "   max. number of modules: " << maxNumModules << "\n"
0250      << "   max. number of strings: " << maxNumStrings << "\n";
0251 
0252   for (size_t layer = 0; layer < tidStringsInnerLayer_.size(); ++layer) {
0253     // divide by 2, because we have HalfShells
0254     trackerNameSpace_.tib_.sphs_.push_back(tidStringsInnerLayer_[layer] / 2);
0255     trackerNameSpace_.tib_.sphs_.push_back(tidStringsOuterLayer_[layer] / 2);
0256 
0257     ss << "      strings in layer-" << layer << " (inside):  " << tidStringsInnerLayer_[layer] << "\n"
0258        << "      strings in layer-" << layer << " (outside): " << tidStringsOuterLayer_[layer] << "\n";
0259   }
0260 
0261   ss << "   max. number of layers:  " << maxNumLayers << "\n"
0262      << "   max. number of sides:   " << maxNumSides;
0263   edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildTIBAlignmentLevels" << ss.str();
0264 
0265   align::AlignmentLevels tib;
0266   tib.push_back(std::make_unique<AlignmentLevel>(align::TIBModule, maxNumModules, false));
0267   tib.push_back(std::make_unique<AlignmentLevel>(align::TIBString, maxNumStrings, true));
0268   tib.push_back(std::make_unique<AlignmentLevel>(align::TIBSurface, 2, false));    // 2 surfaces per half shell
0269   tib.push_back(std::make_unique<AlignmentLevel>(align::TIBHalfShell, 2, false));  // 2 half shells per layer
0270   tib.push_back(std::make_unique<AlignmentLevel>(align::TIBLayer, maxNumLayers, false));
0271   tib.push_back(std::make_unique<AlignmentLevel>(align::TIBHalfBarrel, 2, false));
0272   tib.push_back(std::make_unique<AlignmentLevel>(align::TIBBarrel, 1, false));
0273   return tib;
0274 }
0275 
0276 //_____________________________________________________________________________
0277 align::AlignmentLevels TrackerAlignmentLevelBuilder ::buildTIDAlignmentLevels() {
0278   int maxNumModules = tidModuleIDs_.size();
0279   int maxNumRings = tidRingIDs_.size();
0280   // TODO: for PhaseII geometry the method name for tidWheel changes:
0281   //       -> trackerTopology->tidDisk(detId);
0282   int maxNumWheels = tidWheelIDs_.size();
0283   int maxNumSides = tidSideIDs_.size();
0284 
0285   edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildTIDAlignmentLevels"
0286                                         << "determined following numbers for "
0287                                         << alignableObjectId_.idToString(align::TIDEndcap) << " geometry:"
0288                                         << "\n"
0289                                         << "   max. number of modules: " << maxNumModules << "\n"
0290                                         << "   max. number of rings:   " << maxNumRings << "\n"
0291                                         << "   max. number of wheels:  " << maxNumWheels << "\n"
0292                                         << "   max. number of sides:   " << maxNumSides;
0293 
0294   align::AlignmentLevels tid;
0295   tid.push_back(std::make_unique<AlignmentLevel>(align::TIDModule, maxNumModules, false));
0296   tid.push_back(std::make_unique<AlignmentLevel>(align::TIDSide, 2, false));  // 2 sides per ring
0297   tid.push_back(std::make_unique<AlignmentLevel>(align::TIDRing, maxNumRings, false));
0298   tid.push_back(std::make_unique<AlignmentLevel>(align::TIDDisk, maxNumWheels, false));
0299   tid.push_back(std::make_unique<AlignmentLevel>(align::TIDEndcap, 2, false));  // 2 endcaps in TID
0300   return tid;
0301 }
0302 
0303 //_____________________________________________________________________________
0304 align::AlignmentLevels TrackerAlignmentLevelBuilder ::buildTOBAlignmentLevels() {
0305   int maxNumModules = tobModuleIDs_.size();
0306   int maxNumRods = tobRodIDs_.size();
0307   int maxNumSides = tobSideIDs_.size();
0308   int maxNumLayers = tobLayerIDs_.size();
0309 
0310   edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildTOBAlignmentLevels"
0311                                         << "determined following numbers for "
0312                                         << alignableObjectId_.idToString(align::TOBBarrel) << " geometry:"
0313                                         << "\n"
0314                                         << "   max. number of modules: " << maxNumModules << "\n"
0315                                         << "   max. number of rods:    " << maxNumRods << "\n"
0316                                         << "   max. number of sides:   " << maxNumSides << "\n"
0317                                         << "   max. number of layers:  " << maxNumLayers;
0318 
0319   align::AlignmentLevels tob;
0320   tob.push_back(std::make_unique<AlignmentLevel>(align::TOBModule, maxNumModules, false));
0321   tob.push_back(std::make_unique<AlignmentLevel>(align::TOBRod, maxNumRods, true));
0322   tob.push_back(std::make_unique<AlignmentLevel>(align::TOBLayer, maxNumLayers, false));
0323   tob.push_back(std::make_unique<AlignmentLevel>(align::TOBHalfBarrel, maxNumSides, false));
0324   tob.push_back(std::make_unique<AlignmentLevel>(align::TOBBarrel, 1, false));
0325   return tob;
0326 }
0327 
0328 //_____________________________________________________________________________
0329 align::AlignmentLevels TrackerAlignmentLevelBuilder ::buildTECAlignmentLevels() {
0330   int maxNumModules = tecModuleIDs_.size();
0331   int maxNumRings = tecRingIDs_.size();
0332   int maxNumPetals = tecPetalIDs_.size();
0333   int maxNumDisks = tecWheelIDs_.size();
0334   int maxNumSides = tecSideIDs_.size();
0335 
0336   edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildTECAlignmentLevels"
0337                                         << "determined following numbers for "
0338                                         << alignableObjectId_.idToString(align::TECEndcap) << " geometry:"
0339                                         << "\n"
0340                                         << "   max. number of modules: " << maxNumModules << "\n"
0341                                         << "   max. number of rings:   " << maxNumRings << "\n"
0342                                         << "   max. number of petals:  " << maxNumPetals << "\n"
0343                                         << "   max. number of wheels:  " << maxNumDisks << "\n"
0344                                         << "   max. number of sides:   " << maxNumSides;
0345 
0346   align::AlignmentLevels tec;
0347   tec.push_back(std::make_unique<AlignmentLevel>(align::TECModule, maxNumModules, false));
0348   tec.push_back(std::make_unique<AlignmentLevel>(align::TECRing, maxNumRings, true));
0349   tec.push_back(std::make_unique<AlignmentLevel>(align::TECPetal, maxNumPetals, true));
0350   tec.push_back(std::make_unique<AlignmentLevel>(align::TECSide, 2, false));  // 2 sides per disk
0351   tec.push_back(std::make_unique<AlignmentLevel>(align::TECDisk, maxNumDisks, false));
0352   tec.push_back(std::make_unique<AlignmentLevel>(align::TECEndcap, 2, false));
0353   return tec;
0354 }