CMS 3D CMS Logo

AlignableDTBarrel.cc
Go to the documentation of this file.
1 
9 #include <memory>
10 
16 
17 
19 AlignableDTBarrel::AlignableDTBarrel( const std::vector<AlignableDTWheel*>& dtWheels )
20  : AlignableComposite(dtWheels[0]->id(), align::AlignableDTBarrel)
21 {
22 
23  theDTWheels.insert( theDTWheels.end(), dtWheels.begin(), dtWheels.end() );
24 
25  // maintain also list of components
26  for (const auto& wheel: dtWheels) {
27  const auto mother = wheel->mother();
28  this->addComponent(wheel); // components will be deleted by dtor of AlignableComposite
29  wheel->setMother(mother); // restore previous behaviour where mother is not set
30  }
31 
34 }
35 
36 
39 {
40 
41  if (i >= size() )
42  throw cms::Exception("LogicError") << "Wheel index (" << i << ") out of range";
43 
44  return *theDTWheels[i];
45 
46 }
47 
48 
52 {
53 
55 
56 }
57 
58 
59 
62 {
63 
64  float zz = 0.;
65 
66  for ( std::vector<AlignableDTWheel*>::iterator ilayer = theDTWheels.begin();
67  ilayer != theDTWheels.end(); ilayer++ )
68  zz += (*ilayer)->globalPosition().z();
69 
70  zz /= static_cast<float>(theDTWheels.size());
71 
72  return PositionType( 0.0, 0.0, zz );
73 
74 }
75 
76 
79 {
80  return RotationType();
81 }
82 
83 
84 
86 std::ostream &operator << (std::ostream& os, const AlignableDTBarrel& b )
87 {
88 
89  os << "This DTBarrel contains " << b.theDTWheels.size() << " Barrel wheels" << std::endl;
90  os << "(phi, r, z) = (" << b.globalPosition().phi() << ","
91  << b.globalPosition().perp() << "," << b.globalPosition().z();
92  os << "), orientation:" << std::endl<< b.globalRotation() << std::endl;
93  return os;
94 
95 }
96 
97 
99 void AlignableDTBarrel::dump( void ) const
100 {
101 
102  edm::LogInfo("AlignableDump") << (*this);
103  for ( std::vector<AlignableDTWheel*>::const_iterator iWheel = theDTWheels.begin();
104  iWheel != theDTWheels.end(); iWheel++ )
105  (*iWheel)->dump();
106 
107 }
108 
109 //__________________________________________________________________________________________________
111 {
112  Alignments* m_alignments = new Alignments();
113 
114  // Add components recursively
115  for (const auto& i: this->components()) {
116  std::unique_ptr<Alignments> tmpAlignments{i->alignments()};
117  std::copy(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(),
118  std::back_inserter(m_alignments->m_align));
119  }
120 
121  std::sort( m_alignments->m_align.begin(), m_alignments->m_align.end(),
123 
124  return m_alignments;
125 }
126 
127 //__________________________________________________________________________________________________
129 {
130  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
131 
132  // Add components recursively
133  for (const auto& i: this->components()) {
134  std::unique_ptr<AlignmentErrorsExtended> tmpAlignmentErrorsExtended{i->alignmentErrors()};
135  std::copy(tmpAlignmentErrorsExtended->m_alignError.begin(), tmpAlignmentErrorsExtended->m_alignError.end(),
136  std::back_inserter(m_alignmentErrors->m_alignError));
137  }
138 
139  std::sort( m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end(),
141 
142  return m_alignmentErrors;
143 }
144 
145 
const Alignables & components() const override
Return vector of direct components.
PositionType computePosition()
Compute average z position from all components (x and y forced to 0)
T perp() const
Definition: PV3DBase.h:72
def copy(args, dbName)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:141
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
friend std::ostream & operator<<(std::ostream &, const AlignableDTBarrel &)
Printout muon Barrel information (not recursive)
AlignableDTBarrel(const std::vector< AlignableDTWheel * > &dtWheels)
The constructor simply copies the vector of wheels and computes the surface from them.
RotationType computeOrientation()
Just initialize to default given by default constructor of a RotationType.
void setSurface(const AlignableSurface &s)
Alignments * alignments() const override
Return alignment data.
T z() const
Definition: PV3DBase.h:64
std::vector< AlignableDTWheel * > theDTWheels
AlignableDTWheel & wheel(int i)
Return AlignableBarrelLayer at given index.
AlignableSurface computeSurface()
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:97
void dump(void) const override
Recursive printout of the muon Barrel structure.
std::vector< AlignTransformErrorExtended > m_alignError
AlignmentErrorsExtended * alignmentErrors() const override
Return vector of alignment errors.
double b
Definition: hdecay.h:120
align::RotationType RotationType
Definition: Alignable.h:34
align::PositionType PositionType
Definition: Alignable.h:33
CompConstraintType compConstraintType_
Definition: Alignable.h:255
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:94
void addComponent(Alignable *component) final
int size() const
Return number of direct components.
Definition: Alignable.h:71