CMS 3D CMS Logo

AlignableDTBarrel.cc
Go to the documentation of this file.
1 
8 #include <memory>
9 
14 
16 AlignableDTBarrel::AlignableDTBarrel(const std::vector<AlignableDTWheel*>& dtWheels)
17  : AlignableComposite(dtWheels[0]->id(), align::AlignableDTBarrel) {
18  theDTWheels.insert(theDTWheels.end(), dtWheels.begin(), dtWheels.end());
19 
20  // maintain also list of components
21  for (const auto& wheel : dtWheels) {
22  const auto mother = wheel->mother();
23  this->addComponent(wheel); // components will be deleted by dtor of AlignableComposite
24  wheel->setMother(mother); // restore previous behaviour where mother is not set
25  }
26 
29 }
30 
33  if (i >= size())
34  throw cms::Exception("LogicError") << "Wheel index (" << i << ") out of range";
35 
36  return *theDTWheels[i];
37 }
38 
43 }
44 
47  float zz = 0.;
48 
49  for (std::vector<AlignableDTWheel*>::iterator ilayer = theDTWheels.begin(); ilayer != theDTWheels.end(); ilayer++)
50  zz += (*ilayer)->globalPosition().z();
51 
52  zz /= static_cast<float>(theDTWheels.size());
53 
54  return PositionType(0.0, 0.0, zz);
55 }
56 
59 
61 std::ostream& operator<<(std::ostream& os, const AlignableDTBarrel& b) {
62  os << "This DTBarrel contains " << b.theDTWheels.size() << " Barrel wheels" << std::endl;
63  os << "(phi, r, z) = (" << b.globalPosition().phi() << "," << b.globalPosition().perp() << ","
64  << b.globalPosition().z();
65  os << "), orientation:" << std::endl << b.globalRotation() << std::endl;
66  return os;
67 }
68 
70 void AlignableDTBarrel::dump(void) const {
71  edm::LogInfo("AlignableDump") << (*this);
72  for (std::vector<AlignableDTWheel*>::const_iterator iWheel = theDTWheels.begin(); iWheel != theDTWheels.end();
73  iWheel++)
74  (*iWheel)->dump();
75 }
76 
77 //__________________________________________________________________________________________________
79  Alignments* m_alignments = new Alignments();
80 
81  // Add components recursively
82  for (const auto& i : this->components()) {
83  std::unique_ptr<Alignments> tmpAlignments{i->alignments()};
84  std::copy(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(), std::back_inserter(m_alignments->m_align));
85  }
86 
87  // sort by rawId
88  std::sort(m_alignments->m_align.begin(), m_alignments->m_align.end());
89 
90  return m_alignments;
91 }
92 
93 //__________________________________________________________________________________________________
95  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
96 
97  // Add components recursively
98  for (const auto& i : this->components()) {
99  std::unique_ptr<AlignmentErrorsExtended> tmpAlignmentErrorsExtended{i->alignmentErrors()};
100  std::copy(tmpAlignmentErrorsExtended->m_alignError.begin(),
101  tmpAlignmentErrorsExtended->m_alignError.end(),
102  std::back_inserter(m_alignmentErrors->m_alignError));
103  }
104 
105  // sort by rawId
106  std::sort(m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end());
107 
108  return m_alignmentErrors;
109 }
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
AlignmentErrorsExtended * alignmentErrors() const override
Return vector of alignment errors.
PositionType computePosition()
Compute average z position from all components (x and y forced to 0)
AlignableDTBarrel(const std::vector< AlignableDTWheel *> &dtWheels)
The constructor simply copies the vector of wheels and computes the surface from them.
const Alignables & components() const override
Return vector of direct components.
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
Alignments * alignments() const override
Return alignment data.
std::ostream & operator<<(std::ostream &os, const AlignableDTBarrel &b)
Output Half Barrel information.
RotationType computeOrientation()
Just initialize to default given by default constructor of a RotationType.
void setSurface(const AlignableSurface &s)
std::vector< AlignableDTWheel * > theDTWheels
AlignableDTWheel & wheel(int i)
Return AlignableBarrelLayer at given index.
AlignableSurface computeSurface()
Log< level::Info, false > LogInfo
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:94
std::vector< AlignTransformErrorExtended > m_alignError
double b
Definition: hdecay.h:120
align::RotationType RotationType
Definition: Alignable.h:31
int size() const
Return number of direct components.
Definition: Alignable.h:68
align::PositionType PositionType
Definition: Alignable.h:30
CompConstraintType compConstraintType_
Definition: Alignable.h:246
void addComponent(Alignable *component) final
void dump(void) const override
Recursive printout of the muon Barrel structure.