CMS 3D CMS Logo

AlignableCSCEndcap.cc
Go to the documentation of this file.
1 
14 
15 
17 AlignableCSCEndcap::AlignableCSCEndcap( const std::vector<AlignableCSCStation*>& cscStations )
18  : AlignableComposite(cscStations[0]->id(), align::AlignableCSCEndcap)
19 {
20 
21  theCSCStations.insert( theCSCStations.end(), cscStations.begin(), cscStations.end() );
22 
25 }
26 
27 
30 {
31  for ( std::vector<AlignableCSCStation*>::iterator iter = theCSCStations.begin();
32  iter != theCSCStations.end(); iter++)
33  delete *iter;
34 
35 }
36 
39 {
40 
41  if (i >= size() )
42  throw cms::Exception("LogicError") << "Station index (" << i << ") out of range";
43 
44  return *theCSCStations[i];
45 
46 }
47 
48 
52 {
53 
55 
56 }
57 
58 
59 
62 {
63 
64  float zz = 0.;
65 
66  for ( std::vector<AlignableCSCStation*>::iterator ilayer = theCSCStations.begin();
67  ilayer != theCSCStations.end(); ilayer++ )
68  zz += (*ilayer)->globalPosition().z();
69 
70  zz /= static_cast<float>(theCSCStations.size());
71 
72  return PositionType( 0.0, 0.0, zz );
73 
74 }
75 
76 
79 {
80  return RotationType();
81 }
82 
83 
85 std::ostream &operator << (std::ostream& os, const AlignableCSCEndcap& b )
86 {
87 
88  os << "This EndCap contains " << b.theCSCStations.size() << " CSC stations" << 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 AlignableCSCEndcap::dump( void ) const
99 {
100 
101  edm::LogInfo("AlignableDump") << (*this);
102  for ( std::vector<AlignableCSCStation*>::const_iterator iLayer = theCSCStations.begin();
103  iLayer != theCSCStations.end(); iLayer++ )
104  (*iLayer)->dump();
105 
106 }
107 
108 //__________________________________________________________________________________________________
109 
111 {
112 
113  std::vector<Alignable*> comp = this->components();
114  Alignments* m_alignments = new Alignments();
115  // Add components recursively
116  for ( std::vector<Alignable*>::iterator i=comp.begin(); i!=comp.end(); i++ )
117  {
118  Alignments* tmpAlignments = (*i)->alignments();
119  std::copy( tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(),
120  std::back_inserter(m_alignments->m_align) );
121  delete tmpAlignments;
122  }
123 
124  std::sort( m_alignments->m_align.begin(), m_alignments->m_align.end(),
126 
127  return m_alignments;
128 
129 }
130 
131 //__________________________________________________________________________________________________
132 
134 {
135 
136  std::vector<Alignable*> comp = this->components();
137  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
138 
139  // Add components recursively
140  for ( std::vector<Alignable*>::iterator i=comp.begin(); i!=comp.end(); i++ )
141  {
142  AlignmentErrorsExtended* tmpAlignmentErrorsExtended = (*i)->alignmentErrors();
143  std::copy( tmpAlignmentErrorsExtended->m_alignError.begin(), tmpAlignmentErrorsExtended->m_alignError.end(),
144  std::back_inserter(m_alignmentErrors->m_alignError) );
145  delete tmpAlignmentErrorsExtended;
146  }
147 
148  std::sort( m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end(),
150 
151  return m_alignmentErrors;
152 
153 }
154 
void dump(void) const override
Recursive printout of the muon End Cap structure.
T perp() const
Definition: PV3DBase.h:72
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
std::vector< Alignable * > components() const override
Return vector of direct components.
void setSurface(const AlignableSurface &s)
AlignableSurface computeSurface()
T z() const
Definition: PV3DBase.h:64
~AlignableCSCEndcap() override
Clean delete of the vector and its elements.
RotationType computeOrientation()
Just initialize to default given by default constructor of a RotationType.
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:252
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
AlignableCSCEndcap(const std::vector< AlignableCSCStation * > &cscStations)
The constructor simply copies the vector of stations and computes the surface from them...
int size() const
Return number of direct components.
Definition: Alignable.h:71
AlignableCSCStation & station(int i)
Return AlignableCSCEndcap station at given index.