28 trackerGeometry_(trackerGeometry),
29 trackerTopology_(trackerTopology),
32 trackerAlignmentLevelBuilder_(trackerTopology, trackerGeometry)
34 std::ostringstream ss;
36 switch (alignableObjectId_.geometry()) {
42 <<
"[AlignableTrackerBuilder] unknown version of TrackerGeometry";
46 <<
"@SUB=AlignableTrackerBuilder::AlignableTrackerBuilder" 47 <<
"GeometryVersion: " << ss.str();
57 buildAlignableDetUnits(update);
60 buildAlignableComposites(update);
65 buildPixelDetector(trackerAlignables);
67 buildStripDetector(trackerAlignables);
70 alignableMap_->get(
"Tracker").push_back(trackerAlignables);
86 convertGeomDetsToAlignables(
87 trackerGeometry_->detsPXB(), alignableObjectId_.idToString(
align::TPBModule),
92 convertGeomDetsToAlignables(
93 trackerGeometry_->detsPXF(), alignableObjectId_.idToString(
align::TPEModule),
98 convertGeomDetsToAlignables(
99 trackerGeometry_->detsTIB(), alignableObjectId_.idToString(
align::TIBModule),
104 convertGeomDetsToAlignables(
105 trackerGeometry_->detsTID(), alignableObjectId_.idToString(
align::TIDModule),
110 convertGeomDetsToAlignables(
111 trackerGeometry_->detsTOB(), alignableObjectId_.idToString(
align::TOBModule),
116 convertGeomDetsToAlignables(
117 trackerGeometry_->detsTEC(), alignableObjectId_.idToString(
align::TECModule),
129 auto& alignables = alignableMap_->get(moduleName);
130 if (!update) alignables.reserve(geomDets.size());
134 auto & aliUnits = alignableMap_->get(moduleName+
"Unit");
135 if (!update) aliUnits.reserve(geomDets.size());
137 for (
auto& geomDet : geomDets) {
138 int subdetId = geomDet->geographicalId().subdetId();
142 buildPixelDetectorAlignable(geomDet, subdetId, alignables, aliUnits, update);
150 buildStripDetectorAlignable(geomDet, subdetId, alignables, aliUnits, update);
154 <<
"[AlignableTrackerBuilder] GeomDet of unknown subdetector";
157 trackerAlignmentLevelBuilder_.addDetUnitInfo(geomDet->geographicalId());
166 <<
"@SUB=AlignableTrackerBuilder::convertGeomDetsToAlignables" 167 <<
"converted GeomDets to Alignables for " << moduleName <<
"\n" 168 <<
" GeomDets: " << geomDets.size() <<
"\n" 169 <<
" AlignableDetUnits: " << numDetUnits;
179 if (!geomDetUnit->
isLeaf()) {
181 <<
"[AlignableTrackerBuilder] Pixel GeomDet (subdetector " << subdetId
182 <<
") is not a GeomDetUnit.";
187 std::find_if(aliDets.cbegin(), aliDets.cend(),
188 [&geomDetUnit](
const auto&
i) {
190 if (ali != aliDets.end()) {
194 aliDetUnit->
update(geomDetUnit);
197 <<
"[AlignableTrackerBuilder::buildPixelDetectorAlignable] " 198 <<
"cast to 'AlignableDetUnit*' failed while it should not\n";
202 <<
"[AlignableTrackerBuilder::buildPixelDetectorAlignable] " 204 <<
" not found in current geometry.\n";
208 aliDetUnits.push_back(aliDets.back());
227 if (!detId.glued()) {
233 <<
"[AlignableTrackerBuilder] dynamic_cast<const GluedGeomDet*> " 240 std::find_if(aliDets.cbegin(), aliDets.cend(),
241 [&gluedGeomDet](
const auto&
i) {
243 if (ali != aliDets.end()) {
246 aliSiStripDet->
update(gluedGeomDet);
249 <<
"[AlignableTrackerBuilder::buildStripDetectorAlignable] " 250 <<
"cast to 'AlignableSiStripDet*' failed while it should not\n";
254 <<
"[AlignableTrackerBuilder::buildStripDetectorAlignable] " 256 <<
" not found in current geometry.\n";
261 const auto& addAliDetUnits = aliDets.back()->components();
262 const auto& nAddedUnits = addAliDetUnits.size();
266 aliDetUnits.reserve(aliDetUnits.size() + nAddedUnits -1);
267 aliDetUnits.insert(aliDetUnits.end(), addAliDetUnits.begin(), addAliDetUnits.end());
269 numDetUnits += nAddedUnits;
273 buildPixelDetectorAlignable(geomDet, subdetId, aliDets, aliDetUnits, update);
285 unsigned int numCompositeAlignables = 0;
290 auto trackerLevels = trackerAlignmentLevelBuilder_.build();
294 for (
auto& trackerSubLevels: trackerLevels) {
296 for (
auto&
level: trackerSubLevels) {
300 numCompositeAlignables += compositeBuilder.buildAll(*alignableMap_, update);
302 compositeBuilder.clearAlignmentLevels();
306 <<
"@SUB=AlignableTrackerBuilder::buildAlignableComposites" 307 <<
"AlignableComposites built for Tracker: " << numCompositeAlignables
308 <<
" (note: without Pixel- and Strip-Alignable)";
319 auto& pxbAlignables = alignableMap_->find(pxbName);
320 auto& pxeAlignables = alignableMap_->find(pxeName);
321 auto& pixelAlignables = alignableMap_->get (pixelName);
323 pixelAlignables.push_back(
327 pixelAlignables[0]->addComponent(pxbAlignables[0]);
328 pixelAlignables[0]->addComponent(pxeAlignables[0]);
329 pixelAlignables[0]->addComponent(pxeAlignables[1]);
334 <<
"@SUB=AlignableTrackerBuilder::buildPixelDetector" 335 <<
"Built " << pixelName <<
"-detector Alignable, consisting of Alignables" 336 <<
" of " << pxbName <<
" and " << pxeName;
349 auto& tibAlignables = alignableMap_->find(tibName);
350 auto& tidAlignables = alignableMap_->find(tidName);
351 auto& tobAlignables = alignableMap_->find(tobName);
352 auto& tecAlignables = alignableMap_->find(tecName);
353 auto& stripAlignables = alignableMap_->get (stripName);
355 stripAlignables.push_back(
359 stripAlignables[0]->addComponent(tibAlignables[0]);
360 stripAlignables[0]->addComponent(tidAlignables[0]);
361 stripAlignables[0]->addComponent(tidAlignables[1]);
362 stripAlignables[0]->addComponent(tobAlignables[0]);
363 stripAlignables[0]->addComponent(tecAlignables[0]);
364 stripAlignables[0]->addComponent(tecAlignables[1]);
369 <<
"@SUB=AlignableTrackerBuilder::buildStripDetector" 370 <<
"Built " << stripName <<
"-detector Alignable, consisting of Alignables" 371 <<
" of " << tibName <<
", " << tidName
372 <<
", " << tobName <<
" and " << tecName;
void buildPixelDetectorAlignable(const GeomDet *, int subdetId, Alignables &aliDets, Alignables &aliDetUnits, bool update=false)
Converts GeomDetUnits of PXB and PXE to AlignableDetUnits.
std::vector< Alignable * > Alignables
void buildPixelDetector(AlignableTracker *)
Builds the PixelDetector by hand.
AlignableMap alignableMap_
void update(const GeomDetUnit *geomDetUnit)
uint32_t rawId() const
get the raw id
std::string moduleName(Provenance const &provenance)
DetId geographicalId() const
The label of this GeomDet.
virtual bool isLeaf() const
is a Unit
void buildAlignableDetUnits(bool update=false)
Builds Alignables on module-level for each part of the tracker.
void buildStripDetector(AlignableTracker *)
Builds the StripDetector by hand.
virtual std::vector< const GeomDet * > components() const
Returns direct components, if any.
Detector identifier class for the strip tracker.
AlignableTrackerBuilder(const TrackerGeometry *, const TrackerTopology *)
void update(const GeomDet *geomDet, bool updateComponents=true)
void buildStripDetectorAlignable(const GeomDet *, int subdetId, Alignables &aliDets, Alignables &aliDetUnits, bool update=false)
virtual Alignables components() const
Return vector of direct components.
void buildAlignables(AlignableTracker *, bool update=false)
void convertGeomDetsToAlignables(const TrackingGeometry::DetContainer &, const std::string &moduleName, bool update=false)
std::vector< GeomDet const * > DetContainer
void buildAlignableComposites(bool update=false)
virtual void addComponent(Alignable *component)
void addAlignmentLevel(std::unique_ptr< AlignmentLevel > level)