27 trackerGeometry_(trackerGeometry),
28 trackerTopology_(trackerTopology),
31 trackerAlignmentLevelBuilder_(trackerTopology, trackerGeometry)
33 std::ostringstream ss;
35 switch (alignableObjectId_.geometry()) {
41 <<
"[AlignableTrackerBuilder] unknown version of TrackerGeometry";
45 <<
"@SUB=AlignableTrackerBuilder::AlignableTrackerBuilder" 46 <<
"GeometryVersion: " << ss.str();
56 buildAlignableDetUnits(update);
59 buildAlignableComposites(update);
64 buildPixelDetector(trackerAlignables);
66 buildStripDetector(trackerAlignables);
69 alignableMap_->get(
"Tracker").push_back(trackerAlignables);
85 convertGeomDetsToAlignables(
86 trackerGeometry_->detsPXB(), alignableObjectId_.idToString(
align::TPBModule),
91 convertGeomDetsToAlignables(
92 trackerGeometry_->detsPXF(), alignableObjectId_.idToString(
align::TPEModule),
97 convertGeomDetsToAlignables(
98 trackerGeometry_->detsTIB(), alignableObjectId_.idToString(
align::TIBModule),
103 convertGeomDetsToAlignables(
104 trackerGeometry_->detsTID(), alignableObjectId_.idToString(
align::TIDModule),
109 convertGeomDetsToAlignables(
110 trackerGeometry_->detsTOB(), alignableObjectId_.idToString(
align::TOBModule),
115 convertGeomDetsToAlignables(
116 trackerGeometry_->detsTEC(), alignableObjectId_.idToString(
align::TECModule),
128 auto& alignables = alignableMap_->get(moduleName);
129 if (!update) alignables.reserve(geomDets.size());
133 auto & aliUnits = alignableMap_->get(moduleName+
"Unit");
134 if (!update) aliUnits.reserve(geomDets.size());
136 for (
auto& geomDet : geomDets) {
137 int subdetId = geomDet->geographicalId().subdetId();
141 buildPixelDetectorAlignable(geomDet, subdetId, alignables, aliUnits, update);
149 buildStripDetectorAlignable(geomDet, subdetId, alignables, aliUnits, update);
153 <<
"[AlignableTrackerBuilder] GeomDet of unknown subdetector";
156 trackerAlignmentLevelBuilder_.addDetUnitInfo(geomDet->geographicalId());
165 <<
"@SUB=AlignableTrackerBuilder::convertGeomDetsToAlignables" 166 <<
"converted GeomDets to Alignables for " << moduleName <<
"\n" 167 <<
" GeomDets: " << geomDets.size() <<
"\n" 168 <<
" AlignableDetUnits: " << numDetUnits;
178 if (!geomDetUnit->
isLeaf()) {
180 <<
"[AlignableTrackerBuilder] Pixel GeomDet (subdetector " << subdetId
181 <<
") is not a GeomDetUnit.";
186 std::find_if(aliDets.cbegin(), aliDets.cend(),
187 [&geomDetUnit](
const auto&
i) {
189 if (ali != aliDets.end()) {
193 aliDetUnit->
update(geomDetUnit);
196 <<
"[AlignableTrackerBuilder::buildPixelDetectorAlignable] " 197 <<
"cast to 'AlignableDetUnit*' failed while it should not\n";
201 <<
"[AlignableTrackerBuilder::buildPixelDetectorAlignable] " 203 <<
" not found in current geometry.\n";
207 aliDetUnits.push_back(aliDets.back());
226 if (!detId.glued()) {
232 <<
"[AlignableTrackerBuilder] dynamic_cast<const GluedGeomDet*> " 239 std::find_if(aliDets.cbegin(), aliDets.cend(),
240 [&gluedGeomDet](
const auto&
i) {
242 if (ali != aliDets.end()) {
245 aliSiStripDet->
update(gluedGeomDet);
248 <<
"[AlignableTrackerBuilder::buildStripDetectorAlignable] " 249 <<
"cast to 'AlignableSiStripDet*' failed while it should not\n";
253 <<
"[AlignableTrackerBuilder::buildStripDetectorAlignable] " 255 <<
" not found in current geometry.\n";
260 const auto& addAliDetUnits = aliDets.back()->components();
261 const auto& nAddedUnits = addAliDetUnits.size();
265 aliDetUnits.reserve(aliDetUnits.size() + nAddedUnits -1);
266 aliDetUnits.insert(aliDetUnits.end(), addAliDetUnits.begin(), addAliDetUnits.end());
268 numDetUnits += nAddedUnits;
272 buildPixelDetectorAlignable(geomDet, subdetId, aliDets, aliDetUnits, update);
284 unsigned int numCompositeAlignables = 0;
289 auto trackerLevels = trackerAlignmentLevelBuilder_.build();
293 for (
auto& trackerSubLevels: trackerLevels) {
295 for (
auto&
level: trackerSubLevels) {
299 numCompositeAlignables += compositeBuilder.buildAll(*alignableMap_, update);
301 compositeBuilder.clearAlignmentLevels();
305 <<
"@SUB=AlignableTrackerBuilder::buildAlignableComposites" 306 <<
"AlignableComposites built for Tracker: " << numCompositeAlignables
307 <<
" (note: without Pixel- and Strip-Alignable)";
318 auto& pxbAlignables = alignableMap_->find(pxbName);
319 auto& pxeAlignables = alignableMap_->find(pxeName);
320 auto& pixelAlignables = alignableMap_->get (pixelName);
322 pixelAlignables.push_back(
326 pixelAlignables[0]->addComponent(pxbAlignables[0]);
327 pixelAlignables[0]->addComponent(pxeAlignables[0]);
328 pixelAlignables[0]->addComponent(pxeAlignables[1]);
333 <<
"@SUB=AlignableTrackerBuilder::buildPixelDetector" 334 <<
"Built " << pixelName <<
"-detector Alignable, consisting of Alignables" 335 <<
" of " << pxbName <<
" and " << pxeName;
348 auto& tibAlignables = alignableMap_->find(tibName);
349 auto& tidAlignables = alignableMap_->find(tidName);
350 auto& tobAlignables = alignableMap_->find(tobName);
351 auto& tecAlignables = alignableMap_->find(tecName);
352 auto& stripAlignables = alignableMap_->get (stripName);
354 stripAlignables.push_back(
358 stripAlignables[0]->addComponent(tibAlignables[0]);
359 stripAlignables[0]->addComponent(tidAlignables[0]);
360 stripAlignables[0]->addComponent(tidAlignables[1]);
361 stripAlignables[0]->addComponent(tobAlignables[0]);
362 stripAlignables[0]->addComponent(tecAlignables[0]);
363 stripAlignables[0]->addComponent(tecAlignables[1]);
368 <<
"@SUB=AlignableTrackerBuilder::buildStripDetector" 369 <<
"Built " << stripName <<
"-detector Alignable, consisting of Alignables" 370 <<
" of " << tibName <<
", " << tidName
371 <<
", " << tobName <<
" and " << tecName;
const Alignables & components() const override
Return vector of direct components.
void buildPixelDetectorAlignable(const GeomDet *, int subdetId, Alignables &aliDets, Alignables &aliDetUnits, bool update=false)
Converts GeomDetUnits of PXB and PXE to AlignableDetUnits.
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.
align::Alignables Alignables
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 *)
std::vector< const GeomDet * > DetContainer
void update(const GeomDet *geomDet, bool updateComponents=true)
void buildStripDetectorAlignable(const GeomDet *, int subdetId, Alignables &aliDets, Alignables &aliDetUnits, bool update=false)
void buildAlignables(AlignableTracker *, bool update=false)
void convertGeomDetsToAlignables(const TrackingGeometry::DetContainer &, const std::string &moduleName, bool update=false)
void buildAlignableComposites(bool update=false)
void addComponent(Alignable *component) final
void addAlignmentLevel(std::unique_ptr< AlignmentLevel > level)