CMS 3D CMS Logo

AlignableCSCEndcap.cc
Go to the documentation of this file.
1 
9 #include <memory>
10 
16 
17 
19 AlignableCSCEndcap::AlignableCSCEndcap( const std::vector<AlignableCSCStation*>& cscStations )
20  : AlignableComposite(cscStations[0]->id(), align::AlignableCSCEndcap)
21 {
22 
23  theCSCStations.insert( theCSCStations.end(), cscStations.begin(), cscStations.end() );
24 
25  // maintain also list of components
26  for (const auto& station: cscStations) {
27  const auto mother = station->mother();
28  this->addComponent(station); // components will be deleted by dtor of AlignableComposite
29  station->setMother(mother); // restore previous behaviour where mother is not set
30  }
31 
34 }
35 
38 {
39 
40  if (i >= size() )
41  throw cms::Exception("LogicError") << "Station index (" << i << ") out of range";
42 
43  return *theCSCStations[i];
44 
45 }
46 
47 
51 {
52 
54 
55 }
56 
57 
58 
61 {
62 
63  float zz = 0.;
64 
65  for ( std::vector<AlignableCSCStation*>::iterator ilayer = theCSCStations.begin();
66  ilayer != theCSCStations.end(); ilayer++ )
67  zz += (*ilayer)->globalPosition().z();
68 
69  zz /= static_cast<float>(theCSCStations.size());
70 
71  return PositionType( 0.0, 0.0, zz );
72 
73 }
74 
75 
78 {
79  return RotationType();
80 }
81 
82 
84 std::ostream &operator << (std::ostream& os, const AlignableCSCEndcap& b )
85 {
86 
87  os << "This EndCap contains " << b.theCSCStations.size() << " CSC stations" << std::endl;
88  os << "(phi, r, z) = (" << b.globalPosition().phi() << ","
89  << b.globalPosition().perp() << "," << b.globalPosition().z();
90  os << "), orientation:" << std::endl<< b.globalRotation() << std::endl;
91  return os;
92 
93 }
94 
95 
97 void AlignableCSCEndcap::dump( void ) const
98 {
99 
100  edm::LogInfo("AlignableDump") << (*this);
101  for ( std::vector<AlignableCSCStation*>::const_iterator iLayer = theCSCStations.begin();
102  iLayer != theCSCStations.end(); iLayer++ )
103  (*iLayer)->dump();
104 
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  std::sort( m_alignments->m_align.begin(), m_alignments->m_align.end(),
122 
123  return m_alignments;
124 }
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 
const Alignables & components() const override
Return vector of direct components.
void dump(void) const override
Recursive printout of the muon End Cap structure.
T perp() const
Definition: PV3DBase.h:72
def copy(args, dbName)
friend std::ostream & operator<<(std::ostream &, const AlignableCSCEndcap &)
Printout muon End Cap information (not recursive)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Alignments * alignments() const override
Return alignment data.
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:141
AlignmentErrorsExtended * alignmentErrors() const override
Return vector of alignment errors.
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
void setSurface(const AlignableSurface &s)
AlignableSurface computeSurface()
T z() const
Definition: PV3DBase.h:64
RotationType computeOrientation()
Just initialize to default given by default constructor of a RotationType.
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:97
std::vector< AlignableCSCStation * > theCSCStations
std::vector< AlignTransformErrorExtended > m_alignError
double b
Definition: hdecay.h:120
align::RotationType RotationType
Definition: Alignable.h:34
align::PositionType PositionType
Definition: Alignable.h:33
PositionType computePosition()
Compute average z position from all components (x and y forced to 0)
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
AlignableCSCEndcap(const std::vector< AlignableCSCStation * > &cscStations)
The constructor simply copies the vector of stations and computes the surface from them...
void addComponent(Alignable *component) final
int size() const
Return number of direct components.
Definition: Alignable.h:71
AlignableCSCStation & station(int i)
Return AlignableCSCEndcap station at given index.