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
10 
11 
12 
13 //=============================================================================
14 //=== PUBLIC METHOD IMPLEMENTATION ===
15 //=============================================================================
16 
17 //_____________________________________________________________________________
20  const TrackerGeometry* trackerGeometry) :
21  trackerTopology_(trackerTopology),
22  alignableObjectId_(trackerGeometry, nullptr, nullptr),
23  trackerNameSpace_(trackerTopology)
24 {
25 }
26 
27 //_____________________________________________________________________________
30 {
31 }
32 
33 //_____________________________________________________________________________
35 ::addDetUnitInfo(const DetId& detId)
36 {
37  int subdetId = detId.subdetId();
38 
39  switch (subdetId) {
42  case StripSubdetector::TIB: addTIBDetUnitInfo(detId); break;
43  case StripSubdetector::TID: addTIDDetUnitInfo(detId); break;
44  case StripSubdetector::TOB: addTOBDetUnitInfo(detId); break;
45  case StripSubdetector::TEC: addTECDetUnitInfo(detId); break;
46  }
47 }
48 
49 //_____________________________________________________________________________
50 std::vector<align::AlignmentLevels> TrackerAlignmentLevelBuilder
52 {
53  std::vector<align::AlignmentLevels> levels;
54  levels.push_back(buildPXBAlignmentLevels());
55  levels.push_back(buildPXEAlignmentLevels());
56  levels.push_back(buildTIBAlignmentLevels());
57  levels.push_back(buildTIDAlignmentLevels());
58  levels.push_back(buildTOBAlignmentLevels());
59  levels.push_back(buildTECAlignmentLevels());
60  levelsBuilt_ = true;
61  return levels;
62 }
63 
64 
65 //______________________________________________________________________________
68  if (levelsBuilt_) {
69  return trackerNameSpace_;
70  } else {
71  throw cms::Exception("LogicError")
72  << "@SUB=TrackerAlignmentLevelBuilder::trackerNameSpace\n"
73  << "trying to get the name space before it has been properly initialized;"
74  << " please call TrackerAlignmentLevelBuilder::build() first";
75  }
76 }
77 
78 
79 
80 //=============================================================================
81 //=== PRIVATE METHOD IMPLEMENTATION ===
82 //=============================================================================
83 
84 //_____________________________________________________________________________
87 {
88  auto layerID = trackerTopology_->pxbLayer(detId);
89  auto ladderID = trackerTopology_->pxbLadder(detId);
90  auto moduleID = trackerTopology_->module(detId);
91 
92  if (pxbLaddersPerLayer_[layerID-1] < ladderID) {
93  pxbLaddersPerLayer_[layerID-1] = ladderID;
94  }
95 
96  pxbLayerIDs_. insert(layerID);
97  pxbLadderIDs_.insert(ladderID);
98  pxbModuleIDs_.insert(moduleID);
99 }
100 
101 //_____________________________________________________________________________
104 {
105  auto sideID = trackerTopology_->pxfSide(detId);
106  auto diskID = trackerTopology_->pxfDisk(detId);
107  auto bladeID = trackerTopology_->pxfBlade(detId);
108  auto panelID = trackerTopology_->pxfPanel(detId);
109  auto moduleID = trackerTopology_->module(detId);
110 
111  pxeSideIDs_. insert(sideID);
112  pxeDiskIDs_. insert(diskID);
113  pxeBladeIDs_. insert(bladeID);
114  pxePanelIDs_. insert(panelID);
115  pxeModuleIDs_.insert(moduleID);
116 }
117 
118 //_____________________________________________________________________________
121 {
122  auto sideID = trackerTopology_->tibSide(detId);
123  auto layerID = trackerTopology_->tibLayer(detId);
124  auto layerSide = trackerTopology_->tibOrder(detId);
125  auto stringID = trackerTopology_->tibString(detId);
126  auto moduleID = trackerTopology_->module(detId);
127 
128  if (layerSide == 1) {
129  if (tidStringsInnerLayer_[layerID-1] < stringID) {
130  tidStringsInnerLayer_[layerID-1] = stringID;
131  }
132  } else {
133  if (tidStringsOuterLayer_[layerID-1] < stringID) {
134  tidStringsOuterLayer_[layerID-1] = stringID;
135  }
136  }
137 
138  tibSideIDs_. insert(sideID);
139  tibLayerIDs_. insert(layerID);
140  tibStringIDs_.insert(stringID);
141  tibModuleIDs_.insert(moduleID);
142 }
143 
144 //_____________________________________________________________________________
147 {
148  auto sideID = trackerTopology_->tidSide(detId);
149  auto wheelID = trackerTopology_->tidWheel(detId);
150  auto ringID = trackerTopology_->tidRing(detId);
151  auto moduleID = trackerTopology_->module(detId);
152 
153  // tidOrder
154  tidSideIDs_. insert(sideID);
155  tidWheelIDs_. insert(wheelID);
156  tidRingIDs_. insert(ringID);
157  tidModuleIDs_.insert(moduleID);
158 }
159 
160 //_____________________________________________________________________________
163 {
164  auto layerID = trackerTopology_->tobLayer(detId);
165  auto sideID = trackerTopology_->tobSide(detId);
166  auto rodID = trackerTopology_->tobRod(detId);
167  auto moduleID = trackerTopology_->module(detId);
168 
169  tobLayerIDs_. insert(layerID);
170  tobSideIDs_. insert(sideID);
171  tobRodIDs_. insert(rodID);
172  tobModuleIDs_.insert(moduleID);
173 }
174 
175 //_____________________________________________________________________________
178 {
179  auto sideID = trackerTopology_->tecSide(detId);
180  auto wheelID = trackerTopology_->tecWheel(detId);
181  auto petalID = trackerTopology_->tecPetalNumber(detId);
182  auto ringID = trackerTopology_->tecRing(detId);
183  auto moduleID = trackerTopology_->module(detId);
184 
185  tecSideIDs_. insert(sideID);
186  tecWheelIDs_. insert(wheelID);
187  tecPetalIDs_. insert(petalID);
188  tecRingIDs_. insert(ringID);
189  tecModuleIDs_.insert(moduleID);
190 }
191 
192 
193 
194 //_____________________________________________________________________________
197 {
198  int maxNumModules = pxbModuleIDs_.size();
199  int maxNumLadders = pxbLadderIDs_.size() / 2; // divide by 2 since we have
200  // HalfBarrels
201  int maxNumLayers = pxbLayerIDs_.size();
202 
203  std::ostringstream ss;
204  ss << "determined following numbers for "
205  << alignableObjectId_.idToString(align::TPBBarrel) << " geometry:" << "\n"
206  << " max. number of modules: " << maxNumModules << "\n"
207  << " max. number of ladders: " << maxNumLadders << "\n";
208 
209  for (size_t layer = 0; layer < pxbLaddersPerLayer_.size(); ++layer) {
210  // divide by 4, because we need the ladders per quarter cylinder
211  trackerNameSpace_.tpb_.lpqc_.push_back(pxbLaddersPerLayer_[layer] / 4);
212  ss << " ladders in layer-" << layer << ": "
213  << pxbLaddersPerLayer_[layer] << "\n";
214  }
215 
216  ss << " max. number of layers: " << maxNumLayers;
217  edm::LogInfo("AlignableBuildProcess")
218  << "@SUB=TrackerAlignmentLevelBuilder::buildPXBAlignmentLevels"
219  << ss.str();
220 
222  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBModule, maxNumModules, false));
223  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBLadder, maxNumLadders, true));
224  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBLayer, maxNumLayers, false));
225  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBHalfBarrel, 2, false));
226  pxb.push_back(std::make_unique<AlignmentLevel>(align::TPBBarrel, 1, false));
227  return pxb;
228 }
229 
230 //_____________________________________________________________________________
233 {
234  int maxNumModules = pxeModuleIDs_.size();
235  int maxNumPanels = pxePanelIDs_.size();
236  int maxNumBlades = pxeBladeIDs_.size() / 2;
237  int maxNumDisks = pxeDiskIDs_.size();
238  int maxNumSides = pxeSideIDs_.size();
239 
240  std::ostringstream ss;
241  ss << "determined following numbers for "
242  << alignableObjectId_.idToString(align::TPEEndcap) << " geometry:" << "\n"
243  << " max. number of modules: " << maxNumModules << "\n"
244  << " max. number of panels: " << maxNumPanels << "\n"
245  << " max. number of blades: " << maxNumBlades << "\n";
246 
247  trackerNameSpace_.tpe_.bpqd_ = maxNumBlades / 2;
248 
249  ss << " blades per quarter disk: " << trackerNameSpace_.tpe_.bpqd_ << "\n"
250  << " max. number of disks: " << maxNumDisks << "\n"
251  << " max. number of sides: " << maxNumSides;
252  edm::LogInfo("AlignableBuildProcess")
253  << "@SUB=TrackerAlignmentLevelBuilder::buildPXEAlignmentLevels"
254  << ss.str();
255 
257  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEModule, maxNumModules, false));
258  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEPanel, maxNumPanels, true));
259  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEBlade, maxNumBlades, true));
260  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEHalfDisk, maxNumDisks, false));
261  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEHalfCylinder, 2, false));
262  pxe.push_back(std::make_unique<AlignmentLevel>(align::TPEEndcap, maxNumSides, false));
263  return pxe;
264 }
265 
266 //_____________________________________________________________________________
269 {
270  int maxNumModules = tibModuleIDs_.size();
271  int maxNumStrings = tibStringIDs_.size();
272  int maxNumLayers = tibLayerIDs_.size();
273  int maxNumSides = tibSideIDs_.size();
274 
275  std::ostringstream ss;
276  ss << "determined following numbers for "
277  << alignableObjectId_.idToString(align::TIBBarrel) << " geometry:" << "\n"
278  << " max. number of modules: " << maxNumModules << "\n"
279  << " max. number of strings: " << maxNumStrings << "\n";
280 
281  for (size_t layer = 0; layer < tidStringsInnerLayer_.size(); ++layer) {
282  // divide by 2, because we have HalfShells
283  trackerNameSpace_.tib_.sphs_.push_back(tidStringsInnerLayer_[layer] / 2);
284  trackerNameSpace_.tib_.sphs_.push_back(tidStringsOuterLayer_[layer] / 2);
285 
286  ss << " strings in layer-" << layer << " (inside): "
287  << tidStringsInnerLayer_[layer] << "\n"
288  << " strings in layer-" << layer << " (outside): "
289  << tidStringsOuterLayer_[layer] << "\n";
290  }
291 
292  ss << " max. number of layers: " << maxNumLayers << "\n"
293  << " max. number of sides: " << maxNumSides;
294  edm::LogInfo("AlignableBuildProcess")
295  << "@SUB=TrackerAlignmentLevelBuilder::buildTIBAlignmentLevels"
296  << ss.str();
297 
299  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBModule, maxNumModules, false));
300  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBString, maxNumStrings, true));
301  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBSurface, 2, false)); // 2 surfaces per half shell
302  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBHalfShell, 2, false)); // 2 half shells per layer
303  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBLayer, maxNumLayers, false));
304  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBHalfBarrel, 2, false));
305  tib.push_back(std::make_unique<AlignmentLevel>(align::TIBBarrel, 1, false));
306  return tib;
307 }
308 
309 //_____________________________________________________________________________
312 {
313  int maxNumModules = tidModuleIDs_.size();
314  int maxNumRings = tidRingIDs_.size();
315  // TODO: for PhaseII geometry the method name for tidWheel changes:
316  // -> trackerTopology->tidDisk(detId);
317  int maxNumWheels = tidWheelIDs_.size();
318  int maxNumSides = tidSideIDs_.size();
319 
320  edm::LogInfo("AlignableBuildProcess")
321  << "@SUB=TrackerAlignmentLevelBuilder::buildTIDAlignmentLevels"
322  << "determined following numbers for "
323  << alignableObjectId_.idToString(align::TIDEndcap) << " geometry:" << "\n"
324  << " max. number of modules: " << maxNumModules << "\n"
325  << " max. number of rings: " << maxNumRings << "\n"
326  << " max. number of wheels: " << maxNumWheels << "\n"
327  << " max. number of sides: " << maxNumSides;
328 
330  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDModule, maxNumModules, false));
331  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDSide, 2, false)); // 2 sides per ring
332  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDRing, maxNumRings, false));
333  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDDisk, maxNumWheels, false));
334  tid.push_back(std::make_unique<AlignmentLevel>(align::TIDEndcap, 2, false)); // 2 endcaps in TID
335  return tid;
336 }
337 
338 //_____________________________________________________________________________
341 {
342  int maxNumModules = tobModuleIDs_.size();
343  int maxNumRods = tobRodIDs_.size();
344  int maxNumSides = tobSideIDs_.size();
345  int maxNumLayers = tobLayerIDs_.size();
346 
347  edm::LogInfo("AlignableBuildProcess")
348  << "@SUB=TrackerAlignmentLevelBuilder::buildTOBAlignmentLevels"
349  << "determined following numbers for "
350  << alignableObjectId_.idToString(align::TOBBarrel) << " geometry:" << "\n"
351  << " max. number of modules: " << maxNumModules << "\n"
352  << " max. number of rods: " << maxNumRods << "\n"
353  << " max. number of sides: " << maxNumSides << "\n"
354  << " max. number of layers: " << maxNumLayers;
355 
357  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBModule, maxNumModules, false));
358  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBRod, maxNumRods, true));
359  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBLayer, maxNumLayers, false));
360  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBHalfBarrel, maxNumSides, false));
361  tob.push_back(std::make_unique<AlignmentLevel>(align::TOBBarrel, 1, false));
362  return tob;
363 }
364 
365 //_____________________________________________________________________________
368 {
369  int maxNumModules = tecModuleIDs_.size();
370  int maxNumRings = tecRingIDs_.size();
371  int maxNumPetals = tecPetalIDs_.size();
372  int maxNumDisks = tecWheelIDs_.size();
373  int maxNumSides = tecSideIDs_.size();
374 
375  edm::LogInfo("AlignableBuildProcess")
376  << "@SUB=TrackerAlignmentLevelBuilder::buildTECAlignmentLevels"
377  << "determined following numbers for "
378  << alignableObjectId_.idToString(align::TECEndcap) << " geometry:" << "\n"
379  << " max. number of modules: " << maxNumModules << "\n"
380  << " max. number of rings: " << maxNumRings << "\n"
381  << " max. number of petals: " << maxNumPetals << "\n"
382  << " max. number of wheels: " << maxNumDisks << "\n"
383  << " max. number of sides: " << maxNumSides;
384 
386  tec.push_back(std::make_unique<AlignmentLevel>(align::TECModule, maxNumModules, false));
387  tec.push_back(std::make_unique<AlignmentLevel>(align::TECRing, maxNumRings, true));
388  tec.push_back(std::make_unique<AlignmentLevel>(align::TECPetal, maxNumPetals, true));
389  tec.push_back(std::make_unique<AlignmentLevel>(align::TECSide, 2, false)); // 2 sides per disk
390  tec.push_back(std::make_unique<AlignmentLevel>(align::TECDisk, maxNumDisks, false));
391  tec.push_back(std::make_unique<AlignmentLevel>(align::TECEndcap, 2, false));
392  return tec;
393 }
std::vector< std::unique_ptr< AlignmentLevel > > AlignmentLevels
Definition: Utilities.h:33
unsigned int tibLayer(const DetId &id) const
unsigned int tibString(const DetId &id) const
unsigned int tidRing(const DetId &id) const
align::AlignmentLevels buildTOBAlignmentLevels()
std::map< unsigned int, unsigned int > pxbLaddersPerLayer_
unsigned int pxfDisk(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
unsigned int pxbLadder(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
std::vector< unsigned int > sphs_
Number of strings for each surface of a half shell.
align::AlignmentLevels buildPXEAlignmentLevels()
#define nullptr
std::vector< align::AlignmentLevels > build()
unsigned int module(const DetId &id) const
unsigned int bpqd_
no. of blades per quarter disk
unsigned int tibSide(const DetId &id) const
unsigned int tidSide(const DetId &id) const
const align::TrackerNameSpace & trackerNameSpace() const
align::AlignmentLevels buildTIDAlignmentLevels()
unsigned int tobSide(const DetId &id) const
align::AlignmentLevels buildPXBAlignmentLevels()
TrackerAlignmentLevelBuilder(const TrackerTopology *, const TrackerGeometry *)
std::map< unsigned int, unsigned int > tidStringsOuterLayer_
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
unsigned int pxbLayer(const DetId &id) const
Definition: DetId.h:18
const AlignableObjectId alignableObjectId_
const char * idToString(align::StructureType type) const
std::map< unsigned int, unsigned int > tidStringsInnerLayer_
std::vector< unsigned int > lpqc_
Number of ladders for each quarter cylinder.
void addPXBDetUnitInfo(const DetId &detId)
align::AlignmentLevels buildTIBAlignmentLevels()
unsigned int pxfSide(const DetId &id) const
unsigned int tecPetalNumber(const DetId &id) const
unsigned int tobRod(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
align::AlignmentLevels buildTECAlignmentLevels()
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
unsigned int tibOrder(const DetId &id) const