CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
AlignableTrackerBuilder Class Reference

#include <AlignableTrackerBuilder.h>

Public Member Functions

 AlignableTrackerBuilder (const TrackerGeometry *, const TrackerTopology *)
 
void buildAlignables (AlignableTracker *)
 
const AlignableObjectIdobjectIdProvider () const
 Return tracker alignable object ID provider derived from the tracker's geometry. More...
 
const align::TrackerNameSpacetrackerNameSpace () const
 Return tracker name space derived from the tracker's topology. More...
 
virtual ~AlignableTrackerBuilder ()=default
 

Private Member Functions

void buildAlignableComposites ()
 
void buildAlignableDetUnits ()
 Builds Alignables on module-level for each part of the tracker. More...
 
void buildPixelDetector (AlignableTracker *)
 Builds the PixelDetector by hand. More...
 
void buildPixelDetectorAlignable (const GeomDet *, int subdetId, Alignables &aliDets, Alignables &aliDetUnits)
 Converts GeomDetUnits of PXB and PXE to AlignableDetUnits. More...
 
void buildStripDetector (AlignableTracker *)
 Builds the StripDetector by hand. More...
 
void buildStripDetectorAlignable (const GeomDet *, int subdetId, Alignables &aliDets, Alignables &aliDetUnits)
 
void convertGeomDetsToAlignables (const TrackingGeometry::DetContainer &, const std::string &moduleName)
 

Private Attributes

AlignableMapalignableMap
 
const AlignableObjectId alignableObjectId_
 
int numDetUnits = 0
 
TrackerAlignmentLevelBuilder trackerAlignmentLevelBuilder_
 
const TrackerGeometrytrackerGeometry
 
const TrackerTopologytrackerTopology
 

Detailed Description

Definition at line 18 of file AlignableTrackerBuilder.h.

Constructor & Destructor Documentation

AlignableTrackerBuilder::AlignableTrackerBuilder ( const TrackerGeometry trackerGeometry,
const TrackerTopology trackerTopology 
)

Definition at line 26 of file AlignableTrackerBuilder.cc.

References Exception, AlignableObjectId::PhaseI, AlignableObjectId::PhaseII, AlignableObjectId::RunI, and contentValuesCheck::ss.

27  :
28  trackerGeometry(trackerGeometry),
29  trackerTopology(trackerTopology),
30  alignableObjectId_(trackerGeometry, nullptr, nullptr),
31  alignableMap(nullptr),
32  trackerAlignmentLevelBuilder_(trackerTopology, trackerGeometry)
33 {
34  std::ostringstream ss;
35 
36  switch (alignableObjectId_.geometry()) {
37  case AlignableObjectId::Geometry::RunI: ss << "RunI geometry"; break;
38  case AlignableObjectId::Geometry::PhaseI: ss << "PhaseI geometry"; break;
39  case AlignableObjectId::Geometry::PhaseII: ss << "PhaseII geometry"; break;
40  default:
41  throw cms::Exception("LogicError")
42  << "[AlignableTrackerBuilder] unknown version of TrackerGeometry";
43  }
44 
45  edm::LogInfo("AlignableBuildProcess")
46  << "@SUB=AlignableTrackerBuilder::AlignableTrackerBuilder"
47  << "GeometryVersion: " << ss.str();
48 }
const TrackerGeometry * trackerGeometry
Geometry geometry() const
retrieve the geometry information
const AlignableObjectId alignableObjectId_
TrackerAlignmentLevelBuilder trackerAlignmentLevelBuilder_
const TrackerTopology * trackerTopology
virtual AlignableTrackerBuilder::~AlignableTrackerBuilder ( )
virtualdefault

Member Function Documentation

void AlignableTrackerBuilder::buildAlignableComposites ( )
private

Builds all composite Alignables for the tracker. The hierarchy and numbers of components are determined in TrackerAlignmentLevelBuilder.

Definition at line 224 of file AlignableTrackerBuilder.cc.

References AlignableCompositeBuilder::addAlignmentLevel(), testEve_cfg::level, and eostools::move().

225 {
226  unsigned int numCompositeAlignables = 0;
227 
228  // tracker levels must be built before the indexer is created in order to pass
229  // a valid namespace to the indexer; an exception would be thrown if one tries
230  // to get the namespace w/o building the levels
231  auto trackerLevels = trackerAlignmentLevelBuilder_.build();
233  AlignableCompositeBuilder compositeBuilder{trackerTopology, trackerGeometry, trackerIndexer};
234 
235  for (auto& trackerSubLevels: trackerLevels) {
236  // first add all levels of the current subdetector to the builder
237  for (auto& level: trackerSubLevels) {
238  compositeBuilder.addAlignmentLevel(std::move(level));
239  }
240  // now build this tracker-level
241  numCompositeAlignables += compositeBuilder.buildAll(*alignableMap);
242  // finally, reset the builder
243  compositeBuilder.clearAlignmentLevels();
244  }
245 
246  edm::LogInfo("AlignableBuildProcess")
247  << "@SUB=AlignableTrackerBuilder::buildAlignableComposites"
248  << "AlignableComposites built for Tracker: " << numCompositeAlignables
249  << " (note: without Pixel- and Strip-Alignable)";
250 }
std::vector< align::AlignmentLevels > build()
const align::TrackerNameSpace & trackerNameSpace() const
def move
Definition: eostools.py:510
const TrackerGeometry * trackerGeometry
TrackerAlignmentLevelBuilder trackerAlignmentLevelBuilder_
tuple level
Definition: testEve_cfg.py:34
const TrackerTopology * trackerTopology
void AlignableTrackerBuilder::buildAlignableDetUnits ( )
private

Builds Alignables on module-level for each part of the tracker.

Definition at line 80 of file AlignableTrackerBuilder.cc.

References align::TECModule, align::TIBModule, align::TIDModule, align::TOBModule, align::TPBModule, and align::TPEModule.

81 {
82  // PixelBarrel
85  );
86 
87  // PixelEndcap
90  );
91 
92  // TIB
95  );
96 
97  // TID
100  );
101 
102  // TOB
105  );
106 
107  // TEC
110  );
111 }
const DetContainer & detsTEC() const
const DetContainer & detsPXB() const
const TrackerGeometry * trackerGeometry
const AlignableObjectId alignableObjectId_
void convertGeomDetsToAlignables(const TrackingGeometry::DetContainer &, const std::string &moduleName)
const DetContainer & detsTIB() const
const char * idToString(align::StructureType type) const
const DetContainer & detsPXF() const
const DetContainer & detsTOB() const
const DetContainer & detsTID() const
void AlignableTrackerBuilder::buildAlignables ( AlignableTracker trackerAlignables)

Builds all Alignables (units and composites) of the tracker, based on the given TrackerGeometry.

Definition at line 52 of file AlignableTrackerBuilder.cc.

References AlignableTracker::alignableMap, AlignableComposite::components(), and Alignable::theId.

Referenced by AlignableTracker::AlignableTracker().

53 {
54  alignableMap = &trackerAlignables->alignableMap;
55 
56  // first, build Alignables on module-level (AlignableDetUnits)
58  // now build the composite Alignables (Ladders, Layers etc.)
60 
61  // create pixel-detector
62  buildPixelDetector(trackerAlignables);
63  // create strip-detector
64  buildStripDetector(trackerAlignables);
65 
66  // tracker itself is of course also an Alignable
67  alignableMap->get("Tracker").push_back(trackerAlignables);
68  // id is the id of first component (should be TPBBarrel)
69  trackerAlignables->theId = trackerAlignables->components()[0]->id();
70 }
void buildPixelDetector(AlignableTracker *)
Builds the PixelDetector by hand.
void buildAlignableDetUnits()
Builds Alignables on module-level for each part of the tracker.
Alignables & get(const std::string &name="")
Definition: AlignableMap.cc:9
void buildStripDetector(AlignableTracker *)
Builds the StripDetector by hand.
virtual Alignables components() const
Return vector of direct components.
align::ID theId
Definition: Alignable.h:225
AlignableMap alignableMap
void AlignableTrackerBuilder::buildPixelDetector ( AlignableTracker trackerAlignables)
private

Builds the PixelDetector by hand.

Definition at line 254 of file AlignableTrackerBuilder.cc.

References AlignableComposite::addComponent(), align::Pixel, AlCaHLTBitMon_QueryRunRegistry::string, align::TPBBarrel, and align::TPEEndcap.

255 {
259 
260  auto& pxbAlignables = alignableMap->find(pxbName);
261  auto& pxeAlignables = alignableMap->find(pxeName);
262  auto& pixelAlignables = alignableMap->get (pixelName);
263 
264  pixelAlignables.push_back(
265  new AlignableComposite(pxbAlignables[0]->id(), align::Pixel, align::RotationType())
266  );
267 
268  pixelAlignables[0]->addComponent(pxbAlignables[0]);
269  pixelAlignables[0]->addComponent(pxeAlignables[0]);
270  pixelAlignables[0]->addComponent(pxeAlignables[1]);
271 
272  trackerAlignables->addComponent(pixelAlignables[0]);
273 
274  edm::LogInfo("AlignableBuildProcess")
275  << "@SUB=AlignableTrackerBuilder::buildPixelDetector"
276  << "Built " << pixelName << "-detector Alignable, consisting of Alignables"
277  << " of " << pxbName << " and " << pxeName;
278 }
Alignables & get(const std::string &name="")
Definition: AlignableMap.cc:9
const AlignableObjectId alignableObjectId_
Alignables & find(const std::string &name="")
Definition: AlignableMap.cc:15
const char * idToString(align::StructureType type) const
virtual void addComponent(Alignable *component)
void AlignableTrackerBuilder::buildPixelDetectorAlignable ( const GeomDet geomDetUnit,
int  subdetId,
Alignables aliDets,
Alignables aliDetUnits 
)
private

Converts GeomDetUnits of PXB and PXE to AlignableDetUnits.

Definition at line 165 of file AlignableTrackerBuilder.cc.

References align::AlignableDetUnit, Exception, and GeomDet::isLeaf().

167 {
168  // treat all pixel dets in same way with one AlignableDetUnit
169  if (!geomDetUnit->isLeaf()) {
170  throw cms::Exception("BadHierarchy")
171  << "[AlignableTrackerBuilder] Pixel GeomDet (subdetector " << subdetId
172  << ") is not a GeomDetUnit.";
173  }
174 
175  aliDets.push_back(new AlignableDetUnit(geomDetUnit));
176  aliDetUnits.push_back(aliDets.back());
177  numDetUnits += 1;
178 }
virtual bool isLeaf() const
is a Unit
Definition: GeomDet.h:85
void AlignableTrackerBuilder::buildStripDetector ( AlignableTracker trackerAlignables)
private

Builds the StripDetector by hand.

Definition at line 282 of file AlignableTrackerBuilder.cc.

References AlignableComposite::addComponent(), AlCaHLTBitMon_QueryRunRegistry::string, align::Strip, align::TECEndcap, align::TIBBarrel, align::TIDEndcap, and align::TOBBarrel.

283 {
289 
290  auto& tibAlignables = alignableMap->find(tibName);
291  auto& tidAlignables = alignableMap->find(tidName);
292  auto& tobAlignables = alignableMap->find(tobName);
293  auto& tecAlignables = alignableMap->find(tecName);
294  auto& stripAlignables = alignableMap->get (stripName);
295 
296  stripAlignables.push_back(
297  new AlignableComposite(tibAlignables[0]->id(), align::Strip, align::RotationType())
298  );
299 
300  stripAlignables[0]->addComponent(tibAlignables[0]);
301  stripAlignables[0]->addComponent(tidAlignables[0]);
302  stripAlignables[0]->addComponent(tidAlignables[1]);
303  stripAlignables[0]->addComponent(tobAlignables[0]);
304  stripAlignables[0]->addComponent(tecAlignables[0]);
305  stripAlignables[0]->addComponent(tecAlignables[1]);
306 
307  trackerAlignables->addComponent(stripAlignables[0]);
308 
309  edm::LogInfo("AlignableBuildProcess")
310  << "@SUB=AlignableTrackerBuilder::buildStripDetector"
311  << "Built " << stripName << "-detector Alignable, consisting of Alignables"
312  << " of " << tibName << ", " << tidName
313  << ", " << tobName << " and " << tecName;
314 }
Alignables & get(const std::string &name="")
Definition: AlignableMap.cc:9
const AlignableObjectId alignableObjectId_
Alignables & find(const std::string &name="")
Definition: AlignableMap.cc:15
const char * idToString(align::StructureType type) const
virtual void addComponent(Alignable *component)
void AlignableTrackerBuilder::buildStripDetectorAlignable ( const GeomDet geomDet,
int  subdetId,
Alignables aliDets,
Alignables aliDetUnits 
)
private

Converts GeomDets of TIB, TID, TOB and TEC either to AlignableDetUnits or AlignableSiStripDet, depending on the module-type (2D or 1D).

Definition at line 182 of file AlignableTrackerBuilder.cc.

References GeomDet::components(), Exception, and GeomDet::geographicalId().

184 {
185  // In strip we have:
186  // 1) 'Pure' 1D-modules like TOB layers 3-6 (not glued): AlignableDetUnit
187  // 2) Composite 2D-modules like TOB layers 1&2 (not glued): AlignableDet
188  // 3) The two 1D-components of case 2 (glued): AlignableDetUnit that is constructed
189  // inside AlignableDet-constructor of 'mother', only need to add to alignableLists
190  const SiStripDetId detId(geomDet->geographicalId());
191 
192  // 2D- or 'pure' 1D-module
193  if (!detId.glued()) {
194  if (geomDet->components().size()) {
195  // 2D-module, convert it to GluedGeomDet
196  const GluedGeomDet* gluedGeomDet = dynamic_cast<const GluedGeomDet*>(geomDet);
197  if (!gluedGeomDet) {
198  throw cms::Exception("LogicError")
199  << "[AlignableTrackerBuilder] dynamic_cast<const GluedGeomDet*> "
200  << "failed.";
201  }
202 
203  // components (AlignableDetUnits) constructed within
204  aliDets.push_back(new AlignableSiStripDet(gluedGeomDet));
205  const auto& addAliDetUnits = aliDets.back()->components();
206  const auto& nAddedUnits = addAliDetUnits.size();
207  // reserve space for the additional units:
208  aliDetUnits.reserve(aliDetUnits.size() + nAddedUnits -1);
209  aliDetUnits.insert(aliDetUnits.end(), addAliDetUnits.begin(), addAliDetUnits.end());
210  numDetUnits += nAddedUnits;
211 
212  } else {
213  // no components: pure 1D-module
214  buildPixelDetectorAlignable(geomDet, subdetId, aliDets, aliDetUnits);
215  }
216  } // no else: glued components of AlignableDet constructed within
217  // AlignableSiStripDet -> AlignableDet, see above
218 }
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
virtual std::vector< const GeomDet * > components() const
Returns direct components, if any.
Definition: GeomDet.h:88
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
void buildPixelDetectorAlignable(const GeomDet *, int subdetId, Alignables &aliDets, Alignables &aliDetUnits)
Converts GeomDetUnits of PXB and PXE to AlignableDetUnits.
void AlignableTrackerBuilder::convertGeomDetsToAlignables ( const TrackingGeometry::DetContainer geomDets,
const std::string &  moduleName 
)
private

Decides whether a GeomDet is from Pixel- or Strip-Detector and calls the according method to build the Alignable.

Definition at line 115 of file AlignableTrackerBuilder.cc.

References Exception, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, and SiStripDetId::TOB.

117 {
118  numDetUnits = 0;
119 
120  auto& alignables = alignableMap->get(moduleName);
121  alignables.reserve(geomDets.size());
122 
123  // units are added for each moduleName, which are at moduleName + "Unit"
124  // in the pixel Module and ModuleUnit are equivalent
125  auto & aliUnits = alignableMap->get(moduleName+"Unit");
126  aliUnits.reserve(geomDets.size()); // minimal number space needed
127 
128  for (auto& geomDet : geomDets) {
129  int subdetId = geomDet->geographicalId().subdetId(); //don't check det()==Tracker
130 
131  if (subdetId == PixelSubdetector::PixelBarrel ||
132  subdetId == PixelSubdetector::PixelEndcap) {
133  buildPixelDetectorAlignable(geomDet, subdetId, alignables, aliUnits);
134 
135  } else if (subdetId == SiStripDetId::TIB ||
136  subdetId == SiStripDetId::TID ||
137  subdetId == SiStripDetId::TOB ||
138  subdetId == SiStripDetId::TEC) {
139  // for strip we create also <TIB/TID/TOB/TEC>ModuleUnit list
140  // for 1D components of 2D layers
141  buildStripDetectorAlignable(geomDet, subdetId, alignables, aliUnits);
142 
143  } else {
144  throw cms::Exception("LogicError")
145  << "[AlignableTrackerBuilder] GeomDet of unknown subdetector";
146  }
147 
148  trackerAlignmentLevelBuilder_.addDetUnitInfo(geomDet->geographicalId());
149  }
150 
151  // JFI: For PXB and PXE we exclusively build AlignableDetUnit, hence
152  // alignables.size() and numDetUnits are equal. But for modules in Strip
153  // we also create AlignableSiStripDets, which consist of multiple
154  // AlignableDetUnits, hence alignables.size() and numDetUnits are not equal.
155 
156  edm::LogInfo("AlignableBuildProcess")
157  << "@SUB=AlignableTrackerBuilder::convertGeomDetsToAlignables"
158  << "converted GeomDets to Alignables for " << moduleName << "\n"
159  << " GeomDets: " << geomDets.size() << "\n"
160  << " AlignableDetUnits: " << numDetUnits;
161 }
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
void buildStripDetectorAlignable(const GeomDet *, int subdetId, Alignables &aliDets, Alignables &aliDetUnits)
Alignables & get(const std::string &name="")
Definition: AlignableMap.cc:9
TrackerAlignmentLevelBuilder trackerAlignmentLevelBuilder_
void buildPixelDetectorAlignable(const GeomDet *, int subdetId, Alignables &aliDets, Alignables &aliDetUnits)
Converts GeomDetUnits of PXB and PXE to AlignableDetUnits.
const AlignableObjectId& AlignableTrackerBuilder::objectIdProvider ( ) const
inline

Return tracker alignable object ID provider derived from the tracker's geometry.

Definition at line 36 of file AlignableTrackerBuilder.h.

References alignableObjectId_.

Referenced by AlignableTracker::AlignableTracker().

36 { return alignableObjectId_; }
const AlignableObjectId alignableObjectId_
const align::TrackerNameSpace& AlignableTrackerBuilder::trackerNameSpace ( ) const
inline

Return tracker name space derived from the tracker's topology.

Definition at line 31 of file AlignableTrackerBuilder.h.

References trackerAlignmentLevelBuilder_, and TrackerAlignmentLevelBuilder::trackerNameSpace().

Referenced by AlignableTracker::AlignableTracker().

31  {
const align::TrackerNameSpace & trackerNameSpace() const
TrackerAlignmentLevelBuilder trackerAlignmentLevelBuilder_

Member Data Documentation

AlignableMap* AlignableTrackerBuilder::alignableMap
private

Definition at line 70 of file AlignableTrackerBuilder.h.

const AlignableObjectId AlignableTrackerBuilder::alignableObjectId_
private

Definition at line 68 of file AlignableTrackerBuilder.h.

Referenced by objectIdProvider().

int AlignableTrackerBuilder::numDetUnits = 0
private

Definition at line 74 of file AlignableTrackerBuilder.h.

TrackerAlignmentLevelBuilder AlignableTrackerBuilder::trackerAlignmentLevelBuilder_
private

Definition at line 72 of file AlignableTrackerBuilder.h.

Referenced by trackerNameSpace().

const TrackerGeometry* AlignableTrackerBuilder::trackerGeometry
private

Definition at line 66 of file AlignableTrackerBuilder.h.

const TrackerTopology* AlignableTrackerBuilder::trackerTopology
private

Definition at line 67 of file AlignableTrackerBuilder.h.