CMS 3D CMS Logo

AlignableDTBarrel.cc
Go to the documentation of this file.
1 
9 #include <memory>
10 
15 
16 
18 AlignableDTBarrel::AlignableDTBarrel( const std::vector<AlignableDTWheel*>& dtWheels )
19  : AlignableComposite(dtWheels[0]->id(), align::AlignableDTBarrel)
20 {
21 
22  theDTWheels.insert( theDTWheels.end(), dtWheels.begin(), dtWheels.end() );
23 
24  // maintain also list of components
25  for (const auto& wheel: dtWheels) {
26  const auto mother = wheel->mother();
27  this->addComponent(wheel); // components will be deleted by dtor of AlignableComposite
28  wheel->setMother(mother); // restore previous behaviour where mother is not set
29  }
30 
33 }
34 
35 
38 {
39 
40  if (i >= size() )
41  throw cms::Exception("LogicError") << "Wheel index (" << i << ") out of range";
42 
43  return *theDTWheels[i];
44 
45 }
46 
47 
51 {
52 
54 
55 }
56 
57 
58 
61 {
62 
63  float zz = 0.;
64 
65  for ( std::vector<AlignableDTWheel*>::iterator ilayer = theDTWheels.begin();
66  ilayer != theDTWheels.end(); ilayer++ )
67  zz += (*ilayer)->globalPosition().z();
68 
69  zz /= static_cast<float>(theDTWheels.size());
70 
71  return PositionType( 0.0, 0.0, zz );
72 
73 }
74 
75 
78 {
79  return RotationType();
80 }
81 
82 
83 
85 std::ostream &operator << (std::ostream& os, const AlignableDTBarrel& b )
86 {
87 
88  os << "This DTBarrel contains " << b.theDTWheels.size() << " Barrel wheels" << std::endl;
89  os << "(phi, r, z) = (" << b.globalPosition().phi() << ","
90  << b.globalPosition().perp() << "," << b.globalPosition().z();
91  os << "), orientation:" << std::endl<< b.globalRotation() << std::endl;
92  return os;
93 
94 }
95 
96 
98 void AlignableDTBarrel::dump( void ) const
99 {
100 
101  edm::LogInfo("AlignableDump") << (*this);
102  for ( std::vector<AlignableDTWheel*>::const_iterator iWheel = theDTWheels.begin();
103  iWheel != theDTWheels.end(); iWheel++ )
104  (*iWheel)->dump();
105 
106 }
107 
108 //__________________________________________________________________________________________________
110 {
111  Alignments* m_alignments = new Alignments();
112 
113  // Add components recursively
114  for (const auto& i: this->components()) {
115  std::unique_ptr<Alignments> tmpAlignments{i->alignments()};
116  std::copy(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(),
117  std::back_inserter(m_alignments->m_align));
118  }
119 
120  // sort by rawId
121  std::sort( m_alignments->m_align.begin(), m_alignments->m_align.end());
122 
123  return m_alignments;
124 }
125 
126 //__________________________________________________________________________________________________
128 {
129  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
130 
131  // Add components recursively
132  for (const auto& i: this->components()) {
133  std::unique_ptr<AlignmentErrorsExtended> tmpAlignmentErrorsExtended{i->alignmentErrors()};
134  std::copy(tmpAlignmentErrorsExtended->m_alignError.begin(), tmpAlignmentErrorsExtended->m_alignError.end(),
135  std::back_inserter(m_alignmentErrors->m_alignError));
136  }
137 
138  // sort by rawId
139  std::sort( m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end());
140 
141  return m_alignmentErrors;
142 }
143 
144 
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