CMS 3D CMS Logo

TrackerAlignmentLevelBuilder.cc
Go to the documentation of this file.
1 
3 
4 // Original Author: Max Stark
5 // Created: Wed, 10 Feb 2016 13:48:41 CET
6 
7 // topology and geometry
11 
12 //=============================================================================
13 //=== PUBLIC METHOD IMPLEMENTATION ===
14 //=============================================================================
15 
16 //_____________________________________________________________________________
18  const TrackerGeometry* trackerGeometry)
19  : trackerTopology_(trackerTopology),
20  alignableObjectId_(trackerGeometry, nullptr, nullptr, nullptr),
21  trackerNameSpace_(trackerTopology) {}
22 
23 //_____________________________________________________________________________
25 
26 //_____________________________________________________________________________
28  int subdetId = detId.subdetId();
29 
30  switch (subdetId) {
33  break;
36  break;
39  break;
42  break;
45  break;
48  break;
49  }
50 }
51 
52 //_____________________________________________________________________________
53 std::vector<align::AlignmentLevels> TrackerAlignmentLevelBuilder ::build() {
54  std::vector<align::AlignmentLevels> levels;
55  levels.push_back(buildPXBAlignmentLevels());
56  levels.push_back(buildPXEAlignmentLevels());
57  levels.push_back(buildTIBAlignmentLevels());
58  levels.push_back(buildTIDAlignmentLevels());
59  levels.push_back(buildTOBAlignmentLevels());
60  levels.push_back(buildTECAlignmentLevels());
61  levelsBuilt_ = true;
62  return levels;
63 }
64 
65 //______________________________________________________________________________
67  if (levelsBuilt_) {
68  return trackerNameSpace_;
69  } else {
70  throw cms::Exception("LogicError") << "@SUB=TrackerAlignmentLevelBuilder::trackerNameSpace\n"
71  << "trying to get the name space before it has been properly initialized;"
72  << " please call TrackerAlignmentLevelBuilder::build() first";
73  }
74 }
75 
76 //=============================================================================
77 //=== PRIVATE METHOD IMPLEMENTATION ===
78 //=============================================================================
79 
80 //_____________________________________________________________________________
82  auto layerID = trackerTopology_->pxbLayer(detId);
83  auto ladderID = trackerTopology_->pxbLadder(detId);
84  auto moduleID = trackerTopology_->module(detId);
85 
86  if (pxbLaddersPerLayer_[layerID - 1] < ladderID) {
87  pxbLaddersPerLayer_[layerID - 1] = ladderID;
88  }
89 
90  pxbLayerIDs_.insert(layerID);
91  pxbLadderIDs_.insert(ladderID);
92  pxbModuleIDs_.insert(moduleID);
93 }
94 
95 //_____________________________________________________________________________
97  auto sideID = trackerTopology_->pxfSide(detId);
98  auto diskID = trackerTopology_->pxfDisk(detId);
99  auto bladeID = trackerTopology_->pxfBlade(detId);
100  auto panelID = trackerTopology_->pxfPanel(detId);
101  auto moduleID = trackerTopology_->module(detId);
102 
103  pxeSideIDs_.insert(sideID);
104  pxeDiskIDs_.insert(diskID);
105  pxeBladeIDs_.insert(bladeID);
106  pxePanelIDs_.insert(panelID);
107  pxeModuleIDs_.insert(moduleID);
108 }
109 
110 //_____________________________________________________________________________
112  auto sideID = trackerTopology_->tibSide(detId);
113  auto layerID = trackerTopology_->tibLayer(detId);
114  auto layerSide = trackerTopology_->tibOrder(detId);
115  auto stringID = trackerTopology_->tibString(detId);
116  auto moduleID = trackerTopology_->module(detId);
117 
118  if (layerSide == 1) {
119  if (tidStringsInnerLayer_[layerID - 1] < stringID) {
120  tidStringsInnerLayer_[layerID - 1] = stringID;
121  }
122  } else {
123  if (tidStringsOuterLayer_[layerID - 1] < stringID) {
124  tidStringsOuterLayer_[layerID - 1] = stringID;
125  }
126  }
127 
128  tibSideIDs_.insert(sideID);
129  tibLayerIDs_.insert(layerID);
130  tibStringIDs_.insert(stringID);
131  tibModuleIDs_.insert(moduleID);
132 }
133 
134 //_____________________________________________________________________________
136  auto sideID = trackerTopology_->tidSide(detId);
137  auto wheelID = trackerTopology_->tidWheel(detId);
138  auto ringID = trackerTopology_->tidRing(detId);
139  auto moduleID = trackerTopology_->module(detId);
140 
141  // tidOrder
142  tidSideIDs_.insert(sideID);
143  tidWheelIDs_.insert(wheelID);
144  tidRingIDs_.insert(ringID);
145  tidModuleIDs_.insert(moduleID);
146 }
147 
148 //_____________________________________________________________________________
150  auto layerID = trackerTopology_->tobLayer(detId);
151  auto sideID = trackerTopology_->tobSide(detId);
152  auto rodID = trackerTopology_->tobRod(detId);
153  auto moduleID = trackerTopology_->module(detId);
154 
155  tobLayerIDs_.insert(layerID);
156  tobSideIDs_.insert(sideID);
157  tobRodIDs_.insert(rodID);
158  tobModuleIDs_.insert(moduleID);
159 }
160 
161 //_____________________________________________________________________________
163  auto sideID = trackerTopology_->tecSide(detId);
164  auto wheelID = trackerTopology_->tecWheel(detId);
165  auto petalID = trackerTopology_->tecPetalNumber(detId);
166  auto ringID = trackerTopology_->tecRing(detId);
167  auto moduleID = trackerTopology_->module(detId);
168 
169  tecSideIDs_.insert(sideID);
170  tecWheelIDs_.insert(wheelID);
171  tecPetalIDs_.insert(petalID);
172  tecRingIDs_.insert(ringID);
173  tecModuleIDs_.insert(moduleID);
174 }
175 
176 //_____________________________________________________________________________
178  int maxNumModules = pxbModuleIDs_.size();
179  int maxNumLadders = pxbLadderIDs_.size() / 2; // divide by 2 since we have
180  // HalfBarrels
181  int maxNumLayers = pxbLayerIDs_.size();
182 
183  std::ostringstream ss;
184  ss << "determined following numbers for " << alignableObjectId_.idToString(align::TPBBarrel) << " geometry:"
185  << "\n"
186  << " max. number of modules: " << maxNumModules << "\n"
187  << " max. number of ladders: " << maxNumLadders << "\n";
188 
189  for (size_t layer = 0; layer < pxbLaddersPerLayer_.size(); ++layer) {
190  // divide by 4, because we need the ladders per quarter cylinder
192  ss << " ladders in layer-" << layer << ": " << pxbLaddersPerLayer_[layer] << "\n";
193  }
194 
195  ss << " max. number of layers: " << maxNumLayers;
196  edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildPXBAlignmentLevels" << ss.str();
197 
199  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBModule, maxNumModules, false));
200  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBLadder, maxNumLadders, true));
201  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBLayer, maxNumLayers, false));
202  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBHalfBarrel, 2, false));
203  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBBarrel, 1, false));
204  return pxb;
205 }
206 
207 //_____________________________________________________________________________
209  int maxNumModules = pxeModuleIDs_.size();
210  int maxNumPanels = pxePanelIDs_.size();
211  int maxNumBlades = pxeBladeIDs_.size() / 2;
212  int maxNumDisks = pxeDiskIDs_.size();
213  int maxNumSides = pxeSideIDs_.size();
214 
215  std::ostringstream ss;
216  ss << "determined following numbers for " << alignableObjectId_.idToString(align::TPEEndcap) << " geometry:"
217  << "\n"
218  << " max. number of modules: " << maxNumModules << "\n"
219  << " max. number of panels: " << maxNumPanels << "\n"
220  << " max. number of blades: " << maxNumBlades << "\n";
221 
222  trackerNameSpace_.tpe_.bpqd_ = maxNumBlades / 2;
223 
224  ss << " blades per quarter disk: " << trackerNameSpace_.tpe_.bpqd_ << "\n"
225  << " max. number of disks: " << maxNumDisks << "\n"
226  << " max. number of sides: " << maxNumSides;
227  edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildPXEAlignmentLevels" << ss.str();
228 
230  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEModule, maxNumModules, false));
231  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEPanel, maxNumPanels, true));
232  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEBlade, maxNumBlades, true));
233  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEHalfDisk, maxNumDisks, false));
234  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEHalfCylinder, 2, false));
235  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEEndcap, maxNumSides, false));
236  return pxe;
237 }
238 
239 //_____________________________________________________________________________
241  int maxNumModules = tibModuleIDs_.size();
242  int maxNumStrings = tibStringIDs_.size();
243  int maxNumLayers = tibLayerIDs_.size();
244  int maxNumSides = tibSideIDs_.size();
245 
246  std::ostringstream ss;
247  ss << "determined following numbers for " << alignableObjectId_.idToString(align::TIBBarrel) << " geometry:"
248  << "\n"
249  << " max. number of modules: " << maxNumModules << "\n"
250  << " max. number of strings: " << maxNumStrings << "\n";
251 
252  for (size_t layer = 0; layer < tidStringsInnerLayer_.size(); ++layer) {
253  // divide by 2, because we have HalfShells
256 
257  ss << " strings in layer-" << layer << " (inside): " << tidStringsInnerLayer_[layer] << "\n"
258  << " strings in layer-" << layer << " (outside): " << tidStringsOuterLayer_[layer] << "\n";
259  }
260 
261  ss << " max. number of layers: " << maxNumLayers << "\n"
262  << " max. number of sides: " << maxNumSides;
263  edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildTIBAlignmentLevels" << ss.str();
264 
266  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBModule, maxNumModules, false));
267  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBString, maxNumStrings, true));
268  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBSurface, 2, false)); // 2 surfaces per half shell
269  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBHalfShell, 2, false)); // 2 half shells per layer
270  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBLayer, maxNumLayers, false));
271  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBHalfBarrel, 2, false));
272  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBBarrel, 1, false));
273  return tib;
274 }
275 
276 //_____________________________________________________________________________
278  int maxNumModules = tidModuleIDs_.size();
279  int maxNumRings = tidRingIDs_.size();
280  // TODO: for PhaseII geometry the method name for tidWheel changes:
281  // -> trackerTopology->tidDisk(detId);
282  int maxNumWheels = tidWheelIDs_.size();
283  int maxNumSides = tidSideIDs_.size();
284 
285  edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildTIDAlignmentLevels"
286  << "determined following numbers for "
288  << "\n"
289  << " max. number of modules: " << maxNumModules << "\n"
290  << " max. number of rings: " << maxNumRings << "\n"
291  << " max. number of wheels: " << maxNumWheels << "\n"
292  << " max. number of sides: " << maxNumSides;
293 
295  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDModule, maxNumModules, false));
296  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDSide, 2, false)); // 2 sides per ring
297  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDRing, maxNumRings, false));
298  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDDisk, maxNumWheels, false));
299  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDEndcap, 2, false)); // 2 endcaps in TID
300  return tid;
301 }
302 
303 //_____________________________________________________________________________
305  int maxNumModules = tobModuleIDs_.size();
306  int maxNumRods = tobRodIDs_.size();
307  int maxNumSides = tobSideIDs_.size();
308  int maxNumLayers = tobLayerIDs_.size();
309 
310  edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildTOBAlignmentLevels"
311  << "determined following numbers for "
313  << "\n"
314  << " max. number of modules: " << maxNumModules << "\n"
315  << " max. number of rods: " << maxNumRods << "\n"
316  << " max. number of sides: " << maxNumSides << "\n"
317  << " max. number of layers: " << maxNumLayers;
318 
320  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBModule, maxNumModules, false));
321  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBRod, maxNumRods, true));
322  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBLayer, maxNumLayers, false));
323  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBHalfBarrel, maxNumSides, false));
324  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBBarrel, 1, false));
325  return tob;
326 }
327 
328 //_____________________________________________________________________________
330  int maxNumModules = tecModuleIDs_.size();
331  int maxNumRings = tecRingIDs_.size();
332  int maxNumPetals = tecPetalIDs_.size();
333  int maxNumDisks = tecWheelIDs_.size();
334  int maxNumSides = tecSideIDs_.size();
335 
336  edm::LogInfo("AlignableBuildProcess") << "@SUB=TrackerAlignmentLevelBuilder::buildTECAlignmentLevels"
337  << "determined following numbers for "
339  << "\n"
340  << " max. number of modules: " << maxNumModules << "\n"
341  << " max. number of rings: " << maxNumRings << "\n"
342  << " max. number of petals: " << maxNumPetals << "\n"
343  << " max. number of wheels: " << maxNumDisks << "\n"
344  << " max. number of sides: " << maxNumSides;
345 
347  tec.push_back(std::make_unique<AlignmentLevel>(align::TECModule, maxNumModules, false));
348  tec.push_back(std::make_unique<AlignmentLevel>(align::TECRing, maxNumRings, true));
349  tec.push_back(std::make_unique<AlignmentLevel>(align::TECPetal, maxNumPetals, true));
350  tec.push_back(std::make_unique<AlignmentLevel>(align::TECSide, 2, false)); // 2 sides per disk
351  tec.push_back(std::make_unique<AlignmentLevel>(align::TECDisk, maxNumDisks, false));
352  tec.push_back(std::make_unique<AlignmentLevel>(align::TECEndcap, 2, false));
353  return tec;
354 }
unsigned int tecPetalNumber(const DetId &id) const
static constexpr auto TEC
unsigned int tobLayer(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
unsigned int tibSide(const DetId &id) const
std::vector< std::unique_ptr< AlignmentLevel > > AlignmentLevels
Definition: Utilities.h:33
unsigned int tobSide(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
align::AlignmentLevels buildTOBAlignmentLevels()
unsigned int tibOrder(const DetId &id) const
unsigned int tidSide(const DetId &id) const
std::map< unsigned int, unsigned int > pxbLaddersPerLayer_
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
unsigned int tibString(const DetId &id) const
std::vector< unsigned int > sphs_
Number of strings for each surface of a half shell.
align::AlignmentLevels buildPXEAlignmentLevels()
unsigned int pxbLadder(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
std::vector< align::AlignmentLevels > build()
unsigned int module(const DetId &id) const
unsigned int bpqd_
no. of blades per quarter disk
align::AlignmentLevels buildTIDAlignmentLevels()
unsigned int tecSide(const DetId &id) const
align::AlignmentLevels buildPXBAlignmentLevels()
unsigned int pxfDisk(const DetId &id) const
TrackerAlignmentLevelBuilder(const TrackerTopology *, const TrackerGeometry *)
constexpr uint16_t maxNumModules
std::map< unsigned int, unsigned int > tidStringsOuterLayer_
static constexpr auto TOB
const align::TrackerNameSpace & trackerNameSpace() const
unsigned int pxfPanel(const DetId &id) const
Log< level::Info, false > LogInfo
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
static constexpr auto TIB
const AlignableObjectId alignableObjectId_
std::map< unsigned int, unsigned int > tidStringsInnerLayer_
const char * idToString(align::StructureType type) const
std::vector< unsigned int > lpqc_
Number of ladders for each quarter cylinder.
unsigned int tobRod(const DetId &id) const
void addPXBDetUnitInfo(const DetId &detId)
align::AlignmentLevels buildTIBAlignmentLevels()
unsigned int tidRing(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
static constexpr auto TID
align::AlignmentLevels buildTECAlignmentLevels()
void addPXEDetUnitInfo(const DetId &detId)